ETH Price: $3,568.79 (+2.59%)

Contract

0x707c4622AaeCbff23ED56133b8e19eF940008998
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x608060401056454392023-06-16 4:27:35369 days ago1686889655IN
 Create: ERC20FixedRewardModuleFactory
0 ETH00.00000106

Advanced mode:
Parent Transaction Hash Block From To Value
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC20FixedRewardModuleFactory

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
File 1 of 14 : ERC20FixedRewardModuleFactory.sol
/*
ERC20FixedRewardModuleFactory

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

import "./interfaces/IModuleFactory.sol";
import "./ERC20FixedRewardModule.sol";

/**
 * @title ERC20 fixed reward module factory
 *
 * @notice this factory contract handles deployment for the
 * ERC20FixedRewardModule contract
 *
 * @dev it is called by the parent PoolFactory and is responsible
 * for parsing constructor arguments before creating a new contract
 */
contract ERC20FixedRewardModuleFactory is IModuleFactory {
    /**
     * @inheritdoc IModuleFactory
     */
    function createModule(
        address config,
        bytes calldata data
    ) external override returns (address) {
        // validate
        require(data.length == 96, "xrmf1");

        // parse constructor arguments
        address token;
        uint256 period;
        uint256 rate;
        assembly {
            token := calldataload(100)
            period := calldataload(132)
            rate := calldataload(164)
        }

        // create module
        ERC20FixedRewardModule module = new ERC20FixedRewardModule(
            token,
            period,
            rate,
            config,
            address(this)
        );
        module.transferOwnership(msg.sender);

        // output
        emit ModuleCreated(msg.sender, address(module));
        return address(module);
    }
}

File 2 of 14 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 3 of 14 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 4 of 14 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 5 of 14 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 6 of 14 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 7 of 14 : ERC20FixedRewardModule.sol
/*
ERC20FixedRewardModule

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./interfaces/IRewardModule.sol";
import "./interfaces/IConfiguration.sol";
import "./OwnerController.sol";
import "./TokenUtils.sol";

/**
 * @title ERC20 fixed reward module
 *
 * @notice this reward module distributes a fixed amount of a single ERC20 token.
 *
 * @dev the fixed reward module provides a guarantee that some amount of tokens
 * will be earned over a specified time period. This can be used to create
 * incentive mechanisms such as bond sales, fixed duration payroll, and more.
 */
contract ERC20FixedRewardModule is
    IRewardModule,
    ReentrancyGuard,
    OwnerController
{
    using SafeERC20 for IERC20;
    using TokenUtils for IERC20;

    // user position
    struct Position {
        uint256 debt; // reward shares
        uint256 vested; // reward shares
        uint256 earned; // reward shares
        uint128 timestamp;
        uint128 updated;
    }

    // configuration fields
    uint256 public immutable period;
    uint256 public immutable rate;
    IERC20 private immutable _token;
    address private immutable _factory;
    IConfiguration private immutable _config;

    // state fields
    mapping(bytes32 => Position) public positions;
    uint256 public rewards;
    uint256 public debt;

    /**
     * @param token_ the token that will be rewarded
     * @param period_ time period (seconds)
     * @param rate_ constant reward rate (shares / share second)
     * @param config_ address for configuration contract
     * @param factory_ address of module factory
     */
    constructor(
        address token_,
        uint256 period_,
        uint256 rate_,
        address config_,
        address factory_
    ) {
        require(token_ != address(0));
        require(period_ > 0, "xrm1");
        require(rate_ > 0, "xrm2");

        _token = IERC20(token_);
        _config = IConfiguration(config_);
        _factory = factory_;

        period = period_;
        rate = rate_;
    }

    // -- IRewardModule -------------------------------------------------------

    /**
     * @inheritdoc IRewardModule
     */
    function tokens()
        external
        view
        override
        returns (address[] memory tokens_)
    {
        tokens_ = new address[](1);
        tokens_[0] = address(_token);
    }

    /**
     * @inheritdoc IRewardModule
     */
    function balances()
        external
        view
        override
        returns (uint256[] memory balances_)
    {
        balances_ = new uint256[](1);
        if (rewards > 0) {
            balances_[0] = _token.getAmount(rewards, rewards - debt);
        }
    }

    /**
     * @inheritdoc IRewardModule
     */
    function usage() external pure override returns (uint256) {
        return 0;
    }

    /**
     * @inheritdoc IRewardModule
     */
    function factory() external view override returns (address) {
        return _factory;
    }

    /**
     * @inheritdoc IRewardModule
     *
     * @dev additional stake will bookmark earnings and rollover remainder to new unvested position
     */
    function stake(
        bytes32 account,
        address,
        uint256 shares,
        bytes calldata
    ) external override onlyOwner returns (uint256, uint256) {
        uint256 reward = (shares * rate) / 1e18;
        require(reward <= rewards - debt, "xrm3");

        Position storage pos = positions[account];
        uint256 d = pos.debt;
        if (d > 0) {
            uint256 end = pos.timestamp + period;
            require(block.timestamp > end, "xrm4"); // current stake must be fully vested
            pos.earned += d;
            pos.vested += (d * period) / (end - pos.updated);
        }
        pos.debt = reward;
        pos.timestamp = uint128(block.timestamp);
        pos.updated = uint128(block.timestamp);

        debt += reward;
        return (0, 0);
    }

    /**
     * @inheritdoc IRewardModule
     */
    function unstake(
        bytes32 account,
        address,
        address receiver,
        uint256 shares,
        bytes calldata
    ) external override onlyOwner returns (uint256, uint256) {
        Position storage pos = positions[account];
        require(pos.timestamp < block.timestamp);

        // unstake debt shares
        uint256 burned = (shares * rate) / 1e18;
        {
            uint256 vested = pos.vested; // burn vested shares first
            if (vested > burned) {
                pos.vested = vested - burned;
                burned = 0;
            } else if (vested > 0) {
                burned -= vested;
                pos.vested = 0;
            }
        }
        uint256 unvested;

        // get all pending rewards
        uint256 d = pos.debt;
        uint256 end = pos.timestamp + period;
        uint256 r = pos.earned;
        uint256 e;
        if (block.timestamp > end) {
            e = d;
        } else {
            uint256 last = pos.updated;
            e = (d * (block.timestamp - last)) / (end - last);
            // lost unvested reward shares
            unvested = (burned * (end - block.timestamp)) / period;
            if (d - e - unvested < 1e3) unvested = d - e; // dust
        }

        // update user position
        pos.debt = d - e - unvested;
        // (pos.vested updated above)
        pos.earned = 0;
        if (pos.debt > 0 || pos.vested > 0) {
            // update timestamp
            pos.updated = uint128(
                block.timestamp < end ? block.timestamp : end
            );
        } else {
            // delete position
            pos.updated = 0;
            pos.timestamp = 0;
        }

        // reduce global debt
        if (unvested > 0) debt -= unvested;

        // distribute rewards
        r += e;
        if (r > 0) {
            _distribute(receiver, r);
        }

        return (0, 0);
    }

    /**
     * @inheritdoc IRewardModule
     */
    function claim(
        bytes32 account,
        address,
        address receiver,
        uint256,
        bytes calldata
    ) external override onlyOwner returns (uint256, uint256) {
        // get all pending rewards
        Position storage pos = positions[account];
        uint256 d = pos.debt;
        uint256 end = pos.timestamp + period;
        uint256 r = pos.earned;
        uint256 e;
        if (block.timestamp > end) {
            e = d;
            pos.updated = uint128(end);
        } else {
            uint256 last = pos.updated;
            e = (d * (block.timestamp - last)) / (end - last);
            pos.updated = uint128(block.timestamp);
        }

        // update user position
        pos.debt = d - e;
        pos.earned = 0;
        // (pos.updated set above)

        // distribute rewards
        r += e;
        if (r > 0) {
            _distribute(receiver, r);
        }

        return (0, 0);
    }

    /**
     * @inheritdoc IRewardModule
     */
    function update(bytes32, address, bytes calldata) external override {}

    /**
     * @inheritdoc IRewardModule
     */
    function clean(bytes calldata) external override {}

    // -- ERC20FixedRewardModule ----------------------------------------

    /**
     * @notice fund module by depositing reward tokens
     * @dev this is a public method callable by any account or contract
     * @param amount number of reward tokens to deposit
     */
    function fund(uint256 amount) external nonReentrant {
        require(amount > 0, "xrm5");

        // get fees
        (address receiver, uint256 feeRate) = _config.getAddressUint96(
            keccak256("gysr.core.fixed.fund.fee")
        );

        // do funding transfer, fee processing, and reward shares accounting
        uint256 minted = _token.receiveWithFee(
            rewards,
            msg.sender,
            amount,
            receiver,
            feeRate
        );
        rewards += minted;

        emit RewardsFunded(address(_token), amount, minted, block.timestamp);
    }

    /**
     * @notice withdraw uncommitted reward tokens from module
     * @param amount number of reward tokens to withdraw
     */
    function withdraw(uint256 amount) external {
        requireController();

        // validate excess budget
        require(amount > 0, "xrm6");
        require(amount <= _token.balanceOf(address(this)), "xrm7");
        uint256 shares = _token.getShares(rewards, amount);
        require(shares > 0);
        require(shares <= rewards - debt, "xrm8");

        // withdraw
        rewards -= shares;
        _token.safeTransfer(msg.sender, amount);
        emit RewardsWithdrawn(address(_token), amount, shares, block.timestamp);
    }

    // -- ERC20FixedRewardModule internal -------------------------------

    /**
     * @dev internal method to distribute rewards
     * @param user address of user
     * @param shares number of shares burned
     */
    function _distribute(address user, uint256 shares) private {
        // compute reward amount in tokens
        uint256 amount = _token.getAmount(rewards, shares);

        // update overall reward shares
        rewards -= shares;
        debt -= shares;

        // do reward
        _token.safeTransfer(user, amount);
        emit RewardsDistributed(user, address(_token), amount, shares);
    }
}

File 8 of 14 : IConfiguration.sol
/*
IConfiguration

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

/**
 * @title Configuration interface
 *
 * @notice this defines the protocol configuration interface
 */
interface IConfiguration {
    // events
    event ParameterUpdated(bytes32 indexed key, address value);
    event ParameterUpdated(bytes32 indexed key, uint256 value);
    event ParameterUpdated(bytes32 indexed key, address value0, uint96 value1);
    event ParameterOverridden(
        address indexed caller,
        bytes32 indexed key,
        address value
    );
    event ParameterOverridden(
        address indexed caller,
        bytes32 indexed key,
        uint256 value
    );
    event ParameterOverridden(
        address indexed caller,
        bytes32 indexed key,
        address value0,
        uint96 value1
    );

    /**
     * @notice set or update uint256 parameter
     * @param key keccak256 hash of parameter key
     * @param value uint256 parameter value
     */
    function setUint256(bytes32 key, uint256 value) external;

    /**
     * @notice set or update address parameter
     * @param key keccak256 hash of parameter key
     * @param value address parameter value
     */
    function setAddress(bytes32 key, address value) external;

    /**
     * @notice set or update packed address + uint96 pair
     * @param key keccak256 hash of parameter key
     * @param value0 address parameter value
     * @param value1 uint96 parameter value
     */
    function setAddressUint96(
        bytes32 key,
        address value0,
        uint96 value1
    ) external;

    /**
     * @notice get uint256 parameter
     * @param key keccak256 hash of parameter key
     * @return uint256 parameter value
     */
    function getUint256(bytes32 key) external view returns (uint256);

    /**
     * @notice get address parameter
     * @param key keccak256 hash of parameter key
     * @return uint256 parameter value
     */
    function getAddress(bytes32 key) external view returns (address);

    /**
     * @notice get packed address + uint96 pair
     * @param key keccak256 hash of parameter key
     * @return address parameter value
     * @return uint96 parameter value
     */
    function getAddressUint96(
        bytes32 key
    ) external view returns (address, uint96);

    /**
     * @notice override uint256 parameter for specific caller
     * @param caller address of caller
     * @param key keccak256 hash of parameter key
     * @param value uint256 parameter value
     */
    function overrideUint256(
        address caller,
        bytes32 key,
        uint256 value
    ) external;

    /**
     * @notice override address parameter for specific caller
     * @param caller address of caller
     * @param key keccak256 hash of parameter key
     * @param value address parameter value
     */
    function overrideAddress(
        address caller,
        bytes32 key,
        address value
    ) external;

    /**
     * @notice override address parameter for specific caller
     * @param caller address of caller
     * @param key keccak256 hash of parameter key
     * @param value0 address parameter value
     * @param value1 uint96 parameter value
     */
    function overrideAddressUint96(
        address caller,
        bytes32 key,
        address value0,
        uint96 value1
    ) external;
}

File 9 of 14 : IEvents.sol
/*
IEvents

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
 */

pragma solidity 0.8.18;

/**
 * @title GYSR event system
 *
 * @notice common interface to define GYSR event system
 */
interface IEvents {
    // staking
    event Staked(
        bytes32 indexed account,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint256 shares
    );
    event Unstaked(
        bytes32 indexed account,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint256 shares
    );
    event Claimed(
        bytes32 indexed account,
        address indexed user,
        address indexed token,
        uint256 amount,
        uint256 shares
    );
    event Updated(bytes32 indexed account, address indexed user);

    // rewards
    event RewardsDistributed(
        address indexed user,
        address indexed token,
        uint256 amount,
        uint256 shares
    );
    event RewardsFunded(
        address indexed token,
        uint256 amount,
        uint256 shares,
        uint256 timestamp
    );
    event RewardsExpired(
        address indexed token,
        uint256 amount,
        uint256 shares,
        uint256 timestamp
    );
    event RewardsWithdrawn(
        address indexed token,
        uint256 amount,
        uint256 shares,
        uint256 timestamp
    );
    event RewardsUpdated(bytes32 indexed account);

    // gysr
    event GysrSpent(address indexed user, uint256 amount);
    event GysrVested(address indexed user, uint256 amount);
    event GysrWithdrawn(uint256 amount);
    event Fee(address indexed receiver, address indexed token, uint256 amount);
}

File 10 of 14 : IModuleFactory.sol
/*
IModuleFactory

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

/**
 * @title Module factory interface
 *
 * @notice this defines the common module factory interface used by the
 * main factory to create the staking and reward modules for a new Pool.
 */
interface IModuleFactory {
    // events
    event ModuleCreated(address indexed user, address module);

    /**
     * @notice create a new Pool module
     * @param config address for configuration contract
     * @param data binary encoded construction parameters
     * @return address of newly created module
     */
    function createModule(address config, bytes calldata data)
        external
        returns (address);
}

File 11 of 14 : IOwnerController.sol
/*
IOwnerController

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

/**
 * @title Owner controller interface
 *
 * @notice this defines the interface for any contracts that use the
 * owner controller access pattern
 */
interface IOwnerController {
    /**
     * @dev Returns the address of the current owner.
     */
    function owner() external view returns (address);

    /**
     * @dev Returns the address of the current controller.
     */
    function controller() external view returns (address);

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`). This can
     * include renouncing ownership by transferring to the zero address.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) external;

    /**
     * @dev Transfers control of the contract to a new account (`newController`).
     * Can only be called by the owner.
     */
    function transferControl(address newController) external;
}

File 12 of 14 : IRewardModule.sol
/*
IRewardModule

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

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

import "./IEvents.sol";
import "./IOwnerController.sol";

/**
 * @title Reward module interface
 *
 * @notice this contract defines the common interface that any reward module
 * must implement to be compatible with the modular Pool architecture.
 */
interface IRewardModule is IOwnerController, IEvents {
    /**
     * @return array of reward tokens
     */
    function tokens() external view returns (address[] memory);

    /**
     * @return array of reward token balances
     */
    function balances() external view returns (uint256[] memory);

    /**
     * @return GYSR usage ratio for reward module
     */
    function usage() external view returns (uint256);

    /**
     * @return address of module factory
     */
    function factory() external view returns (address);

    /**
     * @notice perform any necessary accounting for new stake
     * @param account bytes32 id of staking account
     * @param sender address of sender
     * @param shares number of new shares minted
     * @param data addtional data
     * @return amount of gysr spent
     * @return amount of gysr vested
     */
    function stake(
        bytes32 account,
        address sender,
        uint256 shares,
        bytes calldata data
    ) external returns (uint256, uint256);

    /**
     * @notice reward user and perform any necessary accounting for unstake
     * @param account bytes32 id of staking account
     * @param sender address of sender
     * @param receiver address of reward receiver
     * @param shares number of shares burned
     * @param data additional data
     * @return amount of gysr spent
     * @return amount of gysr vested
     */
    function unstake(
        bytes32 account,
        address sender,
        address receiver,
        uint256 shares,
        bytes calldata data
    ) external returns (uint256, uint256);

    /**
     * @notice reward user and perform and necessary accounting for existing stake
     * @param account bytes32 id of staking account
     * @param sender address of sender
     * @param receiver address of reward receiver
     * @param shares number of shares being claimed against
     * @param data additional data
     * @return amount of gysr spent
     * @return amount of gysr vested
     */
    function claim(
        bytes32 account,
        address sender,
        address receiver,
        uint256 shares,
        bytes calldata data
    ) external returns (uint256, uint256);

    /**
     * @notice method called by anyone to update accounting
     * @dev will only be called ad hoc and should not contain essential logic
     * @param account bytes32 id of staking account for update
     * @param sender address of sender
     * @param data additional data
     */
    function update(
        bytes32 account,
        address sender,
        bytes calldata data
    ) external;

    /**
     * @notice method called by owner to clean up and perform additional accounting
     * @dev will only be called ad hoc and should not contain any essential logic
     * @param data additional data
     */
    function clean(bytes calldata data) external;
}

File 13 of 14 : OwnerController.sol
/*
OwnerController

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

import "./interfaces/IOwnerController.sol";

/**
 * @title Owner controller
 *
 * @notice this base contract implements an owner-controller access model.
 *
 * @dev the contract is an adapted version of the OpenZeppelin Ownable contract.
 * It allows the owner to designate an additional account as the controller to
 * perform restricted operations.
 *
 * Other changes include supporting role verification with a require method
 * in addition to the modifier option, and removing some unneeded functionality.
 *
 * Original contract here:
 * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
 */
contract OwnerController is IOwnerController {
    address private _owner;
    address private _controller;

    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    event ControlTransferred(
        address indexed previousController,
        address indexed newController
    );

    constructor() {
        _owner = msg.sender;
        _controller = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
        emit ControlTransferred(address(0), _owner);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view override returns (address) {
        return _owner;
    }

    /**
     * @dev Returns the address of the current controller.
     */
    function controller() public view override returns (address) {
        return _controller;
    }

    /**
     * @dev Modifier that throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == msg.sender, "oc1");
        _;
    }

    /**
     * @dev Modifier that throws if called by any account other than the controller.
     */
    modifier onlyController() {
        require(_controller == msg.sender, "oc2");
        _;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    function requireOwner() internal view {
        require(_owner == msg.sender, "oc1");
    }

    /**
     * @dev Throws if called by any account other than the controller.
     */
    function requireController() internal view {
        require(_controller == msg.sender, "oc2");
    }

    /**
     * @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 override {
        requireOwner();
        require(newOwner != address(0), "oc3");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }

    /**
     * @dev Transfers control of the contract to a new account (`newController`).
     * Can only be called by the owner.
     */
    function transferControl(address newController) public virtual override {
        requireOwner();
        require(newController != address(0), "oc4");
        emit ControlTransferred(_controller, newController);
        _controller = newController;
    }
}

File 14 of 14 : TokenUtils.sol
/*
TokenUtils

https://github.com/gysr-io/core

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/**
 * @title Token utilities
 *
 * @notice this library implements utility methods for token handling,
 * dynamic balance accounting, and fee processing
 */
library TokenUtils {
    using SafeERC20 for IERC20;

    event Fee(address indexed receiver, address indexed token, uint256 amount); // redefinition

    uint256 constant INITIAL_SHARES_PER_TOKEN = 1e6;
    uint256 constant FLOOR_SHARES_PER_TOKEN = 1e3;

    /**
     * @notice get token shares from amount
     * @param token erc20 token interface
     * @param total current total shares
     * @param amount balance of tokens
     */
    function getShares(
        IERC20 token,
        uint256 total,
        uint256 amount
    ) internal view returns (uint256) {
        if (total == 0) return 0;
        uint256 balance = token.balanceOf(address(this));
        if (total < balance * FLOOR_SHARES_PER_TOKEN)
            return amount * FLOOR_SHARES_PER_TOKEN;
        return (total * amount) / balance;
    }

    /**
     * @notice get token amount from shares
     * @param token erc20 token interface
     * @param total current total shares
     * @param shares balance of shares
     */
    function getAmount(
        IERC20 token,
        uint256 total,
        uint256 shares
    ) internal view returns (uint256) {
        if (total == 0) return 0;
        uint256 balance = token.balanceOf(address(this));
        if (total < balance * FLOOR_SHARES_PER_TOKEN)
            return shares / FLOOR_SHARES_PER_TOKEN;
        return (balance * shares) / total;
    }

    /**
     * @notice transfer tokens from sender into contract and convert to shares
     * for internal accounting
     * @param token erc20 token interface
     * @param total current total shares
     * @param sender token sender
     * @param amount number of tokens to be sent
     */
    function receiveAmount(
        IERC20 token,
        uint256 total,
        address sender,
        uint256 amount
    ) internal returns (uint256) {
        // note: we assume amount > 0 has already been validated

        //  transfer
        uint256 balance = token.balanceOf(address(this));
        token.safeTransferFrom(sender, address(this), amount);
        uint256 actual = token.balanceOf(address(this)) - balance;
        require(amount >= actual);

        // mint shares at current rate
        uint256 minted;
        if (total == 0) {
            minted = actual * INITIAL_SHARES_PER_TOKEN;
        } else if (total < balance * FLOOR_SHARES_PER_TOKEN) {
            minted = actual * FLOOR_SHARES_PER_TOKEN;
        } else {
            minted = (total * actual) / balance;
        }
        require(minted > 0);
        return minted;
    }

    /**
     * @notice transfer tokens from sender into contract, process protocol fee,
     * and convert to shares for internal accounting
     * @param token erc20 token interface
     * @param total current total shares
     * @param sender token sender
     * @param amount number of tokens to be sent
     * @param feeReceiver address to receive fee
     * @param feeRate portion of amount to take as fee in 18 decimals
     */
    function receiveWithFee(
        IERC20 token,
        uint256 total,
        address sender,
        uint256 amount,
        address feeReceiver,
        uint256 feeRate
    ) internal returns (uint256) {
        // note: we assume amount > 0 has already been validated

        // check initial token balance
        uint256 balance = token.balanceOf(address(this));

        // process fee
        uint256 fee;
        if (feeReceiver != address(0) && feeRate > 0 && feeRate < 1e18) {
            fee = (amount * feeRate) / 1e18;
            token.safeTransferFrom(sender, feeReceiver, fee);
            emit Fee(feeReceiver, address(token), fee);
        }

        // do transfer
        token.safeTransferFrom(sender, address(this), amount - fee);
        uint256 actual = token.balanceOf(address(this)) - balance;
        require(amount >= actual);

        // mint shares at current rate
        uint256 minted;
        if (total == 0) {
            minted = actual * INITIAL_SHARES_PER_TOKEN;
        } else if (total < balance * FLOOR_SHARES_PER_TOKEN) {
            minted = actual * FLOOR_SHARES_PER_TOKEN;
        } else {
            minted = (total * actual) / balance;
        }
        require(minted > 0);
        return minted;
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"ModuleCreated","type":"event"},{"inputs":[{"internalType":"address","name":"config","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"createModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061296a806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806320868d1814610030575b600080fd5b61004361003e366004610241565b61006c565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000606082146100dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f78726d6631000000000000000000000000000000000000000000000000000000604482015260640160405180910390fd5b60008060006064359250608435915060a435905060008383838a3060405161010390610234565b73ffffffffffffffffffffffffffffffffffffffff95861681526020810194909452604084019290925283166060830152909116608082015260a001604051809103906000f08015801561015b573d6000803e3d6000fd5b506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063f2fde38b90602401600060405180830381600087803b1580156101c657600080fd5b505af11580156101da573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff841681523392507ff708942ec477396a151a5285651961dcab8e8a82ea4f5b31a5236f92f6c92710915060200160405180910390a2979650505050505050565b612655806102e083390190565b60008060006040848603121561025657600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461027a57600080fd5b9250602084013567ffffffffffffffff8082111561029757600080fd5b818601915086601f8301126102ab57600080fd5b8135818111156102ba57600080fd5b8760208285010111156102cc57600080fd5b602083019450809350505050925092509256fe6101206040523480156200001257600080fd5b506040516200265538038062002655833981016040819052620000359162000194565b600160008181558154336001600160a01b0319918216811790935560028054909116831790556040517f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36001546040516001600160a01b03909116906000907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a36001600160a01b038516620000d157600080fd5b60008411620001155760405162461bcd60e51b81526004016200010c9060208082526004908201526378726d3160e01b604082015260600190565b60405180910390fd5b60008311620001505760405162461bcd60e51b81526004016200010c906020808252600490820152633c39369960e11b604082015260600190565b6001600160a01b0394851660c0529084166101005290921660e05260805260a052620001f2565b80516001600160a01b03811681146200018f57600080fd5b919050565b600080600080600060a08688031215620001ad57600080fd5b620001b88662000177565b94506020860151935060408601519250620001d66060870162000177565b9150620001e66080870162000177565b90509295509295909350565b60805160a05160c05160e051610100516123a7620002ae600039600061117f015260006103690152600081816107a4015281816108960152818161095f0152818161099d01528181610b520152818161104e0152818161121d015281816112770152818161140201528181611476015261149f0152600081816101ba015281816104ad0152610c180152600081816103a501528181610532015281816105d901528181610cce01528181610dab0152610edb01526123a76000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638da5cb5b116100cd578063c45a015511610081578063ef78d4fd11610066578063ef78d4fd146103a0578063f2fde38b146103c7578063f77c4791146103da57600080fd5b8063c45a015514610367578063ca1d209d1461038d57600080fd5b80639d63848a116100b25780639d63848a146103355780639ec5a8941461034a578063b31f41701461035357600080fd5b80638da5cb5b146102e357806397c838441461032257600080fd5b80636d16fa41116101245780636fd366b8116101095780636fd366b8146102a95780637bb98a68146102bb57806383711553146102d057600080fd5b80636d16fa411461028f5780636d811e71146102a257600080fd5b80632c4e722e116101555780632c4e722e146101b55780632e1a7d4d146101dc578063514ea4bf146101f157600080fd5b80630dca59c114610171578063185bad3f1461018d575b600080fd5b61017a60055481565b6040519081526020015b60405180910390f35b6101a061019b366004611f32565b6103f8565b60408051928352602083019190915201610184565b61017a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ef6101ea366004611fae565b61071c565b005b6102526101ff366004611fae565b60036020819052600091825260409091208054600182015460028301549290930154909291906fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041685565b604080519586526020860194909452928401919091526fffffffffffffffffffffffffffffffff908116606084015216608082015260a001610184565b6101ef61029d366004611fc7565b610a02565b600061017a565b6101ef6102b7366004611fe4565b5050565b6102c3610afb565b6040516101849190612026565b6101a06102de36600461206a565b610b9c565b60015473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610184565b6101a0610330366004611f32565b610e50565b61033d61102a565b60405161018491906120d4565b61017a60045481565b6101ef610361366004612122565b50505050565b7f00000000000000000000000000000000000000000000000000000000000000006102fd565b6101ef61039b366004611fae565b6110bd565b61017a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ef6103d5366004611fc7565b6112e8565b60025473ffffffffffffffffffffffffffffffffffffffff166102fd565b600154600090819073ffffffffffffffffffffffffffffffffffffffff1633146104695760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600088815260036020819052604090912090810154426fffffffffffffffffffffffffffffffff9091161061049d57600080fd5b6000670de0b6b3a76400006104d27f0000000000000000000000000000000000000000000000000000000000000000896121ad565b6104dc91906121ca565b600183015490915081811115610504576104f68282612205565b60018401556000915061051e565b801561051e576105148183612205565b6000600185015591505b5081546003830154600091908290610569907f0000000000000000000000000000000000000000000000000000000000000000906fffffffffffffffffffffffffffffffff16612218565b6002860154909150600042831015610582575082610645565b600387015470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff166105b78185612205565b6105c18242612205565b6105cb90876121ad565b6105d591906121ca565b91507f00000000000000000000000000000000000000000000000000000000000000006106024286612205565b61060c90896121ad565b61061691906121ca565b95506103e8866106268488612205565b6106309190612205565b1015610643576106408286612205565b95505b505b846106508286612205565b61065a9190612205565b80885560006002890155151580610675575060008760010154115b156106c3578242106106875782610689565b425b6003880180546fffffffffffffffffffffffffffffffff9283167001000000000000000000000000000000000292169190911790556106cb565b600060038801555b84156106e95784600560008282546106e39190612205565b90915550505b6106f38183612218565b91508115610705576107058d836113e1565b5060009e8f9e509c50505050505050505050505050565b610724611532565b600081116107765760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3600000000000000000000000000000000000000000000000000000000604082015260600190565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610800573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610824919061222b565b8111156108755760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3700000000000000000000000000000000000000000000000000000000604082015260600190565b6004546000906108bd9073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016908461159b565b9050600081116108cc57600080fd5b6005546004546108dc9190612205565b81111561092d5760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3800000000000000000000000000000000000000000000000000000000604082015260600190565b806004600082825461093f9190612205565b90915550610986905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163384611687565b6040805183815260208101839052428183015290517f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16917f4f3d7a53f1fd3ab32e84fafd251bc5c1ec2c516068909f68847ad29c366d134c919081900360600190a25050565b610a0a611760565b73ffffffffffffffffffffffffffffffffffffffff8116610a6d5760405162461bcd60e51b815260206004820152600360248201527f6f633400000000000000000000000000000000000000000000000000000000006044820152606401610460565b60025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6040805160018082528183019092526060916020808301908036833750506004549192505015610b9957610b79600454600554600454610b3b9190612205565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691906117c7565b81600081518110610b8c57610b8c612244565b6020026020010181815250505b90565b600154600090819073ffffffffffffffffffffffffffffffffffffffff163314610c085760405162461bcd60e51b815260206004820152600360248201527f6f633100000000000000000000000000000000000000000000000000000000006044820152606401610460565b6000670de0b6b3a7640000610c3d7f0000000000000000000000000000000000000000000000000000000000000000886121ad565b610c4791906121ca565b9050600554600454610c599190612205565b811115610caa5760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3300000000000000000000000000000000000000000000000000000000604082015260600190565b600088815260036020526040902080548015610df4576003820154600090610d05907f0000000000000000000000000000000000000000000000000000000000000000906fffffffffffffffffffffffffffffffff16612218565b9050804211610d585760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3400000000000000000000000000000000000000000000000000000000604082015260600190565b81836002016000828254610d6c9190612218565b90915550506003830154610da69070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1682612205565b610dd07f0000000000000000000000000000000000000000000000000000000000000000846121ad565b610dda91906121ca565b836001016000828254610ded9190612218565b9091555050505b828255426fffffffffffffffffffffffffffffffff16700100000000000000000000000000000000810217600383015560058054849190600090610e39908490612218565b9091555060009b8c9b509950505050505050505050565b600154600090819073ffffffffffffffffffffffffffffffffffffffff163314610ebc5760405162461bcd60e51b815260206004820152600360248201527f6f633100000000000000000000000000000000000000000000000000000000006044820152606401610460565b60008881526003602081905260408220805491810154909290610f12907f0000000000000000000000000000000000000000000000000000000000000000906fffffffffffffffffffffffffffffffff16612218565b6002840154909150600042831015610f5d57506003840180546fffffffffffffffffffffffffffffffff80851670010000000000000000000000000000000002911617905582610fe6565b600385015470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16610f928185612205565b610f9c8242612205565b610fa690876121ad565b610fb091906121ca565b6003870180546fffffffffffffffffffffffffffffffff4281167001000000000000000000000000000000000291161790559150505b610ff08185612205565b8555600060028601556110038183612218565b91508115611015576110158b836113e1565b5060009c8d9c509a5050505050505050505050565b604080516001808252818301909252606091602080830190803683370190505090507f00000000000000000000000000000000000000000000000000000000000000008160008151811061108057611080612244565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505090565b6110c5611896565b600081116111175760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3500000000000000000000000000000000000000000000000000000000604082015260600190565b6040517f575313cd0000000000000000000000000000000000000000000000000000000081527ff866a9547d6d6627751fd85c2c353f6f5741b1a8bc05d106035ae4a3180d5fac6004820152600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063575313cd906024016040805180830381865afa1580156111c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e99190612273565b6004549193506bffffffffffffffffffffffff1691506000906112479073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690338787876118ef565b9050806004600082825461125b9190612218565b90915550506040805185815260208101839052428183015290517f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16917f0d2eac201c6bd25b979f0d9ebcf8ff27a476edde7006f42e843dc70727dbf90b919081900360600190a25050506112e56001600055565b50565b6112f0611760565b73ffffffffffffffffffffffffffffffffffffffff81166113535760405162461bcd60e51b815260206004820152600360248201527f6f633300000000000000000000000000000000000000000000000000000000006044820152606401610460565b60015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6004546000906114299073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690846117c7565b9050816004600082825461143d9190612205565b9250508190555081600560008282546114569190612205565b9091555061149d905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168483611687565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f1a4dfb075362880d700ede1cc31d284b1c3b2811e9f0b2ddde7bdb270042c13f8385604051611525929190918252602082015260400190565b60405180910390a3505050565b60025473ffffffffffffffffffffffffffffffffffffffff1633146115995760405162461bcd60e51b815260206004820152600360248201527f6f633200000000000000000000000000000000000000000000000000000000006044820152606401610460565b565b6000826000036115ad57506000611680565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e919061222b565b905061164c6103e8826121ad565b8410156116675761165f6103e8846121ad565b915050611680565b8061167284866121ad565b61167c91906121ca565b9150505b9392505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261175b9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611bb6565b505050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146115995760405162461bcd60e51b815260206004820152600360248201527f6f633100000000000000000000000000000000000000000000000000000000006044820152606401610460565b6000826000036117d957506000611680565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa158015611846573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186a919061222b565b90506118786103e8826121ad565b84101561188b5761165f6103e8846121ca565b8361167284836121ad565b6002600054036118e85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610460565b6002600055565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8916906370a0823190602401602060405180830381865afa15801561195e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611982919061222b565b9050600073ffffffffffffffffffffffffffffffffffffffff8516158015906119ab5750600084115b80156119be5750670de0b6b3a764000084105b15611a6c57670de0b6b3a76400006119d685886121ad565b6119e091906121ca565b9050611a0473ffffffffffffffffffffffffffffffffffffffff8a16888784611ca8565b8873ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f6ded982279c8387ad8a63e73385031a3807c1862e633f06e09d11bcb6e282f6083604051611a6391815260200190565b60405180910390a35b611a9a8730611a7b848a612205565b73ffffffffffffffffffffffffffffffffffffffff8d16929190611ca8565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090839073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015611b09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b2d919061222b565b611b379190612205565b905080871015611b4657600080fd5b600089600003611b6457611b5d620f4240836121ad565b9050611b9b565b611b706103e8856121ad565b8a1015611b8357611b5d6103e8836121ad565b83611b8e838c6121ad565b611b9891906121ca565b90505b60008111611ba857600080fd5b9a9950505050505050505050565b6000611c18826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611d069092919063ffffffff16565b80519091501561175b5780806020019051810190611c3691906122be565b61175b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610460565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526103619085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016116d9565b6060611d158484600085611d1d565b949350505050565b606082471015611d955760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610460565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611dbe9190612304565b60006040518083038185875af1925050503d8060008114611dfb576040519150601f19603f3d011682016040523d82523d6000602084013e611e00565b606091505b5091509150611e1187838387611e1c565b979650505050505050565b60608315611e98578251600003611e915773ffffffffffffffffffffffffffffffffffffffff85163b611e915760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610460565b5081611d15565b611d158383815115611ead5781518083602001fd5b8060405162461bcd60e51b81526004016104609190612320565b73ffffffffffffffffffffffffffffffffffffffff811681146112e557600080fd5b60008083601f840112611efb57600080fd5b50813567ffffffffffffffff811115611f1357600080fd5b602083019150836020828501011115611f2b57600080fd5b9250929050565b60008060008060008060a08789031215611f4b57600080fd5b863595506020870135611f5d81611ec7565b94506040870135611f6d81611ec7565b935060608701359250608087013567ffffffffffffffff811115611f9057600080fd5b611f9c89828a01611ee9565b979a9699509497509295939492505050565b600060208284031215611fc057600080fd5b5035919050565b600060208284031215611fd957600080fd5b813561168081611ec7565b60008060208385031215611ff757600080fd5b823567ffffffffffffffff81111561200e57600080fd5b61201a85828601611ee9565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561205e57835183529284019291840191600101612042565b50909695505050505050565b60008060008060006080868803121561208257600080fd5b85359450602086013561209481611ec7565b935060408601359250606086013567ffffffffffffffff8111156120b757600080fd5b6120c388828901611ee9565b969995985093965092949392505050565b6020808252825182820181905260009190848201906040850190845b8181101561205e57835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016120f0565b6000806000806060858703121561213857600080fd5b84359350602085013561214a81611ec7565b9250604085013567ffffffffffffffff81111561216657600080fd5b61217287828801611ee9565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820281158282048414176121c4576121c461217e565b92915050565b600082612200577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b818103818111156121c4576121c461217e565b808201808211156121c4576121c461217e565b60006020828403121561223d57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000806040838503121561228657600080fd5b825161229181611ec7565b60208401519092506bffffffffffffffffffffffff811681146122b357600080fd5b809150509250929050565b6000602082840312156122d057600080fd5b8151801515811461168057600080fd5b60005b838110156122fb5781810151838201526020016122e3565b50506000910152565b600082516123168184602087016122e0565b9190910192915050565b602081526000825180602084015261233f8160408501602087016122e0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220515fbd37fc1f1a4713e401eef5f3ba3dbda4f1c0572a516721d59d9318f29e2f64736f6c63430008120033a2646970667358221220bc6e08f16072361b4052bf11a9ad1d0355777f8bfeeeced5d658b2ae07b298bd64736f6c63430008120033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806320868d1814610030575b600080fd5b61004361003e366004610241565b61006c565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000606082146100dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f78726d6631000000000000000000000000000000000000000000000000000000604482015260640160405180910390fd5b60008060006064359250608435915060a435905060008383838a3060405161010390610234565b73ffffffffffffffffffffffffffffffffffffffff95861681526020810194909452604084019290925283166060830152909116608082015260a001604051809103906000f08015801561015b573d6000803e3d6000fd5b506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063f2fde38b90602401600060405180830381600087803b1580156101c657600080fd5b505af11580156101da573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff841681523392507ff708942ec477396a151a5285651961dcab8e8a82ea4f5b31a5236f92f6c92710915060200160405180910390a2979650505050505050565b612655806102e083390190565b60008060006040848603121561025657600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461027a57600080fd5b9250602084013567ffffffffffffffff8082111561029757600080fd5b818601915086601f8301126102ab57600080fd5b8135818111156102ba57600080fd5b8760208285010111156102cc57600080fd5b602083019450809350505050925092509256fe6101206040523480156200001257600080fd5b506040516200265538038062002655833981016040819052620000359162000194565b600160008181558154336001600160a01b0319918216811790935560028054909116831790556040517f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36001546040516001600160a01b03909116906000907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a36001600160a01b038516620000d157600080fd5b60008411620001155760405162461bcd60e51b81526004016200010c9060208082526004908201526378726d3160e01b604082015260600190565b60405180910390fd5b60008311620001505760405162461bcd60e51b81526004016200010c906020808252600490820152633c39369960e11b604082015260600190565b6001600160a01b0394851660c0529084166101005290921660e05260805260a052620001f2565b80516001600160a01b03811681146200018f57600080fd5b919050565b600080600080600060a08688031215620001ad57600080fd5b620001b88662000177565b94506020860151935060408601519250620001d66060870162000177565b9150620001e66080870162000177565b90509295509295909350565b60805160a05160c05160e051610100516123a7620002ae600039600061117f015260006103690152600081816107a4015281816108960152818161095f0152818161099d01528181610b520152818161104e0152818161121d015281816112770152818161140201528181611476015261149f0152600081816101ba015281816104ad0152610c180152600081816103a501528181610532015281816105d901528181610cce01528181610dab0152610edb01526123a76000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c80638da5cb5b116100cd578063c45a015511610081578063ef78d4fd11610066578063ef78d4fd146103a0578063f2fde38b146103c7578063f77c4791146103da57600080fd5b8063c45a015514610367578063ca1d209d1461038d57600080fd5b80639d63848a116100b25780639d63848a146103355780639ec5a8941461034a578063b31f41701461035357600080fd5b80638da5cb5b146102e357806397c838441461032257600080fd5b80636d16fa41116101245780636fd366b8116101095780636fd366b8146102a95780637bb98a68146102bb57806383711553146102d057600080fd5b80636d16fa411461028f5780636d811e71146102a257600080fd5b80632c4e722e116101555780632c4e722e146101b55780632e1a7d4d146101dc578063514ea4bf146101f157600080fd5b80630dca59c114610171578063185bad3f1461018d575b600080fd5b61017a60055481565b6040519081526020015b60405180910390f35b6101a061019b366004611f32565b6103f8565b60408051928352602083019190915201610184565b61017a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ef6101ea366004611fae565b61071c565b005b6102526101ff366004611fae565b60036020819052600091825260409091208054600182015460028301549290930154909291906fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041685565b604080519586526020860194909452928401919091526fffffffffffffffffffffffffffffffff908116606084015216608082015260a001610184565b6101ef61029d366004611fc7565b610a02565b600061017a565b6101ef6102b7366004611fe4565b5050565b6102c3610afb565b6040516101849190612026565b6101a06102de36600461206a565b610b9c565b60015473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610184565b6101a0610330366004611f32565b610e50565b61033d61102a565b60405161018491906120d4565b61017a60045481565b6101ef610361366004612122565b50505050565b7f00000000000000000000000000000000000000000000000000000000000000006102fd565b6101ef61039b366004611fae565b6110bd565b61017a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ef6103d5366004611fc7565b6112e8565b60025473ffffffffffffffffffffffffffffffffffffffff166102fd565b600154600090819073ffffffffffffffffffffffffffffffffffffffff1633146104695760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600088815260036020819052604090912090810154426fffffffffffffffffffffffffffffffff9091161061049d57600080fd5b6000670de0b6b3a76400006104d27f0000000000000000000000000000000000000000000000000000000000000000896121ad565b6104dc91906121ca565b600183015490915081811115610504576104f68282612205565b60018401556000915061051e565b801561051e576105148183612205565b6000600185015591505b5081546003830154600091908290610569907f0000000000000000000000000000000000000000000000000000000000000000906fffffffffffffffffffffffffffffffff16612218565b6002860154909150600042831015610582575082610645565b600387015470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff166105b78185612205565b6105c18242612205565b6105cb90876121ad565b6105d591906121ca565b91507f00000000000000000000000000000000000000000000000000000000000000006106024286612205565b61060c90896121ad565b61061691906121ca565b95506103e8866106268488612205565b6106309190612205565b1015610643576106408286612205565b95505b505b846106508286612205565b61065a9190612205565b80885560006002890155151580610675575060008760010154115b156106c3578242106106875782610689565b425b6003880180546fffffffffffffffffffffffffffffffff9283167001000000000000000000000000000000000292169190911790556106cb565b600060038801555b84156106e95784600560008282546106e39190612205565b90915550505b6106f38183612218565b91508115610705576107058d836113e1565b5060009e8f9e509c50505050505050505050505050565b610724611532565b600081116107765760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3600000000000000000000000000000000000000000000000000000000604082015260600190565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610800573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610824919061222b565b8111156108755760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3700000000000000000000000000000000000000000000000000000000604082015260600190565b6004546000906108bd9073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016908461159b565b9050600081116108cc57600080fd5b6005546004546108dc9190612205565b81111561092d5760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3800000000000000000000000000000000000000000000000000000000604082015260600190565b806004600082825461093f9190612205565b90915550610986905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163384611687565b6040805183815260208101839052428183015290517f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16917f4f3d7a53f1fd3ab32e84fafd251bc5c1ec2c516068909f68847ad29c366d134c919081900360600190a25050565b610a0a611760565b73ffffffffffffffffffffffffffffffffffffffff8116610a6d5760405162461bcd60e51b815260206004820152600360248201527f6f633400000000000000000000000000000000000000000000000000000000006044820152606401610460565b60025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6040805160018082528183019092526060916020808301908036833750506004549192505015610b9957610b79600454600554600454610b3b9190612205565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691906117c7565b81600081518110610b8c57610b8c612244565b6020026020010181815250505b90565b600154600090819073ffffffffffffffffffffffffffffffffffffffff163314610c085760405162461bcd60e51b815260206004820152600360248201527f6f633100000000000000000000000000000000000000000000000000000000006044820152606401610460565b6000670de0b6b3a7640000610c3d7f0000000000000000000000000000000000000000000000000000000000000000886121ad565b610c4791906121ca565b9050600554600454610c599190612205565b811115610caa5760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3300000000000000000000000000000000000000000000000000000000604082015260600190565b600088815260036020526040902080548015610df4576003820154600090610d05907f0000000000000000000000000000000000000000000000000000000000000000906fffffffffffffffffffffffffffffffff16612218565b9050804211610d585760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3400000000000000000000000000000000000000000000000000000000604082015260600190565b81836002016000828254610d6c9190612218565b90915550506003830154610da69070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1682612205565b610dd07f0000000000000000000000000000000000000000000000000000000000000000846121ad565b610dda91906121ca565b836001016000828254610ded9190612218565b9091555050505b828255426fffffffffffffffffffffffffffffffff16700100000000000000000000000000000000810217600383015560058054849190600090610e39908490612218565b9091555060009b8c9b509950505050505050505050565b600154600090819073ffffffffffffffffffffffffffffffffffffffff163314610ebc5760405162461bcd60e51b815260206004820152600360248201527f6f633100000000000000000000000000000000000000000000000000000000006044820152606401610460565b60008881526003602081905260408220805491810154909290610f12907f0000000000000000000000000000000000000000000000000000000000000000906fffffffffffffffffffffffffffffffff16612218565b6002840154909150600042831015610f5d57506003840180546fffffffffffffffffffffffffffffffff80851670010000000000000000000000000000000002911617905582610fe6565b600385015470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16610f928185612205565b610f9c8242612205565b610fa690876121ad565b610fb091906121ca565b6003870180546fffffffffffffffffffffffffffffffff4281167001000000000000000000000000000000000291161790559150505b610ff08185612205565b8555600060028601556110038183612218565b91508115611015576110158b836113e1565b5060009c8d9c509a5050505050505050505050565b604080516001808252818301909252606091602080830190803683370190505090507f00000000000000000000000000000000000000000000000000000000000000008160008151811061108057611080612244565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505090565b6110c5611896565b600081116111175760405162461bcd60e51b81526004016104609060208082526004908201527f78726d3500000000000000000000000000000000000000000000000000000000604082015260600190565b6040517f575313cd0000000000000000000000000000000000000000000000000000000081527ff866a9547d6d6627751fd85c2c353f6f5741b1a8bc05d106035ae4a3180d5fac6004820152600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063575313cd906024016040805180830381865afa1580156111c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e99190612273565b6004549193506bffffffffffffffffffffffff1691506000906112479073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690338787876118ef565b9050806004600082825461125b9190612218565b90915550506040805185815260208101839052428183015290517f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16917f0d2eac201c6bd25b979f0d9ebcf8ff27a476edde7006f42e843dc70727dbf90b919081900360600190a25050506112e56001600055565b50565b6112f0611760565b73ffffffffffffffffffffffffffffffffffffffff81166113535760405162461bcd60e51b815260206004820152600360248201527f6f633300000000000000000000000000000000000000000000000000000000006044820152606401610460565b60015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6004546000906114299073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690846117c7565b9050816004600082825461143d9190612205565b9250508190555081600560008282546114569190612205565b9091555061149d905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168483611687565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f1a4dfb075362880d700ede1cc31d284b1c3b2811e9f0b2ddde7bdb270042c13f8385604051611525929190918252602082015260400190565b60405180910390a3505050565b60025473ffffffffffffffffffffffffffffffffffffffff1633146115995760405162461bcd60e51b815260206004820152600360248201527f6f633200000000000000000000000000000000000000000000000000000000006044820152606401610460565b565b6000826000036115ad57506000611680565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e919061222b565b905061164c6103e8826121ad565b8410156116675761165f6103e8846121ad565b915050611680565b8061167284866121ad565b61167c91906121ca565b9150505b9392505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261175b9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611bb6565b505050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146115995760405162461bcd60e51b815260206004820152600360248201527f6f633100000000000000000000000000000000000000000000000000000000006044820152606401610460565b6000826000036117d957506000611680565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa158015611846573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186a919061222b565b90506118786103e8826121ad565b84101561188b5761165f6103e8846121ca565b8361167284836121ad565b6002600054036118e85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610460565b6002600055565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8916906370a0823190602401602060405180830381865afa15801561195e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611982919061222b565b9050600073ffffffffffffffffffffffffffffffffffffffff8516158015906119ab5750600084115b80156119be5750670de0b6b3a764000084105b15611a6c57670de0b6b3a76400006119d685886121ad565b6119e091906121ca565b9050611a0473ffffffffffffffffffffffffffffffffffffffff8a16888784611ca8565b8873ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f6ded982279c8387ad8a63e73385031a3807c1862e633f06e09d11bcb6e282f6083604051611a6391815260200190565b60405180910390a35b611a9a8730611a7b848a612205565b73ffffffffffffffffffffffffffffffffffffffff8d16929190611ca8565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090839073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015611b09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b2d919061222b565b611b379190612205565b905080871015611b4657600080fd5b600089600003611b6457611b5d620f4240836121ad565b9050611b9b565b611b706103e8856121ad565b8a1015611b8357611b5d6103e8836121ad565b83611b8e838c6121ad565b611b9891906121ca565b90505b60008111611ba857600080fd5b9a9950505050505050505050565b6000611c18826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611d069092919063ffffffff16565b80519091501561175b5780806020019051810190611c3691906122be565b61175b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610460565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526103619085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016116d9565b6060611d158484600085611d1d565b949350505050565b606082471015611d955760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610460565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611dbe9190612304565b60006040518083038185875af1925050503d8060008114611dfb576040519150601f19603f3d011682016040523d82523d6000602084013e611e00565b606091505b5091509150611e1187838387611e1c565b979650505050505050565b60608315611e98578251600003611e915773ffffffffffffffffffffffffffffffffffffffff85163b611e915760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610460565b5081611d15565b611d158383815115611ead5781518083602001fd5b8060405162461bcd60e51b81526004016104609190612320565b73ffffffffffffffffffffffffffffffffffffffff811681146112e557600080fd5b60008083601f840112611efb57600080fd5b50813567ffffffffffffffff811115611f1357600080fd5b602083019150836020828501011115611f2b57600080fd5b9250929050565b60008060008060008060a08789031215611f4b57600080fd5b863595506020870135611f5d81611ec7565b94506040870135611f6d81611ec7565b935060608701359250608087013567ffffffffffffffff811115611f9057600080fd5b611f9c89828a01611ee9565b979a9699509497509295939492505050565b600060208284031215611fc057600080fd5b5035919050565b600060208284031215611fd957600080fd5b813561168081611ec7565b60008060208385031215611ff757600080fd5b823567ffffffffffffffff81111561200e57600080fd5b61201a85828601611ee9565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561205e57835183529284019291840191600101612042565b50909695505050505050565b60008060008060006080868803121561208257600080fd5b85359450602086013561209481611ec7565b935060408601359250606086013567ffffffffffffffff8111156120b757600080fd5b6120c388828901611ee9565b969995985093965092949392505050565b6020808252825182820181905260009190848201906040850190845b8181101561205e57835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016120f0565b6000806000806060858703121561213857600080fd5b84359350602085013561214a81611ec7565b9250604085013567ffffffffffffffff81111561216657600080fd5b61217287828801611ee9565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820281158282048414176121c4576121c461217e565b92915050565b600082612200577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b818103818111156121c4576121c461217e565b808201808211156121c4576121c461217e565b60006020828403121561223d57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000806040838503121561228657600080fd5b825161229181611ec7565b60208401519092506bffffffffffffffffffffffff811681146122b357600080fd5b809150509250929050565b6000602082840312156122d057600080fd5b8151801515811461168057600080fd5b60005b838110156122fb5781810151838201526020016122e3565b50506000910152565b600082516123168184602087016122e0565b9190910192915050565b602081526000825180602084015261233f8160408501602087016122e0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220515fbd37fc1f1a4713e401eef5f3ba3dbda4f1c0572a516721d59d9318f29e2f64736f6c63430008120033a2646970667358221220bc6e08f16072361b4052bf11a9ad1d0355777f8bfeeeced5d658b2ae07b298bd64736f6c63430008120033

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.