Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
RewardEthToken
Compiler Version
v0.7.5+commit.eb77ed08
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.7.5; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol"; import "../presets/OwnablePausableUpgradeable.sol"; import "../interfaces/IStakedEthToken.sol"; import "../interfaces/IRewardEthToken.sol"; import "../interfaces/IMerkleDistributor.sol"; import "../interfaces/IOracles.sol"; import "./ERC20PermitUpgradeable.sol"; /** * @title RewardEthToken * * @dev RewardEthToken contract stores pool reward tokens. */ contract RewardEthToken is IRewardEthToken, OwnablePausableUpgradeable, ERC20PermitUpgradeable { using SafeMathUpgradeable for uint256; using SafeCastUpgradeable for uint256; // @dev Address of the StakedEthToken contract. IStakedEthToken private stakedEthToken; // @dev Address of the Oracles contract. address private oracles; // @dev Maps account address to its reward checkpoint. mapping(address => Checkpoint) public override checkpoints; // @dev Address of the maintainer, where the fee will be paid. address public override maintainer; // @dev Maintainer percentage fee. uint256 public override maintainerFee; // @dev Total amount of rewards. uint128 public override totalRewards; // @dev Reward per token for user reward calculation. uint128 public override rewardPerToken; // @dev Last rewards update block number by oracles. uint256 public override lastUpdateBlockNumber; // @dev Address of the MerkleDistributor contract. address public override merkleDistributor; // @dev Maps account address to whether rewards are distributed through the merkle distributor. mapping(address => bool) public override rewardsDisabled; /** * @dev See {IRewardEthToken-upgrade}. */ function upgrade(address _merkleDistributor, uint256 _lastUpdateBlockNumber) external override onlyAdmin whenPaused { require(merkleDistributor == address(0), "RewardEthToken: already upgraded"); merkleDistributor = _merkleDistributor; lastUpdateBlockNumber = _lastUpdateBlockNumber; updateRewardCheckpoint(address(0)); } /** * @dev See {IRewardEthToken-setRewardsDisabled}. */ function setRewardsDisabled(address account, bool isDisabled) external override { require(msg.sender == address(stakedEthToken), "RewardEthToken: access denied"); require(rewardsDisabled[account] != isDisabled, "RewardEthToken: value did not change"); require(block.number > lastUpdateBlockNumber, "RewardEthToken: cannot disable during rewards update"); uint128 _rewardPerToken = rewardPerToken; checkpoints[account] = Checkpoint({ reward: _balanceOf(account, _rewardPerToken).toUint128(), rewardPerToken: _rewardPerToken }); rewardsDisabled[account] = isDisabled; emit RewardsToggled(account, isDisabled); } /** * @dev See {IRewardEthToken-setMaintainer}. */ function setMaintainer(address _newMaintainer) external override onlyAdmin { require(_newMaintainer != address(0), "RewardEthToken: invalid address"); maintainer = _newMaintainer; emit MaintainerUpdated(_newMaintainer); } /** * @dev See {IRewardEthToken-setMaintainerFee}. */ function setMaintainerFee(uint256 _newMaintainerFee) external override onlyAdmin { require(_newMaintainerFee < 10000, "RewardEthToken: invalid fee"); maintainerFee = _newMaintainerFee; emit MaintainerFeeUpdated(_newMaintainerFee); } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() external view override returns (uint256) { return totalRewards; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) external view override returns (uint256) { return _balanceOf(account, rewardPerToken); } function _balanceOf(address account, uint256 _rewardPerToken) internal view returns (uint256) { Checkpoint memory cp = checkpoints[account]; // skip calculating period reward when it has not changed or when the rewards are disabled if (_rewardPerToken == cp.rewardPerToken || rewardsDisabled[account]) return cp.reward; uint256 stakedEthAmount; if (account == address(0)) { // fetch merkle distributor current principal stakedEthAmount = stakedEthToken.distributorPrincipal(); } else { stakedEthAmount = stakedEthToken.balanceOf(account); } if (stakedEthAmount == 0) return cp.reward; // return checkpoint reward + current reward return _calculateNewReward(cp.reward, stakedEthAmount, _rewardPerToken.sub(cp.rewardPerToken)); } /** * @dev See {ERC20-_transfer}. */ function _transfer(address sender, address recipient, uint256 amount) internal override whenNotPaused { require(sender != address(0), "RewardEthToken: invalid sender"); require(recipient != address(0), "RewardEthToken: invalid receiver"); require(block.number > lastUpdateBlockNumber, "RewardEthToken: cannot transfer during rewards update"); uint128 _rewardPerToken = rewardPerToken; // gas savings checkpoints[sender] = Checkpoint({ reward: _balanceOf(sender, _rewardPerToken).sub(amount).toUint128(), rewardPerToken: _rewardPerToken }); checkpoints[recipient] = Checkpoint({ reward: _balanceOf(recipient, _rewardPerToken).add(amount).toUint128(), rewardPerToken: _rewardPerToken }); emit Transfer(sender, recipient, amount); } /** * @dev See {IRewardEthToken-updateRewardCheckpoint}. */ function updateRewardCheckpoint(address account) public override returns (bool accRewardsDisabled) { accRewardsDisabled = rewardsDisabled[account]; if (!accRewardsDisabled) _updateRewardCheckpoint(account, rewardPerToken); } function _updateRewardCheckpoint(address account, uint128 newRewardPerToken) internal { Checkpoint memory cp = checkpoints[account]; if (newRewardPerToken == cp.rewardPerToken) return; uint256 stakedEthAmount; if (account == address(0)) { // fetch merkle distributor current principal stakedEthAmount = stakedEthToken.distributorPrincipal(); } else { stakedEthAmount = stakedEthToken.balanceOf(account); } if (stakedEthAmount == 0) { checkpoints[account] = Checkpoint({ reward: cp.reward, rewardPerToken: newRewardPerToken }); } else { uint256 periodRewardPerToken = uint256(newRewardPerToken).sub(cp.rewardPerToken); checkpoints[account] = Checkpoint({ reward: _calculateNewReward(cp.reward, stakedEthAmount, periodRewardPerToken).toUint128(), rewardPerToken: newRewardPerToken }); } } function _calculateNewReward( uint256 currentReward, uint256 stakedEthAmount, uint256 periodRewardPerToken ) internal pure returns (uint256) { return currentReward.add(stakedEthAmount.mul(periodRewardPerToken).div(1e18)); } /** * @dev See {IRewardEthToken-updateRewardCheckpoints}. */ function updateRewardCheckpoints(address account1, address account2) public override returns (bool rewardsDisabled1, bool rewardsDisabled2) { rewardsDisabled1 = rewardsDisabled[account1]; rewardsDisabled2 = rewardsDisabled[account2]; if (!rewardsDisabled1 || !rewardsDisabled2) { uint128 newRewardPerToken = rewardPerToken; if (!rewardsDisabled1) _updateRewardCheckpoint(account1, newRewardPerToken); if (!rewardsDisabled2) _updateRewardCheckpoint(account2, newRewardPerToken); } } /** * @dev See {IRewardEthToken-updateTotalRewards}. */ function updateTotalRewards(uint256 newTotalRewards) external override { require(msg.sender == oracles, "RewardEthToken: access denied"); uint256 periodRewards = newTotalRewards.sub(totalRewards); if (periodRewards == 0) return; // calculate reward per token used for account reward calculation uint256 maintainerReward = periodRewards.mul(maintainerFee).div(10000); uint256 prevRewardPerToken = rewardPerToken; uint256 newRewardPerToken = prevRewardPerToken.add(periodRewards.sub(maintainerReward).mul(1e18).div(stakedEthToken.totalDeposits())); uint128 newRewardPerToken128 = newRewardPerToken.toUint128(); // update total rewards and new reward per token (totalRewards, rewardPerToken) = (newTotalRewards.toUint128(), newRewardPerToken128); // update distributor's checkpoint checkpoints[address(0)] = Checkpoint({ reward: _balanceOf(address(0), newRewardPerToken).toUint128(), rewardPerToken: newRewardPerToken128 }); // update maintainer's checkpoint and add its period reward checkpoints[maintainer] = Checkpoint({ reward: _balanceOf(maintainer, newRewardPerToken).add(maintainerReward).toUint128(), rewardPerToken: newRewardPerToken128 }); lastUpdateBlockNumber = block.number; emit RewardsUpdated(periodRewards, newTotalRewards, newRewardPerToken); } /** * @dev See {IRewardEthToken-claim}. */ function claim(address account, uint256 amount) external override { require(msg.sender == merkleDistributor, "RewardEthToken: access denied"); // update checkpoints, transfer amount from distributor to account uint128 _rewardPerToken = rewardPerToken; checkpoints[address(0)] = Checkpoint({ reward: _balanceOf(address(0), _rewardPerToken).sub(amount).toUint128(), rewardPerToken: _rewardPerToken }); checkpoints[account] = Checkpoint({ reward: _balanceOf(account, _rewardPerToken).add(amount).toUint128(), rewardPerToken: _rewardPerToken }); emit Transfer(address(0), account, amount); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when 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. */ library SafeMathUpgradeable { /** * @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) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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) { // 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) { 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) { 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) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); 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) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @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. 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) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); 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) { require(b > 0, "SafeMath: modulo by zero"); 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) { 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. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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) { 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) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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 SafeCastUpgradeable { /** * @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 */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); return uint128(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 */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); return uint64(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 */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); return uint32(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 */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "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. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "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. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @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) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); } /** * @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) { require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits"); return int64(value); } /** * @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) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); } /** * @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) { require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits"); return int16(value); } /** * @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) { require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.7.5; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "../interfaces/IOwnablePausable.sol"; /** * @title OwnablePausableUpgradeable * * @dev Bundles Access Control, Pausable and Upgradeable contracts in one. * */ abstract contract OwnablePausableUpgradeable is IOwnablePausable, PausableUpgradeable, AccessControlUpgradeable { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Modifier for checking whether the caller is an admin. */ modifier onlyAdmin() { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "OwnablePausable: access denied"); _; } /** * @dev Modifier for checking whether the caller is a pauser. */ modifier onlyPauser() { require(hasRole(PAUSER_ROLE, msg.sender), "OwnablePausable: access denied"); _; } // solhint-disable-next-line func-name-mixedcase function __OwnablePausableUpgradeable_init(address _admin) internal initializer { __Context_init_unchained(); __AccessControl_init_unchained(); __Pausable_init_unchained(); __OwnablePausableUpgradeable_init_unchained(_admin); } /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `PAUSER_ROLE` to the admin account. */ // solhint-disable-next-line func-name-mixedcase function __OwnablePausableUpgradeable_init_unchained(address _admin) internal initializer { _setupRole(DEFAULT_ADMIN_ROLE, _admin); _setupRole(PAUSER_ROLE, _admin); } /** * @dev See {IOwnablePausable-isAdmin}. */ function isAdmin(address _account) external override view returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _account); } /** * @dev See {IOwnablePausable-addAdmin}. */ function addAdmin(address _account) external override { grantRole(DEFAULT_ADMIN_ROLE, _account); } /** * @dev See {IOwnablePausable-removeAdmin}. */ function removeAdmin(address _account) external override { revokeRole(DEFAULT_ADMIN_ROLE, _account); } /** * @dev See {IOwnablePausable-isPauser}. */ function isPauser(address _account) external override view returns (bool) { return hasRole(PAUSER_ROLE, _account); } /** * @dev See {IOwnablePausable-addPauser}. */ function addPauser(address _account) external override { grantRole(PAUSER_ROLE, _account); } /** * @dev See {IOwnablePausable-removePauser}. */ function removePauser(address _account) external override { revokeRole(PAUSER_ROLE, _account); } /** * @dev See {IOwnablePausable-pause}. */ function pause() external override onlyPauser { _pause(); } /** * @dev See {IOwnablePausable-unpause}. */ function unpause() external override onlyPauser { _unpause(); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.7.5; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; /** * @dev Interface of the StakedEthToken contract. */ interface IStakedEthToken is IERC20Upgradeable { /** * @dev Function for retrieving the total deposits amount. */ function totalDeposits() external view returns (uint256); /** * @dev Function for retrieving the principal amount of the distributor. */ function distributorPrincipal() external view returns (uint256); /** * @dev Function for toggling rewards for the account. * @param account - address of the account. * @param isDisabled - whether to disable account's rewards distribution. */ function toggleRewards(address account, bool isDisabled) external; /** * @dev Function for creating `amount` tokens and assigning them to `account`. * Can only be called by Pool contract. * @param account - address of the account to assign tokens to. * @param amount - amount of tokens to assign. */ function mint(address account, uint256 amount) external; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.7.5; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; /** * @dev Interface of the RewardEthToken contract. */ interface IRewardEthToken is IERC20Upgradeable { /** * @dev Event for tracking updated maintainer. * @param maintainer - address of the new maintainer, where the fee will be paid. */ event MaintainerUpdated(address maintainer); /** * @dev Event for tracking updated maintainer fee. * @param maintainerFee - new maintainer fee. */ event MaintainerFeeUpdated(uint256 maintainerFee); /** * @dev Event for tracking whether rewards distribution through merkle distributor is enabled/disabled. * @param account - address of the account. * @param isDisabled - whether rewards distribution is disabled. */ event RewardsToggled(address indexed account, bool isDisabled); /** * @dev Structure for storing information about user reward checkpoint. * @param rewardPerToken - user reward per token. * @param reward - user reward checkpoint. */ struct Checkpoint { uint128 reward; uint128 rewardPerToken; } /** * @dev Event for tracking rewards update by oracles. * @param periodRewards - rewards since the last update. * @param totalRewards - total amount of rewards. * @param rewardPerToken - calculated reward per token for account reward calculation. */ event RewardsUpdated( uint256 periodRewards, uint256 totalRewards, uint256 rewardPerToken ); /** * @dev Function for upgrading the RewardEthToken contract. * If deploying contract for the first time, the upgrade function should be replaced with `initialize` and * contain initializations from the previous versions. * @param _merkleDistributor - address of the MerkleDistributor contract. * @param _lastUpdateBlockNumber - block number of the last rewards update. */ function upgrade(address _merkleDistributor, uint256 _lastUpdateBlockNumber) external; /** * @dev Function for getting the address of the merkle distributor. */ function merkleDistributor() external view returns (address); /** * @dev Function for getting the address of the maintainer, where the fee will be paid. */ function maintainer() external view returns (address); /** * @dev Function for changing the maintainer's address. * @param _newMaintainer - new maintainer's address. */ function setMaintainer(address _newMaintainer) external; /** * @dev Function for getting maintainer fee. The percentage fee users pay from their reward for using the pool service. */ function maintainerFee() external view returns (uint256); /** * @dev Function for changing the maintainer's fee. * @param _newMaintainerFee - new maintainer's fee. Must be less than 10000 (100.00%). */ function setMaintainerFee(uint256 _newMaintainerFee) external; /** * @dev Function for retrieving the total rewards amount. */ function totalRewards() external view returns (uint128); /** * @dev Function for retrieving the last total rewards update block number. */ function lastUpdateBlockNumber() external view returns (uint256); /** * @dev Function for retrieving current reward per token used for account reward calculation. */ function rewardPerToken() external view returns (uint128); /** * @dev Function for setting whether rewards are disabled for the account. * Can only be called by the `StakedEthToken` contract. * @param account - address of the account to disable rewards for. * @param isDisabled - whether the rewards will be disabled. */ function setRewardsDisabled(address account, bool isDisabled) external; /** * @dev Function for retrieving account's current checkpoint. * @param account - address of the account to retrieve the checkpoint for. */ function checkpoints(address account) external view returns (uint128, uint128); /** * @dev Function for checking whether account's reward will be distributed through the merkle distributor. * @param account - address of the account. */ function rewardsDisabled(address account) external view returns (bool); /** * @dev Function for updating account's reward checkpoint. * @param account - address of the account to update the reward checkpoint for. */ function updateRewardCheckpoint(address account) external returns (bool); /** * @dev Function for updating reward checkpoints for two accounts simultaneously (for gas savings). * @param account1 - address of the first account to update the reward checkpoint for. * @param account2 - address of the second account to update the reward checkpoint for. */ function updateRewardCheckpoints(address account1, address account2) external returns (bool, bool); /** * @dev Function for updating validators total rewards. * Can only be called by Oracles contract. * @param newTotalRewards - new total rewards. */ function updateTotalRewards(uint256 newTotalRewards) external; /** * @dev Function for claiming rETH2 from the merkle distribution. * Can only be called by MerkleDistributor contract. * @param account - address of the account the tokens will be assigned to. * @param amount - amount of tokens to assign to the account. */ function claim(address account, uint256 amount) external; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.7.5; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "./IOracles.sol"; /** * @dev Interface of the MerkleDistributor contract. * Allows anyone to claim a token if they exist in a merkle root. */ interface IMerkleDistributor { /** * @dev Event for tracking merkle root updates. * @param sender - address of the new transaction sender. * @param merkleRoot - new merkle root hash. * @param merkleProofs - link to the merkle proofs. */ event MerkleRootUpdated( address indexed sender, bytes32 indexed merkleRoot, string merkleProofs ); /** * @dev Event for tracking SWISE token distributions. * @param sender - address of the new transaction sender. * @param token - address of the token. * @param beneficiary - address of the beneficiary, the SWISE allocation is added to. * @param amount - amount of tokens distributed. * @param startBlock - start block of the tokens distribution. * @param endBlock - end block of the tokens distribution. */ event DistributionAdded( address indexed sender, address indexed token, address indexed beneficiary, uint256 amount, uint256 startBlock, uint256 endBlock ); /** * @dev Event for tracking tokens' claims. * @param account - the address of the user that has claimed the tokens. * @param index - the index of the user that has claimed the tokens. * @param tokens - list of token addresses the user got amounts in. * @param amounts - list of user token amounts. */ event Claimed(address indexed account, uint256 index, address[] tokens, uint256[] amounts); /** * @dev Function for getting the current merkle root. */ function merkleRoot() external view returns (bytes32); /** * @dev Function for getting the RewardEthToken contract address. */ function rewardEthToken() external view returns (address); /** * @dev Function for getting the Oracles contract address. */ function oracles() external view returns (IOracles); /** * @dev Function for retrieving the last total merkle root update block number. */ function lastUpdateBlockNumber() external view returns (uint256); /** * @dev Constructor for initializing the MerkleDistributor contract. * @param _admin - address of the contract admin. * @param _rewardEthToken - address of the RewardEthToken contract. * @param _oracles - address of the Oracles contract. */ function initialize(address _admin, address _rewardEthToken, address _oracles) external; /** * @dev Function for checking the claimed bit map. * @param _merkleRoot - the merkle root hash. * @param _wordIndex - the word index of te bit map. */ function claimedBitMap(bytes32 _merkleRoot, uint256 _wordIndex) external view returns (uint256); /** * @dev Function for changing the merkle root. Can only be called by `Oracles` contract. * @param newMerkleRoot - new merkle root hash. * @param merkleProofs - URL to the merkle proofs. */ function setMerkleRoot(bytes32 newMerkleRoot, string calldata merkleProofs) external; /** * @dev Function for adding tokens distribution. * @param token - address of the token. * @param beneficiary - address of the beneficiary. * @param amount - amount of tokens to distribute. * @param durationInBlocks - duration in blocks when the token distribution should be stopped. */ function distribute( address token, address beneficiary, uint256 amount, uint256 durationInBlocks ) external; /** * @dev Function for checking whether the tokens were already claimed. * @param index - the index of the user that is part of the merkle root. */ function isClaimed(uint256 index) external view returns (bool); /** * @dev Function for claiming the given amount of tokens to the account address. * Reverts if the inputs are invalid or the oracles are currently updating the merkle root. * @param index - the index of the user that is part of the merkle root. * @param account - the address of the user that is part of the merkle root. * @param tokens - list of the token addresses. * @param amounts - list of token amounts. * @param merkleProof - an array of hashes to verify whether the user is part of the merkle root. */ function claim( uint256 index, address account, address[] calldata tokens, uint256[] calldata amounts, bytes32[] calldata merkleProof ) external; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.7.5; /** * @dev Interface of the Oracles contract. */ interface IOracles { /** * @dev Event for tracking oracle rewards votes. * @param oracle - address of the account which submitted vote. * @param nonce - current nonce. * @param totalRewards - submitted value of total rewards. * @param activatedValidators - submitted amount of activated validators. */ event RewardsVoteSubmitted( address indexed oracle, uint256 nonce, uint256 totalRewards, uint256 activatedValidators ); /** * @dev Event for tracking oracle merkle root votes. * @param oracle - address of the account which submitted vote. * @param nonce - current nonce. * @param merkleRoot - new merkle root. * @param merkleProofs - link to the merkle proofs. */ event MerkleRootVoteSubmitted( address indexed oracle, uint256 nonce, bytes32 indexed merkleRoot, string merkleProofs ); /** * @dev Event for tracking changes of oracles' sync periods. * @param syncPeriod - new sync period in blocks. * @param sender - address of the transaction sender. */ event SyncPeriodUpdated(uint256 syncPeriod, address indexed sender); /** * @dev Function for retrieving number of votes of the submission candidate. * @param _candidateId - ID of the candidate to retrieve number of votes for. */ function candidates(bytes32 _candidateId) external view returns (uint256); /** * @dev Function for retrieving oracles sync period (in blocks). */ function syncPeriod() external view returns (uint256); /** * @dev Function for upgrading the Oracles contract. * If deploying contract for the first time, the upgrade function should be replaced with `initialize` * and contain initializations from all the previous versions. * @param _merkleDistributor - address of the MerkleDistributor contract. * @param _syncPeriod - number of blocks to wait before the next sync. */ function upgrade(address _merkleDistributor, uint256 _syncPeriod) external; /** * @dev Function for checking whether an account has an oracle role. * @param _account - account to check. */ function isOracle(address _account) external view returns (bool); /** * @dev Function for checking whether an oracle has voted. * @param oracle - oracle address to check. * @param candidateId - hash of nonce and vote parameters. */ function hasVote(address oracle, bytes32 candidateId) external view returns (bool); /** * @dev Function for checking whether the oracles are currently voting for new total rewards. */ function isRewardsVoting() external view returns (bool); /** * @dev Function for checking whether the oracles are currently voting for new merkle root. */ function isMerkleRootVoting() external view returns (bool); /** * @dev Function for retrieving current nonce. */ function currentNonce() external view returns (uint256); /** * @dev Function for adding an oracle role to the account. * Can only be called by an account with an admin role. * @param _account - account to assign an oracle role to. */ function addOracle(address _account) external; /** * @dev Function for removing an oracle role from the account. * Can only be called by an account with an admin role. * @param _account - account to remove an oracle role from. */ function removeOracle(address _account) external; /** * @dev Function for updating oracles sync period. The number of blocks after they will submit the off-chain data. * Can only be called by an account with an admin role. * @param _syncPeriod - new sync period. */ function setSyncPeriod(uint256 _syncPeriod) external; /** * @dev Function for submitting oracle vote for total rewards. The last vote required for quorum will update the values. * Can only be called by an account with an oracle role. * @param _nonce - current nonce. * @param _totalRewards - voted total rewards. * @param _activatedValidators - voted amount of activated validators. */ function voteForRewards(uint256 _nonce, uint256 _totalRewards, uint256 _activatedValidators) external; /** * @dev Function for submitting oracle vote for merkle root. The last vote required for quorum will update the values. * Can only be called by an account with an oracle role. * @param _nonce - current nonce. * @param _merkleRoot - hash of the new merkle root. * @param _merkleProofs - link to the merkle proofs. */ function voteForMerkleRoot(uint256 _nonce, bytes32 _merkleRoot, string calldata _merkleProofs) external; }
// SPDX-License-Identifier: MIT // Adopted from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v3.4.0/contracts/drafts/ERC20PermitUpgradeable.sol pragma solidity 0.7.5; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/drafts/IERC20PermitUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/drafts/EIP712Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/cryptography/ECDSAUpgradeable.sol"; import "./ERC20Upgradeable.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable { using CountersUpgradeable for CountersUpgradeable.Counter; mapping (address => CountersUpgradeable.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ // solhint-disable-next-line func-name-mixedcase function __ERC20Permit_init(string memory name) internal initializer { __EIP712_init_unchained(name, "1"); __ERC20Permit_init_unchained(); } // solhint-disable-next-line func-name-mixedcase function __ERC20Permit_init_unchained() internal initializer { _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); } /** * @dev See {IERC20Permit-permit}. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override { // solhint-disable-next-line not-rely-on-time require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, value, _nonces[owner].current(), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSAUpgradeable.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _nonces[owner].increment(); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/EnumerableSetUpgradeable.sol"; import "../utils/AddressUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * 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 AccessControlUpgradeable is Initializable, ContextUpgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using AddressUpgradeable for address; struct RoleData { EnumerableSetUpgradeable.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @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 {_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) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @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 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. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _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. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _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 granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { 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. * * [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}. * ==== */ 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 { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal initializer { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal initializer { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.7.5; /** * @dev Interface of the OwnablePausableUpgradeable and OwnablePausable contracts. */ interface IOwnablePausable { /** * @dev Function for checking whether an account has an admin role. * @param _account - account to check. */ function isAdmin(address _account) external view returns (bool); /** * @dev Function for assigning an admin role to the account. * Can only be called by an account with an admin role. * @param _account - account to assign an admin role to. */ function addAdmin(address _account) external; /** * @dev Function for removing an admin role from the account. * Can only be called by an account with an admin role. * @param _account - account to remove an admin role from. */ function removeAdmin(address _account) external; /** * @dev Function for checking whether an account has a pauser role. * @param _account - account to check. */ function isPauser(address _account) external view returns (bool); /** * @dev Function for adding a pauser role to the account. * Can only be called by an account with an admin role. * @param _account - account to assign a pauser role to. */ function addPauser(address _account) external; /** * @dev Function for removing a pauser role from the account. * Can only be called by an account with an admin role. * @param _account - account to remove a pauser role from. */ function removePauser(address _account) external; /** * @dev Function for pausing the contract. */ function pause() external; /** * @dev Function for unpausing the contract. */ function unpause() external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /* * @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 GSN 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 ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../math/SafeMathUpgradeable.sol"; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library CountersUpgradeable { using SafeMathUpgradeable for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens, * given `owner`'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712Upgradeable is Initializable { /* solhint-disable var-name-mixedcase */ bytes32 private _HASHED_NAME; bytes32 private _HASHED_VERSION; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal initializer { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal initializer { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash()); } function _buildDomainSeparator(bytes32 typeHash, bytes32 name, bytes32 version) private view returns (bytes32) { return keccak256( abi.encode( typeHash, name, version, _getChainId(), address(this) ) ); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", _domainSeparatorV4(), structHash)); } function _getChainId() private view returns (uint256 chainId) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 // solhint-disable-next-line no-inline-assembly assembly { chainId := chainid() } } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712NameHash() internal virtual view returns (bytes32) { return _HASHED_NAME; } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712VersionHash() internal virtual view returns (bytes32) { return _HASHED_VERSION; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { revert("ECDSA: invalid signature length"); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return recover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } }
// SPDX-License-Identifier: MIT // Adopted from https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v3.4.0/contracts/token/ERC20/ERC20Upgradeable.sol pragma solidity 0.7.5; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of 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}. */ abstract contract ERC20Upgradeable is Initializable, IERC20Upgradeable { using SafeMathUpgradeable for uint256; mapping (address => mapping (address => uint256)) private _allowances; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ // solhint-disable-next-line func-name-mixedcase function __ERC20_init(string memory name_, string memory symbol_) internal initializer { __ERC20_init_unchained(name_, symbol_); } // solhint-disable-next-line func-name-mixedcase function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual 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 {_setupDecimals} is * called. * * 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 returns (uint8) { return _decimals; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(msg.sender, recipient, 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}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(msg.sender, 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}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][msg.sender]; if (sender != msg.sender && currentAllowance != uint256(-1)) { _approve(sender, msg.sender, currentAllowance.sub(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) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(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) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is 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: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { } /** * @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); } uint256[44] private __gap; }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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":false,"internalType":"uint256","name":"maintainerFee","type":"uint256"}],"name":"MaintainerFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"maintainer","type":"address"}],"name":"MaintainerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"isDisabled","type":"bool"}],"name":"RewardsToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"periodRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPerToken","type":"uint256"}],"name":"RewardsUpdated","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"addPauser","outputs":[],"stateMutability":"nonpayable","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":"address","name":"","type":"address"}],"name":"checkpoints","outputs":[{"internalType":"uint128","name":"reward","type":"uint128"},{"internalType":"uint128","name":"rewardPerToken","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"claim","outputs":[],"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":[{"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":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"address","name":"_account","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isPauser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maintainer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maintainerFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleDistributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"removePauser","outputs":[],"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":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardsDisabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newMaintainer","type":"address"}],"name":"setMaintainer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newMaintainerFee","type":"uint256"}],"name":"setMaintainerFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"isDisabled","type":"bool"}],"name":"setRewardsDisabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewards","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"updateRewardCheckpoint","outputs":[{"internalType":"bool","name":"accRewardsDisabled","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account1","type":"address"},{"internalType":"address","name":"account2","type":"address"}],"name":"updateRewardCheckpoints","outputs":[{"internalType":"bool","name":"rewardsDisabled1","type":"bool"},{"internalType":"bool","name":"rewardsDisabled2","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newTotalRewards","type":"uint256"}],"name":"updateTotalRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_merkleDistributor","type":"address"},{"internalType":"uint256","name":"_lastUpdateBlockNumber","type":"uint256"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50613c62806100206000396000f3fe608060405234801561001057600080fd5b50600436106103205760003560e01c80636b2c0f55116101a7578063a9059cbb116100ee578063d547741f11610097578063e0622b2711610071578063e0622b2714610b40578063e63ab1e914610b79578063f4537f7814610b8157610320565b8063d547741f14610a58578063dbb51d6e14610a91578063dd62ed3e14610b0557610320565b8063ca15c873116100c8578063ca15c873146109d5578063cd3daf9d146109f2578063d505accf146109fa57610320565b8063a9059cbb1461095b578063aad3ec9614610994578063b4c6e416146109cd57610320565b80639010d07c116101505780639850d32b1161012a5780639850d32b14610912578063a217fddf1461091a578063a457c2d71461092257610320565b80639010d07c1461088557806391d14854146108d157806395d89b411461090a57610320565b80637ecebe00116101815780637ecebe001461081757806382dc1ec41461084a5780638456cb591461087d57610320565b80636b2c0f551461077e57806370480275146107b157806370a08231146107e457610320565b80633644e5151161026b57806354ea5a56116102145780635c975abb116101ee5780635c975abb146107335780636123b7211461073b5780636a9ecedb1461074357610320565b806354ea5a56146106c65780635bbb860d146106e35780635bdc6d7e1461070057610320565b80633b0c9d90116102455780633b0c9d90146106355780633f4ba83a1461068b57806346fbf68e1461069357610320565b80633644e515146105bb57806336568abe146105c357806339509351146105fc57610320565b806318160ddd116102cd57806324d7806c116102a757806324d7806c146105315780632f2ff15d14610564578063313ce5671461059d57610320565b806318160ddd146104b757806323b872dd146104d1578063248a9ca31461051457610320565b80630e15561a116102fe5780630e15561a1461042257806313ea5d291461044f5780631785f53c1461048457610320565b806301ba793b1461032557806306fdde031461036c578063095ea7b3146103e9575b600080fd5b6103586004803603602081101561033b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b89565b604080519115158252519081900360200190f35b610374610bf2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103ae578181015183820152602001610396565b50505050905090810190601f1680156103db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610358600480360360408110156103ff57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610ca6565b61042a610cbd565b604080516fffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6104826004803603602081101561046557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cd6565b005b6104826004803603602081101561049a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610e48565b6104bf610e56565b60408051918252519081900360200190f35b610358600480360360608110156104e757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e6f565b6104bf6004803603602081101561052a57600080fd5b5035610f01565b6103586004803603602081101561054757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f16565b6104826004803603604081101561057a57600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610f22565b6105a5610fa8565b6040805160ff9092168252519081900360200190f35b6104bf610fb1565b610482600480360360408110156105d957600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610fc0565b6103586004803603604081101561061257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611055565b6106706004803603604081101561064b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611098565b60408051921515835290151560208301528051918290030190f35b610482611131565b610358600480360360208110156106a957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111d0565b610482600480360360208110156106dc57600080fd5b50356111fc565b610482600480360360208110156106f957600080fd5b503561131e565b6103586004803603602081101561071657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661173b565b610358611751565b6104bf61175a565b6104826004803603604081101561075957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001351515611761565b6104826004803603602081101561079457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a12565b610482600480360360208110156107c757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a3c565b6104bf600480360360208110156107fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a47565b6104bf6004803603602081101561082d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a7f565b6104826004803603602081101561086057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611aad565b610482611ad7565b6108a86004803603604081101561089b57600080fd5b5080359060200135611b74565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610358600480360360408110156108e757600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16611b93565b610374611bab565b6108a8611c2a565b6104bf611c47565b6103586004803603604081101561093857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611c4c565b6103586004803603604081101561097157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611c8f565b610482600480360360408110156109aa57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611c9c565b6104bf611efe565b6104bf600480360360208110156109eb57600080fd5b5035611f05565b61042a611f1c565b610482600480360360e0811015610a1057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611f49565b61048260048036036040811015610a6e57600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff1661217b565b610ac460048036036020811015610aa757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166121ee565b60405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6104bf60048036036040811015610b1b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661222b565b61048260048036036040811015610b5657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135612263565b6104bf612428565b6108a861244c565b73ffffffffffffffffffffffffffffffffffffffff81166000908152610136602052604090205460ff1680610bed5761013354610bed90839070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16612469565b919050565b60988054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c9c5780601f10610c7157610100808354040283529160200191610c9c565b820191906000526020600020905b815481529060010190602001808311610c7f57829003601f168201915b5050505050905090565b6000610cb33384846127f2565b5060015b92915050565b610133546fffffffffffffffffffffffffffffffff1681565b610ce1600033611b93565b610d4c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610dce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f526577617264457468546f6b656e3a20696e76616c6964206164647265737300604482015290519081900360640190fd5b610131805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f3d412b7c69615303b057374f7db7e22f80cc367b8a2ccafe84357e2b26584ef29181900360200190a150565b610e5360008261217b565b50565b610133546fffffffffffffffffffffffffffffffff1690565b6000610e7c848484612939565b73ffffffffffffffffffffffffffffffffffffffff84166000818152609760209081526040808320338085529252909120549114801590610edd57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114155b15610ef657610ef68533610ef18487612ce1565b6127f2565b506001949350505050565b60009081526065602052604090206002015490565b6000610cb78183611b93565b600082815260656020526040902060020154610f4590610f40612d58565b611b93565b610f9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613a40602f913960400191505060405180910390fd5b610fa48282612d5c565b5050565b609a5460ff1690565b6000610fbb612ddf565b905090565b610fc8612d58565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461104b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613bfe602f913960400191505060405180910390fd5b610fa48282612e1a565b33600081815260976020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610cb3918590610ef19086612e9d565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152610136602052604080822054928416825290205460ff91821691168115806110db575080155b1561112a576101335470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1682611119576111198582612469565b81611128576111288482612469565b505b9250929050565b61115b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33611b93565b6111c657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b6111ce612f11565b565b6000610cb77f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a83611b93565b611207600033611b93565b61127257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b61271081106112e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f526577617264457468546f6b656e3a20696e76616c6964206665650000000000604482015290519081900360640190fd5b6101328190556040805182815290517f5a128e437f171b9c8e717f61664c1b0a637aa2396d64713e3bca904028c07f2c9181900360200190a150565b61012f5473ffffffffffffffffffffffffffffffffffffffff1633146113a557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f526577617264457468546f6b656e3a206163636573732064656e696564000000604482015290519081900360640190fd5b610133546000906113c99083906fffffffffffffffffffffffffffffffff16612ce1565b9050806113d65750610e53565b60006113fa6127106113f46101325485612fff90919063ffffffff16565b90613072565b6101335461012e54604080517f7d88209700000000000000000000000000000000000000000000000000000000815290519394507001000000000000000000000000000000009092046fffffffffffffffffffffffffffffffff16926000926114ee926114e79273ffffffffffffffffffffffffffffffffffffffff90911691637d882097916004808301926020929190829003018186803b15801561149f57600080fd5b505afa1580156114b3573d6000803e3d6000fd5b505050506040513d60208110156114c957600080fd5b50516113f4670de0b6b3a76400006114e18989612ce1565b90612fff565b8390612e9d565b905060006114fb826130f3565b9050611506866130f3565b61013380547fffffffffffffffffffffffffffffffff000000000000000000000000000000006fffffffffffffffffffffffffffffffff9182167001000000000000000000000000000000008684160217169216919091179055604080518082019091528061157e611579600086613162565b6130f3565b6fffffffffffffffffffffffffffffffff908116825283811660209283015260008052610130825282517f363eca0a79dc8ec297995f86b12cc61391ff0de52f1ba01ca23e9716f742e413805494909301518216700100000000000000000000000000000000029082167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909416939093171691909117905560408051808201909152610131548190611657906115799088906116519073ffffffffffffffffffffffffffffffffffffffff1688613162565b90612e9d565b6fffffffffffffffffffffffffffffffff90811682528381166020928301526101315473ffffffffffffffffffffffffffffffffffffffff166000908152610130835260409081902084518154958501518416700100000000000000000000000000000000029084167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909616959095179092169390931790554361013455815187815290810188905280820184905290517f4b4e9b2b02700f36dc5c043149dbb42bc2bf2211b35cd776181b8a9880891be29181900360600190a1505050505050565b6101366020526000908152604090205460ff1681565b60335460ff1690565b6101325481565b61012e5473ffffffffffffffffffffffffffffffffffffffff1633146117e857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f526577617264457468546f6b656e3a206163636573732064656e696564000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152610136602052604090205460ff161515811515141561186e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613bda6024913960400191505060405180910390fd5b6101345443116118c9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180613b826034913960400191505060405180910390fd5b61013354604080518082019091527001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff16908061190d6115798685613162565b6fffffffffffffffffffffffffffffffff908116825283811660209283015273ffffffffffffffffffffffffffffffffffffffff861660008181526101308452604080822086518154978701518616700100000000000000000000000000000000029086167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909816979097179094169590951790925561013683529083902080548615157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090911681179091558351908152925190927fef7566603852520a8be81b2924311bce365c73c01809a279f86ed6c6f69f824992908290030190a2505050565b610e537f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a8261217b565b610e53600082610f22565b61013354600090610cb790839070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16613162565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260fb60205260408120610cb7906133f2565b610e537f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a82610f22565b611b017f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33611b93565b611b6c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b6111ce6133f6565b6000828152606560205260408120611b8c90836134be565b9392505050565b6000828152606560205260408120611b8c90836134ca565b60998054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c9c5780601f10610c7157610100808354040283529160200191610c9c565b6101315473ffffffffffffffffffffffffffffffffffffffff1681565b600081565b33600081815260976020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610cb3918590610ef19086612ce1565b6000610cb3338484612939565b6101355473ffffffffffffffffffffffffffffffffffffffff163314611d2357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f526577617264457468546f6b656e3a206163636573732064656e696564000000604482015290519081900360640190fd5b61013354604080518082019091527001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff169080611d7261157985611d6c600087613162565b90612ce1565b6fffffffffffffffffffffffffffffffff9081168252838116602092830181905260008052610130835283517f363eca0a79dc8ec297995f86b12cc61391ff0de52f1ba01ca23e9716f742e413805495909401517fffffffffffffffffffffffffffffffff00000000000000000000000000000000909516908316178216700100000000000000000000000000000000949092169390930217905560408051808201909152908190611e2f90611579908690611651908990613162565b6fffffffffffffffffffffffffffffffff908116825283811660209283015273ffffffffffffffffffffffffffffffffffffffff861660008181526101308452604080822086518154978701518616700100000000000000000000000000000000029086167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909816979097179094169590951790925583518681529351909391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a3505050565b6101345481565b6000818152606560205260408120610cb7906134ec565b6101335470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b83421115611fb857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015290519081900360640190fd5b600060fc5488888861200760fb60008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206133f2565b89604051602001808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019650505050505050604051602081830303815290604052805190602001209050600061208a826134f7565b9050600061209a8287878761355e565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461213657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260fb602052604090206121649061374c565b61216f8a8a8a6127f2565b50505050505050505050565b60008281526065602052604090206002015461219990610f40612d58565b61104b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180613b0f6030913960400191505060405180910390fd5b610130602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260976020908152604080832093909416825291909152205490565b61226e600033611b93565b6122d957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b6122e1611751565b61234c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015290519081900360640190fd5b6101355473ffffffffffffffffffffffffffffffffffffffff16156123d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f526577617264457468546f6b656e3a20616c7265616479207570677261646564604482015290519081900360640190fd5b61013580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556101348190556124236000610b89565b505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6101355473ffffffffffffffffffffffffffffffffffffffff1681565b612471613a06565b5073ffffffffffffffffffffffffffffffffffffffff8216600090815261013060209081526040918290208251808401909352546fffffffffffffffffffffffffffffffff80821684527001000000000000000000000000000000009091048116918301829052831614156124e65750610fa4565b600073ffffffffffffffffffffffffffffffffffffffff841661259f5761012e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ae5e0f7a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561256c57600080fd5b505afa158015612580573d6000803e3d6000fd5b505050506040513d602081101561259657600080fd5b50519050612642565b61012e54604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152915191909216916370a08231916024808301926020929190829003018186803b15801561261357600080fd5b505afa158015612627573d6000803e3d6000fd5b505050506040513d602081101561263d57600080fd5b505190505b806126eb5760408051808201825283516fffffffffffffffffffffffffffffffff9081168252858116602080840191825273ffffffffffffffffffffffffffffffffffffffff89166000908152610130909152939093209151825493518216700100000000000000000000000000000000029082167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941693909317169190911790556127ec565b600061272883602001516fffffffffffffffffffffffffffffffff16856fffffffffffffffffffffffffffffffff16612ce190919063ffffffff16565b9050604051806040016040528061275961157986600001516fffffffffffffffffffffffffffffffff168686613755565b6fffffffffffffffffffffffffffffffff908116825286811660209283015273ffffffffffffffffffffffffffffffffffffffff881660009081526101308352604090208351815494909301518216700100000000000000000000000000000000029282167fffffffffffffffffffffffffffffffff000000000000000000000000000000009094169390931716179055505b50505050565b73ffffffffffffffffffffffffffffffffffffffff831661285e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613bb66024913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166128ca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613a6f6022913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260976020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b612941611751565b156129ad57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316612a2f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f526577617264457468546f6b656e3a20696e76616c69642073656e6465720000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216612ab157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f526577617264457468546f6b656e3a20696e76616c6964207265636569766572604482015290519081900360640190fd5b610134544311612b0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180613a916035913960400191505060405180910390fd5b61013354604080518082019091527001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff169080612b5461157985611d6c8987613162565b6fffffffffffffffffffffffffffffffff9081168252838116602092830181905273ffffffffffffffffffffffffffffffffffffffff8816600090815261013084526040908190208551815496909501518416700100000000000000000000000000000000029484167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909616959095179092169290921790925581518083019092528190612c0e90611579908690611651908990613162565b6fffffffffffffffffffffffffffffffff908116825283811660209283015273ffffffffffffffffffffffffffffffffffffffff8681166000818152610130855260409081902086518154978701517fffffffffffffffffffffffffffffffff0000000000000000000000000000000090981690861617851670010000000000000000000000000000000097909516969096029390931790945581518681529151908816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a350505050565b600082821115612d5257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b3390565b6000828152606560205260409020612d74908261377f565b15610fa457612d81612d58565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610fbb7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612e0d6137a1565b612e156137a7565b6137ad565b6000828152606560205260409020612e32908261381c565b15610fa457612e3f612d58565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600082820183811015611b8c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b612f19611751565b612f8457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015290519081900360640190fd5b603380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612fd5612d58565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190a1565b60008261300e57506000610cb7565b8282028284828161301b57fe5b0414611b8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613b616021913960400191505060405180910390fd5b60008082116130e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816130eb57fe5b049392505050565b6000700100000000000000000000000000000000821061315e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180613ac66027913960400191505060405180910390fd5b5090565b600061316c613a06565b5073ffffffffffffffffffffffffffffffffffffffff8316600090815261013060209081526040918290208251808401909352546fffffffffffffffffffffffffffffffff808216845270010000000000000000000000000000000090910416908201819052831480613205575073ffffffffffffffffffffffffffffffffffffffff84166000908152610136602052604090205460ff165b1561322457516fffffffffffffffffffffffffffffffff169050610cb7565b600073ffffffffffffffffffffffffffffffffffffffff85166132dd5761012e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ae5e0f7a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156132aa57600080fd5b505afa1580156132be573d6000803e3d6000fd5b505050506040513d60208110156132d457600080fd5b50519050613380565b61012e54604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152915191909216916370a08231916024808301926020929190829003018186803b15801561335157600080fd5b505afa158015613365573d6000803e3d6000fd5b505050506040513d602081101561337b57600080fd5b505190505b806133a05750516fffffffffffffffffffffffffffffffff169050610cb7565b6133e982600001516fffffffffffffffffffffffffffffffff16826133e485602001516fffffffffffffffffffffffffffffffff1688612ce190919063ffffffff16565b613755565b95945050505050565b5490565b6133fe611751565b1561346a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015290519081900360640190fd5b603380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612fd5612d58565b6000611b8c838361383e565b6000611b8c8373ffffffffffffffffffffffffffffffffffffffff84166138bc565b6000610cb7826133f2565b6000613501612ddf565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050919050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156135d9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613aed6022913960400191505060405180910390fd5b8360ff16601b14806135ee57508360ff16601c145b613643576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613b3f6022913960400191505060405180910390fd5b600060018686868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561369f573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166133e957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015290519081900360640190fd5b80546001019055565b6000613777613770670de0b6b3a76400006113f48686612fff565b8590612e9d565b949350505050565b6000611b8c8373ffffffffffffffffffffffffffffffffffffffff84166138d4565b60c75490565b60c85490565b60008383836137ba61391e565b30604051602001808681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001955050505050506040516020818303038152906040528051906020012090509392505050565b6000611b8c8373ffffffffffffffffffffffffffffffffffffffff8416613922565b8154600090821061389a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613a1e6022913960400191505060405180910390fd5b8260000182815481106138a957fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b60006138e083836138bc565b61391657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cb7565b506000610cb7565b4690565b600081815260018301602052604081205480156139fc5783547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808301919081019060009087908390811061397357fe5b906000526020600020015490508087600001848154811061399057fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806139c057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610cb7565b6000915050610cb7565b60408051808201909152600080825260208201529056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e7445524332303a20617070726f766520746f20746865207a65726f2061646472657373526577617264457468546f6b656e3a2063616e6e6f74207472616e7366657220647572696e6720726577617264732075706461746553616665436173743a2076616c756520646f65736e27742066697420696e20313238206269747345434453413a20696e76616c6964207369676e6174757265202773272076616c7565416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b6545434453413a20696e76616c6964207369676e6174757265202776272076616c7565536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77526577617264457468546f6b656e3a2063616e6e6f742064697361626c6520647572696e6720726577617264732075706461746545524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373526577617264457468546f6b656e3a2076616c756520646964206e6f74206368616e6765416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212204975f7a4ac22b13aa424820c068d4c42685767d08175cb82c20e71d59128164564736f6c63430007050033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103205760003560e01c80636b2c0f55116101a7578063a9059cbb116100ee578063d547741f11610097578063e0622b2711610071578063e0622b2714610b40578063e63ab1e914610b79578063f4537f7814610b8157610320565b8063d547741f14610a58578063dbb51d6e14610a91578063dd62ed3e14610b0557610320565b8063ca15c873116100c8578063ca15c873146109d5578063cd3daf9d146109f2578063d505accf146109fa57610320565b8063a9059cbb1461095b578063aad3ec9614610994578063b4c6e416146109cd57610320565b80639010d07c116101505780639850d32b1161012a5780639850d32b14610912578063a217fddf1461091a578063a457c2d71461092257610320565b80639010d07c1461088557806391d14854146108d157806395d89b411461090a57610320565b80637ecebe00116101815780637ecebe001461081757806382dc1ec41461084a5780638456cb591461087d57610320565b80636b2c0f551461077e57806370480275146107b157806370a08231146107e457610320565b80633644e5151161026b57806354ea5a56116102145780635c975abb116101ee5780635c975abb146107335780636123b7211461073b5780636a9ecedb1461074357610320565b806354ea5a56146106c65780635bbb860d146106e35780635bdc6d7e1461070057610320565b80633b0c9d90116102455780633b0c9d90146106355780633f4ba83a1461068b57806346fbf68e1461069357610320565b80633644e515146105bb57806336568abe146105c357806339509351146105fc57610320565b806318160ddd116102cd57806324d7806c116102a757806324d7806c146105315780632f2ff15d14610564578063313ce5671461059d57610320565b806318160ddd146104b757806323b872dd146104d1578063248a9ca31461051457610320565b80630e15561a116102fe5780630e15561a1461042257806313ea5d291461044f5780631785f53c1461048457610320565b806301ba793b1461032557806306fdde031461036c578063095ea7b3146103e9575b600080fd5b6103586004803603602081101561033b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b89565b604080519115158252519081900360200190f35b610374610bf2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103ae578181015183820152602001610396565b50505050905090810190601f1680156103db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610358600480360360408110156103ff57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610ca6565b61042a610cbd565b604080516fffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6104826004803603602081101561046557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cd6565b005b6104826004803603602081101561049a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610e48565b6104bf610e56565b60408051918252519081900360200190f35b610358600480360360608110156104e757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e6f565b6104bf6004803603602081101561052a57600080fd5b5035610f01565b6103586004803603602081101561054757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f16565b6104826004803603604081101561057a57600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610f22565b6105a5610fa8565b6040805160ff9092168252519081900360200190f35b6104bf610fb1565b610482600480360360408110156105d957600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610fc0565b6103586004803603604081101561061257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611055565b6106706004803603604081101561064b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611098565b60408051921515835290151560208301528051918290030190f35b610482611131565b610358600480360360208110156106a957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111d0565b610482600480360360208110156106dc57600080fd5b50356111fc565b610482600480360360208110156106f957600080fd5b503561131e565b6103586004803603602081101561071657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661173b565b610358611751565b6104bf61175a565b6104826004803603604081101561075957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001351515611761565b6104826004803603602081101561079457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a12565b610482600480360360208110156107c757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a3c565b6104bf600480360360208110156107fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a47565b6104bf6004803603602081101561082d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a7f565b6104826004803603602081101561086057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611aad565b610482611ad7565b6108a86004803603604081101561089b57600080fd5b5080359060200135611b74565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610358600480360360408110156108e757600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16611b93565b610374611bab565b6108a8611c2a565b6104bf611c47565b6103586004803603604081101561093857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611c4c565b6103586004803603604081101561097157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611c8f565b610482600480360360408110156109aa57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611c9c565b6104bf611efe565b6104bf600480360360208110156109eb57600080fd5b5035611f05565b61042a611f1c565b610482600480360360e0811015610a1057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611f49565b61048260048036036040811015610a6e57600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff1661217b565b610ac460048036036020811015610aa757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166121ee565b60405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6104bf60048036036040811015610b1b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661222b565b61048260048036036040811015610b5657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135612263565b6104bf612428565b6108a861244c565b73ffffffffffffffffffffffffffffffffffffffff81166000908152610136602052604090205460ff1680610bed5761013354610bed90839070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16612469565b919050565b60988054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c9c5780601f10610c7157610100808354040283529160200191610c9c565b820191906000526020600020905b815481529060010190602001808311610c7f57829003601f168201915b5050505050905090565b6000610cb33384846127f2565b5060015b92915050565b610133546fffffffffffffffffffffffffffffffff1681565b610ce1600033611b93565b610d4c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610dce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f526577617264457468546f6b656e3a20696e76616c6964206164647265737300604482015290519081900360640190fd5b610131805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f3d412b7c69615303b057374f7db7e22f80cc367b8a2ccafe84357e2b26584ef29181900360200190a150565b610e5360008261217b565b50565b610133546fffffffffffffffffffffffffffffffff1690565b6000610e7c848484612939565b73ffffffffffffffffffffffffffffffffffffffff84166000818152609760209081526040808320338085529252909120549114801590610edd57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114155b15610ef657610ef68533610ef18487612ce1565b6127f2565b506001949350505050565b60009081526065602052604090206002015490565b6000610cb78183611b93565b600082815260656020526040902060020154610f4590610f40612d58565b611b93565b610f9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613a40602f913960400191505060405180910390fd5b610fa48282612d5c565b5050565b609a5460ff1690565b6000610fbb612ddf565b905090565b610fc8612d58565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461104b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613bfe602f913960400191505060405180910390fd5b610fa48282612e1a565b33600081815260976020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610cb3918590610ef19086612e9d565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152610136602052604080822054928416825290205460ff91821691168115806110db575080155b1561112a576101335470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1682611119576111198582612469565b81611128576111288482612469565b505b9250929050565b61115b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33611b93565b6111c657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b6111ce612f11565b565b6000610cb77f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a83611b93565b611207600033611b93565b61127257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b61271081106112e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f526577617264457468546f6b656e3a20696e76616c6964206665650000000000604482015290519081900360640190fd5b6101328190556040805182815290517f5a128e437f171b9c8e717f61664c1b0a637aa2396d64713e3bca904028c07f2c9181900360200190a150565b61012f5473ffffffffffffffffffffffffffffffffffffffff1633146113a557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f526577617264457468546f6b656e3a206163636573732064656e696564000000604482015290519081900360640190fd5b610133546000906113c99083906fffffffffffffffffffffffffffffffff16612ce1565b9050806113d65750610e53565b60006113fa6127106113f46101325485612fff90919063ffffffff16565b90613072565b6101335461012e54604080517f7d88209700000000000000000000000000000000000000000000000000000000815290519394507001000000000000000000000000000000009092046fffffffffffffffffffffffffffffffff16926000926114ee926114e79273ffffffffffffffffffffffffffffffffffffffff90911691637d882097916004808301926020929190829003018186803b15801561149f57600080fd5b505afa1580156114b3573d6000803e3d6000fd5b505050506040513d60208110156114c957600080fd5b50516113f4670de0b6b3a76400006114e18989612ce1565b90612fff565b8390612e9d565b905060006114fb826130f3565b9050611506866130f3565b61013380547fffffffffffffffffffffffffffffffff000000000000000000000000000000006fffffffffffffffffffffffffffffffff9182167001000000000000000000000000000000008684160217169216919091179055604080518082019091528061157e611579600086613162565b6130f3565b6fffffffffffffffffffffffffffffffff908116825283811660209283015260008052610130825282517f363eca0a79dc8ec297995f86b12cc61391ff0de52f1ba01ca23e9716f742e413805494909301518216700100000000000000000000000000000000029082167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909416939093171691909117905560408051808201909152610131548190611657906115799088906116519073ffffffffffffffffffffffffffffffffffffffff1688613162565b90612e9d565b6fffffffffffffffffffffffffffffffff90811682528381166020928301526101315473ffffffffffffffffffffffffffffffffffffffff166000908152610130835260409081902084518154958501518416700100000000000000000000000000000000029084167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909616959095179092169390931790554361013455815187815290810188905280820184905290517f4b4e9b2b02700f36dc5c043149dbb42bc2bf2211b35cd776181b8a9880891be29181900360600190a1505050505050565b6101366020526000908152604090205460ff1681565b60335460ff1690565b6101325481565b61012e5473ffffffffffffffffffffffffffffffffffffffff1633146117e857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f526577617264457468546f6b656e3a206163636573732064656e696564000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152610136602052604090205460ff161515811515141561186e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613bda6024913960400191505060405180910390fd5b6101345443116118c9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180613b826034913960400191505060405180910390fd5b61013354604080518082019091527001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff16908061190d6115798685613162565b6fffffffffffffffffffffffffffffffff908116825283811660209283015273ffffffffffffffffffffffffffffffffffffffff861660008181526101308452604080822086518154978701518616700100000000000000000000000000000000029086167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909816979097179094169590951790925561013683529083902080548615157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090911681179091558351908152925190927fef7566603852520a8be81b2924311bce365c73c01809a279f86ed6c6f69f824992908290030190a2505050565b610e537f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a8261217b565b610e53600082610f22565b61013354600090610cb790839070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16613162565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260fb60205260408120610cb7906133f2565b610e537f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a82610f22565b611b017f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33611b93565b611b6c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b6111ce6133f6565b6000828152606560205260408120611b8c90836134be565b9392505050565b6000828152606560205260408120611b8c90836134ca565b60998054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c9c5780601f10610c7157610100808354040283529160200191610c9c565b6101315473ffffffffffffffffffffffffffffffffffffffff1681565b600081565b33600081815260976020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610cb3918590610ef19086612ce1565b6000610cb3338484612939565b6101355473ffffffffffffffffffffffffffffffffffffffff163314611d2357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f526577617264457468546f6b656e3a206163636573732064656e696564000000604482015290519081900360640190fd5b61013354604080518082019091527001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff169080611d7261157985611d6c600087613162565b90612ce1565b6fffffffffffffffffffffffffffffffff9081168252838116602092830181905260008052610130835283517f363eca0a79dc8ec297995f86b12cc61391ff0de52f1ba01ca23e9716f742e413805495909401517fffffffffffffffffffffffffffffffff00000000000000000000000000000000909516908316178216700100000000000000000000000000000000949092169390930217905560408051808201909152908190611e2f90611579908690611651908990613162565b6fffffffffffffffffffffffffffffffff908116825283811660209283015273ffffffffffffffffffffffffffffffffffffffff861660008181526101308452604080822086518154978701518616700100000000000000000000000000000000029086167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909816979097179094169590951790925583518681529351909391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a3505050565b6101345481565b6000818152606560205260408120610cb7906134ec565b6101335470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b83421115611fb857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015290519081900360640190fd5b600060fc5488888861200760fb60008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206133f2565b89604051602001808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019650505050505050604051602081830303815290604052805190602001209050600061208a826134f7565b9050600061209a8287878761355e565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461213657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260fb602052604090206121649061374c565b61216f8a8a8a6127f2565b50505050505050505050565b60008281526065602052604090206002015461219990610f40612d58565b61104b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180613b0f6030913960400191505060405180910390fd5b610130602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260976020908152604080832093909416825291909152205490565b61226e600033611b93565b6122d957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f776e61626c655061757361626c653a206163636573732064656e6965640000604482015290519081900360640190fd5b6122e1611751565b61234c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015290519081900360640190fd5b6101355473ffffffffffffffffffffffffffffffffffffffff16156123d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f526577617264457468546f6b656e3a20616c7265616479207570677261646564604482015290519081900360640190fd5b61013580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556101348190556124236000610b89565b505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6101355473ffffffffffffffffffffffffffffffffffffffff1681565b612471613a06565b5073ffffffffffffffffffffffffffffffffffffffff8216600090815261013060209081526040918290208251808401909352546fffffffffffffffffffffffffffffffff80821684527001000000000000000000000000000000009091048116918301829052831614156124e65750610fa4565b600073ffffffffffffffffffffffffffffffffffffffff841661259f5761012e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ae5e0f7a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561256c57600080fd5b505afa158015612580573d6000803e3d6000fd5b505050506040513d602081101561259657600080fd5b50519050612642565b61012e54604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152915191909216916370a08231916024808301926020929190829003018186803b15801561261357600080fd5b505afa158015612627573d6000803e3d6000fd5b505050506040513d602081101561263d57600080fd5b505190505b806126eb5760408051808201825283516fffffffffffffffffffffffffffffffff9081168252858116602080840191825273ffffffffffffffffffffffffffffffffffffffff89166000908152610130909152939093209151825493518216700100000000000000000000000000000000029082167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941693909317169190911790556127ec565b600061272883602001516fffffffffffffffffffffffffffffffff16856fffffffffffffffffffffffffffffffff16612ce190919063ffffffff16565b9050604051806040016040528061275961157986600001516fffffffffffffffffffffffffffffffff168686613755565b6fffffffffffffffffffffffffffffffff908116825286811660209283015273ffffffffffffffffffffffffffffffffffffffff881660009081526101308352604090208351815494909301518216700100000000000000000000000000000000029282167fffffffffffffffffffffffffffffffff000000000000000000000000000000009094169390931716179055505b50505050565b73ffffffffffffffffffffffffffffffffffffffff831661285e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613bb66024913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166128ca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613a6f6022913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260976020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b612941611751565b156129ad57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316612a2f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f526577617264457468546f6b656e3a20696e76616c69642073656e6465720000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216612ab157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f526577617264457468546f6b656e3a20696e76616c6964207265636569766572604482015290519081900360640190fd5b610134544311612b0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180613a916035913960400191505060405180910390fd5b61013354604080518082019091527001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff169080612b5461157985611d6c8987613162565b6fffffffffffffffffffffffffffffffff9081168252838116602092830181905273ffffffffffffffffffffffffffffffffffffffff8816600090815261013084526040908190208551815496909501518416700100000000000000000000000000000000029484167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909616959095179092169290921790925581518083019092528190612c0e90611579908690611651908990613162565b6fffffffffffffffffffffffffffffffff908116825283811660209283015273ffffffffffffffffffffffffffffffffffffffff8681166000818152610130855260409081902086518154978701517fffffffffffffffffffffffffffffffff0000000000000000000000000000000090981690861617851670010000000000000000000000000000000097909516969096029390931790945581518681529151908816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a350505050565b600082821115612d5257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b3390565b6000828152606560205260409020612d74908261377f565b15610fa457612d81612d58565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610fbb7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612e0d6137a1565b612e156137a7565b6137ad565b6000828152606560205260409020612e32908261381c565b15610fa457612e3f612d58565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600082820183811015611b8c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b612f19611751565b612f8457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015290519081900360640190fd5b603380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612fd5612d58565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190a1565b60008261300e57506000610cb7565b8282028284828161301b57fe5b0414611b8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613b616021913960400191505060405180910390fd5b60008082116130e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816130eb57fe5b049392505050565b6000700100000000000000000000000000000000821061315e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180613ac66027913960400191505060405180910390fd5b5090565b600061316c613a06565b5073ffffffffffffffffffffffffffffffffffffffff8316600090815261013060209081526040918290208251808401909352546fffffffffffffffffffffffffffffffff808216845270010000000000000000000000000000000090910416908201819052831480613205575073ffffffffffffffffffffffffffffffffffffffff84166000908152610136602052604090205460ff165b1561322457516fffffffffffffffffffffffffffffffff169050610cb7565b600073ffffffffffffffffffffffffffffffffffffffff85166132dd5761012e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ae5e0f7a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156132aa57600080fd5b505afa1580156132be573d6000803e3d6000fd5b505050506040513d60208110156132d457600080fd5b50519050613380565b61012e54604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152915191909216916370a08231916024808301926020929190829003018186803b15801561335157600080fd5b505afa158015613365573d6000803e3d6000fd5b505050506040513d602081101561337b57600080fd5b505190505b806133a05750516fffffffffffffffffffffffffffffffff169050610cb7565b6133e982600001516fffffffffffffffffffffffffffffffff16826133e485602001516fffffffffffffffffffffffffffffffff1688612ce190919063ffffffff16565b613755565b95945050505050565b5490565b6133fe611751565b1561346a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015290519081900360640190fd5b603380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612fd5612d58565b6000611b8c838361383e565b6000611b8c8373ffffffffffffffffffffffffffffffffffffffff84166138bc565b6000610cb7826133f2565b6000613501612ddf565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050919050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156135d9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613aed6022913960400191505060405180910390fd5b8360ff16601b14806135ee57508360ff16601c145b613643576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613b3f6022913960400191505060405180910390fd5b600060018686868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561369f573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166133e957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015290519081900360640190fd5b80546001019055565b6000613777613770670de0b6b3a76400006113f48686612fff565b8590612e9d565b949350505050565b6000611b8c8373ffffffffffffffffffffffffffffffffffffffff84166138d4565b60c75490565b60c85490565b60008383836137ba61391e565b30604051602001808681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001955050505050506040516020818303038152906040528051906020012090509392505050565b6000611b8c8373ffffffffffffffffffffffffffffffffffffffff8416613922565b8154600090821061389a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613a1e6022913960400191505060405180910390fd5b8260000182815481106138a957fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b60006138e083836138bc565b61391657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cb7565b506000610cb7565b4690565b600081815260018301602052604081205480156139fc5783547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808301919081019060009087908390811061397357fe5b906000526020600020015490508087600001848154811061399057fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806139c057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610cb7565b6000915050610cb7565b60408051808201909152600080825260208201529056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e7445524332303a20617070726f766520746f20746865207a65726f2061646472657373526577617264457468546f6b656e3a2063616e6e6f74207472616e7366657220647572696e6720726577617264732075706461746553616665436173743a2076616c756520646f65736e27742066697420696e20313238206269747345434453413a20696e76616c6964207369676e6174757265202773272076616c7565416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b6545434453413a20696e76616c6964207369676e6174757265202776272076616c7565536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77526577617264457468546f6b656e3a2063616e6e6f742064697361626c6520647572696e6720726577617264732075706461746545524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373526577617264457468546f6b656e3a2076616c756520646964206e6f74206368616e6765416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212204975f7a4ac22b13aa424820c068d4c42685767d08175cb82c20e71d59128164564736f6c63430007050033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.