ETH Price: $3,163.01 (+3.08%)

Token

High Yield ETH Index Staked PRT (sPrtHyETH)
 

Overview

Max Total Supply

9,324.7963565475 sPrtHyETH

Holders

77

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
3.18 sPrtHyETH

Value
$0.00
0xecfe632b5ec55dccf26aedd8fd93a665f45de652
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
SignedSnapshotStakingPool

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 23 : SignedSnapshotStakingPool.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ISignedSnapshotStakingPool} from "../interfaces/staking/ISignedSnapshotStakingPool.sol";

import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import {SnapshotStakingPool} from "./SnapshotStakingPool.sol";

/// @title SignedSnapshotStakingPool
/// @author Index Cooperative
/// @notice A contract for staking `stakeToken` and receiving `rewardToken` based 
/// on snapshots taken when rewards are accrued. Snapshots are taken at a minimum
/// interval of `snapshotDelay` seconds. Staking is not allowed `snapshotBuffer` 
/// seconds before a snapshot is taken. Rewards are distributed by the `distributor`.
/// Stakers must sign an agreement `message` to stake.
contract SignedSnapshotStakingPool is ISignedSnapshotStakingPool, SnapshotStakingPool, EIP712 {
    string private constant MESSAGE_TYPE = "StakeMessage(string message)";

    /* ERRORS */

    /// @notice Error when staker is not approved
    error NotApprovedStaker();
    /// @notice Error when signature is invalid
    error InvalidSignature();

    /* EVENTS */

    /// @notice Emitted when the message is changed
    event MessageChanged(string newMessage);
    /// @notice Emitted when a staker has message signature approved
    event StakerApproved(address indexed staker);

    /* STORAGE */

    /// @inheritdoc ISignedSnapshotStakingPool
    string public message;
    /// @inheritdoc ISignedSnapshotStakingPool
    mapping(address => bool) public isApprovedStaker;

    /* CONSTRUCTOR */

    /// @param eip712Name Name of the EIP712 signing domain
    /// @param eip712Version Current major version of the EIP712 signing domain
    /// @param stakeMessage The message to sign when staking
    /// @param name Name of the staked token
    /// @param symbol Symbol of the staked token
    /// @param rewardToken Instance of the reward token
    /// @param stakeToken Instance of the stake token
    /// @param distributor Address of the distributor
    /// @param snapshotBuffer The buffer time before snapshots during which staking is not allowed
    /// @param snapshotDelay The minimum amount of time between snapshots
    constructor(
        string memory eip712Name,
        string memory eip712Version,
        string memory stakeMessage,
        string memory name,
        string memory symbol,
        IERC20 rewardToken,
        IERC20 stakeToken,
        address distributor,
        uint256 snapshotBuffer,
        uint256 snapshotDelay
    )
        EIP712(eip712Name, eip712Version)
        SnapshotStakingPool(name, symbol, rewardToken, stakeToken, distributor, snapshotBuffer, snapshotDelay)
    {
        _setMessage(stakeMessage);
    }

    /* STAKER FUNCTIONS */

    /// @inheritdoc ISignedSnapshotStakingPool
    function stake(uint256 amount) external override(SnapshotStakingPool, ISignedSnapshotStakingPool) nonReentrant {
        if (!isApprovedStaker[msg.sender]) revert NotApprovedStaker();
        _stake(msg.sender, amount);
    }

    /// @inheritdoc ISignedSnapshotStakingPool
    function stake(uint256 amount, bytes calldata signature) external nonReentrant {
        _approveStaker(msg.sender, signature);
        _stake(msg.sender, amount);
    }

    /// @inheritdoc ISignedSnapshotStakingPool
    function approveStaker(bytes calldata signature) external {
        _approveStaker(msg.sender, signature);
    }

    /* ADMIN FUNCTIONS */

    /// @inheritdoc ISignedSnapshotStakingPool
    function setMessage(string memory newMessage) external onlyOwner {
        _setMessage(newMessage);
    }

    /* VIEW FUNCTIONS */

    /// @inheritdoc ISignedSnapshotStakingPool
    function getStakeSignatureDigest() public view returns (bytes32) {
        return _hashTypedDataV4(
            keccak256(
                abi.encode(
                    keccak256(abi.encodePacked(MESSAGE_TYPE)),
                    keccak256(bytes(message))
                )
            )
        );
    }

    /* INTERNAL FUNCTIONS */

    /// @dev Approve the `staker` if the `signature` is valid
    /// @param staker The staker to approve
    /// @param signature The signature to verify
    function _approveStaker(address staker, bytes calldata signature) internal {
        if (!SignatureChecker.isValidSignatureNow(staker, getStakeSignatureDigest(), signature)) revert InvalidSignature();
        isApprovedStaker[staker] = true;
        emit StakerApproved(staker);
    }

    /// @dev Set the stake `message` to `newMessage`
    /// @param newMessage The new message
    function _setMessage(string memory newMessage) internal {
        message = newMessage;
        emit MessageChanged(newMessage);
    }
}

File 2 of 23 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 3 of 23 : ISignedSnapshotStakingPool.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import {ISnapshotStakingPool} from "./ISnapshotStakingPool.sol";

interface ISignedSnapshotStakingPool is ISnapshotStakingPool {

    /// @notice Message to sign when staking
    function message() external view returns (string memory);

    /// @notice Mapping of approved stakers
    function isApprovedStaker(address) external view returns (bool);

    /// @notice Stake `amount` of stakeToken from `msg.sender` and mint staked tokens.
    /// @param amount The amount of stakeToken to stake
    /// @dev Must be an approved staker
    function stake(uint256 amount) external;

    /// @notice Stake `amount` of stakeToken from `msg.sender` and mint staked tokens.
    /// @param amount The amount of stakeToken to stake
    /// @param signature The signature of the message
    /// @dev Approves the staker if not already approved
    function stake(uint256 amount, bytes calldata signature) external;

    /// @notice Approve the signer of the message as an approved staker
    /// @param signature The signature of the message
    function approveStaker(bytes calldata signature) external;

    /// @notice Set the message to sign when staking
    /// @param newMessage The new message
    function setMessage(string memory newMessage) external;

    /// @notice Get the hashed digest of the message to be signed for staking
    /// @return The hashed bytes to be signed
    function getStakeSignatureDigest() external view returns (bytes32);
}

File 4 of 23 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}

File 5 of 23 : SignatureChecker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";
import "../../interfaces/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
 * Argent and Gnosis Safe.
 *
 * _Available since v4.1._
 */
library SignatureChecker {
    /**
     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
        (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
        return
            (error == ECDSA.RecoverError.NoError && recovered == signer) ||
            isValidERC1271SignatureNow(signer, hash, signature);
    }

    /**
     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
     * against the signer smart contract using ERC1271.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidERC1271SignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
    }
}

File 6 of 23 : SnapshotStakingPool.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ISnapshotStakingPool} from "../interfaces/staking/ISnapshotStakingPool.sol";

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC20Snapshot} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Snapshot.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";

/// @title SnapshotStakingPool
/// @author Index Cooperative
/// @notice A contract for staking `stakeToken` and receiving `rewardToken` based 
/// on snapshots taken when rewards are accrued. Snapshots are taken at a minimum
/// interval of `snapshotDelay` seconds. Staking is not allowed `snapshotBuffer` 
/// seconds before a snapshot is taken. Rewards are distributed by the `distributor`.
contract SnapshotStakingPool is ISnapshotStakingPool, Ownable, ERC20Snapshot, ReentrancyGuard {

    /* ERRORS */

    /// @notice Error when snapshot buffer is greater than snapshot delay
    error InvalidSnapshotBuffer(); 
    /// @notice Error when snapshot delay is less than snapshot buffer
    error InvalidSnapshotDelay(); 
    /// @notice Error when staking during snapshot buffer period
    error CannotStakeDuringBuffer();
    /// @notice Error when accrue is called by non-distributor
    error MustBeDistributor();
    /// @notice Error when trying to accrue zero rewards
    error CannotAccrueZero();
    /// @notice Error when trying to accrue rewards with zero staked supply
    error CannotAccrueWithZeroStakedSupply();
    /// @notice Error when trying to accrue rewards before snapshot delay
    error SnapshotDelayNotPassed();
    /// @notice Error when trying to claim rewards from past snapshots
    error CannotClaimFromPastSnapshots();
    /// @notice Error when snapshot id is invalid
    error InvalidSnapshotId();
    /// @notice Error when snapshot id does not exist
    error NonExistentSnapshotId();
    /// @notice Error when transfers are attempted
    error TransfersNotAllowed();

    /* EVENTS */

    /// @notice Emitted when the reward distributor is changed.
    event DistributorChanged(address newDistributor);
    /// @notice Emitted when the snapshot buffer is changed.
    event SnapshotBufferChanged(uint256 newSnapshotBuffer);
    /// @notice Emitted when the snapshot delay is changed.
    event SnapshotDelayChanged(uint256 newSnapshotDelay);

    /* IMMUTABLES */

    /// @inheritdoc ISnapshotStakingPool
    IERC20 public immutable rewardToken;
    /// @inheritdoc ISnapshotStakingPool
    IERC20 public immutable stakeToken;

    /* STORAGE */

    /// @inheritdoc ISnapshotStakingPool
    address public distributor;
    /// @inheritdoc ISnapshotStakingPool
    mapping(address => uint256) public nextClaimId;
    /// @inheritdoc ISnapshotStakingPool
    uint256[] public rewardSnapshots;
    /// @inheritdoc ISnapshotStakingPool
    uint256 public snapshotBuffer;
    /// @inheritdoc ISnapshotStakingPool
    uint256 public snapshotDelay;
    /// @inheritdoc ISnapshotStakingPool
    uint256 public lastSnapshotTime;

    /* CONSTRUCTOR */

    /// @param name Name of the staked token
    /// @param symbol Symbol of the staked token
    /// @param rewardToken_ Instance of the reward token
    /// @param stakeToken_ Instance of the stake token
    /// @param distributor_ Address of the distributor
    /// @param snapshotBuffer_ The buffer time before snapshots during which staking is not allowed
    /// @param snapshotDelay_ The minimum amount of time between snapshots
    constructor(
        string memory name,
        string memory symbol,
        IERC20 rewardToken_,
        IERC20 stakeToken_,
        address distributor_,
        uint256 snapshotBuffer_,
        uint256 snapshotDelay_
    )
        ERC20(name, symbol)
    {
        if (snapshotBuffer_ > snapshotDelay_) revert InvalidSnapshotBuffer();
        rewardToken = rewardToken_;
        stakeToken = stakeToken_;
        distributor = distributor_;
        snapshotBuffer = snapshotBuffer_;
        snapshotDelay = snapshotDelay_;
        lastSnapshotTime = block.timestamp;
    }

    /* MODIFIERS */

    /// @dev Reverts if the caller is not the distributor.
    modifier onlyDistributor() {
        if (msg.sender != distributor) revert MustBeDistributor();
        _;
    }

    /* STAKER FUNCTIONS */

    /// @inheritdoc ISnapshotStakingPool
    function stake(uint256 amount) external virtual nonReentrant {
        _stake(msg.sender, amount);
    }

    /// @inheritdoc ISnapshotStakingPool
    function unstake(uint256 amount) public nonReentrant {
        super._burn(msg.sender, amount);
        stakeToken.transfer(msg.sender, amount);
    }

    /// @inheritdoc ISnapshotStakingPool
    function accrue(uint256 amount) external nonReentrant onlyDistributor {
        if (amount == 0) revert CannotAccrueZero();
        if (totalSupply() == 0) revert CannotAccrueWithZeroStakedSupply();
        if (!canAccrue()) revert SnapshotDelayNotPassed();
        rewardToken.transferFrom(msg.sender, address(this), amount);
        lastSnapshotTime = block.timestamp;
        rewardSnapshots.push(amount);
        super._snapshot();
    }

    /// @inheritdoc ISnapshotStakingPool
    function claim() public nonReentrant {
        uint256 currentId = _getCurrentSnapshotId();
        uint256 lastId = nextClaimId[msg.sender];
        _claim(msg.sender, lastId, currentId);
    }

    /// @inheritdoc ISnapshotStakingPool
    function claimPartial(uint256 startSnapshotId, uint256 endSnapshotId) public nonReentrant {
        if (startSnapshotId < nextClaimId[msg.sender]) revert CannotClaimFromPastSnapshots();
        _claim(msg.sender, startSnapshotId, endSnapshotId);
    }

    /* ADMIN FUNCTIONS */

    /// @inheritdoc ISnapshotStakingPool
    function setDistributor(address newDistributor) external onlyOwner {
        distributor = newDistributor;
        emit DistributorChanged(newDistributor);
    }

    /// @inheritdoc ISnapshotStakingPool
    function setSnapshotBuffer(uint256 newSnapshotBuffer) external onlyOwner {
        if (newSnapshotBuffer > snapshotDelay) revert InvalidSnapshotBuffer();
        snapshotBuffer = newSnapshotBuffer;
        emit SnapshotBufferChanged(newSnapshotBuffer);
    }

    /// @inheritdoc ISnapshotStakingPool
    function setSnapshotDelay(uint256 newSnapshotDelay) external onlyOwner {
        if (snapshotBuffer > newSnapshotDelay) revert InvalidSnapshotDelay();
        snapshotDelay = newSnapshotDelay;
        emit SnapshotDelayChanged(newSnapshotDelay);
    }

    /* ERC20 OVERRIDES */

    /// @notice Prevents transfers of the staked token.
    function transfer(address /*recipient*/, uint256 /*amount*/) public pure override(ERC20, IERC20) returns (bool) {
        revert TransfersNotAllowed();
    }

    /// @notice Prevents transfers of the staked token.
    function transferFrom(address /*sender*/, address /*recipient*/, uint256 /*amount*/) public pure override(ERC20, IERC20) returns (bool) {
        revert TransfersNotAllowed();
    }

    /* VIEW FUNCTIONS */

    /// @inheritdoc ISnapshotStakingPool
    function getCurrentSnapshotId() public view returns (uint256) {
        return _getCurrentSnapshotId();
    }

    /// @inheritdoc ISnapshotStakingPool
    function getPendingRewards(address account) public view returns (uint256) {
        uint256 currentId = _getCurrentSnapshotId();
        uint256 lastId = nextClaimId[account];
        if (lastId == 0 || currentId == 0 || lastId > currentId) return 0;
        return _rewardOfInRange(account, lastId, currentId);
    }

    /// @inheritdoc ISnapshotStakingPool
    function rewardOfInRange(address account, uint256 startSnapshotId, uint256 endSnapshotId) public view returns (uint256) {
        if (startSnapshotId == 0) revert InvalidSnapshotId();
        if (startSnapshotId > endSnapshotId || endSnapshotId > _getCurrentSnapshotId()) revert NonExistentSnapshotId();
        return _rewardOfInRange(account, startSnapshotId, endSnapshotId);
    }

    /// @inheritdoc ISnapshotStakingPool
    function rewardOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {
        if (snapshotId == 0) revert InvalidSnapshotId();
        if (snapshotId > _getCurrentSnapshotId()) revert NonExistentSnapshotId();
        return _rewardOfAt(account, snapshotId);
    }

    /// @inheritdoc ISnapshotStakingPool
    function rewardAt(uint256 snapshotId) public view virtual returns (uint256) {
        if (snapshotId == 0) revert InvalidSnapshotId();
        if (snapshotId > _getCurrentSnapshotId()) revert NonExistentSnapshotId();
        return _rewardAt(snapshotId);
    }

    /// @inheritdoc ISnapshotStakingPool
    function getRewardSnapshots() external view returns(uint256[] memory) {
        return rewardSnapshots;
    }

    /// @inheritdoc ISnapshotStakingPool
    function getLifetimeRewards(address account) public view returns (uint256) {
        uint256 currentId = _getCurrentSnapshotId();
        if (nextClaimId[account] == 0 || currentId == 0) return 0;
        return _rewardOfInRange(account, 1, currentId);
    }

    /// @inheritdoc ISnapshotStakingPool
    function canAccrue() public view returns (bool) {
        return block.timestamp >= getNextSnapshotTime();
    }

    /// @inheritdoc ISnapshotStakingPool
    function getTimeUntilNextSnapshot() public view returns (uint256) {
        if (canAccrue()) {
            return 0;
        }
        return getNextSnapshotTime() - block.timestamp;
    }

    /// @inheritdoc ISnapshotStakingPool
    function getNextSnapshotTime() public view returns (uint256) {
        return lastSnapshotTime + snapshotDelay;
    }

    /// @inheritdoc ISnapshotStakingPool
    function canStake() public view returns (bool) {
        return block.timestamp < getNextSnapshotBufferTime();
    }

    /// @inheritdoc ISnapshotStakingPool
    function getTimeUntilNextSnapshotBuffer() public view returns (uint256) {
        if (!canStake()) {
            return 0;
        }
        return getNextSnapshotBufferTime() - block.timestamp;
    }

    /// @inheritdoc ISnapshotStakingPool
    function getNextSnapshotBufferTime() public view returns (uint256) {
        return getNextSnapshotTime() - snapshotBuffer;
    }

    /* INTERNAL FUNCTIONS */

    function _stake(address account, uint256 amount) internal {
        if (!canStake()) revert CannotStakeDuringBuffer();
        if (nextClaimId[account] == 0) {
            uint256 currentId = _getCurrentSnapshotId();
            nextClaimId[account] = currentId > 0 ? currentId : 1;
        }
        stakeToken.transferFrom(account, address(this), amount);
        super._mint(msg.sender, amount);
    }

    function _claim(address account, uint256 startSnapshotId, uint256 endSnapshotId) internal {
        uint256 amount = rewardOfInRange(account, startSnapshotId, endSnapshotId);
        nextClaimId[account] = endSnapshotId + 1;
        rewardToken.transfer(account, amount);
    }

    function _rewardAt(uint256 snapshotId) internal view returns (uint256) {
        return rewardSnapshots[snapshotId - 1];
    }

    function _rewardOfAt(address account, uint256 snapshotId) internal view returns (uint256) {
        return _rewardAt(snapshotId) * balanceOfAt(account, snapshotId) / totalSupplyAt(snapshotId);
    }

    function _rewardOfInRange(address account, uint256 startSnapshotId, uint256 endSnapshotId) internal view returns (uint256) {
        uint256 rewards = 0;
        for (uint256 i = startSnapshotId; i <= endSnapshotId; i++) {
            rewards += _rewardOfAt(account, i);
        }
        return rewards;
    }
}

File 7 of 23 : ISnapshotStakingPool.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface ISnapshotStakingPool is IERC20 {

    /// @notice Token to be distributed as rewards
    function rewardToken() external view returns (IERC20);

    /// @notice Token to be staked
    function stakeToken() external view returns (IERC20);

    /// @notice Distributor of rewards
    function distributor() external view returns (address);

    /// @notice The buffer time before snapshots during which staking is not allowed
    function snapshotBuffer() external view returns (uint256);

    /// @notice The minimum amount of time between snapshots
    function snapshotDelay() external view returns (uint256);

    /// @notice Last snapshot time
    function lastSnapshotTime() external view returns (uint256);

    /// @notice Next snapshot id for `account` to claim
    function nextClaimId(address account) external view returns (uint256);

    /// @notice Reward snapshot at `snapshotId`
    function rewardSnapshots(uint256) external view returns (uint256);

    /// @notice Get the reward snapshots
    function getRewardSnapshots() external view returns (uint256[] memory);

    /// @notice Stake `amount` of stakeToken from `msg.sender` and mint staked tokens.
    /// @param amount The amount of stakeToken to stake
    function stake(uint256 amount) external;

    /// @notice Unstake `amount` of stakeToken by `msg.sender`.
    /// @param amount The amount of stakeToken to unstake
    function unstake(uint256 amount) external;

    /// @notice ONLY DISTRIBUTOR: Accrue rewardToken and update snapshot.
    /// @param amount The amount of rewardToken to accrue
    function accrue(uint256 amount) external;

    /// @notice Claim the staking rewards from pending snapshots for `msg.sender`.
    function claim() external;

    /// @notice Claim partial staking rewards from pending snapshots for `msg.sender` from `_startClaimId` to `_endClaimId`.
    /// @param startSnapshotId The snapshot id to start the partial claim
    /// @param endSnapshotId The snapshot id to end the partial claim
    function claimPartial(uint256 startSnapshotId, uint256 endSnapshotId) external;

    /// @notice ONLY OWNER: Update the distributor address.
    /// @param newDistributor The new distributor address
    function setDistributor(address newDistributor) external;

    /// @notice ONLY OWNER: Update the snapshot buffer.
    /// @param newSnapshotBuffer The new snapshot buffer
    function setSnapshotBuffer(uint256 newSnapshotBuffer) external;

    /// @notice ONLY OWNER: Update the snapshot delay. Can set to 0 to disable snapshot delay.
    /// @param newSnapshotDelay The new snapshot delay
    function setSnapshotDelay(uint256 newSnapshotDelay) external;

    /// @notice Get the current snapshot id.
    /// @return The current snapshot id
    function getCurrentSnapshotId() external view returns (uint256);

    /// @notice Retrieves the rewards pending to be claimed by `account`.
    /// @param account The account to retrieve pending rewards for
    /// @return The rewards pending to be claimed by `account`
    function getPendingRewards(address account) external view returns (uint256);

    /// @notice Retrives the rewards of `account` in the range of `startSnapshotId` to `endSnapshotId`.
    /// @param account The account to retrieve rewards for
    /// @param startSnapshotId The start snapshot id
    /// @param endSnapshotId The end snapshot id
    /// @return The rewards of `account` in the range of `startSnapshotId` to `endSnapshotId`
    function rewardOfInRange(address account, uint256 startSnapshotId, uint256 endSnapshotId) external view returns (uint256);

    /// @notice Retrieves the rewards of `account` at the `snapshotId`.
    /// @param account The account to retrieve rewards for
    /// @param snapshotId The snapshot id
    /// @return The rewards of `account` at the `snapshotId`
    function rewardOfAt(address account, uint256 snapshotId) external view returns (uint256);

    /// @notice Retrieves the total pool reward at the time `snapshotId`.
    /// @param snapshotId The snapshot id
    /// @return The total pool reward at the time `snapshotId`
    function rewardAt(uint256 snapshotId) external view returns (uint256);

    /// @notice Retrieves the rewards across all snapshots for `account`.
    /// @param account The account to retrieve rewards for
    /// @return The rewards across all snapshots for `account`
    function getLifetimeRewards(address account) external view returns (uint256);

    /// @notice Check if rewards can be accrued.
    /// @return Boolean indicating if rewards can be accrued
    function canAccrue() external view returns (bool);

    /// @notice Get the time until the next snapshot.
    /// @return The time until the next snapshot
    function getTimeUntilNextSnapshot() external view returns (uint256);

    /// @notice Get the next snapshot time.
    /// @return The next snapshot time
    function getNextSnapshotTime() external view returns (uint256);

    /// @notice Check if staking is allowed.
    /// @return Boolean indicating if staking is allowed
    function canStake() external view returns (bool);

    /// @notice Get the time until the next snapshot buffer begins.
    /// @return The time until the next snapshot buffer begins
    function getTimeUntilNextSnapshotBuffer() external view returns (uint256);

    /// @notice Get the next snapshot buffer time.
    /// @return The next snapshot buffer time
    function getNextSnapshotBufferTime() external view returns (uint256);
}

File 8 of 23 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 9 of 23 : ShortStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

File 10 of 23 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

File 11 of 23 : IERC1271.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 *
 * _Available since v4.1._
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

File 12 of 23 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

File 13 of 23 : ERC20Snapshot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Snapshot.sol)

pragma solidity ^0.8.0;

import "../ERC20.sol";
import "../../../utils/Arrays.sol";
import "../../../utils/Counters.sol";

/**
 * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and
 * total supply at the time are recorded for later access.
 *
 * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.
 * In naive implementations it's possible to perform a "double spend" attack by reusing the same balance from different
 * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be
 * used to create an efficient ERC20 forking mechanism.
 *
 * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a
 * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot
 * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id
 * and the account address.
 *
 * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it
 * return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this
 * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.
 *
 * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient
 * alternative consider {ERC20Votes}.
 *
 * ==== Gas Costs
 *
 * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log
 * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much
 * smaller since identical balances in subsequent snapshots are stored as a single entry.
 *
 * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is
 * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent
 * transfers will have normal cost until the next snapshot, and so on.
 */

abstract contract ERC20Snapshot is ERC20 {
    // Inspired by Jordi Baylina's MiniMeToken to record historical balances:
    // https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol

    using Arrays for uint256[];
    using Counters for Counters.Counter;

    // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a
    // Snapshot struct, but that would impede usage of functions that work on an array.
    struct Snapshots {
        uint256[] ids;
        uint256[] values;
    }

    mapping(address => Snapshots) private _accountBalanceSnapshots;
    Snapshots private _totalSupplySnapshots;

    // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.
    Counters.Counter private _currentSnapshotId;

    /**
     * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.
     */
    event Snapshot(uint256 id);

    /**
     * @dev Creates a new snapshot and returns its snapshot id.
     *
     * Emits a {Snapshot} event that contains the same id.
     *
     * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a
     * set of accounts, for example using {AccessControl}, or it may be open to the public.
     *
     * [WARNING]
     * ====
     * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,
     * you must consider that it can potentially be used by attackers in two ways.
     *
     * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow
     * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target
     * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs
     * section above.
     *
     * We haven't measured the actual numbers; if this is something you're interested in please reach out to us.
     * ====
     */
    function _snapshot() internal virtual returns (uint256) {
        _currentSnapshotId.increment();

        uint256 currentId = _getCurrentSnapshotId();
        emit Snapshot(currentId);
        return currentId;
    }

    /**
     * @dev Get the current snapshotId
     */
    function _getCurrentSnapshotId() internal view virtual returns (uint256) {
        return _currentSnapshotId.current();
    }

    /**
     * @dev Retrieves the balance of `account` at the time `snapshotId` was created.
     */
    function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {
        (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);

        return snapshotted ? value : balanceOf(account);
    }

    /**
     * @dev Retrieves the total supply at the time `snapshotId` was created.
     */
    function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {
        (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);

        return snapshotted ? value : totalSupply();
    }

    // Update balance and/or total supply snapshots before the values are modified. This is implemented
    // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
        super._beforeTokenTransfer(from, to, amount);

        if (from == address(0)) {
            // mint
            _updateAccountSnapshot(to);
            _updateTotalSupplySnapshot();
        } else if (to == address(0)) {
            // burn
            _updateAccountSnapshot(from);
            _updateTotalSupplySnapshot();
        } else {
            // transfer
            _updateAccountSnapshot(from);
            _updateAccountSnapshot(to);
        }
    }

    function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {
        require(snapshotId > 0, "ERC20Snapshot: id is 0");
        require(snapshotId <= _getCurrentSnapshotId(), "ERC20Snapshot: nonexistent id");

        // When a valid snapshot is queried, there are three possibilities:
        //  a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never
        //  created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds
        //  to this id is the current one.
        //  b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the
        //  requested id, and its value is the one to return.
        //  c) More snapshots were created after the requested one, and the queried value was later modified. There will be
        //  no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is
        //  larger than the requested one.
        //
        // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if
        // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does
        // exactly this.

        uint256 index = snapshots.ids.findUpperBound(snapshotId);

        if (index == snapshots.ids.length) {
            return (false, 0);
        } else {
            return (true, snapshots.values[index]);
        }
    }

    function _updateAccountSnapshot(address account) private {
        _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));
    }

    function _updateTotalSupplySnapshot() private {
        _updateSnapshot(_totalSupplySnapshots, totalSupply());
    }

    function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {
        uint256 currentId = _getCurrentSnapshotId();
        if (_lastSnapshotId(snapshots.ids) < currentId) {
            snapshots.ids.push(currentId);
            snapshots.values.push(currentValue);
        }
    }

    function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {
        if (ids.length == 0) {
            return 0;
        } else {
            return ids[ids.length - 1];
        }
    }
}

File 14 of 23 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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 15 of 23 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 16 of 23 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 17 of 23 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

File 18 of 23 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 19 of 23 : 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 20 of 23 : Arrays.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Arrays.sol)

pragma solidity ^0.8.0;

import "./StorageSlot.sol";
import "./math/Math.sol";

/**
 * @dev Collection of functions related to array types.
 */
library Arrays {
    using StorageSlot for bytes32;

    /**
     * @dev Searches a sorted `array` and returns the first index that contains
     * a value greater or equal to `element`. If no such index exists (i.e. all
     * values in the array are strictly less than `element`), the array length is
     * returned. Time complexity O(log n).
     *
     * `array` is expected to be sorted in ascending order, and to contain no
     * repeated elements.
     */
    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        if (array.length == 0) {
            return 0;
        }

        uint256 low = 0;
        uint256 high = array.length;

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds down (it does integer division with truncation).
            if (unsafeAccess(array, mid).value > element) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
        if (low > 0 && unsafeAccess(array, low - 1).value == element) {
            return low - 1;
        } else {
            return low;
        }
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getAddressSlot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getBytes32Slot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getUint256Slot();
    }
}

File 21 of 23 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 22 of 23 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 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 256, 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 << 3) < value ? 1 : 0);
        }
    }
}

File 23 of 23 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "index-coop-smart-contracts/=lib/index-coop-smart-contracts/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"eip712Name","type":"string"},{"internalType":"string","name":"eip712Version","type":"string"},{"internalType":"string","name":"stakeMessage","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"contract IERC20","name":"stakeToken","type":"address"},{"internalType":"address","name":"distributor","type":"address"},{"internalType":"uint256","name":"snapshotBuffer","type":"uint256"},{"internalType":"uint256","name":"snapshotDelay","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CannotAccrueWithZeroStakedSupply","type":"error"},{"inputs":[],"name":"CannotAccrueZero","type":"error"},{"inputs":[],"name":"CannotClaimFromPastSnapshots","type":"error"},{"inputs":[],"name":"CannotStakeDuringBuffer","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSnapshotBuffer","type":"error"},{"inputs":[],"name":"InvalidSnapshotDelay","type":"error"},{"inputs":[],"name":"InvalidSnapshotId","type":"error"},{"inputs":[],"name":"MustBeDistributor","type":"error"},{"inputs":[],"name":"NonExistentSnapshotId","type":"error"},{"inputs":[],"name":"NotApprovedStaker","type":"error"},{"inputs":[],"name":"SnapshotDelayNotPassed","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[],"name":"TransfersNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newDistributor","type":"address"}],"name":"DistributorChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newMessage","type":"string"}],"name":"MessageChanged","type":"event"},{"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":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Snapshot","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newSnapshotBuffer","type":"uint256"}],"name":"SnapshotBufferChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newSnapshotDelay","type":"uint256"}],"name":"SnapshotDelayChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"}],"name":"StakerApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"accrue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"approveStaker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"balanceOfAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canAccrue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canStake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startSnapshotId","type":"uint256"},{"internalType":"uint256","name":"endSnapshotId","type":"uint256"}],"name":"claimPartial","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentSnapshotId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getLifetimeRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextSnapshotBufferTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextSnapshotTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardSnapshots","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakeSignatureDigest","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimeUntilNextSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimeUntilNextSnapshotBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isApprovedStaker","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSnapshotTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"message","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nextClaimId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"rewardAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"rewardOfAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"startSnapshotId","type":"uint256"},{"internalType":"uint256","name":"endSnapshotId","type":"uint256"}],"name":"rewardOfInRange","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardSnapshots","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newDistributor","type":"address"}],"name":"setDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newMessage","type":"string"}],"name":"setMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newSnapshotBuffer","type":"uint256"}],"name":"setSnapshotBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newSnapshotDelay","type":"uint256"}],"name":"setSnapshotDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"snapshotBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"snapshotDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101a06040523480156200001257600080fd5b506040516200302e3803806200302e8339810160408190526200003591620003ab565b89898888888888888886866200004b33620001a1565b60046200005983826200056a565b5060056200006882826200056a565b50506001600a5550808211156200009257604051631962358f60e31b815260040160405180910390fd5b6001600160a01b0394851660805292841660a052600b80546001600160a01b0319169290941691909117909255600e91909155600f55505042601055620000db826011620001f1565b61016052620000ec816012620001f1565b61018052815160208084019190912061012052815190820120610140524660e0526200017c6101205161014051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60c0525050306101005262000191886200022a565b5050505050505050505062000690565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020835110156200021157620002098362000275565b905062000224565b816200021e84826200056a565b5060ff90505b92915050565b60136200023882826200056a565b507fbb4847942d98bb5bb249692c72ce235605e41502e705831e609875320ef2cac7816040516200026a919062000636565b60405180910390a150565b600080829050601f81511115620002ac578260405163305a27a960e01b8152600401620002a3919062000636565b60405180910390fd5b8051620002b9826200066b565b179392505050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620002f4578181015183820152602001620002da565b50506000910152565b600082601f8301126200030f57600080fd5b81516001600160401b03808211156200032c576200032c620002c1565b604051601f8301601f19908116603f01168101908282118183101715620003575762000357620002c1565b816040528381528660208588010111156200037157600080fd5b62000384846020830160208901620002d7565b9695505050505050565b80516001600160a01b0381168114620003a657600080fd5b919050565b6000806000806000806000806000806101408b8d031215620003cc57600080fd5b8a516001600160401b0380821115620003e457600080fd5b620003f28e838f01620002fd565b9b5060208d01519150808211156200040957600080fd5b620004178e838f01620002fd565b9a5060408d01519150808211156200042e57600080fd5b6200043c8e838f01620002fd565b995060608d01519150808211156200045357600080fd5b620004618e838f01620002fd565b985060808d01519150808211156200047857600080fd5b50620004878d828e01620002fd565b9650506200049860a08c016200038e565b9450620004a860c08c016200038e565b9350620004b860e08c016200038e565b92506101008b015191506101208b015190509295989b9194979a5092959850565b600181811c90821680620004ee57607f821691505b6020821081036200050f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000565576000816000526020600020601f850160051c81016020861015620005405750805b601f850160051c820191505b8181101562000561578281556001016200054c565b5050505b505050565b81516001600160401b03811115620005865762000586620002c1565b6200059e81620005978454620004d9565b8462000515565b602080601f831160018114620005d65760008415620005bd5750858301515b600019600386901b1c1916600185901b17855562000561565b600085815260208120601f198616915b828110156200060757888601518255948401946001909101908401620005e6565b5085821015620006265787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b602081526000825180602084015262000657816040850160208701620002d7565b601f01601f19169190910160400192915050565b805160208083015191908110156200050f5760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051610180516129116200071d6000396000610e9c01526000610e7101526000611e8701526000611e5f01526000611dba01526000611de401526000611e0e0152600081816104800152818161087d015261154f0152600081816106b701528181610c4801526117f301526129116000f3fe608060405234801561001057600080fd5b506004361061030c5760003560e01c8063744f4cf61161019d578063a457c2d7116100e9578063c7029999116100a2578063ed56e4301161007c578063ed56e43014610684578063f2fde38b1461068c578063f6ed20171461069f578063f7c618c1146106b257600080fd5b8063c702999914610661578063dd62ed3e14610669578063e21f37ce1461067c57600080fd5b8063a457c2d7146105fe578063a694fc3a14610611578063a9059cbb14610624578063be74baf214610632578063bfe109281461063b578063c2d4413c1461064e57600080fd5b8063857f4864116101565780639320e605116101305780639320e605146105c657806395d89b41146105db578063981b24d0146105e35780639ed27809146105f657600080fd5b8063857f4864146105a45780638da5cb5b146105ac578063913db157146105bd57600080fd5b8063744f4cf61461052a57806375619ab51461053d5780637c4e4ab3146105505780637d3f0e7d146105635780637e9d05f71461057657806384b0196e1461058957600080fd5b806342f667ec1161025c5780635439ad86116102155780635e94d4e8116101ef5780635e94d4e8146104e85780636afc62e4146104f157806370a08231146104f9578063715018a61461052257600080fd5b80635439ad86146104ba5780635c1b6119146104c25780635d648588146104d557600080fd5b806342f667ec146104225780634854424e146104455780634ca4b539146104585780634e71d92d146104605780634ee2cd7e1461046857806351ed6a301461047b57600080fd5b80632ad2b7e1116102c9578063357f5d7a116102a3578063357f5d7a146103c9578063368b8772146103e9578063373f6d9d146103fc578063395093511461040f57600080fd5b80632ad2b7e1146103945780632e17de78146103a7578063313ce567146103ba57600080fd5b806306863e261461031157806306fdde031461032c578063095ea7b3146103415780630e89439b1461036457806318160ddd1461037957806323b872dd14610381575b600080fd5b6103196106d9565b6040519081526020015b60405180910390f35b6103346106f5565b604051610323919061224f565b61035461034f366004612279565b610787565b6040519015158152602001610323565b6103776103723660046122e5565b6107a1565b005b600354610319565b61035461038f366004612331565b6107cd565b6103776103a236600461236d565b6107e8565b6103776103b536600461236d565b61084f565b60405160128152602001610323565b6103196103d7366004612386565b600c6020526000908152604090205481565b6103776103f73660046123b7565b610900565b61037761040a36600461236d565b610911565b61035461041d366004612279565b610971565b610354610430366004612386565b60146020526000908152604090205460ff1681565b610377610453366004612468565b610993565b6103196109e4565b610377610a01565b610319610476366004612279565b610a3f565b6104a27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610323565b610319610a98565b6103776104d036600461248a565b610aa2565b6103196104e336600461236d565b610aad565b610319600f5481565b610319610ace565b610319610507366004612386565b6001600160a01b031660009081526001602052604090205490565b610377610b78565b61037761053836600461236d565b610b8a565b61037761054b366004612386565b610cff565b61031961055e3660046124cc565b610d55565b610319610571366004612386565b610dbd565b61031961058436600461236d565b610e0f565b610591610e63565b604051610323979695949392919061253b565b610319610eec565b6000546001600160a01b03166104a2565b610319600e5481565b6105ce610efe565b60405161032391906125ab565b610334610f55565b6103196105f136600461236d565b610f64565b610354610f85565b61035461060c366004612279565b610f96565b61037761061f36600461236d565b611021565b61035461038f366004612279565b61031960105481565b600b546104a2906001600160a01b031681565b61031961065c366004612279565b61106d565b6103546110c2565b6103196106773660046125be565b6110d4565b6103346110ff565b61031961118d565b61037761069a366004612386565b6111ab565b6103196106ad366004612386565b611221565b6104a27f000000000000000000000000000000000000000000000000000000000000000081565b6000600e546106e6610eec565b6106f09190612607565b905090565b6060600480546107049061261a565b80601f01602080910402602001604051908101604052809291908181526020018280546107309061261a565b801561077d5780601f106107525761010080835404028352916020019161077d565b820191906000526020600020905b81548152906001019060200180831161076057829003601f168201915b5050505050905090565b600033610795818585611277565b60019150505b92915050565b6107a961139b565b6107b43383836113f4565b6107be33846114a7565b6107c86001600a55565b505050565b600060405163ab064ad360e01b815260040160405180910390fd5b6107f06115c7565b80600e541115610813576040516318d7cfc960e11b815260040160405180910390fd5b600f8190556040518181527fac73a90e92241d825f00fe635380c3a52d9764a66fe05df6ba465ca269cdcf8e906020015b60405180910390a150565b61085761139b565b6108613382611621565b60405163a9059cbb60e01b8152336004820152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156108ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f29190612654565b506108fd6001600a55565b50565b6109086115c7565b6108fd81611761565b6109196115c7565b600f5481111561093c57604051631962358f60e31b815260040160405180910390fd5b600e8190556040518181527fe7ada3f086eaa57ed8ea5f0ee543b7e9e80ffe73cdc79b63c51eeade5fe7228690602001610844565b60003361079581858561098483836110d4565b61098e9190612676565b611277565b61099b61139b565b336000908152600c60205260409020548210156109cb5760405163045587fd60e31b815260040160405180910390fd5b6109d633838361179d565b6109e06001600a55565b5050565b60006109ee610f85565b6109f85750600090565b426106e66106d9565b610a0961139b565b6000610a13611867565b336000818152600c6020526040902054919250610a3190828461179d565b5050610a3d6001600a55565b565b6001600160a01b038216600090815260066020526040812081908190610a66908590611872565b9150915081610a8d576001600160a01b038516600090815260016020526040902054610a8f565b805b95945050505050565b60006106f0611867565b6109e03383836113f4565b600d8181548110610abd57600080fd5b600091825260209091200154905081565b60006106f06040518060400160405280601c81526020017f5374616b654d65737361676528737472696e67206d6573736167652900000000815250604051602001610b199190612689565b604051602081830303815290604052805190602001206013604051610b3e91906126a5565b604051908190038120610b5d9291602001918252602082015260400190565b60405160208183030381529060405280519060200120611968565b610b806115c7565b610a3d6000611995565b610b9261139b565b600b546001600160a01b03163314610bbd5760405163086bf14760e21b815260040160405180910390fd5b80600003610bde5760405163010cb85960e41b815260040160405180910390fd5b600354600003610c0157604051630355041f60e11b815260040160405180910390fd5b610c096110c2565b610c2657604051636f407c6b60e11b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610c99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbd9190612654565b5042601055600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb5018190556108f26119e5565b610d076115c7565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe37acc13f5ed9d0cc83c2842e093fe5a494d5b8fb5b1db06356b327081832f5290602001610844565b600082600003610d78576040516342f66ec960e01b815260040160405180910390fd5b81831180610d8c5750610d89611867565b82115b15610daa57604051630ea8635b60e41b815260040160405180910390fd5b610db5848484611a3f565b949350505050565b600080610dc8611867565b6001600160a01b0384166000908152600c60205260409020549091501580610dee575080155b15610dfc5750600092915050565b610e0883600183611a3f565b9392505050565b600081600003610e32576040516342f66ec960e01b815260040160405180910390fd5b610e3a611867565b821115610e5a57604051630ea8635b60e41b815260040160405180910390fd5b61079b82611a7c565b600060608082808083610e977f00000000000000000000000000000000000000000000000000000000000000006011611aad565b610ec27f00000000000000000000000000000000000000000000000000000000000000006012611aad565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6000600f546010546106f09190612676565b6060600d80548060200260200160405190810160405280929190818152602001828054801561077d57602002820191906000526020600020905b815481526020019060010190808311610f38575050505050905090565b6060600580546107049061261a565b6000806000610f74846007611872565b9150915081610e0857600354610db5565b6000610f8f6106d9565b4210905090565b60003381610fa482866110d4565b9050838110156110095760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6110168286868403611277565b506001949350505050565b61102961139b565b3360009081526014602052604090205460ff1661105957604051630e56a41760e31b815260040160405180910390fd5b61106333826114a7565b6108fd6001600a55565b600081600003611090576040516342f66ec960e01b815260040160405180910390fd5b611098611867565b8211156110b857604051630ea8635b60e41b815260040160405180910390fd5b610e088383611b58565b60006110cc610eec565b421015905090565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6013805461110c9061261a565b80601f01602080910402602001604051908101604052809291908181526020018280546111389061261a565b80156111855780601f1061115a57610100808354040283529160200191611185565b820191906000526020600020905b81548152906001019060200180831161116857829003601f168201915b505050505081565b60006111976110c2565b156111a25750600090565b426106e6610eec565b6111b36115c7565b6001600160a01b0381166112185760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611000565b6108fd81611995565b60008061122c611867565b6001600160a01b0384166000908152600c6020526040902054909150801580611253575081155b8061125d57508181115b1561126c575060009392505050565b610db5848284611a3f565b6001600160a01b0383166112d95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611000565b6001600160a01b03821661133a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611000565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6002600a54036113ed5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611000565b6002600a55565b61143c83611400610ace565b84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b8a92505050565b61145957604051638baa579f60e01b815260040160405180910390fd5b6001600160a01b038316600081815260146020526040808220805460ff19166001179055517fdad95f091b1c8a016983f3274e809d4365bf521cfb310b8fbdac95814601c6d89190a2505050565b6114af610f85565b6114cc57604051630123178760e31b815260040160405180910390fd5b6001600160a01b0382166000908152600c602052604081205490036115235760006114f5611867565b905060008111611506576001611508565b805b6001600160a01b0384166000908152600c6020526040902055505b6040516323b872dd60e01b81526001600160a01b038381166004830152306024830152604482018390527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303816000875af1158015611598573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115bc9190612654565b506109e03382611beb565b6000546001600160a01b03163314610a3d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611000565b6001600160a01b0382166116815760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611000565b61168d82600083611cb8565b6001600160a01b038216600090815260016020526040902054818110156117015760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611000565b6001600160a01b03831660008181526001602090815260408083208686039055600380548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b601361176d828261276b565b507fbb4847942d98bb5bb249692c72ce235605e41502e705831e609875320ef2cac781604051610844919061224f565b60006117aa848484610d55565b90506117b7826001612676565b6001600160a01b038581166000818152600c60205260409081902093909355915163a9059cbb60e01b81526004810192909252602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af115801561183c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118609190612654565b5050505050565b60006106f060095490565b600080600084116118be5760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b6044820152606401611000565b6118c6611867565b8411156119155760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e742069640000006044820152606401611000565b60006119218486611d00565b84549091508103611939576000809250925050611961565b60018460010182815481106119505761195061282b565b906000526020600020015492509250505b9250929050565b600061079b611975611dad565b8360405161190160f01b8152600281019290925260228201526042902090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006119f5600980546001019055565b60006119ff611867565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb6781604051611a3291815260200190565b60405180910390a1919050565b600080835b838111611a7357611a558682611b58565b611a5f9083612676565b915080611a6b81612841565b915050611a44565b50949350505050565b6000600d611a8b600184612607565b81548110611a9b57611a9b61282b565b90600052602060002001549050919050565b606060ff8314611ac757611ac083611ed8565b905061079b565b818054611ad39061261a565b80601f0160208091040260200160405190810160405280929190818152602001828054611aff9061261a565b8015611b4c5780601f10611b2157610100808354040283529160200191611b4c565b820191906000526020600020905b815481529060010190602001808311611b2f57829003601f168201915b5050505050905061079b565b6000611b6382610f64565b611b6d8484610a3f565b611b7684611a7c565b611b80919061285a565b610e089190612871565b6000806000611b998585611f17565b90925090506000816004811115611bb257611bb2612893565b148015611bd05750856001600160a01b0316826001600160a01b0316145b80611be15750611be1868686611f59565b9695505050505050565b6001600160a01b038216611c415760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611000565b611c4d60008383611cb8565b8060036000828254611c5f9190612676565b90915550506001600160a01b0382166000818152600160209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b038316611cd757611ccf82612045565b6107c8612078565b6001600160a01b038216611cee57611ccf83612045565b611cf783612045565b6107c882612045565b81546000908103611d135750600061079b565b82546000905b80821015611d60576000611d2d8383612086565b60008781526020902090915085908201541115611d4c57809150611d5a565b611d57816001612676565b92505b50611d19565b600082118015611d8c575083611d8986611d7b600186612607565b600091825260209091200190565b54145b15611da557611d9c600183612607565b9250505061079b565b50905061079b565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015611e0657507f000000000000000000000000000000000000000000000000000000000000000046145b15611e3057507f000000000000000000000000000000000000000000000000000000000000000090565b6106f0604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60606000611ee5836120a1565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000808251604103611f4d5760208301516040840151606085015160001a611f41878285856120c9565b94509450505050611961565b50600090506002611961565b6000806000856001600160a01b0316631626ba7e60e01b8686604051602401611f839291906128a9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611fc19190612689565b600060405180830381855afa9150503d8060008114611ffc576040519150601f19603f3d011682016040523d82523d6000602084013e612001565b606091505b509150915081801561201557506020815110155b8015611be157508051630b135d3f60e11b9061203a90830160209081019084016128c2565b149695505050505050565b6001600160a01b03811660009081526006602090815260408083206001909252909120546108fd919061218d565b61218d565b610a3d600761207360035490565b60006120956002848418612871565b610e0890848416612676565b600060ff8216601f81111561079b57604051632cd44ac360e21b815260040160405180910390fd5b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156121005750600090506003612184565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612154573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661217d57600060019250925050612184565b9150600090505b94509492505050565b6000612197611867565b9050806121a3846121d7565b10156107c8578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b805460009081036121ea57506000919050565b81548290611a8b90600190612607565b919050565b60005b8381101561221a578181015183820152602001612202565b50506000910152565b6000815180845261223b8160208601602086016121ff565b601f01601f19169290920160200192915050565b602081526000610e086020830184612223565b80356001600160a01b03811681146121fa57600080fd5b6000806040838503121561228c57600080fd5b61229583612262565b946020939093013593505050565b60008083601f8401126122b557600080fd5b50813567ffffffffffffffff8111156122cd57600080fd5b60208301915083602082850101111561196157600080fd5b6000806000604084860312156122fa57600080fd5b83359250602084013567ffffffffffffffff81111561231857600080fd5b612324868287016122a3565b9497909650939450505050565b60008060006060848603121561234657600080fd5b61234f84612262565b925061235d60208501612262565b9150604084013590509250925092565b60006020828403121561237f57600080fd5b5035919050565b60006020828403121561239857600080fd5b610e0882612262565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156123c957600080fd5b813567ffffffffffffffff808211156123e157600080fd5b818401915084601f8301126123f557600080fd5b813581811115612407576124076123a1565b604051601f8201601f19908116603f0116810190838211818310171561242f5761242f6123a1565b8160405282815287602084870101111561244857600080fd5b826020860160208301376000928101602001929092525095945050505050565b6000806040838503121561247b57600080fd5b50508035926020909101359150565b6000806020838503121561249d57600080fd5b823567ffffffffffffffff8111156124b457600080fd5b6124c0858286016122a3565b90969095509350505050565b6000806000606084860312156124e157600080fd5b6124ea84612262565b95602085013595506040909401359392505050565b60008151808452602080850194506020840160005b8381101561253057815187529582019590820190600101612514565b509495945050505050565b60ff60f81b8816815260e06020820152600061255a60e0830189612223565b828103604084015261256c8189612223565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152905061259d81856124ff565b9a9950505050505050505050565b602081526000610e0860208301846124ff565b600080604083850312156125d157600080fd5b6125da83612262565b91506125e860208401612262565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561079b5761079b6125f1565b600181811c9082168061262e57607f821691505b60208210810361264e57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561266657600080fd5b81518015158114610e0857600080fd5b8082018082111561079b5761079b6125f1565b6000825161269b8184602087016121ff565b9190910192915050565b60008083546126b38161261a565b600182811680156126cb57600181146126e05761270f565b60ff198416875282151583028701945061270f565b8760005260208060002060005b858110156127065781548a8201529084019082016126ed565b50505082870194505b50929695505050505050565b601f8211156107c8576000816000526020600020601f850160051c810160208610156127445750805b601f850160051c820191505b8181101561276357828155600101612750565b505050505050565b815167ffffffffffffffff811115612785576127856123a1565b61279981612793845461261a565b8461271b565b602080601f8311600181146127ce57600084156127b65750858301515b600019600386901b1c1916600185901b178555612763565b600085815260208120601f198616915b828110156127fd578886015182559484019460019091019084016127de565b508582101561281b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b600060018201612853576128536125f1565b5060010190565b808202811582820484141761079b5761079b6125f1565b60008261288e57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052602160045260246000fd5b828152604060208201526000610db56040830184612223565b6000602082840312156128d457600080fd5b505191905056fea264697066735822122032d6e5e79ee285fb2bd9164b524fade708e5449b3af7387d7a4d34dd20c3596264736f6c634300081800330000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000260000000000000000000000000c4506022fb8090774e8a628d5084eed61d9b99ee00000000000000000000000099f6539df9840592a862ab916ddc3258a1d7a77300000000000000000000000043c3ef32e52f17777789c71002ef4a887df9061300000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000a496e64657820436f6f700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000025631000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c492068617665207265616420616e642061636365707420746865205465726d73206f6620536572766963652e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f48696768205969656c642045544820496e646578205374616b6564205052540000000000000000000000000000000000000000000000000000000000000000097350727448794554480000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061030c5760003560e01c8063744f4cf61161019d578063a457c2d7116100e9578063c7029999116100a2578063ed56e4301161007c578063ed56e43014610684578063f2fde38b1461068c578063f6ed20171461069f578063f7c618c1146106b257600080fd5b8063c702999914610661578063dd62ed3e14610669578063e21f37ce1461067c57600080fd5b8063a457c2d7146105fe578063a694fc3a14610611578063a9059cbb14610624578063be74baf214610632578063bfe109281461063b578063c2d4413c1461064e57600080fd5b8063857f4864116101565780639320e605116101305780639320e605146105c657806395d89b41146105db578063981b24d0146105e35780639ed27809146105f657600080fd5b8063857f4864146105a45780638da5cb5b146105ac578063913db157146105bd57600080fd5b8063744f4cf61461052a57806375619ab51461053d5780637c4e4ab3146105505780637d3f0e7d146105635780637e9d05f71461057657806384b0196e1461058957600080fd5b806342f667ec1161025c5780635439ad86116102155780635e94d4e8116101ef5780635e94d4e8146104e85780636afc62e4146104f157806370a08231146104f9578063715018a61461052257600080fd5b80635439ad86146104ba5780635c1b6119146104c25780635d648588146104d557600080fd5b806342f667ec146104225780634854424e146104455780634ca4b539146104585780634e71d92d146104605780634ee2cd7e1461046857806351ed6a301461047b57600080fd5b80632ad2b7e1116102c9578063357f5d7a116102a3578063357f5d7a146103c9578063368b8772146103e9578063373f6d9d146103fc578063395093511461040f57600080fd5b80632ad2b7e1146103945780632e17de78146103a7578063313ce567146103ba57600080fd5b806306863e261461031157806306fdde031461032c578063095ea7b3146103415780630e89439b1461036457806318160ddd1461037957806323b872dd14610381575b600080fd5b6103196106d9565b6040519081526020015b60405180910390f35b6103346106f5565b604051610323919061224f565b61035461034f366004612279565b610787565b6040519015158152602001610323565b6103776103723660046122e5565b6107a1565b005b600354610319565b61035461038f366004612331565b6107cd565b6103776103a236600461236d565b6107e8565b6103776103b536600461236d565b61084f565b60405160128152602001610323565b6103196103d7366004612386565b600c6020526000908152604090205481565b6103776103f73660046123b7565b610900565b61037761040a36600461236d565b610911565b61035461041d366004612279565b610971565b610354610430366004612386565b60146020526000908152604090205460ff1681565b610377610453366004612468565b610993565b6103196109e4565b610377610a01565b610319610476366004612279565b610a3f565b6104a27f00000000000000000000000099f6539df9840592a862ab916ddc3258a1d7a77381565b6040516001600160a01b039091168152602001610323565b610319610a98565b6103776104d036600461248a565b610aa2565b6103196104e336600461236d565b610aad565b610319600f5481565b610319610ace565b610319610507366004612386565b6001600160a01b031660009081526001602052604090205490565b610377610b78565b61037761053836600461236d565b610b8a565b61037761054b366004612386565b610cff565b61031961055e3660046124cc565b610d55565b610319610571366004612386565b610dbd565b61031961058436600461236d565b610e0f565b610591610e63565b604051610323979695949392919061253b565b610319610eec565b6000546001600160a01b03166104a2565b610319600e5481565b6105ce610efe565b60405161032391906125ab565b610334610f55565b6103196105f136600461236d565b610f64565b610354610f85565b61035461060c366004612279565b610f96565b61037761061f36600461236d565b611021565b61035461038f366004612279565b61031960105481565b600b546104a2906001600160a01b031681565b61031961065c366004612279565b61106d565b6103546110c2565b6103196106773660046125be565b6110d4565b6103346110ff565b61031961118d565b61037761069a366004612386565b6111ab565b6103196106ad366004612386565b611221565b6104a27f000000000000000000000000c4506022fb8090774e8a628d5084eed61d9b99ee81565b6000600e546106e6610eec565b6106f09190612607565b905090565b6060600480546107049061261a565b80601f01602080910402602001604051908101604052809291908181526020018280546107309061261a565b801561077d5780601f106107525761010080835404028352916020019161077d565b820191906000526020600020905b81548152906001019060200180831161076057829003601f168201915b5050505050905090565b600033610795818585611277565b60019150505b92915050565b6107a961139b565b6107b43383836113f4565b6107be33846114a7565b6107c86001600a55565b505050565b600060405163ab064ad360e01b815260040160405180910390fd5b6107f06115c7565b80600e541115610813576040516318d7cfc960e11b815260040160405180910390fd5b600f8190556040518181527fac73a90e92241d825f00fe635380c3a52d9764a66fe05df6ba465ca269cdcf8e906020015b60405180910390a150565b61085761139b565b6108613382611621565b60405163a9059cbb60e01b8152336004820152602481018290527f00000000000000000000000099f6539df9840592a862ab916ddc3258a1d7a7736001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156108ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f29190612654565b506108fd6001600a55565b50565b6109086115c7565b6108fd81611761565b6109196115c7565b600f5481111561093c57604051631962358f60e31b815260040160405180910390fd5b600e8190556040518181527fe7ada3f086eaa57ed8ea5f0ee543b7e9e80ffe73cdc79b63c51eeade5fe7228690602001610844565b60003361079581858561098483836110d4565b61098e9190612676565b611277565b61099b61139b565b336000908152600c60205260409020548210156109cb5760405163045587fd60e31b815260040160405180910390fd5b6109d633838361179d565b6109e06001600a55565b5050565b60006109ee610f85565b6109f85750600090565b426106e66106d9565b610a0961139b565b6000610a13611867565b336000818152600c6020526040902054919250610a3190828461179d565b5050610a3d6001600a55565b565b6001600160a01b038216600090815260066020526040812081908190610a66908590611872565b9150915081610a8d576001600160a01b038516600090815260016020526040902054610a8f565b805b95945050505050565b60006106f0611867565b6109e03383836113f4565b600d8181548110610abd57600080fd5b600091825260209091200154905081565b60006106f06040518060400160405280601c81526020017f5374616b654d65737361676528737472696e67206d6573736167652900000000815250604051602001610b199190612689565b604051602081830303815290604052805190602001206013604051610b3e91906126a5565b604051908190038120610b5d9291602001918252602082015260400190565b60405160208183030381529060405280519060200120611968565b610b806115c7565b610a3d6000611995565b610b9261139b565b600b546001600160a01b03163314610bbd5760405163086bf14760e21b815260040160405180910390fd5b80600003610bde5760405163010cb85960e41b815260040160405180910390fd5b600354600003610c0157604051630355041f60e11b815260040160405180910390fd5b610c096110c2565b610c2657604051636f407c6b60e11b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018290527f000000000000000000000000c4506022fb8090774e8a628d5084eed61d9b99ee6001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610c99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbd9190612654565b5042601055600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb5018190556108f26119e5565b610d076115c7565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe37acc13f5ed9d0cc83c2842e093fe5a494d5b8fb5b1db06356b327081832f5290602001610844565b600082600003610d78576040516342f66ec960e01b815260040160405180910390fd5b81831180610d8c5750610d89611867565b82115b15610daa57604051630ea8635b60e41b815260040160405180910390fd5b610db5848484611a3f565b949350505050565b600080610dc8611867565b6001600160a01b0384166000908152600c60205260409020549091501580610dee575080155b15610dfc5750600092915050565b610e0883600183611a3f565b9392505050565b600081600003610e32576040516342f66ec960e01b815260040160405180910390fd5b610e3a611867565b821115610e5a57604051630ea8635b60e41b815260040160405180910390fd5b61079b82611a7c565b600060608082808083610e977f496e64657820436f6f700000000000000000000000000000000000000000000a6011611aad565b610ec27f56310000000000000000000000000000000000000000000000000000000000026012611aad565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6000600f546010546106f09190612676565b6060600d80548060200260200160405190810160405280929190818152602001828054801561077d57602002820191906000526020600020905b815481526020019060010190808311610f38575050505050905090565b6060600580546107049061261a565b6000806000610f74846007611872565b9150915081610e0857600354610db5565b6000610f8f6106d9565b4210905090565b60003381610fa482866110d4565b9050838110156110095760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6110168286868403611277565b506001949350505050565b61102961139b565b3360009081526014602052604090205460ff1661105957604051630e56a41760e31b815260040160405180910390fd5b61106333826114a7565b6108fd6001600a55565b600081600003611090576040516342f66ec960e01b815260040160405180910390fd5b611098611867565b8211156110b857604051630ea8635b60e41b815260040160405180910390fd5b610e088383611b58565b60006110cc610eec565b421015905090565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6013805461110c9061261a565b80601f01602080910402602001604051908101604052809291908181526020018280546111389061261a565b80156111855780601f1061115a57610100808354040283529160200191611185565b820191906000526020600020905b81548152906001019060200180831161116857829003601f168201915b505050505081565b60006111976110c2565b156111a25750600090565b426106e6610eec565b6111b36115c7565b6001600160a01b0381166112185760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611000565b6108fd81611995565b60008061122c611867565b6001600160a01b0384166000908152600c6020526040902054909150801580611253575081155b8061125d57508181115b1561126c575060009392505050565b610db5848284611a3f565b6001600160a01b0383166112d95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611000565b6001600160a01b03821661133a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611000565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6002600a54036113ed5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611000565b6002600a55565b61143c83611400610ace565b84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b8a92505050565b61145957604051638baa579f60e01b815260040160405180910390fd5b6001600160a01b038316600081815260146020526040808220805460ff19166001179055517fdad95f091b1c8a016983f3274e809d4365bf521cfb310b8fbdac95814601c6d89190a2505050565b6114af610f85565b6114cc57604051630123178760e31b815260040160405180910390fd5b6001600160a01b0382166000908152600c602052604081205490036115235760006114f5611867565b905060008111611506576001611508565b805b6001600160a01b0384166000908152600c6020526040902055505b6040516323b872dd60e01b81526001600160a01b038381166004830152306024830152604482018390527f00000000000000000000000099f6539df9840592a862ab916ddc3258a1d7a77316906323b872dd906064016020604051808303816000875af1158015611598573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115bc9190612654565b506109e03382611beb565b6000546001600160a01b03163314610a3d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611000565b6001600160a01b0382166116815760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611000565b61168d82600083611cb8565b6001600160a01b038216600090815260016020526040902054818110156117015760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611000565b6001600160a01b03831660008181526001602090815260408083208686039055600380548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b601361176d828261276b565b507fbb4847942d98bb5bb249692c72ce235605e41502e705831e609875320ef2cac781604051610844919061224f565b60006117aa848484610d55565b90506117b7826001612676565b6001600160a01b038581166000818152600c60205260409081902093909355915163a9059cbb60e01b81526004810192909252602482018390527f000000000000000000000000c4506022fb8090774e8a628d5084eed61d9b99ee169063a9059cbb906044016020604051808303816000875af115801561183c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118609190612654565b5050505050565b60006106f060095490565b600080600084116118be5760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b6044820152606401611000565b6118c6611867565b8411156119155760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e742069640000006044820152606401611000565b60006119218486611d00565b84549091508103611939576000809250925050611961565b60018460010182815481106119505761195061282b565b906000526020600020015492509250505b9250929050565b600061079b611975611dad565b8360405161190160f01b8152600281019290925260228201526042902090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006119f5600980546001019055565b60006119ff611867565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb6781604051611a3291815260200190565b60405180910390a1919050565b600080835b838111611a7357611a558682611b58565b611a5f9083612676565b915080611a6b81612841565b915050611a44565b50949350505050565b6000600d611a8b600184612607565b81548110611a9b57611a9b61282b565b90600052602060002001549050919050565b606060ff8314611ac757611ac083611ed8565b905061079b565b818054611ad39061261a565b80601f0160208091040260200160405190810160405280929190818152602001828054611aff9061261a565b8015611b4c5780601f10611b2157610100808354040283529160200191611b4c565b820191906000526020600020905b815481529060010190602001808311611b2f57829003601f168201915b5050505050905061079b565b6000611b6382610f64565b611b6d8484610a3f565b611b7684611a7c565b611b80919061285a565b610e089190612871565b6000806000611b998585611f17565b90925090506000816004811115611bb257611bb2612893565b148015611bd05750856001600160a01b0316826001600160a01b0316145b80611be15750611be1868686611f59565b9695505050505050565b6001600160a01b038216611c415760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611000565b611c4d60008383611cb8565b8060036000828254611c5f9190612676565b90915550506001600160a01b0382166000818152600160209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b038316611cd757611ccf82612045565b6107c8612078565b6001600160a01b038216611cee57611ccf83612045565b611cf783612045565b6107c882612045565b81546000908103611d135750600061079b565b82546000905b80821015611d60576000611d2d8383612086565b60008781526020902090915085908201541115611d4c57809150611d5a565b611d57816001612676565b92505b50611d19565b600082118015611d8c575083611d8986611d7b600186612607565b600091825260209091200190565b54145b15611da557611d9c600183612607565b9250505061079b565b50905061079b565b6000306001600160a01b037f000000000000000000000000be03026716a4d5e0992f22a3e6494b4f2809a9c616148015611e0657507f000000000000000000000000000000000000000000000000000000000000000146145b15611e3057507f06b80097c23069a0087eaa3c5c843097823b46af57823b49630092e83b12ce1690565b6106f0604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527fe5c684cf12bca56a30d247b9a68c239988b5d6d2b99343fde5d15b1f5169fa0a918101919091527f4c23426613a5dc69e08fbd2787e6210aa679d4522e95a89d4dd88c4fd13a228360608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60606000611ee5836120a1565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000808251604103611f4d5760208301516040840151606085015160001a611f41878285856120c9565b94509450505050611961565b50600090506002611961565b6000806000856001600160a01b0316631626ba7e60e01b8686604051602401611f839291906128a9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611fc19190612689565b600060405180830381855afa9150503d8060008114611ffc576040519150601f19603f3d011682016040523d82523d6000602084013e612001565b606091505b509150915081801561201557506020815110155b8015611be157508051630b135d3f60e11b9061203a90830160209081019084016128c2565b149695505050505050565b6001600160a01b03811660009081526006602090815260408083206001909252909120546108fd919061218d565b61218d565b610a3d600761207360035490565b60006120956002848418612871565b610e0890848416612676565b600060ff8216601f81111561079b57604051632cd44ac360e21b815260040160405180910390fd5b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156121005750600090506003612184565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612154573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661217d57600060019250925050612184565b9150600090505b94509492505050565b6000612197611867565b9050806121a3846121d7565b10156107c8578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b805460009081036121ea57506000919050565b81548290611a8b90600190612607565b919050565b60005b8381101561221a578181015183820152602001612202565b50506000910152565b6000815180845261223b8160208601602086016121ff565b601f01601f19169290920160200192915050565b602081526000610e086020830184612223565b80356001600160a01b03811681146121fa57600080fd5b6000806040838503121561228c57600080fd5b61229583612262565b946020939093013593505050565b60008083601f8401126122b557600080fd5b50813567ffffffffffffffff8111156122cd57600080fd5b60208301915083602082850101111561196157600080fd5b6000806000604084860312156122fa57600080fd5b83359250602084013567ffffffffffffffff81111561231857600080fd5b612324868287016122a3565b9497909650939450505050565b60008060006060848603121561234657600080fd5b61234f84612262565b925061235d60208501612262565b9150604084013590509250925092565b60006020828403121561237f57600080fd5b5035919050565b60006020828403121561239857600080fd5b610e0882612262565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156123c957600080fd5b813567ffffffffffffffff808211156123e157600080fd5b818401915084601f8301126123f557600080fd5b813581811115612407576124076123a1565b604051601f8201601f19908116603f0116810190838211818310171561242f5761242f6123a1565b8160405282815287602084870101111561244857600080fd5b826020860160208301376000928101602001929092525095945050505050565b6000806040838503121561247b57600080fd5b50508035926020909101359150565b6000806020838503121561249d57600080fd5b823567ffffffffffffffff8111156124b457600080fd5b6124c0858286016122a3565b90969095509350505050565b6000806000606084860312156124e157600080fd5b6124ea84612262565b95602085013595506040909401359392505050565b60008151808452602080850194506020840160005b8381101561253057815187529582019590820190600101612514565b509495945050505050565b60ff60f81b8816815260e06020820152600061255a60e0830189612223565b828103604084015261256c8189612223565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152905061259d81856124ff565b9a9950505050505050505050565b602081526000610e0860208301846124ff565b600080604083850312156125d157600080fd5b6125da83612262565b91506125e860208401612262565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561079b5761079b6125f1565b600181811c9082168061262e57607f821691505b60208210810361264e57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561266657600080fd5b81518015158114610e0857600080fd5b8082018082111561079b5761079b6125f1565b6000825161269b8184602087016121ff565b9190910192915050565b60008083546126b38161261a565b600182811680156126cb57600181146126e05761270f565b60ff198416875282151583028701945061270f565b8760005260208060002060005b858110156127065781548a8201529084019082016126ed565b50505082870194505b50929695505050505050565b601f8211156107c8576000816000526020600020601f850160051c810160208610156127445750805b601f850160051c820191505b8181101561276357828155600101612750565b505050505050565b815167ffffffffffffffff811115612785576127856123a1565b61279981612793845461261a565b8461271b565b602080601f8311600181146127ce57600084156127b65750858301515b600019600386901b1c1916600185901b178555612763565b600085815260208120601f198616915b828110156127fd578886015182559484019460019091019084016127de565b508582101561281b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b600060018201612853576128536125f1565b5060010190565b808202811582820484141761079b5761079b6125f1565b60008261288e57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052602160045260246000fd5b828152604060208201526000610db56040830184612223565b6000602082840312156128d457600080fd5b505191905056fea264697066735822122032d6e5e79ee285fb2bd9164b524fade708e5449b3af7387d7a4d34dd20c3596264736f6c63430008180033

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

0000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000260000000000000000000000000c4506022fb8090774e8a628d5084eed61d9b99ee00000000000000000000000099f6539df9840592a862ab916ddc3258a1d7a77300000000000000000000000043c3ef32e52f17777789c71002ef4a887df9061300000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000a496e64657820436f6f700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000025631000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c492068617665207265616420616e642061636365707420746865205465726d73206f6620536572766963652e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f48696768205969656c642045544820496e646578205374616b6564205052540000000000000000000000000000000000000000000000000000000000000000097350727448794554480000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : eip712Name (string): Index Coop
Arg [1] : eip712Version (string): V1
Arg [2] : stakeMessage (string): I have read and accept the Terms of Service.
Arg [3] : name (string): High Yield ETH Index Staked PRT
Arg [4] : symbol (string): sPrtHyETH
Arg [5] : rewardToken (address): 0xc4506022Fb8090774E8A628d5084EED61D9B99Ee
Arg [6] : stakeToken (address): 0x99F6539Df9840592a862ab916dDc3258a1D7a773
Arg [7] : distributor (address): 0x43C3EF32E52f17777789c71002ef4a887df90613
Arg [8] : snapshotBuffer (uint256): 86400
Arg [9] : snapshotDelay (uint256): 2592000

-----Encoded View---------------
21 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [5] : 000000000000000000000000c4506022fb8090774e8a628d5084eed61d9b99ee
Arg [6] : 00000000000000000000000099f6539df9840592a862ab916ddc3258a1d7a773
Arg [7] : 00000000000000000000000043c3ef32e52f17777789c71002ef4a887df90613
Arg [8] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [9] : 0000000000000000000000000000000000000000000000000000000000278d00
Arg [10] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [11] : 496e64657820436f6f7000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [13] : 5631000000000000000000000000000000000000000000000000000000000000
Arg [14] : 000000000000000000000000000000000000000000000000000000000000002c
Arg [15] : 492068617665207265616420616e642061636365707420746865205465726d73
Arg [16] : 206f6620536572766963652e0000000000000000000000000000000000000000
Arg [17] : 000000000000000000000000000000000000000000000000000000000000001f
Arg [18] : 48696768205969656c642045544820496e646578205374616b65642050525400
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [20] : 7350727448794554480000000000000000000000000000000000000000000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.