Transaction Hash:
Block:
13227657 at Sep-15-2021 02:34:21 AM +UTC
Transaction Fee:
0.0021314089782939 ETH
$4.14
Gas Used:
46,650 Gas / 45.689367166 Gwei
Emitted Events:
| 197 |
L1T.Approval( owner=[Sender] 0x32a00fa2fd91c7787d856c82ba0b6239848c4eee, spender=0x7a250d56...659F2488D, value=115792089237316195423570985008687907853269984665640564039457584007913129639935 )
|
Account State Difference:
| Address | Before | After | State Difference | ||
|---|---|---|---|---|---|
| 0x30BAAdB0...b1E596feF | |||||
| 0x32a00FA2...9848c4eeE |
0.751923493496952006 Eth
Nonce: 28
|
0.749792084518658106 Eth
Nonce: 29
| 0.0021314089782939 | ||
|
0xEA674fdD...16B898ec8
Miner
| (Ethermine) | 1,823.982506833424310872 Eth | 1,823.982576808424310872 Eth | 0.000069975 |
Execution Trace
L1T.approve( spender=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, amount=115792089237316195423570985008687907853269984665640564039457584007913129639935 ) => ( True )
{"Context.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\n/*\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\r\n return msg.data;\r\n }\r\n}"},"DividendPayingToken.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\nimport \"./ERC20.sol\";\r\nimport \"./SafeMath.sol\";\r\nimport \"./SafeMathUint.sol\";\r\nimport \"./SafeMathInt.sol\";\r\nimport \"./DividendPayingTokenInterface.sol\";\r\nimport \"./DividendPayingTokenOptionalInterface.sol\";\r\n\r\n\r\n/// @title Dividend-Paying Token\r\n/// @author Roger Wu (https://github.com/roger-wu)\r\n/// @dev A mintable ERC20 token that allows anyone to pay and distribute ether\r\n/// to token holders as dividends and allows token holders to withdraw their dividends.\r\n/// Reference: the source code of PoWH3D: https://etherscan.io/address/0xB3775fB83F7D12A36E0475aBdD1FCA35c091efBe#code\r\ncontract DividendPayingToken is ERC20, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {\r\n using SafeMath for uint256;\r\n using SafeMathUint for uint256;\r\n using SafeMathInt for int256;\r\n\r\n // With `magnitude`, we can properly distribute dividends even if the amount of received ether is small.\r\n // For more discussion about choosing the value of `magnitude`,\r\n // see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728\r\n uint256 constant internal magnitude = 2**128;\r\n\r\n uint256 internal magnifiedDividendPerShare;\r\n\r\n // About dividendCorrection:\r\n // If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with:\r\n // `dividendOf(_user) = dividendPerShare * balanceOf(_user)`.\r\n // When `balanceOf(_user)` is changed (via minting/burning/transferring tokens),\r\n // `dividendOf(_user)` should not be changed,\r\n // but the computed value of `dividendPerShare * balanceOf(_user)` is changed.\r\n // To keep the `dividendOf(_user)` unchanged, we add a correction term:\r\n // `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`,\r\n // where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed:\r\n // `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`.\r\n // So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed.\r\n mapping(address =\u003e int256) internal magnifiedDividendCorrections;\r\n mapping(address =\u003e uint256) internal withdrawnDividends;\r\n\r\n uint256 public totalDividendsDistributed;\r\n\r\n constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {\r\n\r\n }\r\n\r\n /// @dev Distributes dividends whenever ether is paid to this contract.\r\n receive() external payable {\r\n distributeDividends();\r\n }\r\n\r\n /// @notice Distributes ether to token holders as dividends.\r\n /// @dev It reverts if the total supply of tokens is 0.\r\n /// It emits the `DividendsDistributed` event if the amount of received ether is greater than 0.\r\n /// About undistributed ether:\r\n /// In each distribution, there is a small amount of ether not distributed,\r\n /// the magnified amount of which is\r\n /// `(msg.value * magnitude) % totalSupply()`.\r\n /// With a well-chosen `magnitude`, the amount of undistributed ether\r\n /// (de-magnified) in a distribution can be less than 1 wei.\r\n /// We can actually keep track of the undistributed ether in a distribution\r\n /// and try to distribute it in the next distribution,\r\n /// but keeping track of such data on-chain costs much more than\r\n /// the saved ether, so we don\u0027t do that.\r\n function distributeDividends() public override payable {\r\n require(totalSupply() \u003e 0);\r\n\r\n if (msg.value \u003e 0) {\r\n magnifiedDividendPerShare = magnifiedDividendPerShare.add(\r\n (msg.value).mul(magnitude) / totalSupply()\r\n );\r\n emit DividendsDistributed(msg.sender, msg.value);\r\n\r\n totalDividendsDistributed = totalDividendsDistributed.add(msg.value);\r\n }\r\n }\r\n\r\n /// @notice Withdraws the ether distributed to the sender.\r\n /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.\r\n function withdrawDividend() public virtual override {\r\n _withdrawDividendOfUser(payable(msg.sender));\r\n }\r\n\r\n /// @notice Withdraws the ether distributed to the sender.\r\n /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.\r\n function _withdrawDividendOfUser(address payable user) internal returns (uint256) {\r\n uint256 _withdrawableDividend = withdrawableDividendOf(user);\r\n if (_withdrawableDividend \u003e 0) {\r\n withdrawnDividends[user] = withdrawnDividends[user].add(_withdrawableDividend);\r\n emit DividendWithdrawn(user, _withdrawableDividend);\r\n (bool success,) = user.call{value: _withdrawableDividend, gas: 3000}(\"\");\r\n\r\n if(!success) {\r\n withdrawnDividends[user] = withdrawnDividends[user].sub(_withdrawableDividend);\r\n return 0;\r\n }\r\n\r\n return _withdrawableDividend;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n\r\n /// @notice View the amount of dividend in wei that an address can withdraw.\r\n /// @param _owner The address of a token holder.\r\n /// @return The amount of dividend in wei that `_owner` can withdraw.\r\n function dividendOf(address _owner) public view override returns(uint256) {\r\n return withdrawableDividendOf(_owner);\r\n }\r\n\r\n /// @notice View the amount of dividend in wei that an address can withdraw.\r\n /// @param _owner The address of a token holder.\r\n /// @return The amount of dividend in wei that `_owner` can withdraw.\r\n function withdrawableDividendOf(address _owner) public view override returns(uint256) {\r\n return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);\r\n }\r\n\r\n /// @notice View the amount of dividend in wei that an address has withdrawn.\r\n /// @param _owner The address of a token holder.\r\n /// @return The amount of dividend in wei that `_owner` has withdrawn.\r\n function withdrawnDividendOf(address _owner) public view override returns(uint256) {\r\n return withdrawnDividends[_owner];\r\n }\r\n\r\n\r\n /// @notice View the amount of dividend in wei that an address has earned in total.\r\n /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)\r\n /// = (magnifiedDividendPerShare * balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude\r\n /// @param _owner The address of a token holder.\r\n /// @return The amount of dividend in wei that `_owner` has earned in total.\r\n function accumulativeDividendOf(address _owner) public view override returns(uint256) {\r\n return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe()\r\n .add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude;\r\n }\r\n\r\n /// @dev Internal function that transfer tokens from one address to another.\r\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\r\n /// @param from The address to transfer from.\r\n /// @param to The address to transfer to.\r\n /// @param value The amount to be transferred.\r\n function _transfer(address from, address to, uint256 value) internal virtual override {\r\n require(false);\r\n\r\n int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256Safe();\r\n magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);\r\n magnifiedDividendCorrections[to] = magnifiedDividendCorrections[to].sub(_magCorrection);\r\n }\r\n\r\n /// @dev Internal function that mints tokens to an account.\r\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\r\n /// @param account The account that will receive the created tokens.\r\n /// @param value The amount that will be created.\r\n function _mint(address account, uint256 value) internal override {\r\n super._mint(account, value);\r\n\r\n magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]\r\n .sub( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );\r\n }\r\n\r\n /// @dev Internal function that burns an amount of the token of a given account.\r\n /// Update magnifiedDividendCorrections to keep dividends unchanged.\r\n /// @param account The account whose tokens will be burnt.\r\n /// @param value The amount that will be burnt.\r\n function _burn(address account, uint256 value) internal override {\r\n super._burn(account, value);\r\n\r\n magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]\r\n .add( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );\r\n }\r\n\r\n function _setBalance(address account, uint256 newBalance) internal {\r\n uint256 currentBalance = balanceOf(account);\r\n\r\n if(newBalance \u003e currentBalance) {\r\n uint256 mintAmount = newBalance.sub(currentBalance);\r\n _mint(account, mintAmount);\r\n } else if(newBalance \u003c currentBalance) {\r\n uint256 burnAmount = currentBalance.sub(newBalance);\r\n _burn(account, burnAmount);\r\n }\r\n }\r\n}\r\n"},"DividendPayingTokenInterface.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\n\r\n/// @title Dividend-Paying Token Interface\r\n/// @author Roger Wu (https://github.com/roger-wu)\r\n/// @dev An interface for a dividend-paying token contract.\r\ninterface DividendPayingTokenInterface {\r\n /// @notice View the amount of dividend in wei that an address can withdraw.\r\n /// @param _owner The address of a token holder.\r\n /// @return The amount of dividend in wei that `_owner` can withdraw.\r\n function dividendOf(address _owner) external view returns(uint256);\r\n\r\n /// @notice Distributes ether to token holders as dividends.\r\n /// @dev SHOULD distribute the paid ether to token holders as dividends.\r\n /// SHOULD NOT directly transfer ether to token holders in this function.\r\n /// MUST emit a `DividendsDistributed` event when the amount of distributed ether is greater than 0.\r\n function distributeDividends() external payable;\r\n\r\n /// @notice Withdraws the ether distributed to the sender.\r\n /// @dev SHOULD transfer `dividendOf(msg.sender)` wei to `msg.sender`, and `dividendOf(msg.sender)` SHOULD be 0 after the transfer.\r\n /// MUST emit a `DividendWithdrawn` event if the amount of ether transferred is greater than 0.\r\n function withdrawDividend() external;\r\n\r\n /// @dev This event MUST emit when ether is distributed to token holders.\r\n /// @param from The address which sends ether to this contract.\r\n /// @param weiAmount The amount of distributed ether in wei.\r\n event DividendsDistributed(\r\n address indexed from,\r\n uint256 weiAmount\r\n );\r\n\r\n /// @dev This event MUST emit when an address withdraws their dividend.\r\n /// @param to The address which withdraws ether from this contract.\r\n /// @param weiAmount The amount of withdrawn ether in wei.\r\n event DividendWithdrawn(\r\n address indexed to,\r\n uint256 weiAmount\r\n );\r\n}\r\n"},"DividendPayingTokenOptionalInterface.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\n\r\n/// @title Dividend-Paying Token Optional Interface\r\n/// @author Roger Wu (https://github.com/roger-wu)\r\n/// @dev OPTIONAL functions for a dividend-paying token contract.\r\ninterface DividendPayingTokenOptionalInterface {\r\n /// @notice View the amount of dividend in wei that an address can withdraw.\r\n /// @param _owner The address of a token holder.\r\n /// @return The amount of dividend in wei that `_owner` can withdraw.\r\n function withdrawableDividendOf(address _owner) external view returns(uint256);\r\n\r\n /// @notice View the amount of dividend in wei that an address has withdrawn.\r\n /// @param _owner The address of a token holder.\r\n /// @return The amount of dividend in wei that `_owner` has withdrawn.\r\n function withdrawnDividendOf(address _owner) external view returns(uint256);\r\n\r\n /// @notice View the amount of dividend in wei that an address has earned in total.\r\n /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)\r\n /// @param _owner The address of a token holder.\r\n /// @return The amount of dividend in wei that `_owner` has earned in total.\r\n function accumulativeDividendOf(address _owner) external view returns(uint256);\r\n}"},"ERC20.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\nimport \"./IERC20.sol\";\r\nimport \"./IERC20Metadata.sol\";\r\nimport \"./Context.sol\";\r\nimport \"./SafeMath.sol\";\r\n\r\n/**\r\n * @dev Implementation of the {IERC20} interface.\r\n *\r\n * This implementation is agnostic to the way tokens are created. This means\r\n * that a supply mechanism has to be added in a derived contract using {_mint}.\r\n * For a generic mechanism see {ERC20PresetMinterPauser}.\r\n *\r\n * TIP: For a detailed writeup see our guide\r\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\r\n * to implement supply mechanisms].\r\n *\r\n * We have followed general OpenZeppelin guidelines: functions revert instead\r\n * of returning `false` on failure. This behavior is nonetheless conventional\r\n * and does not conflict with the expectations of ERC20 applications.\r\n *\r\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\r\n * This allows applications to reconstruct the allowance for all accounts just\r\n * by listening to said events. Other implementations of the EIP may not emit\r\n * these events, as it isn\u0027t required by the specification.\r\n *\r\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\r\n * functions have been added to mitigate the well-known issues around setting\r\n * allowances. See {IERC20-approve}.\r\n */\r\ncontract ERC20 is Context, IERC20, IERC20Metadata {\r\n using SafeMath for uint256;\r\n\r\n mapping(address =\u003e uint256) private _balances;\r\n\r\n mapping(address =\u003e mapping(address =\u003e uint256)) private _allowances;\r\n\r\n uint256 private _totalSupply;\r\n\r\n string private _name;\r\n string private _symbol;\r\n\r\n /**\r\n * @dev Sets the values for {name} and {symbol}.\r\n *\r\n * The default value of {decimals} is 18. To select a different value for\r\n * {decimals} you should overload it.\r\n *\r\n * All two of these values are immutable: they can only be set once during\r\n * construction.\r\n */\r\n constructor(string memory name_, string memory symbol_) {\r\n _name = name_;\r\n _symbol = symbol_;\r\n }\r\n\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n\r\n /**\r\n * @dev Returns the symbol of the token, usually a shorter version of the\r\n * name.\r\n */\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of decimals used to get its user representation.\r\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\r\n *\r\n * Tokens usually opt for a value of 18, imitating the relationship between\r\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\r\n * overridden;\r\n *\r\n * NOTE: This information is only used for _display_ purposes: it in\r\n * no way affects any of the arithmetic of the contract, including\r\n * {IERC20-balanceOf} and {IERC20-transfer}.\r\n */\r\n function decimals() public view virtual override returns (uint8) {\r\n return 9;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-totalSupply}.\r\n */\r\n function totalSupply() public view virtual override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-balanceOf}.\r\n */\r\n function balanceOf(address account) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transfer}.\r\n *\r\n * Requirements:\r\n *\r\n * - `recipient` cannot be the zero address.\r\n * - the caller must have a balance of at least `amount`.\r\n */\r\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-allowance}.\r\n */\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-approve}.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transferFrom}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance. This is not\r\n * required by the EIP. See the note at the beginning of {ERC20}.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` and `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n * - the caller must have allowance for ``sender``\u0027s tokens of at least\r\n * `amount`.\r\n */\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _transfer(sender, recipient, amount);\r\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically increases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `spender` must have allowance for the caller of at least\r\n * `subtractedValue`.\r\n */\r\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Moves tokens `amount` from `sender` to `recipient`.\r\n *\r\n * This is internal function is equivalent to {transfer}, and can be used to\r\n * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n *\r\n * Emits a {Transfer} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` cannot be the zero address.\r\n * - `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n */\r\n function _transfer(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) internal virtual {\r\n require(sender != address(0), \"ERC20: transfer from the zero address\");\r\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(sender, recipient, amount);\r\n\r\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\r\n _balances[recipient] = _balances[recipient].add(amount);\r\n emit Transfer(sender, recipient, amount);\r\n }\r\n\r\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\r\n * the total supply.\r\n *\r\n * Emits a {Transfer} event with `from` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n */\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n\r\n _beforeTokenTransfer(address(0), account, amount);\r\n\r\n _totalSupply = _totalSupply.add(amount);\r\n _balances[account] = _balances[account].add(amount);\r\n emit Transfer(address(0), account, amount);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens from `account`, reducing the\r\n * total supply.\r\n *\r\n * Emits a {Transfer} event with `to` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n * - `account` must have at least `amount` tokens.\r\n */\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n _beforeTokenTransfer(account, address(0), amount);\r\n\r\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\r\n _totalSupply = _totalSupply.sub(amount);\r\n emit Transfer(account, address(0), amount);\r\n }\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\r\n *\r\n * This internal function is equivalent to `approve`, and can be used to\r\n * e.g. set automatic allowances for certain subsystems, etc.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `owner` cannot be the zero address.\r\n * - `spender` cannot be the zero address.\r\n */\r\n function _approve(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``\u0027s tokens\r\n * will be to transferred to `to`.\r\n * - when `from` is zero, `amount` tokens will be minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``\u0027s tokens will be burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _beforeTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n}\r\n"},"IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller\u0027s account to `recipient`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller\u0027s tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender\u0027s allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\r\n * allowance mechanism. `amount` is then deducted from the caller\u0027s\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) external returns (bool);\r\n\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}"},"IERC20Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\nimport \"./IERC20.sol\";\r\n\r\n/**\r\n * @dev Interface for the optional metadata functions from the ERC20 standard.\r\n *\r\n * _Available since v4.1._\r\n */\r\ninterface IERC20Metadata is IERC20 {\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the symbol of the token.\r\n */\r\n function symbol() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the decimals places of the token.\r\n */\r\n function decimals() external view returns (uint8);\r\n}"},"IterableMapping.sol":{"content":"// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.6;\r\n\r\nlibrary IterableMapping {\r\n // Iterable mapping from address to uint;\r\n struct Map {\r\n address[] keys;\r\n mapping(address =\u003e uint) values;\r\n mapping(address =\u003e uint) indexOf;\r\n mapping(address =\u003e bool) inserted;\r\n }\r\n\r\n function get(Map storage map, address key) public view returns (uint) {\r\n return map.values[key];\r\n }\r\n\r\n function getIndexOfKey(Map storage map, address key) public view returns (int) {\r\n if(!map.inserted[key]) {\r\n return -1;\r\n }\r\n return int(map.indexOf[key]);\r\n }\r\n\r\n function getKeyAtIndex(Map storage map, uint index) public view returns (address) {\r\n return map.keys[index];\r\n }\r\n\r\n\r\n\r\n function size(Map storage map) public view returns (uint) {\r\n return map.keys.length;\r\n }\r\n\r\n function set(Map storage map, address key, uint val) public {\r\n if (map.inserted[key]) {\r\n map.values[key] = val;\r\n } else {\r\n map.inserted[key] = true;\r\n map.values[key] = val;\r\n map.indexOf[key] = map.keys.length;\r\n map.keys.push(key);\r\n }\r\n }\r\n\r\n function remove(Map storage map, address key) public {\r\n if (!map.inserted[key]) {\r\n return;\r\n }\r\n\r\n delete map.inserted[key];\r\n delete map.values[key];\r\n\r\n uint index = map.indexOf[key];\r\n uint lastIndex = map.keys.length - 1;\r\n address lastKey = map.keys[lastIndex];\r\n\r\n map.indexOf[lastKey] = index;\r\n delete map.indexOf[key];\r\n\r\n map.keys[index] = lastKey;\r\n map.keys.pop();\r\n }\r\n}"},"IUniswapV2Factory.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\ninterface IUniswapV2Factory {\r\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\r\n\r\n function feeTo() external view returns (address);\r\n function feeToSetter() external view returns (address);\r\n\r\n function getPair(address tokenA, address tokenB) external view returns (address pair);\r\n function allPairs(uint) external view returns (address pair);\r\n function allPairsLength() external view returns (uint);\r\n\r\n function createPair(address tokenA, address tokenB) external returns (address pair);\r\n\r\n function setFeeTo(address) external;\r\n function setFeeToSetter(address) external;\r\n}"},"IUniswapV2Pair.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\ninterface IUniswapV2Pair {\r\n event Approval(address indexed owner, address indexed spender, uint value);\r\n event Transfer(address indexed from, address indexed to, uint value);\r\n\r\n function name() external pure returns (string memory);\r\n function symbol() external pure returns (string memory);\r\n function decimals() external pure returns (uint8);\r\n function totalSupply() external view returns (uint);\r\n function balanceOf(address owner) external view returns (uint);\r\n function allowance(address owner, address spender) external view returns (uint);\r\n\r\n function approve(address spender, uint value) external returns (bool);\r\n function transfer(address to, uint value) external returns (bool);\r\n function transferFrom(address from, address to, uint value) external returns (bool);\r\n\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n function PERMIT_TYPEHASH() external pure returns (bytes32);\r\n function nonces(address owner) external view returns (uint);\r\n\r\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\r\n\r\n event Mint(address indexed sender, uint amount0, uint amount1);\r\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\r\n event Swap(\r\n address indexed sender,\r\n uint amount0In,\r\n uint amount1In,\r\n uint amount0Out,\r\n uint amount1Out,\r\n address indexed to\r\n );\r\n event Sync(uint112 reserve0, uint112 reserve1);\r\n\r\n function MINIMUM_LIQUIDITY() external pure returns (uint);\r\n function factory() external view returns (address);\r\n function token0() external view returns (address);\r\n function token1() external view returns (address);\r\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\r\n function price0CumulativeLast() external view returns (uint);\r\n function price1CumulativeLast() external view returns (uint);\r\n function kLast() external view returns (uint);\r\n\r\n function mint(address to) external returns (uint liquidity);\r\n function burn(address to) external returns (uint amount0, uint amount1);\r\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;\r\n function skim(address to) external;\r\n function sync() external;\r\n\r\n function initialize(address, address) external;\r\n}"},"IUniswapV2Router.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\ninterface IUniswapV2Router01 {\r\n function factory() external pure returns (address);\r\n function WETH() external pure returns (address);\r\n\r\n function addLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint amountADesired,\r\n uint amountBDesired,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountA, uint amountB, uint liquidity);\r\n function addLiquidityETH(\r\n address token,\r\n uint amountTokenDesired,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\r\n function removeLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint liquidity,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountA, uint amountB);\r\n function removeLiquidityETH(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountToken, uint amountETH);\r\n function removeLiquidityWithPermit(\r\n address tokenA,\r\n address tokenB,\r\n uint liquidity,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline,\r\n bool approveMax, uint8 v, bytes32 r, bytes32 s\r\n ) external returns (uint amountA, uint amountB);\r\n function removeLiquidityETHWithPermit(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline,\r\n bool approveMax, uint8 v, bytes32 r, bytes32 s\r\n ) external returns (uint amountToken, uint amountETH);\r\n function swapExactTokensForTokens(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external returns (uint[] memory amounts);\r\n function swapTokensForExactTokens(\r\n uint amountOut,\r\n uint amountInMax,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external returns (uint[] memory amounts);\r\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\r\n external\r\n payable\r\n returns (uint[] memory amounts);\r\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\r\n external\r\n returns (uint[] memory amounts);\r\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\r\n external\r\n returns (uint[] memory amounts);\r\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\r\n external\r\n payable\r\n returns (uint[] memory amounts);\r\n\r\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\r\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\r\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\r\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\r\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\r\n}\r\n\r\n\r\n\r\n// pragma solidity \u003e=0.6.2;\r\n\r\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\r\n function removeLiquidityETHSupportingFeeOnTransferTokens(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountETH);\r\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline,\r\n bool approveMax, uint8 v, bytes32 r, bytes32 s\r\n ) external returns (uint amountETH);\r\n\r\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external;\r\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external payable;\r\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external;\r\n}"},"Lucky1Token.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\nimport \"./DividendPayingToken.sol\";\r\nimport \"./SafeMath.sol\";\r\nimport \"./IterableMapping.sol\";\r\nimport \"./Ownable.sol\";\r\nimport \"./IUniswapV2Pair.sol\";\r\nimport \"./IUniswapV2Factory.sol\";\r\nimport \"./IUniswapV2Router.sol\";\r\n\r\n\r\ncontract L1T is ERC20, Ownable {\r\n using SafeMath for uint256;\r\n\r\n IUniswapV2Router02 public uniswapV2Router;\r\n address public uniswapV2Pair;\r\n\r\n bool private swapping;\r\n bool public swapEnabled;\r\n bool public tradingEnabled;\r\n\r\n mapping (address =\u003e uint256) private _dailySells;\r\n mapping (address =\u003e uint256) private _firstSell;\r\n mapping (address =\u003e bool) private _isPresalers;\r\n\r\n L1TDividendTracker public dividendTracker;\r\n\r\n address public deadWallet = 0x000000000000000000000000000000000000dEaD;\r\n\r\n uint256 public swapTokensAtAmount = 2000000000 * (10**9);\r\n uint256 public maxDailySell = 200000000000 * 10**9; // 0.02%\r\n uint256 public maxDailySellForPresale = 100000000000 * 10**9; // 0.01%\r\n\r\n uint256 public ETHRewardsFee = 12;\r\n uint256 public liquidityFee = 4;\r\n uint256 public marketingFee = 4;\r\n uint256 public devFee = 0;\r\n uint256 public dPrizeFee = 0;\r\n uint256 public mPrizeFee = 0;\r\n uint256 public yPrizeFee = 0;\r\n\r\n uint256 public totalFees = ETHRewardsFee.add(liquidityFee).add(marketingFee).add(dPrizeFee).add(mPrizeFee).add(yPrizeFee);\r\n\r\n address public marketingWallet = 0xb72d8992278A8Aca04e0C6D112F8C2491620E8a4;\r\n address public devWallet = 0x78D20EB7Cca669D6Eb6C07608020072A40EF2Ac6;\r\n address public dPrizeWallet = 0x989BC0089a1C6c4E7E813C8AEf7259230d42f8e5;\r\n address public mPrizeWallet = 0xC9E6A71e46Dcb1f5eD32AC0BE29549765E216BdA;\r\n address public yPrizeWallet = 0x4c9d95dccBdf3534f4E0594078b6321e875acd7B;\r\n address public liquidityWallet;\r\n\r\n // use by default 300,000 gas to process auto-claiming dividends\r\n uint256 public gasForProcessing = 300000;\r\n\r\n // exlcude from fees and max transaction amount\r\n mapping (address =\u003e bool) private _isExcludedFromFees;\r\n\r\n\r\n // store addresses that a automatic market maker pairs. Any transfer *to* these addresses\r\n // could be subject to a maximum transfer amount\r\n mapping (address =\u003e bool) public automatedMarketMakerPairs;\r\n\r\n event UpdateDividendTracker(address indexed newAddress, address indexed oldAddress);\r\n\r\n event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);\r\n\r\n event ExcludeFromFees(address indexed account, bool isExcluded);\r\n event ExcludeMultipleAccountsFromFees(address[] accounts, bool isExcluded);\r\n\r\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\r\n\r\n event LiquidityWalletUpdated(address indexed newLiquidityWallet, address indexed oldLiquidityWallet);\r\n\r\n event GasForProcessingUpdated(uint256 indexed newValue, uint256 indexed oldValue);\r\n\r\n event SwapAndLiquify(\r\n uint256 tokensSwapped,\r\n uint256 ethReceived,\r\n uint256 tokensIntoLiqudity\r\n );\r\n\r\n event SendDividends(\r\n \tuint256 tokensSwapped,\r\n \tuint256 amount\r\n );\r\n\r\n event ProcessedDividendTracker(\r\n \tuint256 iterations,\r\n \tuint256 claims,\r\n uint256 lastProcessedIndex,\r\n \tbool indexed automatic,\r\n \tuint256 gas,\r\n \taddress indexed processor\r\n );\r\n\r\n constructor() ERC20(\"Lucky1Token\", \"L1T\") {\r\n\r\n \tdividendTracker = new L1TDividendTracker();\r\n\r\n\r\n \tIUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\r\n // Create a uniswap pair for this new token\r\n address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\r\n .createPair(address(this), _uniswapV2Router.WETH());\r\n\r\n uniswapV2Router = _uniswapV2Router;\r\n uniswapV2Pair = _uniswapV2Pair;\r\n\r\n _setAutomatedMarketMakerPair(_uniswapV2Pair, true);\r\n\r\n // exclude from receiving dividends\r\n dividendTracker.excludeFromDividends(address(dividendTracker));\r\n dividendTracker.excludeFromDividends(address(this));\r\n dividendTracker.excludeFromDividends(owner());\r\n dividendTracker.excludeFromDividends(deadWallet);\r\n dividendTracker.excludeFromDividends(address(_uniswapV2Router));\r\n \r\n liquidityWallet = owner();\r\n\r\n // exclude from paying fees or having max transaction amount\r\n excludeFromFees(owner(), true);\r\n excludeFromFees(address(this), true);\r\n excludeFromFees(marketingWallet, true);\r\n excludeFromFees(devWallet, true);\r\n excludeFromFees(dPrizeWallet, true);\r\n excludeFromFees(mPrizeWallet, true);\r\n excludeFromFees(yPrizeWallet, true);\r\n\r\n /*\r\n _mint is an internal function in ERC20.sol that is only called here,\r\n and CANNOT be called ever again\r\n */\r\n _mint(owner(), 1e11 * (10**9));\r\n }\r\n\r\n receive() external payable {\r\n\r\n \t}\r\n\r\n function updateDividendTracker(address newAddress) public onlyOwner {\r\n require(newAddress != address(dividendTracker), \"L1T: The dividend tracker already has that address\");\r\n\r\n L1TDividendTracker newDividendTracker = L1TDividendTracker(payable(newAddress));\r\n\r\n require(newDividendTracker.owner() == address(this), \"L1T: The new dividend tracker must be owned by the L1T token contract\");\r\n\r\n newDividendTracker.excludeFromDividends(address(newDividendTracker));\r\n newDividendTracker.excludeFromDividends(address(this));\r\n newDividendTracker.excludeFromDividends(owner());\r\n newDividendTracker.excludeFromDividends(address(uniswapV2Router));\r\n\r\n emit UpdateDividendTracker(newAddress, address(dividendTracker));\r\n\r\n dividendTracker = newDividendTracker;\r\n }\r\n\r\n function updateUniswapV2Router(address newAddress) public onlyOwner {\r\n require(newAddress != address(uniswapV2Router), \"L1T: The router already has that address\");\r\n emit UpdateUniswapV2Router(newAddress, address(uniswapV2Router));\r\n uniswapV2Router = IUniswapV2Router02(newAddress);\r\n address _uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\r\n .createPair(address(this), uniswapV2Router.WETH());\r\n uniswapV2Pair = _uniswapV2Pair;\r\n }\r\n\r\n function excludeFromFees(address account, bool excluded) public onlyOwner {\r\n require(_isExcludedFromFees[account] != excluded, \"L1T: Account is already the value of \u0027excluded\u0027\");\r\n _isExcludedFromFees[account] = excluded;\r\n\r\n emit ExcludeFromFees(account, excluded);\r\n }\r\n\r\n function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {\r\n for(uint256 i = 0; i \u003c accounts.length; i++) {\r\n _isExcludedFromFees[accounts[i]] = excluded;\r\n }\r\n\r\n emit ExcludeMultipleAccountsFromFees(accounts, excluded);\r\n }\r\n\r\n function setMarketingWallet(address wallet) external onlyOwner{\r\n marketingWallet = wallet;\r\n }\r\n\r\n function setDevWallet(address wallet) external onlyOwner{\r\n devWallet = wallet;\r\n }\r\n \r\n function setLiquidiyWallet(address wallet) external onlyOwner{\r\n liquidityWallet = wallet;\r\n }\r\n\r\n function setDailyPrizeWallet(address wallet) external onlyOwner{\r\n dPrizeWallet = wallet;\r\n }\r\n\r\n function setMonthlyPrizeWallet(address wallet) external onlyOwner{\r\n mPrizeWallet = wallet;\r\n }\r\n\r\n function setYearlyPrizeWallet(address wallet) external onlyOwner{\r\n yPrizeWallet = wallet;\r\n }\r\n\r\n function setPresalers(address[] memory presalers) external onlyOwner{\r\n for(uint256 i = 0; i \u003c presalers.length; i++){\r\n _isPresalers[presalers[i]] = true;\r\n }\r\n }\r\n\r\n function setMaxDailySell(uint256 amount) external onlyOwner{\r\n maxDailySell = amount * 10**9;\r\n }\r\n\r\n function setMaxDailySellForPresale(uint256 amount) external onlyOwner{\r\n maxDailySellForPresale = amount * 10**9;\r\n }\r\n\r\n function setETHRewardsFee(uint256 value) external onlyOwner{\r\n ETHRewardsFee = value;\r\n totalFees = ETHRewardsFee.add(liquidityFee).add(marketingFee).add(dPrizeFee).add(mPrizeFee).add(yPrizeFee);\r\n }\r\n\r\n function setLiquiditFee(uint256 value) external onlyOwner{\r\n liquidityFee = value;\r\n totalFees = ETHRewardsFee.add(liquidityFee).add(marketingFee).add(dPrizeFee).add(mPrizeFee).add(yPrizeFee);\r\n }\r\n\r\n function setMarketingFee(uint256 value) external onlyOwner{\r\n marketingFee = value;\r\n totalFees = ETHRewardsFee.add(liquidityFee).add(marketingFee).add(dPrizeFee).add(mPrizeFee).add(yPrizeFee);\r\n }\r\n\r\n function setPrizeFees(uint256 _dayFee, uint256 _monthFee, uint256 _yearFee) external onlyOwner{\r\n dPrizeFee = _dayFee;\r\n mPrizeFee = _monthFee;\r\n yPrizeFee = _yearFee;\r\n totalFees = ETHRewardsFee.add(liquidityFee).add(marketingFee).add(dPrizeFee).add(mPrizeFee).add(yPrizeFee);\r\n }\r\n\r\n function setSwapEnabled(bool _enabled) external onlyOwner{\r\n swapEnabled = _enabled;\r\n }\r\n\r\n function setTradingEnabled(bool _enabled) external onlyOwner{\r\n tradingEnabled = _enabled;\r\n }\r\n\r\n function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {\r\n require(pair != uniswapV2Pair, \"L1T: The Uniswap pair cannot be removed from automatedMarketMakerPairs\");\r\n\r\n _setAutomatedMarketMakerPair(pair, value);\r\n }\r\n\r\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\r\n require(automatedMarketMakerPairs[pair] != value, \"L1T: Automated market maker pair is already set to that value\");\r\n automatedMarketMakerPairs[pair] = value;\r\n\r\n if(value) {\r\n dividendTracker.excludeFromDividends(pair);\r\n }\r\n\r\n emit SetAutomatedMarketMakerPair(pair, value);\r\n }\r\n\r\n\r\n function updateGasForProcessing(uint256 newValue) public onlyOwner {\r\n require(newValue \u003e= 200000 \u0026\u0026 newValue \u003c= 500000, \"L1T: gasForProcessing must be between 200,000 and 500,000\");\r\n require(newValue != gasForProcessing, \"L1T: Cannot update gasForProcessing to same value\");\r\n emit GasForProcessingUpdated(newValue, gasForProcessing);\r\n gasForProcessing = newValue;\r\n }\r\n\r\n function updateClaimWait(uint256 claimWait) external onlyOwner {\r\n dividendTracker.updateClaimWait(claimWait);\r\n }\r\n\r\n function getClaimWait() external view returns(uint256) {\r\n return dividendTracker.claimWait();\r\n }\r\n\r\n function getTotalDividendsDistributed() external view returns (uint256) {\r\n return dividendTracker.totalDividendsDistributed();\r\n }\r\n\r\n function isExcludedFromFees(address account) public view returns(bool) {\r\n return _isExcludedFromFees[account];\r\n }\r\n\r\n function withdrawableDividendOf(address account) public view returns(uint256) {\r\n \treturn dividendTracker.withdrawableDividendOf(account);\r\n \t}\r\n\r\n\tfunction dividendTokenBalanceOf(address account) public view returns (uint256) {\r\n\t\treturn dividendTracker.balanceOf(account);\r\n\t}\r\n\r\n\tfunction excludeFromDividends(address account) external onlyOwner{\r\n\t dividendTracker.excludeFromDividends(account);\r\n\t}\r\n\r\n function getAccountDividendsInfo(address account)\r\n external view returns (\r\n address,\r\n int256,\r\n int256,\r\n uint256,\r\n uint256,\r\n uint256,\r\n uint256,\r\n uint256) {\r\n return dividendTracker.getAccount(account);\r\n }\r\n\r\n\tfunction getAccountDividendsInfoAtIndex(uint256 index)\r\n external view returns (\r\n address,\r\n int256,\r\n int256,\r\n uint256,\r\n uint256,\r\n uint256,\r\n uint256,\r\n uint256) {\r\n \treturn dividendTracker.getAccountAtIndex(index);\r\n }\r\n\r\n\tfunction processDividendTracker(uint256 gas) external {\r\n\t\t(uint256 iterations, uint256 claims, uint256 lastProcessedIndex) = dividendTracker.process(gas);\r\n\t\temit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, false, gas, tx.origin);\r\n }\r\n\r\n function setSwapTokensAtAmount(uint256 amount) external onlyOwner{\r\n swapTokensAtAmount = amount * 10**9;\r\n }\r\n\r\n function claim() external {\r\n\t\tdividendTracker.processAccount(payable(msg.sender), false);\r\n }\r\n\r\n function getLastProcessedIndex() external view returns(uint256) {\r\n \treturn dividendTracker.getLastProcessedIndex();\r\n }\r\n\r\n function getNumberOfDividendTokenHolders() external view returns(uint256) {\r\n return dividendTracker.getNumberOfTokenHolders();\r\n }\r\n\r\n\r\n function _transfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal override {\r\n require(from != address(0), \"ERC20: transfer from the zero address\");\r\n require(to != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n if(!_isExcludedFromFees[from] \u0026\u0026 !_isExcludedFromFees[to]){\r\n require(tradingEnabled, \"Trading not started yet\");\r\n }\r\n if(amount == 0) {\r\n super._transfer(from, to, 0);\r\n return;\r\n }\r\n\r\n if(_isPresalers[from]) {\r\n if(block.timestamp.sub(_firstSell[from]) \u003c 1 days){\r\n require(_dailySells[from].add(amount) \u003c= maxDailySellForPresale, \"You are exceeding maxDailySellForPresale\");\r\n _dailySells[from] = _dailySells[from].add(amount);\r\n }\r\n else{\r\n _firstSell[from] = block.timestamp;\r\n require(_dailySells[from].add(amount) \u003c= maxDailySellForPresale, \"You are exceeding maxDailySellForPresale\");\r\n _dailySells[from] = amount;\r\n }\r\n }\r\n\r\n if(!_isExcludedFromFees[from] \u0026\u0026 !automatedMarketMakerPairs[from] \u0026\u0026 !swapping){\r\n if(block.timestamp.sub(_firstSell[from]) \u003c 1 days){\r\n require(_dailySells[from].add(amount) \u003c= maxDailySell, \"You are exceeding maxDailySell\");\r\n _dailySells[from] = _dailySells[from].add(amount);\r\n }\r\n else{\r\n _firstSell[from] = block.timestamp;\r\n require(_dailySells[from].add(amount) \u003c= maxDailySell, \"You are exceeding maxDailySell\");\r\n _dailySells[from] = amount;\r\n }\r\n }\r\n\r\n\t\t uint256 contractTokenBalance = balanceOf(address(this));\r\n bool canSwap = contractTokenBalance \u003e= swapTokensAtAmount;\r\n\r\n if( canSwap \u0026\u0026\r\n !swapping \u0026\u0026\r\n swapEnabled \u0026\u0026\r\n !automatedMarketMakerPairs[from] \u0026\u0026\r\n !_isExcludedFromFees[from] \u0026\u0026\r\n !_isExcludedFromFees[to]\r\n ) {\r\n swapping = true;\r\n\r\n contractTokenBalance = swapTokensAtAmount;\r\n\r\n if(marketingFee \u003e 0 || devFee \u003e 0 || liquidityFee \u003e 0){\r\n uint256 marketingTokens = contractTokenBalance.mul(marketingFee + devFee + liquidityFee).div(totalFees);\r\n swapAndSendToFee(marketingTokens);\r\n }\r\n\r\n if(dPrizeFee \u003e 0 || mPrizeFee \u003e 0 || yPrizeFee \u003e 0){\r\n uint256 prizeTokens = contractTokenBalance.div(totalFees).mul(dPrizeFee + mPrizeFee + yPrizeFee);\r\n swapAndSendToPrizePools(prizeTokens);\r\n }\r\n\r\n if(ETHRewardsFee \u003e 0){\r\n uint256 sellTokens = contractTokenBalance.mul(ETHRewardsFee).div(totalFees);\r\n swapAndSendDividends(sellTokens);\r\n }\r\n\r\n swapping = false;\r\n }\r\n\r\n\r\n bool takeFee = !swapping;\r\n\r\n // if any account belongs to _isExcludedFromFee account then remove the fee\r\n if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\r\n takeFee = false;\r\n }\r\n\r\n if(takeFee) {\r\n \tuint256 fees = amount.mul(totalFees).div(100);\r\n if(automatedMarketMakerPairs[to]){\r\n fees += amount.mul(1).div(100);\r\n }\r\n \tamount = amount.sub(fees);\r\n super._transfer(from, address(this), fees);\r\n }\r\n\r\n super._transfer(from, to, amount);\r\n\r\n try dividendTracker.setBalance(payable(from), balanceOf(from)) {} catch {}\r\n try dividendTracker.setBalance(payable(to), balanceOf(to)) {} catch {}\r\n\r\n if(!swapping) {\r\n\t \tuint256 gas = gasForProcessing;\r\n\r\n\t \ttry dividendTracker.process(gas) returns (uint256 iterations, uint256 claims, uint256 lastProcessedIndex) {\r\n\t \t\temit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, true, gas, tx.origin);\r\n\t \t}\r\n\t \tcatch {\r\n\r\n\t \t}\r\n }\r\n }\r\n\r\n function swapAndSendToFee(uint256 tokens) private{\r\n uint256 initialBalance = address(this).balance;\r\n swapTokensForEth(tokens);\r\n uint256 newBalance = address(this).balance.sub(initialBalance);\r\n if(marketingFee \u003e 0) payable(marketingWallet).transfer(newBalance.div(devFee + marketingFee + liquidityFee).mul(marketingFee));\r\n if(devFee \u003e 0) payable(devWallet).transfer(newBalance.div(devFee + marketingFee + liquidityFee).mul(devFee));\r\n if(liquidityFee \u003e 0) payable(liquidityWallet).transfer(newBalance.div(devFee + marketingFee + liquidityFee).mul(liquidityFee));\r\n }\r\n\r\n function swapAndSendToPrizePools(uint256 tokens) private {\r\n uint256 initialBalance = address(this).balance;\r\n swapTokensForEth(tokens);\r\n uint256 totalPrize = dPrizeFee.add(mPrizeFee).add(yPrizeFee);\r\n uint256 transferBalance = (address(this).balance).sub(initialBalance);\r\n payable(dPrizeWallet).transfer(transferBalance.div(totalPrize).mul(dPrizeFee));\r\n payable(mPrizeWallet).transfer(transferBalance.div(totalPrize).mul(mPrizeFee));\r\n payable(yPrizeWallet).transfer(transferBalance.div(totalPrize).mul(yPrizeFee));\r\n }\r\n\r\n\r\n function swapTokensForEth(uint256 tokenAmount) private {\r\n\r\n\r\n // generate the uniswap pair path of token -\u003e weth\r\n address[] memory path = new address[](2);\r\n path[0] = address(this);\r\n path[1] = uniswapV2Router.WETH();\r\n\r\n _approve(address(this), address(uniswapV2Router), tokenAmount);\r\n\r\n // make the swap\r\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n tokenAmount,\r\n 0, // accept any amount of ETH\r\n path,\r\n address(this),\r\n block.timestamp\r\n );\r\n\r\n }\r\n\r\n function swapAndSendDividends(uint256 tokens) private{\r\n uint256 initialBalance = address(this).balance;\r\n swapTokensForEth(tokens);\r\n uint256 dividends = address(this).balance.sub(initialBalance);\r\n (bool success,) = address(dividendTracker).call{value: dividends}(\"\");\r\n\r\n if(success) {\r\n \t \t\temit SendDividends(tokens, dividends);\r\n }\r\n }\r\n}\r\n\r\ncontract L1TDividendTracker is Ownable, DividendPayingToken {\r\n using SafeMath for uint256;\r\n using SafeMathInt for int256;\r\n using IterableMapping for IterableMapping.Map;\r\n\r\n IterableMapping.Map private tokenHoldersMap;\r\n uint256 public lastProcessedIndex;\r\n\r\n mapping (address =\u003e bool) public excludedFromDividends;\r\n\r\n mapping (address =\u003e uint256) public lastClaimTimes;\r\n\r\n uint256 public claimWait;\r\n uint256 public immutable minimumTokenBalanceForDividends;\r\n\r\n event ExcludeFromDividends(address indexed account);\r\n event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);\r\n\r\n event Claim(address indexed account, uint256 amount, bool indexed automatic);\r\n\r\n constructor() DividendPayingToken(\"L1T_Dividen_Tracker\", \"L1T_Dividend_Tracker\") {\r\n \tclaimWait = 3600;\r\n minimumTokenBalanceForDividends = 200000 * (10**9); //must hold 200,000 tokens\r\n }\r\n\r\n function _transfer(address, address, uint256) internal pure override {\r\n require(false, \"L1T_Dividend_Tracker: No transfers allowed\");\r\n }\r\n\r\n function withdrawDividend() public pure override {\r\n require(false, \"L1T_Dividend_Tracker: withdrawDividend disabled. Use the \u0027claim\u0027 function on the main L1T contract.\");\r\n }\r\n\r\n function excludeFromDividends(address account) external onlyOwner {\r\n \trequire(!excludedFromDividends[account]);\r\n \texcludedFromDividends[account] = true;\r\n\r\n \t_setBalance(account, 0);\r\n \ttokenHoldersMap.remove(account);\r\n\r\n \temit ExcludeFromDividends(account);\r\n }\r\n\r\n function updateClaimWait(uint256 newClaimWait) external onlyOwner {\r\n require(newClaimWait \u003e= 3600 \u0026\u0026 newClaimWait \u003c= 86400, \"L1T_Dividend_Tracker: claimWait must be updated to between 1 and 24 hours\");\r\n require(newClaimWait != claimWait, \"L1T_Dividend_Tracker: Cannot update claimWait to same value\");\r\n emit ClaimWaitUpdated(newClaimWait, claimWait);\r\n claimWait = newClaimWait;\r\n }\r\n\r\n function getLastProcessedIndex() external view returns(uint256) {\r\n \treturn lastProcessedIndex;\r\n }\r\n\r\n function getNumberOfTokenHolders() external view returns(uint256) {\r\n return tokenHoldersMap.keys.length;\r\n }\r\n\r\n\r\n\r\n function getAccount(address _account)\r\n public view returns (\r\n address account,\r\n int256 index,\r\n int256 iterationsUntilProcessed,\r\n uint256 withdrawableDividends,\r\n uint256 totalDividends,\r\n uint256 lastClaimTime,\r\n uint256 nextClaimTime,\r\n uint256 secondsUntilAutoClaimAvailable) {\r\n account = _account;\r\n\r\n index = tokenHoldersMap.getIndexOfKey(account);\r\n\r\n iterationsUntilProcessed = -1;\r\n\r\n if(index \u003e= 0) {\r\n if(uint256(index) \u003e lastProcessedIndex) {\r\n iterationsUntilProcessed = index.sub(int256(lastProcessedIndex));\r\n }\r\n else {\r\n uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length \u003e lastProcessedIndex ?\r\n tokenHoldersMap.keys.length.sub(lastProcessedIndex) :\r\n 0;\r\n\r\n\r\n iterationsUntilProcessed = index.add(int256(processesUntilEndOfArray));\r\n }\r\n }\r\n\r\n\r\n withdrawableDividends = withdrawableDividendOf(account);\r\n totalDividends = accumulativeDividendOf(account);\r\n\r\n lastClaimTime = lastClaimTimes[account];\r\n\r\n nextClaimTime = lastClaimTime \u003e 0 ?\r\n lastClaimTime.add(claimWait) :\r\n 0;\r\n\r\n secondsUntilAutoClaimAvailable = nextClaimTime \u003e block.timestamp ?\r\n nextClaimTime.sub(block.timestamp) :\r\n 0;\r\n }\r\n\r\n function getAccountAtIndex(uint256 index)\r\n public view returns (\r\n address,\r\n int256,\r\n int256,\r\n uint256,\r\n uint256,\r\n uint256,\r\n uint256,\r\n uint256) {\r\n \tif(index \u003e= tokenHoldersMap.size()) {\r\n return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);\r\n }\r\n\r\n address account = tokenHoldersMap.getKeyAtIndex(index);\r\n\r\n return getAccount(account);\r\n }\r\n\r\n function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {\r\n \tif(lastClaimTime \u003e block.timestamp) {\r\n \t\treturn false;\r\n \t}\r\n\r\n \treturn block.timestamp.sub(lastClaimTime) \u003e= claimWait;\r\n }\r\n\r\n function setBalance(address payable account, uint256 newBalance) external onlyOwner {\r\n \tif(excludedFromDividends[account]) {\r\n \t\treturn;\r\n \t}\r\n\r\n \tif(newBalance \u003e= minimumTokenBalanceForDividends) {\r\n _setBalance(account, newBalance);\r\n \t\ttokenHoldersMap.set(account, newBalance);\r\n \t}\r\n \telse {\r\n _setBalance(account, 0);\r\n \t\ttokenHoldersMap.remove(account);\r\n \t}\r\n\r\n \tprocessAccount(account, true);\r\n }\r\n\r\n function process(uint256 gas) public returns (uint256, uint256, uint256) {\r\n \tuint256 numberOfTokenHolders = tokenHoldersMap.keys.length;\r\n\r\n \tif(numberOfTokenHolders == 0) {\r\n \t\treturn (0, 0, lastProcessedIndex);\r\n \t}\r\n\r\n \tuint256 _lastProcessedIndex = lastProcessedIndex;\r\n\r\n \tuint256 gasUsed = 0;\r\n\r\n \tuint256 gasLeft = gasleft();\r\n\r\n \tuint256 iterations = 0;\r\n \tuint256 claims = 0;\r\n\r\n \twhile(gasUsed \u003c gas \u0026\u0026 iterations \u003c numberOfTokenHolders) {\r\n \t\t_lastProcessedIndex++;\r\n\r\n \t\tif(_lastProcessedIndex \u003e= tokenHoldersMap.keys.length) {\r\n \t\t\t_lastProcessedIndex = 0;\r\n \t\t}\r\n\r\n \t\taddress account = tokenHoldersMap.keys[_lastProcessedIndex];\r\n\r\n \t\tif(canAutoClaim(lastClaimTimes[account])) {\r\n \t\t\tif(processAccount(payable(account), true)) {\r\n \t\t\t\tclaims++;\r\n \t\t\t}\r\n \t\t}\r\n\r\n \t\titerations++;\r\n\r\n \t\tuint256 newGasLeft = gasleft();\r\n\r\n \t\tif(gasLeft \u003e newGasLeft) {\r\n \t\t\tgasUsed = gasUsed.add(gasLeft.sub(newGasLeft));\r\n \t\t}\r\n\r\n \t\tgasLeft = newGasLeft;\r\n \t}\r\n\r\n \tlastProcessedIndex = _lastProcessedIndex;\r\n\r\n \treturn (iterations, claims, lastProcessedIndex);\r\n }\r\n\r\n function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) {\r\n uint256 amount = _withdrawDividendOfUser(account);\r\n\r\n \tif(amount \u003e 0) {\r\n \t\tlastClaimTimes[account] = block.timestamp;\r\n emit Claim(account, amount, automatic);\r\n \t\treturn true;\r\n \t}\r\n\r\n \treturn false;\r\n }\r\n}\r\n"},"Ownable.sol":{"content":"pragma solidity ^0.8.6;\r\n\r\n// SPDX-License-Identifier: MIT License\r\n\r\nimport \"./Context.sol\";\r\n\r\ncontract Ownable is Context {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Initializes the contract setting the deployer as the initial owner.\r\n */\r\n constructor () {\r\n address msgSender = _msgSender();\r\n _owner = msgSender;\r\n emit OwnershipTransferred(address(0), msgSender);\r\n }\r\n\r\n /**\r\n * @dev Returns the address of the current owner.\r\n */\r\n function owner() public view returns (address) {\r\n return _owner;\r\n }\r\n\r\n /**\r\n * @dev Throws if called by any account other than the owner.\r\n */\r\n modifier onlyOwner() {\r\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Leaves the contract without owner. It will not be possible to call\r\n * `onlyOwner` functions anymore. Can only be called by the current owner.\r\n *\r\n * NOTE: Renouncing ownership will leave the contract without an owner,\r\n * thereby removing any functionality that is only available to the owner.\r\n */\r\n function renounceOwnership() public virtual onlyOwner {\r\n emit OwnershipTransferred(_owner, address(0));\r\n _owner = address(0);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n emit OwnershipTransferred(_owner, newOwner);\r\n _owner = newOwner;\r\n }\r\n}"},"SafeMath.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\nlibrary SafeMath {\r\n /**\r\n * @dev Returns the addition of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity\u0027s `+` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Addition cannot overflow.\r\n */\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c \u003e= a, \"SafeMath: addition overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity\u0027s `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return sub(a, b, \"SafeMath: subtraction overflow\");\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity\u0027s `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b \u003c= a, errorMessage);\r\n uint256 c = a - b;\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity\u0027s `*` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Multiplication cannot overflow.\r\n */\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // Gas optimization: this is cheaper than requiring \u0027a\u0027 not being zero, but the\r\n // benefit is lost if \u0027b\u0027 is also tested.\r\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n uint256 c = a * b;\r\n require(c / a == b, \"SafeMath: multiplication overflow\");\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers. Reverts on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return div(a, b, \"SafeMath: division by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b \u003e 0, errorMessage);\r\n uint256 c = a / b;\r\n // assert(a == b * c + a % b); // There is no case in which this doesn\u0027t hold\r\n\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts when dividing by zero.\r\n *\r\n * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return mod(a, b, \"SafeMath: modulo by zero\");\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * Reverts with custom message when dividing by zero.\r\n *\r\n * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b != 0, errorMessage);\r\n return a % b;\r\n }\r\n}"},"SafeMathInt.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\n/*\r\nMIT License\r\n\r\nCopyright (c) 2018 requestnetwork\r\nCopyright (c) 2018 Fragments, Inc.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.\r\n*/\r\n\r\npragma solidity ^0.8.6;\r\n\r\n/**\r\n * @title SafeMathInt\r\n * @dev Math operations for int256 with overflow safety checks.\r\n */\r\nlibrary SafeMathInt {\r\n int256 private constant MIN_INT256 = int256(1) \u003c\u003c 255;\r\n int256 private constant MAX_INT256 = ~(int256(1) \u003c\u003c 255);\r\n\r\n /**\r\n * @dev Multiplies two int256 variables and fails on overflow.\r\n */\r\n function mul(int256 a, int256 b) internal pure returns (int256) {\r\n int256 c = a * b;\r\n\r\n // Detect overflow when multiplying MIN_INT256 with -1\r\n require(c != MIN_INT256 || (a \u0026 MIN_INT256) != (b \u0026 MIN_INT256));\r\n require((b == 0) || (c / b == a));\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Division of two int256 variables and fails on overflow.\r\n */\r\n function div(int256 a, int256 b) internal pure returns (int256) {\r\n // Prevent overflow when dividing MIN_INT256 by -1\r\n require(b != -1 || a != MIN_INT256);\r\n\r\n // Solidity already throws when dividing by 0.\r\n return a / b;\r\n }\r\n\r\n /**\r\n * @dev Subtracts two int256 variables and fails on overflow.\r\n */\r\n function sub(int256 a, int256 b) internal pure returns (int256) {\r\n int256 c = a - b;\r\n require((b \u003e= 0 \u0026\u0026 c \u003c= a) || (b \u003c 0 \u0026\u0026 c \u003e a));\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Adds two int256 variables and fails on overflow.\r\n */\r\n function add(int256 a, int256 b) internal pure returns (int256) {\r\n int256 c = a + b;\r\n require((b \u003e= 0 \u0026\u0026 c \u003e= a) || (b \u003c 0 \u0026\u0026 c \u003c a));\r\n return c;\r\n }\r\n\r\n /**\r\n * @dev Converts to absolute value, and fails on overflow.\r\n */\r\n function abs(int256 a) internal pure returns (int256) {\r\n require(a != MIN_INT256);\r\n return a \u003c 0 ? -a : a;\r\n }\r\n\r\n\r\n function toUint256Safe(int256 a) internal pure returns (uint256) {\r\n require(a \u003e= 0);\r\n return uint256(a);\r\n }\r\n}"},"SafeMathUint.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.6;\r\n\r\n/**\r\n * @title SafeMathUint\r\n * @dev Math operations with safety checks that revert on error\r\n */\r\nlibrary SafeMathUint {\r\n function toInt256Safe(uint256 a) internal pure returns (int256) {\r\n int256 b = int256(a);\r\n require(b \u003e= 0);\r\n return b;\r\n }\r\n}"}}