Contract 0xA249F6F5d027392Df3DE939AA64c0AFC33A2076c

  Note: Our ETH balance display is temporarily unavailable. Please check back later.

Contract Overview

Balance:
Txn Hash Method
Block
From
To
Value
0x533284dbb1ccd3c186a612ad44423413038e31adfada4248541d8893661989800x60806040177001782023-11-24 12:20:24147 days 15 hrs ago0xd866b2332d4383c1bf719732177e2d9109c99dbc IN  Create: CrossChainCollector0 ETH0.0000000237130.00001
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CrossChainCollector

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : CrossChainCollector.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol";
import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol";
// import {LinkTokenInterface} from "@chainlink/contracts/src/v0.8/shared/interfaces/LinkTokenInterface.sol";
// import {CCIPReceiver} from "@chainlink/contracts-ccip/src/v0.8/ccip/applications/CCIPReceiver.sol";

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

// internal
import "../utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol";
import "../utils/proxy/solidity-0.8.0/ProxyOwned.sol";
import "../utils/proxy/solidity-0.8.0/ProxyPausable.sol";

import "../interfaces/IStakingThales.sol";

import "./CCIPReceiverProxy.sol";


/// @title - Cross Chain Collector contract for Thales staking rewards
contract CrossChainCollector is Initializable, ProxyOwned, ProxyPausable, ProxyReentrancyGuard, CCIPReceiverProxy {
    // Custom errors to provide more descriptive revert messages.
    error NotEnoughBalance(uint256 currentBalance, uint256 calculatedFees); // Used to make sure contract has enough balance.

    IRouterClient private s_router;
    address public stakingThales;

    address public masterCollector;
    uint64 public masterCollectorChain;
    
    mapping(uint => uint64) public chainSelector;
    mapping(uint64 => uint) public chainSelectorIndex;
    mapping(uint => address) public collectorAddress;

    mapping(uint => uint) public lastPeriodForChain;
    mapping(uint => mapping(uint => uint)) public chainStakedAmountInPeriod;
    mapping(uint => mapping(uint => uint)) public chainEscrowedAmountInPeriod;
    mapping(uint => mapping(uint => uint)) public chainBaseRewardsInPeriod;
    mapping(uint => mapping(uint => uint)) public chainExtraRewardsInPeriod;
    mapping(uint => mapping(uint => uint)) public chainBonusPointsInPeriod;

    mapping(uint => uint) public calculatedStakedAmountForPeriod;
    mapping(uint => uint) public calculatedEscrowedAmountForPeriod;
    mapping(uint => uint) public calculatedBonusPointsForPeriod;

    mapping(uint => uint64) public messagesReceivedFromChainSelector;
    mapping(uint => bytes) public messagesReceived;
    uint public numOfMessagesReceived;

    uint public numOfActiveCollectors;
    uint public period;
    uint public baseRewardsPerPeriod;
    uint public extraRewardsPerPeriod;
    uint public collectedResultsPerPeriod;
    uint public lastPeriodBeforeTesting;

    bool public readyToBroadcast;
    bool public testingPhase;
    uint public gasLimitUsed;

    /* ========== INITIALIZERS ========== */
    function initialize(
        address _router,
        bool _masterCollector,
        uint64 _masterCollectorSelector
    ) public initializer {
        setOwner(msg.sender);
        initNonReentrant();
        _setRouter(_router);
        s_router = IRouterClient(_router);
        gasLimitUsed = 1000000;
        if (_masterCollector) {
            masterCollector = address(this);
            masterCollectorChain = _masterCollectorSelector;
            chainSelector[0] = _masterCollectorSelector;
            collectorAddress[_masterCollectorSelector] = address(this);
            chainSelectorIndex[_masterCollectorSelector] = 0;
            numOfActiveCollectors = 1;
            period = 1;
        }
    }

    receive() external payable {}

    /* ========== VIEW FUNCTIONS ========== */

    function isMasterCollector() external view returns (bool isMaster) {
        isMaster = masterCollector == address(this);
    }
    

    function lastMessageFromChainSelector() external view returns (uint64 chainSelector_) {
        if (numOfMessagesReceived > 0) {
            chainSelector_ = messagesReceivedFromChainSelector[numOfMessagesReceived - 1];
        }
    }

    /* ========== EXTERNAL FUNCTIONS ========== */

    function sendOnClosePeriod(
        uint _totalStakedLastPeriodEnd,
        uint _totalEscrowedLastPeriodEnd,
        uint _bonusPoints
    ) external {
        require(msg.sender == stakingThales, "InvSender");
        if (masterCollector == address(this)) {
            _storeRewards(_totalStakedLastPeriodEnd, _totalEscrowedLastPeriodEnd, _bonusPoints, masterCollectorChain);
            ++collectedResultsPerPeriod;
            if (collectedResultsPerPeriod == numOfActiveCollectors) {
                readyToBroadcast = true;
            }
        } else {
            bytes memory message = abi.encode(_totalStakedLastPeriodEnd, _totalEscrowedLastPeriodEnd, _bonusPoints);
            _sendMessageToChain(masterCollectorChain, message);
        }
        emit SentOnClosePeriod(
            _totalStakedLastPeriodEnd,
            _totalEscrowedLastPeriodEnd,
            _bonusPoints
        );
    }

    function broadcastMessageToAll() external onlyOwner {
        if (readyToBroadcast) {
            _broadcastMessageToAll();
            collectedResultsPerPeriod = 0;
            readyToBroadcast = false;
            ++period;
        }
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    /// handle a received message
    function _ccipReceive(Client.Any2EVMMessage memory any2EvmMessage) internal override {
        // decoding the message
        address sender = abi.decode(any2EvmMessage.sender, (address));
        messagesReceivedFromChainSelector[numOfMessagesReceived] = any2EvmMessage.sourceChainSelector;
        messagesReceived[numOfMessagesReceived] = any2EvmMessage.data;
        ++numOfMessagesReceived;

        if (masterCollector == address(this)) {
            uint sourceChainSelector = any2EvmMessage.sourceChainSelector;
            if (testingPhase) {
                if (collectorAddress[sourceChainSelector] == sender) {
                    _calculateRewards(any2EvmMessage.data, sourceChainSelector);
                }
                ++collectedResultsPerPeriod;
                if (collectedResultsPerPeriod == numOfActiveCollectors) {
                    readyToBroadcast = true;
                }
            } else if (collectorAddress[sourceChainSelector] == sender && lastPeriodForChain[sourceChainSelector] < period) {
                lastPeriodForChain[sourceChainSelector] = period;
                _calculateRewards(any2EvmMessage.data, sourceChainSelector);
                ++collectedResultsPerPeriod;
                if (collectedResultsPerPeriod == numOfActiveCollectors) {
                    readyToBroadcast = true;
                }
            }
        } else if (masterCollector == sender) {
            _updateRewardsOnStakingContract(any2EvmMessage.data);
        }
        emit MessageReceived(
            any2EvmMessage.messageId,
            any2EvmMessage.sourceChainSelector, // fetch the source chain identifier (aka selector)
            abi.decode(any2EvmMessage.sender, (address)), // abi-decoding of the sender address,
            any2EvmMessage.data
        );
    }


    function _calculateRewards(bytes memory data, uint _chainSelector) internal {
        (uint stakedAmount, uint escrowedAmount, uint bonusPoints) = abi.decode(data, (uint, uint, uint));
        _storeRewards(stakedAmount, escrowedAmount, bonusPoints, _chainSelector);
    }

    function _storeRewards(
        uint _stakedAmount,
        uint _escrowedAmount,
        uint _bonusPoints,
        uint _chainSelector
    ) internal {
        chainStakedAmountInPeriod[period][_chainSelector] = _stakedAmount;
        chainEscrowedAmountInPeriod[period][_chainSelector] = _escrowedAmount;
        chainBonusPointsInPeriod[period][_chainSelector] = _bonusPoints;

        calculatedStakedAmountForPeriod[period] += _stakedAmount;
        calculatedEscrowedAmountForPeriod[period] += _escrowedAmount;
        calculatedBonusPointsForPeriod[period] += _bonusPoints;
    }

    function _broadcastMessageToAll() internal {
        uint chainBaseRewards;
        uint chainExtraRewards;
        bytes memory message;

        for (uint i = 0; i < numOfActiveCollectors; i++) {
            chainBaseRewards =
                (chainStakedAmountInPeriod[period][chainSelector[i]] * baseRewardsPerPeriod) /
                (calculatedStakedAmountForPeriod[period] + calculatedEscrowedAmountForPeriod[period]);

            chainExtraRewards =
                (chainBonusPointsInPeriod[period][chainSelector[i]] * extraRewardsPerPeriod) /
                (calculatedBonusPointsForPeriod[period]);

            chainBaseRewardsInPeriod[period][chainSelector[i]] = chainBaseRewards;
            chainExtraRewardsInPeriod[period][chainSelector[i]] = chainExtraRewards;

            message = abi.encode(
                chainBaseRewards,
                chainExtraRewards,
                calculatedStakedAmountForPeriod[period],
                calculatedEscrowedAmountForPeriod[period]
            );
            if (i == 0) {
                _updateRewards(
                    chainBaseRewards,
                    chainExtraRewards,
                    calculatedStakedAmountForPeriod[period],
                    calculatedEscrowedAmountForPeriod[period]
                );
            } else {
                _sendMessageToChain(chainSelector[i], message);
            }
        }
    }

    function _sendMessageToChain(uint64 _chainSelector, bytes memory _message) internal returns (bytes32 messageId) {
        Client.EVM2AnyMessage memory evm2AnyMessage = Client.EVM2AnyMessage({
            receiver: abi.encode(collectorAddress[_chainSelector]), // ABI-encoded receiver address
            data: _message, // ABI-encoded string
            tokenAmounts: new Client.EVMTokenAmount[](0), // Empty array indicating no tokens are being sent
            extraArgs: Client._argsToBytes(
                // Additional arguments, setting gas limit and non-strict sequencing mode
                Client.EVMExtraArgsV1({gasLimit: gasLimitUsed, strict: false})
            ),
            // Set the feeToken  address, indicating LINK will be used for fees
            feeToken: address(0)
        });

        // Get the fee required to send the message
        uint256 fees = s_router.getFee(_chainSelector, evm2AnyMessage);

        if (fees > address(this).balance) revert NotEnoughBalance(address(this).balance, fees);

        // Send the message through the router and store the returned message ID
        messageId = s_router.ccipSend{value: fees}(_chainSelector, evm2AnyMessage);

        // Emit an event with message details
        emit MessageSent(messageId, _chainSelector, collectorAddress[_chainSelector], _message, address(0), fees);

        // Return the message ID
        return messageId;
    }

    function _updateRewardsOnStakingContract(bytes memory data) internal {
        (uint baseRewards, uint extraRewards, uint stakedAmount, uint escrowedAmount) = abi.decode(
            data,
            (uint, uint, uint, uint)
        );
        _updateRewards(baseRewards, extraRewards, stakedAmount, escrowedAmount);
    }

    function _updateRewards(
        uint _baseRewards,
        uint _extraRewards,
        uint _stakedAmount,
        uint _escrowedAmount
    ) internal {
        IStakingThales(stakingThales).updateStakingRewards(_baseRewards, _extraRewards, _stakedAmount, _escrowedAmount);
    }

    /* ========== CONTRACT SETTERS FUNCTIONS ========== */

    function setStakingThales(address _stakingThales) external onlyOwner {
        stakingThales = _stakingThales;
        emit SetStakingThales(_stakingThales);
    }

    function setCCIPRouter(address _router) external onlyOwner {
        _setRouter(_router);
        s_router = IRouterClient(_router);
        emit SetCCIPRouter(_router);
    }

    function setPeriodRewards(uint _baseRewardsPerPeriod, uint _extraRewardsPerPeriod) external onlyOwner {
        baseRewardsPerPeriod = _baseRewardsPerPeriod;
        extraRewardsPerPeriod = _extraRewardsPerPeriod;
        emit SetPeriodRewards(_baseRewardsPerPeriod, _extraRewardsPerPeriod);
    }
    
    function setGasLimit(uint _gasLimitUsed) external onlyOwner {
        gasLimitUsed = _gasLimitUsed;
        emit SetGasLimit(_gasLimitUsed);
    }

    function setMasterCollector(address _masterCollector, uint64 _materCollectorChainId) external onlyOwner {
        masterCollector = _masterCollector;
        masterCollectorChain = _materCollectorChainId;
        collectorAddress[_materCollectorChainId] = _masterCollector;
        chainSelector[0] = _materCollectorChainId;
        chainSelectorIndex[_materCollectorChainId] = 0;
        numOfActiveCollectors = numOfActiveCollectors == 0 ? 1 : numOfActiveCollectors;
        emit MasterCollectorSet(_masterCollector, _materCollectorChainId);
    }

    function setCollectorForChain(
        uint64 _chainId,
        address _collectorAddress,
        uint _slot
    ) external onlyOwner {
        require(masterCollector == address(this), "NonMasterCollector");
        require(_slot <= numOfActiveCollectors, "SlotTooBig");
        if (_slot == numOfActiveCollectors) {
            chainSelector[numOfActiveCollectors] = _chainId;
            collectorAddress[_chainId] = _collectorAddress;
            chainSelectorIndex[_chainId] = numOfActiveCollectors;
            ++numOfActiveCollectors;
        } else if (collectorAddress[_chainId] == address(0) && _collectorAddress == address(0)) {
            --numOfActiveCollectors;
            (collectorAddress[_chainId], chainSelector[chainSelectorIndex[_chainId]]) = (
                collectorAddress[chainSelector[numOfActiveCollectors]],
                chainSelector[numOfActiveCollectors]
            );
            delete collectorAddress[chainSelector[numOfActiveCollectors]];
            delete chainSelector[numOfActiveCollectors];
        } else {
            chainSelector[_slot] = _chainId;
            collectorAddress[_chainId] = _collectorAddress;
            chainSelectorIndex[_chainId] = _slot;
        }
        emit CollectorForChainSet(_chainId, _collectorAddress);
    }

    function setTestingPhase(bool _enableTesting) external onlyOwner {
        if (_enableTesting) {
            lastPeriodBeforeTesting = period;
            testingPhase = true;
            period = 0;
        } else {
            testingPhase = false;
            period = lastPeriodBeforeTesting;
        }
    }

    /* ========== EVENTS ========== */

    // Event emitted when a message is sent to another chain.
    event MessageSent(
        bytes32 indexed messageId, // The unique ID of the CCIP message.
        uint64 indexed destinationChainSelector, // The chain selector of the destination chain.
        address receiver, // The address of the receiver on the destination chain.
        bytes text, // The text being sent.
        address feeToken, // the token address used to pay CCIP fees.
        uint256 fees // The fees paid for sending the CCIP message.
    );

    // Event emitted when a message is received from another chain.
    event MessageReceived(
        bytes32 indexed messageId, // The unique ID of the message.
        uint64 indexed sourceChainSelector, // The chain selector of the source chain.
        address sender, // The address of the sender from the source chain.
        bytes data // The text that was received.
    );

    event CollectorForChainSet(uint64 chainId, address collectorAddress);
    event MasterCollectorSet(address masterCollector, uint64 materCollectorChainId);
    event SetPeriodRewards(uint _baseRewardsPerPeriod, uint _extraRewardsPerPeriod);
    event SetCCIPRouter(address _router);
    event SetStakingThales(address _stakingThales);
    event SentOnClosePeriod(uint _totalStakedLastPeriodEnd, uint _totalEscrowedLastPeriodEnd, uint _bonusPoints);
    event SetGasLimit(uint _gasLimitUsed);
}

File 2 of 12 : IRouterClient.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Client} from "../libraries/Client.sol";

interface IRouterClient {
  error UnsupportedDestinationChain(uint64 destChainSelector);
  error InsufficientFeeTokenAmount();
  error InvalidMsgValue();

  /// @notice Checks if the given chain ID is supported for sending/receiving.
  /// @param chainSelector The chain to check.
  /// @return supported is true if it is supported, false if not.
  function isChainSupported(uint64 chainSelector) external view returns (bool supported);

  /// @notice Gets a list of all supported tokens which can be sent or received
  /// to/from a given chain id.
  /// @param chainSelector The chainSelector.
  /// @return tokens The addresses of all tokens that are supported.
  function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens);

  /// @param destinationChainSelector The destination chainSelector
  /// @param message The cross-chain CCIP message including data and/or tokens
  /// @return fee returns guaranteed execution fee for the specified message
  /// delivery to destination chain
  /// @dev returns 0 fee on invalid message.
  function getFee(
    uint64 destinationChainSelector,
    Client.EVM2AnyMessage memory message
  ) external view returns (uint256 fee);

  /// @notice Request a message to be sent to the destination chain
  /// @param destinationChainSelector The destination chain ID
  /// @param message The cross-chain CCIP message including data and/or tokens
  /// @return messageId The message ID
  /// @dev Note if msg.value is larger than the required fee (from getFee) we accept
  /// the overpayment with no refund.
  function ccipSend(
    uint64 destinationChainSelector,
    Client.EVM2AnyMessage calldata message
  ) external payable returns (bytes32);
}

File 3 of 12 : Client.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// End consumer library.
library Client {
  struct EVMTokenAmount {
    address token; // token address on the local chain.
    uint256 amount; // Amount of tokens.
  }

  struct Any2EVMMessage {
    bytes32 messageId; // MessageId corresponding to ccipSend on source.
    uint64 sourceChainSelector; // Source chain selector.
    bytes sender; // abi.decode(sender) if coming from an EVM chain.
    bytes data; // payload sent in original message.
    EVMTokenAmount[] destTokenAmounts; // Tokens and their amounts in their destination chain representation.
  }

  // If extraArgs is empty bytes, the default is 200k gas limit and strict = false.
  struct EVM2AnyMessage {
    bytes receiver; // abi.encode(receiver address) for dest EVM chains
    bytes data; // Data payload
    EVMTokenAmount[] tokenAmounts; // Token transfers
    address feeToken; // Address of feeToken. address(0) means you will send msg.value.
    bytes extraArgs; // Populate this with _argsToBytes(EVMExtraArgsV1)
  }

  // extraArgs will evolve to support new features
  // bytes4(keccak256("CCIP EVMExtraArgsV1"));
  bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9;
  struct EVMExtraArgsV1 {
    uint256 gasLimit; // ATTENTION!!! MAX GAS LIMIT 4M FOR BETA TESTING
    bool strict; // See strict sequencing details below.
  }

  function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) {
    return abi.encodeWithSelector(EVM_EXTRA_ARGS_V1_TAG, extraArgs);
  }
}

File 4 of 12 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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 a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {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 initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the `nonReentrant` modifier
 * available, which can be aplied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 */
contract ProxyReentrancyGuard {
    /// @dev counter to allow mutex lock with only one SSTORE operation
    uint256 private _guardCounter;
    bool private _initialized;

    function initNonReentrant() public {
        require(!_initialized, "Already initialized");
        _initialized = true;
        _guardCounter = 1;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _guardCounter += 1;
        uint256 localCounter = _guardCounter;
        _;
        require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
    }
}

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

pragma solidity ^0.8.0;

// Clone of syntetix contract without constructor
contract ProxyOwned {
    address public owner;
    address public nominatedOwner;
    bool private _initialized;
    bool private _transferredAtInit;

    function setOwner(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        require(!_initialized, "Already initialized, use nominateNewOwner");
        _initialized = true;
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    function transferOwnershipAtInit(address proxyAddress) external onlyOwner {
        require(proxyAddress != address(0), "Invalid address");
        require(!_transferredAtInit, "Already transferred");
        owner = proxyAddress;
        _transferredAtInit = true;
        emit OwnerChanged(owner, proxyAddress);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}

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

pragma solidity ^0.8.0;

// Inheritance
import "./ProxyOwned.sol";

// Clone of syntetix contract without constructor

contract ProxyPausable is ProxyOwned {
    uint public lastPauseTime;
    bool public paused;

    

    /**
     * @notice Change the paused state of the contract
     * @dev Only the contract owner may call this.
     */
    function setPaused(bool _paused) external onlyOwner {
        // Ensure we're actually changing the state before we do anything
        if (_paused == paused) {
            return;
        }

        // Set our paused state.
        paused = _paused;

        // If applicable, set the last pause time.
        if (paused) {
            lastPauseTime = block.timestamp;
        }

        // Let everyone know that our pause state has changed.
        emit PauseChanged(paused);
    }

    event PauseChanged(bool isPaused);

    modifier notPaused {
        require(!paused, "This action cannot be performed while the contract is paused");
        _;
    }
}

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

pragma solidity >=0.5.16;

interface IStakingThales {
    function updateVolume(address account, uint amount) external;

    function updateStakingRewards(
        uint _currentPeriodRewards,
        uint _extraRewards,
        uint _crossChainStakedAmount,
        uint _crossChainEscrowedAmount
    ) external;

    /* ========== VIEWS / VARIABLES ==========  */
    function totalStakedAmount() external view returns (uint);

    function stakedBalanceOf(address account) external view returns (uint);

    function currentPeriodRewards() external view returns (uint);

    function currentPeriodFees() external view returns (uint);

    function getLastPeriodOfClaimedRewards(address account) external view returns (uint);

    function getRewardsAvailable(address account) external view returns (uint);

    function getRewardFeesAvailable(address account) external view returns (uint);

    function getAlreadyClaimedRewards(address account) external view returns (uint);

    function getContractRewardFunds() external view returns (uint);

    function getContractFeeFunds() external view returns (uint);

    function getAMMVolume(address account) external view returns (uint);
}

File 9 of 12 : CCIPReceiverProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IAny2EVMMessageReceiver} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol";

import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol";

import {IERC165} from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/utils/introspection/IERC165.sol";

/// @title - Cross Chain Collector contract for Thales staking rewards
abstract contract CCIPReceiverProxy is IAny2EVMMessageReceiver, IERC165 {
    address internal i_router;

    function _setRouter(address router) internal {
        if (router == address(0)) revert InvalidRouter(address(0));
        i_router = router;
    }

    /// @notice IERC165 supports an interfaceId
    /// @param interfaceId The interfaceId to check
    /// @return true if the interfaceId is supported
    function supportsInterface(bytes4 interfaceId) public pure override returns (bool) {
        return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId;
    }

    /// @inheritdoc IAny2EVMMessageReceiver
    function ccipReceive(Client.Any2EVMMessage calldata message) external virtual override onlyRouter {
        _ccipReceive(message);
    }

    /// @notice Override this function in your implementation.
    /// @param message Any2EVMMessage
    function _ccipReceive(Client.Any2EVMMessage memory message) internal virtual;

    /////////////////////////////////////////////////////////////////////
    // Plumbing
    /////////////////////////////////////////////////////////////////////

    /// @notice Return the current router
    /// @return i_router address
    function getRouter() public view returns (address) {
        return address(i_router);
    }

    error InvalidRouter(address router);

    /// @dev only calls from the set router are accepted.
    modifier onlyRouter() {
        if (msg.sender != address(i_router)) revert InvalidRouter(msg.sender);
        _;
    }
}

File 10 of 12 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

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

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 12 : IAny2EVMMessageReceiver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Client} from "../libraries/Client.sol";

/// @notice Application contracts that intend to receive messages from
/// the router should implement this interface.
interface IAny2EVMMessageReceiver {
  /// @notice Called by the Router to deliver a message.
  /// If this reverts, any token transfers also revert. The message
  /// will move to a FAILED state and become available for manual execution.
  /// @param message CCIP Message
  /// @dev Note ensure you check the msg.sender is the OffRampRouter
  function ccipReceive(Client.Any2EVMMessage calldata message) external;
}

File 12 of 12 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
  /**
    * @dev Returns true if this contract implements the interface defined by
    * `interfaceId`. See the corresponding
    * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
    * to learn more about how these ids are created.
    *
    * This function call must use less than 30 000 gas.
    */
  function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"router","type":"address"}],"name":"InvalidRouter","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentBalance","type":"uint256"},{"internalType":"uint256","name":"calculatedFees","type":"uint256"}],"name":"NotEnoughBalance","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"chainId","type":"uint64"},{"indexed":false,"internalType":"address","name":"collectorAddress","type":"address"}],"name":"CollectorForChainSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"masterCollector","type":"address"},{"indexed":false,"internalType":"uint64","name":"materCollectorChainId","type":"uint64"}],"name":"MasterCollectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"},{"indexed":true,"internalType":"uint64","name":"sourceChainSelector","type":"uint64"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"MessageReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"},{"indexed":true,"internalType":"uint64","name":"destinationChainSelector","type":"uint64"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"bytes","name":"text","type":"bytes"},{"indexed":false,"internalType":"address","name":"feeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"}],"name":"MessageSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_totalStakedLastPeriodEnd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_totalEscrowedLastPeriodEnd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_bonusPoints","type":"uint256"}],"name":"SentOnClosePeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_router","type":"address"}],"name":"SetCCIPRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_gasLimitUsed","type":"uint256"}],"name":"SetGasLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_baseRewardsPerPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_extraRewardsPerPeriod","type":"uint256"}],"name":"SetPeriodRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_stakingThales","type":"address"}],"name":"SetStakingThales","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"baseRewardsPerPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"broadcastMessageToAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"calculatedBonusPointsForPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"calculatedEscrowedAmountForPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"calculatedStakedAmountForPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"uint64","name":"sourceChainSelector","type":"uint64"},{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Client.EVMTokenAmount[]","name":"destTokenAmounts","type":"tuple[]"}],"internalType":"struct Client.Any2EVMMessage","name":"message","type":"tuple"}],"name":"ccipReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainBaseRewardsInPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainBonusPointsInPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainEscrowedAmountInPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainExtraRewardsInPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainSelector","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"chainSelectorIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainStakedAmountInPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectedResultsPerPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"collectorAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extraRewardsPerPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasLimitUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initNonReentrant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"},{"internalType":"bool","name":"_masterCollector","type":"bool"},{"internalType":"uint64","name":"_masterCollectorSelector","type":"uint64"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isMasterCollector","outputs":[{"internalType":"bool","name":"isMaster","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastMessageFromChainSelector","outputs":[{"internalType":"uint64","name":"chainSelector_","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPauseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPeriodBeforeTesting","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastPeriodForChain","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterCollectorChain","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"messagesReceived","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"messagesReceivedFromChainSelector","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numOfActiveCollectors","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numOfMessagesReceived","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"readyToBroadcast","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalStakedLastPeriodEnd","type":"uint256"},{"internalType":"uint256","name":"_totalEscrowedLastPeriodEnd","type":"uint256"},{"internalType":"uint256","name":"_bonusPoints","type":"uint256"}],"name":"sendOnClosePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"setCCIPRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainId","type":"uint64"},{"internalType":"address","name":"_collectorAddress","type":"address"},{"internalType":"uint256","name":"_slot","type":"uint256"}],"name":"setCollectorForChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gasLimitUsed","type":"uint256"}],"name":"setGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_masterCollector","type":"address"},{"internalType":"uint64","name":"_materCollectorChainId","type":"uint64"}],"name":"setMasterCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseRewardsPerPeriod","type":"uint256"},{"internalType":"uint256","name":"_extraRewardsPerPeriod","type":"uint256"}],"name":"setPeriodRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingThales","type":"address"}],"name":"setStakingThales","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enableTesting","type":"bool"}],"name":"setTestingPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingThales","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"testingPhase","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"proxyAddress","type":"address"}],"name":"transferOwnershipAtInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b506129e9806100206000396000f3fe6080604052600436106103015760003560e01c806385572ffb11610190578063b4b2c779116100dc578063ebc7977211610095578063ef5aea6b1161006f578063ef5aea6b146109e4578063ef78d4fd14610a05578063fa31ce7c14610a1b578063fd8a8cc614610a4857600080fd5b8063ebc7977214610995578063edb5eef1146109aa578063ee7d72b4146109c457600080fd5b8063b4b2c779146108dd578063c3b83f5f146108f3578063dadcea4d14610913578063e36fa14114610929578063e3d0603e1461095f578063e6741deb1461097f57600080fd5b806391b4ded9116101495780639c3971ce116101235780639c3971ce1461084c578063a00301eb14610862578063a0cd0f211461089a578063b0f479a1146108ba57600080fd5b806391b4ded9146107de578063940c1f49146107f457806396fd83801461082c57600080fd5b806385572ffb146106e657806386c4f4d71461070657806389889008146107335780638b3c0e35146107535780638b978062146107805780638da5cb5b146107b857600080fd5b80633b6f3ec01161024f5780635d0e31fb11610208578063735744e9116101e2578063735744e91461065957806379ba5097146106915780637bc98264146106a65780637f852582146106c657600080fd5b80635d0e31fb146105ec57806366eb91361461060c578063710183891461062c57600080fd5b80633b6f3ec0146105325780633bad3048146105485780633d8417681461055d57806353a47bb71461057c5780635614fe8f1461059c5780635c975abb146105d257600080fd5b806316c38b3c116102bc5780631ee3d3ec116102965780631ee3d3ec146104705780632ca5214c146104af57806331c1e16a146104c4578063323a2bee146104e457600080fd5b806316c38b3c1461040d578063180305991461042d5780631e45403a1461045a57600080fd5b806204398b1461030d57806237f0791461033657806301ffc9a71461036e5780630ae12fc81461039e57806313af4035146103cb5780631627540c146103ed57600080fd5b3661030857005b600080fd5b34801561031957600080fd5b50610323601a5481565b6040519081526020015b60405180910390f35b34801561034257600080fd5b506103236103513660046124d9565b600d60209081526000928352604080842090915290825290205481565b34801561037a57600080fd5b5061038e610389366004612462565b610a68565b604051901515815260200161032d565b3480156103aa57600080fd5b506103236103b9366004612587565b600a6020526000908152604090205481565b3480156103d757600080fd5b506103eb6103e6366004612379565b610a9f565b005b3480156103f957600080fd5b506103eb610408366004612379565b610bdf565b34801561041957600080fd5b506103eb610428366004612430565b610c35565b34801561043957600080fd5b5061044d6104483660046124c1565b610cab565b60405161032d919061268a565b34801561046657600080fd5b5061032360175481565b34801561047c57600080fd5b5060085461049790600160a01b90046001600160401b031681565b6040516001600160401b03909116815260200161032d565b3480156104bb57600080fd5b506103eb610d45565b3480156104d057600080fd5b506103eb6104df366004612379565b610d88565b3480156104f057600080fd5b5061051a6104ff3660046124c1565b600b602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161032d565b34801561053e57600080fd5b5061032360185481565b34801561055457600080fd5b50610497610de7565b34801561056957600080fd5b50601e5461038e90610100900460ff1681565b34801561058857600080fd5b5060015461051a906001600160a01b031681565b3480156105a857600080fd5b506104976105b73660046124c1565b6015602052600090815260409020546001600160401b031681565b3480156105de57600080fd5b5060035461038e9060ff1681565b3480156105f857600080fd5b506103eb6106073660046125a1565b610e25565b34801561061857600080fd5b5060085461051a906001600160a01b031681565b34801561063857600080fd5b506103236106473660046124c1565b600c6020526000908152604090205481565b34801561066557600080fd5b506103236106743660046124d9565b601060209081526000928352604080842090915290825290205481565b34801561069d57600080fd5b506103eb6110d4565b3480156106b257600080fd5b506103eb6106c13660046124d9565b6111d1565b3480156106d257600080fd5b506103eb6106e1366004612379565b611221565b3480156106f257600080fd5b506103eb61070136600461248a565b611277565b34801561071257600080fd5b506103236107213660046124c1565b60136020526000908152604090205481565b34801561073f57600080fd5b506103eb61074e3660046123fc565b6112ba565b34801561075f57600080fd5b5061032361076e3660046124c1565b60146020526000908152604090205481565b34801561078c57600080fd5b5061032361079b3660046124d9565b600f60209081526000928352604080842090915290825290205481565b3480156107c457600080fd5b5060005461051a906201000090046001600160a01b031681565b3480156107ea57600080fd5b5061032360025481565b34801561080057600080fd5b5061032361080f3660046124d9565b600e60209081526000928352604080842090915290825290205481565b34801561083857600080fd5b506103eb610847366004612430565b6113b3565b34801561085857600080fd5b50610323601b5481565b34801561086e57600080fd5b5061032361087d3660046124d9565b601160209081526000928352604080842090915290825290205481565b3480156108a657600080fd5b506103eb6108b53660046123b8565b6113f2565b3480156108c657600080fd5b5060055461010090046001600160a01b031661051a565b3480156108e957600080fd5b50610323601d5481565b3480156108ff57600080fd5b506103eb61090e366004612379565b611591565b34801561091f57600080fd5b50610323601f5481565b34801561093557600080fd5b506104976109443660046124c1565b6009602052600090815260409020546001600160401b031681565b34801561096b57600080fd5b506103eb61097a3660046124fa565b6116aa565b34801561098b57600080fd5b50610323601c5481565b3480156109a157600080fd5b506103eb6117e0565b3480156109b657600080fd5b50601e5461038e9060ff1681565b3480156109d057600080fd5b506103eb6109df3660046124c1565b61183e565b3480156109f057600080fd5b5061038e6008546001600160a01b0316301490565b348015610a1157600080fd5b5061032360195481565b348015610a2757600080fd5b50610323610a363660046124c1565b60126020526000908152604090205481565b348015610a5457600080fd5b5060075461051a906001600160a01b031681565b60006001600160e01b031982166385572ffb60e01b1480610a9957506001600160e01b031982166301ffc9a760e01b145b92915050565b6001600160a01b038116610afa5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600154600160a01b900460ff1615610b665760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610af1565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610be761187b565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610bd4565b610c3d61187b565b60035460ff1615158115151415610c515750565b6003805460ff191682151590811790915560ff1615610c6f57426002555b60035460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec590602001610bd4565b50565b60166020526000908152604090208054610cc49061291c565b80601f0160208091040260200160405190810160405280929190818152602001828054610cf09061291c565b8015610d3d5780601f10610d1257610100808354040283529160200191610d3d565b820191906000526020600020905b815481529060010190602001808311610d2057829003601f168201915b505050505081565b610d4d61187b565b601e5460ff1615610d8657610d606118f3565b6000601c819055601e805460ff1916905560198054909190610d8190612957565b909155505b565b610d9061187b565b610d9981611ad3565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f28dfffa003cbac2f767191365506e49c4aba7ab310ebfa0a9d770e90f1b4550e90602001610bd4565b60175460009015610e2257601560006001601754610e059190612846565b81526020810191909152604001600020546001600160401b031690505b90565b610e2d61187b565b6008546001600160a01b03163014610e7c5760405162461bcd60e51b81526020600482015260126024820152712737b726b0b9ba32b921b7b63632b1ba37b960711b6044820152606401610af1565b601854811115610ebb5760405162461bcd60e51b815260206004820152600a602482015269536c6f74546f6f42696760b01b6044820152606401610af1565b601854811415610f3757601880546000908152600960209081526040808320805467ffffffffffffffff19166001600160401b0389169081179091558352600b825280832080546001600160a01b0319166001600160a01b0388161790558354600a9092528220819055610f2e90612957565b90915550611084565b6001600160401b0383166000908152600b60205260409020546001600160a01b0316158015610f6d57506001600160a01b038216155b1561102957601860008154610f8190612905565b90915550601880546000908152600960208181526040808420546001600160401b03908116808652600b808552838720548b84168852848820600a8752858920548952878752858920805467ffffffffffffffff19908116909517905580546001600160a01b039092166001600160a01b0319928316179055885488528488205490931687528452828620805490921690915594548452919052902080549091169055611084565b6000818152600960209081526040808320805467ffffffffffffffff19166001600160401b0388169081179091558352600b825280832080546001600160a01b0319166001600160a01b038716179055600a90915290208190555b604080516001600160401b03851681526001600160a01b03841660208201527fd0983e2eb7b3d3254287f511871438d35f972763744ee70fb7602c9138e87db591015b60405180910390a1505050565b6001546001600160a01b0316331461114c5760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610af1565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b6111d961187b565b601a829055601b81905560408051838152602081018390527fc709e263c1f9c98bedb98ba5c5f2a5fd6c3632e74057cc4f1b961b3541190c8191015b60405180910390a15050565b61122961187b565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f475a2179b9b6a155e7ba3f46a461beb6798279b265026364944e38dcb4bacafe90602001610bd4565b60055461010090046001600160a01b031633146112a9576040516335fdcccd60e21b8152336004820152602401610af1565b610ca86112b58261285d565b611b25565b6112c261187b565b600880546001600160a01b0384166001600160e01b03199091168117600160a01b6001600160401b038516908102919091179092556000828152600b6020908152604080832080546001600160a01b0319169094179093557fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b805467ffffffffffffffff1916909417909355600a9092528120556018541561136657601854611369565b60015b601855604080516001600160a01b03841681526001600160401b03831660208201527fdd3bc5fc3811d69c4fec34eef96db67bf7f4531c4ee58a2ccbe73dff6d101fa49101611215565b6113bb61187b565b80156113de5760198054601d55601e805461ff0019166101001790556000905550565b601e805461ff0019169055601d5460195550565b600054610100900460ff1661140d5760005460ff1615611411565b303b155b6114745760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610af1565b600054610100900460ff16158015611496576000805461ffff19166101011790555b61149f33610a9f565b6114a76117e0565b6114b084611ad3565b600680546001600160a01b0319166001600160a01b038616179055620f4240601f55821561157957600880546001600160401b038416600160a01b810267ffffffffffffffff60a01b19309081166001600160e01b031990941693909317179092557fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b805467ffffffffffffffff1916831790556000918252600b6020908152604080842080546001600160a01b031916909317909255600a9052812055600160188190556019555b801561158b576000805461ff00191690555b50505050565b61159961187b565b6001600160a01b0381166115e15760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610af1565b600154600160a81b900460ff16156116315760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610af1565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610bd4565b6007546001600160a01b031633146116f05760405162461bcd60e51b815260206004820152600960248201526824b73b29b2b73232b960b91b6044820152606401610af1565b6008546001600160a01b03163014156117575760085461172590849084908490600160a01b90046001600160401b0316611d65565b601c6000815461173490612957565b90915550601854601c54141561175257601e805460ff191660011790555b6117a2565b6040805160208101859052808201849052606080820184905282518083039091018152608090910190915260085461179f90600160a01b90046001600160401b031682611e23565b50505b60408051848152602081018490529081018290527f50834081a1155e0602c1d55bbfd22e0f84cd7d190c6486e93679bfc1ad8931e1906060016110c7565b60055460ff16156118295760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610af1565b6005805460ff19166001908117909155600455565b61184661187b565b601f8190556040518181527ff5bdeca176beddded5a1132996e4edf0d16be5100214b17d8bada54bf867629790602001610bd4565b6000546201000090046001600160a01b03163314610d865760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610af1565b600080606060005b60185481101561158b5760195460009081526013602090815260408083205460129092529091205461192d91906127ef565b601a546019546000908152600d6020908152604080832086845260098352818420546001600160401b0316845290915290205461196a9190612827565b6119749190612807565b601954600090815260146020908152604080832054601b546011845282852087865260098552838620546001600160401b0316865290935292205492965090916119be9190612827565b6119c89190612807565b601980546000908152600f602090815260408083208684526009835281842080546001600160401b0390811686529184528285208b9055855485526010845282852090549091168452825280832085905592548252601281528282205460138252918390205483519182018990529281018490526060810191909152608081019190915290935060a00160405160208183030381529060405291508060001415611a9d57601954600090815260126020908152604080832054601390925290912054611a989186918691906120c3565b611ac1565b600081815260096020526040902054611abf906001600160401b031683611e23565b505b80611acb81612957565b9150506118fb565b6001600160a01b038116611afd576040516335fdcccd60e21b815260006004820152602401610af1565b600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008160400151806020019051810190611b3f919061239c565b602083810151601780546000908152601584526040808220805467ffffffffffffffff19166001600160401b039095169490941790935560608701519154815260168452919091208151939450611b9c939092919091019061219c565b50601760008154611bac90612957565b909155506008546001600160a01b0316301415611cd7576020820151601e546001600160401b0390911690610100900460ff1615611c46576000818152600b60205260409020546001600160a01b0383811691161415611c1457611c1483606001518261213c565b601c60008154611c2390612957565b90915550601854601c541415611c4157601e805460ff191660011790555b611cd1565b6000818152600b60205260409020546001600160a01b038381169116148015611c7e57506019546000828152600c6020526040902054105b15611cd1576019546000828152600c60205260409020556060830151611ca4908261213c565b601c60008154611cb390612957565b90915550601854601c541415611cd157601e805460ff191660011790555b50611cfa565b6008546001600160a01b0382811691161415611cfa57611cfa826060015161216e565b81602001516001600160401b031682600001517f4add8c8902d6fd412fed639bf652d936405bbb837c732a202153c91e89ebfaa78460400151806020019051810190611d46919061239c565b8560600151604051611d5992919061262a565b60405180910390a35050565b601980546000908152600d60209081526040808320858452825280832088905583548352600e825280832085845282528083208790558354835260118252808320858452825280832086905592548252601290529081208054869290611dcc9084906127ef565b909155505060195460009081526013602052604081208054859290611df29084906127ef565b909155505060195460009081526014602052604081208054849290611e189084906127ef565b909155505050505050565b6040805160a0810182526001600160401b0384166000908152600b602052918220546001600160a01b031660c082015281908060e0810160408051808303601f190181529181529082526020808301879052815160008082529181018352929091019190611eb3565b6040805180820190915260008082526020820152815260200190600190039081611e8c5790505b50815260006020808301829052604080518082018252601f548082529083019384528151602481019190915292511515604480850191909152815180850390910181526064909301815290820180516001600160e01b03166397a657c960e01b179052909101526006546040516320487ded60e01b81529192506000916001600160a01b03909116906320487ded90611f52908890869060040161269d565b60206040518083038186803b158015611f6a57600080fd5b505afa158015611f7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa2919061244a565b905047811115611fce57604051634787a10360e11b815247600482015260248101829052604401610af1565b6006546040516396f4e9f960e01b81526001600160a01b03909116906396f4e9f9908390612002908990879060040161269d565b6020604051808303818588803b15801561201b57600080fd5b505af115801561202f573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612054919061244a565b6001600160401b0386166000818152600b6020526040808220549051939650919286927f3d8a9f055772202d2c3c1fddbad930d3dbe588d8692b75b84cee071946282911926120b3926001600160a01b03909216918a91908890612656565b60405180910390a3505092915050565b600754604051635ec4352d60e11b8152600481018690526024810185905260448101849052606481018390526001600160a01b039091169063bd886a5a90608401600060405180830381600087803b15801561211e57600080fd5b505af1158015612132573d6000803e3d6000fd5b5050505050505050565b6000806000848060200190518101906121559190612525565b92509250925061216783838387611d65565b5050505050565b600080600080848060200190518101906121889190612552565b9350935093509350612167848484846120c3565b8280546121a89061291c565b90600052602060002090601f0160209004810192826121ca5760008555612210565b82601f106121e357805160ff1916838001178555612210565b82800160010185558215612210579182015b828111156122105782518255916020019190600101906121f5565b5061221c929150612220565b5090565b5b8082111561221c5760008155600101612221565b600082601f830112612245578081fd5b813560206001600160401b0382111561226057612260612988565b61226e818360051b016127bf565b80838252828201915082860187848660061b890101111561228d578586fd5b855b858110156122d657604080838b0312156122a7578788fd5b6122af612775565b83356122ba8161299e565b815283870135878201528552938501939091019060010161228f565b5090979650505050505050565b803580151581146122f357600080fd5b919050565b600082601f830112612308578081fd5b81356001600160401b0381111561232157612321612988565b612334601f8201601f19166020016127bf565b818152846020838601011115612348578283fd5b816020850160208301379081016020019190915292915050565b80356001600160401b03811681146122f357600080fd5b60006020828403121561238a578081fd5b81356123958161299e565b9392505050565b6000602082840312156123ad578081fd5b81516123958161299e565b6000806000606084860312156123cc578182fd5b83356123d78161299e565b92506123e5602085016122e3565b91506123f360408501612362565b90509250925092565b6000806040838503121561240e578182fd5b82356124198161299e565b915061242760208401612362565b90509250929050565b600060208284031215612441578081fd5b612395826122e3565b60006020828403121561245b578081fd5b5051919050565b600060208284031215612473578081fd5b81356001600160e01b031981168114612395578182fd5b60006020828403121561249b578081fd5b81356001600160401b038111156124b0578182fd5b820160a08185031215612395578182fd5b6000602082840312156124d2578081fd5b5035919050565b600080604083850312156124eb578081fd5b50508035926020909101359150565b60008060006060848603121561250e578081fd5b505081359360208301359350604090920135919050565b600080600060608486031215612539578081fd5b8351925060208401519150604084015190509250925092565b60008060008060808587031215612567578182fd5b505082516020840151604085015160609095015191969095509092509050565b600060208284031215612598578081fd5b61239582612362565b6000806000606084860312156125b5578081fd5b6125be84612362565b925060208401356125ce8161299e565b929592945050506040919091013590565b60008151808452815b81811015612604576020818501810151868301820152016125e8565b818111156126155782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038316815260406020820181905260009061264e908301846125df565b949350505050565b600060018060a01b0380871683526080602084015261267860808401876125df565b94166040830152506060015292915050565b60208152600061239560208301846125df565b600060406001600160401b038516835260208181850152845160a0838601526126c960e08601826125df565b905081860151603f19808784030160608801526126e683836125df565b88860151888203830160808a015280518083529086019450879350908501905b8084101561273857845180516001600160a01b0316835286015186830152938501936001939093019290860190612706565b5060608901516001600160a01b031660a08901526080890151888203830160c08a0152955061276781876125df565b9a9950505050505050505050565b604080519081016001600160401b038111828210171561279757612797612988565b60405290565b60405160a081016001600160401b038111828210171561279757612797612988565b604051601f8201601f191681016001600160401b03811182821017156127e7576127e7612988565b604052919050565b6000821982111561280257612802612972565b500190565b60008261282257634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561284157612841612972565b500290565b60008282101561285857612858612972565b500390565b600060a0823603121561286e578081fd5b61287661279d565b8235815261288660208401612362565b602082015260408301356001600160401b03808211156128a4578384fd5b6128b0368387016122f8565b604084015260608501359150808211156128c8578384fd5b6128d4368387016122f8565b606084015260808501359150808211156128ec578384fd5b506128f936828601612235565b60808301525092915050565b60008161291457612914612972565b506000190190565b600181811c9082168061293057607f821691505b6020821081141561295157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561296b5761296b612972565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610ca857600080fdfea26469706673582212207c6823acf2366d491a277e4ed85f31aa3bcec244df1273b76cc163417d4c2dad64736f6c63430008040033

Deployed Bytecode

0x6080604052600436106103015760003560e01c806385572ffb11610190578063b4b2c779116100dc578063ebc7977211610095578063ef5aea6b1161006f578063ef5aea6b146109e4578063ef78d4fd14610a05578063fa31ce7c14610a1b578063fd8a8cc614610a4857600080fd5b8063ebc7977214610995578063edb5eef1146109aa578063ee7d72b4146109c457600080fd5b8063b4b2c779146108dd578063c3b83f5f146108f3578063dadcea4d14610913578063e36fa14114610929578063e3d0603e1461095f578063e6741deb1461097f57600080fd5b806391b4ded9116101495780639c3971ce116101235780639c3971ce1461084c578063a00301eb14610862578063a0cd0f211461089a578063b0f479a1146108ba57600080fd5b806391b4ded9146107de578063940c1f49146107f457806396fd83801461082c57600080fd5b806385572ffb146106e657806386c4f4d71461070657806389889008146107335780638b3c0e35146107535780638b978062146107805780638da5cb5b146107b857600080fd5b80633b6f3ec01161024f5780635d0e31fb11610208578063735744e9116101e2578063735744e91461065957806379ba5097146106915780637bc98264146106a65780637f852582146106c657600080fd5b80635d0e31fb146105ec57806366eb91361461060c578063710183891461062c57600080fd5b80633b6f3ec0146105325780633bad3048146105485780633d8417681461055d57806353a47bb71461057c5780635614fe8f1461059c5780635c975abb146105d257600080fd5b806316c38b3c116102bc5780631ee3d3ec116102965780631ee3d3ec146104705780632ca5214c146104af57806331c1e16a146104c4578063323a2bee146104e457600080fd5b806316c38b3c1461040d578063180305991461042d5780631e45403a1461045a57600080fd5b806204398b1461030d57806237f0791461033657806301ffc9a71461036e5780630ae12fc81461039e57806313af4035146103cb5780631627540c146103ed57600080fd5b3661030857005b600080fd5b34801561031957600080fd5b50610323601a5481565b6040519081526020015b60405180910390f35b34801561034257600080fd5b506103236103513660046124d9565b600d60209081526000928352604080842090915290825290205481565b34801561037a57600080fd5b5061038e610389366004612462565b610a68565b604051901515815260200161032d565b3480156103aa57600080fd5b506103236103b9366004612587565b600a6020526000908152604090205481565b3480156103d757600080fd5b506103eb6103e6366004612379565b610a9f565b005b3480156103f957600080fd5b506103eb610408366004612379565b610bdf565b34801561041957600080fd5b506103eb610428366004612430565b610c35565b34801561043957600080fd5b5061044d6104483660046124c1565b610cab565b60405161032d919061268a565b34801561046657600080fd5b5061032360175481565b34801561047c57600080fd5b5060085461049790600160a01b90046001600160401b031681565b6040516001600160401b03909116815260200161032d565b3480156104bb57600080fd5b506103eb610d45565b3480156104d057600080fd5b506103eb6104df366004612379565b610d88565b3480156104f057600080fd5b5061051a6104ff3660046124c1565b600b602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161032d565b34801561053e57600080fd5b5061032360185481565b34801561055457600080fd5b50610497610de7565b34801561056957600080fd5b50601e5461038e90610100900460ff1681565b34801561058857600080fd5b5060015461051a906001600160a01b031681565b3480156105a857600080fd5b506104976105b73660046124c1565b6015602052600090815260409020546001600160401b031681565b3480156105de57600080fd5b5060035461038e9060ff1681565b3480156105f857600080fd5b506103eb6106073660046125a1565b610e25565b34801561061857600080fd5b5060085461051a906001600160a01b031681565b34801561063857600080fd5b506103236106473660046124c1565b600c6020526000908152604090205481565b34801561066557600080fd5b506103236106743660046124d9565b601060209081526000928352604080842090915290825290205481565b34801561069d57600080fd5b506103eb6110d4565b3480156106b257600080fd5b506103eb6106c13660046124d9565b6111d1565b3480156106d257600080fd5b506103eb6106e1366004612379565b611221565b3480156106f257600080fd5b506103eb61070136600461248a565b611277565b34801561071257600080fd5b506103236107213660046124c1565b60136020526000908152604090205481565b34801561073f57600080fd5b506103eb61074e3660046123fc565b6112ba565b34801561075f57600080fd5b5061032361076e3660046124c1565b60146020526000908152604090205481565b34801561078c57600080fd5b5061032361079b3660046124d9565b600f60209081526000928352604080842090915290825290205481565b3480156107c457600080fd5b5060005461051a906201000090046001600160a01b031681565b3480156107ea57600080fd5b5061032360025481565b34801561080057600080fd5b5061032361080f3660046124d9565b600e60209081526000928352604080842090915290825290205481565b34801561083857600080fd5b506103eb610847366004612430565b6113b3565b34801561085857600080fd5b50610323601b5481565b34801561086e57600080fd5b5061032361087d3660046124d9565b601160209081526000928352604080842090915290825290205481565b3480156108a657600080fd5b506103eb6108b53660046123b8565b6113f2565b3480156108c657600080fd5b5060055461010090046001600160a01b031661051a565b3480156108e957600080fd5b50610323601d5481565b3480156108ff57600080fd5b506103eb61090e366004612379565b611591565b34801561091f57600080fd5b50610323601f5481565b34801561093557600080fd5b506104976109443660046124c1565b6009602052600090815260409020546001600160401b031681565b34801561096b57600080fd5b506103eb61097a3660046124fa565b6116aa565b34801561098b57600080fd5b50610323601c5481565b3480156109a157600080fd5b506103eb6117e0565b3480156109b657600080fd5b50601e5461038e9060ff1681565b3480156109d057600080fd5b506103eb6109df3660046124c1565b61183e565b3480156109f057600080fd5b5061038e6008546001600160a01b0316301490565b348015610a1157600080fd5b5061032360195481565b348015610a2757600080fd5b50610323610a363660046124c1565b60126020526000908152604090205481565b348015610a5457600080fd5b5060075461051a906001600160a01b031681565b60006001600160e01b031982166385572ffb60e01b1480610a9957506001600160e01b031982166301ffc9a760e01b145b92915050565b6001600160a01b038116610afa5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600154600160a01b900460ff1615610b665760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610af1565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b610be761187b565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610bd4565b610c3d61187b565b60035460ff1615158115151415610c515750565b6003805460ff191682151590811790915560ff1615610c6f57426002555b60035460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec590602001610bd4565b50565b60166020526000908152604090208054610cc49061291c565b80601f0160208091040260200160405190810160405280929190818152602001828054610cf09061291c565b8015610d3d5780601f10610d1257610100808354040283529160200191610d3d565b820191906000526020600020905b815481529060010190602001808311610d2057829003601f168201915b505050505081565b610d4d61187b565b601e5460ff1615610d8657610d606118f3565b6000601c819055601e805460ff1916905560198054909190610d8190612957565b909155505b565b610d9061187b565b610d9981611ad3565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f28dfffa003cbac2f767191365506e49c4aba7ab310ebfa0a9d770e90f1b4550e90602001610bd4565b60175460009015610e2257601560006001601754610e059190612846565b81526020810191909152604001600020546001600160401b031690505b90565b610e2d61187b565b6008546001600160a01b03163014610e7c5760405162461bcd60e51b81526020600482015260126024820152712737b726b0b9ba32b921b7b63632b1ba37b960711b6044820152606401610af1565b601854811115610ebb5760405162461bcd60e51b815260206004820152600a602482015269536c6f74546f6f42696760b01b6044820152606401610af1565b601854811415610f3757601880546000908152600960209081526040808320805467ffffffffffffffff19166001600160401b0389169081179091558352600b825280832080546001600160a01b0319166001600160a01b0388161790558354600a9092528220819055610f2e90612957565b90915550611084565b6001600160401b0383166000908152600b60205260409020546001600160a01b0316158015610f6d57506001600160a01b038216155b1561102957601860008154610f8190612905565b90915550601880546000908152600960208181526040808420546001600160401b03908116808652600b808552838720548b84168852848820600a8752858920548952878752858920805467ffffffffffffffff19908116909517905580546001600160a01b039092166001600160a01b0319928316179055885488528488205490931687528452828620805490921690915594548452919052902080549091169055611084565b6000818152600960209081526040808320805467ffffffffffffffff19166001600160401b0388169081179091558352600b825280832080546001600160a01b0319166001600160a01b038716179055600a90915290208190555b604080516001600160401b03851681526001600160a01b03841660208201527fd0983e2eb7b3d3254287f511871438d35f972763744ee70fb7602c9138e87db591015b60405180910390a1505050565b6001546001600160a01b0316331461114c5760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610af1565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b6111d961187b565b601a829055601b81905560408051838152602081018390527fc709e263c1f9c98bedb98ba5c5f2a5fd6c3632e74057cc4f1b961b3541190c8191015b60405180910390a15050565b61122961187b565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f475a2179b9b6a155e7ba3f46a461beb6798279b265026364944e38dcb4bacafe90602001610bd4565b60055461010090046001600160a01b031633146112a9576040516335fdcccd60e21b8152336004820152602401610af1565b610ca86112b58261285d565b611b25565b6112c261187b565b600880546001600160a01b0384166001600160e01b03199091168117600160a01b6001600160401b038516908102919091179092556000828152600b6020908152604080832080546001600160a01b0319169094179093557fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b805467ffffffffffffffff1916909417909355600a9092528120556018541561136657601854611369565b60015b601855604080516001600160a01b03841681526001600160401b03831660208201527fdd3bc5fc3811d69c4fec34eef96db67bf7f4531c4ee58a2ccbe73dff6d101fa49101611215565b6113bb61187b565b80156113de5760198054601d55601e805461ff0019166101001790556000905550565b601e805461ff0019169055601d5460195550565b600054610100900460ff1661140d5760005460ff1615611411565b303b155b6114745760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610af1565b600054610100900460ff16158015611496576000805461ffff19166101011790555b61149f33610a9f565b6114a76117e0565b6114b084611ad3565b600680546001600160a01b0319166001600160a01b038616179055620f4240601f55821561157957600880546001600160401b038416600160a01b810267ffffffffffffffff60a01b19309081166001600160e01b031990941693909317179092557fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b805467ffffffffffffffff1916831790556000918252600b6020908152604080842080546001600160a01b031916909317909255600a9052812055600160188190556019555b801561158b576000805461ff00191690555b50505050565b61159961187b565b6001600160a01b0381166115e15760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610af1565b600154600160a81b900460ff16156116315760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610af1565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610bd4565b6007546001600160a01b031633146116f05760405162461bcd60e51b815260206004820152600960248201526824b73b29b2b73232b960b91b6044820152606401610af1565b6008546001600160a01b03163014156117575760085461172590849084908490600160a01b90046001600160401b0316611d65565b601c6000815461173490612957565b90915550601854601c54141561175257601e805460ff191660011790555b6117a2565b6040805160208101859052808201849052606080820184905282518083039091018152608090910190915260085461179f90600160a01b90046001600160401b031682611e23565b50505b60408051848152602081018490529081018290527f50834081a1155e0602c1d55bbfd22e0f84cd7d190c6486e93679bfc1ad8931e1906060016110c7565b60055460ff16156118295760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610af1565b6005805460ff19166001908117909155600455565b61184661187b565b601f8190556040518181527ff5bdeca176beddded5a1132996e4edf0d16be5100214b17d8bada54bf867629790602001610bd4565b6000546201000090046001600160a01b03163314610d865760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610af1565b600080606060005b60185481101561158b5760195460009081526013602090815260408083205460129092529091205461192d91906127ef565b601a546019546000908152600d6020908152604080832086845260098352818420546001600160401b0316845290915290205461196a9190612827565b6119749190612807565b601954600090815260146020908152604080832054601b546011845282852087865260098552838620546001600160401b0316865290935292205492965090916119be9190612827565b6119c89190612807565b601980546000908152600f602090815260408083208684526009835281842080546001600160401b0390811686529184528285208b9055855485526010845282852090549091168452825280832085905592548252601281528282205460138252918390205483519182018990529281018490526060810191909152608081019190915290935060a00160405160208183030381529060405291508060001415611a9d57601954600090815260126020908152604080832054601390925290912054611a989186918691906120c3565b611ac1565b600081815260096020526040902054611abf906001600160401b031683611e23565b505b80611acb81612957565b9150506118fb565b6001600160a01b038116611afd576040516335fdcccd60e21b815260006004820152602401610af1565b600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008160400151806020019051810190611b3f919061239c565b602083810151601780546000908152601584526040808220805467ffffffffffffffff19166001600160401b039095169490941790935560608701519154815260168452919091208151939450611b9c939092919091019061219c565b50601760008154611bac90612957565b909155506008546001600160a01b0316301415611cd7576020820151601e546001600160401b0390911690610100900460ff1615611c46576000818152600b60205260409020546001600160a01b0383811691161415611c1457611c1483606001518261213c565b601c60008154611c2390612957565b90915550601854601c541415611c4157601e805460ff191660011790555b611cd1565b6000818152600b60205260409020546001600160a01b038381169116148015611c7e57506019546000828152600c6020526040902054105b15611cd1576019546000828152600c60205260409020556060830151611ca4908261213c565b601c60008154611cb390612957565b90915550601854601c541415611cd157601e805460ff191660011790555b50611cfa565b6008546001600160a01b0382811691161415611cfa57611cfa826060015161216e565b81602001516001600160401b031682600001517f4add8c8902d6fd412fed639bf652d936405bbb837c732a202153c91e89ebfaa78460400151806020019051810190611d46919061239c565b8560600151604051611d5992919061262a565b60405180910390a35050565b601980546000908152600d60209081526040808320858452825280832088905583548352600e825280832085845282528083208790558354835260118252808320858452825280832086905592548252601290529081208054869290611dcc9084906127ef565b909155505060195460009081526013602052604081208054859290611df29084906127ef565b909155505060195460009081526014602052604081208054849290611e189084906127ef565b909155505050505050565b6040805160a0810182526001600160401b0384166000908152600b602052918220546001600160a01b031660c082015281908060e0810160408051808303601f190181529181529082526020808301879052815160008082529181018352929091019190611eb3565b6040805180820190915260008082526020820152815260200190600190039081611e8c5790505b50815260006020808301829052604080518082018252601f548082529083019384528151602481019190915292511515604480850191909152815180850390910181526064909301815290820180516001600160e01b03166397a657c960e01b179052909101526006546040516320487ded60e01b81529192506000916001600160a01b03909116906320487ded90611f52908890869060040161269d565b60206040518083038186803b158015611f6a57600080fd5b505afa158015611f7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa2919061244a565b905047811115611fce57604051634787a10360e11b815247600482015260248101829052604401610af1565b6006546040516396f4e9f960e01b81526001600160a01b03909116906396f4e9f9908390612002908990879060040161269d565b6020604051808303818588803b15801561201b57600080fd5b505af115801561202f573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612054919061244a565b6001600160401b0386166000818152600b6020526040808220549051939650919286927f3d8a9f055772202d2c3c1fddbad930d3dbe588d8692b75b84cee071946282911926120b3926001600160a01b03909216918a91908890612656565b60405180910390a3505092915050565b600754604051635ec4352d60e11b8152600481018690526024810185905260448101849052606481018390526001600160a01b039091169063bd886a5a90608401600060405180830381600087803b15801561211e57600080fd5b505af1158015612132573d6000803e3d6000fd5b5050505050505050565b6000806000848060200190518101906121559190612525565b92509250925061216783838387611d65565b5050505050565b600080600080848060200190518101906121889190612552565b9350935093509350612167848484846120c3565b8280546121a89061291c565b90600052602060002090601f0160209004810192826121ca5760008555612210565b82601f106121e357805160ff1916838001178555612210565b82800160010185558215612210579182015b828111156122105782518255916020019190600101906121f5565b5061221c929150612220565b5090565b5b8082111561221c5760008155600101612221565b600082601f830112612245578081fd5b813560206001600160401b0382111561226057612260612988565b61226e818360051b016127bf565b80838252828201915082860187848660061b890101111561228d578586fd5b855b858110156122d657604080838b0312156122a7578788fd5b6122af612775565b83356122ba8161299e565b815283870135878201528552938501939091019060010161228f565b5090979650505050505050565b803580151581146122f357600080fd5b919050565b600082601f830112612308578081fd5b81356001600160401b0381111561232157612321612988565b612334601f8201601f19166020016127bf565b818152846020838601011115612348578283fd5b816020850160208301379081016020019190915292915050565b80356001600160401b03811681146122f357600080fd5b60006020828403121561238a578081fd5b81356123958161299e565b9392505050565b6000602082840312156123ad578081fd5b81516123958161299e565b6000806000606084860312156123cc578182fd5b83356123d78161299e565b92506123e5602085016122e3565b91506123f360408501612362565b90509250925092565b6000806040838503121561240e578182fd5b82356124198161299e565b915061242760208401612362565b90509250929050565b600060208284031215612441578081fd5b612395826122e3565b60006020828403121561245b578081fd5b5051919050565b600060208284031215612473578081fd5b81356001600160e01b031981168114612395578182fd5b60006020828403121561249b578081fd5b81356001600160401b038111156124b0578182fd5b820160a08185031215612395578182fd5b6000602082840312156124d2578081fd5b5035919050565b600080604083850312156124eb578081fd5b50508035926020909101359150565b60008060006060848603121561250e578081fd5b505081359360208301359350604090920135919050565b600080600060608486031215612539578081fd5b8351925060208401519150604084015190509250925092565b60008060008060808587031215612567578182fd5b505082516020840151604085015160609095015191969095509092509050565b600060208284031215612598578081fd5b61239582612362565b6000806000606084860312156125b5578081fd5b6125be84612362565b925060208401356125ce8161299e565b929592945050506040919091013590565b60008151808452815b81811015612604576020818501810151868301820152016125e8565b818111156126155782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038316815260406020820181905260009061264e908301846125df565b949350505050565b600060018060a01b0380871683526080602084015261267860808401876125df565b94166040830152506060015292915050565b60208152600061239560208301846125df565b600060406001600160401b038516835260208181850152845160a0838601526126c960e08601826125df565b905081860151603f19808784030160608801526126e683836125df565b88860151888203830160808a015280518083529086019450879350908501905b8084101561273857845180516001600160a01b0316835286015186830152938501936001939093019290860190612706565b5060608901516001600160a01b031660a08901526080890151888203830160c08a0152955061276781876125df565b9a9950505050505050505050565b604080519081016001600160401b038111828210171561279757612797612988565b60405290565b60405160a081016001600160401b038111828210171561279757612797612988565b604051601f8201601f191681016001600160401b03811182821017156127e7576127e7612988565b604052919050565b6000821982111561280257612802612972565b500190565b60008261282257634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561284157612841612972565b500290565b60008282101561285857612858612972565b500390565b600060a0823603121561286e578081fd5b61287661279d565b8235815261288660208401612362565b602082015260408301356001600160401b03808211156128a4578384fd5b6128b0368387016122f8565b604084015260608501359150808211156128c8578384fd5b6128d4368387016122f8565b606084015260808501359150808211156128ec578384fd5b506128f936828601612235565b60808301525092915050565b60008161291457612914612972565b506000190190565b600181811c9082168061293057607f821691505b6020821081141561295157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561296b5761296b612972565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610ca857600080fdfea26469706673582212207c6823acf2366d491a277e4ed85f31aa3bcec244df1273b76cc163417d4c2dad64736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading