├── README.md ├── BEMU_update.sol └── BEMU.sol /README.md: -------------------------------------------------------------------------------- 1 | Token Name: BEMU 2 | 3 | • Symbol: BEMU 4 | • Total Supply: 3,140,000,000 (3.14 billion) 5 | • Decimals: 18 6 | 7 | Buy Fees (6% Total): 8 | • 4% Liquidity: 9 | • 1% Marketing 10 | • 1% Buyback-and-Burn 11 | 12 | Sell Fees (12% Total): 13 | • 6% Liquidity: 14 | • 4% Marketing 15 | • 2% Buyback-and-Burn 16 | 17 | Reflection mechanism: 18 | • A percentage of every transaction (buy, sell, or transfer) is redistributed automatically to all eligible token holders based on their share of the total supply. 19 | • Exclusion wallets (e.g., liquidity pool, marketing wallet) are excluded from receiving reflections. 20 | 21 | Swap-liquidify mechanism: 22 | • Liquidity fees (4% buy, 5% sell) will be used to grow the liquidity pool over time via a swap-and-liquify mechanism swap to Eth. 23 | Transaction Limits: 24 | 25 | Anit-whale Mechanism: 26 | • Maximum Transaction Size: 2% of the total supply per transaction. 27 | • Add an additional 2% fee for transactions exceeding 0.5% of the total supply (15.7 million BEMU). 28 | 29 | Market wallet: 0xc972a554ea75ebBF1DbaDc77F376BD77768B3429 30 | UniswapV2Router: 0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24 31 | 32 | UniswapV2Pair: 0x1b175dE4283E392e8eD7b68922D4530BD1519b6d 33 | 34 | BEMU: 0x170C045cfDbaA5EeDe7d0E6b1892875570111719 35 | -------------------------------------------------------------------------------- /BEMU_update.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | import "@openzeppelin/contracts/utils/math/SafeMath.sol"; 5 | 6 | contract ERC20 { 7 | string public name; 8 | string public symbol; 9 | uint8 public decimals; 10 | uint256 public totalSupply; 11 | 12 | mapping(address => uint256) private _balances; 13 | mapping(address => mapping(address => uint256)) private _allowances; 14 | 15 | event Transfer(address indexed from, address indexed to, uint256 value); 16 | event Approval( 17 | address indexed owner, 18 | address indexed spender, 19 | uint256 value 20 | ); 21 | 22 | constructor(string memory _name, string memory _symbol) { 23 | name = _name; 24 | symbol = _symbol; 25 | decimals = 18; // Standard decimals 26 | } 27 | 28 | function balanceOf(address account) public view returns (uint256) { 29 | return _balances[account]; 30 | } 31 | 32 | function transfer(address recipient, uint256 amount) public returns (bool) { 33 | _transfer(msg.sender, recipient, amount); 34 | return true; 35 | } 36 | 37 | function allowance(address owner, address spender) 38 | public 39 | view 40 | returns (uint256) 41 | { 42 | return _allowances[owner][spender]; 43 | } 44 | 45 | function approve(address spender, uint256 amount) public returns (bool) { 46 | _approve(msg.sender, spender, amount); 47 | return true; 48 | } 49 | 50 | function transferFrom( 51 | address sender, 52 | address recipient, 53 | uint256 amount 54 | ) public returns (bool) { 55 | _transfer(sender, recipient, amount); 56 | _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount); 57 | return true; 58 | } 59 | 60 | function _transfer( 61 | address sender, 62 | address recipient, 63 | uint256 amount 64 | ) internal virtual { 65 | require(sender != address(0), "ERC20: transfer from the zero address"); 66 | require(recipient != address(0), "ERC20: transfer to the zero address"); 67 | 68 | _balances[sender] -= amount; 69 | _balances[recipient] += amount; 70 | 71 | emit Transfer(sender, recipient, amount); 72 | } 73 | 74 | function _approve( 75 | address owner, 76 | address spender, 77 | uint256 amount 78 | ) internal virtual { 79 | require(owner != address(0), "ERC20: approve from the zero address"); 80 | require(spender != address(0), "ERC20: approve to the zero address"); 81 | 82 | _allowances[owner][spender] = amount; 83 | 84 | emit Approval(owner, spender, amount); 85 | } 86 | 87 | function _mint(address account, uint256 amount) internal virtual { 88 | require(account != address(0), "ERC20: mint to the zero address"); 89 | 90 | totalSupply += amount; 91 | _balances[account] += amount; 92 | 93 | emit Transfer(address(0), account, amount); 94 | } 95 | 96 | function _burn(address account, uint256 amount) internal { 97 | require(account != address(0), "ERC20: burn from the zero address"); 98 | require( 99 | _balances[account] >= amount, 100 | "ERC20: burn amount exceeds balance" 101 | ); 102 | 103 | _balances[account] -= amount; 104 | totalSupply -= amount; 105 | emit Transfer(account, address(0), amount); 106 | } 107 | } 108 | 109 | contract Ownable { 110 | address private _owner; 111 | 112 | event OwnershipTransferred( 113 | address indexed previousOwner, 114 | address indexed newOwner 115 | ); 116 | 117 | constructor() { 118 | _owner = msg.sender; 119 | emit OwnershipTransferred(address(0), _owner); 120 | } 121 | 122 | modifier onlyOwner() { 123 | require(owner() == msg.sender, "Ownable: caller is not the owner"); 124 | _; 125 | } 126 | 127 | function owner() public view returns (address) { 128 | return _owner; 129 | } 130 | 131 | function transferOwnership(address newOwner) public onlyOwner { 132 | require( 133 | newOwner != address(0), 134 | "Ownable: new owner is the zero address" 135 | ); 136 | emit OwnershipTransferred(_owner, newOwner); 137 | _owner = newOwner; 138 | } 139 | } 140 | 141 | interface IUniswapV2Router01 { 142 | function factory() external pure returns (address); 143 | 144 | function WETH() external pure returns (address); 145 | 146 | function addLiquidity( 147 | address tokenA, 148 | address tokenB, 149 | uint256 amountADesired, 150 | uint256 amountBDesired, 151 | uint256 amountAMin, 152 | uint256 amountBMin, 153 | address to, 154 | uint256 deadline 155 | ) 156 | external 157 | returns ( 158 | uint256 amountA, 159 | uint256 amountB, 160 | uint256 liquidity 161 | ); 162 | 163 | function addLiquidityETH( 164 | address token, 165 | uint256 amountTokenDesired, 166 | uint256 amountTokenMin, 167 | uint256 amountETHMin, 168 | address to, 169 | uint256 deadline 170 | ) 171 | external 172 | payable 173 | returns ( 174 | uint256 amountToken, 175 | uint256 amountETH, 176 | uint256 liquidity 177 | ); 178 | 179 | function removeLiquidity( 180 | address tokenA, 181 | address tokenB, 182 | uint256 liquidity, 183 | uint256 amountAMin, 184 | uint256 amountBMin, 185 | address to, 186 | uint256 deadline 187 | ) external returns (uint256 amountA, uint256 amountB); 188 | 189 | function removeLiquidityETH( 190 | address token, 191 | uint256 liquidity, 192 | uint256 amountTokenMin, 193 | uint256 amountETHMin, 194 | address to, 195 | uint256 deadline 196 | ) external returns (uint256 amountToken, uint256 amountETH); 197 | 198 | function removeLiquidityWithPermit( 199 | address tokenA, 200 | address tokenB, 201 | uint256 liquidity, 202 | uint256 amountAMin, 203 | uint256 amountBMin, 204 | address to, 205 | uint256 deadline, 206 | bool approveMax, 207 | uint8 v, 208 | bytes32 r, 209 | bytes32 s 210 | ) external returns (uint256 amountA, uint256 amountB); 211 | 212 | function removeLiquidityETHWithPermit( 213 | address token, 214 | uint256 liquidity, 215 | uint256 amountTokenMin, 216 | uint256 amountETHMin, 217 | address to, 218 | uint256 deadline, 219 | bool approveMax, 220 | uint8 v, 221 | bytes32 r, 222 | bytes32 s 223 | ) external returns (uint256 amountToken, uint256 amountETH); 224 | 225 | function swapExactTokensForTokens( 226 | uint256 amountIn, 227 | uint256 amountOutMin, 228 | address[] calldata path, 229 | address to, 230 | uint256 deadline 231 | ) external returns (uint256[] memory amounts); 232 | 233 | function swapTokensForExactTokens( 234 | uint256 amountOut, 235 | uint256 amountInMax, 236 | address[] calldata path, 237 | address to, 238 | uint256 deadline 239 | ) external returns (uint256[] memory amounts); 240 | 241 | function swapExactETHForTokens( 242 | uint256 amountOutMin, 243 | address[] calldata path, 244 | address to, 245 | uint256 deadline 246 | ) external payable returns (uint256[] memory amounts); 247 | 248 | function swapTokensForExactETH( 249 | uint256 amountOut, 250 | uint256 amountInMax, 251 | address[] calldata path, 252 | address to, 253 | uint256 deadline 254 | ) external returns (uint256[] memory amounts); 255 | 256 | function swapExactTokensForETH( 257 | uint256 amountIn, 258 | uint256 amountOutMin, 259 | address[] calldata path, 260 | address to, 261 | uint256 deadline 262 | ) external returns (uint256[] memory amounts); 263 | 264 | function swapETHForExactTokens( 265 | uint256 amountOut, 266 | address[] calldata path, 267 | address to, 268 | uint256 deadline 269 | ) external payable returns (uint256[] memory amounts); 270 | 271 | function quote( 272 | uint256 amountA, 273 | uint256 reserveA, 274 | uint256 reserveB 275 | ) external pure returns (uint256 amountB); 276 | 277 | function getAmountOut( 278 | uint256 amountIn, 279 | uint256 reserveIn, 280 | uint256 reserveOut 281 | ) external pure returns (uint256 amountOut); 282 | 283 | function getAmountIn( 284 | uint256 amountOut, 285 | uint256 reserveIn, 286 | uint256 reserveOut 287 | ) external pure returns (uint256 amountIn); 288 | 289 | function getAmountsOut(uint256 amountIn, address[] calldata path) 290 | external 291 | view 292 | returns (uint256[] memory amounts); 293 | 294 | function getAmountsIn(uint256 amountOut, address[] calldata path) 295 | external 296 | view 297 | returns (uint256[] memory amounts); 298 | } 299 | 300 | interface IUniswapV2Router02 is IUniswapV2Router01 { 301 | function removeLiquidityETHSupportingFeeOnTransferTokens( 302 | address token, 303 | uint256 liquidity, 304 | uint256 amountTokenMin, 305 | uint256 amountETHMin, 306 | address to, 307 | uint256 deadline 308 | ) external returns (uint256 amountETH); 309 | 310 | function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( 311 | address token, 312 | uint256 liquidity, 313 | uint256 amountTokenMin, 314 | uint256 amountETHMin, 315 | address to, 316 | uint256 deadline, 317 | bool approveMax, 318 | uint8 v, 319 | bytes32 r, 320 | bytes32 s 321 | ) external returns (uint256 amountETH); 322 | 323 | function swapExactTokensForTokensSupportingFeeOnTransferTokens( 324 | uint256 amountIn, 325 | uint256 amountOutMin, 326 | address[] calldata path, 327 | address to, 328 | uint256 deadline 329 | ) external; 330 | 331 | function swapExactETHForTokensSupportingFeeOnTransferTokens( 332 | uint256 amountOutMin, 333 | address[] calldata path, 334 | address to, 335 | uint256 deadline 336 | ) external payable; 337 | 338 | function swapExactTokensForETHSupportingFeeOnTransferTokens( 339 | uint256 amountIn, 340 | uint256 amountOutMin, 341 | address[] calldata path, 342 | address to, 343 | uint256 deadline 344 | ) external; 345 | } 346 | 347 | contract BemuToken is ERC20, Ownable { 348 | using SafeMath for uint256; 349 | 350 | uint256 private BUY_LIQUIDITY_FEE = 4; // 4% 351 | uint256 private BUY_MARKETING_FEE = 1; // 1% 352 | uint256 private BUY_BUYBACK_FEE = 1; // 1% 353 | uint256 constant MAX_BUY_FEE_TOTAL = 10; //the total buy fee is 10% maximum 354 | uint256 private SELL_LIQUIDITY_FEE = 6; // 6% 355 | uint256 private SELL_MARKETING_FEE = 4; // 4% 356 | uint256 private SELL_BUYBACK_FEE = 2; // 2% 357 | uint256 constant MAX_SELL_FEE_TOTAL = 15; //the total buy fee is 10% maximum 358 | 359 | event SetFees( 360 | uint256 BUY_LIQUIDITY_FEE, 361 | uint256 BUY_MARKETING_FEE, 362 | uint256 BUY_BUYBACK_FEE, 363 | uint256 SELL_LIQUIDITY_FEE, 364 | uint256 SELL_MARKETING_FEE, 365 | uint256 SELL_BUYBACK_FEE 366 | ); 367 | event UpdateThresholds(uint256 buybackThreshold, uint256 liquidityThreshold); 368 | event MaxTransactionAmountUpdated(uint256 maxTransactionAmount); 369 | event MaxWalletHoldingUpdated(uint256 maxWalletHolding); 370 | 371 | address public marketingWallet; 372 | 373 | mapping(address => bool) public isExcludedFromFees; 374 | mapping(address => bool) public isPair; 375 | 376 | uint256 public buybackThreshold = 200000000 * 10**18; // Threshold to perform buyback 377 | uint256 public liquidityThreshold = 100000000 * 10**18; // Threshold to provide liquidity 378 | 379 | bool private inSwapAndLiquify; 380 | 381 | modifier lockTheSwap() { 382 | inSwapAndLiquify = true; 383 | _; 384 | inSwapAndLiquify = false; 385 | } 386 | 387 | uint256 public buybackPool; 388 | uint256 public liquidityPool; 389 | 390 | // Anti-whale variables 391 | uint256 public maxTransactionAmount; 392 | uint256 public maxWalletHolding; 393 | 394 | IUniswapV2Router02 public uniswapRouter; 395 | 396 | constructor(address _marketingWallet) 397 | ERC20("BEMU", "BEMU") 398 | { 399 | marketingWallet = _marketingWallet; 400 | _mint(msg.sender, 3_140_000_000 * 10**decimals); // Mint 3.14B tokens 401 | 402 | excludeFromFees(msg.sender, true); 403 | excludeFromFees(address(this), true); 404 | } 405 | 406 | function _transfer( 407 | address sender, 408 | address recipient, 409 | uint256 amount 410 | ) internal override { 411 | require(amount <= maxTransactionAmount, "Transfer amount exceeds the max transaction limit"); 412 | require(balanceOf(recipient) + amount <= maxWalletHolding, "Recipient wallet exceeds the max holding limit"); 413 | if (isExcludedFromFees[sender] || isExcludedFromFees[recipient]) { 414 | super._transfer(sender, recipient, amount); 415 | return; 416 | } 417 | 418 | uint256 totalFee; 419 | uint256 marketingFee; 420 | uint256 liquidityFee; 421 | uint256 buybackFee; 422 | 423 | if (isPair[sender]) { 424 | // Buy fees 425 | marketingFee = (amount * BUY_MARKETING_FEE) / 100; 426 | liquidityFee = (amount * BUY_LIQUIDITY_FEE) / 100; 427 | buybackFee = (amount * BUY_BUYBACK_FEE) / 100; 428 | } else if (isPair[recipient]) { 429 | // Sell fees 430 | marketingFee = (amount * SELL_MARKETING_FEE) / 100; 431 | liquidityFee = (amount * SELL_LIQUIDITY_FEE) / 100; 432 | buybackFee = (amount * SELL_BUYBACK_FEE) / 100; 433 | } 434 | 435 | totalFee = marketingFee + liquidityFee + buybackFee; 436 | 437 | if (totalFee > 0) { 438 | // Transfer marketing fee directly to the marketing wallet 439 | if (marketingFee > 0) { 440 | super._transfer(sender, marketingWallet, marketingFee); 441 | } 442 | 443 | // Accumulate liquidity and buyback fees 444 | liquidityPool += liquidityFee; 445 | buybackPool += buybackFee; 446 | 447 | // Transfer the remaining fees to the contract 448 | super._transfer(sender, address(this), totalFee - marketingFee); 449 | } 450 | 451 | if ( 452 | !inSwapAndLiquify && 453 | liquidityPool >= liquidityThreshold && 454 | !isPair[sender] 455 | ) { 456 | provideLiquidity(); 457 | } 458 | if (buybackPool >= buybackThreshold) { 459 | performBuybackAndBurn(); 460 | } 461 | // Transfer the remaining tokens to the recipient 462 | super._transfer(sender, recipient, amount - totalFee); 463 | } 464 | 465 | function provideLiquidity() private lockTheSwap { 466 | uint256 half = liquidityPool.div(2); 467 | uint256 otherHalf = liquidityPool.sub(half); 468 | 469 | uint256 initialBalance = address(this).balance; 470 | 471 | // Swap tokens for ETH 472 | swapTokensForEth(half); 473 | 474 | uint256 newBalance = address(this).balance.sub(initialBalance); 475 | 476 | // Add liquidity 477 | addLiquidity(otherHalf, newBalance); 478 | 479 | liquidityPool = 0; // Reset pool 480 | } 481 | 482 | function performBuybackAndBurn() private { 483 | if (liquidityPool == 0) { 484 | super._burn(address(this), balanceOf(address(this))); 485 | buybackPool = 0; 486 | } else { 487 | super._burn(address(this), buybackPool); // Burn tokens 488 | buybackPool = 0; // Reset pool 489 | } 490 | } 491 | 492 | function swapTokensForEth(uint256 tokenAmount) private { 493 | address[] memory path = new address[](2); 494 | path[0] = address(this); 495 | path[1] = uniswapRouter.WETH(); 496 | 497 | _approve(address(this), address(uniswapRouter), tokenAmount); 498 | 499 | uniswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens( 500 | tokenAmount, 501 | 0, // Accept any amount of ETH 502 | path, 503 | address(this), 504 | block.timestamp 505 | ); 506 | } 507 | 508 | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { 509 | _approve(address(this), address(uniswapRouter), tokenAmount); 510 | 511 | uniswapRouter.addLiquidityETH{value: ethAmount}( 512 | address(this), 513 | tokenAmount, 514 | 0, // Min tokens 515 | 0, // Min ETH 516 | owner(), 517 | block.timestamp 518 | ); 519 | } 520 | 521 | function excludeFromFees(address account, bool excluded) public onlyOwner { 522 | isExcludedFromFees[account] = excluded; 523 | } 524 | 525 | function setFees( 526 | uint256 _BUY_LIQUIDITY_FEE, 527 | uint256 _BUY_MARKETING_FEE, 528 | uint256 _BUY_BUYBACK_FEE, 529 | uint256 _SELL_LIQUIDITY_FEE, 530 | uint256 _SELL_MARKETING_FEE, 531 | uint256 _SELL_BUYBACK_FEE 532 | ) external onlyOwner { 533 | require( 534 | _BUY_LIQUIDITY_FEE + _BUY_MARKETING_FEE + _BUY_BUYBACK_FEE <= MAX_BUY_FEE_TOTAL, 535 | "Buy total fees exceed the maximum limit of 15%" 536 | ); 537 | require( 538 | _SELL_LIQUIDITY_FEE + _SELL_MARKETING_FEE + _SELL_BUYBACK_FEE <= MAX_SELL_FEE_TOTAL, 539 | "Sell total fees exceed the maximum limit of 15%" 540 | ); 541 | BUY_LIQUIDITY_FEE = _BUY_LIQUIDITY_FEE; 542 | BUY_MARKETING_FEE = _BUY_MARKETING_FEE; 543 | BUY_BUYBACK_FEE = _BUY_BUYBACK_FEE; 544 | SELL_LIQUIDITY_FEE = _SELL_LIQUIDITY_FEE; 545 | SELL_MARKETING_FEE = _SELL_MARKETING_FEE; 546 | SELL_BUYBACK_FEE = _SELL_BUYBACK_FEE; 547 | 548 | //Emit the FeesUpdated event 549 | emit SetFees( 550 | _BUY_LIQUIDITY_FEE, 551 | _BUY_MARKETING_FEE, 552 | _BUY_BUYBACK_FEE, 553 | _SELL_LIQUIDITY_FEE, 554 | _SELL_MARKETING_FEE, 555 | _SELL_BUYBACK_FEE 556 | ); 557 | } 558 | 559 | function getFees() external view returns ( 560 | uint256 buyLiquidityFee, 561 | uint256 buyMarketingFee, 562 | uint256 buyBuybackFee, 563 | uint256 sellLiquidityFee, 564 | uint256 sellMarketingFee, 565 | uint256 sellBuybackFee 566 | ) 567 | { 568 | return ( 569 | BUY_LIQUIDITY_FEE, 570 | BUY_MARKETING_FEE, 571 | BUY_BUYBACK_FEE, 572 | SELL_LIQUIDITY_FEE, 573 | SELL_MARKETING_FEE, 574 | SELL_BUYBACK_FEE 575 | ); 576 | } 577 | 578 | function setUniswapRouter(address _uniswapRouter) external onlyOwner { 579 | uniswapRouter = IUniswapV2Router02(_uniswapRouter); 580 | } 581 | 582 | function setPair(address pair, bool value) external onlyOwner { 583 | isPair[pair] = value; 584 | } 585 | 586 | function updateThresholds( 587 | uint256 _buybackThreshold, 588 | uint256 _liquidityThreshold 589 | ) external onlyOwner { 590 | buybackThreshold = _buybackThreshold; 591 | liquidityThreshold = _liquidityThreshold; 592 | 593 | emit UpdateThresholds(_buybackThreshold, _liquidityThreshold); 594 | } 595 | 596 | function updateMaxTransactionAmount(uint256 percentage) external onlyOwner { 597 | require(percentage <= 100, "Percentage must be under 100"); // Ensure the percentage is reasonable (1% to 100%) 598 | maxTransactionAmount = (totalSupply * percentage) / 100; 599 | emit MaxTransactionAmountUpdated(maxTransactionAmount); 600 | } 601 | 602 | function updateMaxWalletHolding(uint256 percentage) external onlyOwner { 603 | require(percentage <= 100, "Percentage must be under 100"); // Ensure the percentage is reasonable (1% to 100%) 604 | maxWalletHolding = (totalSupply * percentage) / 100; 605 | emit MaxWalletHoldingUpdated(maxWalletHolding); 606 | } 607 | 608 | receive() external payable {} 609 | } 610 | -------------------------------------------------------------------------------- /BEMU.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.12; 2 | // SPDX-License-Identifier: Unlicensed 3 | interface IERC20 { 4 | 5 | function totalSupply() external view returns (uint256); 6 | 7 | /** 8 | * @dev Returns the amount of tokens owned by `account`. 9 | */ 10 | function balanceOf(address account) external view returns (uint256); 11 | 12 | /** 13 | * @dev Moves `amount` tokens from the caller's account to `recipient`. 14 | * 15 | * Returns a boolean value indicating whether the operation succeeded. 16 | * 17 | * Emits a {Transfer} event. 18 | */ 19 | function transfer(address recipient, uint256 amount) external returns (bool); 20 | 21 | /** 22 | * @dev Returns the remaining number of tokens that `spender` will be 23 | * allowed to spend on behalf of `owner` through {transferFrom}. This is 24 | * zero by default. 25 | * 26 | * This value changes when {approve} or {transferFrom} are called. 27 | */ 28 | function allowance(address owner, address spender) external view returns (uint256); 29 | 30 | /** 31 | * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. 32 | * 33 | * Returns a boolean value indicating whether the operation succeeded. 34 | * 35 | * IMPORTANT: Beware that changing an allowance with this method brings the risk 36 | * that someone may use both the old and the new allowance by unfortunate 37 | * transaction ordering. One possible solution to mitigate this race 38 | * condition is to first reduce the spender's allowance to 0 and set the 39 | * desired value afterwards: 40 | * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 41 | * 42 | * Emits an {Approval} event. 43 | */ 44 | function approve(address spender, uint256 amount) external returns (bool); 45 | 46 | /** 47 | * @dev Moves `amount` tokens from `sender` to `recipient` using the 48 | * allowance mechanism. `amount` is then deducted from the caller's 49 | * allowance. 50 | * 51 | * Returns a boolean value indicating whether the operation succeeded. 52 | * 53 | * Emits a {Transfer} event. 54 | */ 55 | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); 56 | 57 | /** 58 | * @dev Emitted when `value` tokens are moved from one account (`from`) to 59 | * another (`to`). 60 | * 61 | * Note that `value` may be zero. 62 | */ 63 | event Transfer(address indexed from, address indexed to, uint256 value); 64 | 65 | /** 66 | * @dev Emitted when the allowance of a `spender` for an `owner` is set by 67 | * a call to {approve}. `value` is the new allowance. 68 | */ 69 | event Approval(address indexed owner, address indexed spender, uint256 value); 70 | } 71 | 72 | 73 | 74 | /** 75 | * @dev Wrappers over Solidity's arithmetic operations with added overflow 76 | * checks. 77 | * 78 | * Arithmetic operations in Solidity wrap on overflow. This can easily result 79 | * in bugs, because programmers usually assume that an overflow raises an 80 | * error, which is the standard behavior in high level programming languages. 81 | * `SafeMath` restores this intuition by reverting the transaction when an 82 | * operation overflows. 83 | * 84 | * Using this library instead of the unchecked operations eliminates an entire 85 | * class of bugs, so it's recommended to use it always. 86 | */ 87 | 88 | library SafeMath { 89 | /** 90 | * @dev Returns the addition of two unsigned integers, reverting on 91 | * overflow. 92 | * 93 | * Counterpart to Solidity's `+` operator. 94 | * 95 | * Requirements: 96 | * 97 | * - Addition cannot overflow. 98 | */ 99 | function add(uint256 a, uint256 b) internal pure returns (uint256) { 100 | uint256 c = a + b; 101 | require(c >= a, "SafeMath: addition overflow"); 102 | 103 | return c; 104 | } 105 | 106 | /** 107 | * @dev Returns the subtraction of two unsigned integers, reverting on 108 | * overflow (when the result is negative). 109 | * 110 | * Counterpart to Solidity's `-` operator. 111 | * 112 | * Requirements: 113 | * 114 | * - Subtraction cannot overflow. 115 | */ 116 | function sub(uint256 a, uint256 b) internal pure returns (uint256) { 117 | return sub(a, b, "SafeMath: subtraction overflow"); 118 | } 119 | 120 | /** 121 | * @dev Returns the subtraction of two unsigned integers, reverting with custom message on 122 | * overflow (when the result is negative). 123 | * 124 | * Counterpart to Solidity's `-` operator. 125 | * 126 | * Requirements: 127 | * 128 | * - Subtraction cannot overflow. 129 | */ 130 | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 131 | require(b <= a, errorMessage); 132 | uint256 c = a - b; 133 | 134 | return c; 135 | } 136 | 137 | /** 138 | * @dev Returns the multiplication of two unsigned integers, reverting on 139 | * overflow. 140 | * 141 | * Counterpart to Solidity's `*` operator. 142 | * 143 | * Requirements: 144 | * 145 | * - Multiplication cannot overflow. 146 | */ 147 | function mul(uint256 a, uint256 b) internal pure returns (uint256) { 148 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the 149 | // benefit is lost if 'b' is also tested. 150 | // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 151 | if (a == 0) { 152 | return 0; 153 | } 154 | 155 | uint256 c = a * b; 156 | require(c / a == b, "SafeMath: multiplication overflow"); 157 | 158 | return c; 159 | } 160 | 161 | /** 162 | * @dev Returns the integer division of two unsigned integers. Reverts on 163 | * division by zero. The result is rounded towards zero. 164 | * 165 | * Counterpart to Solidity's `/` operator. Note: this function uses a 166 | * `revert` opcode (which leaves remaining gas untouched) while Solidity 167 | * uses an invalid opcode to revert (consuming all remaining gas). 168 | * 169 | * Requirements: 170 | * 171 | * - The divisor cannot be zero. 172 | */ 173 | function div(uint256 a, uint256 b) internal pure returns (uint256) { 174 | return div(a, b, "SafeMath: division by zero"); 175 | } 176 | 177 | /** 178 | * @dev Returns the integer division of two unsigned integers. Reverts with custom message on 179 | * division by zero. The result is rounded towards zero. 180 | * 181 | * Counterpart to Solidity's `/` operator. Note: this function uses a 182 | * `revert` opcode (which leaves remaining gas untouched) while Solidity 183 | * uses an invalid opcode to revert (consuming all remaining gas). 184 | * 185 | * Requirements: 186 | * 187 | * - The divisor cannot be zero. 188 | */ 189 | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 190 | require(b > 0, errorMessage); 191 | uint256 c = a / b; 192 | // assert(a == b * c + a % b); // There is no case in which this doesn't hold 193 | 194 | return c; 195 | } 196 | 197 | /** 198 | * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), 199 | * Reverts when dividing by zero. 200 | * 201 | * Counterpart to Solidity's `%` operator. This function uses a `revert` 202 | * opcode (which leaves remaining gas untouched) while Solidity uses an 203 | * invalid opcode to revert (consuming all remaining gas). 204 | * 205 | * Requirements: 206 | * 207 | * - The divisor cannot be zero. 208 | */ 209 | function mod(uint256 a, uint256 b) internal pure returns (uint256) { 210 | return mod(a, b, "SafeMath: modulo by zero"); 211 | } 212 | 213 | /** 214 | * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), 215 | * Reverts with custom message when dividing by zero. 216 | * 217 | * Counterpart to Solidity's `%` operator. This function uses a `revert` 218 | * opcode (which leaves remaining gas untouched) while Solidity uses an 219 | * invalid opcode to revert (consuming all remaining gas). 220 | * 221 | * Requirements: 222 | * 223 | * - The divisor cannot be zero. 224 | */ 225 | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 226 | require(b != 0, errorMessage); 227 | return a % b; 228 | } 229 | } 230 | 231 | abstract contract Context { 232 | function _msgSender() internal view virtual returns (address payable) { 233 | return msg.sender; 234 | } 235 | 236 | function _msgData() internal view virtual returns (bytes memory) { 237 | this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 238 | return msg.data; 239 | } 240 | } 241 | 242 | 243 | /** 244 | * @dev Collection of functions related to the address type 245 | */ 246 | library Address { 247 | /** 248 | * @dev Returns true if `account` is a contract. 249 | * 250 | * [IMPORTANT] 251 | * ==== 252 | * It is unsafe to assume that an address for which this function returns 253 | * false is an externally-owned account (EOA) and not a contract. 254 | * 255 | * Among others, `isContract` will return false for the following 256 | * types of addresses: 257 | * 258 | * - an externally-owned account 259 | * - a contract in construction 260 | * - an address where a contract will be created 261 | * - an address where a contract lived, but was destroyed 262 | * ==== 263 | */ 264 | function isContract(address account) internal view returns (bool) { 265 | // According to EIP-1052, 0x0 is the value returned for not-yet created accounts 266 | // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned 267 | // for accounts without code, i.e. `keccak256('')` 268 | bytes32 codehash; 269 | bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; 270 | // solhint-disable-next-line no-inline-assembly 271 | assembly { codehash := extcodehash(account) } 272 | return (codehash != accountHash && codehash != 0x0); 273 | } 274 | 275 | /** 276 | * @dev Replacement for Solidity's `transfer`: sends `amount` wei to 277 | * `recipient`, forwarding all available gas and reverting on errors. 278 | * 279 | * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost 280 | * of certain opcodes, possibly making contracts go over the 2300 gas limit 281 | * imposed by `transfer`, making them unable to receive funds via 282 | * `transfer`. {sendValue} removes this limitation. 283 | * 284 | * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. 285 | * 286 | * IMPORTANT: because control is transferred to `recipient`, care must be 287 | * taken to not create reentrancy vulnerabilities. Consider using 288 | * {ReentrancyGuard} or the 289 | * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. 290 | */ 291 | function sendValue(address payable recipient, uint256 amount) internal { 292 | require(address(this).balance >= amount, "Address: insufficient balance"); 293 | 294 | // solhint-disable-next-line avoid-low-level-calls, avoid-call-value 295 | (bool success, ) = recipient.call{ value: amount }(""); 296 | require(success, "Address: unable to send value, recipient may have reverted"); 297 | } 298 | 299 | /** 300 | * @dev Performs a Solidity function call using a low level `call`. A 301 | * plain`call` is an unsafe replacement for a function call: use this 302 | * function instead. 303 | * 304 | * If `target` reverts with a revert reason, it is bubbled up by this 305 | * function (like regular Solidity function calls). 306 | * 307 | * Returns the raw returned data. To convert to the expected return value, 308 | * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. 309 | * 310 | * Requirements: 311 | * 312 | * - `target` must be a contract. 313 | * - calling `target` with `data` must not revert. 314 | * 315 | * _Available since v3.1._ 316 | */ 317 | function functionCall(address target, bytes memory data) internal returns (bytes memory) { 318 | return functionCall(target, data, "Address: low-level call failed"); 319 | } 320 | 321 | /** 322 | * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with 323 | * `errorMessage` as a fallback revert reason when `target` reverts. 324 | * 325 | * _Available since v3.1._ 326 | */ 327 | function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { 328 | return _functionCallWithValue(target, data, 0, errorMessage); 329 | } 330 | 331 | /** 332 | * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], 333 | * but also transferring `value` wei to `target`. 334 | * 335 | * Requirements: 336 | * 337 | * - the calling contract must have an ETH balance of at least `value`. 338 | * - the called Solidity function must be `payable`. 339 | * 340 | * _Available since v3.1._ 341 | */ 342 | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { 343 | return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); 344 | } 345 | 346 | /** 347 | * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but 348 | * with `errorMessage` as a fallback revert reason when `target` reverts. 349 | * 350 | * _Available since v3.1._ 351 | */ 352 | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { 353 | require(address(this).balance >= value, "Address: insufficient balance for call"); 354 | return _functionCallWithValue(target, data, value, errorMessage); 355 | } 356 | 357 | function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { 358 | require(isContract(target), "Address: call to non-contract"); 359 | 360 | // solhint-disable-next-line avoid-low-level-calls 361 | (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 362 | if (success) { 363 | return returndata; 364 | } else { 365 | // Look for revert reason and bubble it up if present 366 | if (returndata.length > 0) { 367 | // The easiest way to bubble the revert reason is using memory via assembly 368 | 369 | // solhint-disable-next-line no-inline-assembly 370 | assembly { 371 | let returndata_size := mload(returndata) 372 | revert(add(32, returndata), returndata_size) 373 | } 374 | } else { 375 | revert(errorMessage); 376 | } 377 | } 378 | } 379 | } 380 | 381 | /** 382 | * @dev Contract module which provides a basic access control mechanism, where 383 | * there is an account (an owner) that can be granted exclusive access to 384 | * specific functions. 385 | * 386 | * By default, the owner account will be the one that deploys the contract. This 387 | * can later be changed with {transferOwnership}. 388 | * 389 | * This module is used through inheritance. It will make available the modifier 390 | * `onlyOwner`, which can be applied to your functions to restrict their use to 391 | * the owner. 392 | */ 393 | contract Ownable is Context { 394 | address private _owner; 395 | address private _previousOwner; 396 | uint256 private _lockTime; 397 | 398 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 399 | 400 | /** 401 | * @dev Initializes the contract setting the deployer as the initial owner. 402 | */ 403 | constructor () internal { 404 | address msgSender = _msgSender(); 405 | _owner = msgSender; 406 | emit OwnershipTransferred(address(0), msgSender); 407 | } 408 | 409 | /** 410 | * @dev Returns the address of the current owner. 411 | */ 412 | function owner() public view returns (address) { 413 | return _owner; 414 | } 415 | 416 | /** 417 | * @dev Throws if called by any account other than the owner. 418 | */ 419 | modifier onlyOwner() { 420 | require(_owner == _msgSender(), "Ownable: caller is not the owner"); 421 | _; 422 | } 423 | 424 | /** 425 | * @dev Leaves the contract without owner. It will not be possible to call 426 | * `onlyOwner` functions anymore. Can only be called by the current owner. 427 | * 428 | * NOTE: Renouncing ownership will leave the contract without an owner, 429 | * thereby removing any functionality that is only available to the owner. 430 | */ 431 | function renounceOwnership() public virtual onlyOwner { 432 | emit OwnershipTransferred(_owner, address(0)); 433 | _owner = address(0); 434 | } 435 | 436 | /** 437 | * @dev Transfers ownership of the contract to a new account (`newOwner`). 438 | * Can only be called by the current owner. 439 | */ 440 | function transferOwnership(address newOwner) public virtual onlyOwner { 441 | require(newOwner != address(0), "Ownable: new owner is the zero address"); 442 | emit OwnershipTransferred(_owner, newOwner); 443 | _owner = newOwner; 444 | } 445 | 446 | function geUnlockTime() public view returns (uint256) { 447 | return _lockTime; 448 | } 449 | 450 | //Locks the contract for owner for the amount of time provided 451 | function lock(uint256 time) public virtual onlyOwner { 452 | _previousOwner = _owner; 453 | _owner = address(0); 454 | _lockTime = now + time; 455 | emit OwnershipTransferred(_owner, address(0)); 456 | } 457 | 458 | //Unlocks the contract for owner when _lockTime is exceeds 459 | function unlock() public virtual { 460 | require(_previousOwner == msg.sender, "You don't have permission to unlock"); 461 | require(now > _lockTime , "Contract is locked until 7 days"); 462 | emit OwnershipTransferred(_owner, _previousOwner); 463 | _owner = _previousOwner; 464 | } 465 | } 466 | 467 | // pragma solidity >=0.5.0; 468 | 469 | interface IUniswapV2Factory { 470 | event PairCreated(address indexed token0, address indexed token1, address pair, uint); 471 | 472 | function feeTo() external view returns (address); 473 | function feeToSetter() external view returns (address); 474 | 475 | function getPair(address tokenA, address tokenB) external view returns (address pair); 476 | function allPairs(uint) external view returns (address pair); 477 | function allPairsLength() external view returns (uint); 478 | 479 | function createPair(address tokenA, address tokenB) external returns (address pair); 480 | 481 | function setFeeTo(address) external; 482 | function setFeeToSetter(address) external; 483 | } 484 | 485 | 486 | // pragma solidity >=0.5.0; 487 | 488 | interface IUniswapV2Pair { 489 | event Approval(address indexed owner, address indexed spender, uint value); 490 | event Transfer(address indexed from, address indexed to, uint value); 491 | 492 | function name() external pure returns (string memory); 493 | function symbol() external pure returns (string memory); 494 | function decimals() external pure returns (uint8); 495 | function totalSupply() external view returns (uint); 496 | function balanceOf(address owner) external view returns (uint); 497 | function allowance(address owner, address spender) external view returns (uint); 498 | 499 | function approve(address spender, uint value) external returns (bool); 500 | function transfer(address to, uint value) external returns (bool); 501 | function transferFrom(address from, address to, uint value) external returns (bool); 502 | 503 | function DOMAIN_SEPARATOR() external view returns (bytes32); 504 | function PERMIT_TYPEHASH() external pure returns (bytes32); 505 | function nonces(address owner) external view returns (uint); 506 | 507 | function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; 508 | 509 | event Mint(address indexed sender, uint amount0, uint amount1); 510 | event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); 511 | event Swap( 512 | address indexed sender, 513 | uint amount0In, 514 | uint amount1In, 515 | uint amount0Out, 516 | uint amount1Out, 517 | address indexed to 518 | ); 519 | event Sync(uint112 reserve0, uint112 reserve1); 520 | 521 | function MINIMUM_LIQUIDITY() external pure returns (uint); 522 | function factory() external view returns (address); 523 | function token0() external view returns (address); 524 | function token1() external view returns (address); 525 | function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); 526 | function price0CumulativeLast() external view returns (uint); 527 | function price1CumulativeLast() external view returns (uint); 528 | function kLast() external view returns (uint); 529 | 530 | function mint(address to) external returns (uint liquidity); 531 | function burn(address to) external returns (uint amount0, uint amount1); 532 | function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; 533 | function skim(address to) external; 534 | function sync() external; 535 | 536 | function initialize(address, address) external; 537 | } 538 | 539 | // pragma solidity >=0.6.2; 540 | 541 | interface IUniswapV2Router01 { 542 | function factory() external pure returns (address); 543 | function WETH() external pure returns (address); 544 | 545 | function addLiquidity( 546 | address tokenA, 547 | address tokenB, 548 | uint amountADesired, 549 | uint amountBDesired, 550 | uint amountAMin, 551 | uint amountBMin, 552 | address to, 553 | uint deadline 554 | ) external returns (uint amountA, uint amountB, uint liquidity); 555 | function addLiquidityETH( 556 | address token, 557 | uint amountTokenDesired, 558 | uint amountTokenMin, 559 | uint amountETHMin, 560 | address to, 561 | uint deadline 562 | ) external payable returns (uint amountToken, uint amountETH, uint liquidity); 563 | function removeLiquidity( 564 | address tokenA, 565 | address tokenB, 566 | uint liquidity, 567 | uint amountAMin, 568 | uint amountBMin, 569 | address to, 570 | uint deadline 571 | ) external returns (uint amountA, uint amountB); 572 | function removeLiquidityETH( 573 | address token, 574 | uint liquidity, 575 | uint amountTokenMin, 576 | uint amountETHMin, 577 | address to, 578 | uint deadline 579 | ) external returns (uint amountToken, uint amountETH); 580 | function removeLiquidityWithPermit( 581 | address tokenA, 582 | address tokenB, 583 | uint liquidity, 584 | uint amountAMin, 585 | uint amountBMin, 586 | address to, 587 | uint deadline, 588 | bool approveMax, uint8 v, bytes32 r, bytes32 s 589 | ) external returns (uint amountA, uint amountB); 590 | function removeLiquidityETHWithPermit( 591 | address token, 592 | uint liquidity, 593 | uint amountTokenMin, 594 | uint amountETHMin, 595 | address to, 596 | uint deadline, 597 | bool approveMax, uint8 v, bytes32 r, bytes32 s 598 | ) external returns (uint amountToken, uint amountETH); 599 | function swapExactTokensForTokens( 600 | uint amountIn, 601 | uint amountOutMin, 602 | address[] calldata path, 603 | address to, 604 | uint deadline 605 | ) external returns (uint[] memory amounts); 606 | function swapTokensForExactTokens( 607 | uint amountOut, 608 | uint amountInMax, 609 | address[] calldata path, 610 | address to, 611 | uint deadline 612 | ) external returns (uint[] memory amounts); 613 | function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) 614 | external 615 | payable 616 | returns (uint[] memory amounts); 617 | function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) 618 | external 619 | returns (uint[] memory amounts); 620 | function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) 621 | external 622 | returns (uint[] memory amounts); 623 | function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) 624 | external 625 | payable 626 | returns (uint[] memory amounts); 627 | 628 | function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); 629 | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); 630 | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); 631 | function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); 632 | function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); 633 | } 634 | 635 | 636 | 637 | // pragma solidity >=0.6.2; 638 | 639 | interface IUniswapV2Router02 is IUniswapV2Router01 { 640 | function removeLiquidityETHSupportingFeeOnTransferTokens( 641 | address token, 642 | uint liquidity, 643 | uint amountTokenMin, 644 | uint amountETHMin, 645 | address to, 646 | uint deadline 647 | ) external returns (uint amountETH); 648 | function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( 649 | address token, 650 | uint liquidity, 651 | uint amountTokenMin, 652 | uint amountETHMin, 653 | address to, 654 | uint deadline, 655 | bool approveMax, uint8 v, bytes32 r, bytes32 s 656 | ) external returns (uint amountETH); 657 | 658 | function swapExactTokensForTokensSupportingFeeOnTransferTokens( 659 | uint amountIn, 660 | uint amountOutMin, 661 | address[] calldata path, 662 | address to, 663 | uint deadline 664 | ) external; 665 | function swapExactETHForTokensSupportingFeeOnTransferTokens( 666 | uint amountOutMin, 667 | address[] calldata path, 668 | address to, 669 | uint deadline 670 | ) external payable; 671 | function swapExactTokensForETHSupportingFeeOnTransferTokens( 672 | uint amountIn, 673 | uint amountOutMin, 674 | address[] calldata path, 675 | address to, 676 | uint deadline 677 | ) external; 678 | } 679 | 680 | 681 | contract BEMU is Context, IERC20, Ownable { 682 | using SafeMath for uint256; 683 | using Address for address; 684 | 685 | mapping (address => uint256) private _rOwned; 686 | mapping (address => uint256) private _tOwned; 687 | mapping (address => mapping (address => uint256)) private _allowances; 688 | 689 | mapping (address => bool) private _isExcludedFromFee; 690 | 691 | mapping (address => bool) private _isExcluded; 692 | address[] private _excluded; 693 | 694 | uint256 private constant MAX = ~uint256(0); 695 | uint256 private _tTotal = 3_140_000_000 * 10 ** 18; 696 | uint256 private _rTotal = (MAX - (MAX % _tTotal)); 697 | uint256 private _tFeeTotal; 698 | 699 | string private _name = "BEMU"; 700 | string private _symbol = "BEMU"; 701 | uint8 private _decimals = 18; 702 | 703 | uint256 public _taxFee; 704 | uint256 public _liquidityFee; 705 | uint256 public _marketingFee; 706 | 707 | uint256 public _buyTaxFee = 3; 708 | uint256 public _buyMarketingFee = 3; 709 | uint256 public _buyLiquidityFee = 4; 710 | 711 | uint256 public _sellTaxFee = 4; 712 | uint256 public _sellMarketingFee = 4; 713 | uint256 public _sellLiquidityFee = 5; 714 | 715 | 716 | address public _marketingWallet; 717 | 718 | IUniswapV2Router02 public uniswapV2Router; 719 | address public uniswapV2Pair; 720 | 721 | bool inSwapAndLiquify; 722 | bool public swapAndLiquifyEnabled = true; 723 | 724 | uint256 public _maxTxAmount = _tTotal * 2 / 100; // 2% of total supply 725 | uint256 private numTokensSellToAddToLiquidity = 5000000 * 10**18; 726 | 727 | event SwapAndLiquifyEnabledUpdated(bool enabled); 728 | event SwapAndLiquify( 729 | uint256 tokensSwapped, 730 | uint256 ethReceived, 731 | uint256 tokensIntoLiqudity 732 | ); 733 | 734 | modifier lockTheSwap { 735 | inSwapAndLiquify = true; 736 | _; 737 | inSwapAndLiquify = false; 738 | } 739 | 740 | constructor () public { 741 | _rOwned[_msgSender()] = _rTotal; 742 | 743 | _marketingWallet = _msgSender(); 744 | 745 | //exclude owner and this contract from fee 746 | _isExcludedFromFee[owner()] = true; 747 | _isExcludedFromFee[address(this)] = true; 748 | 749 | emit Transfer(address(0), _msgSender(), _tTotal); 750 | } 751 | 752 | function getPair() public onlyOwner { 753 | IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24); 754 | // Create a uniswap pair for this new token 755 | uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) 756 | .createPair(address(this), _uniswapV2Router.WETH()); 757 | 758 | // set the rest of the contract variables 759 | uniswapV2Router = _uniswapV2Router; 760 | } 761 | 762 | function name() public view returns (string memory) { 763 | return _name; 764 | } 765 | 766 | function symbol() public view returns (string memory) { 767 | return _symbol; 768 | } 769 | 770 | function decimals() public view returns (uint8) { 771 | return _decimals; 772 | } 773 | 774 | function totalSupply() public view override returns (uint256) { 775 | return _tTotal; 776 | } 777 | 778 | function balanceOf(address account) public view override returns (uint256) { 779 | if (_isExcluded[account]) return _tOwned[account]; 780 | return tokenFromReflection(_rOwned[account]); 781 | } 782 | 783 | function transfer(address recipient, uint256 amount) public override returns (bool) { 784 | _transfer(_msgSender(), recipient, amount); 785 | return true; 786 | } 787 | 788 | function allowance(address owner, address spender) public view override returns (uint256) { 789 | return _allowances[owner][spender]; 790 | } 791 | 792 | function approve(address spender, uint256 amount) public override returns (bool) { 793 | _approve(_msgSender(), spender, amount); 794 | return true; 795 | } 796 | 797 | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { 798 | _transfer(sender, recipient, amount); 799 | _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 800 | return true; 801 | } 802 | 803 | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { 804 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); 805 | return true; 806 | } 807 | 808 | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { 809 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 810 | return true; 811 | } 812 | 813 | function isExcludedFromReward(address account) public view returns (bool) { 814 | return _isExcluded[account]; 815 | } 816 | 817 | function totalFees() public view returns (uint256) { 818 | return _tFeeTotal; 819 | } 820 | 821 | function deliver(uint256 tAmount) public { 822 | address sender = _msgSender(); 823 | require(!_isExcluded[sender], "Excluded addresses cannot call this function"); 824 | (uint256 rAmount,,,,,,) = _getValues(tAmount); 825 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 826 | _rTotal = _rTotal.sub(rAmount); 827 | _tFeeTotal = _tFeeTotal.add(tAmount); 828 | } 829 | 830 | function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { 831 | require(tAmount <= _tTotal, "Amount must be less than supply"); 832 | if (!deductTransferFee) { 833 | (uint256 rAmount,,,,,,) = _getValues(tAmount); 834 | return rAmount; 835 | } else { 836 | (,uint256 rTransferAmount,,,,,) = _getValues(tAmount); 837 | return rTransferAmount; 838 | } 839 | } 840 | 841 | function tokenFromReflection(uint256 rAmount) public view returns(uint256) { 842 | require(rAmount <= _rTotal, "Amount must be less than total reflections"); 843 | uint256 currentRate = _getRate(); 844 | return rAmount.div(currentRate); 845 | } 846 | 847 | function excludeFromReward(address account) public onlyOwner() { 848 | require(!_isExcluded[account], "Account is already excluded"); 849 | if(_rOwned[account] > 0) { 850 | _tOwned[account] = tokenFromReflection(_rOwned[account]); 851 | } 852 | _isExcluded[account] = true; 853 | _excluded.push(account); 854 | } 855 | 856 | function includeInReward(address account) external onlyOwner() { 857 | require(_isExcluded[account], "Account is already excluded"); 858 | for (uint256 i = 0; i < _excluded.length; i++) { 859 | if (_excluded[i] == account) { 860 | _excluded[i] = _excluded[_excluded.length - 1]; 861 | _tOwned[account] = 0; 862 | _isExcluded[account] = false; 863 | _excluded.pop(); 864 | break; 865 | } 866 | } 867 | } 868 | 869 | function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { 870 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); 871 | _tOwned[sender] = _tOwned[sender].sub(tAmount); 872 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 873 | _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); 874 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 875 | _takeLiquidity(tLiquidity); 876 | _reflectFee(rFee, tFee); 877 | _takeMarketing(tMarketing); 878 | emit Transfer(sender, recipient, tTransferAmount); 879 | } 880 | 881 | function excludeFromFee(address account) public onlyOwner { 882 | _isExcludedFromFee[account] = true; 883 | } 884 | 885 | function includeInFee(address account) public onlyOwner { 886 | _isExcludedFromFee[account] = false; 887 | } 888 | 889 | function setMarketingWallet(address marketingWallet) external onlyOwner() { 890 | _marketingWallet = marketingWallet; 891 | } 892 | 893 | function setTaxFeePercent(uint256 taxFee) external onlyOwner() { 894 | _taxFee = taxFee; 895 | } 896 | 897 | function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { 898 | _liquidityFee = liquidityFee; 899 | } 900 | 901 | function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { 902 | _maxTxAmount = _tTotal.mul(maxTxPercent).div( 903 | 10**2 904 | ); 905 | } 906 | 907 | function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { 908 | swapAndLiquifyEnabled = _enabled; 909 | emit SwapAndLiquifyEnabledUpdated(_enabled); 910 | } 911 | 912 | //to recieve ETH from uniswapV2Router when swaping 913 | receive() external payable {} 914 | 915 | function _reflectFee(uint256 rFee, uint256 tFee) private { 916 | _rTotal = _rTotal.sub(rFee); 917 | _tFeeTotal = _tFeeTotal.add(tFee); 918 | } 919 | 920 | function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256) { 921 | (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getTValues(tAmount); 922 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, tMarketing, _getRate()); 923 | return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity, tMarketing); 924 | } 925 | 926 | function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) { 927 | uint256 tFee = calculateTaxFee(tAmount); 928 | uint256 tLiquidity = calculateLiquidityFee(tAmount); 929 | uint256 tMarketing = calculateMarketingFee(tAmount); 930 | uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tMarketing); 931 | return (tTransferAmount, tFee, tLiquidity, tMarketing); 932 | } 933 | 934 | function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing, uint256 currentRate) private pure returns (uint256, uint256, uint256) { 935 | uint256 rAmount = tAmount.mul(currentRate); 936 | uint256 rFee = tFee.mul(currentRate); 937 | uint256 rLiquidity = tLiquidity.mul(currentRate); 938 | uint256 rMarketing = tMarketing.mul(currentRate); 939 | uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rMarketing); 940 | return (rAmount, rTransferAmount, rFee); 941 | } 942 | 943 | function _getRate() private view returns(uint256) { 944 | (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); 945 | return rSupply.div(tSupply); 946 | } 947 | 948 | function _getCurrentSupply() private view returns(uint256, uint256) { 949 | uint256 rSupply = _rTotal; 950 | uint256 tSupply = _tTotal; 951 | for (uint256 i = 0; i < _excluded.length; i++) { 952 | if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); 953 | rSupply = rSupply.sub(_rOwned[_excluded[i]]); 954 | tSupply = tSupply.sub(_tOwned[_excluded[i]]); 955 | } 956 | if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); 957 | return (rSupply, tSupply); 958 | } 959 | 960 | function _takeLiquidity(uint256 tLiquidity) private { 961 | uint256 currentRate = _getRate(); 962 | uint256 rLiquidity = tLiquidity.mul(currentRate); 963 | _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); 964 | if(_isExcluded[address(this)]) { 965 | _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); 966 | emit Transfer(msg.sender, address(this), tLiquidity); 967 | } 968 | 969 | emit Transfer(msg.sender, address(this), tLiquidity); 970 | } 971 | 972 | function _takeMarketing(uint256 tMarketing) private { 973 | uint256 currentRate = _getRate(); 974 | uint256 rMarketing = tMarketing.mul(currentRate); 975 | _rOwned[_marketingWallet] = _rOwned[_marketingWallet].add(rMarketing); 976 | if(_isExcluded[_marketingWallet]) { 977 | _tOwned[_marketingWallet] = _tOwned[_marketingWallet].add(tMarketing); 978 | emit Transfer(msg.sender, _marketingWallet, tMarketing); 979 | } 980 | 981 | emit Transfer(msg.sender, _marketingWallet, tMarketing); 982 | } 983 | 984 | function calculateTaxFee(uint256 _amount) private view returns (uint256) { 985 | return _amount.mul(_taxFee).div( 986 | 10**2 987 | ); 988 | } 989 | 990 | function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { 991 | return _amount.mul(_liquidityFee).div( 992 | 10**2 993 | ); 994 | } 995 | 996 | function calculateMarketingFee(uint256 _amount) private view returns (uint256) { 997 | return _amount.mul(_marketingFee).div( 998 | 10**2 999 | ); 1000 | } 1001 | 1002 | function removeAllFee() private { 1003 | if(_taxFee == 0 && _liquidityFee == 0 &&_marketingFee == 0) return; 1004 | 1005 | _taxFee = 0; 1006 | _liquidityFee = 0; 1007 | _marketingFee = 0; 1008 | } 1009 | 1010 | function restoreAllFee(bool isBuy) private { 1011 | isBuy ? ( 1012 | _taxFee = _buyTaxFee, 1013 | _liquidityFee = _buyLiquidityFee, 1014 | _marketingFee = _buyMarketingFee 1015 | ) : ( 1016 | _taxFee = _sellTaxFee, 1017 | _liquidityFee = _sellLiquidityFee, 1018 | _marketingFee = _sellMarketingFee 1019 | ); 1020 | } 1021 | 1022 | function isExcludedFromFee(address account) public view returns(bool) { 1023 | return _isExcludedFromFee[account]; 1024 | } 1025 | 1026 | function _approve(address owner, address spender, uint256 amount) private { 1027 | require(owner != address(0), "ERC20: approve from the zero address"); 1028 | require(spender != address(0), "ERC20: approve to the zero address"); 1029 | 1030 | _allowances[owner][spender] = amount; 1031 | emit Approval(owner, spender, amount); 1032 | } 1033 | 1034 | function _transfer( 1035 | address from, 1036 | address to, 1037 | uint256 amount 1038 | ) private { 1039 | require(from != address(0), "ERC20: transfer from the zero address"); 1040 | require(to != address(0), "ERC20: transfer to the zero address"); 1041 | require(amount > 0, "Transfer amount must be greater than zero"); 1042 | if(from != owner() && to != owner()) 1043 | require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); 1044 | 1045 | // is the token balance of this contract address over the min number of 1046 | // tokens that we need to initiate a swap + liquidity lock? 1047 | // also, don't get caught in a circular liquidity event. 1048 | // also, don't swap & liquify if sender is uniswap pair. 1049 | uint256 contractTokenBalance = balanceOf(address(this)); 1050 | 1051 | if(contractTokenBalance >= _maxTxAmount) { 1052 | contractTokenBalance = _maxTxAmount; 1053 | } 1054 | 1055 | bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; 1056 | if ( 1057 | overMinTokenBalance && 1058 | !inSwapAndLiquify && 1059 | from != uniswapV2Pair && 1060 | swapAndLiquifyEnabled 1061 | ) { 1062 | //add liquidity 1063 | swapAndLiquify(contractTokenBalance); 1064 | } 1065 | 1066 | bool takeFee = false; 1067 | bool isBuy = true; 1068 | 1069 | if (from == uniswapV2Pair && !_isExcludedFromFee[to]) { 1070 | takeFee = true; 1071 | isBuy = true; 1072 | } else if (to == uniswapV2Pair && !_isExcludedFromFee[from]) { 1073 | takeFee = true; 1074 | isBuy = false; 1075 | } else { 1076 | takeFee = false; 1077 | } 1078 | 1079 | //transfer amount, it will take tax, burn, liquidity fee 1080 | _tokenTransfer(from,to,amount,takeFee,isBuy); 1081 | } 1082 | 1083 | function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { 1084 | // split the contract balance into halves 1085 | uint256 half = contractTokenBalance.div(2); 1086 | uint256 otherHalf = contractTokenBalance.sub(half); 1087 | 1088 | // capture the contract's current ETH balance. 1089 | // this is so that we can capture exactly the amount of ETH that the 1090 | // swap creates, and not make the liquidity event include any ETH that 1091 | // has been manually sent to the contract 1092 | uint256 initialBalance = address(this).balance; 1093 | 1094 | // swap tokens for ETH 1095 | swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered 1096 | 1097 | // how much ETH did we just swap into? 1098 | uint256 newBalance = address(this).balance.sub(initialBalance); 1099 | 1100 | // add liquidity to uniswap 1101 | addLiquidity(otherHalf, newBalance); 1102 | 1103 | emit SwapAndLiquify(half, newBalance, otherHalf); 1104 | } 1105 | 1106 | function swapTokensForEth(uint256 tokenAmount) private { 1107 | // generate the uniswap pair path of token -> weth 1108 | address[] memory path = new address[](2); 1109 | path[0] = address(this); 1110 | path[1] = uniswapV2Router.WETH(); 1111 | 1112 | _approve(address(this), address(uniswapV2Router), tokenAmount); 1113 | 1114 | // make the swap 1115 | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( 1116 | tokenAmount, 1117 | 0, // accept any amount of ETH 1118 | path, 1119 | address(this), 1120 | block.timestamp 1121 | ); 1122 | } 1123 | 1124 | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { 1125 | // approve token transfer to cover all possible scenarios 1126 | _approve(address(this), address(uniswapV2Router), tokenAmount); 1127 | 1128 | // add the liquidity 1129 | uniswapV2Router.addLiquidityETH{value: ethAmount}( 1130 | address(this), 1131 | tokenAmount, 1132 | 0, // slippage is unavoidable 1133 | 0, // slippage is unavoidable 1134 | owner(), 1135 | block.timestamp 1136 | ); 1137 | } 1138 | 1139 | //this method is responsible for taking all fee, if takeFee is true 1140 | function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee, bool isBuy) private { 1141 | takeFee? restoreAllFee(isBuy) : removeAllFee(); 1142 | 1143 | if (_isExcluded[sender] && !_isExcluded[recipient]) { 1144 | _transferFromExcluded(sender, recipient, amount); 1145 | } else if (!_isExcluded[sender] && _isExcluded[recipient]) { 1146 | _transferToExcluded(sender, recipient, amount); 1147 | } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { 1148 | _transferStandard(sender, recipient, amount); 1149 | } else if (_isExcluded[sender] && _isExcluded[recipient]) { 1150 | _transferBothExcluded(sender, recipient, amount); 1151 | } else { 1152 | _transferStandard(sender, recipient, amount); 1153 | } 1154 | 1155 | if(!takeFee) 1156 | restoreAllFee(isBuy); 1157 | } 1158 | 1159 | function _transferStandard(address sender, address recipient, uint256 tAmount) private { 1160 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); 1161 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 1162 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 1163 | _takeLiquidity(tLiquidity); 1164 | _reflectFee(rFee, tFee); 1165 | _takeMarketing(tMarketing); 1166 | emit Transfer(sender, recipient, tTransferAmount); 1167 | } 1168 | 1169 | function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { 1170 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); 1171 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 1172 | _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); 1173 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 1174 | _takeLiquidity(tLiquidity); 1175 | _reflectFee(rFee, tFee); 1176 | _takeMarketing(tMarketing); 1177 | emit Transfer(sender, recipient, tTransferAmount); 1178 | } 1179 | 1180 | function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { 1181 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); 1182 | _tOwned[sender] = _tOwned[sender].sub(tAmount); 1183 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 1184 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 1185 | _takeLiquidity(tLiquidity); 1186 | _reflectFee(rFee, tFee); 1187 | _takeMarketing(tMarketing); 1188 | emit Transfer(sender, recipient, tTransferAmount); 1189 | } 1190 | 1191 | } --------------------------------------------------------------------------------