Donau Testnet

Contract

0xb6583A2b89e6371E2f7df78070Ba86F303dc3425

Overview

BTT Balance

Bittorent Chain LogoBittorent Chain LogoBittorent Chain Logo0 BTT

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

> 10 Internal Transactions found.

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
489129942025-02-13 7:10:193 days ago1739430619
0xb6583A2b...303dc3425
0 BTT
489129942025-02-13 7:10:193 days ago1739430619
0xb6583A2b...303dc3425
0 BTT
489124922025-02-13 6:53:033 days ago1739429583
0xb6583A2b...303dc3425
0 BTT
489124922025-02-13 6:53:033 days ago1739429583
0xb6583A2b...303dc3425
0 BTT
489118902025-02-13 6:32:233 days ago1739428343
0xb6583A2b...303dc3425
0 BTT
488287192025-02-11 6:53:215 days ago1739256801
0xb6583A2b...303dc3425
0 BTT
488287192025-02-11 6:53:215 days ago1739256801
0xb6583A2b...303dc3425
0 BTT
488280932025-02-11 6:31:495 days ago1739255509
0xb6583A2b...303dc3425
0 BTT
488280932025-02-11 6:31:495 days ago1739255509
0xb6583A2b...303dc3425
0 BTT
488241602025-02-11 4:16:395 days ago1739247399
0xb6583A2b...303dc3425
0 BTT
488241602025-02-11 4:16:395 days ago1739247399
0xb6583A2b...303dc3425
0 BTT
488240762025-02-11 4:13:475 days ago1739247227
0xb6583A2b...303dc3425
0 BTT
488240762025-02-11 4:13:475 days ago1739247227
0xb6583A2b...303dc3425
0 BTT
488238082025-02-11 4:04:355 days ago1739246675
0xb6583A2b...303dc3425
0 BTT
488238082025-02-11 4:04:355 days ago1739246675
0xb6583A2b...303dc3425
0 BTT
488236112025-02-11 3:57:455 days ago1739246265
0xb6583A2b...303dc3425
0 BTT
488236112025-02-11 3:57:455 days ago1739246265
0xb6583A2b...303dc3425
0 BTT
488233972025-02-11 3:50:255 days ago1739245825
0xb6583A2b...303dc3425
0 BTT
488233972025-02-11 3:50:255 days ago1739245825
0xb6583A2b...303dc3425
0 BTT
488233372025-02-11 3:48:215 days ago1739245701
0xb6583A2b...303dc3425
0 BTT
488233372025-02-11 3:48:215 days ago1739245701
0xb6583A2b...303dc3425
0 BTT
488228432025-02-11 3:31:215 days ago1739244681
0xb6583A2b...303dc3425
0 BTT
488228432025-02-11 3:31:215 days ago1739244681
0xb6583A2b...303dc3425
0 BTT
488227372025-02-11 3:27:455 days ago1739244465
0xb6583A2b...303dc3425
0 BTT
488227372025-02-11 3:27:455 days ago1739244465
0xb6583A2b...303dc3425
0 BTT
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ChildERC20RelayStake

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : ChildERC20RelayStake.sol
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {EnumerableSet} from "../../../common/EnumerableSet.sol";
import {AccessControlMixin} from "../../../common/AccessControlMixin.sol";
import {ContextMixin} from "../../../common/ContextMixin.sol";
import {Initializable} from "../../../common/Initializable.sol";
import {IChildTokenForExchange} from "./IChildTokenForExchange.sol";
import {IOracle} from "./IOracle.sol";

contract ChildERC20RelayStake is AccessControlMixin, ContextMixin, Initializable {
    using SafeERC20 for IERC20;
    using SafeMath for uint256;
    using EnumerableSet for EnumerableSet.AddressSet;

    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    bytes32 public constant COMMUNITY_ROLE = keccak256("COMMUNITY_ROLE");
    bytes32 public constant CFO_ROLE = keccak256("CFO_ROLE");
    uint256 public constant PRECISION = 100;
    IERC20 public constant BTT_T = IERC20(0x0000000000000000000000000000000000001010);
    
    IERC20 public btt_e;
    IERC20 public btt_b;
    IOracle public oracle;

    enum Status{
        pending,
        staked,
        activated,
        unstaked
    }

    struct RelayerBasic{
        uint256 stakeAmount;
        uint256 unstakedTime;
        Status status;
    }
    mapping(address => RelayerBasic) public relayerBasic;
    EnumerableSet.AddressSet internal relayers;
    uint256 public totalStaked;
    uint256 public penalSum;
    uint256 public withdrawnPenalSum;
    uint256 public timeInterval;
    address public receiver;
    
    event Stake(address indexed from, uint256 amount, uint256 totalStakedAmount);
    event UnStake(address indexed relayer, uint256 stakeAmount, uint256 availableTime);
    event ActivateRelayer(address indexed relayer);
    event WithdrawCollateral(address indexed relayer, uint256 amount);
    event TimeIntervalUpdated(uint256 value);
    event Punished(address indexed relayer, uint256 amount, uint256 stakeAmount);
    event Retrieved(address receiver, uint256 amount);
    event ReceiverUpdated(address receiver);
    event OracleUpdated(address oracle);

    function initialize(
        address _admin,
        address _operator,
        address _community,
        address _cfo,
        address _btt_e,
        address _btt_b,
        address _receiver,
        uint256 _timeInterval) external initializer {
        _setupContractId("ChildERC20RelayStake");
        _setupRole(DEFAULT_ADMIN_ROLE, _admin);
        _setupRole(OPERATOR_ROLE, _operator);
        _setupRole(COMMUNITY_ROLE, _community);
        _setupRole(CFO_ROLE, _cfo);
        btt_b = IERC20(_btt_b);
        btt_e = IERC20(_btt_e);
        receiver = _receiver;
        timeInterval = _timeInterval;
    }
    
    receive() external payable {
    }

    function stake(IERC20 btt, uint256 amount) payable external {
        _stake(btt,amount,msgSender());
    }

    function stakeTo(IERC20 btt, uint256 amount, address targetRelayer) payable external {
        require(targetRelayer != address(0x00), "ChildERC20RelayStake: targetRelayer should not be zero address");
        _stake(btt,amount,targetRelayer);
    }

    function _stake(IERC20 btt, uint256 amount, address relayer) internal {
        RelayerBasic storage basic = relayerBasic[relayer];

        require(basic.status != Status.unstaked, "ChildERC20RelayStake: incorrect status");
        require(btt == BTT_T || btt == btt_b || btt == btt_e,"ChildERC20RelayStake: incorrect btt address");
        if(btt == BTT_T){
            require(amount == msg.value, "ChildERC20RelayStake: incorrect btt amount");
        }
        if(btt == btt_e || btt == btt_b){
            btt.safeTransferFrom(msgSender(), address(this), amount);
            IChildTokenForExchange(address(btt)).swapOut(amount);
        }
        totalStaked = totalStaked.add(amount);
        basic.stakeAmount = basic.stakeAmount.add(amount);
        if(basic.status == Status.pending){
            basic.status = Status.staked;
        }
        emit Stake(relayer,amount,basic.stakeAmount);
    }

    function unstake() external {
        address relayer = msgSender();

        require(relayerBasic[relayer].status == Status.activated, "ChildERC20RelayStake: incorrect status");
        relayerBasic[relayer].status = Status.unstaked;
        relayerBasic[relayer].unstakedTime = block.timestamp;
        relayers.remove(relayer);
        emit UnStake(relayer,relayerBasic[relayer].stakeAmount,block.timestamp + timeInterval);
    }

    function withdrawCollateral() external{
        address relayer = msgSender();
        RelayerBasic memory basic = relayerBasic[relayer];

        require(basic.status == Status.unstaked || basic.status == Status.staked,"ChildERC20RelayStake: incorrect status");
        
        if(basic.status == Status.unstaked){
            require(block.timestamp.sub(basic.unstakedTime) >= timeInterval,"ChildERC20RelayStake: less than limit timeInterval");
        }

        delete relayerBasic[relayer];
        
        if(basic.stakeAmount > 0){
            totalStaked = totalStaked.sub(basic.stakeAmount);
            payable(relayer).transfer(basic.stakeAmount);
        }
        emit WithdrawCollateral(relayer,basic.stakeAmount);
    }

    function punish(address relayer,uint256 amount) external only(OPERATOR_ROLE){
        require(amount <= relayerBasic[relayer].stakeAmount, "ChildERC20RelayStake: exceeds stake amount");
        require(relayerBasic[relayer].status == Status.activated || relayerBasic[relayer].status == Status.unstaked , "ChildERC20RelayStake: incorrect status");
        relayerBasic[relayer].stakeAmount = relayerBasic[relayer].stakeAmount.sub(amount);
        penalSum = penalSum.add(amount);
        totalStaked = totalStaked.sub(amount);
        emit Punished(relayer,amount,relayerBasic[relayer].stakeAmount);
    }

    function retrieve(uint256 amount) external only(CFO_ROLE){
        require(amount <= (penalSum.sub(withdrawnPenalSum)), "ChildERC20RelayStake: exceeds penal sum");
        payable(receiver).transfer(amount);
        withdrawnPenalSum = withdrawnPenalSum.add(amount);
        emit Retrieved(receiver, amount);
    }

    function activateRelayer(address relayer) external only(COMMUNITY_ROLE){
        require(relayer != address(0x00), "ChildERC20RelayStake: relayer should not be zero address");
        require(relayerBasic[relayer].status == Status.staked, "ChildERC20RelayStake: incorrect status");
        
        relayers.add(relayer);
        relayerBasic[relayer].status = Status.activated;
        emit ActivateRelayer(relayer);
    }

    function setTimeInterval(uint256 interval) external only(DEFAULT_ADMIN_ROLE){
        require(interval > 0, "ChildERC20RelayStake: need non-zero value");
        timeInterval = interval;
        emit TimeIntervalUpdated(interval);
    }

    function setReceiver(address receiverNew) external only(DEFAULT_ADMIN_ROLE){
        require(receiverNew != address(0x00), "ChildERC20RelayStake: receiverNew should not be zero address");
        receiver = receiverNew;
        emit ReceiverUpdated(receiverNew);
    }

    function setOracle(address oracleNew) external only(DEFAULT_ADMIN_ROLE){
        require(oracleNew != address(0x00), "ChildERC20RelayStake: oracleNew should not be zero address");
        oracle = IOracle(oracleNew);
        emit OracleUpdated(oracleNew);
    }

    function replaceRole(bytes32 role, address addr) external only(role){
        require(addr != address(0x00), "ChildERC20RelayStake: role should not be zero address");
        require(role == OPERATOR_ROLE || role == COMMUNITY_ROLE || role == CFO_ROLE, "ChildERC20RelayStake: incorrect role");
        renounceRole(role, msgSender());
        _setupRole(role, addr);
    }

    function getMaxHourlyOrders(address relayer) view external returns(uint256){
        uint256 stakeAmount = relayerBasic[relayer].stakeAmount;
        uint256 hardLimit = oracle.hardLimit();
        uint256 scale = oracle.scale();
        uint256 orderCost = oracle.orderCost();
        if(stakeAmount >= hardLimit){
            return stakeAmount.sub(hardLimit).mul(PRECISION).div(scale).div(orderCost);
        }
        return 0;  
    }

    function isActive(address relayer) external view returns(bool){
        if(relayerBasic[relayer].status == Status.activated){
            return true;
        }
        return false;
    }

    function isOrderTaking(address relayer) external view returns(bool){
        uint256 hardLimit = oracle.hardLimit();
        if(relayerBasic[relayer].status == Status.activated && relayerBasic[relayer].stakeAmount >= hardLimit){
            return true;
        }
        return false;
    }

    function getRelayerStakeAmount(address relayer) external view returns(uint256){
        return relayerBasic[relayer].stakeAmount;
    }

    function getRelayers() public view returns (address[] memory){
        return relayers.values();
    }

}

File 2 of 15 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../utils/Context.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 AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.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());
        }
    }
}

File 3 of 15 : SafeMath.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 SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @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) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @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) {
        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, reverting 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) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting 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) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * 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);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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 4 of 15 : IERC20.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 IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 5 of 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 7 of 15 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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 Context {
    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;
    }
}

File 8 of 15 : EnumerableSet.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 EnumerableSet {
    // 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(uint160(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(uint160(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(uint160(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(uint160(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));
    }
}

File 9 of 15 : IChildToken.sol
pragma solidity 0.6.6;

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

interface IChildToken is IERC20 {
    event WithdrawTo(address indexed from, address indexed to, uint256 amount);
    function deposit(address user, bytes calldata depositData) external;
    function withdrawTo(address to, uint256 amount) payable external;
}

File 10 of 15 : IChildTokenForExchange.sol
pragma solidity 0.6.6;

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

interface IChildTokenForExchange is IChildToken {
    function swapIn(uint256 amount)  external;

    function swapOut(uint256 amount) external;

}

File 11 of 15 : IOracle.sol
pragma solidity 0.6.6;

interface IOracle {
    function hardLimit() view external returns (uint256);
    function orderCost() view external returns (uint256);
    function scale() view external returns (uint256);

}

File 12 of 15 : AccessControlMixin.sol
pragma solidity 0.6.6;

import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";

contract AccessControlMixin is AccessControl {
    string private _revertMsg;
    function _setupContractId(string memory contractId) internal {
        _revertMsg = string(abi.encodePacked(contractId, ": INSUFFICIENT_PERMISSIONS"));
    }

    modifier only(bytes32 role) {
        require(
            hasRole(role, _msgSender()),
            _revertMsg
        );
        _;
    }
}

File 13 of 15 : ContextMixin.sol
pragma solidity 0.6.6;

abstract contract ContextMixin {
    function msgSender()
        internal
        view
        returns (address payable sender)
    {
        if (msg.sender == address(this)) {
            bytes memory array = msg.data;
            uint256 index = msg.data.length;
            assembly {
                // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
                sender := and(
                    mload(add(array, index)),
                    0xffffffffffffffffffffffffffffffffffffffff
                )
            }
        } else {
            sender = msg.sender;
        }
        return sender;
    }
}

File 14 of 15 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

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 EnumerableSet {
    // 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;

            if (lastIndex != toDeleteIndex) {
                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] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // 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) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // 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(uint160(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(uint160(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(uint160(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(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory result) {
        bytes32[] storage store = set._inner._values;
        result = new address[](store.length);
        for (uint i = 0; i < store.length; i++) {
            result[i] = address(uint(store[i]));
        }
    }

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

}

File 15 of 15 : Initializable.sol
pragma solidity 0.6.6;

contract Initializable {
    bool inited = false;

    modifier initializer() {
        require(!inited, "already inited");
        _;
        inited = true;
    }
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"ActivateRelayer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"OracleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakeAmount","type":"uint256"}],"name":"Punished","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"ReceiverUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Retrieved","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":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalStakedAmount","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TimeIntervalUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"uint256","name":"stakeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"availableTime","type":"uint256"}],"name":"UnStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawCollateral","type":"event"},{"inputs":[],"name":"BTT_T","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CFO_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COMMUNITY_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"activateRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"btt_b","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"btt_e","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"getMaxHourlyOrders","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"getRelayerStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRelayers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"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":[{"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":"_admin","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_community","type":"address"},{"internalType":"address","name":"_cfo","type":"address"},{"internalType":"address","name":"_btt_e","type":"address"},{"internalType":"address","name":"_btt_b","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_timeInterval","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"isOrderTaking","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"penalSum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"punish","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"receiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"relayerBasic","outputs":[{"internalType":"uint256","name":"stakeAmount","type":"uint256"},{"internalType":"uint256","name":"unstakedTime","type":"uint256"},{"internalType":"enum ChildERC20RelayStake.Status","name":"status","type":"uint8"}],"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":"addr","type":"address"}],"name":"replaceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"retrieve","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":"oracleNew","type":"address"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiverNew","type":"address"}],"name":"setReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"interval","type":"uint256"}],"name":"setTimeInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"btt","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"btt","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"targetRelayer","type":"address"}],"name":"stakeTo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"timeInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawnPenalSum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040526002805460ff1916905534801561001a57600080fd5b50612c718061002a6000396000f3fe6080604052600436106102345760003560e01c80638f5164381161012e578063b16b3699116100ab578063df7eb5911161006f578063df7eb59114610625578063f5b541a61461063a578063f7260d3e1461064f578063f7485ffd14610664578063fb9ca751146106845761023b565b8063b16b369914610583578063b211568114610596578063ca15c873146105c5578063d547741f146105e5578063d8e423b2146106055761023b565b80639f6f50ed116100f25780639f6f50ed146105115780639f8a13d714610526578063a217fddf14610546578063aaf5eb681461055b578063adc9772e146105705761023b565b80638f516438146104875780638f88708b1461049c5780639010d07c146104bc57806391d14854146104dc5780639aa77731146104fc5761023b565b806359c153be116101bc5780637adbf973116101805780637adbf973146104085780637dc0d1d0146104285780637de2c4e41461043d578063817b1cd21461045257806388301911146104675761023b565b806359c153be1461037c5780635a2782801461039157806366d4cf48146103b357806370ed5d3a146103c8578063718da7ee146103e85761023b565b80632def6620116102035780632def6620146102da5780632f2ff15d146102ef57806336568abe1461030f5780633f1ea9ba1461032f5780634bb911c71461035c5761023b565b80630b5c704414610240578063179ff4b214610276578063248a9ca31461029857806325423a1b146102b85761023b565b3661023b57005b600080fd5b34801561024c57600080fd5b5061026061025b3660046120ec565b610699565b60405161026d9190612400565b60405180910390f35b34801561028257600080fd5b5061028b610894565b60405161026d91906123a8565b3480156102a457600080fd5b506102606102b33660046121f2565b6108a6565b3480156102c457600080fd5b506102d86102d33660046121f2565b6108bb565b005b3480156102e657600080fd5b506102d8610954565b3480156102fb57600080fd5b506102d861030a36600461220a565b610a3f565b34801561031b57600080fd5b506102d861032a36600461220a565b610a87565b34801561033b57600080fd5b5061034f61034a3660046120ec565b610ac9565b60405161026d91906123f5565b34801561036857600080fd5b506102606103773660046120ec565b610bb0565b34801561038857600080fd5b506102d8610bcb565b34801561039d57600080fd5b506103a6610da3565b60405161026d9190612357565b3480156103bf57600080fd5b506103a6610db2565b3480156103d457600080fd5b506102d86103e336600461220a565b610db8565b3480156103f457600080fd5b506102d86104033660046120ec565b610e93565b34801561041457600080fd5b506102d86104233660046120ec565b610f33565b34801561043457600080fd5b506103a6610fd3565b34801561044957600080fd5b50610260610fe2565b34801561045e57600080fd5b50610260610fe8565b34801561047357600080fd5b506102d8610482366004612108565b610fee565b34801561049357600080fd5b5061026061110a565b3480156104a857600080fd5b506102d86104b73660046121f2565b611110565b3480156104c857600080fd5b506103a66104d7366004612239565b611215565b3480156104e857600080fd5b5061034f6104f736600461220a565b61123c565b34801561050857600080fd5b5061026061125a565b34801561051d57600080fd5b50610260611271565b34801561053257600080fd5b5061034f6105413660046120ec565b61127d565b34801561055257600080fd5b506102606112c1565b34801561056757600080fd5b506102606112c6565b6102d861057e3660046121a7565b6112cb565b6102d861059136600461225a565b6112dd565b3480156105a257600080fd5b506105b66105b13660046120ec565b61130e565b60405161026d93929190612ba5565b3480156105d157600080fd5b506102606105e03660046121f2565b611332565b3480156105f157600080fd5b506102d861060036600461220a565b611349565b34801561061157600080fd5b506102d86106203660046121a7565b611383565b34801561063157600080fd5b506103a661153f565b34801561064657600080fd5b50610260611553565b34801561065b57600080fd5b506103a661155f565b34801561067057600080fd5b506102d861067f3660046120ec565b61156e565b34801561069057600080fd5b50610260611682565b6001600160a01b0380821660009081526005602090815260408083205460048054835163c41f6d5f60e01b81529351959692958795919093169363c41f6d5f93818401939091829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b919061229b565b90506000600460009054906101000a90046001600160a01b03166001600160a01b031663f51e181a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561077d57600080fd5b505afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b5919061229b565b90506000600460009054906101000a90046001600160a01b03166001600160a01b031663df272bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561080757600080fd5b505afa15801561081b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083f919061229b565b90508284106108865761087b8161086f848160646108638a8a63ffffffff61168816565b9063ffffffff6116b016565b9063ffffffff6116ea16565b94505050505061088f565b60009450505050505b919050565b60606108a0600661171c565b90505b90565b60009081526020819052604090206002015490565b60006108c9816104f76117bf565b6001906108f25760405162461bcd60e51b81526004016108e9919061243c565b60405180910390fd5b50600082116109135760405162461bcd60e51b81526004016108e9906128fa565b600b8290556040517f3aa1f99724613750b559470daa4b1e9741d847eb9d6e4f03686085c86f1d2b0c90610948908490612400565b60405180910390a15050565b600061095e6117c3565b905060026001600160a01b03821660009081526005602052604090206002015460ff16600381111561098c57fe5b146109a95760405162461bcd60e51b81526004016108e990612943565b6001600160a01b038116600090815260056020526040902060028101805460ff19166003179055426001909101556109e2600682611820565b506001600160a01b0381166000818152600560205260409081902054600b5491517f54a9763035584fc4fcad1bc4e0e7a83f93e016f50ae32bd527530a77257393ee92610a3492914290910190612b97565b60405180910390a250565b600082815260208190526040902060020154610a5d906104f76117bf565b610a795760405162461bcd60e51b81526004016108e990612508565b610a838282611835565b5050565b610a8f6117bf565b6001600160a01b0316816001600160a01b031614610abf5760405162461bcd60e51b81526004016108e990612b48565b610a8382826118a4565b600480546040805163c41f6d5f60e01b8152905160009384936001600160a01b03169263c41f6d5f9281830192602092829003018186803b158015610b0d57600080fd5b505afa158015610b21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b45919061229b565b905060026001600160a01b03841660009081526005602052604090206002015460ff166003811115610b7357fe5b148015610b9857506001600160a01b0383166000908152600560205260409020548111155b15610ba757600191505061088f565b50600092915050565b6001600160a01b031660009081526005602052604090205490565b6000610bd56117c3565b9050610bdf612029565b6001600160a01b0382166000908152600560209081526040918290208251606081018452815481526001820154928101929092526002810154919290919083019060ff166003811115610c2e57fe5b6003811115610c3957fe5b9052509050600381604001516003811115610c5057fe5b1480610c6b5750600181604001516003811115610c6957fe5b145b610c875760405162461bcd60e51b81526004016108e990612943565b600381604001516003811115610c9957fe5b1415610cd657600b546020820151610cb890429063ffffffff61168816565b1015610cd65760405162461bcd60e51b81526004016108e990612a33565b6001600160a01b03821660009081526005602052604081208181556001810191909155600201805460ff19169055805115610d5a578051600854610d1f9163ffffffff61168816565b60085580516040516001600160a01b0384169180156108fc02916000818181858888f19350505050158015610d58573d6000803e3d6000fd5b505b816001600160a01b03167fa8e76b822fc682be77f3b1c822ea81f6bda5aed92ba82e6873bfd889f328d1d28260000151604051610d979190612400565b60405180910390a25050565b6003546001600160a01b031681565b61101081565b81610dc5816104f76117bf565b600190610de55760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b038216610e0c5760405162461bcd60e51b81526004016108e9906125ed565b604051610e189061232a565b6040518091039020831480610e3f5750604051610e3490612310565b604051809103902083145b80610e5c5750604051610e5190612343565b604051809103902083145b610e785760405162461bcd60e51b81526004016108e990612a85565b610e848361032a6117c3565b610e8e8383610a79565b505050565b6000610ea1816104f76117bf565b600190610ec15760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b038216610ee85760405162461bcd60e51b81526004016108e990612824565b600c80546001600160a01b0319166001600160a01b0384161790556040517f75fd3aa5d9b6e2a8a9d8894008c9263200713f4b1fa9113665e09ceac002774690610948908490612357565b6000610f41816104f76117bf565b600190610f615760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b038216610f885760405162461bcd60e51b81526004016108e9906127c7565b600480546001600160a01b0319166001600160a01b0384161790556040517f3df77beb5db05fcdd70a30fc8adf3f83f9501b68579455adbd100b818094039490610948908490612357565b6004546001600160a01b031681565b600a5481565b60085481565b60025460ff16156110115760405162461bcd60e51b81526004016108e990612977565b611046604051806040016040528060148152602001734368696c64455243323052656c61795374616b6560601b815250611913565b611051600089610a79565b61106e6040516110609061232a565b604051809103902088610a79565b61108b60405161107d90612310565b604051809103902087610a79565b6110a860405161109a90612343565b604051809103902086610a79565b600380546001600160a01b03199081166001600160a01b039586161790915560028054600c805490931694861694909417909155600b91909155610100600160a81b031990911661010093909216929092021760ff1916600117905550505050565b600b5481565b60405161111c90612343565b6040518091039020611130816104f76117bf565b6001906111505760405162461bcd60e51b81526004016108e9919061243c565b50600a546009546111669163ffffffff61168816565b8211156111855760405162461bcd60e51b81526004016108e990612ab7565b600c546040516001600160a01b039091169083156108fc029084906000818181858888f193505050501580156111bf573d6000803e3d6000fd5b50600a546111d3908363ffffffff61194816565b600a55600c546040517f094703abe6f34e06c217139505bcc40e39f606853962e503a74d776a28f1148f91610948916001600160a01b0390911690859061238f565b6000828152602081905260408120611233908363ffffffff61196d16565b90505b92915050565b6000828152602081905260408120611233908363ffffffff61197916565b60405161126690612310565b604051809103902081565b60405161126690612343565b600060026001600160a01b03831660009081526005602052604090206002015460ff1660038111156112ab57fe5b14156112b95750600161088f565b506000919050565b600081565b606481565b610a8382826112d86117c3565b61198e565b6001600160a01b0381166113035760405162461bcd60e51b81526004016108e99061299f565b610e8e83838361198e565b60056020526000908152604090208054600182015460029092015490919060ff1683565b600081815260208190526040812061123690611bbf565b600082815260208190526040902060020154611367906104f76117bf565b610abf5760405162461bcd60e51b81526004016108e990612777565b60405161138f9061232a565b60405180910390206113a3816104f76117bf565b6001906113c35760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b0383166000908152600560205260409020548211156113fc5760405162461bcd60e51b81526004016108e9906126b0565b60026001600160a01b03841660009081526005602052604090206002015460ff16600381111561142857fe5b148061145d575060036001600160a01b03841660009081526005602052604090206002015460ff16600381111561145b57fe5b145b6114795760405162461bcd60e51b81526004016108e990612943565b6001600160a01b0383166000908152600560205260409020546114a2908363ffffffff61168816565b6001600160a01b0384166000908152600560205260409020556009546114ce908363ffffffff61194816565b6009556008546114e4908363ffffffff61168816565b6008556001600160a01b038316600081815260056020526040908190205490517f79518e3d01d758cc6d21a6b9e3498ab383ef7832972db6eae679df281c9bfc9c9161153291869190612b97565b60405180910390a2505050565b60025461010090046001600160a01b031681565b6040516112669061232a565b600c546001600160a01b031681565b60405161157a90612310565b604051809103902061158e816104f76117bf565b6001906115ae5760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b0382166115d55760405162461bcd60e51b81526004016108e990612557565b60016001600160a01b03831660009081526005602052604090206002015460ff16600381111561160157fe5b1461161e5760405162461bcd60e51b81526004016108e990612943565b61162f60068363ffffffff611bca16565b506001600160a01b0382166000818152600560205260408082206002908101805460ff19169091179055517f237d1a6f3f645c45fc6ce49cd7ae78896cf1f273ac0b7daa8e503d5552b593d79190a25050565b60095481565b6000828211156116aa5760405162461bcd60e51b81526004016108e990612679565b50900390565b6000826116bf57506000611236565b828202828482816116cc57fe5b04146112335760405162461bcd60e51b81526004016108e9906128b9565b600080821161170b5760405162461bcd60e51b81526004016108e990612740565b81838161171457fe5b049392505050565b8054606090829067ffffffffffffffff8111801561173957600080fd5b50604051908082528060200260200182016040528015611763578160200160208202803683370190505b50915060005b81548110156117b85781818154811061177e57fe5b906000526020600020015460001c83828151811061179857fe5b6001600160a01b0390921660209283029190910190910152600101611769565b5050919050565b3390565b60003330141561181b5760606000368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b031691506108a39050565b503390565b6000611233836001600160a01b038416611bdf565b6000828152602081905260409020611853908263ffffffff611bca16565b15610a83576118606117bf565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020819052604090206118c2908263ffffffff611ca716565b15610a83576118cf6117bf565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b8060405160200161192491906122cf565b60405160208183030381529060405260019080519060200190610a83929190612054565b6000828201838110156112335760405162461bcd60e51b81526004016108e990612642565b60006112338383611cbc565b6000611233836001600160a01b038416611d01565b6001600160a01b03811660009081526005602052604090206003600282015460ff1660038111156119bb57fe5b14156119d95760405162461bcd60e51b81526004016108e990612943565b6001600160a01b03841661101014806119ff57506003546001600160a01b038581169116145b80611a1c57506002546001600160a01b0385811661010090920416145b611a385760405162461bcd60e51b81526004016108e9906125b4565b6001600160a01b0384166110101415611a6a57348314611a6a5760405162461bcd60e51b81526004016108e990612881565b6002546001600160a01b03858116610100909204161480611a9857506003546001600160a01b038581169116145b15611b1f57611ac0611aa86117c3565b6001600160a01b03861690308663ffffffff611d1916565b6040516374d945d960e01b81526001600160a01b038516906374d945d990611aec908690600401612400565b600060405180830381600087803b158015611b0657600080fd5b505af1158015611b1a573d6000803e3d6000fd5b505050505b600854611b32908463ffffffff61194816565b6008558054611b47908463ffffffff61194816565b81556000600282015460ff166003811115611b5e57fe5b1415611b745760028101805460ff191660011790555b80546040516001600160a01b038416917f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b691611bb1918791612b97565b60405180910390a250505050565b600061123682611d77565b6000611233836001600160a01b038416611d7b565b60008181526001830160205260408120548015611c9d5783546000198083019101808214611c57576000866000018281548110611c1857fe5b9060005260206000200154905080876000018481548110611c3557fe5b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611c6257fe5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611236565b6000915050611236565b6000611233836001600160a01b038416611dc5565b81546000908210611cdf5760405162461bcd60e51b81526004016108e9906124c6565b826000018281548110611cee57fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b611d71846323b872dd60e01b858585604051602401611d3a9392919061236b565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611e81565b50505050565b5490565b6000611d878383611d01565b611dbd57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611236565b506000611236565b60008181526001830160205260408120548015611c9d5783546000198083019190810190600090879083908110611df857fe5b9060005260206000200154905080876000018481548110611e1557fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080611e4557fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611236565b6060611ed6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f109092919063ffffffff16565b805190915015610e8e5780806020019051810190611ef491906121d2565b610e8e5760405162461bcd60e51b81526004016108e990612afe565b6060611f1f8484600085611f29565b90505b9392505050565b606082471015611f4b5760405162461bcd60e51b81526004016108e9906126fa565b611f5485611fea565b611f705760405162461bcd60e51b81526004016108e9906129fc565b60006060866001600160a01b03168587604051611f8d91906122b3565b60006040518083038185875af1925050503d8060008114611fca576040519150601f19603f3d011682016040523d82523d6000602084013e611fcf565b606091505b5091509150611fdf828286611ff0565b979650505050505050565b3b151590565b60608315611fff575081611f22565b82511561200f5782518084602001fd5b8160405162461bcd60e51b81526004016108e99190612409565b604051806060016040528060008152602001600081526020016000600381111561204f57fe5b905290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061209557805160ff19168380011785556120c2565b828001600101855582156120c2579182015b828111156120c25782518255916020019190600101906120a7565b506120ce9291506120d2565b5090565b6108a391905b808211156120ce57600081556001016120d8565b6000602082840312156120fd578081fd5b813561123381612c03565b600080600080600080600080610100898b031215612124578384fd5b883561212f81612c03565b9750602089013561213f81612c03565b9650604089013561214f81612c03565b9550606089013561215f81612c03565b9450608089013561216f81612c03565b935060a089013561217f81612c03565b925060c089013561218f81612c03565b8092505060e089013590509295985092959890939650565b600080604083850312156121b9578182fd5b82356121c481612c03565b946020939093013593505050565b6000602082840312156121e3578081fd5b81518015158114611233578182fd5b600060208284031215612203578081fd5b5035919050565b6000806040838503121561221c578182fd5b82359150602083013561222e81612c03565b809150509250929050565b6000806040838503121561224b578182fd5b50508035926020909101359150565b60008060006060848603121561226e578283fd5b833561227981612c03565b925060208401359150604084013561229081612c03565b809150509250925092565b6000602082840312156122ac578081fd5b5051919050565b600082516122c5818460208701612bd7565b9190910192915050565b600082516122e1818460208701612bd7565b7f3a20494e53554646494349454e545f5045524d495353494f4e53000000000000920191825250601a01919050565b6d434f4d4d554e4954595f524f4c4560901b8152600e0190565b6c4f50455241544f525f524f4c4560981b8152600d0190565b6743464f5f524f4c4560c01b815260080190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156123e95783516001600160a01b0316835292840192918401916001016123c4565b50909695505050505050565b901515815260200190565b90815260200190565b6000602082528251806020840152612428816040850160208701612bd7565b601f01601f19169190910160400192915050565b600060208083018184528285546001808216600081146124635760018114612481576124b9565b60028304607f16855260ff19831660408901526060880193506124b9565b600283048086526124918a612bcb565b885b828110156124af5781548b820160400152908401908801612493565b8a01604001955050505b5091979650505050505050565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252602f908201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60408201526e0818591b5a5b881d1bc819dc985b9d608a1b606082015260800190565b60208082526038908201527f4368696c64455243323052656c61795374616b653a2072656c6179657220736860408201527f6f756c64206e6f74206265207a65726f20616464726573730000000000000000606082015260800190565b6020808252602b90820152600080516020612c1c83398151915260408201526a627474206164647265737360a81b606082015260800190565b60208082526035908201527f4368696c64455243323052656c61795374616b653a20726f6c652073686f756c60408201527464206e6f74206265207a65726f206164647265737360581b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252602a908201527f4368696c64455243323052656c61795374616b653a2065786365656473207374604082015269185ad948185b5bdd5b9d60b21b606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526030908201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60408201526f2061646d696e20746f207265766f6b6560801b606082015260800190565b6020808252603a908201527f4368696c64455243323052656c61795374616b653a206f7261636c654e65772060408201527f73686f756c64206e6f74206265207a65726f2061646472657373000000000000606082015260800190565b6020808252603c908201527f4368696c64455243323052656c61795374616b653a2072656365697665724e6560408201527f772073686f756c64206e6f74206265207a65726f206164647265737300000000606082015260800190565b6020808252602a90820152600080516020612c1c833981519152604082015269189d1d08185b5bdd5b9d60b21b606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526029908201527f4368696c64455243323052656c61795374616b653a206e656564206e6f6e2d7a60408201526865726f2076616c756560b81b606082015260800190565b6020808252602690820152600080516020612c1c83398151915260408201526573746174757360d01b606082015260800190565b6020808252600e908201526d185b1c9958591e481a5b9a5d195960921b604082015260600190565b6020808252603e908201527f4368696c64455243323052656c61795374616b653a2074617267657452656c6160408201527f7965722073686f756c64206e6f74206265207a65726f20616464726573730000606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526032908201527f4368696c64455243323052656c61795374616b653a206c657373207468616e206040820152711b1a5b5a5d081d1a5b59525b9d195c9d985b60721b606082015260800190565b6020808252602490820152600080516020612c1c833981519152604082015263726f6c6560e01b606082015260800190565b60208082526027908201527f4368696c64455243323052656c61795374616b653a20657863656564732070656040820152666e616c2073756d60c81b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602f908201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560408201526e103937b632b9903337b91039b2b63360891b606082015260800190565b918252602082015260400190565b838152602081018390526060810160048310612bbd57fe5b826040830152949350505050565b60009081526020902090565b60005b83811015612bf2578181015183820152602001612bda565b83811115611d715750506000910152565b6001600160a01b0381168114612c1857600080fd5b5056fe4368696c64455243323052656c61795374616b653a20696e636f727265637420a264697066735822122027bfb65edced3b87a434524f8e30a19104c7623dbccd819d51d9bb143c5a185a64736f6c63430006060033

Deployed Bytecode

0x6080604052600436106102345760003560e01c80638f5164381161012e578063b16b3699116100ab578063df7eb5911161006f578063df7eb59114610625578063f5b541a61461063a578063f7260d3e1461064f578063f7485ffd14610664578063fb9ca751146106845761023b565b8063b16b369914610583578063b211568114610596578063ca15c873146105c5578063d547741f146105e5578063d8e423b2146106055761023b565b80639f6f50ed116100f25780639f6f50ed146105115780639f8a13d714610526578063a217fddf14610546578063aaf5eb681461055b578063adc9772e146105705761023b565b80638f516438146104875780638f88708b1461049c5780639010d07c146104bc57806391d14854146104dc5780639aa77731146104fc5761023b565b806359c153be116101bc5780637adbf973116101805780637adbf973146104085780637dc0d1d0146104285780637de2c4e41461043d578063817b1cd21461045257806388301911146104675761023b565b806359c153be1461037c5780635a2782801461039157806366d4cf48146103b357806370ed5d3a146103c8578063718da7ee146103e85761023b565b80632def6620116102035780632def6620146102da5780632f2ff15d146102ef57806336568abe1461030f5780633f1ea9ba1461032f5780634bb911c71461035c5761023b565b80630b5c704414610240578063179ff4b214610276578063248a9ca31461029857806325423a1b146102b85761023b565b3661023b57005b600080fd5b34801561024c57600080fd5b5061026061025b3660046120ec565b610699565b60405161026d9190612400565b60405180910390f35b34801561028257600080fd5b5061028b610894565b60405161026d91906123a8565b3480156102a457600080fd5b506102606102b33660046121f2565b6108a6565b3480156102c457600080fd5b506102d86102d33660046121f2565b6108bb565b005b3480156102e657600080fd5b506102d8610954565b3480156102fb57600080fd5b506102d861030a36600461220a565b610a3f565b34801561031b57600080fd5b506102d861032a36600461220a565b610a87565b34801561033b57600080fd5b5061034f61034a3660046120ec565b610ac9565b60405161026d91906123f5565b34801561036857600080fd5b506102606103773660046120ec565b610bb0565b34801561038857600080fd5b506102d8610bcb565b34801561039d57600080fd5b506103a6610da3565b60405161026d9190612357565b3480156103bf57600080fd5b506103a6610db2565b3480156103d457600080fd5b506102d86103e336600461220a565b610db8565b3480156103f457600080fd5b506102d86104033660046120ec565b610e93565b34801561041457600080fd5b506102d86104233660046120ec565b610f33565b34801561043457600080fd5b506103a6610fd3565b34801561044957600080fd5b50610260610fe2565b34801561045e57600080fd5b50610260610fe8565b34801561047357600080fd5b506102d8610482366004612108565b610fee565b34801561049357600080fd5b5061026061110a565b3480156104a857600080fd5b506102d86104b73660046121f2565b611110565b3480156104c857600080fd5b506103a66104d7366004612239565b611215565b3480156104e857600080fd5b5061034f6104f736600461220a565b61123c565b34801561050857600080fd5b5061026061125a565b34801561051d57600080fd5b50610260611271565b34801561053257600080fd5b5061034f6105413660046120ec565b61127d565b34801561055257600080fd5b506102606112c1565b34801561056757600080fd5b506102606112c6565b6102d861057e3660046121a7565b6112cb565b6102d861059136600461225a565b6112dd565b3480156105a257600080fd5b506105b66105b13660046120ec565b61130e565b60405161026d93929190612ba5565b3480156105d157600080fd5b506102606105e03660046121f2565b611332565b3480156105f157600080fd5b506102d861060036600461220a565b611349565b34801561061157600080fd5b506102d86106203660046121a7565b611383565b34801561063157600080fd5b506103a661153f565b34801561064657600080fd5b50610260611553565b34801561065b57600080fd5b506103a661155f565b34801561067057600080fd5b506102d861067f3660046120ec565b61156e565b34801561069057600080fd5b50610260611682565b6001600160a01b0380821660009081526005602090815260408083205460048054835163c41f6d5f60e01b81529351959692958795919093169363c41f6d5f93818401939091829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b919061229b565b90506000600460009054906101000a90046001600160a01b03166001600160a01b031663f51e181a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561077d57600080fd5b505afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b5919061229b565b90506000600460009054906101000a90046001600160a01b03166001600160a01b031663df272bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561080757600080fd5b505afa15801561081b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083f919061229b565b90508284106108865761087b8161086f848160646108638a8a63ffffffff61168816565b9063ffffffff6116b016565b9063ffffffff6116ea16565b94505050505061088f565b60009450505050505b919050565b60606108a0600661171c565b90505b90565b60009081526020819052604090206002015490565b60006108c9816104f76117bf565b6001906108f25760405162461bcd60e51b81526004016108e9919061243c565b60405180910390fd5b50600082116109135760405162461bcd60e51b81526004016108e9906128fa565b600b8290556040517f3aa1f99724613750b559470daa4b1e9741d847eb9d6e4f03686085c86f1d2b0c90610948908490612400565b60405180910390a15050565b600061095e6117c3565b905060026001600160a01b03821660009081526005602052604090206002015460ff16600381111561098c57fe5b146109a95760405162461bcd60e51b81526004016108e990612943565b6001600160a01b038116600090815260056020526040902060028101805460ff19166003179055426001909101556109e2600682611820565b506001600160a01b0381166000818152600560205260409081902054600b5491517f54a9763035584fc4fcad1bc4e0e7a83f93e016f50ae32bd527530a77257393ee92610a3492914290910190612b97565b60405180910390a250565b600082815260208190526040902060020154610a5d906104f76117bf565b610a795760405162461bcd60e51b81526004016108e990612508565b610a838282611835565b5050565b610a8f6117bf565b6001600160a01b0316816001600160a01b031614610abf5760405162461bcd60e51b81526004016108e990612b48565b610a8382826118a4565b600480546040805163c41f6d5f60e01b8152905160009384936001600160a01b03169263c41f6d5f9281830192602092829003018186803b158015610b0d57600080fd5b505afa158015610b21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b45919061229b565b905060026001600160a01b03841660009081526005602052604090206002015460ff166003811115610b7357fe5b148015610b9857506001600160a01b0383166000908152600560205260409020548111155b15610ba757600191505061088f565b50600092915050565b6001600160a01b031660009081526005602052604090205490565b6000610bd56117c3565b9050610bdf612029565b6001600160a01b0382166000908152600560209081526040918290208251606081018452815481526001820154928101929092526002810154919290919083019060ff166003811115610c2e57fe5b6003811115610c3957fe5b9052509050600381604001516003811115610c5057fe5b1480610c6b5750600181604001516003811115610c6957fe5b145b610c875760405162461bcd60e51b81526004016108e990612943565b600381604001516003811115610c9957fe5b1415610cd657600b546020820151610cb890429063ffffffff61168816565b1015610cd65760405162461bcd60e51b81526004016108e990612a33565b6001600160a01b03821660009081526005602052604081208181556001810191909155600201805460ff19169055805115610d5a578051600854610d1f9163ffffffff61168816565b60085580516040516001600160a01b0384169180156108fc02916000818181858888f19350505050158015610d58573d6000803e3d6000fd5b505b816001600160a01b03167fa8e76b822fc682be77f3b1c822ea81f6bda5aed92ba82e6873bfd889f328d1d28260000151604051610d979190612400565b60405180910390a25050565b6003546001600160a01b031681565b61101081565b81610dc5816104f76117bf565b600190610de55760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b038216610e0c5760405162461bcd60e51b81526004016108e9906125ed565b604051610e189061232a565b6040518091039020831480610e3f5750604051610e3490612310565b604051809103902083145b80610e5c5750604051610e5190612343565b604051809103902083145b610e785760405162461bcd60e51b81526004016108e990612a85565b610e848361032a6117c3565b610e8e8383610a79565b505050565b6000610ea1816104f76117bf565b600190610ec15760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b038216610ee85760405162461bcd60e51b81526004016108e990612824565b600c80546001600160a01b0319166001600160a01b0384161790556040517f75fd3aa5d9b6e2a8a9d8894008c9263200713f4b1fa9113665e09ceac002774690610948908490612357565b6000610f41816104f76117bf565b600190610f615760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b038216610f885760405162461bcd60e51b81526004016108e9906127c7565b600480546001600160a01b0319166001600160a01b0384161790556040517f3df77beb5db05fcdd70a30fc8adf3f83f9501b68579455adbd100b818094039490610948908490612357565b6004546001600160a01b031681565b600a5481565b60085481565b60025460ff16156110115760405162461bcd60e51b81526004016108e990612977565b611046604051806040016040528060148152602001734368696c64455243323052656c61795374616b6560601b815250611913565b611051600089610a79565b61106e6040516110609061232a565b604051809103902088610a79565b61108b60405161107d90612310565b604051809103902087610a79565b6110a860405161109a90612343565b604051809103902086610a79565b600380546001600160a01b03199081166001600160a01b039586161790915560028054600c805490931694861694909417909155600b91909155610100600160a81b031990911661010093909216929092021760ff1916600117905550505050565b600b5481565b60405161111c90612343565b6040518091039020611130816104f76117bf565b6001906111505760405162461bcd60e51b81526004016108e9919061243c565b50600a546009546111669163ffffffff61168816565b8211156111855760405162461bcd60e51b81526004016108e990612ab7565b600c546040516001600160a01b039091169083156108fc029084906000818181858888f193505050501580156111bf573d6000803e3d6000fd5b50600a546111d3908363ffffffff61194816565b600a55600c546040517f094703abe6f34e06c217139505bcc40e39f606853962e503a74d776a28f1148f91610948916001600160a01b0390911690859061238f565b6000828152602081905260408120611233908363ffffffff61196d16565b90505b92915050565b6000828152602081905260408120611233908363ffffffff61197916565b60405161126690612310565b604051809103902081565b60405161126690612343565b600060026001600160a01b03831660009081526005602052604090206002015460ff1660038111156112ab57fe5b14156112b95750600161088f565b506000919050565b600081565b606481565b610a8382826112d86117c3565b61198e565b6001600160a01b0381166113035760405162461bcd60e51b81526004016108e99061299f565b610e8e83838361198e565b60056020526000908152604090208054600182015460029092015490919060ff1683565b600081815260208190526040812061123690611bbf565b600082815260208190526040902060020154611367906104f76117bf565b610abf5760405162461bcd60e51b81526004016108e990612777565b60405161138f9061232a565b60405180910390206113a3816104f76117bf565b6001906113c35760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b0383166000908152600560205260409020548211156113fc5760405162461bcd60e51b81526004016108e9906126b0565b60026001600160a01b03841660009081526005602052604090206002015460ff16600381111561142857fe5b148061145d575060036001600160a01b03841660009081526005602052604090206002015460ff16600381111561145b57fe5b145b6114795760405162461bcd60e51b81526004016108e990612943565b6001600160a01b0383166000908152600560205260409020546114a2908363ffffffff61168816565b6001600160a01b0384166000908152600560205260409020556009546114ce908363ffffffff61194816565b6009556008546114e4908363ffffffff61168816565b6008556001600160a01b038316600081815260056020526040908190205490517f79518e3d01d758cc6d21a6b9e3498ab383ef7832972db6eae679df281c9bfc9c9161153291869190612b97565b60405180910390a2505050565b60025461010090046001600160a01b031681565b6040516112669061232a565b600c546001600160a01b031681565b60405161157a90612310565b604051809103902061158e816104f76117bf565b6001906115ae5760405162461bcd60e51b81526004016108e9919061243c565b506001600160a01b0382166115d55760405162461bcd60e51b81526004016108e990612557565b60016001600160a01b03831660009081526005602052604090206002015460ff16600381111561160157fe5b1461161e5760405162461bcd60e51b81526004016108e990612943565b61162f60068363ffffffff611bca16565b506001600160a01b0382166000818152600560205260408082206002908101805460ff19169091179055517f237d1a6f3f645c45fc6ce49cd7ae78896cf1f273ac0b7daa8e503d5552b593d79190a25050565b60095481565b6000828211156116aa5760405162461bcd60e51b81526004016108e990612679565b50900390565b6000826116bf57506000611236565b828202828482816116cc57fe5b04146112335760405162461bcd60e51b81526004016108e9906128b9565b600080821161170b5760405162461bcd60e51b81526004016108e990612740565b81838161171457fe5b049392505050565b8054606090829067ffffffffffffffff8111801561173957600080fd5b50604051908082528060200260200182016040528015611763578160200160208202803683370190505b50915060005b81548110156117b85781818154811061177e57fe5b906000526020600020015460001c83828151811061179857fe5b6001600160a01b0390921660209283029190910190910152600101611769565b5050919050565b3390565b60003330141561181b5760606000368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b031691506108a39050565b503390565b6000611233836001600160a01b038416611bdf565b6000828152602081905260409020611853908263ffffffff611bca16565b15610a83576118606117bf565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020819052604090206118c2908263ffffffff611ca716565b15610a83576118cf6117bf565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b8060405160200161192491906122cf565b60405160208183030381529060405260019080519060200190610a83929190612054565b6000828201838110156112335760405162461bcd60e51b81526004016108e990612642565b60006112338383611cbc565b6000611233836001600160a01b038416611d01565b6001600160a01b03811660009081526005602052604090206003600282015460ff1660038111156119bb57fe5b14156119d95760405162461bcd60e51b81526004016108e990612943565b6001600160a01b03841661101014806119ff57506003546001600160a01b038581169116145b80611a1c57506002546001600160a01b0385811661010090920416145b611a385760405162461bcd60e51b81526004016108e9906125b4565b6001600160a01b0384166110101415611a6a57348314611a6a5760405162461bcd60e51b81526004016108e990612881565b6002546001600160a01b03858116610100909204161480611a9857506003546001600160a01b038581169116145b15611b1f57611ac0611aa86117c3565b6001600160a01b03861690308663ffffffff611d1916565b6040516374d945d960e01b81526001600160a01b038516906374d945d990611aec908690600401612400565b600060405180830381600087803b158015611b0657600080fd5b505af1158015611b1a573d6000803e3d6000fd5b505050505b600854611b32908463ffffffff61194816565b6008558054611b47908463ffffffff61194816565b81556000600282015460ff166003811115611b5e57fe5b1415611b745760028101805460ff191660011790555b80546040516001600160a01b038416917f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b691611bb1918791612b97565b60405180910390a250505050565b600061123682611d77565b6000611233836001600160a01b038416611d7b565b60008181526001830160205260408120548015611c9d5783546000198083019101808214611c57576000866000018281548110611c1857fe5b9060005260206000200154905080876000018481548110611c3557fe5b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611c6257fe5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611236565b6000915050611236565b6000611233836001600160a01b038416611dc5565b81546000908210611cdf5760405162461bcd60e51b81526004016108e9906124c6565b826000018281548110611cee57fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b611d71846323b872dd60e01b858585604051602401611d3a9392919061236b565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611e81565b50505050565b5490565b6000611d878383611d01565b611dbd57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611236565b506000611236565b60008181526001830160205260408120548015611c9d5783546000198083019190810190600090879083908110611df857fe5b9060005260206000200154905080876000018481548110611e1557fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080611e4557fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611236565b6060611ed6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f109092919063ffffffff16565b805190915015610e8e5780806020019051810190611ef491906121d2565b610e8e5760405162461bcd60e51b81526004016108e990612afe565b6060611f1f8484600085611f29565b90505b9392505050565b606082471015611f4b5760405162461bcd60e51b81526004016108e9906126fa565b611f5485611fea565b611f705760405162461bcd60e51b81526004016108e9906129fc565b60006060866001600160a01b03168587604051611f8d91906122b3565b60006040518083038185875af1925050503d8060008114611fca576040519150601f19603f3d011682016040523d82523d6000602084013e611fcf565b606091505b5091509150611fdf828286611ff0565b979650505050505050565b3b151590565b60608315611fff575081611f22565b82511561200f5782518084602001fd5b8160405162461bcd60e51b81526004016108e99190612409565b604051806060016040528060008152602001600081526020016000600381111561204f57fe5b905290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061209557805160ff19168380011785556120c2565b828001600101855582156120c2579182015b828111156120c25782518255916020019190600101906120a7565b506120ce9291506120d2565b5090565b6108a391905b808211156120ce57600081556001016120d8565b6000602082840312156120fd578081fd5b813561123381612c03565b600080600080600080600080610100898b031215612124578384fd5b883561212f81612c03565b9750602089013561213f81612c03565b9650604089013561214f81612c03565b9550606089013561215f81612c03565b9450608089013561216f81612c03565b935060a089013561217f81612c03565b925060c089013561218f81612c03565b8092505060e089013590509295985092959890939650565b600080604083850312156121b9578182fd5b82356121c481612c03565b946020939093013593505050565b6000602082840312156121e3578081fd5b81518015158114611233578182fd5b600060208284031215612203578081fd5b5035919050565b6000806040838503121561221c578182fd5b82359150602083013561222e81612c03565b809150509250929050565b6000806040838503121561224b578182fd5b50508035926020909101359150565b60008060006060848603121561226e578283fd5b833561227981612c03565b925060208401359150604084013561229081612c03565b809150509250925092565b6000602082840312156122ac578081fd5b5051919050565b600082516122c5818460208701612bd7565b9190910192915050565b600082516122e1818460208701612bd7565b7f3a20494e53554646494349454e545f5045524d495353494f4e53000000000000920191825250601a01919050565b6d434f4d4d554e4954595f524f4c4560901b8152600e0190565b6c4f50455241544f525f524f4c4560981b8152600d0190565b6743464f5f524f4c4560c01b815260080190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156123e95783516001600160a01b0316835292840192918401916001016123c4565b50909695505050505050565b901515815260200190565b90815260200190565b6000602082528251806020840152612428816040850160208701612bd7565b601f01601f19169190910160400192915050565b600060208083018184528285546001808216600081146124635760018114612481576124b9565b60028304607f16855260ff19831660408901526060880193506124b9565b600283048086526124918a612bcb565b885b828110156124af5781548b820160400152908401908801612493565b8a01604001955050505b5091979650505050505050565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252602f908201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60408201526e0818591b5a5b881d1bc819dc985b9d608a1b606082015260800190565b60208082526038908201527f4368696c64455243323052656c61795374616b653a2072656c6179657220736860408201527f6f756c64206e6f74206265207a65726f20616464726573730000000000000000606082015260800190565b6020808252602b90820152600080516020612c1c83398151915260408201526a627474206164647265737360a81b606082015260800190565b60208082526035908201527f4368696c64455243323052656c61795374616b653a20726f6c652073686f756c60408201527464206e6f74206265207a65726f206164647265737360581b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252602a908201527f4368696c64455243323052656c61795374616b653a2065786365656473207374604082015269185ad948185b5bdd5b9d60b21b606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526030908201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60408201526f2061646d696e20746f207265766f6b6560801b606082015260800190565b6020808252603a908201527f4368696c64455243323052656c61795374616b653a206f7261636c654e65772060408201527f73686f756c64206e6f74206265207a65726f2061646472657373000000000000606082015260800190565b6020808252603c908201527f4368696c64455243323052656c61795374616b653a2072656365697665724e6560408201527f772073686f756c64206e6f74206265207a65726f206164647265737300000000606082015260800190565b6020808252602a90820152600080516020612c1c833981519152604082015269189d1d08185b5bdd5b9d60b21b606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526029908201527f4368696c64455243323052656c61795374616b653a206e656564206e6f6e2d7a60408201526865726f2076616c756560b81b606082015260800190565b6020808252602690820152600080516020612c1c83398151915260408201526573746174757360d01b606082015260800190565b6020808252600e908201526d185b1c9958591e481a5b9a5d195960921b604082015260600190565b6020808252603e908201527f4368696c64455243323052656c61795374616b653a2074617267657452656c6160408201527f7965722073686f756c64206e6f74206265207a65726f20616464726573730000606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526032908201527f4368696c64455243323052656c61795374616b653a206c657373207468616e206040820152711b1a5b5a5d081d1a5b59525b9d195c9d985b60721b606082015260800190565b6020808252602490820152600080516020612c1c833981519152604082015263726f6c6560e01b606082015260800190565b60208082526027908201527f4368696c64455243323052656c61795374616b653a20657863656564732070656040820152666e616c2073756d60c81b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602f908201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560408201526e103937b632b9903337b91039b2b63360891b606082015260800190565b918252602082015260400190565b838152602081018390526060810160048310612bbd57fe5b826040830152949350505050565b60009081526020902090565b60005b83811015612bf2578181015183820152602001612bda565b83811115611d715750506000910152565b6001600160a01b0381168114612c1857600080fd5b5056fe4368696c64455243323052656c61795374616b653a20696e636f727265637420a264697066735822122027bfb65edced3b87a434524f8e30a19104c7623dbccd819d51d9bb143c5a185a64736f6c63430006060033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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