OP Sepolia Testnet

Contract

0x2B27C30C5f3E2717252277151a2a1ca5025b3A3A

Overview

ETH Balance

0 ETH

Token Holdings

Sponsored

Transaction Hash
Method
Block
From
To
Value
Node Withdraw90562752024-03-08 16:24:5039 days ago1709915090IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90562742024-03-08 16:24:4839 days ago1709915088IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90562722024-03-08 16:24:4439 days ago1709915084IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90559752024-03-08 16:14:5039 days ago1709914490IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90559742024-03-08 16:14:4839 days ago1709914488IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90559722024-03-08 16:14:4439 days ago1709914484IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90556752024-03-08 16:04:5039 days ago1709913890IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90556742024-03-08 16:04:4839 days ago1709913888IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90556722024-03-08 16:04:4439 days ago1709913884IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90553752024-03-08 15:54:5039 days ago1709913290IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90553742024-03-08 15:54:4839 days ago1709913288IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90553722024-03-08 15:54:4439 days ago1709913284IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90547752024-03-08 15:34:5039 days ago1709912090IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90547742024-03-08 15:34:4839 days ago1709912088IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90547722024-03-08 15:34:4439 days ago1709912084IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90544722024-03-08 15:24:4439 days ago1709911484IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90541752024-03-08 15:14:5039 days ago1709910890IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90541742024-03-08 15:14:4839 days ago1709910888IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90541722024-03-08 15:14:4439 days ago1709910884IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90538752024-03-08 15:04:5039 days ago1709910290IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90538742024-03-08 15:04:4839 days ago1709910288IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90538722024-03-08 15:04:4439 days ago1709910284IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90535742024-03-08 14:54:4839 days ago1709909688IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90535722024-03-08 14:54:4439 days ago1709909684IN
0x2B27C30C...5025b3A3A
0 ETH0.000000070.00100025
Node Withdraw90532812024-03-08 14:45:0239 days ago1709909102IN
0x2B27C30C...5025b3A3A
0 ETH0.000000020.00100025
View all transactions

Advanced mode:
Parent Txn Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ControllerOracle

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 300 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 14 : ControllerOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IERC20, SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol";
import {Initializable} from "openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import {IControllerOracle} from "./interfaces/IControllerOracle.sol";
import {IOPCrossDomainMessenger} from "./interfaces/IOPCrossDomainMessenger.sol";
import {IAdapter} from "./interfaces/IAdapter.sol";
// solhint-disable-next-line no-global-import
import "./utils/Utils.sol" as Utils;

contract ControllerOracle is Initializable, IControllerOracle, OwnableUpgradeable {
    using SafeERC20 for IERC20;

    struct GroupData {
        uint256 epoch;
        uint256 groupCount;
        mapping(uint256 => Group) groups; // group_index => Group struct
        uint256 idealNumberOfGroups;
        uint256 groupMaxCapacity;
        uint256 defaultNumberOfCommitters;
    }

    // *Constants*
    uint16 private constant _BALANCE_BASE = 1;

    // *Controller Config*
    IERC20 private _arpa;
    address private _chainMessenger;
    IOPCrossDomainMessenger private _l2CrossDomainMessenger;
    address private _adapterContractAddress;

    // *Node State Variables*
    mapping(address => uint256) private _withdrawableEths; // maps node address to withdrawable eth amount
    mapping(address => uint256) private _arpaRewards; // maps node address to arpa rewards

    // *Group Variables*
    GroupData internal _groupData;

    // *Task Variables*
    uint256 private _lastOutput;

    // *Events*
    event NodeRewarded(address indexed nodeAddress, uint256 ethAmount, uint256 arpaAmount);
    event GroupUpdated(
        uint256 epoch, uint256 indexed groupIndex, uint256 indexed groupEpoch, address indexed committer
    );

    // *Errors*
    error GroupObsolete(uint256 groupIndex, uint256 relayedGroupEpoch, uint256 currentGroupEpoch);
    error SenderNotAdapter();
    error SenderNotChainMessenger();
    error InvalidZeroAddress();

    function initialize(
        address arpa,
        address chainMessenger,
        address l2CrossDomainMessenger,
        address adapterContractAddress,
        uint256 lastOutput
    ) public initializer {
        _arpa = IERC20(arpa);
        _chainMessenger = chainMessenger;
        _l2CrossDomainMessenger = IOPCrossDomainMessenger(l2CrossDomainMessenger);
        _adapterContractAddress = adapterContractAddress;
        _lastOutput = lastOutput;

        __Ownable_init();
    }

    function updateGroup(address committer, Group memory group) external {
        if (
            msg.sender != owner()
                && (
                    msg.sender != address(_l2CrossDomainMessenger)
                        || _l2CrossDomainMessenger.xDomainMessageSender() != _chainMessenger
                )
        ) {
            revert SenderNotChainMessenger();
        }

        uint256 groupIndex = group.index;

        if (group.epoch <= _groupData.groups[groupIndex].epoch) {
            revert GroupObsolete(groupIndex, group.epoch, _groupData.groups[groupIndex].epoch);
        }

        _groupData.epoch++;

        if (_groupData.groups[groupIndex].epoch == 0) {
            _groupData.groupCount++;
        }

        _copyGroup(group);

        emit GroupUpdated(_groupData.epoch, groupIndex, group.epoch, committer);
    }

    function setChainMessenger(address chainMessenger) external onlyOwner {
        if (chainMessenger == address(0)) {
            revert InvalidZeroAddress();
        }
        _chainMessenger = chainMessenger;
    }

    function setL2CrossDomainMessenger(address l2CrossDomainMessenger) external onlyOwner {
        if (l2CrossDomainMessenger == address(0)) {
            revert InvalidZeroAddress();
        }
        _l2CrossDomainMessenger = IOPCrossDomainMessenger(l2CrossDomainMessenger);
    }

    function setAdapterContractAddress(address adapterContractAddress) external onlyOwner {
        if (adapterContractAddress == address(0)) {
            revert InvalidZeroAddress();
        }
        _adapterContractAddress = adapterContractAddress;
    }

    function nodeWithdraw(address recipient) external override(IControllerOracle) {
        if (recipient == address(0)) {
            revert InvalidZeroAddress();
        }
        uint256 ethAmount = _withdrawableEths[msg.sender];
        uint256 arpaAmount = _arpaRewards[msg.sender];
        if (arpaAmount > _BALANCE_BASE) {
            _arpaRewards[msg.sender] = _BALANCE_BASE;
            _arpa.safeTransfer(recipient, arpaAmount - _BALANCE_BASE);
        }
        if (ethAmount > _BALANCE_BASE) {
            _withdrawableEths[msg.sender] = _BALANCE_BASE;
            IAdapter(_adapterContractAddress).nodeWithdrawETH(recipient, ethAmount - _BALANCE_BASE);
        }
    }

    function addReward(address[] memory nodes, uint256 ethAmount, uint256 arpaAmount)
        public
        override(IControllerOracle)
    {
        if (msg.sender != _adapterContractAddress) {
            revert SenderNotAdapter();
        }
        for (uint256 i = 0; i < nodes.length; i++) {
            _withdrawableEths[nodes[i]] += ethAmount;
            _arpaRewards[nodes[i]] += arpaAmount;
            emit NodeRewarded(nodes[i], ethAmount, arpaAmount);
        }
    }

    function setLastOutput(uint256 lastOutput) external override(IControllerOracle) {
        if (msg.sender != _adapterContractAddress) {
            revert SenderNotAdapter();
        }
        _lastOutput = lastOutput;
    }

    function getValidGroupIndices() public view override(IControllerOracle) returns (uint256[] memory) {
        uint256[] memory groupIndices = new uint256[](_groupData.groupCount); //max length is group count
        uint256 index = 0;
        for (uint256 i = 0; i < _groupData.groupCount; i++) {
            Group memory g = _groupData.groups[i];
            if (g.isStrictlyMajorityConsensusReached) {
                groupIndices[index] = i;
                index++;
            }
        }

        return Utils.trimTrailingElements(groupIndices, index);
    }

    function getGroupEpoch() external view override(IControllerOracle) returns (uint256) {
        return _groupData.epoch;
    }

    function getGroupCount() external view override(IControllerOracle) returns (uint256) {
        return _groupData.groupCount;
    }

    function getGroup(uint256 groupIndex) public view override(IControllerOracle) returns (Group memory) {
        return _groupData.groups[groupIndex];
    }

    function getGroupThreshold(uint256 groupIndex) public view override(IControllerOracle) returns (uint256, uint256) {
        return (_groupData.groups[groupIndex].threshold, _groupData.groups[groupIndex].size);
    }

    function getMember(uint256 groupIndex, uint256 memberIndex)
        public
        view
        override(IControllerOracle)
        returns (Member memory)
    {
        return _groupData.groups[groupIndex].members[memberIndex];
    }

    function getBelongingGroup(address nodeAddress)
        external
        view
        override(IControllerOracle)
        returns (int256, int256)
    {
        for (uint256 i = 0; i < _groupData.groupCount; i++) {
            int256 memberIndex = _getMemberIndexByAddress(i, nodeAddress);
            if (memberIndex != -1) {
                return (int256(i), memberIndex);
            }
        }
        return (-1, -1);
    }

    function getNodeWithdrawableTokens(address nodeAddress)
        public
        view
        override(IControllerOracle)
        returns (uint256, uint256)
    {
        return (
            _withdrawableEths[nodeAddress] == 0 ? 0 : (_withdrawableEths[nodeAddress] - _BALANCE_BASE),
            _arpaRewards[nodeAddress] == 0 ? 0 : (_arpaRewards[nodeAddress] - _BALANCE_BASE)
        );
    }

    function getLastOutput() external view returns (uint256) {
        return _lastOutput;
    }

    function _copyGroup(Group memory group) internal {
        Group storage g = _groupData.groups[group.index];
        g.index = group.index;
        g.epoch = group.epoch;
        g.threshold = group.threshold;
        g.size = group.size;
        g.isStrictlyMajorityConsensusReached = group.isStrictlyMajorityConsensusReached;
        delete g.members;
        for (uint256 i = 0; i < group.size; i++) {
            address memberAddress = group.members[i].nodeIdAddress;
            g.members.push(group.members[i]);
            // Initialize withdrawable eths and arpa rewards to save gas for adapter call
            if (_withdrawableEths[memberAddress] == 0 && _arpaRewards[memberAddress] == 0) {
                _withdrawableEths[memberAddress] = _BALANCE_BASE;
                _arpaRewards[memberAddress] = _BALANCE_BASE;
            }
        }
        g.committers = group.committers;
        g.publicKey = group.publicKey;
    }

    function _getMemberIndexByAddress(uint256 groupIndex, address nodeAddress) internal view returns (int256) {
        Group memory g = _groupData.groups[groupIndex];
        for (uint256 i = 0; i < g.members.length; i++) {
            if (g.members[i].nodeIdAddress == nodeAddress) {
                return int256(i);
            }
        }
        return -1;
    }
}

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

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 3 of 14 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 4 of 14 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 5 of 14 : IControllerOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IControllerOracle {
    struct Group {
        uint256 index;
        uint256 epoch;
        uint256 size;
        uint256 threshold;
        Member[] members;
        address[] committers;
        CommitCache[] commitCacheList;
        bool isStrictlyMajorityConsensusReached;
        uint256[4] publicKey;
    }

    struct Member {
        address nodeIdAddress;
        uint256[4] partialPublicKey;
    }

    struct CommitResult {
        uint256 groupEpoch;
        uint256[4] publicKey;
        address[] disqualifiedNodes;
    }

    struct CommitCache {
        address[] nodeIdAddress;
        CommitResult commitResult;
    }

    struct CommitDkgParams {
        uint256 groupIndex;
        uint256 groupEpoch;
        bytes publicKey;
        bytes partialPublicKey;
        address[] disqualifiedNodes;
    }

    // relay transaction
    function updateGroup(address committer, Group memory group) external;

    // node transaction
    function nodeWithdraw(address recipient) external;

    // adapter transaction
    function addReward(address[] memory nodes, uint256 ethAmount, uint256 arpaAmount) external;

    function setLastOutput(uint256 lastOutput) external;

    // view
    /// @notice Get list of all group indexes where group.isStrictlyMajorityConsensusReached == true
    /// @return uint256[] List of valid group indexes
    function getValidGroupIndices() external view returns (uint256[] memory);

    function getGroupEpoch() external view returns (uint256);

    function getGroupCount() external view returns (uint256);

    function getGroup(uint256 index) external view returns (Group memory);

    function getGroupThreshold(uint256 groupIndex) external view returns (uint256, uint256);

    function getMember(uint256 groupIndex, uint256 memberIndex) external view returns (Member memory);

    /// @notice Get the group index and member index of a given node.
    function getBelongingGroup(address nodeAddress) external view returns (int256, int256);

    function getNodeWithdrawableTokens(address nodeAddress) external view returns (uint256, uint256);

    function getLastOutput() external view returns (uint256);
}

File 6 of 14 : IOPCrossDomainMessenger.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IOPCrossDomainMessenger {
    function sendMessage(address _target, bytes calldata _message, uint32 _minGasLimit) external payable;

    function xDomainMessageSender() external view returns (address);
}

File 7 of 14 : IAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

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

interface IAdapter is IRequestTypeBase {
    struct PartialSignature {
        uint256 index;
        uint256 partialSignature;
    }

    struct RandomnessRequestParams {
        RequestType requestType;
        bytes params;
        uint64 subId;
        uint256 seed;
        uint16 requestConfirmations;
        uint32 callbackGasLimit;
        uint256 callbackMaxGasPrice;
    }

    struct RequestDetail {
        uint64 subId;
        uint32 groupIndex;
        RequestType requestType;
        bytes params;
        address callbackContract;
        uint256 seed;
        uint16 requestConfirmations;
        uint32 callbackGasLimit;
        uint256 callbackMaxGasPrice;
        uint256 blockNum;
    }

    // controller transaction
    function nodeWithdrawETH(address recipient, uint256 ethAmount) external;

    // consumer contract transaction
    function requestRandomness(RandomnessRequestParams calldata params) external returns (bytes32);

    function fulfillRandomness(
        uint32 groupIndex,
        bytes32 requestId,
        uint256 signature,
        RequestDetail calldata requestDetail,
        PartialSignature[] calldata partialSignatures
    ) external;

    // user transaction
    function createSubscription() external returns (uint64);

    function addConsumer(uint64 subId, address consumer) external;

    function fundSubscription(uint64 subId) external payable;

    function setReferral(uint64 subId, uint64 referralSubId) external;

    function cancelSubscription(uint64 subId, address to) external;

    function removeConsumer(uint64 subId, address consumer) external;

    // delete the request that cannot be fulfilled, triggered by user themselves
    function cancelOvertimeRequest(bytes32 requestId, RequestDetail calldata requestDetail) external;

    // view
    function getLastSubscription(address consumer) external view returns (uint64);

    function getSubscription(uint64 subId)
        external
        view
        returns (
            address owner,
            address[] memory consumers,
            uint256 balance,
            uint256 inflightCost,
            uint64 reqCount,
            uint64 freeRequestCount,
            uint64 referralSubId,
            uint64 reqCountInCurrentPeriod,
            uint256 lastRequestTimestamp
        );

    function getPendingRequestCommitment(bytes32 requestId) external view returns (bytes32);

    function getLastAssignedGroupIndex() external view returns (uint256);

    function getLastRandomness() external view returns (uint256);

    function getRandomnessCount() external view returns (uint256);

    function getCurrentSubId() external view returns (uint64);

    function getCumulativeData() external view returns (uint256, uint256, uint256);

    function getController() external view returns (address);

    function getAdapterConfig()
        external
        view
        returns (
            uint16 minimumRequestConfirmations,
            uint32 maxGasLimit,
            uint32 gasAfterPaymentCalculation,
            uint32 gasExceptCallback,
            uint256 signatureTaskExclusiveWindow,
            uint256 rewardPerSignature,
            uint256 committerRewardPerSignature
        );

    function getFlatFeeConfig()
        external
        view
        returns (
            uint32 fulfillmentFlatFeeLinkPPMTier1,
            uint32 fulfillmentFlatFeeLinkPPMTier2,
            uint32 fulfillmentFlatFeeLinkPPMTier3,
            uint32 fulfillmentFlatFeeLinkPPMTier4,
            uint32 fulfillmentFlatFeeLinkPPMTier5,
            uint24 reqsForTier2,
            uint24 reqsForTier3,
            uint24 reqsForTier4,
            uint24 reqsForTier5,
            uint16 flatFeePromotionGlobalPercentage,
            bool isFlatFeePromotionEnabledPermanently,
            uint256 flatFeePromotionStartTimestamp,
            uint256 flatFeePromotionEndTimestamp
        );

    function getReferralConfig()
        external
        view
        returns (bool isReferralEnabled, uint16 freeRequestCountForReferrer, uint16 freeRequestCountForReferee);

    /*
     * @notice Compute fee based on the request count
     * @param reqCount number of requests
     * @return feePPM fee in ARPA PPM
     */
    function getFeeTier(uint64 reqCount) external view returns (uint32);

    // Estimate the amount of gas used for fulfillment
    function estimatePaymentAmountInETH(
        uint32 callbackGasLimit,
        uint32 gasExceptCallback,
        uint32 fulfillmentFlatFeeEthPPM,
        uint256 weiPerUnitGas,
        uint32 groupSize
    ) external view returns (uint256);
}

File 8 of 14 : Utils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

// 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100)
// and some arithmetic operations.
uint256 constant GAS_FOR_CALL_EXACT_CHECK = 5_000;

function containElement(uint256[] memory arr, uint256 element) pure returns (bool) {
    for (uint256 i = 0; i < arr.length; i++) {
        if (arr[i] == element) {
            return true;
        }
    }
    return false;
}

function containElement(address[] memory arr, address element) pure returns (bool) {
    for (uint256 i = 0; i < arr.length; i++) {
        if (arr[i] == element) {
            return true;
        }
    }
    return false;
}

/**
 * @dev returns the minimum threshold for a group of size groupSize
 */
function minimumThreshold(uint256 groupSize) pure returns (uint256) {
    return groupSize / 2 + 1;
}

/**
 * @dev choose one random index from an array.
 */
function pickRandomIndex(uint256 seed, uint256 length) pure returns (uint256) {
    return uint256(keccak256(abi.encodePacked(seed))) % length;
}

/**
 * @dev choose "count" random indices from "indices" array.
 */
function pickRandomIndex(uint256 seed, uint256[] memory indices, uint256 count) pure returns (uint256[] memory) {
    uint256[] memory chosenIndices = new uint256[](count);

    // Create copy of indices to avoid modifying original array.
    uint256[] memory remainingIndices = new uint256[](indices.length);
    for (uint256 i = 0; i < indices.length; i++) {
        remainingIndices[i] = indices[i];
    }

    uint256 remainingCount = remainingIndices.length;
    for (uint256 i = 0; i < count; i++) {
        uint256 index = uint256(keccak256(abi.encodePacked(seed, i))) % remainingCount;
        chosenIndices[i] = remainingIndices[index];
        remainingIndices[index] = remainingIndices[remainingCount - 1];
        remainingCount--;
    }
    return chosenIndices;
}

/**
 * @dev iterates through list of members and remove disqualified nodes.
 */
function getNonDisqualifiedMajorityMembers(address[] memory nodeAddresses, address[] memory disqualifiedNodes)
    pure
    returns (address[] memory)
{
    address[] memory majorityMembers = new address[](nodeAddresses.length);
    uint256 majorityMembersLength = 0;
    for (uint256 i = 0; i < nodeAddresses.length; i++) {
        if (!containElement(disqualifiedNodes, nodeAddresses[i])) {
            majorityMembers[majorityMembersLength] = nodeAddresses[i];
            majorityMembersLength++;
        }
    }

    // remove trailing zero addresses
    return trimTrailingElements(majorityMembers, majorityMembersLength);
}

function trimTrailingElements(uint256[] memory arr, uint256 newLength) pure returns (uint256[] memory) {
    uint256[] memory output = new uint256[](newLength);
    for (uint256 i = 0; i < newLength; i++) {
        output[i] = arr[i];
    }
    return output;
}

function trimTrailingElements(address[] memory arr, uint256 newLength) pure returns (address[] memory) {
    address[] memory output = new address[](newLength);
    for (uint256 i = 0; i < newLength; i++) {
        output[i] = arr[i];
    }
    return output;
}

/**
 * @dev calls target address with exactly gasAmount gas and data as calldata
 * or reverts if at least gasAmount gas is not available.
 */
function callWithExactGas(uint256 gasAmount, address target, bytes memory data) returns (bool success) {
    // solhint-disable-next-line no-inline-assembly
    assembly {
        let g := gas()
        // Compute g -= GAS_FOR_CALL_EXACT_CHECK and check for underflow
        // The gas actually passed to the callee is min(gasAmount, 63//64*gas available).
        // We want to ensure that we revert if gasAmount >  63//64*gas available
        // as we do not want to provide them with less, however that check itself costs
        // gas.  GAS_FOR_CALL_EXACT_CHECK ensures we have at least enough gas to be able
        // to revert if gasAmount >  63//64*gas available.
        if lt(g, GAS_FOR_CALL_EXACT_CHECK) { revert(0, 0) }
        g := sub(g, GAS_FOR_CALL_EXACT_CHECK)
        // if g - g//64 <= gasAmount, revert
        // (we subtract g//64 because of EIP-150)
        if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) }
        // solidity calls check that a contract actually exists at the destination, so we do the same
        if iszero(extcodesize(target)) { revert(0, 0) }
        // call and return whether we succeeded. ignore return data
        // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength)
        success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0)
    }
    return success;
}

function shuffle(uint256 upper, uint256 randomness) pure returns (uint256[] memory) {
    uint256[] memory arr = new uint256[](upper);
    for (uint256 k = 0; k < upper; k++) {
        arr[k] = k;
    }
    uint256 i = arr.length;
    uint256 j;
    uint256 t;
    while (--i > 0) {
        j = randomness % i;
        randomness = uint256(keccak256(abi.encode(randomness)));
        t = arr[i];
        arr[i] = arr[j];
        arr[j] = t;
    }
    return arr;
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 10 of 14 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

File 12 of 14 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

File 14 of 14 : IRequestTypeBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IRequestTypeBase {
    enum RequestType {
        Randomness,
        RandomWords,
        Shuffling
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "Staking-v0.1/=lib/Staking-v0.1/src/",
    "Randcast-User-Contract/=lib/Randcast-User-Contract/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "fx-portal/=lib/fx-portal/contracts/",
    "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 300
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"groupIndex","type":"uint256"},{"internalType":"uint256","name":"relayedGroupEpoch","type":"uint256"},{"internalType":"uint256","name":"currentGroupEpoch","type":"uint256"}],"name":"GroupObsolete","type":"error"},{"inputs":[],"name":"InvalidZeroAddress","type":"error"},{"inputs":[],"name":"SenderNotAdapter","type":"error"},{"inputs":[],"name":"SenderNotChainMessenger","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"groupIndex","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"groupEpoch","type":"uint256"},{"indexed":true,"internalType":"address","name":"committer","type":"address"}],"name":"GroupUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nodeAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"arpaAmount","type":"uint256"}],"name":"NodeRewarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address[]","name":"nodes","type":"address[]"},{"internalType":"uint256","name":"ethAmount","type":"uint256"},{"internalType":"uint256","name":"arpaAmount","type":"uint256"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nodeAddress","type":"address"}],"name":"getBelongingGroup","outputs":[{"internalType":"int256","name":"","type":"int256"},{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"groupIndex","type":"uint256"}],"name":"getGroup","outputs":[{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"uint256","name":"threshold","type":"uint256"},{"components":[{"internalType":"address","name":"nodeIdAddress","type":"address"},{"internalType":"uint256[4]","name":"partialPublicKey","type":"uint256[4]"}],"internalType":"struct IControllerOracle.Member[]","name":"members","type":"tuple[]"},{"internalType":"address[]","name":"committers","type":"address[]"},{"components":[{"internalType":"address[]","name":"nodeIdAddress","type":"address[]"},{"components":[{"internalType":"uint256","name":"groupEpoch","type":"uint256"},{"internalType":"uint256[4]","name":"publicKey","type":"uint256[4]"},{"internalType":"address[]","name":"disqualifiedNodes","type":"address[]"}],"internalType":"struct IControllerOracle.CommitResult","name":"commitResult","type":"tuple"}],"internalType":"struct IControllerOracle.CommitCache[]","name":"commitCacheList","type":"tuple[]"},{"internalType":"bool","name":"isStrictlyMajorityConsensusReached","type":"bool"},{"internalType":"uint256[4]","name":"publicKey","type":"uint256[4]"}],"internalType":"struct IControllerOracle.Group","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGroupCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGroupEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"groupIndex","type":"uint256"}],"name":"getGroupThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastOutput","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"groupIndex","type":"uint256"},{"internalType":"uint256","name":"memberIndex","type":"uint256"}],"name":"getMember","outputs":[{"components":[{"internalType":"address","name":"nodeIdAddress","type":"address"},{"internalType":"uint256[4]","name":"partialPublicKey","type":"uint256[4]"}],"internalType":"struct IControllerOracle.Member","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nodeAddress","type":"address"}],"name":"getNodeWithdrawableTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getValidGroupIndices","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"arpa","type":"address"},{"internalType":"address","name":"chainMessenger","type":"address"},{"internalType":"address","name":"l2CrossDomainMessenger","type":"address"},{"internalType":"address","name":"adapterContractAddress","type":"address"},{"internalType":"uint256","name":"lastOutput","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"nodeWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"adapterContractAddress","type":"address"}],"name":"setAdapterContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"chainMessenger","type":"address"}],"name":"setChainMessenger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"l2CrossDomainMessenger","type":"address"}],"name":"setL2CrossDomainMessenger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"lastOutput","type":"uint256"}],"name":"setLastOutput","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"committer","type":"address"},{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"uint256","name":"threshold","type":"uint256"},{"components":[{"internalType":"address","name":"nodeIdAddress","type":"address"},{"internalType":"uint256[4]","name":"partialPublicKey","type":"uint256[4]"}],"internalType":"struct IControllerOracle.Member[]","name":"members","type":"tuple[]"},{"internalType":"address[]","name":"committers","type":"address[]"},{"components":[{"internalType":"address[]","name":"nodeIdAddress","type":"address[]"},{"components":[{"internalType":"uint256","name":"groupEpoch","type":"uint256"},{"internalType":"uint256[4]","name":"publicKey","type":"uint256[4]"},{"internalType":"address[]","name":"disqualifiedNodes","type":"address[]"}],"internalType":"struct IControllerOracle.CommitResult","name":"commitResult","type":"tuple"}],"internalType":"struct IControllerOracle.CommitCache[]","name":"commitCacheList","type":"tuple[]"},{"internalType":"bool","name":"isStrictlyMajorityConsensusReached","type":"bool"},{"internalType":"uint256[4]","name":"publicKey","type":"uint256[4]"}],"internalType":"struct IControllerOracle.Group","name":"group","type":"tuple"}],"name":"updateGroup","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061279a806100206000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c8063715018a6116100ad578063ceb6065411610071578063ceb606541461025f578063f2fde38b1461027f578063f3df080214610292578063f49e0ba9146102a5578063f7013ef6146102d057600080fd5b8063715018a61461020c5780637ee49cfd146102145780638da5cb5b1461021c578063914eb34d14610237578063b330a0fd1461024a57600080fd5b80634bc4447b116100f45780634bc4447b146101ab5780634d79a893146101be5780634ecea80d146101de57806351a2b9a0146101f157806353d615f8146101f957600080fd5b806306545a9314610131578063227d0f46146101485780633b6c00b0146101705780634897a7301461018357806349b0889614610198575b600080fd5b606c545b6040519081526020015b60405180910390f35b61015b610156366004611ddb565b6102e3565b6040805192835260208301919091520161013f565b61015b61017e366004611ddb565b610384565b610196610191366004611ddb565b6103d5565b005b6101966101a63660046121a5565b610426565b6101966101b9366004611ddb565b6105f9565b6101d16101cc3660046122be565b61064a565b60405161013f9190612322565b6101966101ec366004611ddb565b6106e1565b607154610135565b610196610207366004611ddb565b610806565b610196610857565b606b54610135565b6033546040516001600160a01b03909116815260200161013f565b610196610245366004612330565b61086b565b6102526109c9565b60405161013f919061237e565b61027261026d3660046123c2565b610d82565b60405161013f91906124f0565b61019661028d366004611ddb565b611091565b6101966102a03660046123c2565b61110a565b61015b6102b33660046123c2565b6000908152606d6020526040902060038101546002909101549091565b6101966102de36600461259d565b61113a565b6001600160a01b03811660009081526069602052604081205481901561032d576001600160a01b03831660009081526069602052604090205461032890600190612617565b610330565b60005b6001600160a01b0384166000908152606a602052604090205415610378576001600160a01b0384166000908152606a602052604090205461037390600190612617565b61037b565b60005b91509150915091565b60008060005b606c548110156103c85760006103a0828661129f565b905080600019146103b5579094909350915050565b50806103c08161262a565b91505061038a565b5060001993849350915050565b6103dd611613565b6001600160a01b0381166104045760405163f6b2911f60e01b815260040160405180910390fd5b606880546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633148015906104d257506067546001600160a01b0316331415806104d2575060665460675460408051636e296e4560e01b815290516001600160a01b039384169390921691636e296e45916004808201926020929091908290030181865afa1580156104a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c69190612643565b6001600160a01b031614155b156104f057604051630ba6b4d160e31b815260040160405180910390fd5b80516000818152606d6020908152604090912060010154908301511161055a576020828101516000838152606d90925260409182902060010154915163699745e360e01b815260048101849052602481019190915260448101919091526064015b60405180910390fd5b606b805490600061056a8361262a565b90915550506000818152606d6020526040812060010154900361059d57606c80549060006105978361262a565b91905055505b6105a68261166d565b826001600160a01b03168260200151827f086df69ece965de938d49c9d0eca0f14e39b9d5b178e0358d27ef0fdde2672f8606b600001546040516105ec91815260200190565b60405180910390a4505050565b610601611613565b6001600160a01b0381166106285760405163f6b2911f60e01b815260040160405180910390fd5b606780546001600160a01b0319166001600160a01b0392909216919091179055565b610652611c2f565b6000838152606d6020526040902060040180548390811061067557610675612660565b6000918252602091829020604080518082018252600590930290910180546001600160a01b0316835281516080810190925291928301906001830160048282826020028201915b8154815260200190600101908083116106bc5750505050508152505090505b92915050565b6001600160a01b0381166107085760405163f6b2911f60e01b815260040160405180910390fd5b33600090815260696020908152604080832054606a90925290912054600181111561076557336000908152606a602052604090206001908190556107659084906107529084612617565b6065546001600160a01b03169190611822565b6001821115610801573360009081526069602052604090206001908190556068546001600160a01b031690630ad98f6a9085906107a29086612617565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156107e857600080fd5b505af11580156107fc573d6000803e3d6000fd5b505050505b505050565b61080e611613565b6001600160a01b0381166108355760405163f6b2911f60e01b815260040160405180910390fd5b606680546001600160a01b0319166001600160a01b0392909216919091179055565b61085f611613565b6108696000611874565b565b6068546001600160a01b031633146108965760405163469666c560e01b815260040160405180910390fd5b60005b83518110156109c35782606960008684815181106108b9576108b9612660565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546108f09190612676565b9250508190555081606a600086848151811061090e5761090e612660565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109459190612676565b9250508190555083818151811061095e5761095e612660565b60200260200101516001600160a01b03167f8353a804115421789f3ab2eeb3f5215943906ce12100c91d40fc865caf742b6f84846040516109a9929190918252602082015260400190565b60405180910390a2806109bb8161262a565b915050610899565b50505050565b60606000606b6001015467ffffffffffffffff8111156109eb576109eb611dff565b604051908082528060200260200182016040528015610a14578160200160208202803683370190505b5090506000805b606c54811015610d70576000818152606d602090815260408083208151610120810183528154815260018201548185015260028201548184015260038201546060820152600482018054845181870281018701909552808552919492936080860193909290879084015b82821015610afe5760008481526020908190206040805180820182526005860290920180546001600160a01b0316835281516080810190925291928301906001830160048282826020028201915b815481526020019060010190808311610ad35750505050508152505081526020019060010190610a85565b50505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015610b5f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610b41575b5050505050815260200160068201805480602002602001604051908101604052809291908181526020016000905b82821015610cd6578382906000526020600020906007020160405180604001604052908160008201805480602002602001604051908101604052809291908181526020018280548015610c0957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610beb575b50505091835250506040805160608101825260018401805482528251608081019384905260209485019492939192840191600287019060049082845b815481526020019060010190808311610c45575050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015610cba57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610c9c575b5050505050815250508152505081526020019060010190610b8d565b50505090825250600782015460ff1615156020820152604080516080810182529101906008830160048282826020028201915b815481526020019060010190808311610d095750505050508152505090508060e0015115610d5d5781848481518110610d4457610d44612660565b602090810291909101015282610d598161262a565b9350505b5080610d688161262a565b915050610a1b565b50610d7b82826118c6565b9250505090565b610d8a611c57565b6000828152606d602090815260408083208151610120810183528154815260018201548185015260028201548184015260038201546060820152600482018054845181870281018701909552808552919592946080870194939192919084015b82821015610e635760008481526020908190206040805180820182526005860290920180546001600160a01b0316835281516080810190925291928301906001830160048282826020028201915b815481526020019060010190808311610e385750505050508152505081526020019060010190610dea565b50505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015610ec457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610ea6575b5050505050815260200160068201805480602002602001604051908101604052809291908181526020016000905b8282101561103b578382906000526020600020906007020160405180604001604052908160008201805480602002602001604051908101604052809291908181526020018280548015610f6e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f50575b50505091835250506040805160608101825260018401805482528251608081019384905260209485019492939192840191600287019060049082845b815481526020019060010190808311610faa57505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561101f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611001575b5050505050815250508152505081526020019060010190610ef2565b50505090825250600782015460ff1615156020820152604080516080810182529101906008830160048282826020028201915b81548152602001906001019080831161106e575050505050815250509050919050565b611099611613565b6001600160a01b0381166110fe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610551565b61110781611874565b50565b6068546001600160a01b031633146111355760405163469666c560e01b815260040160405180910390fd5b607155565b600054610100900460ff161580801561115a5750600054600160ff909116105b806111745750303b158015611174575060005460ff166001145b6111d75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610551565b6000805460ff1916600117905580156111fa576000805461ff0019166101001790555b606580546001600160a01b038089166001600160a01b03199283161790925560668054888416908316179055606780548784169083161790556068805492861692909116919091179055607182905561125161196b565b8015611297576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000828152606d60209081526040808320815161012081018352815481526001820154818501526002820154818401526003820154606082015260048201805484518187028101870190955280855286959294608086019390929190879084015b828210156113795760008481526020908190206040805180820182526005860290920180546001600160a01b0316835281516080810190925291928301906001830160048282826020028201915b81548152602001906001019080831161134e5750505050508152505081526020019060010190611300565b505050508152602001600582018054806020026020016040519081016040528092919081815260200182805480156113da57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116113bc575b5050505050815260200160068201805480602002602001604051908101604052809291908181526020016000905b8282101561155157838290600052602060002090600702016040518060400160405290816000820180548060200260200160405190810160405280929190818152602001828054801561148457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611466575b50505091835250506040805160608101825260018401805482528251608081019384905260209485019492939192840191600287019060049082845b8154815260200190600101908083116114c057505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561153557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611517575b5050505050815250508152505081526020019060010190611408565b50505090825250600782015460ff1615156020820152604080516080810182529101906008830160048282826020028201915b81548152602001906001019080831161158457505050505081525050905060005b81608001515181101561160757836001600160a01b0316826080015182815181106115d2576115d2612660565b6020026020010151600001516001600160a01b0316036115f55791506106db9050565b806115ff8161262a565b9150506115a5565b50600019949350505050565b6033546001600160a01b031633146108695760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610551565b80516000908152606d602090815260408083208451815591840151600183015560608401516003830155830151600282015560e083015160078201805460ff1916911515919091179055906116c6906004830190611ca5565b60005b82604001518110156117ef576000836080015182815181106116ed576116ed612660565b6020026020010151600001519050826004018460800151838151811061171557611715612660565b602090810291909101810151825460018082018555600094855293839020825160059092020180546001600160a01b0319166001600160a01b0390921691909117815591810151909261176d91908301906004611cc6565b5050506001600160a01b0381166000908152606960205260409020541580156117ac57506001600160a01b0381166000908152606a6020526040902054155b156117dc576001600160a01b0381166000908152606960209081526040808320600190819055606a909252909120555b50806117e78161262a565b9150506116c9565b5060a0820151805161180b916005840191602090910190611d04565b506101008201516108019060088301906004611cc6565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261080190849061199a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b606060008267ffffffffffffffff8111156118e3576118e3611dff565b60405190808252806020026020018201604052801561190c578160200160208202803683370190505b50905060005b838110156119635784818151811061192c5761192c612660565b602002602001015182828151811061194657611946612660565b60209081029190910101528061195b8161262a565b915050611912565b509392505050565b600054610100900460ff166119925760405162461bcd60e51b815260040161055190612689565b610869611a6f565b60006119ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a9f9092919063ffffffff16565b9050805160001480611a10575080806020019051810190611a1091906126d4565b6108015760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610551565b600054610100900460ff16611a965760405162461bcd60e51b815260040161055190612689565b61086933611874565b6060611aae8484600085611ab6565b949350505050565b606082471015611b175760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610551565b600080866001600160a01b03168587604051611b339190612715565b60006040518083038185875af1925050503d8060008114611b70576040519150601f19603f3d011682016040523d82523d6000602084013e611b75565b606091505b5091509150611b8687838387611b91565b979650505050505050565b60608315611c00578251600003611bf9576001600160a01b0385163b611bf95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610551565b5081611aae565b611aae8383815115611c155781518083602001fd5b8060405162461bcd60e51b81526004016105519190612731565b604051806040016040528060006001600160a01b03168152602001611c52611d59565b905290565b60405180610120016040528060008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001600015158152602001611c52611d59565b50805460008255600502906000526020600020908101906111079190611d77565b8260048101928215611cf4579160200282015b82811115611cf4578251825591602001919060010190611cd9565b50611d00929150611db1565b5090565b828054828255906000526020600020908101928215611cf4579160200282015b82811115611cf457825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611d24565b60405180608001604052806004906020820280368337509192915050565b80821115611d005780546001600160a01b031916815560006001820181905560028201819055600382018190556004820155600501611d77565b5b80821115611d005760008155600101611db2565b6001600160a01b038116811461110757600080fd5b600060208284031215611ded57600080fd5b8135611df881611dc6565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611e3857611e38611dff565b60405290565b6040516060810167ffffffffffffffff81118282101715611e3857611e38611dff565b604051610120810167ffffffffffffffff81118282101715611e3857611e38611dff565b604051601f8201601f1916810167ffffffffffffffff81118282101715611eae57611eae611dff565b604052919050565b600067ffffffffffffffff821115611ed057611ed0611dff565b5060051b60200190565b600082601f830112611eeb57600080fd5b6040516080810181811067ffffffffffffffff82111715611f0e57611f0e611dff565b604052806080840185811115611f2357600080fd5b845b81811015611f3d578035835260209283019201611f25565b509195945050505050565b600082601f830112611f5957600080fd5b81356020611f6e611f6983611eb6565b611e85565b82815260a09283028501820192828201919087851115611f8d57600080fd5b8387015b85811015611fdb5781818a031215611fa95760008081fd5b611fb1611e15565b8135611fbc81611dc6565b8152611fca8a838801611eda565b818701528452928401928101611f91565b5090979650505050505050565b600082601f830112611ff957600080fd5b81356020612009611f6983611eb6565b82815260059290921b8401810191818101908684111561202857600080fd5b8286015b8481101561204c57803561203f81611dc6565b835291830191830161202c565b509695505050505050565b600082601f83011261206857600080fd5b81356020612078611f6983611eb6565b82815260059290921b8401810191818101908684111561209757600080fd5b8286015b8481101561204c57803567ffffffffffffffff808211156120bb57600080fd5b908801906040601f19838c0381018213156120d557600080fd5b6120dd611e15565b88850135848111156120ee57600080fd5b6120fc8e8b83890101611fe8565b825250828501358481111561211057600080fd5b949094019360c0858e03830112156121285760008081fd5b612130611e3e565b91508885013582526121448d848701611eda565b8983015260c08501358481111561215b5760008081fd5b6121698e8b83890101611fe8565b9383019390935280890191909152865250505091830191830161209b565b801515811461110757600080fd5b80356121a081612187565b919050565b600080604083850312156121b857600080fd5b82356121c381611dc6565b9150602083013567ffffffffffffffff808211156121e057600080fd5b9084019061018082870312156121f557600080fd5b6121fd611e61565b8235815260208301356020820152604083013560408201526060830135606082015260808301358281111561223157600080fd5b61223d88828601611f48565b60808301525060a08301358281111561225557600080fd5b61226188828601611fe8565b60a08301525060c08301358281111561227957600080fd5b61228588828601612057565b60c08301525061229760e08401612195565b60e082015261010091506122ad87838501611eda565b828201528093505050509250929050565b600080604083850312156122d157600080fd5b50508035926020909101359150565b8060005b60048110156109c35781518452602093840193909101906001016122e4565b6001600160a01b038151168252602081015161080160208401826122e0565b60a081016106db8284612303565b60008060006060848603121561234557600080fd5b833567ffffffffffffffff81111561235c57600080fd5b61236886828701611fe8565b9660208601359650604090950135949350505050565b6020808252825182820181905260009190848201906040850190845b818110156123b65783518352928401929184019160010161239a565b50909695505050505050565b6000602082840312156123d457600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561241557612402878351612303565b60a09690960195908201906001016123ef565b509495945050505050565b600081518084526020808501945080840160005b838110156124155781516001600160a01b031687529582019590820190600101612434565b600082825180855260208086019550808260051b84010181860160005b84811015611fdb57601f1986840301895281516040815181865261249c82870182612420565b90508683015192508581038787015260c083518252878401516124c1898401826122e0565b508284015193508060a08301526124da81830185612420565b9c88019c96505050928501925050600101612476565b60208152815160208201526020820151604082015260408201516060820152606082015160808201526000608083015161018060a08401526125366101a08401826123db565b905060a0840151601f19808584030160c08601526125548383612420565b925060c08601519150808584030160e0860152506125728282612459565b91505060e084015161010061258a8186018315159052565b85015190506119636101208501826122e0565b600080600080600060a086880312156125b557600080fd5b85356125c081611dc6565b945060208601356125d081611dc6565b935060408601356125e081611dc6565b925060608601356125f081611dc6565b949793965091946080013592915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106db576106db612601565b60006001820161263c5761263c612601565b5060010190565b60006020828403121561265557600080fd5b8151611df881611dc6565b634e487b7160e01b600052603260045260246000fd5b808201808211156106db576106db612601565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156126e657600080fd5b8151611df881612187565b60005b8381101561270c5781810151838201526020016126f4565b50506000910152565b600082516127278184602087016126f1565b9190910192915050565b60208152600082518060208401526127508160408501602087016126f1565b601f01601f1916919091016040019291505056fea2646970667358221220985283088ff2e45dc128061c9f4e1b2da69b1af38b7d61f4b6fd1c752bde6a0164736f6c63430008120033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063715018a6116100ad578063ceb6065411610071578063ceb606541461025f578063f2fde38b1461027f578063f3df080214610292578063f49e0ba9146102a5578063f7013ef6146102d057600080fd5b8063715018a61461020c5780637ee49cfd146102145780638da5cb5b1461021c578063914eb34d14610237578063b330a0fd1461024a57600080fd5b80634bc4447b116100f45780634bc4447b146101ab5780634d79a893146101be5780634ecea80d146101de57806351a2b9a0146101f157806353d615f8146101f957600080fd5b806306545a9314610131578063227d0f46146101485780633b6c00b0146101705780634897a7301461018357806349b0889614610198575b600080fd5b606c545b6040519081526020015b60405180910390f35b61015b610156366004611ddb565b6102e3565b6040805192835260208301919091520161013f565b61015b61017e366004611ddb565b610384565b610196610191366004611ddb565b6103d5565b005b6101966101a63660046121a5565b610426565b6101966101b9366004611ddb565b6105f9565b6101d16101cc3660046122be565b61064a565b60405161013f9190612322565b6101966101ec366004611ddb565b6106e1565b607154610135565b610196610207366004611ddb565b610806565b610196610857565b606b54610135565b6033546040516001600160a01b03909116815260200161013f565b610196610245366004612330565b61086b565b6102526109c9565b60405161013f919061237e565b61027261026d3660046123c2565b610d82565b60405161013f91906124f0565b61019661028d366004611ddb565b611091565b6101966102a03660046123c2565b61110a565b61015b6102b33660046123c2565b6000908152606d6020526040902060038101546002909101549091565b6101966102de36600461259d565b61113a565b6001600160a01b03811660009081526069602052604081205481901561032d576001600160a01b03831660009081526069602052604090205461032890600190612617565b610330565b60005b6001600160a01b0384166000908152606a602052604090205415610378576001600160a01b0384166000908152606a602052604090205461037390600190612617565b61037b565b60005b91509150915091565b60008060005b606c548110156103c85760006103a0828661129f565b905080600019146103b5579094909350915050565b50806103c08161262a565b91505061038a565b5060001993849350915050565b6103dd611613565b6001600160a01b0381166104045760405163f6b2911f60e01b815260040160405180910390fd5b606880546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633148015906104d257506067546001600160a01b0316331415806104d2575060665460675460408051636e296e4560e01b815290516001600160a01b039384169390921691636e296e45916004808201926020929091908290030181865afa1580156104a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c69190612643565b6001600160a01b031614155b156104f057604051630ba6b4d160e31b815260040160405180910390fd5b80516000818152606d6020908152604090912060010154908301511161055a576020828101516000838152606d90925260409182902060010154915163699745e360e01b815260048101849052602481019190915260448101919091526064015b60405180910390fd5b606b805490600061056a8361262a565b90915550506000818152606d6020526040812060010154900361059d57606c80549060006105978361262a565b91905055505b6105a68261166d565b826001600160a01b03168260200151827f086df69ece965de938d49c9d0eca0f14e39b9d5b178e0358d27ef0fdde2672f8606b600001546040516105ec91815260200190565b60405180910390a4505050565b610601611613565b6001600160a01b0381166106285760405163f6b2911f60e01b815260040160405180910390fd5b606780546001600160a01b0319166001600160a01b0392909216919091179055565b610652611c2f565b6000838152606d6020526040902060040180548390811061067557610675612660565b6000918252602091829020604080518082018252600590930290910180546001600160a01b0316835281516080810190925291928301906001830160048282826020028201915b8154815260200190600101908083116106bc5750505050508152505090505b92915050565b6001600160a01b0381166107085760405163f6b2911f60e01b815260040160405180910390fd5b33600090815260696020908152604080832054606a90925290912054600181111561076557336000908152606a602052604090206001908190556107659084906107529084612617565b6065546001600160a01b03169190611822565b6001821115610801573360009081526069602052604090206001908190556068546001600160a01b031690630ad98f6a9085906107a29086612617565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156107e857600080fd5b505af11580156107fc573d6000803e3d6000fd5b505050505b505050565b61080e611613565b6001600160a01b0381166108355760405163f6b2911f60e01b815260040160405180910390fd5b606680546001600160a01b0319166001600160a01b0392909216919091179055565b61085f611613565b6108696000611874565b565b6068546001600160a01b031633146108965760405163469666c560e01b815260040160405180910390fd5b60005b83518110156109c35782606960008684815181106108b9576108b9612660565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546108f09190612676565b9250508190555081606a600086848151811061090e5761090e612660565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546109459190612676565b9250508190555083818151811061095e5761095e612660565b60200260200101516001600160a01b03167f8353a804115421789f3ab2eeb3f5215943906ce12100c91d40fc865caf742b6f84846040516109a9929190918252602082015260400190565b60405180910390a2806109bb8161262a565b915050610899565b50505050565b60606000606b6001015467ffffffffffffffff8111156109eb576109eb611dff565b604051908082528060200260200182016040528015610a14578160200160208202803683370190505b5090506000805b606c54811015610d70576000818152606d602090815260408083208151610120810183528154815260018201548185015260028201548184015260038201546060820152600482018054845181870281018701909552808552919492936080860193909290879084015b82821015610afe5760008481526020908190206040805180820182526005860290920180546001600160a01b0316835281516080810190925291928301906001830160048282826020028201915b815481526020019060010190808311610ad35750505050508152505081526020019060010190610a85565b50505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015610b5f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610b41575b5050505050815260200160068201805480602002602001604051908101604052809291908181526020016000905b82821015610cd6578382906000526020600020906007020160405180604001604052908160008201805480602002602001604051908101604052809291908181526020018280548015610c0957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610beb575b50505091835250506040805160608101825260018401805482528251608081019384905260209485019492939192840191600287019060049082845b815481526020019060010190808311610c45575050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015610cba57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610c9c575b5050505050815250508152505081526020019060010190610b8d565b50505090825250600782015460ff1615156020820152604080516080810182529101906008830160048282826020028201915b815481526020019060010190808311610d095750505050508152505090508060e0015115610d5d5781848481518110610d4457610d44612660565b602090810291909101015282610d598161262a565b9350505b5080610d688161262a565b915050610a1b565b50610d7b82826118c6565b9250505090565b610d8a611c57565b6000828152606d602090815260408083208151610120810183528154815260018201548185015260028201548184015260038201546060820152600482018054845181870281018701909552808552919592946080870194939192919084015b82821015610e635760008481526020908190206040805180820182526005860290920180546001600160a01b0316835281516080810190925291928301906001830160048282826020028201915b815481526020019060010190808311610e385750505050508152505081526020019060010190610dea565b50505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015610ec457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610ea6575b5050505050815260200160068201805480602002602001604051908101604052809291908181526020016000905b8282101561103b578382906000526020600020906007020160405180604001604052908160008201805480602002602001604051908101604052809291908181526020018280548015610f6e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f50575b50505091835250506040805160608101825260018401805482528251608081019384905260209485019492939192840191600287019060049082845b815481526020019060010190808311610faa57505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561101f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611001575b5050505050815250508152505081526020019060010190610ef2565b50505090825250600782015460ff1615156020820152604080516080810182529101906008830160048282826020028201915b81548152602001906001019080831161106e575050505050815250509050919050565b611099611613565b6001600160a01b0381166110fe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610551565b61110781611874565b50565b6068546001600160a01b031633146111355760405163469666c560e01b815260040160405180910390fd5b607155565b600054610100900460ff161580801561115a5750600054600160ff909116105b806111745750303b158015611174575060005460ff166001145b6111d75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610551565b6000805460ff1916600117905580156111fa576000805461ff0019166101001790555b606580546001600160a01b038089166001600160a01b03199283161790925560668054888416908316179055606780548784169083161790556068805492861692909116919091179055607182905561125161196b565b8015611297576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000828152606d60209081526040808320815161012081018352815481526001820154818501526002820154818401526003820154606082015260048201805484518187028101870190955280855286959294608086019390929190879084015b828210156113795760008481526020908190206040805180820182526005860290920180546001600160a01b0316835281516080810190925291928301906001830160048282826020028201915b81548152602001906001019080831161134e5750505050508152505081526020019060010190611300565b505050508152602001600582018054806020026020016040519081016040528092919081815260200182805480156113da57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116113bc575b5050505050815260200160068201805480602002602001604051908101604052809291908181526020016000905b8282101561155157838290600052602060002090600702016040518060400160405290816000820180548060200260200160405190810160405280929190818152602001828054801561148457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611466575b50505091835250506040805160608101825260018401805482528251608081019384905260209485019492939192840191600287019060049082845b8154815260200190600101908083116114c057505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561153557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611517575b5050505050815250508152505081526020019060010190611408565b50505090825250600782015460ff1615156020820152604080516080810182529101906008830160048282826020028201915b81548152602001906001019080831161158457505050505081525050905060005b81608001515181101561160757836001600160a01b0316826080015182815181106115d2576115d2612660565b6020026020010151600001516001600160a01b0316036115f55791506106db9050565b806115ff8161262a565b9150506115a5565b50600019949350505050565b6033546001600160a01b031633146108695760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610551565b80516000908152606d602090815260408083208451815591840151600183015560608401516003830155830151600282015560e083015160078201805460ff1916911515919091179055906116c6906004830190611ca5565b60005b82604001518110156117ef576000836080015182815181106116ed576116ed612660565b6020026020010151600001519050826004018460800151838151811061171557611715612660565b602090810291909101810151825460018082018555600094855293839020825160059092020180546001600160a01b0319166001600160a01b0390921691909117815591810151909261176d91908301906004611cc6565b5050506001600160a01b0381166000908152606960205260409020541580156117ac57506001600160a01b0381166000908152606a6020526040902054155b156117dc576001600160a01b0381166000908152606960209081526040808320600190819055606a909252909120555b50806117e78161262a565b9150506116c9565b5060a0820151805161180b916005840191602090910190611d04565b506101008201516108019060088301906004611cc6565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261080190849061199a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b606060008267ffffffffffffffff8111156118e3576118e3611dff565b60405190808252806020026020018201604052801561190c578160200160208202803683370190505b50905060005b838110156119635784818151811061192c5761192c612660565b602002602001015182828151811061194657611946612660565b60209081029190910101528061195b8161262a565b915050611912565b509392505050565b600054610100900460ff166119925760405162461bcd60e51b815260040161055190612689565b610869611a6f565b60006119ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a9f9092919063ffffffff16565b9050805160001480611a10575080806020019051810190611a1091906126d4565b6108015760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610551565b600054610100900460ff16611a965760405162461bcd60e51b815260040161055190612689565b61086933611874565b6060611aae8484600085611ab6565b949350505050565b606082471015611b175760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610551565b600080866001600160a01b03168587604051611b339190612715565b60006040518083038185875af1925050503d8060008114611b70576040519150601f19603f3d011682016040523d82523d6000602084013e611b75565b606091505b5091509150611b8687838387611b91565b979650505050505050565b60608315611c00578251600003611bf9576001600160a01b0385163b611bf95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610551565b5081611aae565b611aae8383815115611c155781518083602001fd5b8060405162461bcd60e51b81526004016105519190612731565b604051806040016040528060006001600160a01b03168152602001611c52611d59565b905290565b60405180610120016040528060008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001600015158152602001611c52611d59565b50805460008255600502906000526020600020908101906111079190611d77565b8260048101928215611cf4579160200282015b82811115611cf4578251825591602001919060010190611cd9565b50611d00929150611db1565b5090565b828054828255906000526020600020908101928215611cf4579160200282015b82811115611cf457825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611d24565b60405180608001604052806004906020820280368337509192915050565b80821115611d005780546001600160a01b031916815560006001820181905560028201819055600382018190556004820155600501611d77565b5b80821115611d005760008155600101611db2565b6001600160a01b038116811461110757600080fd5b600060208284031215611ded57600080fd5b8135611df881611dc6565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611e3857611e38611dff565b60405290565b6040516060810167ffffffffffffffff81118282101715611e3857611e38611dff565b604051610120810167ffffffffffffffff81118282101715611e3857611e38611dff565b604051601f8201601f1916810167ffffffffffffffff81118282101715611eae57611eae611dff565b604052919050565b600067ffffffffffffffff821115611ed057611ed0611dff565b5060051b60200190565b600082601f830112611eeb57600080fd5b6040516080810181811067ffffffffffffffff82111715611f0e57611f0e611dff565b604052806080840185811115611f2357600080fd5b845b81811015611f3d578035835260209283019201611f25565b509195945050505050565b600082601f830112611f5957600080fd5b81356020611f6e611f6983611eb6565b611e85565b82815260a09283028501820192828201919087851115611f8d57600080fd5b8387015b85811015611fdb5781818a031215611fa95760008081fd5b611fb1611e15565b8135611fbc81611dc6565b8152611fca8a838801611eda565b818701528452928401928101611f91565b5090979650505050505050565b600082601f830112611ff957600080fd5b81356020612009611f6983611eb6565b82815260059290921b8401810191818101908684111561202857600080fd5b8286015b8481101561204c57803561203f81611dc6565b835291830191830161202c565b509695505050505050565b600082601f83011261206857600080fd5b81356020612078611f6983611eb6565b82815260059290921b8401810191818101908684111561209757600080fd5b8286015b8481101561204c57803567ffffffffffffffff808211156120bb57600080fd5b908801906040601f19838c0381018213156120d557600080fd5b6120dd611e15565b88850135848111156120ee57600080fd5b6120fc8e8b83890101611fe8565b825250828501358481111561211057600080fd5b949094019360c0858e03830112156121285760008081fd5b612130611e3e565b91508885013582526121448d848701611eda565b8983015260c08501358481111561215b5760008081fd5b6121698e8b83890101611fe8565b9383019390935280890191909152865250505091830191830161209b565b801515811461110757600080fd5b80356121a081612187565b919050565b600080604083850312156121b857600080fd5b82356121c381611dc6565b9150602083013567ffffffffffffffff808211156121e057600080fd5b9084019061018082870312156121f557600080fd5b6121fd611e61565b8235815260208301356020820152604083013560408201526060830135606082015260808301358281111561223157600080fd5b61223d88828601611f48565b60808301525060a08301358281111561225557600080fd5b61226188828601611fe8565b60a08301525060c08301358281111561227957600080fd5b61228588828601612057565b60c08301525061229760e08401612195565b60e082015261010091506122ad87838501611eda565b828201528093505050509250929050565b600080604083850312156122d157600080fd5b50508035926020909101359150565b8060005b60048110156109c35781518452602093840193909101906001016122e4565b6001600160a01b038151168252602081015161080160208401826122e0565b60a081016106db8284612303565b60008060006060848603121561234557600080fd5b833567ffffffffffffffff81111561235c57600080fd5b61236886828701611fe8565b9660208601359650604090950135949350505050565b6020808252825182820181905260009190848201906040850190845b818110156123b65783518352928401929184019160010161239a565b50909695505050505050565b6000602082840312156123d457600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561241557612402878351612303565b60a09690960195908201906001016123ef565b509495945050505050565b600081518084526020808501945080840160005b838110156124155781516001600160a01b031687529582019590820190600101612434565b600082825180855260208086019550808260051b84010181860160005b84811015611fdb57601f1986840301895281516040815181865261249c82870182612420565b90508683015192508581038787015260c083518252878401516124c1898401826122e0565b508284015193508060a08301526124da81830185612420565b9c88019c96505050928501925050600101612476565b60208152815160208201526020820151604082015260408201516060820152606082015160808201526000608083015161018060a08401526125366101a08401826123db565b905060a0840151601f19808584030160c08601526125548383612420565b925060c08601519150808584030160e0860152506125728282612459565b91505060e084015161010061258a8186018315159052565b85015190506119636101208501826122e0565b600080600080600060a086880312156125b557600080fd5b85356125c081611dc6565b945060208601356125d081611dc6565b935060408601356125e081611dc6565b925060608601356125f081611dc6565b949793965091946080013592915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106db576106db612601565b60006001820161263c5761263c612601565b5060010190565b60006020828403121561265557600080fd5b8151611df881611dc6565b634e487b7160e01b600052603260045260246000fd5b808201808211156106db576106db612601565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156126e657600080fd5b8151611df881612187565b60005b8381101561270c5781810151838201526020016126f4565b50506000910152565b600082516127278184602087016126f1565b9190910192915050565b60208152600082518060208401526127508160408501602087016126f1565b601f01601f1916919091016040019291505056fea2646970667358221220985283088ff2e45dc128061c9f4e1b2da69b1af38b7d61f4b6fd1c752bde6a0164736f6c63430008120033

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

Validator Index Block Amount
View All Withdrawals

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