├── CertiK Audit Report for ExzoCoin Token.pdf ├── ExzoCoin_2_0.sol ├── LICENSE ├── README.md └── Read.ME /CertiK Audit Report for ExzoCoin Token.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nexisdev/ERC-20-token-smart-contract/e1c889930fe8a89be938fadc2a7053cd358492f0/CertiK Audit Report for ExzoCoin Token.pdf -------------------------------------------------------------------------------- /ExzoCoin_2_0.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Unlicensed 2 | 3 | pragma solidity ^0.8.4; 4 | 5 | interface IERC20 { 6 | 7 | function totalSupply() external view returns (uint256); 8 | function balanceOf(address account) external view returns (uint256); 9 | function transfer(address recipient, uint256 amount) external returns (bool); 10 | function allowance(address owner, address spender) external view returns (uint256); 11 | function approve(address spender, uint256 amount) external returns (bool); 12 | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); 13 | event Transfer(address indexed from, address indexed to, uint256 value); 14 | event Approval(address indexed owner, address indexed spender, uint256 value); 15 | } 16 | 17 | library SafeMath { 18 | 19 | function add(uint256 a, uint256 b) internal pure returns (uint256) { 20 | uint256 c = a + b; 21 | require(c >= a, "SafeMath: addition overflow"); 22 | return c; 23 | } 24 | 25 | function sub(uint256 a, uint256 b) internal pure returns (uint256) { 26 | return sub(a, b, "SafeMath: subtraction overflow"); 27 | } 28 | 29 | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 30 | require(b <= a, errorMessage); 31 | uint256 c = a - b; 32 | return c; 33 | } 34 | 35 | function mul(uint256 a, uint256 b) internal pure returns (uint256) { 36 | if (a == 0) { 37 | return 0; 38 | } 39 | 40 | uint256 c = a * b; 41 | require(c / a == b, "SafeMath: multiplication overflow"); 42 | return c; 43 | } 44 | 45 | function div(uint256 a, uint256 b) internal pure returns (uint256) { 46 | return div(a, b, "SafeMath: division by zero"); 47 | } 48 | 49 | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 50 | require(b > 0, errorMessage); 51 | uint256 c = a / b; 52 | return c; 53 | } 54 | 55 | 56 | function mod(uint256 a, uint256 b) internal pure returns (uint256) { 57 | return mod(a, b, "SafeMath: modulo by zero"); 58 | } 59 | 60 | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 61 | require(b != 0, errorMessage); 62 | return a % b; 63 | } 64 | } 65 | 66 | abstract contract Context { 67 | function _msgSender() internal view virtual returns (address payable) { 68 | return payable(msg.sender); 69 | } 70 | 71 | function _msgData() internal view virtual returns (bytes memory) { 72 | this; 73 | return msg.data; 74 | } 75 | } 76 | 77 | library Address { 78 | function isContract(address account) internal view returns (bool) { 79 | bytes32 codehash; 80 | bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; 81 | assembly { codehash := extcodehash(account) } 82 | return (codehash != accountHash && codehash != 0x0); 83 | } 84 | 85 | function sendValue(address payable recipient, uint256 amount) internal { 86 | require(address(this).balance >= amount, "Address: insufficient balance"); 87 | (bool success, ) = recipient.call{ value: amount }(""); 88 | require(success, "Address: unable to send value, recipient may have reverted"); 89 | } 90 | 91 | function functionCall(address target, bytes memory data) internal returns (bytes memory) { 92 | return functionCall(target, data, "Address: low-level call failed"); 93 | } 94 | 95 | function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { 96 | return _functionCallWithValue(target, data, 0, errorMessage); 97 | } 98 | 99 | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { 100 | return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); 101 | } 102 | 103 | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { 104 | require(address(this).balance >= value, "Address: insufficient balance for call"); 105 | return _functionCallWithValue(target, data, value, errorMessage); 106 | } 107 | 108 | function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { 109 | require(isContract(target), "Address: call to non-contract"); 110 | 111 | (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 112 | if (success) { 113 | return returndata; 114 | } else { 115 | if (returndata.length > 0) { 116 | assembly { 117 | let returndata_size := mload(returndata) 118 | revert(add(32, returndata), returndata_size) 119 | } 120 | } else { 121 | revert(errorMessage); 122 | } 123 | } 124 | } 125 | } 126 | 127 | contract Ownable is Context { 128 | address private _owner; 129 | address private _previousOwner; 130 | uint256 private _lockTime; 131 | 132 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 133 | 134 | constructor () { 135 | address msgSender = _msgSender(); 136 | _owner = msgSender; 137 | emit OwnershipTransferred(address(0), msgSender); 138 | } 139 | 140 | function owner() public view returns (address) { 141 | return _owner; 142 | } 143 | 144 | modifier onlyOwner() { 145 | require(_owner == _msgSender(), "Ownable: caller is not the owner"); 146 | _; 147 | } 148 | 149 | function renounceOwnership() public virtual onlyOwner { 150 | emit OwnershipTransferred(_owner, address(0)); 151 | _owner = address(0); 152 | } 153 | 154 | function transferOwnership(address newOwner) public virtual onlyOwner { 155 | require(newOwner != address(0), "Ownable: new owner is the zero address"); 156 | emit OwnershipTransferred(_owner, newOwner); 157 | _owner = newOwner; 158 | } 159 | 160 | function geUnlockTime() public view returns (uint256) { 161 | return _lockTime; 162 | } 163 | 164 | function lock(uint256 time) public virtual onlyOwner { 165 | _previousOwner = _owner; 166 | _owner = address(0); 167 | _lockTime = block.timestamp + time; 168 | emit OwnershipTransferred(_owner, address(0)); 169 | } 170 | 171 | function unlock() public virtual { 172 | require(_previousOwner == msg.sender, "You don't have permission to unlock"); 173 | require(block.timestamp > _lockTime , "Contract is locked until 7 days"); 174 | emit OwnershipTransferred(_owner, _previousOwner); 175 | _owner = _previousOwner; 176 | } 177 | } 178 | 179 | // pragma solidity >=0.5.0; 180 | 181 | interface IUniswapV2Factory { 182 | event PairCreated(address indexed token0, address indexed token1, address pair, uint); 183 | 184 | function feeTo() external view returns (address); 185 | function feeToSetter() external view returns (address); 186 | 187 | function getPair(address tokenA, address tokenB) external view returns (address pair); 188 | function allPairs(uint) external view returns (address pair); 189 | function allPairsLength() external view returns (uint); 190 | 191 | function createPair(address tokenA, address tokenB) external returns (address pair); 192 | 193 | function setFeeTo(address) external; 194 | function setFeeToSetter(address) external; 195 | } 196 | 197 | 198 | // pragma solidity >=0.5.0; 199 | 200 | interface IUniswapV2Pair { 201 | event Approval(address indexed owner, address indexed spender, uint value); 202 | event Transfer(address indexed from, address indexed to, uint value); 203 | 204 | function name() external pure returns (string memory); 205 | function symbol() external pure returns (string memory); 206 | function decimals() external pure returns (uint8); 207 | function totalSupply() external view returns (uint); 208 | function balanceOf(address owner) external view returns (uint); 209 | function allowance(address owner, address spender) external view returns (uint); 210 | 211 | function approve(address spender, uint value) external returns (bool); 212 | function transfer(address to, uint value) external returns (bool); 213 | function transferFrom(address from, address to, uint value) external returns (bool); 214 | 215 | function DOMAIN_SEPARATOR() external view returns (bytes32); 216 | function PERMIT_TYPEHASH() external pure returns (bytes32); 217 | function nonces(address owner) external view returns (uint); 218 | 219 | function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; 220 | 221 | event Mint(address indexed sender, uint amount0, uint amount1); 222 | event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); 223 | event Swap( 224 | address indexed sender, 225 | uint amount0In, 226 | uint amount1In, 227 | uint amount0Out, 228 | uint amount1Out, 229 | address indexed to 230 | ); 231 | event Sync(uint112 reserve0, uint112 reserve1); 232 | 233 | function MINIMUM_LIQUIDITY() external pure returns (uint); 234 | function factory() external view returns (address); 235 | function token0() external view returns (address); 236 | function token1() external view returns (address); 237 | function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); 238 | function price0CumulativeLast() external view returns (uint); 239 | function price1CumulativeLast() external view returns (uint); 240 | function kLast() external view returns (uint); 241 | 242 | function mint(address to) external returns (uint liquidity); 243 | function burn(address to) external returns (uint amount0, uint amount1); 244 | function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; 245 | function skim(address to) external; 246 | function sync() external; 247 | 248 | function initialize(address, address) external; 249 | } 250 | 251 | // pragma solidity >=0.6.2; 252 | 253 | interface IUniswapV2Router01 { 254 | function factory() external pure returns (address); 255 | function WETH() external pure returns (address); 256 | 257 | function addLiquidity( 258 | address tokenA, 259 | address tokenB, 260 | uint amountADesired, 261 | uint amountBDesired, 262 | uint amountAMin, 263 | uint amountBMin, 264 | address to, 265 | uint deadline 266 | ) external returns (uint amountA, uint amountB, uint liquidity); 267 | function addLiquidityETH( 268 | address token, 269 | uint amountTokenDesired, 270 | uint amountTokenMin, 271 | uint amountETHMin, 272 | address to, 273 | uint deadline 274 | ) external payable returns (uint amountToken, uint amountETH, uint liquidity); 275 | function removeLiquidity( 276 | address tokenA, 277 | address tokenB, 278 | uint liquidity, 279 | uint amountAMin, 280 | uint amountBMin, 281 | address to, 282 | uint deadline 283 | ) external returns (uint amountA, uint amountB); 284 | function removeLiquidityETH( 285 | address token, 286 | uint liquidity, 287 | uint amountTokenMin, 288 | uint amountETHMin, 289 | address to, 290 | uint deadline 291 | ) external returns (uint amountToken, uint amountETH); 292 | function removeLiquidityWithPermit( 293 | address tokenA, 294 | address tokenB, 295 | uint liquidity, 296 | uint amountAMin, 297 | uint amountBMin, 298 | address to, 299 | uint deadline, 300 | bool approveMax, uint8 v, bytes32 r, bytes32 s 301 | ) external returns (uint amountA, uint amountB); 302 | function removeLiquidityETHWithPermit( 303 | address token, 304 | uint liquidity, 305 | uint amountTokenMin, 306 | uint amountETHMin, 307 | address to, 308 | uint deadline, 309 | bool approveMax, uint8 v, bytes32 r, bytes32 s 310 | ) external returns (uint amountToken, uint amountETH); 311 | function swapExactTokensForTokens( 312 | uint amountIn, 313 | uint amountOutMin, 314 | address[] calldata path, 315 | address to, 316 | uint deadline 317 | ) external returns (uint[] memory amounts); 318 | function swapTokensForExactTokens( 319 | uint amountOut, 320 | uint amountInMax, 321 | address[] calldata path, 322 | address to, 323 | uint deadline 324 | ) external returns (uint[] memory amounts); 325 | function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) 326 | external 327 | payable 328 | returns (uint[] memory amounts); 329 | function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) 330 | external 331 | returns (uint[] memory amounts); 332 | function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) 333 | external 334 | returns (uint[] memory amounts); 335 | function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) 336 | external 337 | payable 338 | returns (uint[] memory amounts); 339 | 340 | function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); 341 | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); 342 | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); 343 | function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); 344 | function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); 345 | } 346 | 347 | 348 | 349 | // pragma solidity >=0.6.2; 350 | 351 | interface IUniswapV2Router02 is IUniswapV2Router01 { 352 | function removeLiquidityETHSupportingFeeOnTransferTokens( 353 | address token, 354 | uint liquidity, 355 | uint amountTokenMin, 356 | uint amountETHMin, 357 | address to, 358 | uint deadline 359 | ) external returns (uint amountETH); 360 | function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( 361 | address token, 362 | uint liquidity, 363 | uint amountTokenMin, 364 | uint amountETHMin, 365 | address to, 366 | uint deadline, 367 | bool approveMax, uint8 v, bytes32 r, bytes32 s 368 | ) external returns (uint amountETH); 369 | 370 | function swapExactTokensForTokensSupportingFeeOnTransferTokens( 371 | uint amountIn, 372 | uint amountOutMin, 373 | address[] calldata path, 374 | address to, 375 | uint deadline 376 | ) external; 377 | function swapExactETHForTokensSupportingFeeOnTransferTokens( 378 | uint amountOutMin, 379 | address[] calldata path, 380 | address to, 381 | uint deadline 382 | ) external payable; 383 | function swapExactTokensForETHSupportingFeeOnTransferTokens( 384 | uint amountIn, 385 | uint amountOutMin, 386 | address[] calldata path, 387 | address to, 388 | uint deadline 389 | ) external; 390 | } 391 | 392 | 393 | contract ExzoCoin2_0 is Context, IERC20, Ownable { 394 | using SafeMath for uint256; 395 | using Address for address; 396 | 397 | mapping (address => uint256) private _rOwned; 398 | mapping (address => uint256) private _tOwned; 399 | mapping (address => mapping (address => uint256)) private _allowances; 400 | 401 | mapping (address => bool) private _isExcludedFromFee; 402 | 403 | mapping (address => bool) private _isExcluded; 404 | mapping (address => bool) private _isBlacklisted; 405 | 406 | address[] private _excluded; 407 | 408 | address payable public charityAddress = payable(0xE8E98a435576D94870739B0de03236182d1cbD34); 409 | 410 | uint256 private constant MAX = ~uint256(0); 411 | uint256 private _tTotal = 20000 * 10**6 * 10**9; 412 | uint256 private _rTotal = (MAX - (MAX % _tTotal)); 413 | uint256 private _tFeeTotal; 414 | 415 | string private _name = "Stefan Token"; 416 | string private _symbol = "STEFAN"; 417 | uint8 private _decimals = 9; 418 | 419 | uint256 public _charityFee = 20; 420 | uint256 private _previousCharityFee = _charityFee; 421 | 422 | uint256 public _burnFee = 0; 423 | uint256 private _previousBurnFee = _burnFee; 424 | 425 | uint256 public _reflectionFee = 20; 426 | uint256 private _previousReflectionFee = _reflectionFee; 427 | 428 | uint256 private _taxFee = _burnFee.add(_reflectionFee); 429 | uint256 private _previousTaxFee = _taxFee; 430 | 431 | uint256 private _crctLiquidityFee = 20; 432 | uint256 private _pcrctLiquidityFee = _crctLiquidityFee; 433 | 434 | uint256 private _liquidityFee = _charityFee.add(_crctLiquidityFee); 435 | uint256 private _previousLiquidityFee = _liquidityFee; 436 | 437 | IUniswapV2Router02 public uniswapV2Router; 438 | address public uniswapV2Pair; 439 | 440 | bool inSwapAndLiquify; 441 | bool public swapAndLiquifyEnabled = true; 442 | 443 | uint256 public _maxTxAmount = 200 * 10**6 * 10**9; 444 | uint256 private numTokensSellToAddToLiquidity = 10 * 10**6 * 10**9; 445 | 446 | 447 | event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); 448 | event SwapAndLiquifyEnabledUpdated(bool enabled); 449 | event SwapAndLiquify( 450 | uint256 tokensSwapped, 451 | uint256 ethReceived, 452 | uint256 tokensIntoLiqudity 453 | ); 454 | 455 | modifier lockTheSwap { 456 | inSwapAndLiquify = true; 457 | _; 458 | inSwapAndLiquify = false; 459 | } 460 | 461 | constructor () { 462 | _rOwned[_msgSender()] = _rTotal; 463 | 464 | IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E); 465 | // Create a uniswap pair for this new token 466 | uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) 467 | .createPair(address(this), _uniswapV2Router.WETH()); 468 | 469 | // set the rest of the contract variables 470 | uniswapV2Router = _uniswapV2Router; 471 | 472 | //exclude owner and this contract from fee 473 | _isExcludedFromFee[owner()] = true; 474 | _isExcludedFromFee[address(this)] = true; 475 | 476 | //Exclude dead address from reflection 477 | _isExcluded[address(0)] = true; 478 | 479 | emit Transfer(address(0), _msgSender(), _tTotal); 480 | } 481 | 482 | function name() public view returns (string memory) { 483 | return _name; 484 | } 485 | 486 | function symbol() public view returns (string memory) { 487 | return _symbol; 488 | } 489 | 490 | function decimals() public view returns (uint8) { 491 | return _decimals; 492 | } 493 | 494 | function totalSupply() public view override returns (uint256) { 495 | return _tTotal; 496 | } 497 | 498 | function balanceOf(address account) public view override returns (uint256) { 499 | if (_isExcluded[account]) return _tOwned[account]; 500 | return tokenFromReflection(_rOwned[account]); 501 | } 502 | 503 | function transfer(address recipient, uint256 amount) public override returns (bool) { 504 | _transfer(_msgSender(), recipient, amount); 505 | return true; 506 | } 507 | 508 | function allowance(address owner, address spender) public view override returns (uint256) { 509 | return _allowances[owner][spender]; 510 | } 511 | 512 | function approve(address spender, uint256 amount) public override returns (bool) { 513 | _approve(_msgSender(), spender, amount); 514 | return true; 515 | } 516 | 517 | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { 518 | _transfer(sender, recipient, amount); 519 | _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 520 | return true; 521 | } 522 | 523 | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { 524 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); 525 | return true; 526 | } 527 | 528 | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { 529 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 530 | return true; 531 | } 532 | 533 | function isExcludedFromReward(address account) public view returns (bool) { 534 | return _isExcluded[account]; 535 | } 536 | 537 | function totalFees() public view returns (uint256) { 538 | return _tFeeTotal; 539 | } 540 | 541 | function getliquidityFee() public view returns (uint256) 542 | { 543 | return _crctLiquidityFee; 544 | } 545 | 546 | function deliver(uint256 tAmount) public { 547 | address sender = _msgSender(); 548 | require(!_isExcluded[sender], "Excluded addresses cannot call this function"); 549 | (uint256 rAmount,,,,,,) = _getValues(tAmount); 550 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 551 | _rTotal = _rTotal.sub(rAmount); 552 | _tFeeTotal = _tFeeTotal.add(tAmount); 553 | } 554 | 555 | function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { 556 | require(tAmount <= _tTotal, "Amount must be less than supply"); 557 | if (!deductTransferFee) { 558 | (uint256 rAmount,,,,,,) = _getValues(tAmount); 559 | return rAmount; 560 | } else { 561 | (,uint256 rTransferAmount,,,,,) = _getValues(tAmount); 562 | return rTransferAmount; 563 | } 564 | } 565 | 566 | function tokenFromReflection(uint256 rAmount) public view returns(uint256) { 567 | require(rAmount <= _rTotal, "Amount must be less than total reflections"); 568 | uint256 currentRate = _getRate(); 569 | return rAmount.div(currentRate); 570 | } 571 | 572 | function excludeFromReward(address account) public onlyOwner() { 573 | // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); 574 | require(!_isExcluded[account], "Account is already excluded"); 575 | if(_rOwned[account] > 0) { 576 | _tOwned[account] = tokenFromReflection(_rOwned[account]); 577 | } 578 | _isExcluded[account] = true; 579 | _excluded.push(account); 580 | } 581 | 582 | function includeInReward(address account) external onlyOwner() { 583 | require(_isExcluded[account], "Account is already excluded"); 584 | for (uint256 i = 0; i < _excluded.length; i++) { 585 | if (_excluded[i] == account) { 586 | _excluded[i] = _excluded[_excluded.length - 1]; 587 | _tOwned[account] = 0; 588 | _isExcluded[account] = false; 589 | _excluded.pop(); 590 | break; 591 | } 592 | } 593 | } 594 | 595 | function _burn(address account, uint256 amount) internal { 596 | require(account != address(0), "BEP20: burn from the zero address"); 597 | 598 | _tOwned[address(0)] = _tOwned[address(0)].add(amount); 599 | emit Transfer(account, address(0), amount); 600 | } 601 | 602 | function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { 603 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 bFee, uint256 tLiquidity) = _getValues(tAmount); 604 | _tOwned[sender] = _tOwned[sender].sub(tAmount); 605 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 606 | _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); 607 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 608 | 609 | if(_burnFee > 0 && _taxFee > 0) _burn(sender, bFee); 610 | _takeLiquidity(tLiquidity); 611 | _reflectFee(rFee, tFee); 612 | emit Transfer(sender, recipient, tTransferAmount); 613 | } 614 | 615 | function excludeFromFee(address account) public onlyOwner { 616 | _isExcludedFromFee[account] = true; 617 | } 618 | 619 | function includeInFee(address account) public onlyOwner { 620 | _isExcludedFromFee[account] = false; 621 | } 622 | 623 | function setBurnFeePercent(uint256 Fee) external onlyOwner() { 624 | _burnFee = Fee; 625 | _taxFee = _burnFee.add(_reflectionFee); 626 | } 627 | 628 | function setCharityFeePercent(uint256 Fee) external onlyOwner() { 629 | _charityFee = Fee; 630 | _liquidityFee = _crctLiquidityFee.add(_charityFee); 631 | } 632 | 633 | function setReflectFeePercent(uint256 Fee) external onlyOwner() { 634 | _reflectionFee = Fee; 635 | _taxFee = _burnFee.add(_reflectionFee); 636 | } 637 | 638 | function setLiquidityFeePercent(uint256 Fee) external onlyOwner() { 639 | _crctLiquidityFee = Fee; 640 | _liquidityFee = _crctLiquidityFee.add(_charityFee); 641 | } 642 | 643 | function setMaxTxTokens(uint256 maxTxTokens) external onlyOwner() { 644 | _maxTxAmount = maxTxTokens.mul( 10**_decimals ); 645 | } 646 | 647 | function setCharityAddress(address payable _charityAddress) external onlyOwner() { 648 | charityAddress = _charityAddress; 649 | } 650 | 651 | function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { 652 | swapAndLiquifyEnabled = _enabled; 653 | emit SwapAndLiquifyEnabledUpdated(_enabled); 654 | } 655 | 656 | //to recieve ETH from uniswapV2Router when swaping 657 | receive() external payable {} 658 | 659 | function _reflectFee(uint256 rFee, uint256 tFee) private { 660 | _rTotal = _rTotal.sub(rFee); 661 | _tFeeTotal = _tFeeTotal.add(tFee); 662 | } 663 | 664 | function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256) { 665 | (uint256 tTransferAmount, uint256 tFee, uint256 bFee, uint256 tLiquidity) = _getTValues(tAmount); 666 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, bFee, _getRate()); 667 | return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, bFee, tLiquidity); 668 | } 669 | 670 | function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) { 671 | uint256 tFee = calculateReflectionFee(tAmount); 672 | uint256 bFee = calculateBurnFee(tAmount); 673 | uint256 tLiquidity = calculateLiquidityFee(tAmount); 674 | uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(bFee); 675 | return (tTransferAmount, tFee, bFee, tLiquidity); 676 | } 677 | 678 | function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 bFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) { 679 | uint256 rAmount = tAmount.mul(currentRate); 680 | uint256 rFee = tFee.mul(currentRate); 681 | uint256 rbFee = bFee.mul(currentRate); 682 | uint256 rLiquidity = tLiquidity.mul(currentRate); 683 | uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rbFee); 684 | return (rAmount, rTransferAmount, rFee); 685 | } 686 | 687 | function _getRate() private view returns(uint256) { 688 | (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); 689 | return rSupply.div(tSupply); 690 | } 691 | 692 | function _getCurrentSupply() private view returns(uint256, uint256) { 693 | uint256 rSupply = _rTotal; 694 | uint256 tSupply = _tTotal; 695 | for (uint256 i = 0; i < _excluded.length; i++) { 696 | if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); 697 | rSupply = rSupply.sub(_rOwned[_excluded[i]]); 698 | tSupply = tSupply.sub(_tOwned[_excluded[i]]); 699 | } 700 | if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); 701 | return (rSupply, tSupply); 702 | } 703 | 704 | function _takeLiquidity(uint256 tLiquidity) private { 705 | uint256 currentRate = _getRate(); 706 | uint256 rLiquidity = tLiquidity.mul(currentRate); 707 | _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); 708 | if(_isExcluded[address(this)]) 709 | _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); 710 | } 711 | 712 | function calculateBurnFee(uint256 _amount) private view returns (uint256) { 713 | return _amount.mul(_burnFee).div( 714 | 10**3 715 | ); 716 | } 717 | 718 | function calculateReflectionFee(uint256 _amount) private view returns (uint256) { 719 | return _amount.mul(_reflectionFee).div( 720 | 10**3 721 | ); 722 | } 723 | 724 | function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { 725 | return _amount.mul(_liquidityFee).div( 726 | 10**3 727 | ); 728 | } 729 | 730 | function removeAllFee() private { 731 | if(_taxFee == 0 && _liquidityFee == 0 && _burnFee == 0 && 732 | _charityFee == 0 && _reflectionFee == 0 && _crctLiquidityFee == 0) return; 733 | 734 | _pcrctLiquidityFee = _crctLiquidityFee; 735 | _previousBurnFee = _burnFee; // burn fee 736 | _previousCharityFee = _charityFee; // charity fee 737 | _previousReflectionFee = _reflectionFee; //reflection fee 738 | _previousTaxFee = _taxFee; 739 | _previousLiquidityFee = _liquidityFee; 740 | 741 | _crctLiquidityFee = 0; 742 | _burnFee = 0; 743 | _charityFee = 0; 744 | _reflectionFee = 0; 745 | _taxFee = 0; 746 | _liquidityFee = 0; 747 | } 748 | 749 | function restoreAllFee() private { 750 | _crctLiquidityFee = _pcrctLiquidityFee; 751 | _burnFee = _previousBurnFee; // burn fee 752 | _charityFee = _previousCharityFee; // charity fee 753 | _reflectionFee = _previousReflectionFee; //reflection fee 754 | _taxFee = _previousTaxFee; 755 | _liquidityFee = _previousLiquidityFee; 756 | } 757 | 758 | function isExcludedFromFee(address account) public view returns(bool) { 759 | return _isExcludedFromFee[account]; 760 | } 761 | 762 | function setMinTokensSendToCharity(uint256 minCharityValue) public onlyOwner() 763 | { 764 | numTokensSellToAddToLiquidity = minCharityValue; 765 | } 766 | 767 | function _approve(address owner, address spender, uint256 amount) private { 768 | require(owner != address(0), "ERC20: approve from the zero address"); 769 | require(spender != address(0), "ERC20: approve to the zero address"); 770 | 771 | _allowances[owner][spender] = amount; 772 | emit Approval(owner, spender, amount); 773 | } 774 | 775 | function _transfer( 776 | address from, 777 | address to, 778 | uint256 amount 779 | ) private { 780 | require(from != address(0), "ERC20: transfer from the zero address"); 781 | require(to != address(0), "ERC20: transfer to the zero address"); 782 | require(amount > 0, "Transfer amount must be greater than zero"); 783 | require(_isBlacklisted[from] == false, "You are banned"); 784 | require(_isBlacklisted[to] == false, "The recipient is banned"); 785 | if(from != owner() && to != owner()) 786 | require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); 787 | 788 | uint256 contractTokenBalance = balanceOf(address(this)); 789 | 790 | if(contractTokenBalance >= _maxTxAmount) 791 | { 792 | contractTokenBalance = _maxTxAmount; 793 | } 794 | 795 | bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; 796 | if ( 797 | overMinTokenBalance && 798 | !inSwapAndLiquify && 799 | from != uniswapV2Pair && 800 | swapAndLiquifyEnabled 801 | ) { 802 | contractTokenBalance = numTokensSellToAddToLiquidity; 803 | //add liquidity 804 | swapAndLiquify(contractTokenBalance); 805 | } 806 | 807 | //indicates if fee should be deducted from transfer 808 | bool takeFee = true; 809 | 810 | //if any account belongs to _isExcludedFromFee account then remove the fee 811 | if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ 812 | takeFee = false; 813 | } 814 | 815 | //transfer amount, it will take tax, burn, liquidity fee 816 | _tokenTransfer(from,to,amount,takeFee); 817 | } 818 | 819 | function swapAndLiquify(uint256 tokenBalance) private lockTheSwap { 820 | uint256 liquidityAmount = tokenBalance; 821 | uint256 initialBalance = address(this).balance; 822 | 823 | if(_charityFee > 0) 824 | { 825 | uint256 charityAmount = tokenBalance.mul(_charityFee); 826 | charityAmount = charityAmount.div(_liquidityFee); 827 | liquidityAmount = tokenBalance.sub(charityAmount); 828 | swapToCharityETH(charityAddress, charityAmount); 829 | 830 | initialBalance = address(this).balance; 831 | } 832 | 833 | if(_crctLiquidityFee > 0) 834 | { 835 | uint256 half = liquidityAmount.div(2); 836 | uint256 otherHalf = liquidityAmount.sub(half); 837 | 838 | swapTokensForEth(half); 839 | 840 | uint256 newBalance = address(this).balance.sub(initialBalance); 841 | 842 | addLiquidity(otherHalf, newBalance); 843 | 844 | emit SwapAndLiquify(half, newBalance, otherHalf); 845 | } 846 | } 847 | 848 | function swapToCharityETH(address payable recipient, uint256 tokenAmount) private { 849 | address[] memory path = new address[](2); 850 | path[0] = address(this); 851 | path[1] = uniswapV2Router.WETH(); 852 | 853 | _approve(address(this), address(uniswapV2Router), tokenAmount); 854 | 855 | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( 856 | tokenAmount, 857 | 0, // accept any amount of ETH 858 | path, 859 | recipient, 860 | block.timestamp 861 | ); 862 | } 863 | 864 | function swapTokensForEth(uint256 tokenAmount) private { 865 | address[] memory path = new address[](2); 866 | path[0] = address(this); 867 | path[1] = uniswapV2Router.WETH(); 868 | 869 | _approve(address(this), address(uniswapV2Router), tokenAmount); 870 | 871 | // make the swap 872 | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( 873 | tokenAmount, 874 | 0, // accept any amount of ETH 875 | path, 876 | address(this), 877 | block.timestamp 878 | ); 879 | } 880 | 881 | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { 882 | _approve(address(this), address(uniswapV2Router), tokenAmount); 883 | 884 | uniswapV2Router.addLiquidityETH{value: ethAmount}( 885 | address(this), 886 | tokenAmount, 887 | 0, // slippage is unavoidable 888 | 0, // slippage is unavoidable 889 | owner(), 890 | block.timestamp 891 | ); 892 | } 893 | 894 | function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { 895 | if(!takeFee) 896 | removeAllFee(); 897 | 898 | if (_isExcluded[sender] && !_isExcluded[recipient]) { 899 | _transferFromExcluded(sender, recipient, amount); 900 | } else if (!_isExcluded[sender] && _isExcluded[recipient]) { 901 | _transferToExcluded(sender, recipient, amount); 902 | } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { 903 | _transferStandard(sender, recipient, amount); 904 | } else if (_isExcluded[sender] && _isExcluded[recipient]) { 905 | _transferBothExcluded(sender, recipient, amount); 906 | } else { 907 | _transferStandard(sender, recipient, amount); 908 | } 909 | 910 | if(!takeFee) 911 | restoreAllFee(); 912 | } 913 | 914 | function _transferStandard(address sender, address recipient, uint256 tAmount) private { 915 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 bFee, uint256 tLiquidity) = _getValues(tAmount); 916 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 917 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 918 | 919 | if(_burnFee > 0 && _taxFee > 0) _burn(sender, bFee); 920 | _takeLiquidity(tLiquidity); 921 | _reflectFee(rFee, tFee); 922 | emit Transfer(sender, recipient, tTransferAmount); 923 | } 924 | 925 | function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { 926 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 bFee, uint256 tLiquidity) = _getValues(tAmount); 927 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 928 | _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); 929 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 930 | 931 | if(_burnFee > 0 && _taxFee > 0) _burn(sender, bFee); 932 | _takeLiquidity(tLiquidity); 933 | _reflectFee(rFee, tFee); 934 | emit Transfer(sender, recipient, tTransferAmount); 935 | } 936 | 937 | function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { 938 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 bFee, uint256 tLiquidity) = _getValues(tAmount); 939 | _tOwned[sender] = _tOwned[sender].sub(tAmount); 940 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 941 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 942 | 943 | if(_burnFee > 0 && _taxFee > 0) _burn(sender, bFee); 944 | _takeLiquidity(tLiquidity); 945 | _reflectFee(rFee, tFee); 946 | emit Transfer(sender, recipient, tTransferAmount); 947 | } 948 | 949 | 950 | function blacklistSingleWallet(address addresses) public onlyOwner(){ 951 | if(_isBlacklisted[addresses] == true) return; 952 | _isBlacklisted[addresses] = true; 953 | } 954 | 955 | function blacklistMultipleWallets(address[] calldata addresses) public onlyOwner(){ 956 | for (uint256 i; i < addresses.length; ++i) { 957 | _isBlacklisted[addresses[i]] = true; 958 | } 959 | } 960 | 961 | function isBlacklisted(address addresses) public view returns (bool){ 962 | if(_isBlacklisted[addresses] == true) return true; 963 | else return false; 964 | } 965 | 966 | 967 | function unBlacklistSingleWallet(address addresses) external onlyOwner(){ 968 | if(_isBlacklisted[addresses] == false) return; 969 | _isBlacklisted[addresses] = false; 970 | } 971 | 972 | function unBlacklistMultipleWallets(address[] calldata addresses) public onlyOwner(){ 973 | for (uint256 i; i < addresses.length; ++i) { 974 | _isBlacklisted[addresses[i]] = false; 975 | } 976 | } 977 | 978 | function recoverTokens() public onlyOwner() 979 | { 980 | address recipient = _msgSender(); 981 | uint256 tokensToRecover = balanceOf(address(this)); 982 | uint256 currentRate = _getRate(); 983 | uint256 rtokensToRecover = tokensToRecover.mul(currentRate); 984 | _rOwned[address(this)] = _rOwned[address(this)].sub(rtokensToRecover); 985 | _rOwned[recipient] = _rOwned[recipient].add(rtokensToRecover); 986 | } 987 | 988 | function recoverBNB() public onlyOwner() 989 | { 990 | address payable recipient = _msgSender(); 991 | if(address(this).balance > 0) 992 | recipient.transfer(address(this).balance); 993 | } 994 | 995 | //New Pancakeswap router version? 996 | //No problem, just change it! 997 | function setRouterAddress(address newRouter) public onlyOwner() { 998 | IUniswapV2Router02 _newPancakeRouter = IUniswapV2Router02(newRouter); 999 | uniswapV2Pair = IUniswapV2Factory(_newPancakeRouter.factory()).createPair(address(this), _newPancakeRouter.WETH()); 1000 | uniswapV2Router = _newPancakeRouter; 1001 | } 1002 | 1003 | } 1004 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Exzo Network 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ERC-20-token-smart-contract 2 | An ERC-20 standard for smart contract design of tokenization for a digital asset. 3 | 4 | Security audit: https://www.certik.com/projects/exzocoin#audit 5 | -------------------------------------------------------------------------------- /Read.ME: -------------------------------------------------------------------------------- 1 | ERC-20 Smart contract audit: https://www.certik.com/projects/exzocoin#audit 2 | --------------------------------------------------------------------------------