ERC-20
Overview
Max Total Supply
662,931,992.961077752480551782 Pack_Dividend_Tracker
Holders
196
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
2,946,896.846114783216909997 Pack_Dividend_TrackerValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
PackDividendTracker
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 20000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/math/SignedSafeMath.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "./IDividendPayingToken.sol"; import "./IterableMapping.sol"; /// @notice The Pack dividend tracker contract contract PackDividendTracker is ERC20, ERC20Burnable, AccessControl, IDividendPayingToken { using SafeMath for uint256; using SignedSafeMath for int256; using IterableMapping for IterableMapping.Map; // With `magnitude`, we can properly distribute dividends even if the amount of received ether is small. // For more discussion about choosing the value of `magnitude`, // see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728 uint256 constant internal MAGNITUDE = 2 ** 128; /// @notice Dividend tracker administration role bytes32 public constant TOKEN_ADMIN_ROLE = keccak256("TOKEN_ADMIN_ROLE"); IterableMapping.Map private tokenHoldersMap; mapping(address => int256) private magnifiedDividendCorrections; mapping(address => uint256) private withdrawnDividends; mapping(address => bool) private excludedFromDividends; IUniswapV2Router02 private uniswapRouter; uint256 private magnifiedDividendPerShare; uint256 private minimumTokenBalanceForDividends; address[][] private ethToRewardPath = new address[][](2); /// @notice The total dividends distributed in ETH uint256 public totalDividendsDistributed; /// @notice The index of the last processed wallet uint256 public lastProcessedIndex; /// @notice The current token used for rewards address[] public rewardTokens; event ExcludeFromDividends(address indexed account); event Claim(address indexed account, uint256 amount, bool indexed automatic); constructor() ERC20("Pack_Dividend_Tracker", "Pack_Dividend_Tracker") { minimumTokenBalanceForDividends = 1 * (10 ** 18); _grantRole(DEFAULT_ADMIN_ROLE, 0x3ed182236F5D4754769A1CC182C5A07D17d4722b); _grantRole(TOKEN_ADMIN_ROLE, 0x3ed182236F5D4754769A1CC182C5A07D17d4722b); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(TOKEN_ADMIN_ROLE, msg.sender); rewardTokens = [0x9813037ee2218799597d83D4a5B6F3b6778218d9]; excludeFromDividends(address(this), true); excludeFromDividends(address(0x000000000000000000000000000000000000dEaD), true); excludeFromDividends(address(0), true); excludeFromDividends(msg.sender, true); } /// @notice Received funds are calculated and added to total dividends distributed receive() external payable { distributeDividends(); } /// @notice Grants a user token administrator role /// @param user The user to give the token administrator role to function setTokenAdminRole(address user) public onlyRole(TOKEN_ADMIN_ROLE) { _grantRole(TOKEN_ADMIN_ROLE, user); } /// @notice Adds incoming funds to the dividends per share function distributeDividends() public onlyRole(TOKEN_ADMIN_ROLE) payable { require(totalSupply() > 0, "No supply"); if (msg.value > 0) { magnifiedDividendPerShare = magnifiedDividendPerShare.add((msg.value).mul(MAGNITUDE) / totalSupply()); emit DividendsDistributed(msg.sender, msg.value); totalDividendsDistributed = totalDividendsDistributed.add(msg.value); } } /// @notice View the amount of dividend in wei that an address can withdraw. /// @param _owner The address of a token holder. /// @return dividends The amount of dividend in wei that `_owner` can withdraw. function dividendOf(address _owner) public view returns (uint256 dividends) { return withdrawableDividendOf(_owner); } /// @notice View the amount of dividend that a address has withdrawn /// @param _owner The address of the token holder. /// @return dividends The amount of dividends that `_owner` has withdrawn function withdrawnDividendOf(address _owner) public view returns (uint256 dividends) { return withdrawnDividends[_owner]; } /// @notice The reward tokens to pay out dividends in /// @param tokens The token addresses of the rewards (use 0x0 for < 3) function setRewardTokens(address[] memory tokens) public onlyRole(TOKEN_ADMIN_ROLE) { require(tokens.length <=3, "max 3 rewards"); delete ethToRewardPath; for(uint256 i = 0; i < tokens.length; i++){ if(tokens[i] != address(0)){ address[] memory path = new address[](2); path[0] = uniswapRouter.WETH(); path[1] = address(tokens[i]); ethToRewardPath.push(path); } } rewardTokens = tokens; } /// @notice The uniswap router to use for internal swaps /// @param router The uniswap swap router function setUniswapRouter(IUniswapV2Router02 router) public onlyRole(TOKEN_ADMIN_ROLE) { uniswapRouter = router; excludeFromDividends(address(uniswapRouter), true); } function _transfer(address, address, uint256) internal pure virtual override { require(false, "No transfers"); } /// @notice Excludes a wallet from dividends /// @param account The address to exclude from dividends /// @param value true if the address should be excluded from dividends, false otherwise function excludeFromDividends(address account, bool value) public onlyRole(TOKEN_ADMIN_ROLE) { excludedFromDividends[account] = value; _setBalance(account, 0); tokenHoldersMap.remove(account); emit ExcludeFromDividends(account); } /// @notice Set the minimum amount of token required to earn dividends /// @param newValue The minimum amount of token required to earn dividends function setTokenBalanceForDividends(uint256 newValue) external onlyRole(TOKEN_ADMIN_ROLE) { minimumTokenBalanceForDividends = newValue; } /// @notice Gets the index of the last processed wallet /// @return index The index of the last wallet that was paid dividends function getLastProcessedIndex() external view returns (uint256 index) { return lastProcessedIndex; } /// @notice Gets the number of dividend tracking token holders /// @return holders The number of dividend tracking token holders function getNumberOfTokenHolders() external view returns (uint256 holders) { return tokenHoldersMap.size(); } /// @notice Allows retrieval of any ERC20 token that was sent to the contract address /// @return success true if the transfer succeeded, false otherwise function rescueToken(address tokenAddress) external onlyRole(TOKEN_ADMIN_ROLE) returns (bool success) { return ERC20(tokenAddress).transfer(msg.sender, ERC20(tokenAddress).balanceOf(address(this))); } /// @notice Gets account information by address /// @param _account The account to get information for /// @return account The account retrieved /// @return index The index of the account in the iterable mapping /// @return iterationsUntilProcessed The number of wallets left to process before this wallet /// @return withdrawableDividends The amount of dividends this account can withdraw /// @return totalDividends The total dividends this account has earned function getAccount(address _account) public view returns ( address account, int256 index, int256 iterationsUntilProcessed, uint256 withdrawableDividends, uint256 totalDividends) { account = _account; index = tokenHoldersMap.getIndexOfKey(account); iterationsUntilProcessed = 0; if (index >= 0) { if (SafeCast.toUint256(index) > lastProcessedIndex) { iterationsUntilProcessed = index.sub(SafeCast.toInt256(lastProcessedIndex)); } else { uint256 processesUntilEndOfArray = tokenHoldersMap.size() > lastProcessedIndex ? tokenHoldersMap.size().sub(lastProcessedIndex) : 0; iterationsUntilProcessed = index.add(SafeCast.toInt256(processesUntilEndOfArray)); } } withdrawableDividends = withdrawableDividendOf(account); totalDividends = accumulativeDividendOf(account); } /// @notice Gets account information by index /// @param _index The index to get information for /// @return account The account retrieved /// @return index The index of the account in the iterable mapping /// @return iterationsUntilProcessed The number of wallets left to process before this wallet /// @return withdrawableDividends The amount of dividends this account can withdraw /// @return totalDividends The total dividends this account has earned function getAccountAtIndex(uint256 _index) public view returns ( address account, int256 index, int256 iterationsUntilProcessed, uint256 withdrawableDividends, uint256 totalDividends) { if (_index >= tokenHoldersMap.size()) { return (0x0000000000000000000000000000000000000000, 0, 0, 0, 0); } return getAccount(tokenHoldersMap.getKeyAtIndex(_index)); } /// @notice Sets the balance of dividend tracking tokens for an account /// @param account The account to set the balance for /// @param newBalance The new balance to set for the account. function setBalance(address payable account, uint256 newBalance) external onlyRole(TOKEN_ADMIN_ROLE) { if (excludedFromDividends[account]) { return; } if (newBalance >= minimumTokenBalanceForDividends) { _setBalance(account, newBalance); tokenHoldersMap.set(account, newBalance); } else { _setBalance(account, 0); tokenHoldersMap.remove(account); } processAccount(account, true); } /// @notice This function uses a set amount of gas to process dividends for as many wallets as it can /// @param gas The amount of gas to use for processing dividends /// @return numProcessed The number of wallets processed /// @return numClaims The number of actual claims sent /// @return lastIndex The index of the last wallet processed function process(uint256 gas) public onlyRole(TOKEN_ADMIN_ROLE) returns (uint256 numProcessed, uint256 numClaims, uint256 lastIndex) { uint256 numberOfTokenHolders = tokenHoldersMap.size(); if (numberOfTokenHolders == 0) { return (0, 0, lastProcessedIndex); } uint256 _lastProcessedIndex = lastProcessedIndex; uint256 gasUsed = 0; uint256 gasLeft = gasleft(); uint256 iterations = 0; uint256 claims = 0; while (gasUsed < gas && iterations < numberOfTokenHolders) { _lastProcessedIndex++; if (_lastProcessedIndex >= tokenHoldersMap.size()) { _lastProcessedIndex = 0; } address account = tokenHoldersMap.getKeyAtIndex(_lastProcessedIndex); if (processAccount(payable(account), true)) { claims++; } iterations++; uint256 newGasLeft = gasleft(); if (gasLeft > newGasLeft) { gasUsed = gasUsed.add(gasLeft.sub(newGasLeft)); } gasLeft = newGasLeft; } lastProcessedIndex = _lastProcessedIndex; return (iterations, claims, lastProcessedIndex); } function processAccount(address payable account, bool automatic) internal returns (bool) { uint256 amount = _withdrawDividendOfUser(account); emit Claim(account, amount, automatic); return amount > 0; } function claimReward() external returns (bool) { uint256 amount = _withdrawDividendOfUser(payable(msg.sender)); emit Claim(msg.sender, amount, false); return amount > 0; } function _withdrawDividendOfUser(address payable user) internal returns (uint256) { uint256 _withdrawableDividend = withdrawableDividendOf(user); uint256 perToken = _withdrawableDividend.div(ethToRewardPath.length); uint256 amount = 0; for(uint256 i = 0; i < ethToRewardPath.length; i++){ if (perToken > 0) { withdrawnDividends[user] = withdrawnDividends[user].add(perToken); emit DividendWithdrawn(user, perToken); amount.add(swapETHForTokensAndWithdrawDividend(user, ethToRewardPath[i], perToken)); } } return amount; } function swapETHForTokensAndWithdrawDividend(address holder, address[] memory rewardPath, uint256 ethAmount) private returns (uint256) { try uniswapRouter.swapExactETHForTokensSupportingFeeOnTransferTokens{value : ethAmount}( 0, // accept any amount of tokens rewardPath, address(holder), block.timestamp ) { return ethAmount; } catch { withdrawnDividends[holder] = withdrawnDividends[holder].sub(ethAmount); } return 0; } /// @notice The total accumulated dividends for a address /// @param _owner The address to query for accumulated dividends /// @return accumulated The total dividends currently accumulated (total - withdrawn) function accumulativeDividendOf(address _owner) public view returns (uint256 accumulated) { return SafeCast.toUint256(SafeCast.toInt256(magnifiedDividendPerShare.mul(balanceOf(_owner))) .add(magnifiedDividendCorrections[_owner])) / (MAGNITUDE); } /// @notice The total withdrawable dividends for a address /// @param _owner The address to query for accumulated dividends /// @return withdrawable The total dividends currently withdrawable (total - withdrawn) function withdrawableDividendOf(address _owner) public view returns (uint256 withdrawable) { return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]); } function _setBalance(address account, uint256 newBalance) internal { uint256 currentBalance = balanceOf(account); if (newBalance > currentBalance) { uint256 mintAmount = newBalance.sub(currentBalance); _mint(account, mintAmount); } else if (newBalance < currentBalance) { uint256 burnAmount = currentBalance.sub(newBalance); _burn(account, burnAmount); } } function _mint(address account, uint256 value) internal override { super._mint(account, value); magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account] .sub(SafeCast.toInt256(magnifiedDividendPerShare.mul(value))); } function _burn(address account, uint256 value) internal override { super._burn(account, value); magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account] .add(SafeCast.toInt256(magnifiedDividendPerShare.mul(value))); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol) pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SignedSafeMath { /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { return a * b; } /** * @dev Returns the integer division of two signed integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(int256 a, int256 b) internal pure returns (int256) { return a / b; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { return a - b; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { return a + b; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); }
pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; /// @title Dividend-Paying Token Interface /// @author Roger Wu (https://github.com/roger-wu) /// @dev An interface for a dividend-paying token contract. interface IDividendPayingToken { /// @notice View the amount of dividend in wei that an address can withdraw. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` can withdraw. function dividendOf(address _owner) external view returns(uint256); /// @dev This event MUST emit when ether is distributed to token holders. /// @param from The address which sends ether to this contract. /// @param weiAmount The amount of distributed ether in wei. event DividendsDistributed( address indexed from, uint256 weiAmount ); /// @dev This event MUST emit when an address withdraws their dividend. /// @param to The address which withdraws ether from this contract. /// @param weiAmount The amount of withdrawn ether in wei. event DividendWithdrawn( address indexed to, uint256 weiAmount ); /// @notice View the amount of dividend in wei that an address can withdraw. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` can withdraw. function withdrawableDividendOf(address _owner) external view returns(uint256); /// @notice View the amount of dividend in wei that an address has withdrawn. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` has withdrawn. function withdrawnDividendOf(address _owner) external view returns(uint256); /// @notice View the amount of dividend in wei that an address has earned in total. /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner) /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` has earned in total. function accumulativeDividendOf(address _owner) external view returns(uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; /// @notice Library to allow iteration of an ordered mapping of address -> uint library IterableMapping { struct Map { address[] keys; mapping(address => uint) values; mapping(address => uint) indexOf; mapping(address => bool) inserted; } /// @notice Gets the index in the mapping of the specified key /// @param map The map to find the key in /// @param key The key to get the index for /// @return index The index of the key that was passed in function getIndexOfKey(Map storage map, address key) public view returns (int index) { if (!map.inserted[key]) { return - 1; } return int(map.indexOf[key]); } /// @notice Get the key and a specific index /// @param map The map to get the key from /// @param index The index to retrieve the key from /// @param key The address(key) of the index passed in function getKeyAtIndex(Map storage map, uint index) public view returns (address key) { return map.keys[index]; } /// @notice Gets the size of the map /// @return mapSize The size of the map function size(Map storage map) public view returns (uint mapSize) { return map.keys.length; } /// @notice Sets a key/value pair into the map /// @param map The map to add to /// @param key The address to key the value on /// @param val The value associated with the key function set( Map storage map, address key, uint val ) public { if (map.inserted[key]) { map.values[key] = val; } else { map.inserted[key] = true; map.values[key] = val; map.indexOf[key] = map.keys.length; map.keys.push(key); } } /// @notice Removes a key/value form the map /// @param map The map to remove the entry from /// @param key The key of the entry to remove from the map function remove(Map storage map, address key) public { if (!map.inserted[key]) { return; } delete map.inserted[key]; delete map.values[key]; uint index = map.indexOf[key]; uint lastIndex = map.keys.length - 1; address lastKey = map.keys[lastIndex]; map.indexOf[lastKey] = index; delete map.indexOf[key]; map.keys[index] = lastKey; map.keys.pop(); } }
{ "optimizer": { "enabled": true, "runs": 20000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": { "contracts/IterableMapping.sol": { "IterableMapping": "0x72dccaabd1979538a6c36feee2a2f9ea704b15a4" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"bool","name":"automatic","type":"bool"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"weiAmount","type":"uint256"}],"name":"DividendWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"weiAmount","type":"uint256"}],"name":"DividendsDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"ExcludeFromDividends","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"accumulativeDividendOf","outputs":[{"internalType":"uint256","name":"accumulated","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeDividends","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"dividendOf","outputs":[{"internalType":"uint256","name":"dividends","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"value","type":"bool"}],"name":"excludeFromDividends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getAccount","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"int256","name":"index","type":"int256"},{"internalType":"int256","name":"iterationsUntilProcessed","type":"int256"},{"internalType":"uint256","name":"withdrawableDividends","type":"uint256"},{"internalType":"uint256","name":"totalDividends","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getAccountAtIndex","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"int256","name":"index","type":"int256"},{"internalType":"int256","name":"iterationsUntilProcessed","type":"int256"},{"internalType":"uint256","name":"withdrawableDividends","type":"uint256"},{"internalType":"uint256","name":"totalDividends","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastProcessedIndex","outputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumberOfTokenHolders","outputs":[{"internalType":"uint256","name":"holders","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastProcessedIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gas","type":"uint256"}],"name":"process","outputs":[{"internalType":"uint256","name":"numProcessed","type":"uint256"},{"internalType":"uint256","name":"numClaims","type":"uint256"},{"internalType":"uint256","name":"lastIndex","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"rescueToken","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"},{"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"setBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"setRewardTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"setTokenAdminRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setTokenBalanceForDividends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IUniswapV2Router02","name":"router","type":"address"}],"name":"setUniswapRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDividendsDistributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"withdrawableDividendOf","outputs":[{"internalType":"uint256","name":"withdrawable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"withdrawnDividendOf","outputs":[{"internalType":"uint256","name":"dividends","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6002608081815260e06040529060a05b60608152602001906001900390816200000f57505080516200003a9160109160209091019062000950565b503480156200004857600080fd5b5060408051808201825260158082527f5061636b5f4469766964656e645f547261636b6572000000000000000000000060208084018290528451808601909552918452908301529060036200009e838262000b12565b506004620000ad828262000b12565b5050670de0b6b3a7640000600f5550620000dd6000733ed182236f5d4754769a1cc182c5a07d17d4722b620001a4565b6200010c600080516020620043eb833981519152733ed182236f5d4754769a1cc182c5a07d17d4722b620001a4565b62000119600033620001a4565b62000134600080516020620043eb83398151915233620001a4565b6040805160208101909152739813037ee2218799597d83d4a5b6f3b6778218d9815262000166906013906001620009b0565b50620001743060016200022f565b6200018361dead60016200022f565b62000191600060016200022f565b6200019e3360016200022f565b62000d93565b620001b0828262000328565b6200022b5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001ea3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600080516020620043eb8339815191526200024a8162000355565b6001600160a01b0383166000908152600c60205260408120805460ff19168415151790556200027b90849062000364565b60405163131836e760e21b8152600660048201526001600160a01b03841660248201527372dccaabd1979538a6c36feee2a2f9ea704b15a490634c60db9c9060440160006040518083038186803b158015620002d657600080fd5b505af4158015620002eb573d6000803e3d6000fd5b50506040516001600160a01b03861692507fa878b31040b2e6d0a9a3d3361209db3908ba62014b0dca52adbaee451d128b259150600090a2505050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b620003618133620003d2565b50565b6001600160a01b03821660009081526020819052604090205480821115620003a85760006200039483836200043f565b9050620003a2848262000454565b50505050565b80821015620003cd576000620003bf82846200043f565b9050620003a28482620004bf565b505050565b620003de828262000328565b6200022b57620003ee8162000504565b620003fb83602062000517565b6040516020016200040e92919062000c04565b60408051601f198184030181529082905262461bcd60e51b8252620004369160040162000c7d565b60405180910390fd5b60006200044d828462000cc8565b9392505050565b620004608282620006d0565b600e546200049f906200047f9062000479908462000782565b62000790565b6001600160a01b0384166000908152600a60205260409020549062000800565b6001600160a01b039092166000908152600a602052604090209190915550565b620004cb82826200080e565b600e546200049f90620004e49062000479908462000782565b6001600160a01b0384166000908152600a60205260409020549062000942565b60606200034f6001600160a01b03831660145b606060006200052883600262000cde565b6200053590600262000cf8565b6001600160401b038111156200054f576200054f62000a6e565b6040519080825280601f01601f1916602001820160405280156200057a576020820181803683370190505b509050600360fc1b8160008151811062000598576200059862000d0e565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620005ca57620005ca62000d0e565b60200101906001600160f81b031916908160001a9053506000620005f084600262000cde565b620005fd90600162000cf8565b90505b60018111156200067f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811062000635576200063562000d0e565b1a60f81b8282815181106200064e576200064e62000d0e565b60200101906001600160f81b031916908160001a90535060049490941c93620006778162000d24565b905062000600565b5083156200044d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000436565b6001600160a01b038216620007285760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640162000436565b80600260008282546200073c919062000cf8565b90915550506001600160a01b03821660008181526020818152604080832080548601905551848152600080516020620043cb833981519152910160405180910390a35050565b60006200044d828462000cde565b60006001600160ff1b03821115620007fc5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b606482015260840162000436565b5090565b60006200044d828462000d3e565b6001600160a01b038216620008705760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840162000436565b6001600160a01b03821660009081526020819052604090205481811015620008e65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840162000436565b6001600160a01b038316600081815260208181526040808320868603905560028054879003905551858152919291600080516020620043cb833981519152910160405180910390a3620003cd836000846001600160e01b038416565b60006200044d828462000d68565b828054828255906000526020600020908101928215620009a2579160200282015b82811115620009a2578251805162000991918491602090910190620009b0565b509160200191906001019062000971565b50620007fc92915062000a16565b82805482825590600052602060002090810192821562000a08579160200282015b8281111562000a0857825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620009d1565b50620007fc92915062000a37565b80821115620007fc57600062000a2d828262000a4e565b5060010162000a16565b5b80821115620007fc576000815560010162000a38565b508054600082559060005260206000209081019062000361919062000a37565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168062000a9957607f821691505b60208210810362000aba57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003cd57600081815260208120601f850160051c8101602086101562000ae95750805b601f850160051c820191505b8181101562000b0a5782815560010162000af5565b505050505050565b81516001600160401b0381111562000b2e5762000b2e62000a6e565b62000b468162000b3f845462000a84565b8462000ac0565b602080601f83116001811462000b7e576000841562000b655750858301515b600019600386901b1c1916600185901b17855562000b0a565b600085815260208120601f198616915b8281101562000baf5788860151825594840194600190910190840162000b8e565b508582101562000bce5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60005b8381101562000bfb57818101518382015260200162000be1565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835162000c3e81601785016020880162000bde565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835162000c7181602884016020880162000bde565b01602801949350505050565b602081526000825180602084015262000c9e81604085016020870162000bde565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156200034f576200034f62000cb2565b80820281158282048414176200034f576200034f62000cb2565b808201808211156200034f576200034f62000cb2565b634e487b7160e01b600052603260045260246000fd5b60008162000d365762000d3662000cb2565b506000190190565b818103600083128015838313168383128216171562000d615762000d6162000cb2565b5092915050565b808201828112600083128015821682158216171562000d8b5762000d8b62000cb2565b505092915050565b6136288062000da36000396000f3fe6080604052600436106102d55760003560e01c806370a0823111610179578063a9059cbb116100d6578063d75a9def1161008a578063e7841ec011610064578063e7841ec0146108bb578063fbcbc0f1146108d0578063ffb2c479146108f057600080fd5b8063d75a9def14610814578063dd62ed3e14610848578063e30443bc1461089b57600080fd5b8063b88a802f116100bb578063b88a802f146107bf578063bea9849e146107d4578063d547741f146107f457600080fd5b8063a9059cbb1461075c578063aafd847a1461077c57600080fd5b806391d148541161012d578063a217fddf11610112578063a217fddf14610707578063a457c2d71461071c578063a8b9d2401461073c57600080fd5b806391d148541461069f57806395d89b41146106f257600080fd5b80637bb7bed11161015e5780637bb7bed11461062457806385a6b3ae1461066957806391b89fba1461067f57600080fd5b806370a08231146105c157806379cc67901461060457600080fd5b8063248a9ca31161023257806336568abe116101e65780634460d3cf116101c05780634460d3cf1461052257806346493cd2146105425780635183d6fd1461056257600080fd5b806336568abe146104c257806339509351146104e257806342966c681461050257600080fd5b80632f2ff15d116102175780632f2ff15d146104705780633009a60914610490578063313ce567146104a657600080fd5b8063248a9ca31461042057806327ce01471461045057600080fd5b806309bbedde1161028957806318160ddd1161026e57806318160ddd146103cb578063201e81a8146103e057806323b872dd1461040057600080fd5b806309bbedde14610388578063163c7cef146103ab57600080fd5b80630483f7a0116102ba5780630483f7a01461032657806306fdde0314610346578063095ea7b31461036857600080fd5b806301ffc9a7146102e957806303c833021461031e57600080fd5b366102e4576102e261092b565b005b600080fd5b3480156102f557600080fd5b50610309610304366004612f83565b610a58565b60405190151581526020015b60405180910390f35b6102e261092b565b34801561033257600080fd5b506102e2610341366004613005565b610af1565b34801561035257600080fd5b5061035b610c53565b6040516103159190613062565b34801561037457600080fd5b506103096103833660046130b3565b610ce5565b34801561039457600080fd5b5061039d610cfd565b604051908152602001610315565b3480156103b757600080fd5b506102e26103c63660046130df565b610d92565b3480156103d757600080fd5b5060025461039d565b3480156103ec57600080fd5b506102e26103fb366004613127565b610dc2565b34801561040c57600080fd5b5061030961041b36600461320a565b611080565b34801561042c57600080fd5b5061039d61043b3660046130df565b60009081526005602052604090206001015490565b34801561045c57600080fd5b5061039d61046b36600461324b565b6110a6565b34801561047c57600080fd5b506102e261048b366004613268565b61111c565b34801561049c57600080fd5b5061039d60125481565b3480156104b257600080fd5b5060405160128152602001610315565b3480156104ce57600080fd5b506102e26104dd366004613268565b611141565b3480156104ee57600080fd5b506103096104fd3660046130b3565b6111f4565b34801561050e57600080fd5b506102e261051d3660046130df565b611240565b34801561052e57600080fd5b5061030961053d36600461324b565b61124a565b34801561054e57600080fd5b506102e261055d36600461324b565b6113ab565b34801561056e57600080fd5b5061058261057d3660046130df565b6113ff565b6040805173ffffffffffffffffffffffffffffffffffffffff90961686526020860194909452928401919091526060830152608082015260a001610315565b3480156105cd57600080fd5b5061039d6105dc36600461324b565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b34801561061057600080fd5b506102e261061f3660046130b3565b61155d565b34801561063057600080fd5b5061064461063f3660046130df565b611572565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610315565b34801561067557600080fd5b5061039d60115481565b34801561068b57600080fd5b5061039d61069a36600461324b565b6115a9565b3480156106ab57600080fd5b506103096106ba366004613268565b600091825260056020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156106fe57600080fd5b5061035b6115b4565b34801561071357600080fd5b5061039d600081565b34801561072857600080fd5b506103096107373660046130b3565b6115c3565b34801561074857600080fd5b5061039d61075736600461324b565b61169f565b34801561076857600080fd5b506103096107773660046130b3565b6116d8565b34801561078857600080fd5b5061039d61079736600461324b565b73ffffffffffffffffffffffffffffffffffffffff166000908152600b602052604090205490565b3480156107cb57600080fd5b506103096116e6565b3480156107e057600080fd5b506102e26107ef36600461324b565b611734565b34801561080057600080fd5b506102e261080f366004613268565b6117ac565b34801561082057600080fd5b5061039d7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd681565b34801561085457600080fd5b5061039d61086336600461328d565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b3480156108a757600080fd5b506102e26108b63660046130b3565b6117d1565b3480156108c757600080fd5b5060125461039d565b3480156108dc57600080fd5b506105826108eb36600461324b565b611994565b3480156108fc57600080fd5b5061091061090b3660046130df565b611bf1565b60408051938452602084019290925290820152606001610315565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd661095581611e9c565b600061096060025490565b116109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e6f20737570706c79000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b3415610a5557610a0c6109de60025490565b6109f934700100000000000000000000000000000000611ea6565b610a0391906132ea565b600e5490611eb2565b600e5560405134815233907fa493a9229478c3fcd73f66d2cdeb7f94fd0f341da924d1054236d784541165119060200160405180910390a2601154610a519034611eb2565b6011555b50565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610aeb57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6610b1b81611e9c565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600c6020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016841515179055610b75908490611ebe565b6040517f4c60db9c0000000000000000000000000000000000000000000000000000000081526006600482015273ffffffffffffffffffffffffffffffffffffffff841660248201527372dccaabd1979538a6c36feee2a2f9ea704b15a490634c60db9c9060440160006040518083038186803b158015610bf557600080fd5b505af4158015610c09573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff861692507fa878b31040b2e6d0a9a3d3361209db3908ba62014b0dca52adbaee451d128b259150600090a2505050565b606060038054610c6290613325565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8e90613325565b8015610cdb5780601f10610cb057610100808354040283529160200191610cdb565b820191906000526020600020905b815481529060010190602001808311610cbe57829003601f168201915b5050505050905090565b600033610cf3818585611f24565b5060019392505050565b6040517fdeb3d896000000000000000000000000000000000000000000000000000000008152600660048201526000907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015610d69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8d9190613372565b905090565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6610dbc81611e9c565b50600f55565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6610dec81611e9c565b600382511115610e58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6d6178203320726577617264730000000000000000000000000000000000000060448201526064016109c3565b610e6460106000612e8f565b60005b825181101561106757600073ffffffffffffffffffffffffffffffffffffffff16838281518110610e9a57610e9a61338b565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614611055576040805160028082526060820183526000926020830190803683375050600d54604080517fad5c4648000000000000000000000000000000000000000000000000000000008152905193945073ffffffffffffffffffffffffffffffffffffffff9091169263ad5c4648925060048083019260209291908290030181865afa158015610f4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7191906133ba565b81600081518110610f8457610f8461338b565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050838281518110610fd057610fd061338b565b602002602001015181600181518110610feb57610feb61338b565b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101820152601080546001810182556000919091528251611052927f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae67290920191840190612ead565b50505b8061105f816133d7565b915050610e67565b50815161107b906013906020850190612ead565b505050565b60003361108e8582856120d7565b6110998585856121a8565b60019150505b9392505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600a602090815260408083205491839052822054600e54700100000000000000000000000000000000926111129261110d92611107916111029190611ea6565b61220a565b906122c0565b6122cc565b610aeb91906132ea565b60008281526005602052604090206001015461113781611e9c565b61107b8383612338565b73ffffffffffffffffffffffffffffffffffffffff811633146111e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016109c3565b6111f0828261242c565b5050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190610cf3908290869061123b90879061340f565b611f24565b610a5533826124e7565b60007f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd661127681611e9c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff84169063a9059cbb90339083906370a0823190602401602060405180830381865afa1580156112ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130e9190613372565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af115801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a29190613422565b91505b50919050565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd66113d581611e9c565b6111f07f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd683612338565b6040517fdeb3d8960000000000000000000000000000000000000000000000000000000081526006600482015260009081908190819081907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015611473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114979190613372565b86106114b157506000935083925082915081905080611554565b6040517fd1aa9e7e0000000000000000000000000000000000000000000000000000000081526006600482015260248101879052611549907372dccaabd1979538a6c36feee2a2f9ea704b15a49063d1aa9e7e90604401602060405180830381865af4158015611525573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108eb91906133ba565b945094509450945094505b91939590929450565b6115688233836120d7565b6111f082826124e7565b6013818154811061158257600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6000610aeb8261169f565b606060048054610c6290613325565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015611687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016109c3565b6116948286868403611f24565b506001949350505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020526040812054610aeb906116d2846110a6565b90612565565b600033610cf38185856121a8565b6000806116f233612571565b60405181815290915060009033907fa2c38e2d2fb7e3e1912d937fd1ca11ed6d51864dee4cfa7a7bf02becd7acf0929060200160405180910390a31515919050565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd661175e81611e9c565b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556111f0906001610af1565b6000828152600560205260409020600101546117c781611e9c565b61107b838361242c565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd66117fb81611e9c565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600c602052604090205460ff1661107b57600f5482106118df5761183b8383611ebe565b6040517fbc2b405c0000000000000000000000000000000000000000000000000000000081526006600482015273ffffffffffffffffffffffffffffffffffffffff84166024820152604481018390527372dccaabd1979538a6c36feee2a2f9ea704b15a49063bc2b405c9060640160006040518083038186803b1580156118c257600080fd5b505af41580156118d6573d6000803e3d6000fd5b50505050611983565b6118ea836000611ebe565b6040517f4c60db9c0000000000000000000000000000000000000000000000000000000081526006600482015273ffffffffffffffffffffffffffffffffffffffff841660248201527372dccaabd1979538a6c36feee2a2f9ea704b15a490634c60db9c9060440160006040518083038186803b15801561196a57600080fd5b505af415801561197e573d6000803e3d6000fd5b505050505b61198e8360016126ef565b50505050565b6040517f17e142d10000000000000000000000000000000000000000000000000000000081526006600482015273ffffffffffffffffffffffffffffffffffffffff8216602482015281906000908190819081907372dccaabd1979538a6c36feee2a2f9ea704b15a4906317e142d190604401602060405180830381865af4158015611a24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a489190613372565b93506000925060008412611bd257601254611a62856122cc565b1115611a8457611a7d611a7660125461220a565b8590612759565b9250611bd2565b6012546040517fdeb3d89600000000000000000000000000000000000000000000000000000000815260066004820152600091907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015611af4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b189190613372565b11611b24576000611bb9565b6012546040517fdeb3d89600000000000000000000000000000000000000000000000000000000815260066004820152611bb991907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015611b95573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d29190613372565b9050611bce611bc78261220a565b86906122c0565b9350505b611bdb8561169f565b9150611be6856110a6565b905091939590929450565b60008060007f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6611c2081611e9c565b6040517fdeb3d896000000000000000000000000000000000000000000000000000000008152600660048201526000907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015611c8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb09190613372565b905080600003611ccc5760008060125494509450945050611e94565b6012546000805a90506000805b8a84108015611ce757508582105b15611e835784611cf6816133d7565b6040517fdeb3d896000000000000000000000000000000000000000000000000000000008152600660048201529096507372dccaabd1979538a6c36feee2a2f9ea704b15a4915063deb3d89690602401602060405180830381865af4158015611d63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d879190613372565b8510611d9257600094505b6040517fd1aa9e7e00000000000000000000000000000000000000000000000000000000815260066004820152602481018690526000907372dccaabd1979538a6c36feee2a2f9ea704b15a49063d1aa9e7e90604401602060405180830381865af4158015611e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2991906133ba565b9050611e368160016126ef565b15611e495781611e45816133d7565b9250505b82611e53816133d7565b93505060005a905080851115611e7a57611e77611e708683612565565b8790611eb2565b95505b9350611cd99050565b601285905590985096509194505050505b509193909250565b610a558133612765565b600061109f828461343f565b600061109f828461340f565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205480821115611f04576000611ef88383612565565b905061198e848261281f565b8082101561107b576000611f188284612565565b905061198e84826124e7565b73ffffffffffffffffffffffffffffffffffffffff8316611fc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016109c3565b73ffffffffffffffffffffffffffffffffffffffff8216612069576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016109c3565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461198e578181101561219b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016109c3565b61198e8484848403611f24565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4e6f207472616e7366657273000000000000000000000000000000000000000060448201526064016109c3565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8211156122bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e7432353600000000000000000000000000000000000000000000000060648201526084016109c3565b5090565b600061109f8284613456565b6000808212156122bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f73697469766560448201526064016109c3565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166111f057600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556123ce3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156111f057600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6124f18282612870565b61253861250c61110283600e54611ea690919063ffffffff16565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600a6020526040902054906122c0565b73ffffffffffffffffffffffffffffffffffffffff9092166000908152600a602052604090209190915550565b600061109f828461347e565b60008061257d8361169f565b601054909150600090612591908390612a34565b90506000805b6010548110156126e65782156126d45773ffffffffffffffffffffffffffffffffffffffff86166000908152600b60205260409020546125d79084611eb2565b73ffffffffffffffffffffffffffffffffffffffff87166000818152600b6020526040908190209290925590517fee503bee2bb6a87e57bc57db795f98137327401a0e7b7ce42e37926cc1a9ca4d906126339086815260200190565b60405180910390a26126d26126cb87601084815481106126555761265561338b565b906000526020600020018054806020026020016040519081016040528092919081815260200182805480156126c057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311612695575b505050505086612a40565b8390611eb2565b505b806126de816133d7565b915050612597565b50949350505050565b6000806126fb84612571565b90508215158473ffffffffffffffffffffffffffffffffffffffff167fa2c38e2d2fb7e3e1912d937fd1ca11ed6d51864dee4cfa7a7bf02becd7acf0928360405161274891815260200190565b60405180910390a315159392505050565b600061109f8284613491565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166111f0576127a581612b3a565b6127b0836020612b59565b6040516020016127c19291906134b8565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109c391600401613062565b6128298282612d9c565b61253861284461110283600e54611ea690919063ffffffff16565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600a602052604090205490612759565b73ffffffffffffffffffffffffffffffffffffffff8216612913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016109c3565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040902054818110156129c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016109c3565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600061109f82846132ea565b600d546040517fb6f9de9500000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063b6f9de95908490612a9f90859088908a904290600401613539565b6000604051808303818588803b158015612ab857600080fd5b505af193505050508015612aca575060015b612b295773ffffffffffffffffffffffffffffffffffffffff84166000908152600b6020526040902054612afe9083612565565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600b6020526040902055612b30565b508061109f565b5060009392505050565b6060610aeb73ffffffffffffffffffffffffffffffffffffffff831660145b60606000612b6883600261343f565b612b7390600261340f565b67ffffffffffffffff811115612b8b57612b8b6130f8565b6040519080825280601f01601f191660200182016040528015612bb5576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612bec57612bec61338b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612c4f57612c4f61338b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612c8b84600261343f565b612c9690600161340f565b90505b6001811115612d33577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612cd757612cd761338b565b1a60f81b828281518110612ced57612ced61338b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93612d2c816135bd565b9050612c99565b50831561109f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109c3565b73ffffffffffffffffffffffffffffffffffffffff8216612e19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016109c3565b8060026000828254612e2b919061340f565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b5080546000825590600052602060002090810190610a559190612f33565b828054828255906000526020600020908101928215612f27579160200282015b82811115612f2757825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190612ecd565b506122bc929150612f50565b808211156122bc576000612f478282612f65565b50600101612f33565b5b808211156122bc5760008155600101612f51565b5080546000825590600052602060002090810190610a559190612f50565b600060208284031215612f9557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461109f57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a5557600080fd5b8035612ff281612fc5565b919050565b8015158114610a5557600080fd5b6000806040838503121561301857600080fd5b823561302381612fc5565b9150602083013561303381612ff7565b809150509250929050565b60005b83811015613059578181015183820152602001613041565b50506000910152565b602081526000825180602084015261308181604085016020870161303e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600080604083850312156130c657600080fd5b82356130d181612fc5565b946020939093013593505050565b6000602082840312156130f157600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602080838503121561313a57600080fd5b823567ffffffffffffffff8082111561315257600080fd5b818501915085601f83011261316657600080fd5b813581811115613178576131786130f8565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156131bb576131bb6130f8565b6040529182528482019250838101850191888311156131d957600080fd5b938501935b828510156131fe576131ef85612fe7565b845293850193928501926131de565b98975050505050505050565b60008060006060848603121561321f57600080fd5b833561322a81612fc5565b9250602084013561323a81612fc5565b929592945050506040919091013590565b60006020828403121561325d57600080fd5b813561109f81612fc5565b6000806040838503121561327b57600080fd5b82359150602083013561303381612fc5565b600080604083850312156132a057600080fd5b82356132ab81612fc5565b9150602083013561303381612fc5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082613320577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600181811c9082168061333957607f821691505b6020821081036113a5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006020828403121561338457600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156133cc57600080fd5b815161109f81612fc5565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613408576134086132bb565b5060010190565b80820180821115610aeb57610aeb6132bb565b60006020828403121561343457600080fd5b815161109f81612ff7565b8082028115828204841417610aeb57610aeb6132bb565b8082018281126000831280158216821582161715613476576134766132bb565b505092915050565b81810381811115610aeb57610aeb6132bb565b81810360008312801583831316838312821617156134b1576134b16132bb565b5092915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516134f081601785016020880161303e565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161352d81602884016020880161303e565b01602801949350505050565b600060808201868352602060808185015281875180845260a086019150828901935060005b8181101561359057845173ffffffffffffffffffffffffffffffffffffffff168352938301939183019160010161355e565b505073ffffffffffffffffffffffffffffffffffffffff9690961660408501525050506060015292915050565b6000816135cc576135cc6132bb565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212209b90b8e7d7127cd7d701e30d2d7fbe2af5c088d6e7ceded813c2da79942c505464736f6c63430008130033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6
Deployed Bytecode
0x6080604052600436106102d55760003560e01c806370a0823111610179578063a9059cbb116100d6578063d75a9def1161008a578063e7841ec011610064578063e7841ec0146108bb578063fbcbc0f1146108d0578063ffb2c479146108f057600080fd5b8063d75a9def14610814578063dd62ed3e14610848578063e30443bc1461089b57600080fd5b8063b88a802f116100bb578063b88a802f146107bf578063bea9849e146107d4578063d547741f146107f457600080fd5b8063a9059cbb1461075c578063aafd847a1461077c57600080fd5b806391d148541161012d578063a217fddf11610112578063a217fddf14610707578063a457c2d71461071c578063a8b9d2401461073c57600080fd5b806391d148541461069f57806395d89b41146106f257600080fd5b80637bb7bed11161015e5780637bb7bed11461062457806385a6b3ae1461066957806391b89fba1461067f57600080fd5b806370a08231146105c157806379cc67901461060457600080fd5b8063248a9ca31161023257806336568abe116101e65780634460d3cf116101c05780634460d3cf1461052257806346493cd2146105425780635183d6fd1461056257600080fd5b806336568abe146104c257806339509351146104e257806342966c681461050257600080fd5b80632f2ff15d116102175780632f2ff15d146104705780633009a60914610490578063313ce567146104a657600080fd5b8063248a9ca31461042057806327ce01471461045057600080fd5b806309bbedde1161028957806318160ddd1161026e57806318160ddd146103cb578063201e81a8146103e057806323b872dd1461040057600080fd5b806309bbedde14610388578063163c7cef146103ab57600080fd5b80630483f7a0116102ba5780630483f7a01461032657806306fdde0314610346578063095ea7b31461036857600080fd5b806301ffc9a7146102e957806303c833021461031e57600080fd5b366102e4576102e261092b565b005b600080fd5b3480156102f557600080fd5b50610309610304366004612f83565b610a58565b60405190151581526020015b60405180910390f35b6102e261092b565b34801561033257600080fd5b506102e2610341366004613005565b610af1565b34801561035257600080fd5b5061035b610c53565b6040516103159190613062565b34801561037457600080fd5b506103096103833660046130b3565b610ce5565b34801561039457600080fd5b5061039d610cfd565b604051908152602001610315565b3480156103b757600080fd5b506102e26103c63660046130df565b610d92565b3480156103d757600080fd5b5060025461039d565b3480156103ec57600080fd5b506102e26103fb366004613127565b610dc2565b34801561040c57600080fd5b5061030961041b36600461320a565b611080565b34801561042c57600080fd5b5061039d61043b3660046130df565b60009081526005602052604090206001015490565b34801561045c57600080fd5b5061039d61046b36600461324b565b6110a6565b34801561047c57600080fd5b506102e261048b366004613268565b61111c565b34801561049c57600080fd5b5061039d60125481565b3480156104b257600080fd5b5060405160128152602001610315565b3480156104ce57600080fd5b506102e26104dd366004613268565b611141565b3480156104ee57600080fd5b506103096104fd3660046130b3565b6111f4565b34801561050e57600080fd5b506102e261051d3660046130df565b611240565b34801561052e57600080fd5b5061030961053d36600461324b565b61124a565b34801561054e57600080fd5b506102e261055d36600461324b565b6113ab565b34801561056e57600080fd5b5061058261057d3660046130df565b6113ff565b6040805173ffffffffffffffffffffffffffffffffffffffff90961686526020860194909452928401919091526060830152608082015260a001610315565b3480156105cd57600080fd5b5061039d6105dc36600461324b565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b34801561061057600080fd5b506102e261061f3660046130b3565b61155d565b34801561063057600080fd5b5061064461063f3660046130df565b611572565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610315565b34801561067557600080fd5b5061039d60115481565b34801561068b57600080fd5b5061039d61069a36600461324b565b6115a9565b3480156106ab57600080fd5b506103096106ba366004613268565b600091825260056020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156106fe57600080fd5b5061035b6115b4565b34801561071357600080fd5b5061039d600081565b34801561072857600080fd5b506103096107373660046130b3565b6115c3565b34801561074857600080fd5b5061039d61075736600461324b565b61169f565b34801561076857600080fd5b506103096107773660046130b3565b6116d8565b34801561078857600080fd5b5061039d61079736600461324b565b73ffffffffffffffffffffffffffffffffffffffff166000908152600b602052604090205490565b3480156107cb57600080fd5b506103096116e6565b3480156107e057600080fd5b506102e26107ef36600461324b565b611734565b34801561080057600080fd5b506102e261080f366004613268565b6117ac565b34801561082057600080fd5b5061039d7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd681565b34801561085457600080fd5b5061039d61086336600461328d565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b3480156108a757600080fd5b506102e26108b63660046130b3565b6117d1565b3480156108c757600080fd5b5060125461039d565b3480156108dc57600080fd5b506105826108eb36600461324b565b611994565b3480156108fc57600080fd5b5061091061090b3660046130df565b611bf1565b60408051938452602084019290925290820152606001610315565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd661095581611e9c565b600061096060025490565b116109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e6f20737570706c79000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b3415610a5557610a0c6109de60025490565b6109f934700100000000000000000000000000000000611ea6565b610a0391906132ea565b600e5490611eb2565b600e5560405134815233907fa493a9229478c3fcd73f66d2cdeb7f94fd0f341da924d1054236d784541165119060200160405180910390a2601154610a519034611eb2565b6011555b50565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610aeb57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6610b1b81611e9c565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600c6020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016841515179055610b75908490611ebe565b6040517f4c60db9c0000000000000000000000000000000000000000000000000000000081526006600482015273ffffffffffffffffffffffffffffffffffffffff841660248201527372dccaabd1979538a6c36feee2a2f9ea704b15a490634c60db9c9060440160006040518083038186803b158015610bf557600080fd5b505af4158015610c09573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff861692507fa878b31040b2e6d0a9a3d3361209db3908ba62014b0dca52adbaee451d128b259150600090a2505050565b606060038054610c6290613325565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8e90613325565b8015610cdb5780601f10610cb057610100808354040283529160200191610cdb565b820191906000526020600020905b815481529060010190602001808311610cbe57829003601f168201915b5050505050905090565b600033610cf3818585611f24565b5060019392505050565b6040517fdeb3d896000000000000000000000000000000000000000000000000000000008152600660048201526000907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015610d69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8d9190613372565b905090565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6610dbc81611e9c565b50600f55565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6610dec81611e9c565b600382511115610e58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6d6178203320726577617264730000000000000000000000000000000000000060448201526064016109c3565b610e6460106000612e8f565b60005b825181101561106757600073ffffffffffffffffffffffffffffffffffffffff16838281518110610e9a57610e9a61338b565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614611055576040805160028082526060820183526000926020830190803683375050600d54604080517fad5c4648000000000000000000000000000000000000000000000000000000008152905193945073ffffffffffffffffffffffffffffffffffffffff9091169263ad5c4648925060048083019260209291908290030181865afa158015610f4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7191906133ba565b81600081518110610f8457610f8461338b565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050838281518110610fd057610fd061338b565b602002602001015181600181518110610feb57610feb61338b565b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101820152601080546001810182556000919091528251611052927f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae67290920191840190612ead565b50505b8061105f816133d7565b915050610e67565b50815161107b906013906020850190612ead565b505050565b60003361108e8582856120d7565b6110998585856121a8565b60019150505b9392505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600a602090815260408083205491839052822054600e54700100000000000000000000000000000000926111129261110d92611107916111029190611ea6565b61220a565b906122c0565b6122cc565b610aeb91906132ea565b60008281526005602052604090206001015461113781611e9c565b61107b8383612338565b73ffffffffffffffffffffffffffffffffffffffff811633146111e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016109c3565b6111f0828261242c565b5050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190610cf3908290869061123b90879061340f565b611f24565b610a5533826124e7565b60007f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd661127681611e9c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff84169063a9059cbb90339083906370a0823190602401602060405180830381865afa1580156112ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130e9190613372565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af115801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a29190613422565b91505b50919050565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd66113d581611e9c565b6111f07f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd683612338565b6040517fdeb3d8960000000000000000000000000000000000000000000000000000000081526006600482015260009081908190819081907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015611473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114979190613372565b86106114b157506000935083925082915081905080611554565b6040517fd1aa9e7e0000000000000000000000000000000000000000000000000000000081526006600482015260248101879052611549907372dccaabd1979538a6c36feee2a2f9ea704b15a49063d1aa9e7e90604401602060405180830381865af4158015611525573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108eb91906133ba565b945094509450945094505b91939590929450565b6115688233836120d7565b6111f082826124e7565b6013818154811061158257600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6000610aeb8261169f565b606060048054610c6290613325565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015611687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016109c3565b6116948286868403611f24565b506001949350505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020526040812054610aeb906116d2846110a6565b90612565565b600033610cf38185856121a8565b6000806116f233612571565b60405181815290915060009033907fa2c38e2d2fb7e3e1912d937fd1ca11ed6d51864dee4cfa7a7bf02becd7acf0929060200160405180910390a31515919050565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd661175e81611e9c565b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556111f0906001610af1565b6000828152600560205260409020600101546117c781611e9c565b61107b838361242c565b7f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd66117fb81611e9c565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600c602052604090205460ff1661107b57600f5482106118df5761183b8383611ebe565b6040517fbc2b405c0000000000000000000000000000000000000000000000000000000081526006600482015273ffffffffffffffffffffffffffffffffffffffff84166024820152604481018390527372dccaabd1979538a6c36feee2a2f9ea704b15a49063bc2b405c9060640160006040518083038186803b1580156118c257600080fd5b505af41580156118d6573d6000803e3d6000fd5b50505050611983565b6118ea836000611ebe565b6040517f4c60db9c0000000000000000000000000000000000000000000000000000000081526006600482015273ffffffffffffffffffffffffffffffffffffffff841660248201527372dccaabd1979538a6c36feee2a2f9ea704b15a490634c60db9c9060440160006040518083038186803b15801561196a57600080fd5b505af415801561197e573d6000803e3d6000fd5b505050505b61198e8360016126ef565b50505050565b6040517f17e142d10000000000000000000000000000000000000000000000000000000081526006600482015273ffffffffffffffffffffffffffffffffffffffff8216602482015281906000908190819081907372dccaabd1979538a6c36feee2a2f9ea704b15a4906317e142d190604401602060405180830381865af4158015611a24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a489190613372565b93506000925060008412611bd257601254611a62856122cc565b1115611a8457611a7d611a7660125461220a565b8590612759565b9250611bd2565b6012546040517fdeb3d89600000000000000000000000000000000000000000000000000000000815260066004820152600091907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015611af4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b189190613372565b11611b24576000611bb9565b6012546040517fdeb3d89600000000000000000000000000000000000000000000000000000000815260066004820152611bb991907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015611b95573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d29190613372565b9050611bce611bc78261220a565b86906122c0565b9350505b611bdb8561169f565b9150611be6856110a6565b905091939590929450565b60008060007f9e262e26e9d5bf97da5c389e15529a31bb2b13d89967a4f6eab01792567d5fd6611c2081611e9c565b6040517fdeb3d896000000000000000000000000000000000000000000000000000000008152600660048201526000907372dccaabd1979538a6c36feee2a2f9ea704b15a49063deb3d89690602401602060405180830381865af4158015611c8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb09190613372565b905080600003611ccc5760008060125494509450945050611e94565b6012546000805a90506000805b8a84108015611ce757508582105b15611e835784611cf6816133d7565b6040517fdeb3d896000000000000000000000000000000000000000000000000000000008152600660048201529096507372dccaabd1979538a6c36feee2a2f9ea704b15a4915063deb3d89690602401602060405180830381865af4158015611d63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d879190613372565b8510611d9257600094505b6040517fd1aa9e7e00000000000000000000000000000000000000000000000000000000815260066004820152602481018690526000907372dccaabd1979538a6c36feee2a2f9ea704b15a49063d1aa9e7e90604401602060405180830381865af4158015611e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2991906133ba565b9050611e368160016126ef565b15611e495781611e45816133d7565b9250505b82611e53816133d7565b93505060005a905080851115611e7a57611e77611e708683612565565b8790611eb2565b95505b9350611cd99050565b601285905590985096509194505050505b509193909250565b610a558133612765565b600061109f828461343f565b600061109f828461340f565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205480821115611f04576000611ef88383612565565b905061198e848261281f565b8082101561107b576000611f188284612565565b905061198e84826124e7565b73ffffffffffffffffffffffffffffffffffffffff8316611fc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016109c3565b73ffffffffffffffffffffffffffffffffffffffff8216612069576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016109c3565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461198e578181101561219b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016109c3565b61198e8484848403611f24565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4e6f207472616e7366657273000000000000000000000000000000000000000060448201526064016109c3565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8211156122bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e7432353600000000000000000000000000000000000000000000000060648201526084016109c3565b5090565b600061109f8284613456565b6000808212156122bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f73697469766560448201526064016109c3565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166111f057600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556123ce3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156111f057600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6124f18282612870565b61253861250c61110283600e54611ea690919063ffffffff16565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600a6020526040902054906122c0565b73ffffffffffffffffffffffffffffffffffffffff9092166000908152600a602052604090209190915550565b600061109f828461347e565b60008061257d8361169f565b601054909150600090612591908390612a34565b90506000805b6010548110156126e65782156126d45773ffffffffffffffffffffffffffffffffffffffff86166000908152600b60205260409020546125d79084611eb2565b73ffffffffffffffffffffffffffffffffffffffff87166000818152600b6020526040908190209290925590517fee503bee2bb6a87e57bc57db795f98137327401a0e7b7ce42e37926cc1a9ca4d906126339086815260200190565b60405180910390a26126d26126cb87601084815481106126555761265561338b565b906000526020600020018054806020026020016040519081016040528092919081815260200182805480156126c057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311612695575b505050505086612a40565b8390611eb2565b505b806126de816133d7565b915050612597565b50949350505050565b6000806126fb84612571565b90508215158473ffffffffffffffffffffffffffffffffffffffff167fa2c38e2d2fb7e3e1912d937fd1ca11ed6d51864dee4cfa7a7bf02becd7acf0928360405161274891815260200190565b60405180910390a315159392505050565b600061109f8284613491565b600082815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166111f0576127a581612b3a565b6127b0836020612b59565b6040516020016127c19291906134b8565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109c391600401613062565b6128298282612d9c565b61253861284461110283600e54611ea690919063ffffffff16565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600a602052604090205490612759565b73ffffffffffffffffffffffffffffffffffffffff8216612913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016109c3565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040902054818110156129c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016109c3565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600061109f82846132ea565b600d546040517fb6f9de9500000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063b6f9de95908490612a9f90859088908a904290600401613539565b6000604051808303818588803b158015612ab857600080fd5b505af193505050508015612aca575060015b612b295773ffffffffffffffffffffffffffffffffffffffff84166000908152600b6020526040902054612afe9083612565565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600b6020526040902055612b30565b508061109f565b5060009392505050565b6060610aeb73ffffffffffffffffffffffffffffffffffffffff831660145b60606000612b6883600261343f565b612b7390600261340f565b67ffffffffffffffff811115612b8b57612b8b6130f8565b6040519080825280601f01601f191660200182016040528015612bb5576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612bec57612bec61338b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612c4f57612c4f61338b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612c8b84600261343f565b612c9690600161340f565b90505b6001811115612d33577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612cd757612cd761338b565b1a60f81b828281518110612ced57612ced61338b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93612d2c816135bd565b9050612c99565b50831561109f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109c3565b73ffffffffffffffffffffffffffffffffffffffff8216612e19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016109c3565b8060026000828254612e2b919061340f565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b5080546000825590600052602060002090810190610a559190612f33565b828054828255906000526020600020908101928215612f27579160200282015b82811115612f2757825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190612ecd565b506122bc929150612f50565b808211156122bc576000612f478282612f65565b50600101612f33565b5b808211156122bc5760008155600101612f51565b5080546000825590600052602060002090810190610a559190612f50565b600060208284031215612f9557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461109f57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a5557600080fd5b8035612ff281612fc5565b919050565b8015158114610a5557600080fd5b6000806040838503121561301857600080fd5b823561302381612fc5565b9150602083013561303381612ff7565b809150509250929050565b60005b83811015613059578181015183820152602001613041565b50506000910152565b602081526000825180602084015261308181604085016020870161303e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600080604083850312156130c657600080fd5b82356130d181612fc5565b946020939093013593505050565b6000602082840312156130f157600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602080838503121561313a57600080fd5b823567ffffffffffffffff8082111561315257600080fd5b818501915085601f83011261316657600080fd5b813581811115613178576131786130f8565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156131bb576131bb6130f8565b6040529182528482019250838101850191888311156131d957600080fd5b938501935b828510156131fe576131ef85612fe7565b845293850193928501926131de565b98975050505050505050565b60008060006060848603121561321f57600080fd5b833561322a81612fc5565b9250602084013561323a81612fc5565b929592945050506040919091013590565b60006020828403121561325d57600080fd5b813561109f81612fc5565b6000806040838503121561327b57600080fd5b82359150602083013561303381612fc5565b600080604083850312156132a057600080fd5b82356132ab81612fc5565b9150602083013561303381612fc5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082613320577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600181811c9082168061333957607f821691505b6020821081036113a5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006020828403121561338457600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156133cc57600080fd5b815161109f81612fc5565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613408576134086132bb565b5060010190565b80820180821115610aeb57610aeb6132bb565b60006020828403121561343457600080fd5b815161109f81612ff7565b8082028115828204841417610aeb57610aeb6132bb565b8082018281126000831280158216821582161715613476576134766132bb565b505092915050565b81810381811115610aeb57610aeb6132bb565b81810360008312801583831316838312821617156134b1576134b16132bb565b5092915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516134f081601785016020880161303e565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161352d81602884016020880161303e565b01602801949350505050565b600060808201868352602060808185015281875180845260a086019150828901935060005b8181101561359057845173ffffffffffffffffffffffffffffffffffffffff168352938301939183019160010161355e565b505073ffffffffffffffffffffffffffffffffffffffff9690961660408501525050506060015292915050565b6000816135cc576135cc6132bb565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212209b90b8e7d7127cd7d701e30d2d7fbe2af5c088d6e7ceded813c2da79942c505464736f6c63430008130033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.