ETH Price: $2,580.12 (-16.86%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...170585622023-04-16 9:26:23659 days ago1681637183IN
0xE4a51EC5...532B584ed
0 ETH0.0006742723.53895886
Add Rewards170376762023-04-13 9:15:47662 days ago1681377347IN
0xE4a51EC5...532B584ed
0 ETH0.0094868354.11398111
Add Rewards170376762023-04-13 9:15:47662 days ago1681377347IN
0xE4a51EC5...532B584ed
0 ETH0.0097465754.11398111
Add Rewards170376762023-04-13 9:15:47662 days ago1681377347IN
0xE4a51EC5...532B584ed
0 ETH0.0097465754.11398111
Add Rewards170376732023-04-13 9:15:11662 days ago1681377311IN
0xE4a51EC5...532B584ed
0 ETH0.0095953753.27449728
Add Rewards170376712023-04-13 9:14:47662 days ago1681377287IN
0xE4a51EC5...532B584ed
0 ETH0.0055049656.5121801
Add Rewards170376702023-04-13 9:14:35662 days ago1681377275IN
0xE4a51EC5...532B584ed
0 ETH0.0051467654.53001144
Deploy Pool170357922023-04-13 2:05:35662 days ago1681351535IN
0xE4a51EC5...532B584ed
0 ETH0.0349397229.58426375
Deploy Pool170357902023-04-13 2:05:11662 days ago1681351511IN
0xE4a51EC5...532B584ed
0 ETH0.0311399926.36694415
Deploy Pool170357892023-04-13 2:04:47662 days ago1681351487IN
0xE4a51EC5...532B584ed
0 ETH0.0317272126.86415795
Deploy Pool170357872023-04-13 2:04:23662 days ago1681351463IN
0xE4a51EC5...532B584ed
0 ETH0.0327726227.74932952
Add Rewards170168172023-04-10 9:08:11665 days ago1681117691IN
0xE4a51EC5...532B584ed
0 ETH0.0020938519.8484259
Add Rewards170168102023-04-10 9:06:47665 days ago1681117607IN
0xE4a51EC5...532B584ed
0 ETH0.0032732818.19662432
Add Rewards170168092023-04-10 9:06:35665 days ago1681117595IN
0xE4a51EC5...532B584ed
0 ETH0.0033522618.61460763
Deploy Pool170157612023-04-10 5:33:47665 days ago1681104827IN
0xE4a51EC5...532B584ed
0 ETH0.0303258825.68470778
Deploy Pool170157592023-04-10 5:33:23665 days ago1681104803IN
0xE4a51EC5...532B584ed
0 ETH0.035261227.26302091

Latest 9 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
171212762023-04-25 5:43:35650 days ago1682401415
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
171147402023-04-24 7:44:11651 days ago1682322251
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
171002632023-04-22 7:01:23653 days ago1682146883
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
170357922023-04-13 2:05:35662 days ago1681351535
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
170357902023-04-13 2:05:11662 days ago1681351511
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
170357892023-04-13 2:04:47662 days ago1681351487
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
170357872023-04-13 2:04:23662 days ago1681351463
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
170157612023-04-10 5:33:47665 days ago1681104827
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
170157592023-04-10 5:33:23665 days ago1681104803
0xE4a51EC5...532B584ed
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StakingPoolFactory

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : StakingPoolFactory.sol
// 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);
    }
  }

}

File 2 of 20 : draft-IERC20PermitUpgradeable.sol
// 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);
}

File 3 of 20 : IERC20Upgradeable.sol
// 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);
}

File 4 of 20 : SafeERC20Upgradeable.sol
// 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");
        }
    }
}

File 5 of 20 : AddressUpgradeable.sol
// 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);
        }
    }
}

File 6 of 20 : Ownable.sol
// 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);
    }
}

File 7 of 20 : ReentrancyGuard.sol
// 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;
    }
}

File 8 of 20 : draft-IERC20Permit.sol
// 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);
}

File 9 of 20 : IERC20.sol
// 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);
}

File 10 of 20 : SafeERC20.sol
// 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");
        }
    }
}

File 11 of 20 : Address.sol
// 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);
        }
    }
}

File 12 of 20 : Context.sol
// 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;
    }
}

File 13 of 20 : Math.sol
// 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);
        }
    }
}

File 14 of 20 : SafeMath.sol
// 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;
        }
    }
}

File 15 of 20 : EthStakingPool.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;
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 {
    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);
  }

}

File 16 of 20 : IStakingPool.sol
// 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;
}

File 17 of 20 : IWETH.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;

interface IWETH {
  function deposit() external payable;
  
  function withdraw(uint wad) external;
}

File 18 of 20 : CurrencyTransferLib.sol
// 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);
    }
  }
}

File 19 of 20 : RewardsDistributionRecipient.sol
// 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");
    _;
  }
}

File 20 of 20 : StakingPool.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;
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);
    _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);
}

Settings
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"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"}]

608060405234801561001057600080fd5b506040516135f23803806135f283398101604081905261002f916100d5565b61003833610069565b600180546001600160a01b039384166001600160a01b03199182161790915560028054929093169116179055610108565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100d057600080fd5b919050565b600080604083850312156100e857600080fd5b6100f1836100b9565b91506100ff602084016100b9565b90509250929050565b6134db806101176000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063ab5777db11610071578063ab5777db1461013d578063d1af0c7d14610150578063da1d111b14610163578063eb7f8f2414610178578063f2fde38b146101e1578063f9ea29cb146101f457600080fd5b8063344e5e34146100b957806367c81f65146100e9578063715018a6146100fe5780637e4b02d5146101065780638da5cb5b14610119578063a9fc507b1461012a575b600080fd5b6100cc6100c7366004610b28565b610207565b6040516001600160a01b0390911681526020015b60405180910390f35b6100fc6100f7366004610b5d565b610231565b005b6100fc610552565b6100cc610114366004610b90565b610566565b6000546001600160a01b03166100cc565b6100fc610138366004610bab565b6105fb565b6100fc61014b366004610bd5565b610848565b6001546100cc906001600160a01b031681565b61016b610974565b6040516100e09190610c08565b6101b7610186366004610b90565b60046020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b604080516001600160a01b03909516855260208501939093529183015260608201526080016100e0565b6100fc6101ef366004610b90565b6109d6565b6002546100cc906001600160a01b031681565b6003818154811061021757600080fd5b6000918252602090912001546001600160a01b0316905081565b610239610a4f565b6001600160a01b0380841660009081526004602052604090208054909116156102c25760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201526f185b1c9958591e4819195c1b1bde595960821b60648201526084015b60405180910390fd5b428310156103295760405162461bcd60e51b815260206004820152602e60248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201526d39ba30b93a103a37b79039b7b7b760911b60648201526084016102b9565b600082116103945760405162461bcd60e51b815260206004820152603260248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a20604482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b60648201526084016102b9565b6001600160a01b03841661042a5760015460025460405130926001600160a01b0390811692169085906103c690610b0e565b6001600160a01b0394851681529284166020840152921660408201526060810191909152608001604051809103906000f080158015610409573d6000803e3d6000fd5b5081546001600160a01b0319166001600160a01b03919091161781556104a9565b60015460405130916001600160a01b0316908690859061044990610b1b565b6001600160a01b0394851681529284166020840152921660408201526060810191909152608001604051809103906000f08015801561048c573d6000803e3d6000fd5b5081546001600160a01b0319166001600160a01b03919091161781555b600181810184905560028201839055600060038084018290558054928301815590527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0386811691821790925582546040805187815260208101879052929391909116917f489ab9065c597368f4a678fadcb323bf4c848713ea7d5a296d16ec97203eae83910160405180910390a350505050565b61055a610a4f565b6105646000610aa9565b565b6001600160a01b038082166000908152600460205260408120805491929091166105eb5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a676574506f6f6c416464726560448201526f1cdcce881b9bdd0819195c1b1bde595960821b60648201526084016102b9565b546001600160a01b031692915050565b610603610a4f565b6001600160a01b03808316600090815260046020526040902080549091166106825760405162461bcd60e51b815260206004820152602c60248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a2060448201526b1b9bdd0819195c1b1bde595960a21b60648201526084016102b9565b80600101544210156106e85760405162461bcd60e51b815260206004820152602960248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a206044820152686e6f7420726561647960b81b60648201526084016102b9565b81156108435760038101546106fd9083610af9565b600382015560015481546040516323b872dd60e01b81523360048201526001600160a01b039182166024820152604481018590529116906323b872dd906064016020604051808303816000875af115801561075c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107809190610c55565b6107e45760405162461bcd60e51b815260206004820152602f60248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a2060448201526e1d1c985b9cd9995c8819985a5b1959608a1b60648201526084016102b9565b8054604051633c6b16ab60e01b8152600481018490526001600160a01b0390911690633c6b16ab906024015b600060405180830381600087803b15801561082a57600080fd5b505af115801561083e573d6000803e3d6000fd5b505050505b505050565b610850610a4f565b6001600160a01b03808316600090815260046020526040902080549091166108d65760405162461bcd60e51b815260206004820152603360248201527f5374616b696e67506f6f6c466163746f72793a3a7769746864726177454c52656044820152721dd85c991cce881b9bdd0819195c1b1bde5959606a1b60648201526084016102b9565b80600101544210156109435760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a7769746864726177454c526560448201526f77617264733a206e6f7420726561647960801b60648201526084016102b9565b805460405163236a38f760e01b81526001600160a01b0384811660048301529091169063236a38f790602401610810565b606060038054806020026020016040519081016040528092919081815260200182805480156109cc57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116109ae575b5050505050905090565b6109de610a4f565b6001600160a01b038116610a435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102b9565b610a4c81610aa9565b50565b6000546001600160a01b031633146105645760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102b9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610b058284610c7e565b90505b92915050565b6114fb80610ca083390190565b61130b8061219b83390190565b600060208284031215610b3a57600080fd5b5035919050565b80356001600160a01b0381168114610b5857600080fd5b919050565b600080600060608486031215610b7257600080fd5b610b7b84610b41565b95602085013595506040909401359392505050565b600060208284031215610ba257600080fd5b610b0582610b41565b60008060408385031215610bbe57600080fd5b610bc783610b41565b946020939093013593505050565b60008060408385031215610be857600080fd5b610bf183610b41565b9150610bff60208401610b41565b90509250929050565b6020808252825182820181905260009190848201906040850190845b81811015610c495783516001600160a01b031683529284019291840191600101610c24565b50909695505050505050565b600060208284031215610c6757600080fd5b81518015158114610c7757600080fd5b9392505050565b80820180821115610b0857634e487b7160e01b600052601160045260246000fdfe6080604052600060045560006005553480156200001b57600080fd5b50604051620014fb380380620014fb8339810160408190526200003e91620000f8565b60018055600280546001600160a01b038086166001600160a01b03199283161790925560038054838616908316179055600080549287169290911691909117905583838383620000928162015180620000c4565b6006555050600d80546001600160a01b0319166001600160a01b03959095169490941790935550620001709350505050565b6000620000d282846200014a565b90505b92915050565b80516001600160a01b0381168114620000f357600080fd5b919050565b600080600080608085870312156200010f57600080fd5b6200011a85620000db565b93506200012a60208601620000db565b92506200013a60408601620000db565b6060959095015193969295505050565b8082028115828204841417620000d557634e487b7160e01b600052601160045260246000fd5b61137b80620001806000396000f3fe6080604052600436106101435760003560e01c806370a08231116100b6578063c8f33c911161006f578063c8f33c911461037f578063cd3daf9d14610395578063d1af0c7d146103aa578063df136d65146103ca578063e9fad8ee146103e0578063ebe2b12b146103f557600080fd5b806370a08231146102be57806372f702f3146102f45780637b0a47ee1461031457806380faa57d1461032a5780638b8763471461033f578063a694fc3a1461036c57600080fd5b80632e1a7d4d116101085780632e1a7d4d146101fb578063386a95251461021b5780633c6b16ab146102315780633d18b912146102515780633fc6df6e146102665780633fc8cef31461029e57600080fd5b80628cc2621461014f5780630700037d1461018257806318160ddd146101af5780631c1f78eb146101c4578063236a38f7146101d957600080fd5b3661014a57005b600080fd5b34801561015b57600080fd5b5061016f61016a366004611196565b61040b565b6040519081526020015b60405180910390f35b34801561018e57600080fd5b5061016f61019d366004611196565b600a6020526000908152604090205481565b3480156101bb57600080fd5b50600b5461016f565b3480156101d057600080fd5b5061016f610489565b3480156101e557600080fd5b506101f96101f4366004611196565b6104a7565b005b34801561020757600080fd5b506101f96102163660046111bf565b6105df565b34801561022757600080fd5b5061016f60065481565b34801561023d57600080fd5b506101f961024c3660046111bf565b6106fb565b34801561025d57600080fd5b506101f9610906565b34801561027257600080fd5b50600054610286906001600160a01b031681565b6040516001600160a01b039091168152602001610179565b3480156102aa57600080fd5b50600d54610286906001600160a01b031681565b3480156102ca57600080fd5b5061016f6102d9366004611196565b6001600160a01b03166000908152600c602052604090205490565b34801561030057600080fd5b50600354610286906001600160a01b031681565b34801561032057600080fd5b5061016f60055481565b34801561033657600080fd5b5061016f6109eb565b34801561034b57600080fd5b5061016f61035a366004611196565b60096020526000908152604090205481565b6101f961037a3660046111bf565b6109f9565b34801561038b57600080fd5b5061016f60075481565b3480156103a157600080fd5b5061016f610b12565b3480156103b657600080fd5b50600254610286906001600160a01b031681565b3480156103d657600080fd5b5061016f60085481565b3480156103ec57600080fd5b506101f9610b5d565b34801561040157600080fd5b5061016f60045481565b6001600160a01b0381166000908152600a60209081526040808320546009909252822054610483919061047d90670de0b6b3a7640000906104779061045890610452610b12565b90610b7e565b6001600160a01b0388166000908152600c602052604090205490610b91565b90610b9d565b90610ba9565b92915050565b60006104a2600654600554610b9190919063ffffffff16565b905090565b6104af610bb5565b6000546001600160a01b031633146104e25760405162461bcd60e51b81526004016104d9906111d8565b60405180910390fd5b6004544210156105345760405162461bcd60e51b815260206004820181905260248201527f4e6f7420726561647920746f20776974686472617720454c207265776172647360448201526064016104d9565b47806105825760405162461bcd60e51b815260206004820152601f60248201527f4e6f20657874726120454c207265776172647320746f2077697468647261770060448201526064016104d9565b61058f6000308484610c0e565b816001600160a01b03167fbca5c314ed4bf159442030f0d4293bd6da1e7d20d5ea7c6da488ae3f899af500826040516105ca91815260200190565b60405180910390a2506105dc60018055565b50565b6105e7610bb5565b336105f0610b12565b6008556105fb6109eb565b6007556001600160a01b03811615610642576106168161040b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600082116106865760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b60448201526064016104d9565b600b546106939083610b7e565b600b55336000908152600c60205260409020546106b09083610b7e565b336000908152600c60205260409020556106c982610c43565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020016105ca565b6000546001600160a01b031633146107255760405162461bcd60e51b81526004016104d9906111d8565b600061072f610b12565b60085561073a6109eb565b6007556001600160a01b03811615610781576107558161040b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60045442106107a057600654610798908390610b9d565b6005556107e3565b6004546000906107b09042610b7e565b905060006107c960055483610b9190919063ffffffff16565b6006549091506107dd906104778684610ba9565b60055550505b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561082c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108509190611222565b905061086760065482610b9d90919063ffffffff16565b60055411156108b85760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f2068696768000000000000000060448201526064016104d9565b4260078190556006546108cb9190610ba9565b6004556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b61090e610bb5565b33610917610b12565b6008556109226109eb565b6007556001600160a01b038116156109695761093d8161040b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a602052604090205480156109de57336000818152600a60205260408120556002546109a8916001600160a01b039091169083610cae565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b50506109e960018055565b565b60006104a242600454610d16565b610a01610bb5565b33610a0a610b12565b600855610a156109eb565b6007556001600160a01b03811615610a5c57610a308161040b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610a9d5760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016104d9565b600b54610aaa9083610ba9565b600b55336000908152600c6020526040902054610ac79083610ba9565b336000908152600c6020526040902055610ae082610d2c565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d906020016105ca565b6000600b54600003610b25575060085490565b6104a2610b54600b54610477670de0b6b3a7640000610b4e600554610b4e6007546104526109eb565b90610b91565b60085490610ba9565b336000908152600c6020526040902054610b76906105df565b6109e9610906565b6000610b8a8284611251565b9392505050565b6000610b8a8284611264565b6000610b8a828461127b565b6000610b8a828461129d565b600260015403610c075760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104d9565b6002600155565b8015610c3d576001600160a01b038416610c3157610c2c8282610e06565b610c3d565b610c3d84848484610ea9565b50505050565b600d54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015610c8957600080fd5b505af1158015610c9d573d6000803e3d6000fd5b505050506105dc6000303384610c0e565b6040516001600160a01b038316602482015260448101829052610d1190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610efc565b505050565b6000818310610d255781610b8a565b5090919050565b80341015610d6f5760405162461bcd60e51b815260206004820152601060248201526f4e6f7420656e6f7567682076616c756560801b60448201526064016104d9565b600d60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015610dbf57600080fd5b505af1158015610dd3573d6000803e3d6000fd5b50505050506000610ded8234610b7e90919063ffffffff16565b90508015610e0257610e026000303384610c0e565b5050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e53576040519150601f19603f3d011682016040523d82523d6000602084013e610e58565b606091505b5050905080610d115760405162461bcd60e51b815260206004820152601c60248201527f4e617469766520746f6b656e207472616e73666572206661696c65640000000060448201526064016104d9565b816001600160a01b0316836001600160a01b03160315610c3d57306001600160a01b03841603610ee757610c2c6001600160a01b0385168383610cae565b610c3d6001600160a01b038516848484610fce565b6000610f51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110069092919063ffffffff16565b805190915015610d115780806020019051810190610f6f91906112b0565b610d115760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104d9565b6040516001600160a01b0380851660248301528316604482015260648101829052610c3d9085906323b872dd60e01b90608401610cda565b6060611015848460008561101d565b949350505050565b60608247101561107e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016104d9565b600080866001600160a01b0316858760405161109a91906112f6565b60006040518083038185875af1925050503d80600081146110d7576040519150601f19603f3d011682016040523d82523d6000602084013e6110dc565b606091505b50915091506110ed878383876110f8565b979650505050505050565b60608315611167578251600003611160576001600160a01b0385163b6111605760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104d9565b5081611015565b611015838381511561117c5781518083602001fd5b8060405162461bcd60e51b81526004016104d99190611312565b6000602082840312156111a857600080fd5b81356001600160a01b0381168114610b8a57600080fd5b6000602082840312156111d157600080fd5b5035919050565b6020808252602a908201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6040820152691b8818dbdb9d1c9858dd60b21b606082015260800190565b60006020828403121561123457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156104835761048361123b565b80820281158282048414176104835761048361123b565b60008261129857634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156104835761048361123b565b6000602082840312156112c257600080fd5b81518015158114610b8a57600080fd5b60005b838110156112ed5781810151838201526020016112d5565b50506000910152565b600082516113088184602087016112d2565b9190910192915050565b60208152600082518060208401526113318160408501602087016112d2565b601f01601f1916919091016040019291505056fea26469706673582212209e9ecb35ccdc508568cd6d1c7617328b83af62becbba18616b95b7da78c0133964736f6c634300081300336080604052600060045560006005553480156200001b57600080fd5b506040516200130b3803806200130b8339810160408190526200003e91620000d0565b60018055600280546001600160a01b038086166001600160a01b0319928316179092556003805485841690831617905560008054928716929091169190911790556200008e81620151806200009c565b600655506200014892505050565b6000620000aa828462000122565b90505b92915050565b80516001600160a01b0381168114620000cb57600080fd5b919050565b60008060008060808587031215620000e757600080fd5b620000f285620000b3565b93506200010260208601620000b3565b92506200011260408601620000b3565b6060959095015193969295505050565b8082028115828204841417620000ad57634e487b7160e01b600052601160045260246000fd5b6111b380620001586000396000f3fe6080604052600436106101385760003560e01c806372f702f3116100ab578063c8f33c911161006f578063c8f33c9114610354578063cd3daf9d1461036a578063d1af0c7d1461037f578063df136d651461039f578063e9fad8ee146103b5578063ebe2b12b146103ca57600080fd5b806372f702f3146102c95780637b0a47ee146102e957806380faa57d146102ff5780638b87634714610314578063a694fc3a1461034157600080fd5b80632e1a7d4d116100fd5780632e1a7d4d146101f0578063386a9525146102105780633c6b16ab146102265780633d18b912146102465780633fc6df6e1461025b57806370a082311461029357600080fd5b80628cc262146101445780630700037d1461017757806318160ddd146101a45780631c1f78eb146101b9578063236a38f7146101ce57600080fd5b3661013f57005b600080fd5b34801561015057600080fd5b5061016461015f366004610fce565b6103e0565b6040519081526020015b60405180910390f35b34801561018357600080fd5b50610164610192366004610fce565b600a6020526000908152604090205481565b3480156101b057600080fd5b50600b54610164565b3480156101c557600080fd5b5061016461045e565b3480156101da57600080fd5b506101ee6101e9366004610fce565b61047c565b005b3480156101fc57600080fd5b506101ee61020b366004610ff7565b610644565b34801561021c57600080fd5b5061016460065481565b34801561023257600080fd5b506101ee610241366004610ff7565b61076e565b34801561025257600080fd5b506101ee610979565b34801561026757600080fd5b5060005461027b906001600160a01b031681565b6040516001600160a01b03909116815260200161016e565b34801561029f57600080fd5b506101646102ae366004610fce565b6001600160a01b03166000908152600c602052604090205490565b3480156102d557600080fd5b5060035461027b906001600160a01b031681565b3480156102f557600080fd5b5061016460055481565b34801561030b57600080fd5b50610164610a5e565b34801561032057600080fd5b5061016461032f366004610fce565b60096020526000908152604090205481565b6101ee61034f366004610ff7565b610a6c565b34801561036057600080fd5b5061016460075481565b34801561037657600080fd5b50610164610b85565b34801561038b57600080fd5b5060025461027b906001600160a01b031681565b3480156103ab57600080fd5b5061016460085481565b3480156103c157600080fd5b506101ee610bd0565b3480156103d657600080fd5b5061016460045481565b6001600160a01b0381166000908152600a60209081526040808320546009909252822054610458919061045290670de0b6b3a76400009061044c9061042d90610427610b85565b90610bf1565b6001600160a01b0388166000908152600c602052604090205490610c04565b90610c10565b90610c1c565b92915050565b6000610477600654600554610c0490919063ffffffff16565b905090565b610484610c28565b6000546001600160a01b031633146104b75760405162461bcd60e51b81526004016104ae90611010565b60405180910390fd5b6004544210156105095760405162461bcd60e51b815260206004820181905260248201527f4e6f7420726561647920746f20776974686472617720454c207265776172647360448201526064016104ae565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610552573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610576919061105a565b9050600b5481116105c95760405162461bcd60e51b815260206004820152601f60248201527f4e6f20657874726120454c207265776172647320746f2077697468647261770060448201526064016104ae565b6000600b54826105d99190611089565b6003549091506105f3906001600160a01b03168483610c81565b826001600160a01b03167fbca5c314ed4bf159442030f0d4293bd6da1e7d20d5ea7c6da488ae3f899af5008260405161062e91815260200190565b60405180910390a2505061064160018055565b50565b61064c610c28565b33610655610b85565b600855610660610a5e565b6007556001600160a01b038116156106a75761067b816103e0565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600082116106eb5760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b60448201526064016104ae565b600b546106f89083610bf1565b600b55336000908152600c60205260409020546107159083610bf1565b336000908152600c602052604090205561072e82610ce9565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a25061064160018055565b6000546001600160a01b031633146107985760405162461bcd60e51b81526004016104ae90611010565b60006107a2610b85565b6008556107ad610a5e565b6007556001600160a01b038116156107f4576107c8816103e0565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60045442106108135760065461080b908390610c10565b600555610856565b6004546000906108239042610bf1565b9050600061083c60055483610c0490919063ffffffff16565b6006549091506108509061044c8684610c1c565b60055550505b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561089f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c3919061105a565b90506108da60065482610c1090919063ffffffff16565b600554111561092b5760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f2068696768000000000000000060448201526064016104ae565b42600781905560065461093e9190610c1c565b6004556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b610981610c28565b3361098a610b85565b600855610995610a5e565b6007556001600160a01b038116156109dc576109b0816103e0565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a60205260409020548015610a5157336000818152600a6020526040812055600254610a1b916001600160a01b039091169083610c81565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b5050610a5c60018055565b565b600061047742600454610d00565b610a74610c28565b33610a7d610b85565b600855610a88610a5e565b6007556001600160a01b03811615610acf57610aa3816103e0565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610b105760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016104ae565b600b54610b1d9083610c1c565b600b55336000908152600c6020526040902054610b3a9083610c1c565b336000908152600c6020526040902055610b5382610d16565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200161075c565b6000600b54600003610b98575060085490565b610477610bc7600b5461044c670de0b6b3a7640000610bc1600554610bc1600754610427610a5e565b90610c04565b60085490610c1c565b336000908152600c6020526040902054610be990610644565b610a5c610979565b6000610bfd8284611089565b9392505050565b6000610bfd828461109c565b6000610bfd82846110b3565b6000610bfd82846110d5565b600260015403610c7a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104ae565b6002600155565b6040516001600160a01b038316602482015260448101829052610ce490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d2e565b505050565b600354610641906001600160a01b03163383610c81565b6000818310610d0f5781610bfd565b5090919050565b600354610641906001600160a01b0316333084610e00565b6000610d83826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e3e9092919063ffffffff16565b805190915015610ce45780806020019051810190610da191906110e8565b610ce45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104ae565b6040516001600160a01b0380851660248301528316604482015260648101829052610e389085906323b872dd60e01b90608401610cad565b50505050565b6060610e4d8484600085610e55565b949350505050565b606082471015610eb65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016104ae565b600080866001600160a01b03168587604051610ed2919061112e565b60006040518083038185875af1925050503d8060008114610f0f576040519150601f19603f3d011682016040523d82523d6000602084013e610f14565b606091505b5091509150610f2587838387610f30565b979650505050505050565b60608315610f9f578251600003610f98576001600160a01b0385163b610f985760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104ae565b5081610e4d565b610e4d8383815115610fb45781518083602001fd5b8060405162461bcd60e51b81526004016104ae919061114a565b600060208284031215610fe057600080fd5b81356001600160a01b0381168114610bfd57600080fd5b60006020828403121561100957600080fd5b5035919050565b6020808252602a908201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6040820152691b8818dbdb9d1c9858dd60b21b606082015260800190565b60006020828403121561106c57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561045857610458611073565b808202811582820484141761045857610458611073565b6000826110d057634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561045857610458611073565b6000602082840312156110fa57600080fd5b81518015158114610bfd57600080fd5b60005b8381101561112557818101518382015260200161110d565b50506000910152565b6000825161114081846020870161110a565b9190910192915050565b602081526000825180602084015261116981604085016020870161110a565b601f01601f1916919091016040019291505056fea264697066735822122016c20bf1ca005b7ce1bbb70cf9869e638082b22902e919f9ef81353ab54d978164736f6c63430008130033a2646970667358221220b8702193928cd1c83050bee0f57537c9f9b4b0ff5cade760473df6d4947fafd364736f6c63430008130033000000000000000000000000801c71a771e5710d41ac4c0f1d6e82bd07b5fa43000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063ab5777db11610071578063ab5777db1461013d578063d1af0c7d14610150578063da1d111b14610163578063eb7f8f2414610178578063f2fde38b146101e1578063f9ea29cb146101f457600080fd5b8063344e5e34146100b957806367c81f65146100e9578063715018a6146100fe5780637e4b02d5146101065780638da5cb5b14610119578063a9fc507b1461012a575b600080fd5b6100cc6100c7366004610b28565b610207565b6040516001600160a01b0390911681526020015b60405180910390f35b6100fc6100f7366004610b5d565b610231565b005b6100fc610552565b6100cc610114366004610b90565b610566565b6000546001600160a01b03166100cc565b6100fc610138366004610bab565b6105fb565b6100fc61014b366004610bd5565b610848565b6001546100cc906001600160a01b031681565b61016b610974565b6040516100e09190610c08565b6101b7610186366004610b90565b60046020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b604080516001600160a01b03909516855260208501939093529183015260608201526080016100e0565b6100fc6101ef366004610b90565b6109d6565b6002546100cc906001600160a01b031681565b6003818154811061021757600080fd5b6000918252602090912001546001600160a01b0316905081565b610239610a4f565b6001600160a01b0380841660009081526004602052604090208054909116156102c25760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201526f185b1c9958591e4819195c1b1bde595960821b60648201526084015b60405180910390fd5b428310156103295760405162461bcd60e51b815260206004820152602e60248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a2060448201526d39ba30b93a103a37b79039b7b7b760911b60648201526084016102b9565b600082116103945760405162461bcd60e51b815260206004820152603260248201527f5374616b696e67506f6f6c466163746f72793a3a6465706c6f79506f6f6c3a20604482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b60648201526084016102b9565b6001600160a01b03841661042a5760015460025460405130926001600160a01b0390811692169085906103c690610b0e565b6001600160a01b0394851681529284166020840152921660408201526060810191909152608001604051809103906000f080158015610409573d6000803e3d6000fd5b5081546001600160a01b0319166001600160a01b03919091161781556104a9565b60015460405130916001600160a01b0316908690859061044990610b1b565b6001600160a01b0394851681529284166020840152921660408201526060810191909152608001604051809103906000f08015801561048c573d6000803e3d6000fd5b5081546001600160a01b0319166001600160a01b03919091161781555b600181810184905560028201839055600060038084018290558054928301815590527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0386811691821790925582546040805187815260208101879052929391909116917f489ab9065c597368f4a678fadcb323bf4c848713ea7d5a296d16ec97203eae83910160405180910390a350505050565b61055a610a4f565b6105646000610aa9565b565b6001600160a01b038082166000908152600460205260408120805491929091166105eb5760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a676574506f6f6c416464726560448201526f1cdcce881b9bdd0819195c1b1bde595960821b60648201526084016102b9565b546001600160a01b031692915050565b610603610a4f565b6001600160a01b03808316600090815260046020526040902080549091166106825760405162461bcd60e51b815260206004820152602c60248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a2060448201526b1b9bdd0819195c1b1bde595960a21b60648201526084016102b9565b80600101544210156106e85760405162461bcd60e51b815260206004820152602960248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a206044820152686e6f7420726561647960b81b60648201526084016102b9565b81156108435760038101546106fd9083610af9565b600382015560015481546040516323b872dd60e01b81523360048201526001600160a01b039182166024820152604481018590529116906323b872dd906064016020604051808303816000875af115801561075c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107809190610c55565b6107e45760405162461bcd60e51b815260206004820152602f60248201527f5374616b696e67506f6f6c466163746f72793a3a616464526577617264733a2060448201526e1d1c985b9cd9995c8819985a5b1959608a1b60648201526084016102b9565b8054604051633c6b16ab60e01b8152600481018490526001600160a01b0390911690633c6b16ab906024015b600060405180830381600087803b15801561082a57600080fd5b505af115801561083e573d6000803e3d6000fd5b505050505b505050565b610850610a4f565b6001600160a01b03808316600090815260046020526040902080549091166108d65760405162461bcd60e51b815260206004820152603360248201527f5374616b696e67506f6f6c466163746f72793a3a7769746864726177454c52656044820152721dd85c991cce881b9bdd0819195c1b1bde5959606a1b60648201526084016102b9565b80600101544210156109435760405162461bcd60e51b815260206004820152603060248201527f5374616b696e67506f6f6c466163746f72793a3a7769746864726177454c526560448201526f77617264733a206e6f7420726561647960801b60648201526084016102b9565b805460405163236a38f760e01b81526001600160a01b0384811660048301529091169063236a38f790602401610810565b606060038054806020026020016040519081016040528092919081815260200182805480156109cc57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116109ae575b5050505050905090565b6109de610a4f565b6001600160a01b038116610a435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102b9565b610a4c81610aa9565b50565b6000546001600160a01b031633146105645760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102b9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610b058284610c7e565b90505b92915050565b6114fb80610ca083390190565b61130b8061219b83390190565b600060208284031215610b3a57600080fd5b5035919050565b80356001600160a01b0381168114610b5857600080fd5b919050565b600080600060608486031215610b7257600080fd5b610b7b84610b41565b95602085013595506040909401359392505050565b600060208284031215610ba257600080fd5b610b0582610b41565b60008060408385031215610bbe57600080fd5b610bc783610b41565b946020939093013593505050565b60008060408385031215610be857600080fd5b610bf183610b41565b9150610bff60208401610b41565b90509250929050565b6020808252825182820181905260009190848201906040850190845b81811015610c495783516001600160a01b031683529284019291840191600101610c24565b50909695505050505050565b600060208284031215610c6757600080fd5b81518015158114610c7757600080fd5b9392505050565b80820180821115610b0857634e487b7160e01b600052601160045260246000fdfe6080604052600060045560006005553480156200001b57600080fd5b50604051620014fb380380620014fb8339810160408190526200003e91620000f8565b60018055600280546001600160a01b038086166001600160a01b03199283161790925560038054838616908316179055600080549287169290911691909117905583838383620000928162015180620000c4565b6006555050600d80546001600160a01b0319166001600160a01b03959095169490941790935550620001709350505050565b6000620000d282846200014a565b90505b92915050565b80516001600160a01b0381168114620000f357600080fd5b919050565b600080600080608085870312156200010f57600080fd5b6200011a85620000db565b93506200012a60208601620000db565b92506200013a60408601620000db565b6060959095015193969295505050565b8082028115828204841417620000d557634e487b7160e01b600052601160045260246000fd5b61137b80620001806000396000f3fe6080604052600436106101435760003560e01c806370a08231116100b6578063c8f33c911161006f578063c8f33c911461037f578063cd3daf9d14610395578063d1af0c7d146103aa578063df136d65146103ca578063e9fad8ee146103e0578063ebe2b12b146103f557600080fd5b806370a08231146102be57806372f702f3146102f45780637b0a47ee1461031457806380faa57d1461032a5780638b8763471461033f578063a694fc3a1461036c57600080fd5b80632e1a7d4d116101085780632e1a7d4d146101fb578063386a95251461021b5780633c6b16ab146102315780633d18b912146102515780633fc6df6e146102665780633fc8cef31461029e57600080fd5b80628cc2621461014f5780630700037d1461018257806318160ddd146101af5780631c1f78eb146101c4578063236a38f7146101d957600080fd5b3661014a57005b600080fd5b34801561015b57600080fd5b5061016f61016a366004611196565b61040b565b6040519081526020015b60405180910390f35b34801561018e57600080fd5b5061016f61019d366004611196565b600a6020526000908152604090205481565b3480156101bb57600080fd5b50600b5461016f565b3480156101d057600080fd5b5061016f610489565b3480156101e557600080fd5b506101f96101f4366004611196565b6104a7565b005b34801561020757600080fd5b506101f96102163660046111bf565b6105df565b34801561022757600080fd5b5061016f60065481565b34801561023d57600080fd5b506101f961024c3660046111bf565b6106fb565b34801561025d57600080fd5b506101f9610906565b34801561027257600080fd5b50600054610286906001600160a01b031681565b6040516001600160a01b039091168152602001610179565b3480156102aa57600080fd5b50600d54610286906001600160a01b031681565b3480156102ca57600080fd5b5061016f6102d9366004611196565b6001600160a01b03166000908152600c602052604090205490565b34801561030057600080fd5b50600354610286906001600160a01b031681565b34801561032057600080fd5b5061016f60055481565b34801561033657600080fd5b5061016f6109eb565b34801561034b57600080fd5b5061016f61035a366004611196565b60096020526000908152604090205481565b6101f961037a3660046111bf565b6109f9565b34801561038b57600080fd5b5061016f60075481565b3480156103a157600080fd5b5061016f610b12565b3480156103b657600080fd5b50600254610286906001600160a01b031681565b3480156103d657600080fd5b5061016f60085481565b3480156103ec57600080fd5b506101f9610b5d565b34801561040157600080fd5b5061016f60045481565b6001600160a01b0381166000908152600a60209081526040808320546009909252822054610483919061047d90670de0b6b3a7640000906104779061045890610452610b12565b90610b7e565b6001600160a01b0388166000908152600c602052604090205490610b91565b90610b9d565b90610ba9565b92915050565b60006104a2600654600554610b9190919063ffffffff16565b905090565b6104af610bb5565b6000546001600160a01b031633146104e25760405162461bcd60e51b81526004016104d9906111d8565b60405180910390fd5b6004544210156105345760405162461bcd60e51b815260206004820181905260248201527f4e6f7420726561647920746f20776974686472617720454c207265776172647360448201526064016104d9565b47806105825760405162461bcd60e51b815260206004820152601f60248201527f4e6f20657874726120454c207265776172647320746f2077697468647261770060448201526064016104d9565b61058f6000308484610c0e565b816001600160a01b03167fbca5c314ed4bf159442030f0d4293bd6da1e7d20d5ea7c6da488ae3f899af500826040516105ca91815260200190565b60405180910390a2506105dc60018055565b50565b6105e7610bb5565b336105f0610b12565b6008556105fb6109eb565b6007556001600160a01b03811615610642576106168161040b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600082116106865760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b60448201526064016104d9565b600b546106939083610b7e565b600b55336000908152600c60205260409020546106b09083610b7e565b336000908152600c60205260409020556106c982610c43565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020016105ca565b6000546001600160a01b031633146107255760405162461bcd60e51b81526004016104d9906111d8565b600061072f610b12565b60085561073a6109eb565b6007556001600160a01b03811615610781576107558161040b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60045442106107a057600654610798908390610b9d565b6005556107e3565b6004546000906107b09042610b7e565b905060006107c960055483610b9190919063ffffffff16565b6006549091506107dd906104778684610ba9565b60055550505b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561082c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108509190611222565b905061086760065482610b9d90919063ffffffff16565b60055411156108b85760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f2068696768000000000000000060448201526064016104d9565b4260078190556006546108cb9190610ba9565b6004556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b61090e610bb5565b33610917610b12565b6008556109226109eb565b6007556001600160a01b038116156109695761093d8161040b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a602052604090205480156109de57336000818152600a60205260408120556002546109a8916001600160a01b039091169083610cae565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b50506109e960018055565b565b60006104a242600454610d16565b610a01610bb5565b33610a0a610b12565b600855610a156109eb565b6007556001600160a01b03811615610a5c57610a308161040b565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610a9d5760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016104d9565b600b54610aaa9083610ba9565b600b55336000908152600c6020526040902054610ac79083610ba9565b336000908152600c6020526040902055610ae082610d2c565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d906020016105ca565b6000600b54600003610b25575060085490565b6104a2610b54600b54610477670de0b6b3a7640000610b4e600554610b4e6007546104526109eb565b90610b91565b60085490610ba9565b336000908152600c6020526040902054610b76906105df565b6109e9610906565b6000610b8a8284611251565b9392505050565b6000610b8a8284611264565b6000610b8a828461127b565b6000610b8a828461129d565b600260015403610c075760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104d9565b6002600155565b8015610c3d576001600160a01b038416610c3157610c2c8282610e06565b610c3d565b610c3d84848484610ea9565b50505050565b600d54604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015610c8957600080fd5b505af1158015610c9d573d6000803e3d6000fd5b505050506105dc6000303384610c0e565b6040516001600160a01b038316602482015260448101829052610d1190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610efc565b505050565b6000818310610d255781610b8a565b5090919050565b80341015610d6f5760405162461bcd60e51b815260206004820152601060248201526f4e6f7420656e6f7567682076616c756560801b60448201526064016104d9565b600d60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015610dbf57600080fd5b505af1158015610dd3573d6000803e3d6000fd5b50505050506000610ded8234610b7e90919063ffffffff16565b90508015610e0257610e026000303384610c0e565b5050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e53576040519150601f19603f3d011682016040523d82523d6000602084013e610e58565b606091505b5050905080610d115760405162461bcd60e51b815260206004820152601c60248201527f4e617469766520746f6b656e207472616e73666572206661696c65640000000060448201526064016104d9565b816001600160a01b0316836001600160a01b03160315610c3d57306001600160a01b03841603610ee757610c2c6001600160a01b0385168383610cae565b610c3d6001600160a01b038516848484610fce565b6000610f51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110069092919063ffffffff16565b805190915015610d115780806020019051810190610f6f91906112b0565b610d115760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104d9565b6040516001600160a01b0380851660248301528316604482015260648101829052610c3d9085906323b872dd60e01b90608401610cda565b6060611015848460008561101d565b949350505050565b60608247101561107e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016104d9565b600080866001600160a01b0316858760405161109a91906112f6565b60006040518083038185875af1925050503d80600081146110d7576040519150601f19603f3d011682016040523d82523d6000602084013e6110dc565b606091505b50915091506110ed878383876110f8565b979650505050505050565b60608315611167578251600003611160576001600160a01b0385163b6111605760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104d9565b5081611015565b611015838381511561117c5781518083602001fd5b8060405162461bcd60e51b81526004016104d99190611312565b6000602082840312156111a857600080fd5b81356001600160a01b0381168114610b8a57600080fd5b6000602082840312156111d157600080fd5b5035919050565b6020808252602a908201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6040820152691b8818dbdb9d1c9858dd60b21b606082015260800190565b60006020828403121561123457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156104835761048361123b565b80820281158282048414176104835761048361123b565b60008261129857634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156104835761048361123b565b6000602082840312156112c257600080fd5b81518015158114610b8a57600080fd5b60005b838110156112ed5781810151838201526020016112d5565b50506000910152565b600082516113088184602087016112d2565b9190910192915050565b60208152600082518060208401526113318160408501602087016112d2565b601f01601f1916919091016040019291505056fea26469706673582212209e9ecb35ccdc508568cd6d1c7617328b83af62becbba18616b95b7da78c0133964736f6c634300081300336080604052600060045560006005553480156200001b57600080fd5b506040516200130b3803806200130b8339810160408190526200003e91620000d0565b60018055600280546001600160a01b038086166001600160a01b0319928316179092556003805485841690831617905560008054928716929091169190911790556200008e81620151806200009c565b600655506200014892505050565b6000620000aa828462000122565b90505b92915050565b80516001600160a01b0381168114620000cb57600080fd5b919050565b60008060008060808587031215620000e757600080fd5b620000f285620000b3565b93506200010260208601620000b3565b92506200011260408601620000b3565b6060959095015193969295505050565b8082028115828204841417620000ad57634e487b7160e01b600052601160045260246000fd5b6111b380620001586000396000f3fe6080604052600436106101385760003560e01c806372f702f3116100ab578063c8f33c911161006f578063c8f33c9114610354578063cd3daf9d1461036a578063d1af0c7d1461037f578063df136d651461039f578063e9fad8ee146103b5578063ebe2b12b146103ca57600080fd5b806372f702f3146102c95780637b0a47ee146102e957806380faa57d146102ff5780638b87634714610314578063a694fc3a1461034157600080fd5b80632e1a7d4d116100fd5780632e1a7d4d146101f0578063386a9525146102105780633c6b16ab146102265780633d18b912146102465780633fc6df6e1461025b57806370a082311461029357600080fd5b80628cc262146101445780630700037d1461017757806318160ddd146101a45780631c1f78eb146101b9578063236a38f7146101ce57600080fd5b3661013f57005b600080fd5b34801561015057600080fd5b5061016461015f366004610fce565b6103e0565b6040519081526020015b60405180910390f35b34801561018357600080fd5b50610164610192366004610fce565b600a6020526000908152604090205481565b3480156101b057600080fd5b50600b54610164565b3480156101c557600080fd5b5061016461045e565b3480156101da57600080fd5b506101ee6101e9366004610fce565b61047c565b005b3480156101fc57600080fd5b506101ee61020b366004610ff7565b610644565b34801561021c57600080fd5b5061016460065481565b34801561023257600080fd5b506101ee610241366004610ff7565b61076e565b34801561025257600080fd5b506101ee610979565b34801561026757600080fd5b5060005461027b906001600160a01b031681565b6040516001600160a01b03909116815260200161016e565b34801561029f57600080fd5b506101646102ae366004610fce565b6001600160a01b03166000908152600c602052604090205490565b3480156102d557600080fd5b5060035461027b906001600160a01b031681565b3480156102f557600080fd5b5061016460055481565b34801561030b57600080fd5b50610164610a5e565b34801561032057600080fd5b5061016461032f366004610fce565b60096020526000908152604090205481565b6101ee61034f366004610ff7565b610a6c565b34801561036057600080fd5b5061016460075481565b34801561037657600080fd5b50610164610b85565b34801561038b57600080fd5b5060025461027b906001600160a01b031681565b3480156103ab57600080fd5b5061016460085481565b3480156103c157600080fd5b506101ee610bd0565b3480156103d657600080fd5b5061016460045481565b6001600160a01b0381166000908152600a60209081526040808320546009909252822054610458919061045290670de0b6b3a76400009061044c9061042d90610427610b85565b90610bf1565b6001600160a01b0388166000908152600c602052604090205490610c04565b90610c10565b90610c1c565b92915050565b6000610477600654600554610c0490919063ffffffff16565b905090565b610484610c28565b6000546001600160a01b031633146104b75760405162461bcd60e51b81526004016104ae90611010565b60405180910390fd5b6004544210156105095760405162461bcd60e51b815260206004820181905260248201527f4e6f7420726561647920746f20776974686472617720454c207265776172647360448201526064016104ae565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610552573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610576919061105a565b9050600b5481116105c95760405162461bcd60e51b815260206004820152601f60248201527f4e6f20657874726120454c207265776172647320746f2077697468647261770060448201526064016104ae565b6000600b54826105d99190611089565b6003549091506105f3906001600160a01b03168483610c81565b826001600160a01b03167fbca5c314ed4bf159442030f0d4293bd6da1e7d20d5ea7c6da488ae3f899af5008260405161062e91815260200190565b60405180910390a2505061064160018055565b50565b61064c610c28565b33610655610b85565b600855610660610a5e565b6007556001600160a01b038116156106a75761067b816103e0565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b600082116106eb5760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b60448201526064016104ae565b600b546106f89083610bf1565b600b55336000908152600c60205260409020546107159083610bf1565b336000908152600c602052604090205561072e82610ce9565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a25061064160018055565b6000546001600160a01b031633146107985760405162461bcd60e51b81526004016104ae90611010565b60006107a2610b85565b6008556107ad610a5e565b6007556001600160a01b038116156107f4576107c8816103e0565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60045442106108135760065461080b908390610c10565b600555610856565b6004546000906108239042610bf1565b9050600061083c60055483610c0490919063ffffffff16565b6006549091506108509061044c8684610c1c565b60055550505b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561089f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c3919061105a565b90506108da60065482610c1090919063ffffffff16565b600554111561092b5760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f2068696768000000000000000060448201526064016104ae565b42600781905560065461093e9190610c1c565b6004556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b610981610c28565b3361098a610b85565b600855610995610a5e565b6007556001600160a01b038116156109dc576109b0816103e0565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a60205260409020548015610a5157336000818152600a6020526040812055600254610a1b916001600160a01b039091169083610c81565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b5050610a5c60018055565b565b600061047742600454610d00565b610a74610c28565b33610a7d610b85565b600855610a88610a5e565b6007556001600160a01b03811615610acf57610aa3816103e0565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610b105760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016104ae565b600b54610b1d9083610c1c565b600b55336000908152600c6020526040902054610b3a9083610c1c565b336000908152600c6020526040902055610b5382610d16565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200161075c565b6000600b54600003610b98575060085490565b610477610bc7600b5461044c670de0b6b3a7640000610bc1600554610bc1600754610427610a5e565b90610c04565b60085490610c1c565b336000908152600c6020526040902054610be990610644565b610a5c610979565b6000610bfd8284611089565b9392505050565b6000610bfd828461109c565b6000610bfd82846110b3565b6000610bfd82846110d5565b600260015403610c7a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104ae565b6002600155565b6040516001600160a01b038316602482015260448101829052610ce490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d2e565b505050565b600354610641906001600160a01b03163383610c81565b6000818310610d0f5781610bfd565b5090919050565b600354610641906001600160a01b0316333084610e00565b6000610d83826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e3e9092919063ffffffff16565b805190915015610ce45780806020019051810190610da191906110e8565b610ce45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104ae565b6040516001600160a01b0380851660248301528316604482015260648101829052610e389085906323b872dd60e01b90608401610cad565b50505050565b6060610e4d8484600085610e55565b949350505050565b606082471015610eb65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016104ae565b600080866001600160a01b03168587604051610ed2919061112e565b60006040518083038185875af1925050503d8060008114610f0f576040519150601f19603f3d011682016040523d82523d6000602084013e610f14565b606091505b5091509150610f2587838387610f30565b979650505050505050565b60608315610f9f578251600003610f98576001600160a01b0385163b610f985760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104ae565b5081610e4d565b610e4d8383815115610fb45781518083602001fd5b8060405162461bcd60e51b81526004016104ae919061114a565b600060208284031215610fe057600080fd5b81356001600160a01b0381168114610bfd57600080fd5b60006020828403121561100957600080fd5b5035919050565b6020808252602a908201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6040820152691b8818dbdb9d1c9858dd60b21b606082015260800190565b60006020828403121561106c57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561045857610458611073565b808202811582820484141761045857610458611073565b6000826110d057634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561045857610458611073565b6000602082840312156110fa57600080fd5b81518015158114610bfd57600080fd5b60005b8381101561112557818101518382015260200161110d565b50506000910152565b6000825161114081846020870161110a565b9190910192915050565b602081526000825180602084015261116981604085016020870161110a565b601f01601f1916919091016040019291505056fea264697066735822122016c20bf1ca005b7ce1bbb70cf9869e638082b22902e919f9ef81353ab54d978164736f6c63430008130033a2646970667358221220b8702193928cd1c83050bee0f57537c9f9b4b0ff5cade760473df6d4947fafd364736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000801c71a771e5710d41ac4c0f1d6e82bd07b5fa43000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _rewardsToken (address): 0x801C71A771E5710D41AC4C0F1d6E82bd07B5Fa43
Arg [1] : _nativeTokenWrapper (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000801c71a771e5710d41ac4c0f1d6e82bd07b5fa43
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.