POL Price: $0.596418 (-3.76%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC20StakingModuleInfo

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 10000 runs

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

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

import "../interfaces/IStakingModuleInfo.sol";
import "../interfaces/IStakingModule.sol";
import "../ERC20StakingModule.sol";
import "./TokenUtilsInfo.sol";

/**
 * @title ERC20 staking module info library
 *
 * @notice this library provides read-only convenience functions to query
 * additional information about the ERC20StakingModule contract.
 */
library ERC20StakingModuleInfo {
    using TokenUtilsInfo for IERC20;

    // -- IStakingModuleInfo --------------------------------------------------

    /**
     * @notice convenience function to get all token metadata in a single call
     * @param module address of reward module
     * @return addresses_
     * @return names_
     * @return symbols_
     * @return decimals_
     */
    function tokens(
        address module
    )
        external
        view
        returns (
            address[] memory addresses_,
            string[] memory names_,
            string[] memory symbols_,
            uint8[] memory decimals_
        )
    {
        addresses_ = new address[](1);
        names_ = new string[](1);
        symbols_ = new string[](1);
        decimals_ = new uint8[](1);
        (addresses_[0], names_[0], symbols_[0], decimals_[0]) = token(module);
    }

    /**
     * @notice get all staking positions for user
     * @param module address of staking module
     * @param addr user address of interest
     * @param data additional encoded data
     * @return accounts_
     * @return shares_
     */
    function positions(
        address module,
        address addr,
        bytes calldata data
    )
        external
        view
        returns (bytes32[] memory accounts_, uint256[] memory shares_)
    {
        uint256 s = shares(module, addr, 0);
        if (s > 0) {
            accounts_ = new bytes32[](1);
            shares_ = new uint256[](1);
            accounts_[0] = bytes32(uint256(uint160(addr)));
            shares_[0] = s;
        }
    }

    // -- ERC20StakingModuleInfo ----------------------------------------------

    /**
     * @notice convenience function to get token metadata in a single call
     * @param module address of staking module
     * @return address
     * @return name
     * @return symbol
     * @return decimals
     */
    function token(
        address module
    ) public view returns (address, string memory, string memory, uint8) {
        IStakingModule m = IStakingModule(module);
        IERC20Metadata tkn = IERC20Metadata(m.tokens()[0]);
        return (address(tkn), tkn.name(), tkn.symbol(), tkn.decimals());
    }

    /**
     * @notice quote the share value for an amount of tokens
     * @param module address of staking module
     * @param addr account address of interest
     * @param amount number of tokens. if zero, return entire share balance
     * @return number of shares
     */
    function shares(
        address module,
        address addr,
        uint256 amount
    ) public view returns (uint256) {
        ERC20StakingModule m = ERC20StakingModule(module);

        // return all user shares
        if (amount == 0) {
            return m.shares(addr);
        }

        uint256 totalShares = m.totalShares();
        require(totalShares > 0, "smi1");

        // convert token amount to shares
        IERC20 tkn = IERC20(m.tokens()[0]);
        uint256 s = tkn.getShares(module, totalShares, amount);

        require(s > 0, "smi2");
        require(m.shares(addr) >= s, "smi3");

        return s;
    }

    /**
     * @notice get shares per token
     * @param module address of staking module
     * @return current shares per token
     */
    function sharesPerToken(address module) public view returns (uint256) {
        ERC20StakingModule m = ERC20StakingModule(module);

        uint256 totalShares = m.totalShares();
        if (totalShares == 0) {
            return 1e24;
        }

        IERC20 tkn = IERC20(m.tokens()[0]);
        return tkn.getShares(module, totalShares, 1e18);
    }
}

File 2 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 3 of 14 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

File 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 : ERC20StakingModule.sol
/*
ERC20StakingModule

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 "./interfaces/IStakingModule.sol";
import "./OwnerController.sol";
import "./TokenUtils.sol";

/**
 * @title ERC20 staking module
 *
 * @notice this staking module allows users to deposit an amount of ERC20 token
 * in exchange for shares credited to their address. When the user
 * unstakes, these shares will be burned and a reward will be distributed.
 */
contract ERC20StakingModule is IStakingModule, OwnerController {
    using SafeERC20 for IERC20;
    using TokenUtils for IERC20;

    // events
    event Approval(address indexed user, address indexed operator, bool value);

    // members
    IERC20 private immutable _token;
    address private immutable _factory;

    mapping(address => uint256) public shares;
    uint256 public totalShares;
    mapping(address => mapping(address => bool)) public approvals;

    /**
     * @param token_ the token that will be staked
     * @param factory_ address of module factory
     */
    constructor(address token_, address factory_) {
        require(token_ != address(0));
        _token = IERC20(token_);
        _factory = factory_;
    }

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

    /**
     * @inheritdoc IStakingModule
     */
    function balances(
        address user
    ) external view override returns (uint256[] memory balances_) {
        balances_ = new uint256[](1);
        balances_[0] = _balance(user);
    }

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

    /**
     * @inheritdoc IStakingModule
     */
    function totals()
        external
        view
        override
        returns (uint256[] memory totals_)
    {
        totals_ = new uint256[](1);
        totals_[0] = _token.balanceOf(address(this));
    }

    /**
     * @inheritdoc IStakingModule
     */
    function stake(
        address sender,
        uint256 amount,
        bytes calldata data
    ) external override onlyOwner returns (bytes32, uint256) {
        // validate
        require(amount > 0, "sm1");
        address account = _account(sender, data);

        // transfer
        uint256 minted = _token.receiveAmount(totalShares, sender, amount);

        // update user staking info
        shares[account] += minted;

        // add newly minted shares to global total
        totalShares += minted;

        bytes32 account_ = bytes32(uint256(uint160(account)));
        emit Staked(account_, sender, address(_token), amount, minted);

        return (account_, minted);
    }

    /**
     * @inheritdoc IStakingModule
     */
    function unstake(
        address sender,
        uint256 amount,
        bytes calldata data
    ) external override onlyOwner returns (bytes32, address, uint256) {
        // validate and get shares
        address account = _account(sender, data);
        uint256 burned = _shares(account, amount);

        // burn shares
        totalShares -= burned;
        shares[account] -= burned;

        // unstake
        _token.safeTransfer(sender, amount);

        bytes32 account_ = bytes32(uint256(uint160(account)));
        emit Unstaked(account_, sender, address(_token), amount, burned);

        return (account_, sender, burned);
    }

    /**
     * @inheritdoc IStakingModule
     */
    function claim(
        address sender,
        uint256 amount,
        bytes calldata data
    ) external override onlyOwner returns (bytes32, address, uint256) {
        address account = _account(sender, data);
        uint256 s = _shares(account, amount);
        bytes32 account_ = bytes32(uint256(uint160(account)));
        emit Claimed(account_, sender, address(_token), amount, s);
        return (account_, sender, s);
    }

    /**
     * @inheritdoc IStakingModule
     */
    function update(
        address sender,
        bytes calldata data
    ) external view override returns (bytes32) {
        return (bytes32(uint256(uint160(_account(sender, data)))));
    }

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

    /**
     * @notice set approval for operators to act on user position
     * @param operator address of operator
     * @param value boolean to grant or revoke approval
     */
    function approve(address operator, bool value) external {
        approvals[msg.sender][operator] = value;
        emit Approval(msg.sender, operator, value);
    }

    /**
     * @dev internal helper to get user balance
     * @param user address of interest
     */
    function _balance(address user) private view returns (uint256) {
        return _token.getAmount(totalShares, shares[user]);
    }

    /**
     * @dev internal helper to validate and convert user stake amount to shares
     * @param user address of user
     * @param amount number of tokens to consider
     * @return shares_ equivalent number of shares
     */
    function _shares(
        address user,
        uint256 amount
    ) private view returns (uint256 shares_) {
        // validate
        require(amount > 0, "sm3");
        require(totalShares > 0, "sm4");

        // convert token amount to shares
        shares_ = _token.getShares(totalShares, amount);

        require(shares_ > 0, "sm5");
        require(shares[user] >= shares_, "sm6");
    }

    /**
     * @dev internal helper to get account and validate approval
     * @param sender address of sender
     * @param data either empty bytes or encoded account address
     */
    function _account(
        address sender,
        bytes calldata data
    ) private view returns (address) {
        require(data.length == 0 || data.length == 32, "sm7");

        if (data.length > 0) {
            address account;
            assembly {
                account := calldataload(132)
            }
            require(approvals[account][sender], "sm8");
            return account;
        } else {
            return sender;
        }
    }
}

File 8 of 14 : TokenUtilsInfo.sol
/*
TokenUtilsInfo

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

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

/**
 * @title Token utilities info
 *
 * @notice this library implements utility methods for token handling,
 * dynamic balance accounting, and fee processing.
 *
 * this is a modified version to be used by info libraries.
 */
library TokenUtilsInfo {
    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 module address of module
     * @param total current total shares
     * @param amount balance of tokens
     */
    function getShares(
        IERC20 token,
        address module,
        uint256 total,
        uint256 amount
    ) internal view returns (uint256) {
        if (total == 0) return 0;
        uint256 balance = token.balanceOf(module);
        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 module address of module
     * @param total current total shares
     * @param shares balance of shares
     */
    function getAmount(
        IERC20 token,
        address module,
        uint256 total,
        uint256 shares
    ) internal view returns (uint256) {
        if (total == 0) return 0;
        uint256 balance = token.balanceOf(module);
        if (total < balance * FLOOR_SHARES_PER_TOKEN)
            return shares / FLOOR_SHARES_PER_TOKEN;
        return (balance * shares) / total;
    }
}

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 : 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 11 of 14 : IStakingModule.sol
/*
IStakingModule

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 Staking module interface
 *
 * @notice this contract defines the common interface that any staking module
 * must implement to be compatible with the modular Pool architecture.
 */
interface IStakingModule is IOwnerController, IEvents {
    /**
     * @return array of staking tokens
     */
    function tokens() external view returns (address[] memory);

    /**
     * @notice get balance of user
     * @param user address of user
     * @return balances of each staking token
     */
    function balances(address user) external view returns (uint256[] memory);

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

    /**
     * @notice get total staked amount
     * @return totals for each staking token
     */
    function totals() external view returns (uint256[] memory);

    /**
     * @notice stake an amount of tokens for user
     * @param sender address of sender
     * @param amount number of tokens to stake
     * @param data additional data
     * @return bytes32 id of staking account
     * @return number of shares minted for stake
     */
    function stake(
        address sender,
        uint256 amount,
        bytes calldata data
    ) external returns (bytes32, uint256);

    /**
     * @notice unstake an amount of tokens for user
     * @param sender address of sender
     * @param amount number of tokens to unstake
     * @param data additional data
     * @return bytes32 id of staking account
     * @return address of reward receiver
     * @return number of shares burned for unstake
     */
    function unstake(
        address sender,
        uint256 amount,
        bytes calldata data
    ) external returns (bytes32, address, uint256);

    /**
     * @notice quote the share value for an amount of tokens without unstaking
     * @param sender address of sender
     * @param amount number of tokens to claim with
     * @param data additional data
     * @return bytes32 id of staking account
     * @return address of reward receiver
     * @return number of shares that the claim amount is worth
     */
    function claim(
        address sender,
        uint256 amount,
        bytes calldata data
    ) external returns (bytes32, address, uint256);

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

    /**
     * @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 12 of 14 : IStakingModuleInfo.sol
/*
IStakingModuleInfo

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.18;

/**
 * @title Staking module info interface
 *
 * @notice this contract defines the common interface that any staking module info
 * must implement to be compatible with the modular Pool architecture.
 */
interface IStakingModuleInfo {
    /**
     * @notice convenience function to get all token metadata in a single call
     * @param module address of staking module
     * @return addresses
     * @return names
     * @return symbols
     * @return decimals
     */
    function tokens(
        address module
    )
        external
        view
        returns (
            address[] memory,
            string[] memory,
            string[] memory,
            uint8[] memory
        );

    /**
     * @notice get all staking positions for user
     * @param module address of staking module
     * @param addr user address of interest
     * @param data additional encoded data
     * @return accounts_
     * @return shares_
     */
    function positions(
        address module,
        address addr,
        bytes calldata data
    ) external view returns (bytes32[] memory, uint256[] memory);
}

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

[{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"address","name":"addr","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"positions","outputs":[{"internalType":"bytes32[]","name":"accounts_","type":"bytes32[]"},{"internalType":"uint256[]","name":"shares_","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"sharesPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"tokens","outputs":[{"internalType":"address[]","name":"addresses_","type":"address[]"},{"internalType":"string[]","name":"names_","type":"string[]"},{"internalType":"string[]","name":"symbols_","type":"string[]"},{"internalType":"uint8[]","name":"decimals_","type":"uint8[]"}],"stateMutability":"view","type":"function"}]

61113561003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100715760003560e01c80636d46a1db1161005a5780636d46a1db146100af5780637a84ba6f146100d2578063e4860339146100f357600080fd5b806336fe2c99146100765780635ab2c6761461009c575b600080fd5b610089610084366004610b5b565b610116565b6040519081526020015b60405180910390f35b6100896100aa366004610b9c565b6104d0565b6100c26100bd366004610b9c565b61062b565b6040516100939493929190610c09565b6100e56100e0366004610c5f565b61082e565b604051610093929190610cf1565b610106610101366004610b9c565b6108eb565b6040516100939493929190610db1565b6000838282036101b8576040517fce7c2ac200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282169063ce7c2ac290602401602060405180830381865afa15801561018c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b09190610e6f565b9150506104c9565b60008173ffffffffffffffffffffffffffffffffffffffff16633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa158015610205573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102299190610e6f565b9050600081116102a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102979060208082526004908201527f736d693100000000000000000000000000000000000000000000000000000000604082015260600190565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff16639d63848a6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156102ed573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103159190810190610ee8565b60008151811061032757610327610f9a565b60209081029190910101519050600061035873ffffffffffffffffffffffffffffffffffffffff8316898589610a46565b9050600081116103c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102979060208082526004908201527f736d693200000000000000000000000000000000000000000000000000000000604082015260600190565b6040517fce7c2ac200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff888116600483015282919086169063ce7c2ac290602401602060405180830381865afa158015610435573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104599190610e6f565b10156104c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102979060208082526004908201527f736d693300000000000000000000000000000000000000000000000000000000604082015260600190565b93505050505b9392505050565b60008082905060008173ffffffffffffffffffffffffffffffffffffffff16633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa158015610523573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105479190610e6f565b905080600003610564575069d3c21bcecceda10000009392505050565b60008273ffffffffffffffffffffffffffffffffffffffff16639d63848a6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156105b1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105d99190810190610ee8565b6000815181106105eb576105eb610f9a565b6020908102919091010151905061062273ffffffffffffffffffffffffffffffffffffffff82168684670de0b6b3a7640000610a46565b95945050505050565b600060608060008085905060008173ffffffffffffffffffffffffffffffffffffffff16639d63848a6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610683573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106ab9190810190610ee8565b6000815181106106bd576106bd610f9a565b60200260200101519050808173ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015610713573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261073b9190810190610fc9565b8273ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610786573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107ae9190810190610fc9565b8373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081d919061105d565b955095509550955050509193509193565b606080600061083f87876000610116565b905080156108e157604080516001808252818301909252906020808301908036833750506040805160018082528183019092529295509050602080830190803683370190505091508573ffffffffffffffffffffffffffffffffffffffff1660001b836000815181106108b4576108b4610f9a565b60200260200101818152505080826000815181106108d4576108d4610f9a565b6020026020010181815250505b5094509492505050565b604080516001808252818301909252606091829182918291906020808301908036833701905050604080516001808252818301909252919550816020015b6060815260200190600190039081610929575050604080516001808252818301909252919450602082015b6060815260200190600190039081610954575050604080516001808252818301909252919350602080830190803683370190505090506109938561062b565b876000815181106109a6576109a6610f9a565b60200260200101876000815181106109c0576109c0610f9a565b60200260200101876000815181106109da576109da610f9a565b60200260200101876000815181106109f4576109f4610f9a565b602002602001018460ff1660ff168152508490528490528473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250505050509193509193565b600082600003610a5857506000610b2e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152600091908716906370a0823190602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190610e6f565b9050610afa6103e882611080565b841015610b1557610b0d6103e884611080565b915050610b2e565b80610b208486611080565b610b2a91906110c4565b9150505b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610b5857600080fd5b50565b600080600060608486031215610b7057600080fd5b8335610b7b81610b36565b92506020840135610b8b81610b36565b929592945050506040919091013590565b600060208284031215610bae57600080fd5b81356104c981610b36565b60005b83811015610bd4578181015183820152602001610bbc565b50506000910152565b60008151808452610bf5816020860160208601610bb9565b601f01601f19169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201526000610c386080830186610bdd565b8281036040840152610c4a8186610bdd565b91505060ff8316606083015295945050505050565b60008060008060608587031215610c7557600080fd5b8435610c8081610b36565b93506020850135610c9081610b36565b9250604085013567ffffffffffffffff80821115610cad57600080fd5b818701915087601f830112610cc157600080fd5b813581811115610cd057600080fd5b886020828501011115610ce257600080fd5b95989497505060200194505050565b604080825283519082018190526000906020906060840190828701845b82811015610d2a57815184529284019290840190600101610d0e565b5050508381038285015284518082528583019183019060005b81811015610d5f57835183529284019291840191600101610d43565b5090979650505050505050565b6000815180845260208085019450848260051b860182860160005b85811015610d5f578383038952610d9f838351610bdd565b98850198925090840190600101610d87565b6080808252855190820181905260009060209060a0840190828901845b82811015610e0057815173ffffffffffffffffffffffffffffffffffffffff1684529284019290840190600101610dce565b50505083810382850152610e148188610d6c565b90508381036040850152610e288187610d6c565b8481036060860152855180825283870192509083019060005b81811015610e6057835160ff1683529284019291840191600101610e41565b50909998505050505050505050565b600060208284031215610e8157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610ee057610ee0610e88565b604052919050565b60006020808385031215610efb57600080fd5b825167ffffffffffffffff80821115610f1357600080fd5b818501915085601f830112610f2757600080fd5b815181811115610f3957610f39610e88565b8060051b9150610f4a848301610eb7565b8181529183018401918481019088841115610f6457600080fd5b938501935b83851015610f8e5784519250610f7e83610b36565b8282529385019390850190610f69565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215610fdb57600080fd5b815167ffffffffffffffff80821115610ff357600080fd5b818401915084601f83011261100757600080fd5b81518181111561101957611019610e88565b61102c6020601f19601f84011601610eb7565b915080825285602082850101111561104357600080fd5b611054816020840160208601610bb9565b50949350505050565b60006020828403121561106f57600080fd5b815160ff811681146104c957600080fd5b80820281158282048414176110be577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b6000826110fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50049056fea264697066735822122044020b087e37264e9c5328ae97d7ec322128cdfecbd036dd5541f46758ec46fd64736f6c63430008120033

Deployed Bytecode

0x7327403fb4be8f1e4d869cd1a888a20933a869bbdb30146080604052600436106100715760003560e01c80636d46a1db1161005a5780636d46a1db146100af5780637a84ba6f146100d2578063e4860339146100f357600080fd5b806336fe2c99146100765780635ab2c6761461009c575b600080fd5b610089610084366004610b5b565b610116565b6040519081526020015b60405180910390f35b6100896100aa366004610b9c565b6104d0565b6100c26100bd366004610b9c565b61062b565b6040516100939493929190610c09565b6100e56100e0366004610c5f565b61082e565b604051610093929190610cf1565b610106610101366004610b9c565b6108eb565b6040516100939493929190610db1565b6000838282036101b8576040517fce7c2ac200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015282169063ce7c2ac290602401602060405180830381865afa15801561018c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b09190610e6f565b9150506104c9565b60008173ffffffffffffffffffffffffffffffffffffffff16633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa158015610205573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102299190610e6f565b9050600081116102a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102979060208082526004908201527f736d693100000000000000000000000000000000000000000000000000000000604082015260600190565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff16639d63848a6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156102ed573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103159190810190610ee8565b60008151811061032757610327610f9a565b60209081029190910101519050600061035873ffffffffffffffffffffffffffffffffffffffff8316898589610a46565b9050600081116103c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102979060208082526004908201527f736d693200000000000000000000000000000000000000000000000000000000604082015260600190565b6040517fce7c2ac200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff888116600483015282919086169063ce7c2ac290602401602060405180830381865afa158015610435573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104599190610e6f565b10156104c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102979060208082526004908201527f736d693300000000000000000000000000000000000000000000000000000000604082015260600190565b93505050505b9392505050565b60008082905060008173ffffffffffffffffffffffffffffffffffffffff16633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa158015610523573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105479190610e6f565b905080600003610564575069d3c21bcecceda10000009392505050565b60008273ffffffffffffffffffffffffffffffffffffffff16639d63848a6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156105b1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105d99190810190610ee8565b6000815181106105eb576105eb610f9a565b6020908102919091010151905061062273ffffffffffffffffffffffffffffffffffffffff82168684670de0b6b3a7640000610a46565b95945050505050565b600060608060008085905060008173ffffffffffffffffffffffffffffffffffffffff16639d63848a6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610683573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106ab9190810190610ee8565b6000815181106106bd576106bd610f9a565b60200260200101519050808173ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015610713573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261073b9190810190610fc9565b8273ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610786573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107ae9190810190610fc9565b8373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081d919061105d565b955095509550955050509193509193565b606080600061083f87876000610116565b905080156108e157604080516001808252818301909252906020808301908036833750506040805160018082528183019092529295509050602080830190803683370190505091508573ffffffffffffffffffffffffffffffffffffffff1660001b836000815181106108b4576108b4610f9a565b60200260200101818152505080826000815181106108d4576108d4610f9a565b6020026020010181815250505b5094509492505050565b604080516001808252818301909252606091829182918291906020808301908036833701905050604080516001808252818301909252919550816020015b6060815260200190600190039081610929575050604080516001808252818301909252919450602082015b6060815260200190600190039081610954575050604080516001808252818301909252919350602080830190803683370190505090506109938561062b565b876000815181106109a6576109a6610f9a565b60200260200101876000815181106109c0576109c0610f9a565b60200260200101876000815181106109da576109da610f9a565b60200260200101876000815181106109f4576109f4610f9a565b602002602001018460ff1660ff168152508490528490528473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250505050509193509193565b600082600003610a5857506000610b2e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152600091908716906370a0823190602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190610e6f565b9050610afa6103e882611080565b841015610b1557610b0d6103e884611080565b915050610b2e565b80610b208486611080565b610b2a91906110c4565b9150505b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610b5857600080fd5b50565b600080600060608486031215610b7057600080fd5b8335610b7b81610b36565b92506020840135610b8b81610b36565b929592945050506040919091013590565b600060208284031215610bae57600080fd5b81356104c981610b36565b60005b83811015610bd4578181015183820152602001610bbc565b50506000910152565b60008151808452610bf5816020860160208601610bb9565b601f01601f19169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201526000610c386080830186610bdd565b8281036040840152610c4a8186610bdd565b91505060ff8316606083015295945050505050565b60008060008060608587031215610c7557600080fd5b8435610c8081610b36565b93506020850135610c9081610b36565b9250604085013567ffffffffffffffff80821115610cad57600080fd5b818701915087601f830112610cc157600080fd5b813581811115610cd057600080fd5b886020828501011115610ce257600080fd5b95989497505060200194505050565b604080825283519082018190526000906020906060840190828701845b82811015610d2a57815184529284019290840190600101610d0e565b5050508381038285015284518082528583019183019060005b81811015610d5f57835183529284019291840191600101610d43565b5090979650505050505050565b6000815180845260208085019450848260051b860182860160005b85811015610d5f578383038952610d9f838351610bdd565b98850198925090840190600101610d87565b6080808252855190820181905260009060209060a0840190828901845b82811015610e0057815173ffffffffffffffffffffffffffffffffffffffff1684529284019290840190600101610dce565b50505083810382850152610e148188610d6c565b90508381036040850152610e288187610d6c565b8481036060860152855180825283870192509083019060005b81811015610e6057835160ff1683529284019291840191600101610e41565b50909998505050505050505050565b600060208284031215610e8157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610ee057610ee0610e88565b604052919050565b60006020808385031215610efb57600080fd5b825167ffffffffffffffff80821115610f1357600080fd5b818501915085601f830112610f2757600080fd5b815181811115610f3957610f39610e88565b8060051b9150610f4a848301610eb7565b8181529183018401918481019088841115610f6457600080fd5b938501935b83851015610f8e5784519250610f7e83610b36565b8282529385019390850190610f69565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215610fdb57600080fd5b815167ffffffffffffffff80821115610ff357600080fd5b818401915084601f83011261100757600080fd5b81518181111561101957611019610e88565b61102c6020601f19601f84011601610eb7565b915080825285602082850101111561104357600080fd5b611054816020840160208601610bb9565b50949350505050565b60006020828403121561106f57600080fd5b815160ff811681146104c957600080fd5b80820281158282048414176110be577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b6000826110fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50049056fea264697066735822122044020b087e37264e9c5328ae97d7ec322128cdfecbd036dd5541f46758ec46fd64736f6c63430008120033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.