POL Price: $0.644487 (+3.52%)
 

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

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
287954362022-05-26 14:28:54931 days ago1653575334
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
285578682022-05-20 18:17:05936 days ago1653070625
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
285028742022-05-19 9:25:19938 days ago1652952319
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
283465852022-05-15 11:51:58942 days ago1652615518
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
283463482022-05-15 11:43:48942 days ago1652615028
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
282794972022-05-13 19:42:34943 days ago1652470954
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
282264522022-05-12 10:39:14945 days ago1652351954
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279376892022-05-05 3:13:00952 days ago1651720380
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279376592022-05-05 3:11:48952 days ago1651720308
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279370432022-05-05 2:46:32952 days ago1651718792
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279370162022-05-05 2:45:34952 days ago1651718734
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279369762022-05-05 2:44:14952 days ago1651718654
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279369312022-05-05 2:42:40952 days ago1651718560
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279368942022-05-05 2:41:22952 days ago1651718482
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279368592022-05-05 2:40:12952 days ago1651718412
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279368322022-05-05 2:39:18952 days ago1651718358
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279367032022-05-05 2:34:48952 days ago1651718088
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279366392022-05-05 2:32:36952 days ago1651717956
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279296832022-05-04 22:24:51952 days ago1651703091
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279294942022-05-04 22:16:59952 days ago1651702619
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279294252022-05-04 22:13:51952 days ago1651702431
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279293602022-05-04 22:11:37952 days ago1651702297
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279292512022-05-04 22:07:51952 days ago1651702071
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279291842022-05-04 22:05:33952 days ago1651701933
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
279290022022-05-04 21:57:01952 days ago1651701421
0x225fbc87...5c81CEB9a
 Contract Creation0 POL
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC20CompetitiveRewardModuleFactory

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
File 1 of 12 : ERC20CompetitiveRewardModuleFactory.sol
/*
ERC20CompetitiveRewardModuleFactory

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.4;

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

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

        // parse constructor arguments
        address token;
        uint256 bonusMin;
        uint256 bonusMax;
        uint256 bonusPeriod;
        assembly {
            token := calldataload(68)
            bonusMin := calldataload(100)
            bonusMax := calldataload(132)
            bonusPeriod := calldataload(164)
        }

        // create module
        ERC20CompetitiveRewardModule module =
            new ERC20CompetitiveRewardModule(
                token,
                bonusMin,
                bonusMax,
                bonusPeriod,
                address(this)
            );
        module.transferOwnership(msg.sender);

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

File 2 of 12 : ERC20BaseRewardModule.sol
/*
ERC20BaseRewardModule

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.4;

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

import "./interfaces/IRewardModule.sol";

/**
 * @title ERC20 base reward module
 *
 * @notice this abstract class implements common ERC20 funding and unlocking
 * logic, which is inherited by other reward modules.
 */
abstract contract ERC20BaseRewardModule is IRewardModule {
    using SafeERC20 for IERC20;

    // single funding/reward schedule
    struct Funding {
        uint256 amount;
        uint256 shares;
        uint256 locked;
        uint256 updated;
        uint256 start;
        uint256 duration;
    }

    // constants
    uint256 public constant INITIAL_SHARES_PER_TOKEN = 10**6;
    uint256 public constant MAX_ACTIVE_FUNDINGS = 16;

    // funding/reward state fields
    mapping(address => Funding[]) private _fundings;
    mapping(address => uint256) private _shares;
    mapping(address => uint256) private _locked;

    /**
     * @notice getter for total token shares
     */
    function totalShares(address token) public view returns (uint256) {
        return _shares[token];
    }

    /**
     * @notice getter for total locked token shares
     */
    function lockedShares(address token) public view returns (uint256) {
        return _locked[token];
    }

    /**
     * @notice getter for funding schedule struct
     */
    function fundings(address token, uint256 index)
        public
        view
        returns (
            uint256 amount,
            uint256 shares,
            uint256 locked,
            uint256 updated,
            uint256 start,
            uint256 duration
        )
    {
        Funding storage f = _fundings[token][index];
        return (f.amount, f.shares, f.locked, f.updated, f.start, f.duration);
    }

    /**
     * @param token contract address of reward token
     * @return number of active funding schedules
     */
    function fundingCount(address token) public view returns (uint256) {
        return _fundings[token].length;
    }

    /**
     * @notice compute number of unlockable shares for a specific funding schedule
     * @param token contract address of reward token
     * @param idx index of the funding
     * @return the number of unlockable shares
     */
    function unlockable(address token, uint256 idx)
        public
        view
        returns (uint256)
    {
        Funding storage funding = _fundings[token][idx];

        // funding schedule is in future
        if (block.timestamp < funding.start) {
            return 0;
        }
        // empty
        if (funding.locked == 0) {
            return 0;
        }
        // handle zero-duration period or leftover dust from integer division
        if (block.timestamp >= funding.start + funding.duration) {
            return funding.locked;
        }

        return
            ((block.timestamp - funding.updated) * funding.shares) /
            funding.duration;
    }

    /**
     * @notice fund pool by locking up reward tokens for future distribution
     * @param token contract address of reward token
     * @param amount number of reward tokens to lock up as funding
     * @param duration period (seconds) over which funding will be unlocked
     * @param start time (seconds) at which funding begins to unlock
     */
    function _fund(
        address token,
        uint256 amount,
        uint256 duration,
        uint256 start
    ) internal {
        requireController();
        // validate
        require(amount > 0, "rm1");
        require(start >= block.timestamp, "rm2");
        require(_fundings[token].length < MAX_ACTIVE_FUNDINGS, "rm3");

        IERC20 rewardToken = IERC20(token);

        // do transfer of funding
        uint256 total = rewardToken.balanceOf(address(this));
        rewardToken.safeTransferFrom(msg.sender, address(this), amount);
        uint256 actual = rewardToken.balanceOf(address(this)) - total;

        // mint shares at current rate
        uint256 minted =
            (total > 0)
                ? (_shares[token] * actual) / total
                : actual * INITIAL_SHARES_PER_TOKEN;

        _locked[token] += minted;
        _shares[token] += minted;

        // create new funding
        _fundings[token].push(
            Funding({
                amount: amount,
                shares: minted,
                locked: minted,
                updated: start,
                start: start,
                duration: duration
            })
        );

        emit RewardsFunded(token, amount, minted, start);
    }

    /**
     * @dev internal function to clean up stale funding schedules
     * @param token contract address of reward token to clean up
     */
    function _clean(address token) internal {
        // check for stale funding schedules to expire
        uint256 removed = 0;
        uint256 originalSize = _fundings[token].length;
        for (uint256 i = 0; i < originalSize; i++) {
            Funding storage funding = _fundings[token][i - removed];
            uint256 idx = i - removed;

            if (
                unlockable(token, idx) == 0 &&
                block.timestamp >= funding.start + funding.duration
            ) {
                emit RewardsExpired(
                    token,
                    funding.amount,
                    funding.shares,
                    funding.start
                );

                // remove at idx by copying last element here, then popping off last
                // (we don't care about order)
                _fundings[token][idx] = _fundings[token][
                    _fundings[token].length - 1
                ];
                _fundings[token].pop();
                removed++;
            }
        }
    }

    /**
     * @dev unlocks reward tokens based on funding schedules
     * @param token contract addres of reward token
     * @return shares number of shares unlocked
     */
    function _unlockTokens(address token) internal returns (uint256 shares) {
        // get unlockable shares for each funding schedule
        for (uint256 i = 0; i < _fundings[token].length; i++) {
            uint256 s = unlockable(token, i);
            Funding storage funding = _fundings[token][i];
            if (s > 0) {
                funding.locked -= s;
                funding.updated = block.timestamp;
                shares += s;
            }
        }

        // do unlocking
        if (shares > 0) {
            _locked[token] -= shares;
            emit RewardsUnlocked(token, shares);
        }
    }

    /**
     * @dev distribute reward tokens to user
     * @param user address of user receiving rweard
     * @param token contract address of reward token
     * @param shares number of shares to be distributed
     * @return amount number of reward tokens distributed
     */
    function _distribute(
        address user,
        address token,
        uint256 shares
    ) internal returns (uint256 amount) {
        // compute reward amount in tokens
        IERC20 rewardToken = IERC20(token);
        amount =
            (rewardToken.balanceOf(address(this)) * shares) /
            _shares[token];

        // update overall reward shares
        _shares[token] -= shares;

        // do reward
        rewardToken.safeTransfer(user, amount);
        emit RewardsDistributed(user, token, amount, shares);
    }
}

File 3 of 12 : ERC20CompetitiveRewardModule.sol
/*
ERC20CompetitiveRewardModule

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.4;

import "./interfaces/IRewardModule.sol";
import "./ERC20BaseRewardModule.sol";
import "./GysrUtils.sol";

/**
 * @title ERC20 competitive reward module
 *
 * @notice this reward module distributes a single ERC20 token as the staking reward.
 * It is designed to offer competitive and engaging reward mechanics.
 *
 * @dev share seconds are the primary unit of accounting in this module. They
 * are accrued over time and burned during reward distribution. Users can
 * earn a time multiplier as an incentive for longer term staking. They can
 * also receive a GYSR multiplier by spending GYSR at the time of unstaking.
 *
 * h/t https://github.com/ampleforth/token-geyser
 */
contract ERC20CompetitiveRewardModule is ERC20BaseRewardModule {
    using SafeERC20 for IERC20;
    using GysrUtils for uint256;

    // single stake by user
    struct Stake {
        uint256 shares;
        uint256 timestamp;
    }

    mapping(address => Stake[]) public stakes;

    // configuration fields
    uint256 public immutable bonusMin;
    uint256 public immutable bonusMax;
    uint256 public immutable bonusPeriod;
    IERC20 private immutable _token;
    address private immutable _factory;

    // global state fields
    uint256 public totalStakingShares;
    uint256 public totalStakingShareSeconds;
    uint256 public lastUpdated;
    uint256 private _usage;

    /**
     * @param token_ the token that will be rewarded
     * @param bonusMin_ initial time bonus
     * @param bonusMax_ maximum time bonus
     * @param bonusPeriod_ period (in seconds) over which time bonus grows to max
     * @param factory_ address of module factory
     */
    constructor(
        address token_,
        uint256 bonusMin_,
        uint256 bonusMax_,
        uint256 bonusPeriod_,
        address factory_
    ) {
        require(bonusMin_ <= bonusMax_, "crm1");

        _token = IERC20(token_);
        _factory = factory_;

        bonusMin = bonusMin_;
        bonusMax = bonusMax_;
        bonusPeriod = bonusPeriod_;

        lastUpdated = block.timestamp;
    }

    // -- 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);
        balances_[0] = totalLocked();
    }

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

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

    /**
     * @inheritdoc IRewardModule
     */
    function stake(
        address account,
        address,
        uint256 shares,
        bytes calldata
    ) external override onlyOwner returns (uint256, uint256) {
        _update();
        _stake(account, shares);
        return (0, 0);
    }

    /**
     * @inheritdoc IRewardModule
     */
    function unstake(
        address account,
        address user,
        uint256 shares,
        bytes calldata data
    ) external override onlyOwner returns (uint256, uint256) {
        _update();
        return _unstake(account, user, shares, data);
    }

    /**
     * @inheritdoc IRewardModule
     */
    function claim(
        address account,
        address user,
        uint256 shares,
        bytes calldata data
    ) external override onlyOwner returns (uint256 spent, uint256 vested) {
        _update();
        (spent, vested) = _unstake(account, user, shares, data);
        _stake(account, shares);
    }

    /**
     * @inheritdoc IRewardModule
     */
    function update(address) external override {
        requireOwner();
        _update();
    }

    /**
     * @inheritdoc IRewardModule
     */
    function clean() external override {
        requireOwner();
        _update();
        _clean(address(_token));
    }

    // -- ERC20CompetitiveRewardModule ----------------------------------------

    /**
     * @notice fund module by locking up reward tokens for distribution
     * @param amount number of reward tokens to lock up as funding
     * @param duration period (seconds) over which funding will be unlocked
     */
    function fund(uint256 amount, uint256 duration) external {
        _update();
        _fund(address(_token), amount, duration, block.timestamp);
    }

    /**
     * @notice fund module by locking up reward tokens for distribution
     * @param amount number of reward tokens to lock up as funding
     * @param duration period (seconds) over which funding will be unlocked
     * @param start time (seconds) at which funding begins to unlock
     */
    function fund(
        uint256 amount,
        uint256 duration,
        uint256 start
    ) external {
        _update();
        _fund(address(_token), amount, duration, start);
    }

    /**
     * @notice compute time bonus earned as a function of staking time
     * @param time length of time for which the tokens have been staked
     * @return bonus multiplier for time
     */
    function timeBonus(uint256 time) public view returns (uint256) {
        if (time >= bonusPeriod) {
            return 10**DECIMALS + bonusMax;
        }

        // linearly interpolate between bonus min and bonus max
        uint256 bonus = bonusMin + ((bonusMax - bonusMin) * time) / bonusPeriod;
        return 10**DECIMALS + bonus;
    }

    /**
     * @return total number of locked reward tokens
     */
    function totalLocked() public view returns (uint256) {
        if (lockedShares(address(_token)) == 0) {
            return 0;
        }
        return
            (_token.balanceOf(address(this)) * lockedShares(address(_token))) /
            totalShares(address(_token));
    }

    /**
     * @return total number of unlocked reward tokens
     */
    function totalUnlocked() public view returns (uint256) {
        uint256 unlockedShares =
            totalShares(address(_token)) - lockedShares(address(_token));

        if (unlockedShares == 0) {
            return 0;
        }
        return
            (_token.balanceOf(address(this)) * unlockedShares) /
            totalShares(address(_token));
    }

    /**
     * @param addr address of interest
     * @return number of active stakes for user
     */
    function stakeCount(address addr) public view returns (uint256) {
        return stakes[addr].length;
    }

    // -- ERC20CompetitiveRewardModule internal -------------------------------

    /**
     * @dev internal implementation of stake method
     * @param account address of staking account
     * @param shares number of shares burned
     */
    function _stake(address account, uint256 shares) private {
        // update user staking info
        stakes[account].push(Stake(shares, block.timestamp));

        // add newly minted shares to global total
        totalStakingShares += shares;
    }

    /**
     * @dev internal implementation of unstake method
     * @param account address of staking account
     * @param user address of user
     * @param shares number of shares burned
     * @param data additional data
     * @return spent amount of gysr spent
     * @return vested amount of gysr vested
     */
    function _unstake(
        address account,
        address user,
        uint256 shares,
        bytes calldata data
    ) private returns (uint256 spent, uint256 vested) {
        // validate
        // note: we assume shares has been validated upstream
        require(data.length == 0 || data.length == 32, "crm2");

        // parse GYSR amount from data
        if (data.length == 32) {
            assembly {
                spent := calldataload(164)
            }
        }

        uint256 bonus = spent.gysrBonus(shares, totalStakingShares, _usage);

        // do unstaking, first-in last-out, respecting time bonus
        uint256 shareSeconds;
        uint256 timeWeightedShareSeconds;
        (shareSeconds, timeWeightedShareSeconds) = _unstakeFirstInLastOut(
            account,
            shares
        );

        // compute and apply GYSR token bonus
        uint256 gysrWeightedShareSeconds =
            (bonus * timeWeightedShareSeconds) / 10**DECIMALS;

        // get reward in shares
        uint256 unlockedShares =
            totalShares(address(_token)) - lockedShares(address(_token));

        uint256 rewardShares =
            (unlockedShares * gysrWeightedShareSeconds) /
                (totalStakingShareSeconds + gysrWeightedShareSeconds);

        // reward
        if (rewardShares > 0) {
            _distribute(user, address(_token), rewardShares);

            // update usage
            uint256 ratio;
            if (spent > 0) {
                vested = spent;
                emit GysrSpent(user, spent);
                emit GysrVested(user, vested);
                ratio = ((bonus - 10**DECIMALS) * 10**DECIMALS) / bonus;
            }
            uint256 weight =
                (shareSeconds * 10**DECIMALS) /
                    (totalStakingShareSeconds + shareSeconds);
            _usage =
                _usage -
                (weight * _usage) /
                10**DECIMALS +
                (weight * ratio) /
                10**DECIMALS;
        }
    }

    /**
     * @dev internal implementation of update method to
     * unlock tokens and do global accounting
     */
    function _update() private {
        _unlockTokens(address(_token));

        // global accounting
        totalStakingShareSeconds +=
            (block.timestamp - lastUpdated) *
            totalStakingShares;
        lastUpdated = block.timestamp;
    }

    /**
     * @dev helper function to actually execute unstaking, first-in last-out, 
     while computing and applying time bonus. This function also updates
     user and global totals for shares and share-seconds.
     * @param user address of user
     * @param shares number of staking shares to burn
     * @return rawShareSeconds raw share seconds burned
     * @return bonusShareSeconds time bonus weighted share seconds
     */
    function _unstakeFirstInLastOut(address user, uint256 shares)
        private
        returns (uint256 rawShareSeconds, uint256 bonusShareSeconds)
    {
        // redeem first-in-last-out
        uint256 sharesLeftToBurn = shares;
        Stake[] storage userStakes = stakes[user];
        while (sharesLeftToBurn > 0) {
            Stake storage lastStake = userStakes[userStakes.length - 1];
            uint256 stakeTime = block.timestamp - lastStake.timestamp;

            uint256 bonus = timeBonus(stakeTime);

            if (lastStake.shares <= sharesLeftToBurn) {
                // fully redeem a past stake
                bonusShareSeconds +=
                    (lastStake.shares * stakeTime * bonus) /
                    10**DECIMALS;
                rawShareSeconds += lastStake.shares * stakeTime;
                sharesLeftToBurn -= lastStake.shares;
                userStakes.pop();
            } else {
                // partially redeem a past stake
                bonusShareSeconds +=
                    (sharesLeftToBurn * stakeTime * bonus) /
                    10**DECIMALS;
                rawShareSeconds += sharesLeftToBurn * stakeTime;
                lastStake.shares -= sharesLeftToBurn;
                sharesLeftToBurn = 0;
            }
        }

        // update global totals
        totalStakingShareSeconds -= rawShareSeconds;
        totalStakingShares -= shares;
    }
}

File 4 of 12 : GysrUtils.sol
/*
GYSRUtils

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.4;

import "./MathUtils.sol";

/**
 * @title GYSR utilities
 *
 * @notice this library implements utility methods for the GYSR multiplier
 * and spending mechanics
 */
library GysrUtils {
    using MathUtils for int128;

    // constants
    uint256 public constant DECIMALS = 18;
    uint256 public constant GYSR_PROPORTION = 10**(DECIMALS - 2); // 1%

    /**
     * @notice compute GYSR bonus as a function of usage ratio, stake amount,
     * and GYSR spent
     * @param gysr number of GYSR token applied to bonus
     * @param amount number of tokens or shares to unstake
     * @param total number of tokens or shares in overall pool
     * @param ratio usage ratio from 0 to 1
     * @return multiplier value
     */
    function gysrBonus(
        uint256 gysr,
        uint256 amount,
        uint256 total,
        uint256 ratio
    ) internal pure returns (uint256) {
        if (amount == 0) {
            return 0;
        }
        if (total == 0) {
            return 0;
        }
        if (gysr == 0) {
            return 10**DECIMALS;
        }

        // scale GYSR amount with respect to proportion
        uint256 portion = (GYSR_PROPORTION * total) / 10**DECIMALS;
        if (amount > portion) {
            gysr = (gysr * portion) / amount;
        }

        // 1 + gysr / (0.01 + ratio)
        uint256 x = 2**64 + (2**64 * gysr) / (10**(DECIMALS - 2) + ratio);

        return
            10**DECIMALS +
            (uint256(int256(int128(uint128(x)).logbase10())) * 10**DECIMALS) /
            2**64;
    }
}

File 5 of 12 : MathUtils.sol
/*
MathUtils

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

SPDX-License-Identifier: BSD-4-Clause
*/

pragma solidity 0.8.4;

/**
 * @title Math utilities
 *
 * @notice this library implements various logarithmic math utilies which support
 * other contracts and specifically the GYSR multiplier calculation
 *
 * @dev h/t https://github.com/abdk-consulting/abdk-libraries-solidity
 */
library MathUtils {
    /**
     * @notice calculate binary logarithm of x
     *
     * @param x signed 64.64-bit fixed point number, require x > 0
     * @return signed 64.64-bit fixed point number
     */
    function logbase2(int128 x) internal pure returns (int128) {
        unchecked {
            require(x > 0);

            int256 msb = 0;
            int256 xc = x;
            if (xc >= 0x10000000000000000) {
                xc >>= 64;
                msb += 64;
            }
            if (xc >= 0x100000000) {
                xc >>= 32;
                msb += 32;
            }
            if (xc >= 0x10000) {
                xc >>= 16;
                msb += 16;
            }
            if (xc >= 0x100) {
                xc >>= 8;
                msb += 8;
            }
            if (xc >= 0x10) {
                xc >>= 4;
                msb += 4;
            }
            if (xc >= 0x4) {
                xc >>= 2;
                msb += 2;
            }
            if (xc >= 0x2) msb += 1; // No need to shift xc anymore

            int256 result = (msb - 64) << 64;
            uint256 ux = uint256(int256(x)) << uint256(127 - msb);
            for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {
                ux *= ux;
                uint256 b = ux >> 255;
                ux >>= 127 + b;
                result += bit * int256(b);
            }

            return int128(result);
        }
    }

    /**
     * @notice calculate natural logarithm of x
     * @dev magic constant comes from ln(2) * 2^128 -> hex
     * @param x signed 64.64-bit fixed point number, require x > 0
     * @return signed 64.64-bit fixed point number
     */
    function ln(int128 x) internal pure returns (int128) {
        unchecked {
            require(x > 0);

            return
                int128(
                    int256(
                        (uint256(int256(logbase2(x))) *
                            0xB17217F7D1CF79ABC9E3B39803F2F6AF) >> 128
                    )
                );
        }
    }

    /**
     * @notice calculate logarithm base 10 of x
     * @dev magic constant comes from log10(2) * 2^128 -> hex
     * @param x signed 64.64-bit fixed point number, require x > 0
     * @return signed 64.64-bit fixed point number
     */
    function logbase10(int128 x) internal pure returns (int128) {
        require(x > 0);

        return
            int128(
                int256(
                    (uint256(int256(logbase2(x))) *
                        0x4d104d427de7fce20a6e420e02236748) >> 128
                )
            );
    }

    // wrapper functions to allow testing
    function testlogbase2(int128 x) public pure returns (int128) {
        return logbase2(x);
    }

    function testlogbase10(int128 x) public pure returns (int128) {
        return logbase10(x);
    }
}

File 6 of 12 : OwnerController.sol
/*
OwnerController

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.4;

/**
 * @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 {
    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 returns (address) {
        return _owner;
    }

    /**
     * @dev Returns the address of the current controller.
     */
    function controller() public view 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`). This can
     * include renouncing ownership by transferring to the zero address.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual {
        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 {
        requireOwner();
        require(newController != address(0), "oc4");
        emit ControlTransferred(_controller, newController);
        _controller = newController;
    }
}

File 7 of 12 : IEvents.sol
/*
IEvents

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

SPDX-License-Identifier: MIT
 */

pragma solidity 0.8.4;

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

    // 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 RewardsUnlocked(address indexed token, uint256 shares);
    event RewardsExpired(
        address indexed token,
        uint256 amount,
        uint256 shares,
        uint256 timestamp
    );

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

File 8 of 12 : IModuleFactory.sol
/*
IModuleFactory

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.4;

/**
 * @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 data binary encoded construction parameters
     * @return address of newly created module
     */
    function createModule(bytes calldata data) external returns (address);
}

File 9 of 12 : IRewardModule.sol
/*
IRewardModule

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

SPDX-License-Identifier: MIT
*/

pragma solidity 0.8.4;

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

import "./IEvents.sol";

import "../OwnerController.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.
 */
abstract contract IRewardModule is OwnerController, IEvents {
    // constants
    uint256 public constant DECIMALS = 18;

    /**
     * @return array of reward tokens
     */
    function tokens() external view virtual returns (address[] memory);

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

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

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

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

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

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

    /**
     * @notice method called by anyone to update accounting
     * @param user address of user for update
     * @dev will only be called ad hoc and should not contain essential logic
     */
    function update(address user) external virtual;

    /**
     * @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
     */
    function clean() external virtual;
}

File 10 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @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);
}

File 11 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.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'
        // solhint-disable-next-line max-line-length
        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));
        }
    }

    /**
     * @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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 12 of 12 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

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":"bytes","name":"data","type":"bytes"}],"name":"createModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50612f2a806100206000396000f3fe608060405234801561001057600080fd5b506004361061002a5760003560e01c8062ee8fe51461002f575b600080fd5b61004261003d366004610240565b61006b565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000608082146100db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f63726d6631000000000000000000000000000000000000000000000000000000604482015260640160405180910390fd5b60405160443590606435906084359060a435906000908590859085908590309061010490610233565b73ffffffffffffffffffffffffffffffffffffffff9586168152602081019490945260408401929092526060830152909116608082015260a001604051809103906000f08015801561015a573d6000803e3d6000fd5b506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063f2fde38b90602401600060405180830381600087803b1580156101c557600080fd5b505af11580156101d9573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff841681523392507ff708942ec477396a151a5285651961dcab8e8a82ea4f5b31a5236f92f6c92710915060200160405180910390a2979650505050505050565b612c47806102ae83390190565b60008060208385031215610252578182fd5b823567ffffffffffffffff80821115610269578384fd5b818501915085601f83011261027c578384fd5b81358181111561028a578485fd5b86602082850101111561029b578485fd5b6020929092019691955090935050505056fe6101206040523480156200001257600080fd5b5060405162002c4738038062002c4783398101604081905262000035916200014d565b60008054336001600160a01b0319918216811783556001805490921681179091556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600080546040516001600160a01b0390911691907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a382841115620000fe5760405162461bcd60e51b8152600401620000f59060208082526004908201526363726d3160e01b604082015260600190565b60405180910390fd5b6001600160601b0319606095861b811660e052941b9093166101005260809190915260a05260c05242600855620001a1565b80516001600160a01b03811681146200014857600080fd5b919050565b600080600080600060a0868803121562000165578081fd5b620001708662000130565b9450602086015193506040860151925060608601519150620001956080870162000130565b90509295509295909350565b60805160a05160c05160e05160601c6101005160601c6129cf6200027860003960006104bb015260008181610567015281816107050152818161074801528181610781015281816107de01528181610a9601528181610c3201528181610c5f01528181610cc501528181610d2401528181610fa701528181610fd2015281816115d401528181611618015261168501526000818161032701528181610afd0152610b5d0152600081816103d501528181610b240152610ba301526000818161028101528181610b820152610be101526129cf6000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c80637bb98a681161012a578063c148cf85116100bd578063dc16ceb91161008c578063f2fde38b11610071578063f2fde38b1461052e578063f77c479114610541578063fc4333cd1461055257600080fd5b8063dc16ceb9146104fb578063e336ac441461050557600080fd5b8063c148cf85146104a6578063c45a0155146104b9578063c7537f36146104df578063d0b06f5d146104f257600080fd5b8063a5be655c116100f9578063a5be655c14610459578063a65e2cfd14610462578063a779d08014610475578063bf6b874e1461047d57600080fd5b80637bb98a68146103f75780638da5cb5b1461040c5780639d63848a146104315780639e57e4911461044657600080fd5b80634af4a127116101bd5780635f5319931161018c5780636d811e71116101715780636d811e71146103bf57806370c6a17e146103c75780637aba86d2146103d057600080fd5b80635f5319931461036c5780636d16fa41146103ac57600080fd5b80634af4a127146103225780634b8456b8146103495780635689141214610351578063584b62a11461035957600080fd5b80632e0f2625116101f95780632e0f2625146102b657806333060d90146102be5780633f265ddb146102e75780634854b143146102fa57600080fd5b806304003d5b1461022b578063111d7d50146102675780631b87d58a1461027c5780631c1b8772146102a3575b600080fd5b61025461023936600461257c565b6001600160a01b031660009081526002602052604090205490565b6040519081526020015b60405180910390f35b61027a6102753660046126c6565b61055a565b005b6102547f000000000000000000000000000000000000000000000000000000000000000081565b61027a6102b136600461257c565b610593565b610254601281565b6102546102cc36600461257c565b6001600160a01b031660009081526005602052604090205490565b6102546102f536600461262c565b6105a6565b61030d610308366004612596565b610676565b6040805192835260208301919091520161025e565b6102547f000000000000000000000000000000000000000000000000000000000000000081565b610254601081565b6102546106fb565b61030d61036736600461262c565b610879565b61037f61037a36600461262c565b6108b5565b604080519687526020870195909552938501929092526060840152608083015260a082015260c00161025e565b61027a6103ba36600461257c565b610946565b600954610254565b61025460065481565b6102547f000000000000000000000000000000000000000000000000000000000000000081565b6103ff610a18565b60405161025e919061275a565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161025e565b610439610a72565b60405161025e919061270d565b610254610454366004612675565b610af9565b61025460075481565b61027a6104703660046126a5565b610c25565b610254610c5d565b61025461048b36600461257c565b6001600160a01b031660009081526003602052604090205490565b61030d6104b4366004612596565b610dc0565b7f0000000000000000000000000000000000000000000000000000000000000000610419565b61030d6104ed366004612596565b610e40565b61025460085481565b610254620f424081565b61025461051336600461257c565b6001600160a01b031660009081526004602052604090205490565b61027a61053c36600461257c565b610ec1565b6001546001600160a01b0316610419565b61027a610f92565b610562610fcd565b61058e7f000000000000000000000000000000000000000000000000000000000000000084848461102d565b505050565b61059b61144f565b6105a3610fcd565b50565b6001600160a01b03821660009081526002602052604081208054829190849081106105e157634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020190508060040154421015610607576000915050610670565b600281015461061a576000915050610670565b8060050154816004015461062e91906127e3565b421061063f57600201549050610670565b6005810154600182015460038301546106589042612925565b6106629190612906565b61066c91906127fb565b9150505b92915050565b6000805481906001600160a01b031633146106d85760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6106e0610fcd565b6106ea87866114a9565b5060009050805b9550959350505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660009081526004602052604081205461073e5750600090565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600360205260409020546001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600460205260409020546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561082857600080fd5b505afa15801561083c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610860919061268d565b61086a9190612906565b61087491906127fb565b905090565b6005602052816000526040600020818154811061089557600080fd5b600091825260209091206002909102018054600190910154909250905082565b6000806000806000806000600260008a6001600160a01b03166001600160a01b03168152602001908152602001600020888154811061090457634e487b7160e01b600052603260045260246000fd5b6000918252602090912060069091020180546001820154600283015460038401546004850154600590950154939e929d50909b50995091975095509350505050565b61094e61144f565b6001600160a01b0381166109a45760405162461bcd60e51b815260206004820152600360248201527f6f6334000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6001546040516001600160a01b038084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a3600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b60408051600180825281830190925260609160208083019080368337019050509050610a426106fb565b81600081518110610a6357634e487b7160e01b600052603260045260246000fd5b60200260200101818152505090565b604080516001808252818301909252606091602080830190803683370190505090507f000000000000000000000000000000000000000000000000000000000000000081600081518110610ad657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505090565b60007f00000000000000000000000000000000000000000000000000000000000000008210610b59577f0000000000000000000000000000000000000000000000000000000000000000610b4f6012600a61285e565b61067091906127e3565b60007f000000000000000000000000000000000000000000000000000000000000000083610bc77f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000612925565b610bd19190612906565b610bdb91906127fb565b610c05907f00000000000000000000000000000000000000000000000000000000000000006127e3565b905080610c146012600a61285e565b610c1e91906127e3565b9392505050565b610c2d610fcd565b610c597f000000000000000000000000000000000000000000000000000000000000000083834261102d565b5050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031660009081526004602090815260408083205460039092528220548291610cac91612925565b905080610cbb57600091505090565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600360205260409020546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015610d6e57600080fd5b505afa158015610d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da6919061268d565b610db09190612906565b610dba91906127fb565b91505090565b6000805481906001600160a01b03163314610e1d5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b610e25610fcd565b610e328787878787611512565b915091509550959350505050565b6000805481906001600160a01b03163314610e9d5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b610ea5610fcd565b610eb28787878787611512565b90925090506106f187866114a9565b610ec961144f565b6001600160a01b038116610f1f5760405162461bcd60e51b815260206004820152600360248201527f6f6333000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610f9a61144f565b610fa2610fcd565b610fcb7f0000000000000000000000000000000000000000000000000000000000000000611818565b565b610ff67f0000000000000000000000000000000000000000000000000000000000000000611a92565b506006546008546110079042612925565b6110119190612906565b6007600082825461102291906127e3565b909155505042600855565b611035611bd1565b600083116110855760405162461bcd60e51b815260206004820152600360248201527f726d31000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b428110156110d55760405162461bcd60e51b815260206004820152600360248201527f726d32000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6001600160a01b03841660009081526002602052604090205460101161113d5760405162461bcd60e51b815260206004820152600360248201527f726d33000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015284906000906001600160a01b038316906370a082319060240160206040518083038186803b15801561119a57600080fd5b505afa1580156111ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d2919061268d565b90506111e96001600160a01b038316333088611c2b565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b15801561124657600080fd5b505afa15801561125a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127e919061268d565b6112889190612925565b905060008083116112a5576112a0620f424083612906565b6112d5565b6001600160a01b03881660009081526003602052604090205483906112cb908490612906565b6112d591906127fb565b6001600160a01b0389166000908152600460205260408120805492935083929091906113029084906127e3565b90915550506001600160a01b0388166000908152600360205260408120805483929061132f9084906127e3565b9250508190555060026000896001600160a01b03166001600160a01b031681526020019081526020016000206040518060c00160405280898152602001838152602001838152602001878152602001878152602001888152509080600181540180825580915050600190039060005260206000209060060201600090919091909150600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a082015181600501555050876001600160a01b03167f0d2eac201c6bd25b979f0d9ebcf8ff27a476edde7006f42e843dc70727dbf90b88838860405161143d939291909283526020830191909152604082015260600190565b60405180910390a25050505050505050565b6000546001600160a01b03163314610fcb5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6001600160a01b0382166000908152600560209081526040808320815180830190925284825242828401908152815460018181018455928652938520925160029094029092019283559051910155600680548392906115099084906127e3565b90915550505050565b6000808215806115225750602083145b6115705760405162461bcd60e51b81526004016106cf9060208082526004908201527f63726d3200000000000000000000000000000000000000000000000000000000604082015260600190565b602083141561157f5760a43591505b6006546009546000916115959185918991611cfa565b90506000806115a48a89611e3c565b909250905060006115b76012600a61285e565b6115c18386612906565b6115cb91906127fb565b9050600061160e7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031660009081526004602052604090205490565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600360205260409020546116519190612925565b905060008260075461166391906127e3565b61166d8484612906565b61167791906127fb565b90508015611808576116aa8c7f00000000000000000000000000000000000000000000000000000000000000008361201f565b5060008815611776578897508c6001600160a01b03167fc16aaa1ae5a136c89a5275f4f29944ca4f17d3815f9122eae9455ae495b4c76f8a6040516116f191815260200190565b60405180910390a28c6001600160a01b03167f18fe0f7ac77be33dd859236b08864eee2e81199a12f1ac17e688517ddc47ea808960405161173491815260200190565b60405180910390a2866117496012600a61285e565b6117556012600a61285e565b61175f908a612925565b6117699190612906565b61177391906127fb565b90505b60008660075461178691906127e3565b6117926012600a61285e565b61179c9089612906565b6117a691906127fb565b90506117b46012600a61285e565b6117be8383612906565b6117c891906127fb565b6117d46012600a61285e565b6009546117e19084612906565b6117eb91906127fb565b6009546117f89190612925565b61180291906127e3565b60095550505b5050505050509550959350505050565b6001600160a01b038116600090815260026020526040812054815b81811015611a8c576001600160a01b038416600090815260026020526040812061185d8584612925565b8154811061187b57634e487b7160e01b600052603260045260246000fd5b60009182526020822060069091020191506118968584612925565b90506118a286826105a6565b1580156118c25750816005015482600401546118be91906127e3565b4210155b15611a7757815460018301546004840154604080519384526020840192909252908201526001600160a01b038716907fda2a262bf91f4f5d64d1083fcf0438477235659afee73ec3ead834792dd2fc3e9060600160405180910390a26001600160a01b0386166000908152600260205260409020805461194490600190612925565b8154811061196257634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020160026000886001600160a01b03166001600160a01b0316815260200190815260200160002082815481106119b457634e487b7160e01b600052603260045260246000fd5b6000918252602080832084546006909302019182556001808501549083015560028085015481840155600380860154908401556004808601549084015560059485015494909201939093556001600160a01b038916825290915260409020805480611a2f57634e487b7160e01b600052603160045260246000fd5b6000828152602081206006600019909301928302018181556001810182905560028101829055600381018290556004810182905560050155905584611a7381612968565b9550505b50508080611a8490612968565b915050611833565b50505050565b6000805b6001600160a01b038316600090815260026020526040902054811015611b59576000611ac284836105a6565b6001600160a01b03851660009081526002602052604081208054929350909184908110611aff57634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020190506000821115611b445781816002016000828254611b2c9190612925565b9091555050426003820155611b4182856127e3565b93505b50508080611b5190612968565b915050611a96565b508015611bcc576001600160a01b03821660009081526004602052604081208054839290611b88908490612925565b90915550506040518181526001600160a01b038316907ff544cfde8481f9e7bc714e7e32a2b1a6b73688d87f1b32827ce45051e8e3b8e69060200160405180910390a25b919050565b6001546001600160a01b03163314610fcb5760405162461bcd60e51b815260206004820152600360248201527f6f6332000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6040516001600160a01b0380851660248301528316604482015260648101829052611a8c9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261217d565b600083611d0957506000611e34565b82611d1657506000611e34565b84611d2e57611d276012600a61285e565b9050611e34565b6000611d3c6012600a61285e565b84611d4960026012612925565b611d5490600a61285e565b611d5e9190612906565b611d6891906127fb565b905080851115611d8a5784611d7d8288612906565b611d8791906127fb565b95505b600083611d9960026012612925565b611da490600a61285e565b611dae91906127e3565b611dc18868010000000000000000612906565b611dcb91906127fb565b611dde90680100000000000000006127e3565b905068010000000000000000611df66012600a61285e565b611e0283600f0b612262565b600f0b611e0f9190612906565b611e1991906127fb565b611e256012600a61285e565b611e2f91906127e3565b925050505b949350505050565b6001600160a01b0382166000908152600560205260408120819083905b8115611fe45780546000908290611e7290600190612925565b81548110611e9057634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020190506000816001015442611eb29190612925565b90506000611ebf82610af9565b905084836000015411611f7157611ed86012600a61285e565b83548290611ee7908590612906565b611ef19190612906565b611efb91906127fb565b611f0590876127e3565b8354909650611f15908390612906565b611f1f90886127e3565b8354909750611f2e9086612925565b945083805480611f4e57634e487b7160e01b600052603160045260246000fd5b600082815260208120600260001990930192830201818155600101559055611fdc565b611f7d6012600a61285e565b81611f888488612906565b611f929190612906565b611f9c91906127fb565b611fa690876127e3565b9550611fb28286612906565b611fbc90886127e3565b965084836000016000828254611fd29190612925565b9091555060009550505b505050611e59565b8360076000828254611ff69190612925565b92505081905550846006600082825461200f9190612925565b9250508190555050509250929050565b6001600160a01b0382166000818152600360205260408082205490517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152919285928591906370a082319060240160206040518083038186803b15801561208c57600080fd5b505afa1580156120a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c4919061268d565b6120ce9190612906565b6120d891906127fb565b6001600160a01b038516600090815260036020526040812080549294508592909190612105908490612925565b9091555061211f90506001600160a01b03821686846122a3565b836001600160a01b0316856001600160a01b03167f1a4dfb075362880d700ede1cc31d284b1c3b2811e9f0b2ddde7bdb270042c13f848660405161216d929190918252602082015260400190565b60405180910390a3509392505050565b60006121d2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122ec9092919063ffffffff16565b80519091501561058e57808060200190518101906121f09190612655565b61058e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016106cf565b60008082600f0b1361227357600080fd5b608061227e836122fb565b61229b90600f0b6f4d104d427de7fce20a6e420e02236748612906565b901c92915050565b6040516001600160a01b03831660248201526044810182905261058e9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611c78565b6060611e3484846000856123fd565b60008082600f0b1361230c57600080fd5b6000600f83900b68010000000000000000811261232b576040918201911d5b640100000000811261233f576020918201911d5b620100008112612351576010918201911d5b6101008112612362576008918201911d5b60108112612372576004918201911d5b60048112612382576002918201911d5b60028112612391576001820191505b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0820160401b600f85900b607f8490031b6780000000000000005b60008113156123f25790800260ff81901c8281029390930192607f011c9060011d6123cc565b509095945050505050565b6060824710156124755760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016106cf565b843b6124c35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106cf565b600080866001600160a01b031685876040516124df91906126f1565b60006040518083038185875af1925050503d806000811461251c576040519150601f19603f3d011682016040523d82523d6000602084013e612521565b606091505b5091509150611e2f8282866060831561253b575081610c1e565b82511561254b5782518084602001fd5b8160405162461bcd60e51b81526004016106cf9190612792565b80356001600160a01b0381168114611bcc57600080fd5b60006020828403121561258d578081fd5b610c1e82612565565b6000806000806000608086880312156125ad578081fd5b6125b686612565565b94506125c460208701612565565b935060408601359250606086013567ffffffffffffffff808211156125e7578283fd5b818801915088601f8301126125fa578283fd5b813581811115612608578384fd5b896020828501011115612619578384fd5b9699959850939650602001949392505050565b6000806040838503121561263e578182fd5b61264783612565565b946020939093013593505050565b600060208284031215612666578081fd5b81518015158114610c1e578182fd5b600060208284031215612686578081fd5b5035919050565b60006020828403121561269e578081fd5b5051919050565b600080604083850312156126b7578182fd5b50508035926020909101359150565b6000806000606084860312156126da578283fd5b505081359360208301359350604090920135919050565b6000825161270381846020870161293c565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b8181101561274e5783516001600160a01b031683529284019291840191600101612729565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561274e57835183529284019291840191600101612776565b60208152600082518060208401526127b181604085016020870161293c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600082198211156127f6576127f6612983565b500190565b60008261281657634e487b7160e01b81526012600452602481fd5b500490565b600181815b8085111561285657816000190482111561283c5761283c612983565b8085161561284957918102915b93841c9390800290612820565b509250929050565b6000610c1e838360008261287457506001610670565b8161288157506000610670565b816001811461289757600281146128a1576128bd565b6001915050610670565b60ff8411156128b2576128b2612983565b50506001821b610670565b5060208310610133831016604e8410600b84101617156128e0575081810a610670565b6128ea838361281b565b80600019048211156128fe576128fe612983565b029392505050565b600081600019048311821515161561292057612920612983565b500290565b60008282101561293757612937612983565b500390565b60005b8381101561295757818101518382015260200161293f565b83811115611a8c5750506000910152565b600060001982141561297c5761297c612983565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220a0f2e16ef4b1e5c012ed2b60b6821d1bbeac72190d4efe0aead94b3537201c8e64736f6c63430008040033a26469706673582212202c5222ae7133dd671c8f0f9fadf7fa7440e141e5a94874199854d64d367c702964736f6c63430008040033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061002a5760003560e01c8062ee8fe51461002f575b600080fd5b61004261003d366004610240565b61006b565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000608082146100db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f63726d6631000000000000000000000000000000000000000000000000000000604482015260640160405180910390fd5b60405160443590606435906084359060a435906000908590859085908590309061010490610233565b73ffffffffffffffffffffffffffffffffffffffff9586168152602081019490945260408401929092526060830152909116608082015260a001604051809103906000f08015801561015a573d6000803e3d6000fd5b506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063f2fde38b90602401600060405180830381600087803b1580156101c557600080fd5b505af11580156101d9573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff841681523392507ff708942ec477396a151a5285651961dcab8e8a82ea4f5b31a5236f92f6c92710915060200160405180910390a2979650505050505050565b612c47806102ae83390190565b60008060208385031215610252578182fd5b823567ffffffffffffffff80821115610269578384fd5b818501915085601f83011261027c578384fd5b81358181111561028a578485fd5b86602082850101111561029b578485fd5b6020929092019691955090935050505056fe6101206040523480156200001257600080fd5b5060405162002c4738038062002c4783398101604081905262000035916200014d565b60008054336001600160a01b0319918216811783556001805490921681179091556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600080546040516001600160a01b0390911691907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a382841115620000fe5760405162461bcd60e51b8152600401620000f59060208082526004908201526363726d3160e01b604082015260600190565b60405180910390fd5b6001600160601b0319606095861b811660e052941b9093166101005260809190915260a05260c05242600855620001a1565b80516001600160a01b03811681146200014857600080fd5b919050565b600080600080600060a0868803121562000165578081fd5b620001708662000130565b9450602086015193506040860151925060608601519150620001956080870162000130565b90509295509295909350565b60805160a05160c05160e05160601c6101005160601c6129cf6200027860003960006104bb015260008181610567015281816107050152818161074801528181610781015281816107de01528181610a9601528181610c3201528181610c5f01528181610cc501528181610d2401528181610fa701528181610fd2015281816115d401528181611618015261168501526000818161032701528181610afd0152610b5d0152600081816103d501528181610b240152610ba301526000818161028101528181610b820152610be101526129cf6000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c80637bb98a681161012a578063c148cf85116100bd578063dc16ceb91161008c578063f2fde38b11610071578063f2fde38b1461052e578063f77c479114610541578063fc4333cd1461055257600080fd5b8063dc16ceb9146104fb578063e336ac441461050557600080fd5b8063c148cf85146104a6578063c45a0155146104b9578063c7537f36146104df578063d0b06f5d146104f257600080fd5b8063a5be655c116100f9578063a5be655c14610459578063a65e2cfd14610462578063a779d08014610475578063bf6b874e1461047d57600080fd5b80637bb98a68146103f75780638da5cb5b1461040c5780639d63848a146104315780639e57e4911461044657600080fd5b80634af4a127116101bd5780635f5319931161018c5780636d811e71116101715780636d811e71146103bf57806370c6a17e146103c75780637aba86d2146103d057600080fd5b80635f5319931461036c5780636d16fa41146103ac57600080fd5b80634af4a127146103225780634b8456b8146103495780635689141214610351578063584b62a11461035957600080fd5b80632e0f2625116101f95780632e0f2625146102b657806333060d90146102be5780633f265ddb146102e75780634854b143146102fa57600080fd5b806304003d5b1461022b578063111d7d50146102675780631b87d58a1461027c5780631c1b8772146102a3575b600080fd5b61025461023936600461257c565b6001600160a01b031660009081526002602052604090205490565b6040519081526020015b60405180910390f35b61027a6102753660046126c6565b61055a565b005b6102547f000000000000000000000000000000000000000000000000000000000000000081565b61027a6102b136600461257c565b610593565b610254601281565b6102546102cc36600461257c565b6001600160a01b031660009081526005602052604090205490565b6102546102f536600461262c565b6105a6565b61030d610308366004612596565b610676565b6040805192835260208301919091520161025e565b6102547f000000000000000000000000000000000000000000000000000000000000000081565b610254601081565b6102546106fb565b61030d61036736600461262c565b610879565b61037f61037a36600461262c565b6108b5565b604080519687526020870195909552938501929092526060840152608083015260a082015260c00161025e565b61027a6103ba36600461257c565b610946565b600954610254565b61025460065481565b6102547f000000000000000000000000000000000000000000000000000000000000000081565b6103ff610a18565b60405161025e919061275a565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161025e565b610439610a72565b60405161025e919061270d565b610254610454366004612675565b610af9565b61025460075481565b61027a6104703660046126a5565b610c25565b610254610c5d565b61025461048b36600461257c565b6001600160a01b031660009081526003602052604090205490565b61030d6104b4366004612596565b610dc0565b7f0000000000000000000000000000000000000000000000000000000000000000610419565b61030d6104ed366004612596565b610e40565b61025460085481565b610254620f424081565b61025461051336600461257c565b6001600160a01b031660009081526004602052604090205490565b61027a61053c36600461257c565b610ec1565b6001546001600160a01b0316610419565b61027a610f92565b610562610fcd565b61058e7f000000000000000000000000000000000000000000000000000000000000000084848461102d565b505050565b61059b61144f565b6105a3610fcd565b50565b6001600160a01b03821660009081526002602052604081208054829190849081106105e157634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020190508060040154421015610607576000915050610670565b600281015461061a576000915050610670565b8060050154816004015461062e91906127e3565b421061063f57600201549050610670565b6005810154600182015460038301546106589042612925565b6106629190612906565b61066c91906127fb565b9150505b92915050565b6000805481906001600160a01b031633146106d85760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6106e0610fcd565b6106ea87866114a9565b5060009050805b9550959350505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660009081526004602052604081205461073e5750600090565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600360205260409020546001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600460205260409020546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561082857600080fd5b505afa15801561083c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610860919061268d565b61086a9190612906565b61087491906127fb565b905090565b6005602052816000526040600020818154811061089557600080fd5b600091825260209091206002909102018054600190910154909250905082565b6000806000806000806000600260008a6001600160a01b03166001600160a01b03168152602001908152602001600020888154811061090457634e487b7160e01b600052603260045260246000fd5b6000918252602090912060069091020180546001820154600283015460038401546004850154600590950154939e929d50909b50995091975095509350505050565b61094e61144f565b6001600160a01b0381166109a45760405162461bcd60e51b815260206004820152600360248201527f6f6334000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6001546040516001600160a01b038084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a3600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b60408051600180825281830190925260609160208083019080368337019050509050610a426106fb565b81600081518110610a6357634e487b7160e01b600052603260045260246000fd5b60200260200101818152505090565b604080516001808252818301909252606091602080830190803683370190505090507f000000000000000000000000000000000000000000000000000000000000000081600081518110610ad657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505090565b60007f00000000000000000000000000000000000000000000000000000000000000008210610b59577f0000000000000000000000000000000000000000000000000000000000000000610b4f6012600a61285e565b61067091906127e3565b60007f000000000000000000000000000000000000000000000000000000000000000083610bc77f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000612925565b610bd19190612906565b610bdb91906127fb565b610c05907f00000000000000000000000000000000000000000000000000000000000000006127e3565b905080610c146012600a61285e565b610c1e91906127e3565b9392505050565b610c2d610fcd565b610c597f000000000000000000000000000000000000000000000000000000000000000083834261102d565b5050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031660009081526004602090815260408083205460039092528220548291610cac91612925565b905080610cbb57600091505090565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600360205260409020546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015610d6e57600080fd5b505afa158015610d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da6919061268d565b610db09190612906565b610dba91906127fb565b91505090565b6000805481906001600160a01b03163314610e1d5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b610e25610fcd565b610e328787878787611512565b915091509550959350505050565b6000805481906001600160a01b03163314610e9d5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b610ea5610fcd565b610eb28787878787611512565b90925090506106f187866114a9565b610ec961144f565b6001600160a01b038116610f1f5760405162461bcd60e51b815260206004820152600360248201527f6f6333000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610f9a61144f565b610fa2610fcd565b610fcb7f0000000000000000000000000000000000000000000000000000000000000000611818565b565b610ff67f0000000000000000000000000000000000000000000000000000000000000000611a92565b506006546008546110079042612925565b6110119190612906565b6007600082825461102291906127e3565b909155505042600855565b611035611bd1565b600083116110855760405162461bcd60e51b815260206004820152600360248201527f726d31000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b428110156110d55760405162461bcd60e51b815260206004820152600360248201527f726d32000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6001600160a01b03841660009081526002602052604090205460101161113d5760405162461bcd60e51b815260206004820152600360248201527f726d33000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015284906000906001600160a01b038316906370a082319060240160206040518083038186803b15801561119a57600080fd5b505afa1580156111ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d2919061268d565b90506111e96001600160a01b038316333088611c2b565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b15801561124657600080fd5b505afa15801561125a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127e919061268d565b6112889190612925565b905060008083116112a5576112a0620f424083612906565b6112d5565b6001600160a01b03881660009081526003602052604090205483906112cb908490612906565b6112d591906127fb565b6001600160a01b0389166000908152600460205260408120805492935083929091906113029084906127e3565b90915550506001600160a01b0388166000908152600360205260408120805483929061132f9084906127e3565b9250508190555060026000896001600160a01b03166001600160a01b031681526020019081526020016000206040518060c00160405280898152602001838152602001838152602001878152602001878152602001888152509080600181540180825580915050600190039060005260206000209060060201600090919091909150600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a082015181600501555050876001600160a01b03167f0d2eac201c6bd25b979f0d9ebcf8ff27a476edde7006f42e843dc70727dbf90b88838860405161143d939291909283526020830191909152604082015260600190565b60405180910390a25050505050505050565b6000546001600160a01b03163314610fcb5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6001600160a01b0382166000908152600560209081526040808320815180830190925284825242828401908152815460018181018455928652938520925160029094029092019283559051910155600680548392906115099084906127e3565b90915550505050565b6000808215806115225750602083145b6115705760405162461bcd60e51b81526004016106cf9060208082526004908201527f63726d3200000000000000000000000000000000000000000000000000000000604082015260600190565b602083141561157f5760a43591505b6006546009546000916115959185918991611cfa565b90506000806115a48a89611e3c565b909250905060006115b76012600a61285e565b6115c18386612906565b6115cb91906127fb565b9050600061160e7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031660009081526004602052604090205490565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600360205260409020546116519190612925565b905060008260075461166391906127e3565b61166d8484612906565b61167791906127fb565b90508015611808576116aa8c7f00000000000000000000000000000000000000000000000000000000000000008361201f565b5060008815611776578897508c6001600160a01b03167fc16aaa1ae5a136c89a5275f4f29944ca4f17d3815f9122eae9455ae495b4c76f8a6040516116f191815260200190565b60405180910390a28c6001600160a01b03167f18fe0f7ac77be33dd859236b08864eee2e81199a12f1ac17e688517ddc47ea808960405161173491815260200190565b60405180910390a2866117496012600a61285e565b6117556012600a61285e565b61175f908a612925565b6117699190612906565b61177391906127fb565b90505b60008660075461178691906127e3565b6117926012600a61285e565b61179c9089612906565b6117a691906127fb565b90506117b46012600a61285e565b6117be8383612906565b6117c891906127fb565b6117d46012600a61285e565b6009546117e19084612906565b6117eb91906127fb565b6009546117f89190612925565b61180291906127e3565b60095550505b5050505050509550959350505050565b6001600160a01b038116600090815260026020526040812054815b81811015611a8c576001600160a01b038416600090815260026020526040812061185d8584612925565b8154811061187b57634e487b7160e01b600052603260045260246000fd5b60009182526020822060069091020191506118968584612925565b90506118a286826105a6565b1580156118c25750816005015482600401546118be91906127e3565b4210155b15611a7757815460018301546004840154604080519384526020840192909252908201526001600160a01b038716907fda2a262bf91f4f5d64d1083fcf0438477235659afee73ec3ead834792dd2fc3e9060600160405180910390a26001600160a01b0386166000908152600260205260409020805461194490600190612925565b8154811061196257634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020160026000886001600160a01b03166001600160a01b0316815260200190815260200160002082815481106119b457634e487b7160e01b600052603260045260246000fd5b6000918252602080832084546006909302019182556001808501549083015560028085015481840155600380860154908401556004808601549084015560059485015494909201939093556001600160a01b038916825290915260409020805480611a2f57634e487b7160e01b600052603160045260246000fd5b6000828152602081206006600019909301928302018181556001810182905560028101829055600381018290556004810182905560050155905584611a7381612968565b9550505b50508080611a8490612968565b915050611833565b50505050565b6000805b6001600160a01b038316600090815260026020526040902054811015611b59576000611ac284836105a6565b6001600160a01b03851660009081526002602052604081208054929350909184908110611aff57634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020190506000821115611b445781816002016000828254611b2c9190612925565b9091555050426003820155611b4182856127e3565b93505b50508080611b5190612968565b915050611a96565b508015611bcc576001600160a01b03821660009081526004602052604081208054839290611b88908490612925565b90915550506040518181526001600160a01b038316907ff544cfde8481f9e7bc714e7e32a2b1a6b73688d87f1b32827ce45051e8e3b8e69060200160405180910390a25b919050565b6001546001600160a01b03163314610fcb5760405162461bcd60e51b815260206004820152600360248201527f6f6332000000000000000000000000000000000000000000000000000000000060448201526064016106cf565b6040516001600160a01b0380851660248301528316604482015260648101829052611a8c9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261217d565b600083611d0957506000611e34565b82611d1657506000611e34565b84611d2e57611d276012600a61285e565b9050611e34565b6000611d3c6012600a61285e565b84611d4960026012612925565b611d5490600a61285e565b611d5e9190612906565b611d6891906127fb565b905080851115611d8a5784611d7d8288612906565b611d8791906127fb565b95505b600083611d9960026012612925565b611da490600a61285e565b611dae91906127e3565b611dc18868010000000000000000612906565b611dcb91906127fb565b611dde90680100000000000000006127e3565b905068010000000000000000611df66012600a61285e565b611e0283600f0b612262565b600f0b611e0f9190612906565b611e1991906127fb565b611e256012600a61285e565b611e2f91906127e3565b925050505b949350505050565b6001600160a01b0382166000908152600560205260408120819083905b8115611fe45780546000908290611e7290600190612925565b81548110611e9057634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020190506000816001015442611eb29190612925565b90506000611ebf82610af9565b905084836000015411611f7157611ed86012600a61285e565b83548290611ee7908590612906565b611ef19190612906565b611efb91906127fb565b611f0590876127e3565b8354909650611f15908390612906565b611f1f90886127e3565b8354909750611f2e9086612925565b945083805480611f4e57634e487b7160e01b600052603160045260246000fd5b600082815260208120600260001990930192830201818155600101559055611fdc565b611f7d6012600a61285e565b81611f888488612906565b611f929190612906565b611f9c91906127fb565b611fa690876127e3565b9550611fb28286612906565b611fbc90886127e3565b965084836000016000828254611fd29190612925565b9091555060009550505b505050611e59565b8360076000828254611ff69190612925565b92505081905550846006600082825461200f9190612925565b9250508190555050509250929050565b6001600160a01b0382166000818152600360205260408082205490517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152919285928591906370a082319060240160206040518083038186803b15801561208c57600080fd5b505afa1580156120a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c4919061268d565b6120ce9190612906565b6120d891906127fb565b6001600160a01b038516600090815260036020526040812080549294508592909190612105908490612925565b9091555061211f90506001600160a01b03821686846122a3565b836001600160a01b0316856001600160a01b03167f1a4dfb075362880d700ede1cc31d284b1c3b2811e9f0b2ddde7bdb270042c13f848660405161216d929190918252602082015260400190565b60405180910390a3509392505050565b60006121d2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122ec9092919063ffffffff16565b80519091501561058e57808060200190518101906121f09190612655565b61058e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016106cf565b60008082600f0b1361227357600080fd5b608061227e836122fb565b61229b90600f0b6f4d104d427de7fce20a6e420e02236748612906565b901c92915050565b6040516001600160a01b03831660248201526044810182905261058e9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611c78565b6060611e3484846000856123fd565b60008082600f0b1361230c57600080fd5b6000600f83900b68010000000000000000811261232b576040918201911d5b640100000000811261233f576020918201911d5b620100008112612351576010918201911d5b6101008112612362576008918201911d5b60108112612372576004918201911d5b60048112612382576002918201911d5b60028112612391576001820191505b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0820160401b600f85900b607f8490031b6780000000000000005b60008113156123f25790800260ff81901c8281029390930192607f011c9060011d6123cc565b509095945050505050565b6060824710156124755760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016106cf565b843b6124c35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106cf565b600080866001600160a01b031685876040516124df91906126f1565b60006040518083038185875af1925050503d806000811461251c576040519150601f19603f3d011682016040523d82523d6000602084013e612521565b606091505b5091509150611e2f8282866060831561253b575081610c1e565b82511561254b5782518084602001fd5b8160405162461bcd60e51b81526004016106cf9190612792565b80356001600160a01b0381168114611bcc57600080fd5b60006020828403121561258d578081fd5b610c1e82612565565b6000806000806000608086880312156125ad578081fd5b6125b686612565565b94506125c460208701612565565b935060408601359250606086013567ffffffffffffffff808211156125e7578283fd5b818801915088601f8301126125fa578283fd5b813581811115612608578384fd5b896020828501011115612619578384fd5b9699959850939650602001949392505050565b6000806040838503121561263e578182fd5b61264783612565565b946020939093013593505050565b600060208284031215612666578081fd5b81518015158114610c1e578182fd5b600060208284031215612686578081fd5b5035919050565b60006020828403121561269e578081fd5b5051919050565b600080604083850312156126b7578182fd5b50508035926020909101359150565b6000806000606084860312156126da578283fd5b505081359360208301359350604090920135919050565b6000825161270381846020870161293c565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b8181101561274e5783516001600160a01b031683529284019291840191600101612729565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561274e57835183529284019291840191600101612776565b60208152600082518060208401526127b181604085016020870161293c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600082198211156127f6576127f6612983565b500190565b60008261281657634e487b7160e01b81526012600452602481fd5b500490565b600181815b8085111561285657816000190482111561283c5761283c612983565b8085161561284957918102915b93841c9390800290612820565b509250929050565b6000610c1e838360008261287457506001610670565b8161288157506000610670565b816001811461289757600281146128a1576128bd565b6001915050610670565b60ff8411156128b2576128b2612983565b50506001821b610670565b5060208310610133831016604e8410600b84101617156128e0575081810a610670565b6128ea838361281b565b80600019048211156128fe576128fe612983565b029392505050565b600081600019048311821515161561292057612920612983565b500290565b60008282101561293757612937612983565b500390565b60005b8381101561295757818101518382015260200161293f565b83811115611a8c5750506000910152565b600060001982141561297c5761297c612983565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220a0f2e16ef4b1e5c012ed2b60b6821d1bbeac72190d4efe0aead94b3537201c8e64736f6c63430008040033a26469706673582212202c5222ae7133dd671c8f0f9fadf7fa7440e141e5a94874199854d64d367c702964736f6c63430008040033

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
[ 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.