ETH Price: $3,163.73 (-7.63%)

Contract

0xAF5C23A6462B68573e0600aa3f7d64A7D0FB10c6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040115441082020-12-28 18:43:141415 days ago1609180994IN
 Create: Staking
0 ETH0.3434376150

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Staking

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 0 runs

Other Settings:
default evmVersion
File 1 of 14 : Staking.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.4.25 <0.7.0;

/** OpenZeppelin Dependencies */
// import "@openzeppelin/contracts-upgradeable/contracts/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
/** Local Interfaces */
import "./interfaces/IToken.sol";
import "./interfaces/IAuction.sol";
import "./interfaces/IStaking.sol";
import "./interfaces/ISubBalances.sol";
import "./interfaces/IStakingV1.sol";


contract Staking is IStaking, Initializable, AccessControlUpgradeable {
    using SafeMathUpgradeable for uint256;

    /** Events */
    event Stake(
        address indexed account,
        uint256 indexed sessionId,
        uint256 amount,
        uint256 start,
        uint256 end,
        uint256 shares
    );

    event Unstake(
        address indexed account,
        uint256 indexed sessionId,
        uint256 amount,
        uint256 start,
        uint256 end,
        uint256 shares
    );

    event MakePayout(
        uint256 indexed value,
        uint256 indexed sharesTotalSupply,
        uint256 indexed time
    );

    /** Structs */
    struct Payout {
        uint256 payout;
        uint256 sharesTotalSupply;
    }

    struct Session {
        uint256 amount;
        uint256 start;
        uint256 end;
        uint256 shares;
        uint256 firstPayout;
        uint256 lastPayout;
        bool withdrawn;
        uint256 payout;
    }

    struct Addresses {
        address mainToken;
        address auction;
        address subBalances;
    }

    Addresses public addresses;
    IStakingV1 public stakingV1;

    /** Roles */
    bytes32 public constant MIGRATOR_ROLE = keccak256("MIGRATOR_ROLE");
    bytes32 public constant EXTERNAL_STAKER_ROLE = keccak256("EXTERNAL_STAKER_ROLE");
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

    /** Public Variables */
    uint256 public shareRate;
    uint256 public sharesTotalSupply;
    uint256 public nextPayoutCall;
    uint256 public stepTimestamp;
    uint256 public startContract;
    uint256 public globalPayout;
    uint256 public globalPayin;
    uint256 public lastSessionId;
    uint256 public lastSessionIdV1;

    /** Mappings / Arrays */
    mapping(address => mapping(uint256 => Session)) public sessionDataOf;
    mapping(address => uint256[]) public sessionsOf;
    Payout[] public payouts;
    
    /** Booleans */
    bool public init_;

    /** Variables after initial contract launch must go below here. https://github.com/OpenZeppelin/openzeppelin-sdk/issues/37 */
    /** End Variables after launch */

    /** Roles */
    modifier onlyManager() {
        require(hasRole(MANAGER_ROLE, _msgSender()), "Caller is not a manager");
        _;
    }
    modifier onlyMigrator() {
        require(hasRole(MIGRATOR_ROLE, _msgSender()), "Caller is not a migrator");
        _;
    }
    modifier onlyExternalStaker() {
        require(
            hasRole(EXTERNAL_STAKER_ROLE, _msgSender()),
            "Caller is not a external staker"
        );
        _;
    }

    /** Init functions */
    function initialize(
        address _manager,
        address _migrator
    ) public initializer {
        _setupRole(MANAGER_ROLE, _manager);
        _setupRole(MIGRATOR_ROLE, _migrator);
        init_ = false;
    }
    
    function init(
        address _mainTokenAddress,
        address _auctionAddress,
        address _subBalancesAddress,
        address _foreignSwapAddress,
        address _stakingV1Address,
        uint256 _stepTimestamp
    ) external onlyMigrator {
        require(!init_, "Staking: init is active");
        init_ = true;
        /** Setup */
        _setupRole(EXTERNAL_STAKER_ROLE, _foreignSwapAddress);
        _setupRole(EXTERNAL_STAKER_ROLE, _auctionAddress);

        addresses = Addresses({
            mainToken: _mainTokenAddress,
            auction: _auctionAddress,
            subBalances: _subBalancesAddress
        });
        
        stakingV1 = IStakingV1(_stakingV1Address);

        stepTimestamp = _stepTimestamp;

        if (startContract == 0) {
            startContract = now;
            nextPayoutCall = startContract.add(_stepTimestamp);
        }

        if (shareRate == 0) {
            shareRate = 1e18;
        }
    }
    /** End init functions */

    function sessionsOf_(address account)
        external
        view
        returns (uint256[] memory)
    {
        return sessionsOf[account];
    }

    function stake(uint256 amount, uint256 stakingDays) external {
        if (now >= nextPayoutCall) makePayout();

        // Staking days must be greater then 0 and less then or equal to 5555.
        require(stakingDays != 0, "stakingDays < 1");
        require(stakingDays <= 5555, "stakingDays > 5555");

        uint256 start = now;
        uint256 end = now.add(stakingDays.mul(stepTimestamp));

        IToken(addresses.mainToken).burn(msg.sender, amount);
        lastSessionId = lastSessionId.add(1);
        uint256 sessionId = lastSessionId;
        uint256 shares = _getStakersSharesAmount(amount, start, end);
        sharesTotalSupply = sharesTotalSupply.add(shares);

        sessionDataOf[msg.sender][sessionId] = Session({
            amount: amount,
            start: start,
            end: end,
            shares: shares,
            firstPayout: payouts.length,
            lastPayout: payouts.length + stakingDays,
            withdrawn: false,
            payout: 0
        });

        sessionsOf[msg.sender].push(sessionId);

        ISubBalances(addresses.subBalances).callIncomeStakerTrigger(
            msg.sender,
            sessionId,
            start,
            end,
            shares
        );

        emit Stake(msg.sender, sessionId, amount, start, end, shares);
    }

    function externalStake(
        uint256 amount,
        uint256 stakingDays,
        address staker
    ) external override onlyExternalStaker {
        if (now >= nextPayoutCall) makePayout();

        require(stakingDays != 0, "stakingDays < 1");
        require(stakingDays <= 5555, "stakingDays > 5555");

        uint256 start = now;
        uint256 end = now.add(stakingDays.mul(stepTimestamp));

        lastSessionId = lastSessionId.add(1);
        uint256 sessionId = lastSessionId;
        uint256 shares = _getStakersSharesAmount(amount, start, end);
        sharesTotalSupply = sharesTotalSupply.add(shares);

        sessionDataOf[staker][sessionId] = Session({
            amount: amount,
            start: start,
            end: end,
            shares: shares,
            firstPayout: payouts.length,
            lastPayout: payouts.length + stakingDays,
            withdrawn: false,
            payout: 0
        });

        sessionsOf[staker].push(sessionId);

        ISubBalances(addresses.subBalances).callIncomeStakerTrigger(
            staker,
            sessionId,
            start,
            end,
            shares
        );

        emit Stake(staker, sessionId, amount, start, end, shares);
    }

    function _initPayout(address to, uint256 amount) internal {
        IToken(addresses.mainToken).mint(to, amount);
        globalPayout = globalPayout.add(amount);
    }

    function calculateStakingInterest(
        uint256 firstPayout,
        uint256 lastPayout,
        uint256 shares
    ) public view returns (uint256) {
        uint256 stakingInterest;
        uint256 lastIndex = MathUpgradeable.min(
            payouts.length, 
            lastPayout
        );

        for (
            uint256 i = firstPayout;
            i < lastIndex;
            i++
        ) {
            uint256 payout = payouts[i].payout.mul(shares).div(
                payouts[i].sharesTotalSupply
            );

            stakingInterest = stakingInterest.add(payout);
        }

        return stakingInterest;
    }

    function unstake(uint256 sessionId) external {
        if (now >= nextPayoutCall) makePayout();

        Session storage session = sessionDataOf[msg.sender][sessionId];

        require(
            session.shares != 0 
                && session.withdrawn == false,
            "Staking: Stake withdrawn/invalid"
        );

        uint256 actualEnd = now;
        uint256 amountOut = unstakeInternal(
            sessionId,
            session.amount, 
            session.start, 
            session.end,
            actualEnd,
            session.shares, 
            session.firstPayout, 
            session.lastPayout
        );

        ISubBalances(addresses.subBalances).callOutcomeStakerTrigger(
            sessionId,
            session.start,
            session.end,
            actualEnd,
            session.shares
        );

        session.end = actualEnd;
        session.withdrawn = true;
        session.payout = amountOut;
    }

    function unstakeV1(uint256 sessionId) external {
        if (now >= nextPayoutCall) makePayout();

        require(sessionId <= lastSessionIdV1, "Staking: Invalid sessionId");

        Session storage session = sessionDataOf[msg.sender][sessionId];

        // Unstaked already
        require(
            session.shares == 0 && session.withdrawn == false,
            "Staking: Stake withdrawn"
        );

        (uint256 amount, uint256 start, uint256 end, uint256 shares, uint256 firstPayout) 
            = stakingV1.sessionDataOf(msg.sender, sessionId);

        // Unstaked in v1 / doesn't exist
        require(
            shares > 0,
            "Staking: Stake withdrawn"
        );

        uint256 lastPayout = (end - start) / stepTimestamp + firstPayout;

        uint256 actualEnd = now;
        uint256 amountOut = unstakeInternal(
            sessionId, 
            amount, 
            start,
            end,
            actualEnd,
            shares, 
            firstPayout, 
            lastPayout
        );

        ISubBalances(addresses.subBalances).callOutcomeStakerTriggerV1(
            msg.sender,
            sessionId,
            start,
            end,
            actualEnd,
            shares
        );

        sessionDataOf[msg.sender][sessionId] = Session({
            amount: amount,
            start: start,
            end: actualEnd,
            shares: shares,
            firstPayout: firstPayout,
            lastPayout: lastPayout,
            withdrawn: true,
            payout: amountOut
        });

        sessionsOf[msg.sender].push(sessionId);
    }

    function unstakeInternal(
        uint256 sessionId, 
        uint256 amount, 
        uint256 start, 
        uint256 end, 
        uint256 actualEnd,
        uint256 shares, 
        uint256 firstPayout,
        uint256 lastPayout
    ) internal returns (uint256) {
        uint256 stakingInterest = calculateStakingInterest(
            firstPayout,
            lastPayout,
            shares
        );

        sharesTotalSupply = sharesTotalSupply.sub(shares);

        (uint256 amountOut, uint256 penalty) = getAmountOutAndPenalty(
            amount,
            start,
            end,
            stakingInterest
        );

        // To auction
        if (penalty != 0) {
            _initPayout(addresses.auction, penalty);
            IAuction(addresses.auction).callIncomeDailyTokensTrigger(penalty);
        }
        
        // To account
        _initPayout(msg.sender, amountOut);

        emit Unstake(
            msg.sender,
            sessionId,
            amountOut,
            start,
            actualEnd,
            shares
        );

        return amountOut;
    }

    function getAmountOutAndPenalty(uint256 amount, uint256 start, uint256 end, uint256 stakingInterest)
        public
        view
        returns (uint256, uint256)
    {
        uint256 stakingSeconds = end.sub(start);
        uint256 stakingDays = stakingSeconds.div(stepTimestamp);
        uint256 secondsStaked = now.sub(start);
        uint256 daysStaked = secondsStaked.div(stepTimestamp);
        uint256 amountAndInterest = amount.add(stakingInterest);

        // Early
        if (stakingDays > daysStaked) {
            uint256 payOutAmount = amountAndInterest.mul(secondsStaked).div(
                stakingSeconds
            );

            uint256 earlyUnstakePenalty = amountAndInterest.sub(payOutAmount);

            return (payOutAmount, earlyUnstakePenalty);
            // In time
        } else if (
            daysStaked < stakingDays.add(14)
        ) {
            return (amountAndInterest, 0);
            // Late
        } else if (
            daysStaked < stakingDays.add(714)
        ) {
            uint256 daysAfterStaking = daysStaked - stakingDays;

            uint256 payOutAmount = amountAndInterest
                .mul(uint256(714).sub(daysAfterStaking))
                .div(700);

            uint256 lateUnstakePenalty = amountAndInterest.sub(payOutAmount);

            return (payOutAmount, lateUnstakePenalty);
            // Nothing
        } else {
            return (0, amountAndInterest);
        }
    }

    function makePayout() public {
        require(now >= nextPayoutCall, "Staking: Wrong payout time");

        uint256 payout = _getPayout();

        payouts.push(
            Payout({payout: payout, sharesTotalSupply: sharesTotalSupply})
        );

        nextPayoutCall = nextPayoutCall.add(stepTimestamp);

        emit MakePayout(payout, sharesTotalSupply, now);
    }

    function readPayout() external view returns (uint256) {
        uint256 amountTokenInDay = IERC20Upgradeable(addresses.mainToken).balanceOf(address(this));

        uint256 currentTokenTotalSupply = (IERC20Upgradeable(addresses.mainToken).totalSupply()).add(
            globalPayin
        );

        uint256 inflation = uint256(8)
            .mul(currentTokenTotalSupply.add(sharesTotalSupply))
            .div(36500);

        return amountTokenInDay.add(inflation);
    }

    function _getPayout() internal returns (uint256) {
        uint256 amountTokenInDay = IERC20Upgradeable(addresses.mainToken).balanceOf(address(this));

        globalPayin = globalPayin.add(amountTokenInDay);

        if (globalPayin > globalPayout) {
            globalPayin = globalPayin.sub(globalPayout);
            globalPayout = 0;
        } else {
            globalPayin = 0;
            globalPayout = 0;
        }

        uint256 currentTokenTotalSupply = (IERC20Upgradeable(addresses.mainToken).totalSupply()).add(
            globalPayin
        );

        IToken(addresses.mainToken).burn(address(this), amountTokenInDay);

        uint256 inflation = uint256(8)
            .mul(currentTokenTotalSupply.add(sharesTotalSupply))
            .div(36500);


        globalPayin = globalPayin.add(inflation);

        return amountTokenInDay.add(inflation);
    }

    function _getStakersSharesAmount(
        uint256 amount,
        uint256 start,
        uint256 end
    ) internal view returns (uint256) {
        uint256 stakingDays = (end.sub(start)).div(stepTimestamp);
        uint256 numerator = amount.mul(uint256(1819).add(stakingDays));
        uint256 denominator = uint256(1820).mul(shareRate);

        return (numerator).mul(1e18).div(denominator);
    }

    function _getShareRate(
        uint256 amount,
        uint256 shares,
        uint256 start,
        uint256 end,
        uint256 stakingInterest
    ) internal view returns (uint256) {
        uint256 stakingDays = (end.sub(start)).div(stepTimestamp);

        uint256 numerator = (amount.add(stakingInterest)).mul(
            uint256(1819).add(stakingDays)
        );

        uint256 denominator = uint256(1820).mul(shares);

        return (numerator).mul(1e18).div(denominator);
    }

    /** Roles management - only for multi sig address */
    function setupRole(bytes32 role, address account) external onlyManager {
        _setupRole(role, account);
    }
}

File 2 of 14 : IAuction.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

interface IAuction {
    function callIncomeDailyTokensTrigger(uint256 amount) external;

    function callIncomeWeeklyTokensTrigger(uint256 amount) external;

    function addReservesToAuction(uint256 daysInFuture, uint256 amount) external returns(uint256);
}

File 3 of 14 : IStaking.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

interface IStaking {
    function externalStake(
        uint256 amount,
        uint256 stakingDays,
        address staker
    ) external;
}

File 4 of 14 : IStakingV1.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

interface IStakingV1 {
    function sessionDataOf(address, uint256)
        external view returns (uint256, uint256, uint256, uint256, uint256);
}

File 5 of 14 : ISubBalances.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

interface ISubBalances {
    function callIncomeStakerTrigger(
        address staker,
        uint256 sessionId,
        uint256 start,
        uint256 end,
        uint256 shares
    ) external;

    function callOutcomeStakerTrigger(
        uint256 sessionId,
        uint256 start,
        uint256 end,
        uint256 actualEnd,
        uint256 shares
    ) external;

    function callOutcomeStakerTriggerV1(
        address staker,
        uint256 sessionId,
        uint256 start,
        uint256 end,
        uint256 actualEnd,
        uint256 shares
    ) external;
}

File 6 of 14 : IToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

interface IToken {
    function mint(address to, uint256 amount) external;

    function burn(address from, uint256 amount) external;
}

File 7 of 14 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal initializer {
    }
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
    uint256[50] private __gap;
}

File 8 of 14 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/EnumerableSetUpgradeable.sol";
import "../utils/AddressUpgradeable.sol";
import "../GSN/ContextUpgradeable.sol";
import "../proxy/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable {
    function __AccessControl_init() internal initializer {
        __Context_init_unchained();
        __AccessControl_init_unchained();
    }

    function __AccessControl_init_unchained() internal initializer {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
    using AddressUpgradeable for address;

    struct RoleData {
        EnumerableSetUpgradeable.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}

File 9 of 14 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

File 10 of 14 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMathUpgradeable {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 11 of 14 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;


/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 * 
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 * 
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        // extcodesize checks the size of the code stored in an address, and
        // address returns the current address. Since the code is still not
        // deployed when running a constructor, any checks on its code size will
        // yield zero, making it an effective way to detect if a contract is
        // under construction or not.
        address self = address(this);
        uint256 cs;
        // solhint-disable-next-line no-inline-assembly
        assembly { cs := extcodesize(self) }
        return cs == 0;
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 13 of 14 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    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);
    }

    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);
            }
        }
    }
}

File 14 of 14 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint256(_at(set._inner, index)));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"sharesTotalSupply","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"time","type":"uint256"}],"name":"MakePayout","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"sessionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"sessionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Unstake","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXTERNAL_STAKER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIGRATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addresses","outputs":[{"internalType":"address","name":"mainToken","type":"address"},{"internalType":"address","name":"auction","type":"address"},{"internalType":"address","name":"subBalances","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"firstPayout","type":"uint256"},{"internalType":"uint256","name":"lastPayout","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"calculateStakingInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"stakingDays","type":"uint256"},{"internalType":"address","name":"staker","type":"address"}],"name":"externalStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"uint256","name":"stakingInterest","type":"uint256"}],"name":"getAmountOutAndPenalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalPayin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalPayout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_mainTokenAddress","type":"address"},{"internalType":"address","name":"_auctionAddress","type":"address"},{"internalType":"address","name":"_subBalancesAddress","type":"address"},{"internalType":"address","name":"_foreignSwapAddress","type":"address"},{"internalType":"address","name":"_stakingV1Address","type":"address"},{"internalType":"uint256","name":"_stepTimestamp","type":"uint256"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"init_","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"},{"internalType":"address","name":"_migrator","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastSessionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSessionIdV1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"makePayout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextPayoutCall","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"payouts","outputs":[{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"sharesTotalSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"readPayout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"sessionDataOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"firstPayout","type":"uint256"},{"internalType":"uint256","name":"lastPayout","type":"uint256"},{"internalType":"bool","name":"withdrawn","type":"bool"},{"internalType":"uint256","name":"payout","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"sessionsOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"sessionsOf_","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"setupRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shareRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sharesTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"stakingDays","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingV1","outputs":[{"internalType":"contract IStakingV1","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startContract","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stepTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sessionId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sessionId","type":"uint256"}],"name":"unstakeV1","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50612874806100206000396000f3fe608060405234801561001057600080fd5b50600436106101c25760003560e01c80630b7df8b7146101c75780631304bd761461020f5780631f5a56a81461027e578063228988c4146102b2578063248a9ca31461032857806329652e86146103575780632e17de78146103745780632f2ff15d1461039157806336568abe146103bd5780633feb925b146103e9578063421653f7146103f157806345bf0cc0146103f9578063485cc955146104015780634f5f99781461042f578063544b08b51461044c5780635fb02f4d146104985780636fae2e15146104a05780637b0472f0146104a85780637e905dfe146104cb5780638061c46f146104d3578063814a59b3146104db5780638d1ad737146104e35780639010d07c146104eb57806391d148541461052a578063980375581461056a578063982e52fb146105935780639964935e1461059b578063a217fddf146105a3578063a2e6f9bf146105ab578063abe91271146105b3578063ca15c873146105bb578063d547741f146105d8578063da0321cd14610604578063dd00721214610637578063ec87621c14610663578063f556a79c1461066b578063fa82ac7614610673578063fb802a651461069f575b600080fd5b6101f6600480360360808110156101dd57600080fd5b50803590602081013590604081013590606001356106a7565b6040805192835260208301919091528051918290030190f35b61023b6004803603604081101561022557600080fd5b506001600160a01b038135169060200135610815565b604080519889526020890197909752878701959095526060870193909352608086019190915260a0850152151560c084015260e083015251908190036101000190f35b6102b06004803603606081101561029457600080fd5b50803590602081013590604001356001600160a01b0316610869565b005b6102d8600480360360208110156102c857600080fd5b50356001600160a01b0316610c2c565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103145781810151838201526020016102fc565b505050509050019250505060405180910390f35b6103456004803603602081101561033e57600080fd5b5035610c98565b60408051918252519081900360200190f35b6101f66004803603602081101561036d57600080fd5b5035610cad565b6102b06004803603602081101561038a57600080fd5b5035610cd8565b6102b0600480360360408110156103a757600080fd5b50803590602001356001600160a01b0316610e4d565b6102b0600480360360408110156103d357600080fd5b50803590602001356001600160a01b0316610eb4565b610345610f15565b610345610f41565b610345610f47565b6102b06004803603604081101561041757600080fd5b506001600160a01b0381358116916020013516610f4d565b6102b06004803603602081101561044557600080fd5b5035611052565b6102b0600480360360c081101561046257600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101358216916080820135169060a00135611412565b6103456115f9565b6103456115ff565b6102b0600480360360408110156104be57600080fd5b5080359060200135611624565b610345611910565b610345611916565b61034561191c565b610345611922565b61050e6004803603604081101561050157600080fd5b5080359060200135611a70565b604080516001600160a01b039092168252519081900360200190f35b6105566004803603604081101561054057600080fd5b50803590602001356001600160a01b0316611a97565b604080519115158252519081900360200190f35b6103456004803603606081101561058057600080fd5b5080359060208101359060400135611ab5565b610556611b4f565b6102b0611b58565b610345611c79565b610345611c7e565b610345611c84565b610345600480360360208110156105d157600080fd5b5035611c8a565b6102b0600480360360408110156105ee57600080fd5b50803590602001356001600160a01b0316611ca1565b61060c611cfa565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190f35b6103456004803603604081101561064d57600080fd5b506001600160a01b038135169060200135611d17565b610345611d45565b61050e611d69565b6102b06004803603604081101561068957600080fd5b50803590602001356001600160a01b0316611d78565b610345611dfa565b600080806106bb858763ffffffff611e0016565b905060006106d4606c5483611e4290919063ffffffff16565b905060006106e8428963ffffffff611e0016565b90506000610701606c5483611e4290919063ffffffff16565b905060006107158b8963ffffffff611e8116565b90508184111561076757600061074186610735848763ffffffff611ed916565b9063ffffffff611e4216565b90506000610755838363ffffffff611e0016565b91985090965061080c95505050505050565b61077884600e63ffffffff611e8116565b82101561078f5795506000945061080c9350505050565b6107a1846102ca63ffffffff611e8116565b8210156107fc5783820360006107d56102bc6107356107c86102ca8663ffffffff611e0016565b869063ffffffff611ed916565b905060006107e9848363ffffffff611e0016565b91995090975061080c9650505050505050565b60009650945061080c9350505050565b94509492505050565b60726020908152600092835260408084209091529082529020805460018201546002830154600384015460048501546005860154600687015460079097015495969495939492939192909160ff9091169088565b604080517345585445524e414c5f5354414b45525f524f4c4560601b815290519081900360140190206108a39061089e611f32565b611a97565b6108f4576040805162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f7420612065787465726e616c207374616b657200604482015290519081900360640190fd5b606b54421061090557610905611b58565b81610949576040805162461bcd60e51b815260206004820152600f60248201526e7374616b696e6744617973203c203160881b604482015290519081900360640190fd5b6115b3821115610995576040805162461bcd60e51b81526020600482015260126024820152717374616b696e6744617973203e203535353560701b604482015290519081900360640190fd5b606c5442906000906109bf906109b290869063ffffffff611ed916565b429063ffffffff611e8116565b6070549091506109d690600163ffffffff611e8116565b607081905560006109e8878585611f36565b606a549091506109fe908263ffffffff611e8116565b606a81905550604051806101000160405280888152602001858152602001848152602001828152602001607480549050815260200187607480549050018152602001600015158152602001600081525060726000876001600160a01b03166001600160a01b031681526020019081526020016000206000848152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e0820151816007015590505060736000866001600160a01b03166001600160a01b03168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055606560020160009054906101000a90046001600160a01b03166001600160a01b0316635028ed7286848787866040518663ffffffff1660e01b815260040180866001600160a01b03166001600160a01b0316815260200185815260200184815260200183815260200182815260200195505050505050600060405180830381600087803b158015610bc957600080fd5b505af1158015610bdd573d6000803e3d6000fd5b5050604080518a8152602081018890528082018790526060810185905290518593506001600160a01b03891692506000805160206127718339815191529181900360800190a350505050505050565b6001600160a01b038116600090815260736020908152604091829020805483518184028101840190945280845260609392830182828015610c8c57602002820191906000526020600020905b815481526020019060010190808311610c78575b50505050509050919050565b60009081526033602052604090206002015490565b60748181548110610cba57fe5b60009182526020909120600290910201805460019091015490915082565b606b544210610ce957610ce9611b58565b3360009081526072602090815260408083208484529091529020600381015415801590610d1b5750600681015460ff16155b610d6c576040805162461bcd60e51b815260206004820181905260248201527f5374616b696e673a205374616b652077697468647261776e2f696e76616c6964604482015290519081900360640190fd5b60004290506000610d9b8484600001548560010154866002015486886003015489600401548a60050154611fbc565b60675460018501546002860154600387015460408051639170577360e01b8152600481018b905260248101949094526044840192909252606483018790526084830152519293506001600160a01b039091169163917057739160a48082019260009290919082900301818387803b158015610e1557600080fd5b505af1158015610e29573d6000803e3d6000fd5b50505050600283019190915560068201805460ff1916600117905560079091015550565b600082815260336020526040902060020154610e6b9061089e611f32565b610ea65760405162461bcd60e51b815260040180806020018281038252602f815260200180612742602f913960400191505060405180910390fd5b610eb082826120de565b5050565b610ebc611f32565b6001600160a01b0316816001600160a01b031614610f0b5760405162461bcd60e51b815260040180806020018281038252602f815260200180612810602f913960400191505060405180910390fd5b610eb0828261214d565b604080517345585445524e414c5f5354414b45525f524f4c4560601b8152905190819003601401902081565b60705481565b60715481565b600054610100900460ff1680610f665750610f666121bc565b80610f74575060005460ff16155b610faf5760405162461bcd60e51b815260040180806020018281038252602e8152602001806127c1602e913960400191505060405180910390fd5b600054610100900460ff16158015610fda576000805460ff1961ff0019909116610100171660011790555b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c0190206110059084610ea6565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d0190206110319083610ea6565b6075805460ff19169055801561104d576000805461ff00191690555b505050565b606b54421061106357611063611b58565b6071548111156110b7576040805162461bcd60e51b815260206004820152601a60248201527914dd185ada5b99ce88125b9d985b1a59081cd95cdcda5bdb925960321b604482015290519081900360640190fd5b336000908152607260209081526040808320848452909152902060038101541580156110e85750600681015460ff16155b611134576040805162461bcd60e51b815260206004820152601860248201527729ba30b5b4b7339d1029ba30b5b2903bb4ba34323930bbb760411b604482015290519081900360640190fd5b606854604080516309825ebb60e11b815233600482015260248101859052905160009283928392839283926001600160a01b0390911691631304bd769160448082019260a092909190829003018186803b15801561119157600080fd5b505afa1580156111a5573d6000803e3d6000fd5b505050506040513d60a08110156111bb57600080fd5b508051602082015160408301516060840151608090940151929850909650945090925090508161122d576040805162461bcd60e51b815260206004820152601860248201527729ba30b5b4b7339d1029ba30b5b2903bb4ba34323930bbb760411b604482015290519081900360640190fd5b600081606c548686038161123d57fe5b040190504260006112548a898989868a8a8a611fbc565b606754604080516344b335bd60e11b8152336004820152602481018e9052604481018b9052606481018a90526084810186905260a4810189905290519293506001600160a01b03909116916389666b7a9160c48082019260009290919082900301818387803b1580156112c657600080fd5b505af11580156112da573d6000803e3d6000fd5b505050506040518061010001604052808981526020018881526020018381526020018681526020018581526020018481526020016001151581526020018281525060726000336001600160a01b03166001600160a01b0316815260200190815260200160002060008c8152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e0820151816007015590505060736000336001600160a01b03166001600160a01b031681526020019081526020016000208a908060018154018082558091505060019003906000526020600020016000909190919091505550505050505050505050565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d0190206114409061089e611f32565b61148c576040805162461bcd60e51b815260206004820152601860248201527721b0b63632b91034b9903737ba10309036b4b3b930ba37b960411b604482015290519081900360640190fd5b60755460ff16156114de576040805162461bcd60e51b81526020600482015260176024820152765374616b696e673a20696e69742069732061637469766560481b604482015290519081900360640190fd5b6075805460ff19166001179055604080517345585445524e414c5f5354414b45525f524f4c4560601b8152905190819003601401902061151e9084610ea6565b604080517345585445524e414c5f5354414b45525f524f4c4560601b815290519081900360140190206115519086610ea6565b604080516060810182526001600160a01b038881168083528882166020840181905288831693909401839052606580546001600160a01b0319908116909217905560668054821690941790935560678054841690921790915560688054909216908416179055606c819055606d546115dd5742606d8190556115d9908263ffffffff611e8116565b606b555b6069546115f157670de0b6b3a76400006069555b505050505050565b606d5481565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d01902081565b606b54421061163557611635611b58565b80611679576040805162461bcd60e51b815260206004820152600f60248201526e7374616b696e6744617973203c203160881b604482015290519081900360640190fd5b6115b38111156116c5576040805162461bcd60e51b81526020600482015260126024820152717374616b696e6744617973203e203535353560701b604482015290519081900360640190fd5b606c5442906000906116e2906109b290859063ffffffff611ed916565b60655460408051632770a7eb60e21b81523360048201526024810188905290519293506001600160a01b0390911691639dc29fac9160448082019260009290919082900301818387803b15801561173857600080fd5b505af115801561174c573d6000803e3d6000fd5b505060705461176592509050600163ffffffff611e8116565b60708190556000611777868585611f36565b606a5490915061178d908263ffffffff611e8116565b606a55604080516101008101825287815260208082018781528284018781526060840186815260745460808601818152908c0160a08701908152600060c0880181815260e089018281523380845260728a528b84208e85528a528b84209a518b5597516001808c0191909155965160028b0155945160038a015592516004808a019190915591516005890155915160068801805460ff191691151591909117905591516007909601959095558285526073845285852080549283018155855292842001869055606754845163281476b960e11b8152928301919091526024820186905260448201889052606482018790526084820185905292516001600160a01b0390931692635028ed729260a48084019391929182900301818387803b1580156118b757600080fd5b505af11580156118cb573d6000803e3d6000fd5b505060408051898152602081018890528082018790526060810185905290518593503392506000805160206127718339815191529181900360800190a3505050505050565b606f5481565b606b5481565b606e5481565b606554604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561197257600080fd5b505afa158015611986573d6000803e3d6000fd5b505050506040513d602081101561199c57600080fd5b5051606f54606554604080516318160ddd60e01b81529051939450600093611a2693926001600160a01b0316916318160ddd916004808301926020929190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff611e8116565b90506000611a56618e94610735611a48606a5486611e8190919063ffffffff16565b60089063ffffffff611ed916565b9050611a68838263ffffffff611e8116565b935050505090565b6000828152603360205260408120611a8e908363ffffffff6121c216565b90505b92915050565b6000828152603360205260408120611a8e908363ffffffff6121ce16565b6000806000611ac9607480549050866121e3565b9050855b81811015611b44576000611b2760748381548110611ae757fe5b9060005260206000209060020201600101546107358860748681548110611b0a57fe5b60009182526020909120600290910201549063ffffffff611ed916565b9050611b39848263ffffffff611e8116565b935050600101611acd565b509095945050505050565b60755460ff1681565b606b54421015611bac576040805162461bcd60e51b815260206004820152601a6024820152795374616b696e673a2057726f6e67207061796f75742074696d6560301b604482015290519081900360640190fd5b6000611bb66121f9565b60408051808201909152818152606a54602082019081526074805460018101825560009190915291517f19a0b39aa25ac793b5f6e9a0534364cc0b3fd1ea9b651e79c7f50a59d48ef813600290930292830155517f19a0b39aa25ac793b5f6e9a0534364cc0b3fd1ea9b651e79c7f50a59d48ef81490910155606c54606b54919250611c429190611e81565b606b55606a5460405142919083907fd62b41a40bef91d47724ff07583b3d171958e4bc44899c59aea750e4a0160bf990600090a450565b600081565b606c5481565b606a5481565b6000818152603360205260408120611a91906123d6565b600082815260336020526040902060020154611cbf9061089e611f32565b610f0b5760405162461bcd60e51b81526004018080602001828103825260308152602001806127916030913960400191505060405180910390fd5b6065546066546067546001600160a01b0392831692918216911683565b60736020528160005260406000208181548110611d3057fe5b90600052602060002001600091509150505481565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c01902081565b6068546001600160a01b031681565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020611da59061089e611f32565b611df0576040805162461bcd60e51b815260206004820152601760248201527621b0b63632b91034b9903737ba10309036b0b730b3b2b960491b604482015290519081900360640190fd5b610eb08282610ea6565b60695481565b6000611a8e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123e1565b6000611a8e83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250612478565b600082820183811015611a8e576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b600082611ee857506000611a91565b82820282848281611ef557fe5b0414611a8e5760405162461bcd60e51b81526004018080602001828103825260218152602001806127ef6021913960400191505060405180910390fd5b3390565b600080611f52606c546107358686611e0090919063ffffffff16565b90506000611f78611f6b61071b8463ffffffff611e8116565b879063ffffffff611ed916565b90506000611f9360695461071c611ed990919063ffffffff16565b9050611fb18161073584670de0b6b3a764000063ffffffff611ed916565b979650505050505050565b600080611fca848487611ab5565b606a54909150611fe0908663ffffffff611e0016565b606a55600080611ff28b8b8b866106a7565b915091508060001461207a57606654612014906001600160a01b0316826124dd565b6066546040805163c22fd76f60e01b81526004810184905290516001600160a01b039092169163c22fd76f9160248082019260009290919082900301818387803b15801561206157600080fd5b505af1158015612075573d6000803e3d6000fd5b505050505b61208433836124dd565b60408051838152602081018c90528082018a90526060810189905290518d9133917f2ae77851d374757c0aeee19fd5d8f75edac9f1f52043fb96992607c2937314419181900360800190a3509a9950505050505050505050565b60008281526033602052604090206120fc908263ffffffff61256516565b15610eb057612109611f32565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260336020526040902061216b908263ffffffff61257a16565b15610eb057612178611f32565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b303b1590565b6000611a8e838361258f565b6000611a8e836001600160a01b0384166125f3565b60008183106121f25781611a8e565b5090919050565b606554604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561224957600080fd5b505afa15801561225d573d6000803e3d6000fd5b505050506040513d602081101561227357600080fd5b5051606f5490915061228b908263ffffffff611e8116565b606f819055606e5410156122bb57606e54606f546122ae9163ffffffff611e0016565b606f556000606e556122c6565b6000606f819055606e555b600061231f606f54606560000160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119ee57600080fd5b60655460408051632770a7eb60e21b81523060048201526024810186905290519293506001600160a01b0390911691639dc29fac9160448082019260009290919082900301818387803b15801561237557600080fd5b505af1158015612389573d6000803e3d6000fd5b5050505060006123ad618e94610735611a48606a5486611e8190919063ffffffff16565b606f549091506123c3908263ffffffff611e8116565b606f55611a68838263ffffffff611e8116565b6000611a918261260b565b600081848411156124705760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561243557818101518382015260200161241d565b50505050905090810190601f1680156124625780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836124c75760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561243557818101518382015260200161241d565b5060008385816124d357fe5b0495945050505050565b606554604080516340c10f1960e01b81526001600160a01b03858116600483015260248201859052915191909216916340c10f1991604480830192600092919082900301818387803b15801561253257600080fd5b505af1158015612546573d6000803e3d6000fd5b5050606e5461255e925090508263ffffffff611e8116565b606e555050565b6000611a8e836001600160a01b03841661260f565b6000611a8e836001600160a01b038416612659565b815460009082106125d15760405162461bcd60e51b81526004018080602001828103825260228152602001806127206022913960400191505060405180910390fd5b8260000182815481106125e057fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b600061261b83836125f3565b61265157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611a91565b506000611a91565b60008181526001830160205260408120548015612715578354600019808301919081019060009087908390811061268c57fe5b90600052602060002001549050808760000184815481106126a957fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806126d957fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611a91565b6000915050611a9156fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74c6f8dbf1fa0a0918d52df74fa2b529a0a4da7011a24f263a28678e7504444cd6416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220ea6c14856d16651df3ac3e62f548f648f13b17a0106564ad9234e4497941a70464736f6c63430006060033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101c25760003560e01c80630b7df8b7146101c75780631304bd761461020f5780631f5a56a81461027e578063228988c4146102b2578063248a9ca31461032857806329652e86146103575780632e17de78146103745780632f2ff15d1461039157806336568abe146103bd5780633feb925b146103e9578063421653f7146103f157806345bf0cc0146103f9578063485cc955146104015780634f5f99781461042f578063544b08b51461044c5780635fb02f4d146104985780636fae2e15146104a05780637b0472f0146104a85780637e905dfe146104cb5780638061c46f146104d3578063814a59b3146104db5780638d1ad737146104e35780639010d07c146104eb57806391d148541461052a578063980375581461056a578063982e52fb146105935780639964935e1461059b578063a217fddf146105a3578063a2e6f9bf146105ab578063abe91271146105b3578063ca15c873146105bb578063d547741f146105d8578063da0321cd14610604578063dd00721214610637578063ec87621c14610663578063f556a79c1461066b578063fa82ac7614610673578063fb802a651461069f575b600080fd5b6101f6600480360360808110156101dd57600080fd5b50803590602081013590604081013590606001356106a7565b6040805192835260208301919091528051918290030190f35b61023b6004803603604081101561022557600080fd5b506001600160a01b038135169060200135610815565b604080519889526020890197909752878701959095526060870193909352608086019190915260a0850152151560c084015260e083015251908190036101000190f35b6102b06004803603606081101561029457600080fd5b50803590602081013590604001356001600160a01b0316610869565b005b6102d8600480360360208110156102c857600080fd5b50356001600160a01b0316610c2c565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103145781810151838201526020016102fc565b505050509050019250505060405180910390f35b6103456004803603602081101561033e57600080fd5b5035610c98565b60408051918252519081900360200190f35b6101f66004803603602081101561036d57600080fd5b5035610cad565b6102b06004803603602081101561038a57600080fd5b5035610cd8565b6102b0600480360360408110156103a757600080fd5b50803590602001356001600160a01b0316610e4d565b6102b0600480360360408110156103d357600080fd5b50803590602001356001600160a01b0316610eb4565b610345610f15565b610345610f41565b610345610f47565b6102b06004803603604081101561041757600080fd5b506001600160a01b0381358116916020013516610f4d565b6102b06004803603602081101561044557600080fd5b5035611052565b6102b0600480360360c081101561046257600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101358216916080820135169060a00135611412565b6103456115f9565b6103456115ff565b6102b0600480360360408110156104be57600080fd5b5080359060200135611624565b610345611910565b610345611916565b61034561191c565b610345611922565b61050e6004803603604081101561050157600080fd5b5080359060200135611a70565b604080516001600160a01b039092168252519081900360200190f35b6105566004803603604081101561054057600080fd5b50803590602001356001600160a01b0316611a97565b604080519115158252519081900360200190f35b6103456004803603606081101561058057600080fd5b5080359060208101359060400135611ab5565b610556611b4f565b6102b0611b58565b610345611c79565b610345611c7e565b610345611c84565b610345600480360360208110156105d157600080fd5b5035611c8a565b6102b0600480360360408110156105ee57600080fd5b50803590602001356001600160a01b0316611ca1565b61060c611cfa565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190f35b6103456004803603604081101561064d57600080fd5b506001600160a01b038135169060200135611d17565b610345611d45565b61050e611d69565b6102b06004803603604081101561068957600080fd5b50803590602001356001600160a01b0316611d78565b610345611dfa565b600080806106bb858763ffffffff611e0016565b905060006106d4606c5483611e4290919063ffffffff16565b905060006106e8428963ffffffff611e0016565b90506000610701606c5483611e4290919063ffffffff16565b905060006107158b8963ffffffff611e8116565b90508184111561076757600061074186610735848763ffffffff611ed916565b9063ffffffff611e4216565b90506000610755838363ffffffff611e0016565b91985090965061080c95505050505050565b61077884600e63ffffffff611e8116565b82101561078f5795506000945061080c9350505050565b6107a1846102ca63ffffffff611e8116565b8210156107fc5783820360006107d56102bc6107356107c86102ca8663ffffffff611e0016565b869063ffffffff611ed916565b905060006107e9848363ffffffff611e0016565b91995090975061080c9650505050505050565b60009650945061080c9350505050565b94509492505050565b60726020908152600092835260408084209091529082529020805460018201546002830154600384015460048501546005860154600687015460079097015495969495939492939192909160ff9091169088565b604080517345585445524e414c5f5354414b45525f524f4c4560601b815290519081900360140190206108a39061089e611f32565b611a97565b6108f4576040805162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f7420612065787465726e616c207374616b657200604482015290519081900360640190fd5b606b54421061090557610905611b58565b81610949576040805162461bcd60e51b815260206004820152600f60248201526e7374616b696e6744617973203c203160881b604482015290519081900360640190fd5b6115b3821115610995576040805162461bcd60e51b81526020600482015260126024820152717374616b696e6744617973203e203535353560701b604482015290519081900360640190fd5b606c5442906000906109bf906109b290869063ffffffff611ed916565b429063ffffffff611e8116565b6070549091506109d690600163ffffffff611e8116565b607081905560006109e8878585611f36565b606a549091506109fe908263ffffffff611e8116565b606a81905550604051806101000160405280888152602001858152602001848152602001828152602001607480549050815260200187607480549050018152602001600015158152602001600081525060726000876001600160a01b03166001600160a01b031681526020019081526020016000206000848152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e0820151816007015590505060736000866001600160a01b03166001600160a01b03168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055606560020160009054906101000a90046001600160a01b03166001600160a01b0316635028ed7286848787866040518663ffffffff1660e01b815260040180866001600160a01b03166001600160a01b0316815260200185815260200184815260200183815260200182815260200195505050505050600060405180830381600087803b158015610bc957600080fd5b505af1158015610bdd573d6000803e3d6000fd5b5050604080518a8152602081018890528082018790526060810185905290518593506001600160a01b03891692506000805160206127718339815191529181900360800190a350505050505050565b6001600160a01b038116600090815260736020908152604091829020805483518184028101840190945280845260609392830182828015610c8c57602002820191906000526020600020905b815481526020019060010190808311610c78575b50505050509050919050565b60009081526033602052604090206002015490565b60748181548110610cba57fe5b60009182526020909120600290910201805460019091015490915082565b606b544210610ce957610ce9611b58565b3360009081526072602090815260408083208484529091529020600381015415801590610d1b5750600681015460ff16155b610d6c576040805162461bcd60e51b815260206004820181905260248201527f5374616b696e673a205374616b652077697468647261776e2f696e76616c6964604482015290519081900360640190fd5b60004290506000610d9b8484600001548560010154866002015486886003015489600401548a60050154611fbc565b60675460018501546002860154600387015460408051639170577360e01b8152600481018b905260248101949094526044840192909252606483018790526084830152519293506001600160a01b039091169163917057739160a48082019260009290919082900301818387803b158015610e1557600080fd5b505af1158015610e29573d6000803e3d6000fd5b50505050600283019190915560068201805460ff1916600117905560079091015550565b600082815260336020526040902060020154610e6b9061089e611f32565b610ea65760405162461bcd60e51b815260040180806020018281038252602f815260200180612742602f913960400191505060405180910390fd5b610eb082826120de565b5050565b610ebc611f32565b6001600160a01b0316816001600160a01b031614610f0b5760405162461bcd60e51b815260040180806020018281038252602f815260200180612810602f913960400191505060405180910390fd5b610eb0828261214d565b604080517345585445524e414c5f5354414b45525f524f4c4560601b8152905190819003601401902081565b60705481565b60715481565b600054610100900460ff1680610f665750610f666121bc565b80610f74575060005460ff16155b610faf5760405162461bcd60e51b815260040180806020018281038252602e8152602001806127c1602e913960400191505060405180910390fd5b600054610100900460ff16158015610fda576000805460ff1961ff0019909116610100171660011790555b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c0190206110059084610ea6565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d0190206110319083610ea6565b6075805460ff19169055801561104d576000805461ff00191690555b505050565b606b54421061106357611063611b58565b6071548111156110b7576040805162461bcd60e51b815260206004820152601a60248201527914dd185ada5b99ce88125b9d985b1a59081cd95cdcda5bdb925960321b604482015290519081900360640190fd5b336000908152607260209081526040808320848452909152902060038101541580156110e85750600681015460ff16155b611134576040805162461bcd60e51b815260206004820152601860248201527729ba30b5b4b7339d1029ba30b5b2903bb4ba34323930bbb760411b604482015290519081900360640190fd5b606854604080516309825ebb60e11b815233600482015260248101859052905160009283928392839283926001600160a01b0390911691631304bd769160448082019260a092909190829003018186803b15801561119157600080fd5b505afa1580156111a5573d6000803e3d6000fd5b505050506040513d60a08110156111bb57600080fd5b508051602082015160408301516060840151608090940151929850909650945090925090508161122d576040805162461bcd60e51b815260206004820152601860248201527729ba30b5b4b7339d1029ba30b5b2903bb4ba34323930bbb760411b604482015290519081900360640190fd5b600081606c548686038161123d57fe5b040190504260006112548a898989868a8a8a611fbc565b606754604080516344b335bd60e11b8152336004820152602481018e9052604481018b9052606481018a90526084810186905260a4810189905290519293506001600160a01b03909116916389666b7a9160c48082019260009290919082900301818387803b1580156112c657600080fd5b505af11580156112da573d6000803e3d6000fd5b505050506040518061010001604052808981526020018881526020018381526020018681526020018581526020018481526020016001151581526020018281525060726000336001600160a01b03166001600160a01b0316815260200190815260200160002060008c8152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e0820151816007015590505060736000336001600160a01b03166001600160a01b031681526020019081526020016000208a908060018154018082558091505060019003906000526020600020016000909190919091505550505050505050505050565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d0190206114409061089e611f32565b61148c576040805162461bcd60e51b815260206004820152601860248201527721b0b63632b91034b9903737ba10309036b4b3b930ba37b960411b604482015290519081900360640190fd5b60755460ff16156114de576040805162461bcd60e51b81526020600482015260176024820152765374616b696e673a20696e69742069732061637469766560481b604482015290519081900360640190fd5b6075805460ff19166001179055604080517345585445524e414c5f5354414b45525f524f4c4560601b8152905190819003601401902061151e9084610ea6565b604080517345585445524e414c5f5354414b45525f524f4c4560601b815290519081900360140190206115519086610ea6565b604080516060810182526001600160a01b038881168083528882166020840181905288831693909401839052606580546001600160a01b0319908116909217905560668054821690941790935560678054841690921790915560688054909216908416179055606c819055606d546115dd5742606d8190556115d9908263ffffffff611e8116565b606b555b6069546115f157670de0b6b3a76400006069555b505050505050565b606d5481565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d01902081565b606b54421061163557611635611b58565b80611679576040805162461bcd60e51b815260206004820152600f60248201526e7374616b696e6744617973203c203160881b604482015290519081900360640190fd5b6115b38111156116c5576040805162461bcd60e51b81526020600482015260126024820152717374616b696e6744617973203e203535353560701b604482015290519081900360640190fd5b606c5442906000906116e2906109b290859063ffffffff611ed916565b60655460408051632770a7eb60e21b81523360048201526024810188905290519293506001600160a01b0390911691639dc29fac9160448082019260009290919082900301818387803b15801561173857600080fd5b505af115801561174c573d6000803e3d6000fd5b505060705461176592509050600163ffffffff611e8116565b60708190556000611777868585611f36565b606a5490915061178d908263ffffffff611e8116565b606a55604080516101008101825287815260208082018781528284018781526060840186815260745460808601818152908c0160a08701908152600060c0880181815260e089018281523380845260728a528b84208e85528a528b84209a518b5597516001808c0191909155965160028b0155945160038a015592516004808a019190915591516005890155915160068801805460ff191691151591909117905591516007909601959095558285526073845285852080549283018155855292842001869055606754845163281476b960e11b8152928301919091526024820186905260448201889052606482018790526084820185905292516001600160a01b0390931692635028ed729260a48084019391929182900301818387803b1580156118b757600080fd5b505af11580156118cb573d6000803e3d6000fd5b505060408051898152602081018890528082018790526060810185905290518593503392506000805160206127718339815191529181900360800190a3505050505050565b606f5481565b606b5481565b606e5481565b606554604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561197257600080fd5b505afa158015611986573d6000803e3d6000fd5b505050506040513d602081101561199c57600080fd5b5051606f54606554604080516318160ddd60e01b81529051939450600093611a2693926001600160a01b0316916318160ddd916004808301926020929190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff611e8116565b90506000611a56618e94610735611a48606a5486611e8190919063ffffffff16565b60089063ffffffff611ed916565b9050611a68838263ffffffff611e8116565b935050505090565b6000828152603360205260408120611a8e908363ffffffff6121c216565b90505b92915050565b6000828152603360205260408120611a8e908363ffffffff6121ce16565b6000806000611ac9607480549050866121e3565b9050855b81811015611b44576000611b2760748381548110611ae757fe5b9060005260206000209060020201600101546107358860748681548110611b0a57fe5b60009182526020909120600290910201549063ffffffff611ed916565b9050611b39848263ffffffff611e8116565b935050600101611acd565b509095945050505050565b60755460ff1681565b606b54421015611bac576040805162461bcd60e51b815260206004820152601a6024820152795374616b696e673a2057726f6e67207061796f75742074696d6560301b604482015290519081900360640190fd5b6000611bb66121f9565b60408051808201909152818152606a54602082019081526074805460018101825560009190915291517f19a0b39aa25ac793b5f6e9a0534364cc0b3fd1ea9b651e79c7f50a59d48ef813600290930292830155517f19a0b39aa25ac793b5f6e9a0534364cc0b3fd1ea9b651e79c7f50a59d48ef81490910155606c54606b54919250611c429190611e81565b606b55606a5460405142919083907fd62b41a40bef91d47724ff07583b3d171958e4bc44899c59aea750e4a0160bf990600090a450565b600081565b606c5481565b606a5481565b6000818152603360205260408120611a91906123d6565b600082815260336020526040902060020154611cbf9061089e611f32565b610f0b5760405162461bcd60e51b81526004018080602001828103825260308152602001806127916030913960400191505060405180910390fd5b6065546066546067546001600160a01b0392831692918216911683565b60736020528160005260406000208181548110611d3057fe5b90600052602060002001600091509150505481565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c01902081565b6068546001600160a01b031681565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020611da59061089e611f32565b611df0576040805162461bcd60e51b815260206004820152601760248201527621b0b63632b91034b9903737ba10309036b0b730b3b2b960491b604482015290519081900360640190fd5b610eb08282610ea6565b60695481565b6000611a8e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123e1565b6000611a8e83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250612478565b600082820183811015611a8e576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b600082611ee857506000611a91565b82820282848281611ef557fe5b0414611a8e5760405162461bcd60e51b81526004018080602001828103825260218152602001806127ef6021913960400191505060405180910390fd5b3390565b600080611f52606c546107358686611e0090919063ffffffff16565b90506000611f78611f6b61071b8463ffffffff611e8116565b879063ffffffff611ed916565b90506000611f9360695461071c611ed990919063ffffffff16565b9050611fb18161073584670de0b6b3a764000063ffffffff611ed916565b979650505050505050565b600080611fca848487611ab5565b606a54909150611fe0908663ffffffff611e0016565b606a55600080611ff28b8b8b866106a7565b915091508060001461207a57606654612014906001600160a01b0316826124dd565b6066546040805163c22fd76f60e01b81526004810184905290516001600160a01b039092169163c22fd76f9160248082019260009290919082900301818387803b15801561206157600080fd5b505af1158015612075573d6000803e3d6000fd5b505050505b61208433836124dd565b60408051838152602081018c90528082018a90526060810189905290518d9133917f2ae77851d374757c0aeee19fd5d8f75edac9f1f52043fb96992607c2937314419181900360800190a3509a9950505050505050505050565b60008281526033602052604090206120fc908263ffffffff61256516565b15610eb057612109611f32565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260336020526040902061216b908263ffffffff61257a16565b15610eb057612178611f32565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b303b1590565b6000611a8e838361258f565b6000611a8e836001600160a01b0384166125f3565b60008183106121f25781611a8e565b5090919050565b606554604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561224957600080fd5b505afa15801561225d573d6000803e3d6000fd5b505050506040513d602081101561227357600080fd5b5051606f5490915061228b908263ffffffff611e8116565b606f819055606e5410156122bb57606e54606f546122ae9163ffffffff611e0016565b606f556000606e556122c6565b6000606f819055606e555b600061231f606f54606560000160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119ee57600080fd5b60655460408051632770a7eb60e21b81523060048201526024810186905290519293506001600160a01b0390911691639dc29fac9160448082019260009290919082900301818387803b15801561237557600080fd5b505af1158015612389573d6000803e3d6000fd5b5050505060006123ad618e94610735611a48606a5486611e8190919063ffffffff16565b606f549091506123c3908263ffffffff611e8116565b606f55611a68838263ffffffff611e8116565b6000611a918261260b565b600081848411156124705760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561243557818101518382015260200161241d565b50505050905090810190601f1680156124625780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836124c75760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561243557818101518382015260200161241d565b5060008385816124d357fe5b0495945050505050565b606554604080516340c10f1960e01b81526001600160a01b03858116600483015260248201859052915191909216916340c10f1991604480830192600092919082900301818387803b15801561253257600080fd5b505af1158015612546573d6000803e3d6000fd5b5050606e5461255e925090508263ffffffff611e8116565b606e555050565b6000611a8e836001600160a01b03841661260f565b6000611a8e836001600160a01b038416612659565b815460009082106125d15760405162461bcd60e51b81526004018080602001828103825260228152602001806127206022913960400191505060405180910390fd5b8260000182815481106125e057fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b600061261b83836125f3565b61265157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611a91565b506000611a91565b60008181526001830160205260408120548015612715578354600019808301919081019060009087908390811061268c57fe5b90600052602060002001549050808760000184815481106126a957fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806126d957fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611a91565b6000915050611a9156fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74c6f8dbf1fa0a0918d52df74fa2b529a0a4da7011a24f263a28678e7504444cd6416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a2646970667358221220ea6c14856d16651df3ac3e62f548f648f13b17a0106564ad9234e4497941a70464736f6c63430006060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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.