Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 44 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Add Rewards | 17237153 | 650 days ago | IN | 0 ETH | 0.00845758 | ||||
Add Rewards | 17237140 | 650 days ago | IN | 0 ETH | 0.00844529 | ||||
Add Rewards | 17237125 | 650 days ago | IN | 0 ETH | 0.00884455 | ||||
Add Rewards | 17187995 | 657 days ago | IN | 0 ETH | 0.00767271 | ||||
Add Rewards | 17187990 | 657 days ago | IN | 0 ETH | 0.00879954 | ||||
Add Rewards | 17187984 | 657 days ago | IN | 0 ETH | 0.00929317 | ||||
Add Rewards | 17136493 | 664 days ago | IN | 0 ETH | 0.003173 | ||||
Add Rewards | 17136491 | 664 days ago | IN | 0 ETH | 0.0067014 | ||||
Add Rewards | 17136489 | 664 days ago | IN | 0 ETH | 0.00352451 | ||||
Deploy Pool | 17136201 | 664 days ago | IN | 0 ETH | 0.04738188 | ||||
Add Rewards | 17086779 | 671 days ago | IN | 0 ETH | 0.00433798 | ||||
Add Rewards | 17086774 | 671 days ago | IN | 0 ETH | 0.00490047 | ||||
Add Rewards | 17037638 | 678 days ago | IN | 0 ETH | 0.00360863 | ||||
Add Rewards | 17037634 | 678 days ago | IN | 0 ETH | 0.00349754 | ||||
Withdraw EL Rewa... | 17037161 | 679 days ago | IN | 0 ETH | 0.00280857 | ||||
Withdraw EL Rewa... | 16988693 | 685 days ago | IN | 0 ETH | 0.0029357 | ||||
Add Rewards | 16988579 | 685 days ago | IN | 0 ETH | 0.00497872 | ||||
Add Rewards | 16988572 | 685 days ago | IN | 0 ETH | 0.00255884 | ||||
Deploy Pool | 16987531 | 686 days ago | IN | 0 ETH | 0.0291298 | ||||
Add Rewards | 16939142 | 692 days ago | IN | 0 ETH | 0.00323798 | ||||
Add Rewards | 16939138 | 692 days ago | IN | 0 ETH | 0.0036203 | ||||
Add Rewards | 16939133 | 692 days ago | IN | 0 ETH | 0.00363013 | ||||
Add Rewards | 16939125 | 692 days ago | IN | 0 ETH | 0.00342259 | ||||
Add Rewards | 16939120 | 692 days ago | IN | 0 ETH | 0.00326245 | ||||
Withdraw EL Rewa... | 16939075 | 692 days ago | IN | 0 ETH | 0.00320229 |
Latest 8 internal transactions
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
17136201 | 664 days ago | Contract Creation | 0 ETH | |||
16987531 | 686 days ago | Contract Creation | 0 ETH | |||
16938753 | 692 days ago | Contract Creation | 0 ETH | |||
16839250 | 706 days ago | Contract Creation | 0 ETH | |||
16832200 | 707 days ago | Contract Creation | 0 ETH | |||
16832181 | 707 days ago | Contract Creation | 0 ETH | |||
16832167 | 707 days ago | Contract Creation | 0 ETH | |||
16832145 | 707 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
StakingPoolFactory
Compiler Version
v0.8.12+commit.f00d7308
Optimization Enabled:
Yes with 590 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import "@openzeppelin/contracts/access/Ownable.sol"; import "./lib/CurrencyTransferLib.sol"; import './StakingPool.sol'; import './EthStakingPool.sol'; contract StakingPoolFactory is Ownable { using SafeMath for uint256; // immutables address public rewardsToken; address public nativeTokenWrapper; // the staking tokens for which the rewards contract has been deployed address[] public stakingTokens; // info about rewards for a particular staking token struct StakingPoolInfo { address poolAddress; uint256 startTime; uint256 roundDurationInDays; uint256 totalRewardsAmount; } // rewards info by staking token mapping(address => StakingPoolInfo) public stakingPoolInfoByStakingToken; event StakingPoolDeployed( address indexed poolAddress, address indexed stakingToken, uint256 startTime, uint256 roundDurationInDays ); constructor( address _rewardsToken, address _nativeTokenWrapper ) Ownable() { rewardsToken = _rewardsToken; nativeTokenWrapper = _nativeTokenWrapper; } function getStakingPoolAddress(address stakingToken) public virtual view returns (address) { StakingPoolInfo storage info = stakingPoolInfoByStakingToken[stakingToken]; require(info.poolAddress != address(0), 'StakingPoolFactory::getPoolAddress: not deployed'); return info.poolAddress; } function getStakingTokens() public virtual view returns (address[] memory) { return stakingTokens; } ///// permissioned functions // deploy a by-stages staking reward contract for the staking token function deployPool(address stakingToken, uint256 startTime, uint256 roundDurationInDays) public onlyOwner { StakingPoolInfo storage info = stakingPoolInfoByStakingToken[stakingToken]; require(info.poolAddress == address(0), 'StakingPoolFactory::deployPool: already deployed'); require(startTime >= block.timestamp, 'StakingPoolFactory::deployPool: start too soon'); require(roundDurationInDays > 0, 'StakingPoolFactory::deployPool: duration too short'); if (stakingToken == CurrencyTransferLib.NATIVE_TOKEN) { info.poolAddress = address(new EthStakingPool(/*_rewardsDistribution=*/ address(this), rewardsToken, nativeTokenWrapper, roundDurationInDays)); } else { info.poolAddress = address(new StakingPool(/*_rewardsDistribution=*/ address(this), rewardsToken, stakingToken, roundDurationInDays)); } info.startTime = startTime; info.roundDurationInDays = roundDurationInDays; info.totalRewardsAmount = 0; stakingTokens.push(stakingToken); emit StakingPoolDeployed(info.poolAddress, stakingToken, startTime, roundDurationInDays); } // withdraw EL staking rewards from a staking pool after period finish. // this is only intended for rebasable staking tokens like stETH function withdrawELRewards(address stakingToken, address to) external onlyOwner { StakingPoolInfo storage info = stakingPoolInfoByStakingToken[stakingToken]; require(info.poolAddress != address(0), 'StakingPoolFactory::withdrawELRewards: not deployed'); require(block.timestamp >= info.startTime, 'StakingPoolFactory::withdrawELRewards: not ready'); StakingPool(payable(address(info.poolAddress))).withdrawELRewards(to); } function addRewards(address stakingToken, uint256 rewardsAmount) public onlyOwner { StakingPoolInfo storage info = stakingPoolInfoByStakingToken[stakingToken]; require(info.poolAddress != address(0), 'StakingPoolFactory::addRewards: not deployed'); require(block.timestamp >= info.startTime, 'StakingPoolFactory::addRewards: not ready'); if (rewardsAmount > 0) { info.totalRewardsAmount = info.totalRewardsAmount.add(rewardsAmount); require( IERC20(rewardsToken).transferFrom(msg.sender, info.poolAddress, rewardsAmount), 'StakingPoolFactory::addRewards: transfer failed' ); StakingPool(payable(address(info.poolAddress))).notifyRewardAmount(rewardsAmount); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^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 // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20PermitUpgradeable token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^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 IERC20Permit { /** * @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 // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; // Uncomment this line to use console.log // import "hardhat/console.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./lib/CurrencyTransferLib.sol"; import "./interfaces/IWETH.sol"; import "./StakingPool.sol"; contract EthStakingPool is StakingPool { using SafeMath for uint256; IWETH public weth; /* ========== CONSTRUCTOR ========== */ constructor( address _rewardsDistribution, address _rewardsToken, address _nativeTokenWrapper, uint256 _durationInDays ) StakingPool(_rewardsDistribution, _rewardsToken, _nativeTokenWrapper, _durationInDays) { weth = IWETH(_nativeTokenWrapper); } function _transferStakingToken(uint256 amount) override internal virtual { // console.log('_transferStakingToken, msg.value: %s, amount: %s', msg.value, amount); require(msg.value >= amount, 'Not enough value'); weth.deposit{value: amount}(); uint256 diff = msg.value.sub(amount); if (diff > 0) { CurrencyTransferLib.transferCurrency(CurrencyTransferLib.NATIVE_TOKEN, address(this), msg.sender, diff); } } function _withdrawStakingToken(uint256 amount) override internal virtual { weth.withdraw(amount); CurrencyTransferLib.transferCurrency(CurrencyTransferLib.NATIVE_TOKEN, address(this), msg.sender, amount); } // Admin could withdraw Ethers that are accidently sent to the pool function withdrawELRewards(address to) external override virtual nonReentrant onlyRewardsDistribution { require(block.timestamp >= periodFinish, 'Not ready to withdraw EL rewards'); uint256 amount = address(this).balance; require(amount > 0, 'No extra EL rewards to withdraw'); CurrencyTransferLib.transferCurrency(CurrencyTransferLib.NATIVE_TOKEN, address(this), to, amount); emit ELRewardWithdrawn(to, amount); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; interface IStakingPool { // Views function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function getRewardForDuration() external view returns (uint256); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); // Mutative function stake(uint256 amount) external payable; function withdraw(uint256 amount) external; function getReward() external; function exit() external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; interface IWETH { function deposit() external payable; function withdraw(uint wad) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; library CurrencyTransferLib { using SafeERC20Upgradeable for IERC20Upgradeable; /// @dev The address interpreted as native token of the chain. address public constant NATIVE_TOKEN = 0x0000000000000000000000000000000000000000; /// @dev Transfers a given amount of currency. function transferCurrency( address currency, address from, address to, uint256 amount ) internal { if (amount == 0) { return; } if (currency == NATIVE_TOKEN) { safeTransferNativeToken(to, amount); } else { safeTransferERC20(currency, from, to, amount); } } /// @dev Transfers `amount` of native token to `to`. function safeTransferNativeToken(address to, uint256 value) internal { // solhint-disable avoid-low-level-calls // slither-disable-next-line low-level-calls (bool success, ) = to.call{ value: value }(""); require(success, "Native token transfer failed"); } /// @dev Transfer `amount` of ERC20 token from `from` to `to`. function safeTransferERC20( address currency, address from, address to, uint256 amount ) internal { if (from == to) { return; } if (from == address(this)) { IERC20Upgradeable(currency).safeTransfer(to, amount); } else { IERC20Upgradeable(currency).safeTransferFrom(from, to, amount); } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; abstract contract RewardsDistributionRecipient { address public rewardsDistribution; function notifyRewardAmount(uint256 reward) external virtual; modifier onlyRewardsDistribution() { require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract"); _; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; // Uncomment this line to use console.log // import "hardhat/console.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./lib/CurrencyTransferLib.sol"; import "./interfaces/IStakingPool.sol"; import "./RewardsDistributionRecipient.sol"; contract StakingPool is IStakingPool, RewardsDistributionRecipient, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ IERC20 public rewardsToken; IERC20 public stakingToken; uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public rewardsDuration; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; uint256 private _totalSupply; mapping(address => uint256) private _balances; /* ========== CONSTRUCTOR ========== */ constructor( address _rewardsDistribution, address _rewardsToken, address _stakingToken, uint256 _durationInDays ) { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); rewardsDistribution = _rewardsDistribution; rewardsDuration = _durationInDays.mul(3600 * 24); } receive() external payable virtual {} /* ========== VIEWS ========== */ function totalSupply() external view returns (uint256) { return _totalSupply; } function balanceOf(address account) external view returns (uint256) { return _balances[account]; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (_totalSupply == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(_totalSupply) ); } function earned(address account) public view returns (uint256) { return _balances[account].mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]); } function getRewardForDuration() external view returns (uint256) { return rewardRate.mul(rewardsDuration); } /* ========== MUTATIVE FUNCTIONS ========== */ function stake(uint256 amount) external virtual payable nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); // console.log('stake, msg.sender balance: %s', stakingToken.balanceOf(msg.sender)); _transferStakingToken(amount); emit Staked(msg.sender, amount); } function _transferStakingToken(uint256 amount) internal virtual { stakingToken.safeTransferFrom(msg.sender, address(this), amount); } function withdraw(uint256 amount) public virtual nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); _withdrawStakingToken(amount); emit Withdrawn(msg.sender, amount); } function _withdrawStakingToken(uint256 amount) internal virtual { stakingToken.safeTransfer(msg.sender, amount); } function getReward() public nonReentrant updateReward(msg.sender) { uint256 reward = rewards[msg.sender]; if (reward > 0) { rewards[msg.sender] = 0; rewardsToken.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } function exit() external { withdraw(_balances[msg.sender]); getReward(); } /* ========== RESTRICTED FUNCTIONS ========== */ function notifyRewardAmount(uint256 reward) external override onlyRewardsDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(rewardsDuration); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(rewardsDuration); } // Ensure the provided reward amount is not more than the balance in the contract. // This keeps the reward rate in the right range, preventing overflows due to // very high values of rewardRate in the earned and rewardsPerToken functions; // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow. uint balance = rewardsToken.balanceOf(address(this)); require(rewardRate <= balance.div(rewardsDuration), "Provided reward too high"); lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(rewardsDuration); emit RewardAdded(reward); } function withdrawELRewards(address to) external virtual nonReentrant onlyRewardsDistribution { require(block.timestamp >= periodFinish, 'Not ready to withdraw EL rewards'); uint256 balance = stakingToken.balanceOf(address(this)); // console.log('withdrawELRewards, balance: %s, total supply:', balance, _totalSupply); require(balance > _totalSupply, 'No extra EL rewards to withdraw'); uint256 amount = balance - _totalSupply; stakingToken.safeTransfer(to, amount); emit ELRewardWithdrawn(to, amount); } /* ========== MODIFIERS ========== */ modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } /* ========== EVENTS ========== */ event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); event ELRewardWithdrawn(address indexed to, uint256 amount); }
{ "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 590 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_nativeTokenWrapper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poolAddress","type":"address"},{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"roundDurationInDays","type":"uint256"}],"name":"StakingPoolDeployed","type":"event"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"uint256","name":"rewardsAmount","type":"uint256"}],"name":"addRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"roundDurationInDays","type":"uint256"}],"name":"deployPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"}],"name":"getStakingPoolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakingTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeTokenWrapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakingPoolInfoByStakingToken","outputs":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"roundDurationInDays","type":"uint256"},{"internalType":"uint256","name":"totalRewardsAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakingTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawELRewards","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161386738038061386783398101604081905261002f916100d5565b61003833610069565b600180546001600160a01b039384166001600160a01b03199182161790915560028054929093169116179055610108565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100d057600080fd5b919050565b600080604083850312156100e857600080fd5b6100f1836100b9565b91506100ff602084016100b9565b90509250929050565b613750806101176000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c8063ab5777db11610081578063eb7f8f241161005b578063eb7f8f2414610198578063f2fde38b14610201578063f9ea29cb1461021457600080fd5b8063ab5777db1461015d578063d1af0c7d14610170578063da1d111b1461018357600080fd5b80637e4b02d5116100b25780637e4b02d5146101265780638da5cb5b14610139578063a9fc507b1461014a57600080fd5b8063344e5e34146100d957806367c81f6514610109578063715018a61461011e575b600080fd5b6100ec6100e7366004610bb2565b610227565b6040516001600160a01b0390911681526020015b60405180910390f35b61011c610117366004610be7565b610251565b005b61011c610599565b6100ec610134366004610c1a565b6105ad565b6000546001600160a01b03166100ec565b61011c610158366004610c35565b61064f565b61011c61016b366004610c5f565b6108bb565b6001546100ec906001600160a01b031681565b61018b6109fe565b6040516101009190610c92565b6101d76101a6366004610c1a565b60046020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610100565b61011c61020f366004610c1a565b610a60565b6002546100ec906001600160a01b031681565b6003818154811061023757600080fd5b6000918252602090912001546001600160a01b0316905081565b610259610ad9565b6001600160a01b0380841660009081526004602052604090208054909116156102ef5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201527f616c7265616479206465706c6f7965640000000000000000000000000000000060648201526084015b60405180910390fd5b428310156103655760405162461bcd60e51b815260206004820152602e60248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201527f737461727420746f6f20736f6f6e00000000000000000000000000000000000060648201526084016102e6565b600082116103db5760405162461bcd60e51b815260206004820152603260248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201527f6475726174696f6e20746f6f2073686f7274000000000000000000000000000060648201526084016102e6565b6001600160a01b0384166104715760015460025460405130926001600160a01b03908116921690859061040d90610b96565b6001600160a01b0394851681529284166020840152921660408201526060810191909152608001604051809103906000f080158015610450573d6000803e3d6000fd5b5081546001600160a01b0319166001600160a01b03919091161781556104f0565b60015460405130916001600160a01b0316908690859061049090610ba4565b6001600160a01b0394851681529284166020840152921660408201526060810191909152608001604051809103906000f0801580156104d3573d6000803e3d6000fd5b5081546001600160a01b0319166001600160a01b03919091161781555b600181810184905560028201839055600060038084018290558054928301815590527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0386811691821790925582546040805187815260208101879052929391909116917f489ab9065c597368f4a678fadcb323bf4c848713ea7d5a296d16ec97203eae83910160405180910390a350505050565b6105a1610ad9565b6105ab6000610b33565b565b6001600160a01b0380821660009081526004602052604081208054919290911661063f5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a676574506f6f6c416464726560448201527f73733a206e6f74206465706c6f7965640000000000000000000000000000000060648201526084016102e6565b546001600160a01b031692915050565b610657610ad9565b6001600160a01b03808316600090815260046020526040902080549091166106e75760405162461bcd60e51b815260206004820152602c60248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a2060448201527f6e6f74206465706c6f796564000000000000000000000000000000000000000060648201526084016102e6565b806001015442101561074d5760405162461bcd60e51b815260206004820152602960248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a206044820152686e6f7420726561647960b81b60648201526084016102e6565b81156108b65760038101546107629083610b83565b600382015560015481546040516323b872dd60e01b81523360048201526001600160a01b039182166024820152604481018590529116906323b872dd906064016020604051808303816000875af11580156107c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e59190610cdf565b6108575760405162461bcd60e51b815260206004820152602f60248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a2060448201527f7472616e73666572206661696c6564000000000000000000000000000000000060648201526084016102e6565b8054604051633c6b16ab60e01b8152600481018490526001600160a01b0390911690633c6b16ab906024015b600060405180830381600087803b15801561089d57600080fd5b505af11580156108b1573d6000803e3d6000fd5b505050505b505050565b6108c3610ad9565b6001600160a01b03808316600090815260046020526040902080549091166109535760405162461bcd60e51b815260206004820152603360248201527f5374616b696e67506f6f6c466163746f72793a3a7769746864726177454c526560448201527f77617264733a206e6f74206465706c6f7965640000000000000000000000000060648201526084016102e6565b80600101544210156109cd5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a7769746864726177454c526560448201527f77617264733a206e6f742072656164790000000000000000000000000000000060648201526084016102e6565b805460405163236a38f760e01b81526001600160a01b0384811660048301529091169063236a38f790602401610883565b60606003805480602002602001604051908101604052809291908181526020018280548015610a5657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a38575b5050505050905090565b610a68610ad9565b6001600160a01b038116610acd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102e6565b610ad681610b33565b50565b6000546001600160a01b031633146105ab5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102e6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610b8f8284610d01565b9392505050565b6115fd8062000d2883390190565b6113f6806200232583390190565b600060208284031215610bc457600080fd5b5035919050565b80356001600160a01b0381168114610be257600080fd5b919050565b600080600060608486031215610bfc57600080fd5b610c0584610bcb565b95602085013595506040909401359392505050565b600060208284031215610c2c57600080fd5b610b8f82610bcb565b60008060408385031215610c4857600080fd5b610c5183610bcb565b946020939093013593505050565b60008060408385031215610c7257600080fd5b610c7b83610bcb565b9150610c8960208401610bcb565b90509250929050565b6020808252825182820181905260009190848201906040850190845b81811015610cd35783516001600160a01b031683529284019291840191600101610cae565b50909695505050505050565b600060208284031215610cf157600080fd5b81518015158114610b8f57600080fd5b60008219821115610d2257634e487b7160e01b600052601160045260246000fd5b50019056fe6080604052600060045560006005553480156200001b57600080fd5b50604051620015fd380380620015fd8339810160408190526200003e9162000103565b60018055600280546001600160a01b03199081166001600160a01b038681169190911790925560038054821685841617905560008054909116918616919091179055838383836200009f8162015180620000d1602090811b62000c5c17901c565b6006555050600d80546001600160a01b0319166001600160a01b03959095169490941790935550620001839350505050565b6000620000df828462000155565b9392505050565b80516001600160a01b0381168114620000fe57600080fd5b919050565b600080600080608085870312156200011a57600080fd5b6200012585620000e6565b93506200013560208601620000e6565b92506200014560408601620000e6565b6060959095015193969295505050565b60008160001904831182151516156200017e57634e487b7160e01b600052601160045260246000fd5b500290565b61146a80620001936000396000f3fe6080604052600436106101835760003560e01c806370a08231116100d6578063c8f33c911161007f578063df136d6511610059578063df136d651461040a578063e9fad8ee14610420578063ebe2b12b1461043557600080fd5b8063c8f33c91146103bf578063cd3daf9d146103d5578063d1af0c7d146103ea57600080fd5b806380faa57d116100b057806380faa57d1461036a5780638b8763471461037f578063a694fc3a146103ac57600080fd5b806370a08231146102fe57806372f702f3146103345780637b0a47ee1461035457600080fd5b80632e1a7d4d116101385780633d18b912116101125780633d18b912146102915780633fc6df6e146102a65780633fc8cef3146102de57600080fd5b80632e1a7d4d1461023b578063386a95251461025b5780633c6b16ab1461027157600080fd5b806318160ddd1161016957806318160ddd146101ef5780631c1f78eb14610204578063236a38f71461021957600080fd5b80628cc2621461018f5780630700037d146101c257600080fd5b3661018a57005b600080fd5b34801561019b57600080fd5b506101af6101aa3660046112b6565b61044b565b6040519081526020015b60405180910390f35b3480156101ce57600080fd5b506101af6101dd3660046112b6565b600a6020526000908152604090205481565b3480156101fb57600080fd5b50600b546101af565b34801561021057600080fd5b506101af6104c9565b34801561022557600080fd5b506102396102343660046112b6565b6104e7565b005b34801561024757600080fd5b506102396102563660046112df565b61065e565b34801561026757600080fd5b506101af60065481565b34801561027d57600080fd5b5061023961028c3660046112df565b610786565b34801561029d57600080fd5b506102396109d4565b3480156102b257600080fd5b506000546102c6906001600160a01b031681565b6040516001600160a01b0390911681526020016101b9565b3480156102ea57600080fd5b50600d546102c6906001600160a01b031681565b34801561030a57600080fd5b506101af6103193660046112b6565b6001600160a01b03166000908152600c602052604090205490565b34801561034057600080fd5b506003546102c6906001600160a01b031681565b34801561036057600080fd5b506101af60055481565b34801561037657600080fd5b506101af610ab9565b34801561038b57600080fd5b506101af61039a3660046112b6565b60096020526000908152604090205481565b6102396103ba3660046112df565b610ac7565b3480156103cb57600080fd5b506101af60075481565b3480156103e157600080fd5b506101af610bef565b3480156103f657600080fd5b506002546102c6906001600160a01b031681565b34801561041657600080fd5b506101af60085481565b34801561042c57600080fd5b50610239610c3b565b34801561044157600080fd5b506101af60045481565b6001600160a01b0381166000908152600a602090815260408083205460099092528220546104c391906104bd90670de0b6b3a7640000906104b79061049890610492610bef565b90610c6f565b6001600160a01b0388166000908152600c602052604090205490610c5c565b90610c7b565b90610c87565b92915050565b60006104e2600654600554610c5c90919063ffffffff16565b905090565b6104ef610c93565b6000546001600160a01b031633146105615760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b60648201526084015b60405180910390fd5b6004544210156105b35760405162461bcd60e51b815260206004820181905260248201527f4e6f7420726561647920746f20776974686472617720454c20726577617264736044820152606401610558565b47806106015760405162461bcd60e51b815260206004820152601f60248201527f4e6f20657874726120454c207265776172647320746f207769746864726177006044820152606401610558565b61060e6000308484610ced565b816001600160a01b03167fbca5c314ed4bf159442030f0d4293bd6da1e7d20d5ea7c6da488ae3f899af5008260405161064991815260200190565b60405180910390a25061065b60018055565b50565b610666610c93565b3361066f610bef565b60085561067a610ab9565b6007556001600160a01b038116156106c1576106958161044b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600082116107115760405162461bcd60e51b815260206004820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152606401610558565b600b5461071e9083610c6f565b600b55336000908152600c602052604090205461073b9083610c6f565b336000908152600c602052604090205561075482610d26565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d590602001610649565b6000546001600160a01b031633146107f35760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b6064820152608401610558565b60006107fd610bef565b600855610808610ab9565b6007556001600160a01b0381161561084f576108238161044b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600454421061086e57600654610866908390610c7b565b6005556108b1565b60045460009061087e9042610c6f565b9050600061089760055483610c5c90919063ffffffff16565b6006549091506108ab906104b78684610c87565b60055550505b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156108fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091e91906112f8565b905061093560065482610c7b90919063ffffffff16565b60055411156109865760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152606401610558565b4260078190556006546109999190610c87565b6004556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b6109dc610c93565b336109e5610bef565b6008556109f0610ab9565b6007556001600160a01b03811615610a3757610a0b8161044b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a60205260409020548015610aac57336000818152600a6020526040812055600254610a76916001600160a01b039091169083610d91565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b5050610ab760018055565b565b60006104e242600454610e26565b610acf610c93565b33610ad8610bef565b600855610ae3610ab9565b6007556001600160a01b03811615610b2a57610afe8161044b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610b7a5760405162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b6520300000000000000000000000000000000000006044820152606401610558565b600b54610b879083610c87565b600b55336000908152600c6020526040902054610ba49083610c87565b336000908152600c6020526040902055610bbd82610e3c565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610649565b6000600b5460001415610c03575060085490565b6104e2610c32600b546104b7670de0b6b3a7640000610c2c600554610c2c600754610492610ab9565b90610c5c565b60085490610c87565b336000908152600c6020526040902054610c549061065e565b610ab76109d4565b6000610c688284611327565b9392505050565b6000610c688284611346565b6000610c68828461135d565b6000610c68828461137f565b60026001541415610ce65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610558565b6002600155565b80610cf757610d20565b6001600160a01b038416610d1457610d0f8282610f23565b610d20565b610d2084848484610fc6565b50505050565b600d54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015610d6c57600080fd5b505af1158015610d80573d6000803e3d6000fd5b5050505061065b6000303384610ced565b6040516001600160a01b038316602482015260448101829052610e2190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261101f565b505050565b6000818310610e355781610c68565b5090919050565b80341015610e8c5760405162461bcd60e51b815260206004820152601060248201527f4e6f7420656e6f7567682076616c7565000000000000000000000000000000006044820152606401610558565b600d60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015610edc57600080fd5b505af1158015610ef0573d6000803e3d6000fd5b50505050506000610f0a8234610c6f90919063ffffffff16565b90508015610f1f57610f1f6000303384610ced565b5050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f70576040519150601f19603f3d011682016040523d82523d6000602084013e610f75565b606091505b5050905080610e215760405162461bcd60e51b815260206004820152601c60248201527f4e617469766520746f6b656e207472616e73666572206661696c6564000000006044820152606401610558565b816001600160a01b0316836001600160a01b03161415610fe557610d20565b6001600160a01b03831630141561100a57610d0f6001600160a01b0385168383610d91565b610d206001600160a01b0385168484846110f1565b6000611074826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111299092919063ffffffff16565b805190915015610e2157808060200190518101906110929190611397565b610e215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610558565b6040516001600160a01b0380851660248301528316604482015260648101829052610d209085906323b872dd60e01b90608401610dbd565b60606111388484600085611140565b949350505050565b6060824710156111a15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610558565b600080866001600160a01b031685876040516111bd91906113e5565b60006040518083038185875af1925050503d80600081146111fa576040519150601f19603f3d011682016040523d82523d6000602084013e6111ff565b606091505b50915091506112108783838761121b565b979650505050505050565b60608315611287578251611280576001600160a01b0385163b6112805760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610558565b5081611138565b611138838381511561129c5781518083602001fd5b8060405162461bcd60e51b81526004016105589190611401565b6000602082840312156112c857600080fd5b81356001600160a01b0381168114610c6857600080fd5b6000602082840312156112f157600080fd5b5035919050565b60006020828403121561130a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561134157611341611311565b500290565b60008282101561135857611358611311565b500390565b60008261137a57634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561139257611392611311565b500190565b6000602082840312156113a957600080fd5b81518015158114610c6857600080fd5b60005b838110156113d45781810151838201526020016113bc565b83811115610d205750506000910152565b600082516113f78184602087016113b9565b9190910192915050565b60208152600082518060208401526114208160408501602087016113b9565b601f01601f1916919091016040019291505056fea2646970667358221220dbb550799fdd2cd5cade32369bfd555a784229413cb4d441266e97ebe72f49e664736f6c634300080c00336080604052600060045560006005553480156200001b57600080fd5b50604051620013f6380380620013f68339810160408190526200003e91620000db565b60018055600280546001600160a01b03199081166001600160a01b0386811691909117909255600380548216858416179055600080549091169186169190911790556200009b8162015180620000a9602090811b62000ccf17901c565b600655506200015b92505050565b6000620000b782846200012d565b9392505050565b80516001600160a01b0381168114620000d657600080fd5b919050565b60008060008060808587031215620000f257600080fd5b620000fd85620000be565b93506200010d60208601620000be565b92506200011d60408601620000be565b6060959095015193969295505050565b60008160001904831182151516156200015657634e487b7160e01b600052601160045260246000fd5b500290565b61128b806200016b6000396000f3fe6080604052600436106101785760003560e01c806372f702f3116100cb578063c8f33c911161007f578063df136d6511610059578063df136d65146103df578063e9fad8ee146103f5578063ebe2b12b1461040a57600080fd5b8063c8f33c9114610394578063cd3daf9d146103aa578063d1af0c7d146103bf57600080fd5b806380faa57d116100b057806380faa57d1461033f5780638b87634714610354578063a694fc3a1461038157600080fd5b806372f702f3146103095780637b0a47ee1461032957600080fd5b80632e1a7d4d1161012d5780633d18b912116101075780633d18b912146102865780633fc6df6e1461029b57806370a08231146102d357600080fd5b80632e1a7d4d14610230578063386a9525146102505780633c6b16ab1461026657600080fd5b806318160ddd1161015e57806318160ddd146101e45780631c1f78eb146101f9578063236a38f71461020e57600080fd5b80628cc262146101845780630700037d146101b757600080fd5b3661017f57005b600080fd5b34801561019057600080fd5b506101a461019f3660046110d7565b610420565b6040519081526020015b60405180910390f35b3480156101c357600080fd5b506101a46101d23660046110d7565b600a6020526000908152604090205481565b3480156101f057600080fd5b50600b546101a4565b34801561020557600080fd5b506101a461049e565b34801561021a57600080fd5b5061022e6102293660046110d7565b6104bc565b005b34801561023c57600080fd5b5061022e61024b366004611100565b6106c3565b34801561025c57600080fd5b506101a460065481565b34801561027257600080fd5b5061022e610281366004611100565b6107f9565b34801561029257600080fd5b5061022e610a47565b3480156102a757600080fd5b506000546102bb906001600160a01b031681565b6040516001600160a01b0390911681526020016101ae565b3480156102df57600080fd5b506101a46102ee3660046110d7565b6001600160a01b03166000908152600c602052604090205490565b34801561031557600080fd5b506003546102bb906001600160a01b031681565b34801561033557600080fd5b506101a460055481565b34801561034b57600080fd5b506101a4610b2c565b34801561036057600080fd5b506101a461036f3660046110d7565b60096020526000908152604090205481565b61022e61038f366004611100565b610b3a565b3480156103a057600080fd5b506101a460075481565b3480156103b657600080fd5b506101a4610c62565b3480156103cb57600080fd5b506002546102bb906001600160a01b031681565b3480156103eb57600080fd5b506101a460085481565b34801561040157600080fd5b5061022e610cae565b34801561041657600080fd5b506101a460045481565b6001600160a01b0381166000908152600a60209081526040808320546009909252822054610498919061049290670de0b6b3a76400009061048c9061046d90610467610c62565b90610ce2565b6001600160a01b0388166000908152600c602052604090205490610ccf565b90610cee565b90610cfa565b92915050565b60006104b7600654600554610ccf90919063ffffffff16565b905090565b6104c4610d06565b6000546001600160a01b031633146105365760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b60648201526084015b60405180910390fd5b6004544210156105885760405162461bcd60e51b815260206004820181905260248201527f4e6f7420726561647920746f20776974686472617720454c2072657761726473604482015260640161052d565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156105d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f59190611119565b9050600b5481116106485760405162461bcd60e51b815260206004820152601f60248201527f4e6f20657874726120454c207265776172647320746f20776974686472617700604482015260640161052d565b6000600b54826106589190611148565b600354909150610672906001600160a01b03168483610d60565b826001600160a01b03167fbca5c314ed4bf159442030f0d4293bd6da1e7d20d5ea7c6da488ae3f899af500826040516106ad91815260200190565b60405180910390a250506106c060018055565b50565b6106cb610d06565b336106d4610c62565b6008556106df610b2c565b6007556001600160a01b03811615610726576106fa81610420565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600082116107765760405162461bcd60e51b815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015260640161052d565b600b546107839083610ce2565b600b55336000908152600c60205260409020546107a09083610ce2565b336000908152600c60205260409020556107b982610df5565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a2506106c060018055565b6000546001600160a01b031633146108665760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b606482015260840161052d565b6000610870610c62565b60085561087b610b2c565b6007556001600160a01b038116156108c25761089681610420565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60045442106108e1576006546108d9908390610cee565b600555610924565b6004546000906108f19042610ce2565b9050600061090a60055483610ccf90919063ffffffff16565b60065490915061091e9061048c8684610cfa565b60055550505b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611119565b90506109a860065482610cee90919063ffffffff16565b60055411156109f95760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f20686967680000000000000000604482015260640161052d565b426007819055600654610a0c9190610cfa565b6004556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b610a4f610d06565b33610a58610c62565b600855610a63610b2c565b6007556001600160a01b03811615610aaa57610a7e81610420565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a60205260409020548015610b1f57336000818152600a6020526040812055600254610ae9916001600160a01b039091169083610d60565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b5050610b2a60018055565b565b60006104b742600454610e0c565b610b42610d06565b33610b4b610c62565b600855610b56610b2c565b6007556001600160a01b03811615610b9d57610b7181610420565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610bed5760405162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015260640161052d565b600b54610bfa9083610cfa565b600b55336000908152600c6020526040902054610c179083610cfa565b336000908152600c6020526040902055610c3082610e22565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d906020016107e7565b6000600b5460001415610c76575060085490565b6104b7610ca5600b5461048c670de0b6b3a7640000610c9f600554610c9f600754610467610b2c565b90610ccf565b60085490610cfa565b336000908152600c6020526040902054610cc7906106c3565b610b2a610a47565b6000610cdb828461115f565b9392505050565b6000610cdb8284611148565b6000610cdb828461117e565b6000610cdb82846111a0565b60026001541415610d595760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161052d565b6002600155565b6040516001600160a01b038316602482015260448101829052610df090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610e3a565b505050565b6003546106c0906001600160a01b03163383610d60565b6000818310610e1b5781610cdb565b5090919050565b6003546106c0906001600160a01b0316333084610f0c565b6000610e8f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610f4a9092919063ffffffff16565b805190915015610df05780806020019051810190610ead91906111b8565b610df05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161052d565b6040516001600160a01b0380851660248301528316604482015260648101829052610f449085906323b872dd60e01b90608401610d8c565b50505050565b6060610f598484600085610f61565b949350505050565b606082471015610fc25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161052d565b600080866001600160a01b03168587604051610fde9190611206565b60006040518083038185875af1925050503d806000811461101b576040519150601f19603f3d011682016040523d82523d6000602084013e611020565b606091505b50915091506110318783838761103c565b979650505050505050565b606083156110a85782516110a1576001600160a01b0385163b6110a15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161052d565b5081610f59565b610f5983838151156110bd5781518083602001fd5b8060405162461bcd60e51b815260040161052d9190611222565b6000602082840312156110e957600080fd5b81356001600160a01b0381168114610cdb57600080fd5b60006020828403121561111257600080fd5b5035919050565b60006020828403121561112b57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561115a5761115a611132565b500390565b600081600019048311821515161561117957611179611132565b500290565b60008261119b57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156111b3576111b3611132565b500190565b6000602082840312156111ca57600080fd5b81518015158114610cdb57600080fd5b60005b838110156111f55781810151838201526020016111dd565b83811115610f445750506000910152565b600082516112188184602087016111da565b9190910192915050565b60208152600082518060208401526112418160408501602087016111da565b601f01601f1916919091016040019291505056fea2646970667358221220d18e5dafc1ea699ef03546a0816ac303799a5c479faefc49f2eeabaaae44feac64736f6c634300080c0033a2646970667358221220829df5625641e639c6e58eb0056f1e80add69438129de92bb53251ec2d4cf87e64736f6c634300080c0033000000000000000000000000fac77a24e52b463ba9857d6b758ba41ae20e31ff000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100d45760003560e01c8063ab5777db11610081578063eb7f8f241161005b578063eb7f8f2414610198578063f2fde38b14610201578063f9ea29cb1461021457600080fd5b8063ab5777db1461015d578063d1af0c7d14610170578063da1d111b1461018357600080fd5b80637e4b02d5116100b25780637e4b02d5146101265780638da5cb5b14610139578063a9fc507b1461014a57600080fd5b8063344e5e34146100d957806367c81f6514610109578063715018a61461011e575b600080fd5b6100ec6100e7366004610bb2565b610227565b6040516001600160a01b0390911681526020015b60405180910390f35b61011c610117366004610be7565b610251565b005b61011c610599565b6100ec610134366004610c1a565b6105ad565b6000546001600160a01b03166100ec565b61011c610158366004610c35565b61064f565b61011c61016b366004610c5f565b6108bb565b6001546100ec906001600160a01b031681565b61018b6109fe565b6040516101009190610c92565b6101d76101a6366004610c1a565b60046020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610100565b61011c61020f366004610c1a565b610a60565b6002546100ec906001600160a01b031681565b6003818154811061023757600080fd5b6000918252602090912001546001600160a01b0316905081565b610259610ad9565b6001600160a01b0380841660009081526004602052604090208054909116156102ef5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201527f616c7265616479206465706c6f7965640000000000000000000000000000000060648201526084015b60405180910390fd5b428310156103655760405162461bcd60e51b815260206004820152602e60248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201527f737461727420746f6f20736f6f6e00000000000000000000000000000000000060648201526084016102e6565b600082116103db5760405162461bcd60e51b815260206004820152603260248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201527f6475726174696f6e20746f6f2073686f7274000000000000000000000000000060648201526084016102e6565b6001600160a01b0384166104715760015460025460405130926001600160a01b03908116921690859061040d90610b96565b6001600160a01b0394851681529284166020840152921660408201526060810191909152608001604051809103906000f080158015610450573d6000803e3d6000fd5b5081546001600160a01b0319166001600160a01b03919091161781556104f0565b60015460405130916001600160a01b0316908690859061049090610ba4565b6001600160a01b0394851681529284166020840152921660408201526060810191909152608001604051809103906000f0801580156104d3573d6000803e3d6000fd5b5081546001600160a01b0319166001600160a01b03919091161781555b600181810184905560028201839055600060038084018290558054928301815590527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0386811691821790925582546040805187815260208101879052929391909116917f489ab9065c597368f4a678fadcb323bf4c848713ea7d5a296d16ec97203eae83910160405180910390a350505050565b6105a1610ad9565b6105ab6000610b33565b565b6001600160a01b0380821660009081526004602052604081208054919290911661063f5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a676574506f6f6c416464726560448201527f73733a206e6f74206465706c6f7965640000000000000000000000000000000060648201526084016102e6565b546001600160a01b031692915050565b610657610ad9565b6001600160a01b03808316600090815260046020526040902080549091166106e75760405162461bcd60e51b815260206004820152602c60248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a2060448201527f6e6f74206465706c6f796564000000000000000000000000000000000000000060648201526084016102e6565b806001015442101561074d5760405162461bcd60e51b815260206004820152602960248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a206044820152686e6f7420726561647960b81b60648201526084016102e6565b81156108b65760038101546107629083610b83565b600382015560015481546040516323b872dd60e01b81523360048201526001600160a01b039182166024820152604481018590529116906323b872dd906064016020604051808303816000875af11580156107c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e59190610cdf565b6108575760405162461bcd60e51b815260206004820152602f60248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a2060448201527f7472616e73666572206661696c6564000000000000000000000000000000000060648201526084016102e6565b8054604051633c6b16ab60e01b8152600481018490526001600160a01b0390911690633c6b16ab906024015b600060405180830381600087803b15801561089d57600080fd5b505af11580156108b1573d6000803e3d6000fd5b505050505b505050565b6108c3610ad9565b6001600160a01b03808316600090815260046020526040902080549091166109535760405162461bcd60e51b815260206004820152603360248201527f5374616b696e67506f6f6c466163746f72793a3a7769746864726177454c526560448201527f77617264733a206e6f74206465706c6f7965640000000000000000000000000060648201526084016102e6565b80600101544210156109cd5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a7769746864726177454c526560448201527f77617264733a206e6f742072656164790000000000000000000000000000000060648201526084016102e6565b805460405163236a38f760e01b81526001600160a01b0384811660048301529091169063236a38f790602401610883565b60606003805480602002602001604051908101604052809291908181526020018280548015610a5657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a38575b5050505050905090565b610a68610ad9565b6001600160a01b038116610acd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102e6565b610ad681610b33565b50565b6000546001600160a01b031633146105ab5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102e6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610b8f8284610d01565b9392505050565b6115fd8062000d2883390190565b6113f6806200232583390190565b600060208284031215610bc457600080fd5b5035919050565b80356001600160a01b0381168114610be257600080fd5b919050565b600080600060608486031215610bfc57600080fd5b610c0584610bcb565b95602085013595506040909401359392505050565b600060208284031215610c2c57600080fd5b610b8f82610bcb565b60008060408385031215610c4857600080fd5b610c5183610bcb565b946020939093013593505050565b60008060408385031215610c7257600080fd5b610c7b83610bcb565b9150610c8960208401610bcb565b90509250929050565b6020808252825182820181905260009190848201906040850190845b81811015610cd35783516001600160a01b031683529284019291840191600101610cae565b50909695505050505050565b600060208284031215610cf157600080fd5b81518015158114610b8f57600080fd5b60008219821115610d2257634e487b7160e01b600052601160045260246000fd5b50019056fe6080604052600060045560006005553480156200001b57600080fd5b50604051620015fd380380620015fd8339810160408190526200003e9162000103565b60018055600280546001600160a01b03199081166001600160a01b038681169190911790925560038054821685841617905560008054909116918616919091179055838383836200009f8162015180620000d1602090811b62000c5c17901c565b6006555050600d80546001600160a01b0319166001600160a01b03959095169490941790935550620001839350505050565b6000620000df828462000155565b9392505050565b80516001600160a01b0381168114620000fe57600080fd5b919050565b600080600080608085870312156200011a57600080fd5b6200012585620000e6565b93506200013560208601620000e6565b92506200014560408601620000e6565b6060959095015193969295505050565b60008160001904831182151516156200017e57634e487b7160e01b600052601160045260246000fd5b500290565b61146a80620001936000396000f3fe6080604052600436106101835760003560e01c806370a08231116100d6578063c8f33c911161007f578063df136d6511610059578063df136d651461040a578063e9fad8ee14610420578063ebe2b12b1461043557600080fd5b8063c8f33c91146103bf578063cd3daf9d146103d5578063d1af0c7d146103ea57600080fd5b806380faa57d116100b057806380faa57d1461036a5780638b8763471461037f578063a694fc3a146103ac57600080fd5b806370a08231146102fe57806372f702f3146103345780637b0a47ee1461035457600080fd5b80632e1a7d4d116101385780633d18b912116101125780633d18b912146102915780633fc6df6e146102a65780633fc8cef3146102de57600080fd5b80632e1a7d4d1461023b578063386a95251461025b5780633c6b16ab1461027157600080fd5b806318160ddd1161016957806318160ddd146101ef5780631c1f78eb14610204578063236a38f71461021957600080fd5b80628cc2621461018f5780630700037d146101c257600080fd5b3661018a57005b600080fd5b34801561019b57600080fd5b506101af6101aa3660046112b6565b61044b565b6040519081526020015b60405180910390f35b3480156101ce57600080fd5b506101af6101dd3660046112b6565b600a6020526000908152604090205481565b3480156101fb57600080fd5b50600b546101af565b34801561021057600080fd5b506101af6104c9565b34801561022557600080fd5b506102396102343660046112b6565b6104e7565b005b34801561024757600080fd5b506102396102563660046112df565b61065e565b34801561026757600080fd5b506101af60065481565b34801561027d57600080fd5b5061023961028c3660046112df565b610786565b34801561029d57600080fd5b506102396109d4565b3480156102b257600080fd5b506000546102c6906001600160a01b031681565b6040516001600160a01b0390911681526020016101b9565b3480156102ea57600080fd5b50600d546102c6906001600160a01b031681565b34801561030a57600080fd5b506101af6103193660046112b6565b6001600160a01b03166000908152600c602052604090205490565b34801561034057600080fd5b506003546102c6906001600160a01b031681565b34801561036057600080fd5b506101af60055481565b34801561037657600080fd5b506101af610ab9565b34801561038b57600080fd5b506101af61039a3660046112b6565b60096020526000908152604090205481565b6102396103ba3660046112df565b610ac7565b3480156103cb57600080fd5b506101af60075481565b3480156103e157600080fd5b506101af610bef565b3480156103f657600080fd5b506002546102c6906001600160a01b031681565b34801561041657600080fd5b506101af60085481565b34801561042c57600080fd5b50610239610c3b565b34801561044157600080fd5b506101af60045481565b6001600160a01b0381166000908152600a602090815260408083205460099092528220546104c391906104bd90670de0b6b3a7640000906104b79061049890610492610bef565b90610c6f565b6001600160a01b0388166000908152600c602052604090205490610c5c565b90610c7b565b90610c87565b92915050565b60006104e2600654600554610c5c90919063ffffffff16565b905090565b6104ef610c93565b6000546001600160a01b031633146105615760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b60648201526084015b60405180910390fd5b6004544210156105b35760405162461bcd60e51b815260206004820181905260248201527f4e6f7420726561647920746f20776974686472617720454c20726577617264736044820152606401610558565b47806106015760405162461bcd60e51b815260206004820152601f60248201527f4e6f20657874726120454c207265776172647320746f207769746864726177006044820152606401610558565b61060e6000308484610ced565b816001600160a01b03167fbca5c314ed4bf159442030f0d4293bd6da1e7d20d5ea7c6da488ae3f899af5008260405161064991815260200190565b60405180910390a25061065b60018055565b50565b610666610c93565b3361066f610bef565b60085561067a610ab9565b6007556001600160a01b038116156106c1576106958161044b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600082116107115760405162461bcd60e51b815260206004820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152606401610558565b600b5461071e9083610c6f565b600b55336000908152600c602052604090205461073b9083610c6f565b336000908152600c602052604090205561075482610d26565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d590602001610649565b6000546001600160a01b031633146107f35760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b6064820152608401610558565b60006107fd610bef565b600855610808610ab9565b6007556001600160a01b0381161561084f576108238161044b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600454421061086e57600654610866908390610c7b565b6005556108b1565b60045460009061087e9042610c6f565b9050600061089760055483610c5c90919063ffffffff16565b6006549091506108ab906104b78684610c87565b60055550505b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156108fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091e91906112f8565b905061093560065482610c7b90919063ffffffff16565b60055411156109865760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152606401610558565b4260078190556006546109999190610c87565b6004556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b6109dc610c93565b336109e5610bef565b6008556109f0610ab9565b6007556001600160a01b03811615610a3757610a0b8161044b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a60205260409020548015610aac57336000818152600a6020526040812055600254610a76916001600160a01b039091169083610d91565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b5050610ab760018055565b565b60006104e242600454610e26565b610acf610c93565b33610ad8610bef565b600855610ae3610ab9565b6007556001600160a01b03811615610b2a57610afe8161044b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610b7a5760405162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b6520300000000000000000000000000000000000006044820152606401610558565b600b54610b879083610c87565b600b55336000908152600c6020526040902054610ba49083610c87565b336000908152600c6020526040902055610bbd82610e3c565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610649565b6000600b5460001415610c03575060085490565b6104e2610c32600b546104b7670de0b6b3a7640000610c2c600554610c2c600754610492610ab9565b90610c5c565b60085490610c87565b336000908152600c6020526040902054610c549061065e565b610ab76109d4565b6000610c688284611327565b9392505050565b6000610c688284611346565b6000610c68828461135d565b6000610c68828461137f565b60026001541415610ce65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610558565b6002600155565b80610cf757610d20565b6001600160a01b038416610d1457610d0f8282610f23565b610d20565b610d2084848484610fc6565b50505050565b600d54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015610d6c57600080fd5b505af1158015610d80573d6000803e3d6000fd5b5050505061065b6000303384610ced565b6040516001600160a01b038316602482015260448101829052610e2190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261101f565b505050565b6000818310610e355781610c68565b5090919050565b80341015610e8c5760405162461bcd60e51b815260206004820152601060248201527f4e6f7420656e6f7567682076616c7565000000000000000000000000000000006044820152606401610558565b600d60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015610edc57600080fd5b505af1158015610ef0573d6000803e3d6000fd5b50505050506000610f0a8234610c6f90919063ffffffff16565b90508015610f1f57610f1f6000303384610ced565b5050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f70576040519150601f19603f3d011682016040523d82523d6000602084013e610f75565b606091505b5050905080610e215760405162461bcd60e51b815260206004820152601c60248201527f4e617469766520746f6b656e207472616e73666572206661696c6564000000006044820152606401610558565b816001600160a01b0316836001600160a01b03161415610fe557610d20565b6001600160a01b03831630141561100a57610d0f6001600160a01b0385168383610d91565b610d206001600160a01b0385168484846110f1565b6000611074826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111299092919063ffffffff16565b805190915015610e2157808060200190518101906110929190611397565b610e215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610558565b6040516001600160a01b0380851660248301528316604482015260648101829052610d209085906323b872dd60e01b90608401610dbd565b60606111388484600085611140565b949350505050565b6060824710156111a15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610558565b600080866001600160a01b031685876040516111bd91906113e5565b60006040518083038185875af1925050503d80600081146111fa576040519150601f19603f3d011682016040523d82523d6000602084013e6111ff565b606091505b50915091506112108783838761121b565b979650505050505050565b60608315611287578251611280576001600160a01b0385163b6112805760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610558565b5081611138565b611138838381511561129c5781518083602001fd5b8060405162461bcd60e51b81526004016105589190611401565b6000602082840312156112c857600080fd5b81356001600160a01b0381168114610c6857600080fd5b6000602082840312156112f157600080fd5b5035919050565b60006020828403121561130a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561134157611341611311565b500290565b60008282101561135857611358611311565b500390565b60008261137a57634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561139257611392611311565b500190565b6000602082840312156113a957600080fd5b81518015158114610c6857600080fd5b60005b838110156113d45781810151838201526020016113bc565b83811115610d205750506000910152565b600082516113f78184602087016113b9565b9190910192915050565b60208152600082518060208401526114208160408501602087016113b9565b601f01601f1916919091016040019291505056fea2646970667358221220dbb550799fdd2cd5cade32369bfd555a784229413cb4d441266e97ebe72f49e664736f6c634300080c00336080604052600060045560006005553480156200001b57600080fd5b50604051620013f6380380620013f68339810160408190526200003e91620000db565b60018055600280546001600160a01b03199081166001600160a01b0386811691909117909255600380548216858416179055600080549091169186169190911790556200009b8162015180620000a9602090811b62000ccf17901c565b600655506200015b92505050565b6000620000b782846200012d565b9392505050565b80516001600160a01b0381168114620000d657600080fd5b919050565b60008060008060808587031215620000f257600080fd5b620000fd85620000be565b93506200010d60208601620000be565b92506200011d60408601620000be565b6060959095015193969295505050565b60008160001904831182151516156200015657634e487b7160e01b600052601160045260246000fd5b500290565b61128b806200016b6000396000f3fe6080604052600436106101785760003560e01c806372f702f3116100cb578063c8f33c911161007f578063df136d6511610059578063df136d65146103df578063e9fad8ee146103f5578063ebe2b12b1461040a57600080fd5b8063c8f33c9114610394578063cd3daf9d146103aa578063d1af0c7d146103bf57600080fd5b806380faa57d116100b057806380faa57d1461033f5780638b87634714610354578063a694fc3a1461038157600080fd5b806372f702f3146103095780637b0a47ee1461032957600080fd5b80632e1a7d4d1161012d5780633d18b912116101075780633d18b912146102865780633fc6df6e1461029b57806370a08231146102d357600080fd5b80632e1a7d4d14610230578063386a9525146102505780633c6b16ab1461026657600080fd5b806318160ddd1161015e57806318160ddd146101e45780631c1f78eb146101f9578063236a38f71461020e57600080fd5b80628cc262146101845780630700037d146101b757600080fd5b3661017f57005b600080fd5b34801561019057600080fd5b506101a461019f3660046110d7565b610420565b6040519081526020015b60405180910390f35b3480156101c357600080fd5b506101a46101d23660046110d7565b600a6020526000908152604090205481565b3480156101f057600080fd5b50600b546101a4565b34801561020557600080fd5b506101a461049e565b34801561021a57600080fd5b5061022e6102293660046110d7565b6104bc565b005b34801561023c57600080fd5b5061022e61024b366004611100565b6106c3565b34801561025c57600080fd5b506101a460065481565b34801561027257600080fd5b5061022e610281366004611100565b6107f9565b34801561029257600080fd5b5061022e610a47565b3480156102a757600080fd5b506000546102bb906001600160a01b031681565b6040516001600160a01b0390911681526020016101ae565b3480156102df57600080fd5b506101a46102ee3660046110d7565b6001600160a01b03166000908152600c602052604090205490565b34801561031557600080fd5b506003546102bb906001600160a01b031681565b34801561033557600080fd5b506101a460055481565b34801561034b57600080fd5b506101a4610b2c565b34801561036057600080fd5b506101a461036f3660046110d7565b60096020526000908152604090205481565b61022e61038f366004611100565b610b3a565b3480156103a057600080fd5b506101a460075481565b3480156103b657600080fd5b506101a4610c62565b3480156103cb57600080fd5b506002546102bb906001600160a01b031681565b3480156103eb57600080fd5b506101a460085481565b34801561040157600080fd5b5061022e610cae565b34801561041657600080fd5b506101a460045481565b6001600160a01b0381166000908152600a60209081526040808320546009909252822054610498919061049290670de0b6b3a76400009061048c9061046d90610467610c62565b90610ce2565b6001600160a01b0388166000908152600c602052604090205490610ccf565b90610cee565b90610cfa565b92915050565b60006104b7600654600554610ccf90919063ffffffff16565b905090565b6104c4610d06565b6000546001600160a01b031633146105365760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b60648201526084015b60405180910390fd5b6004544210156105885760405162461bcd60e51b815260206004820181905260248201527f4e6f7420726561647920746f20776974686472617720454c2072657761726473604482015260640161052d565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156105d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f59190611119565b9050600b5481116106485760405162461bcd60e51b815260206004820152601f60248201527f4e6f20657874726120454c207265776172647320746f20776974686472617700604482015260640161052d565b6000600b54826106589190611148565b600354909150610672906001600160a01b03168483610d60565b826001600160a01b03167fbca5c314ed4bf159442030f0d4293bd6da1e7d20d5ea7c6da488ae3f899af500826040516106ad91815260200190565b60405180910390a250506106c060018055565b50565b6106cb610d06565b336106d4610c62565b6008556106df610b2c565b6007556001600160a01b03811615610726576106fa81610420565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600082116107765760405162461bcd60e51b815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015260640161052d565b600b546107839083610ce2565b600b55336000908152600c60205260409020546107a09083610ce2565b336000908152600c60205260409020556107b982610df5565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a2506106c060018055565b6000546001600160a01b031633146108665760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b606482015260840161052d565b6000610870610c62565b60085561087b610b2c565b6007556001600160a01b038116156108c25761089681610420565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60045442106108e1576006546108d9908390610cee565b600555610924565b6004546000906108f19042610ce2565b9050600061090a60055483610ccf90919063ffffffff16565b60065490915061091e9061048c8684610cfa565b60055550505b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611119565b90506109a860065482610cee90919063ffffffff16565b60055411156109f95760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f20686967680000000000000000604482015260640161052d565b426007819055600654610a0c9190610cfa565b6004556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b610a4f610d06565b33610a58610c62565b600855610a63610b2c565b6007556001600160a01b03811615610aaa57610a7e81610420565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a60205260409020548015610b1f57336000818152600a6020526040812055600254610ae9916001600160a01b039091169083610d60565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b5050610b2a60018055565b565b60006104b742600454610e0c565b610b42610d06565b33610b4b610c62565b600855610b56610b2c565b6007556001600160a01b03811615610b9d57610b7181610420565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610bed5760405162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015260640161052d565b600b54610bfa9083610cfa565b600b55336000908152600c6020526040902054610c179083610cfa565b336000908152600c6020526040902055610c3082610e22565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d906020016107e7565b6000600b5460001415610c76575060085490565b6104b7610ca5600b5461048c670de0b6b3a7640000610c9f600554610c9f600754610467610b2c565b90610ccf565b60085490610cfa565b336000908152600c6020526040902054610cc7906106c3565b610b2a610a47565b6000610cdb828461115f565b9392505050565b6000610cdb8284611148565b6000610cdb828461117e565b6000610cdb82846111a0565b60026001541415610d595760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161052d565b6002600155565b6040516001600160a01b038316602482015260448101829052610df090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610e3a565b505050565b6003546106c0906001600160a01b03163383610d60565b6000818310610e1b5781610cdb565b5090919050565b6003546106c0906001600160a01b0316333084610f0c565b6000610e8f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610f4a9092919063ffffffff16565b805190915015610df05780806020019051810190610ead91906111b8565b610df05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161052d565b6040516001600160a01b0380851660248301528316604482015260648101829052610f449085906323b872dd60e01b90608401610d8c565b50505050565b6060610f598484600085610f61565b949350505050565b606082471015610fc25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161052d565b600080866001600160a01b03168587604051610fde9190611206565b60006040518083038185875af1925050503d806000811461101b576040519150601f19603f3d011682016040523d82523d6000602084013e611020565b606091505b50915091506110318783838761103c565b979650505050505050565b606083156110a85782516110a1576001600160a01b0385163b6110a15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161052d565b5081610f59565b610f5983838151156110bd5781518083602001fd5b8060405162461bcd60e51b815260040161052d9190611222565b6000602082840312156110e957600080fd5b81356001600160a01b0381168114610cdb57600080fd5b60006020828403121561111257600080fd5b5035919050565b60006020828403121561112b57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561115a5761115a611132565b500390565b600081600019048311821515161561117957611179611132565b500290565b60008261119b57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156111b3576111b3611132565b500190565b6000602082840312156111ca57600080fd5b81518015158114610cdb57600080fd5b60005b838110156111f55781810151838201526020016111dd565b83811115610f445750506000910152565b600082516112188184602087016111da565b9190910192915050565b60208152600082518060208401526112418160408501602087016111da565b601f01601f1916919091016040019291505056fea2646970667358221220d18e5dafc1ea699ef03546a0816ac303799a5c479faefc49f2eeabaaae44feac64736f6c634300080c0033a2646970667358221220829df5625641e639c6e58eb0056f1e80add69438129de92bb53251ec2d4cf87e64736f6c634300080c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000fac77a24e52b463ba9857d6b758ba41ae20e31ff000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
-----Decoded View---------------
Arg [0] : _rewardsToken (address): 0xfAC77A24E52B463bA9857d6b758ba41aE20e31FF
Arg [1] : _nativeTokenWrapper (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000fac77a24e52b463ba9857d6b758ba41ae20e31ff
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
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.