function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFee = taxFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
_liquidityFee = liquidityFee;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
_maxTxAmount = _tTotal.mul(maxTxPercent).div(
10**2
);
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
//to recieve ETH from uniswapV2Router when swaping
receive() external payable {}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity);
return (tTransferAmount, tFee, tLiquidity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
May 21, 2021, 5:07 PM
0x139e2b3ebfa683faf39d22d065a7e5bedca5128b
testenet
bsv
bsc
yes
BEP20.sol:759:9: ParserError: Expected ';' but got identifier uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) ^-----------^
May 21, 2021, 5:17 PM
you forgot one ';'
Put that
May 21, 2021, 5:19 PM
constructor () public {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router01 _uniswapV2Router = IUniswapV2Router01(0xD99D1c33F9fC3444f8101754aBC46c52416550D1);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
"IUniswapV2Router01 _uniswapV2Router = "
//exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router01 _uniswapV2Router = IUniswapV2Router01(0xD99D1c33F9fC3444f8101754aBC46c52416550D1);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
"IUniswapV2Router01 _uniswapV2Router = "
//exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
not working
May 21, 2021, 5:23 PM
_rOwned[_msgSender()] = _rTotal;?
whata
That's wrong
_balances[_msgSender()] = _tTotal;
aannd
?
May 21, 2021, 5:26 PM
That simply won’t work.
May 21, 2021, 5:26 PM
I use v1 and It work ...
May 21, 2021, 5:27 PM
impossible man
v1 on testnet?😝
May 21, 2021, 5:28 PM
?
sry hahaha
May 21, 2021, 5:29 PM
ohh yes that was the problem
so 0xD99D1c33F9fC3444f8101754aBC46c52416550D1 is for testnet?
May 21, 2021, 5:31 PM
ya
May 21, 2021, 5:31 PM
for mainnet?
May 21, 2021, 5:31 PM
0x10ED43C718714eb63d5aA57B78B54704E256024E
May 21, 2021, 5:31 PM
ohhh thank you
May 21, 2021, 5:31 PM
hey you're welcome =D
May 21, 2021, 5:32 PM
Greetings from Greece!
May 21, 2021, 5:32 PM
Guys
if yoi want use the function to change router address in future
you cam find on OpenZeppelin
May 21, 2021, 5:33 PM
Do you recommend use It?
May 21, 2021, 5:35 PM
sure
otherwise you will do Safemoon end
May 21, 2021, 5:35 PM
Would you mind saying about?
I'm studying to create a good contract
or send me some source
May 21, 2021, 5:38 PM
check OpenZeppelin
best source
May 21, 2021, 5:40 PM
ok thanks bro
May 21, 2021, 5:40 PM
Safemoon is on github but code looks strange
May 21, 2021, 5:40 PM
I read the code
That's so strange
May 21, 2021, 5:41 PM
Yes too much references to eth for a bsc code
May 21, 2021, 5:43 PM
I found you hahaha
May 21, 2021, 5:49 PM
nice
May 21, 2021, 5:49 PM
It's too complex tbh
But it does the job, nice work Freezy
May 21, 2021, 6:05 PM
I hope it will be useful
May 21, 2021, 6:30 PM
Lol
May 21, 2021, 7:40 PM