Contract 0xc6a7a3f049B07CCb260edd1460CA5a6ac9f966a9

Contract Overview

Balance:
0 ETH
Txn Hash Method
Block
From
To
Value
0x7d57156bd21d3359f83dc3113d7c1f63b0f53f3a3d5d92073ad92a4bcf71d5260x6080604022702722022-10-25 11:34:03340 days 5 hrs ago0x9841484a4a6c0b61c4eea71376d76453fd05ec9c IN  Create: EscrowThales0 ETH0.014915346340.00001
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x4ace3518f28d99402007c0807b74628ca897a6c3529a17380f8eaad299b5aa29112147102023-06-27 9:18:0895 days 7 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0x4ace3518f28d99402007c0807b74628ca897a6c3529a17380f8eaad299b5aa29112147102023-06-27 9:18:0895 days 7 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0x4ace3518f28d99402007c0807b74628ca897a6c3529a17380f8eaad299b5aa29112147102023-06-27 9:18:0895 days 7 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0x4ace3518f28d99402007c0807b74628ca897a6c3529a17380f8eaad299b5aa29112147102023-06-27 9:18:0895 days 7 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xe60da2c80a56e3cea17efc6d52aa213c679c26be926d8a9451dbf56bf9ea1ec0112146852023-06-27 9:17:1895 days 7 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0x9139bf9d8167e887d8ed52842c9fa17927f105cd7d713087606aa6308d4d18d6112120502023-06-27 7:49:2895 days 9 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0x9139bf9d8167e887d8ed52842c9fa17927f105cd7d713087606aa6308d4d18d6112120502023-06-27 7:49:2895 days 9 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0x9139bf9d8167e887d8ed52842c9fa17927f105cd7d713087606aa6308d4d18d6112120502023-06-27 7:49:2895 days 9 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0x9139bf9d8167e887d8ed52842c9fa17927f105cd7d713087606aa6308d4d18d6112120502023-06-27 7:49:2895 days 9 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xf86a8ef5354c036a08dd16fe70be4a3512cdfe212adc98f5e0930fc659f47259106619062023-06-14 14:11:20108 days 2 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xf86a8ef5354c036a08dd16fe70be4a3512cdfe212adc98f5e0930fc659f47259106619062023-06-14 14:11:20108 days 2 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xf86a8ef5354c036a08dd16fe70be4a3512cdfe212adc98f5e0930fc659f47259106619062023-06-14 14:11:20108 days 2 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xf86a8ef5354c036a08dd16fe70be4a3512cdfe212adc98f5e0930fc659f47259106619062023-06-14 14:11:20108 days 2 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xba331766f140d9e8b44bef31751c3cb5b2b7b6a9632c20624bb4aeef1f4ae9fd104393902023-06-09 10:34:08113 days 6 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xba331766f140d9e8b44bef31751c3cb5b2b7b6a9632c20624bb4aeef1f4ae9fd104393902023-06-09 10:34:08113 days 6 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xba331766f140d9e8b44bef31751c3cb5b2b7b6a9632c20624bb4aeef1f4ae9fd104393902023-06-09 10:34:08113 days 6 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xba331766f140d9e8b44bef31751c3cb5b2b7b6a9632c20624bb4aeef1f4ae9fd104393902023-06-09 10:34:08113 days 6 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0x55f76205a598b512f46ba0290ac131785b17e8828b0c8189ca73e7255f73ed50104378882023-06-09 9:44:04113 days 7 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xfddf90f12b37b79bf7a8f37ea303afd9c63301403c36454ca772b8f822f96ddb85876142023-04-27 13:48:16156 days 3 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xfddf90f12b37b79bf7a8f37ea303afd9c63301403c36454ca772b8f822f96ddb85876142023-04-27 13:48:16156 days 3 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xfddf90f12b37b79bf7a8f37ea303afd9c63301403c36454ca772b8f822f96ddb85876142023-04-27 13:48:16156 days 3 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xfddf90f12b37b79bf7a8f37ea303afd9c63301403c36454ca772b8f822f96ddb85876142023-04-27 13:48:16156 days 3 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xfd6c76e84d0029aae68086cc316f02e4469fdd4b8f1f0105a3c754b5bc64635085875562023-04-27 13:46:20156 days 3 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xfd6c76e84d0029aae68086cc316f02e4469fdd4b8f1f0105a3c754b5bc64635085875562023-04-27 13:46:20156 days 3 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
0xfd6c76e84d0029aae68086cc316f02e4469fdd4b8f1f0105a3c754b5bc64635085875562023-04-27 13:46:20156 days 3 hrs ago 0xe7fc1ded638f00e7e20b6d5f024b0f33a7502609 0xc6a7a3f049b07ccb260edd1460ca5a6ac9f966a90 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EscrowThales

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

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

pragma solidity ^0.5.16;

import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol";
import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/SafeERC20.sol";

import "../utils/proxy/ProxyReentrancyGuard.sol";
import "../utils/proxy/ProxyOwned.sol";
import "../utils/proxy/ProxyPausable.sol";
import "@openzeppelin/upgrades-core/contracts/Initializable.sol";

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

/// @title A Escrow contract that provides logic for escrow and vesting staking rewards
contract EscrowThales is IEscrowThales, Initializable, ProxyOwned, ProxyReentrancyGuard, ProxyPausable {
    using SafeMath for uint;
    using SafeERC20 for IERC20;

    IERC20 public vestingToken;
    IStakingThales public iStakingThales;
    address public airdropContract;

    uint public constant NUM_PERIODS = 10;
    uint public totalEscrowedRewards;
    uint public totalEscrowBalanceNotIncludedInStaking;
    uint public currentVestingPeriod;

    uint private _totalVested;

    struct VestingEntry {
        uint amount;
        uint vesting_period;
    }

    mapping(address => VestingEntry[NUM_PERIODS]) public vestingEntries;
    mapping(address => uint) public totalAccountEscrowedAmount;

    mapping(address => uint) public lastPeriodAddedReward;

    bool private testMode;
    IThalesStakingRewardsPool public ThalesStakingRewardsPool;

    /* ========== CONSTRUCTOR ========== */

    function initialize(
        address _owner,
        address _vestingToken //THALES
    ) public initializer {
        setOwner(_owner);
        initNonReentrant();
        vestingToken = IERC20(_vestingToken);
    }

    /* ========== VIEWS ========== */

    /// @notice Get the vesting period of specific vesting entry for the account
    /// @param account to get the vesting period for
    /// @param index of vesting entry to get vesting period for
    /// @return the vesting period
    function getStakerPeriod(address account, uint index) external view returns (uint) {
        require(account != address(0), "Invalid account address");
        return vestingEntries[account][index].vesting_period;
    }

    /// @notice Get the vesting amount of specific vesting entry for the account
    /// @param account to get the vesting amount for
    /// @param index of vesting entry to get vesting amount for
    /// @return the vesting amount for the account
    function getStakerAmounts(address account, uint index) external view returns (uint) {
        require(account != address(0), "Invalid account address");
        return vestingEntries[account][index].amount;
    }

    /// @notice Get the staked escrowed balance for the account
    /// @param account to get the staked escrowed balance for
    /// @return the staked escrowed balance for the account
    function getStakedEscrowedBalanceForRewards(address account) external view returns (uint) {
        if (lastPeriodAddedReward[account] == currentVestingPeriod) {
            return
                totalAccountEscrowedAmount[account].sub(
                    vestingEntries[account][currentVestingPeriod.mod(NUM_PERIODS)].amount
                );
        } else {
            return totalAccountEscrowedAmount[account];
        }
    }

    /// @notice Get the claimable vesting amount for the account
    /// @param account to get the claimable vesting amount for
    /// @return the claimable vesting amount for the account
    function claimable(address account) external view returns (uint) {
        require(account != address(0), "Invalid address");
        return totalAccountEscrowedAmount[account].sub(_getVestingNotAvailable(account));
    }

    /* ========== PUBLIC ========== */

    /// @notice Add the amount of staking token to the escrow for the account
    /// @param account to add the amount to the escrow for
    /// @param amount to add to the escrow
    function addToEscrow(address account, uint amount) external notPaused {
        require(account != address(0), "Invalid address");
        require(amount > 0, "Amount is 0");
        require(
            msg.sender == address(ThalesStakingRewardsPool) || msg.sender == airdropContract,
            "Add to escrow can only be called from staking or ongoing airdrop contracts"
        );

        totalAccountEscrowedAmount[account] = totalAccountEscrowedAmount[account].add(amount);

        if (lastPeriodAddedReward[account] == currentVestingPeriod) {
            vestingEntries[account][currentVestingPeriod.mod(NUM_PERIODS)].amount = vestingEntries[account][
                currentVestingPeriod.mod(NUM_PERIODS)
            ]
                .amount
                .add(amount);
        } else {
            vestingEntries[account][currentVestingPeriod.mod(NUM_PERIODS)].amount = amount;
        }
        vestingEntries[account][currentVestingPeriod.mod(NUM_PERIODS)].vesting_period = currentVestingPeriod.add(
            NUM_PERIODS
        );
        lastPeriodAddedReward[account] = currentVestingPeriod;

        totalEscrowedRewards = totalEscrowedRewards.add(amount);
        //Transfering THALES from StakingThales to EscrowThales
        vestingToken.safeTransferFrom(msg.sender, address(this), amount);

        // add to totalEscrowBalanceNotIncludedInStaking if user is not staking
        if (iStakingThales.stakedBalanceOf(account) == 0) {
            totalEscrowBalanceNotIncludedInStaking = totalEscrowBalanceNotIncludedInStaking.add(amount);
        }

        emit AddedToEscrow(account, amount);
    }

    /// @notice Vest the amount of escrowed tokens
    /// @param amount to vest
    function vest(uint amount) external nonReentrant notPaused returns (bool) {
        require(amount > 0, "Claimed amount is 0");
        require(currentVestingPeriod >= NUM_PERIODS, "Vesting rewards still not available");

        uint vestingAmount = 0;
        vestingAmount = totalAccountEscrowedAmount[msg.sender].sub(_getVestingNotAvailable(msg.sender));
        // Amount must be lower than the reward
        require(amount <= vestingAmount, "Amount exceeds the claimable rewards");
        totalAccountEscrowedAmount[msg.sender] = totalAccountEscrowedAmount[msg.sender].sub(amount);
        totalEscrowedRewards = totalEscrowedRewards.sub(amount);
        _totalVested = _totalVested.add(amount);
        vestingToken.safeTransfer(msg.sender, amount);

        // subtract from totalEscrowBalanceNotIncludedInStaking if user is not staking
        if (iStakingThales.stakedBalanceOf(msg.sender) == 0) {
            totalEscrowBalanceNotIncludedInStaking = totalEscrowBalanceNotIncludedInStaking.sub(amount);
        }

        emit Vested(msg.sender, amount);
        return true;
    }

    /// @notice Add the amount of tokens to the total escrow balance not included in staking
    /// @param amount to add
    function addTotalEscrowBalanceNotIncludedInStaking(uint amount) external {
        require(msg.sender == address(iStakingThales), "Can only be called from staking contract");
        totalEscrowBalanceNotIncludedInStaking = totalEscrowBalanceNotIncludedInStaking.add(amount);
    }

    /// @notice Subtract the amount of tokens form the total escrow balance not included in staking
    /// @param amount to subtract
    function subtractTotalEscrowBalanceNotIncludedInStaking(uint amount) external {
        require(msg.sender == address(iStakingThales), "Can only be called from staking contract");
        totalEscrowBalanceNotIncludedInStaking = totalEscrowBalanceNotIncludedInStaking.sub(amount);
    }

    /// @notice Update the current vesting period
    function updateCurrentPeriod() external returns (bool) {
        if (!testMode) {
            require(msg.sender == address(iStakingThales), "Can only be called from staking contract");
        }
        currentVestingPeriod = currentVestingPeriod.add(1);
        return true;
    }

    /// @notice Set address of Staking Thales contract
    /// @param StakingThalesContract address of Staking Thales contract
    function setStakingThalesContract(address StakingThalesContract) external onlyOwner {
        require(StakingThalesContract != address(0), "Invalid address set");
        iStakingThales = IStakingThales(StakingThalesContract);
        emit StakingThalesContractChanged(StakingThalesContract);
    }

    /// @notice Enable the test mode
    function enableTestMode() external onlyOwner {
        testMode = true;
    }

    /// @notice Set address of Airdrop contract
    /// @param AirdropContract address of Airdrop contract
    function setAirdropContract(address AirdropContract) external onlyOwner {
        require(AirdropContract != address(0), "Invalid address set");
        airdropContract = AirdropContract;
        emit AirdropContractChanged(AirdropContract);
    }

    /// @notice Set address of Thales staking rewards pool
    /// @param _thalesStakingRewardsPool address of Thales staking rewards pool
    function setThalesStakingRewardsPool(address _thalesStakingRewardsPool) public onlyOwner {
        require(_thalesStakingRewardsPool != address(0), "Invalid address");
        ThalesStakingRewardsPool = IThalesStakingRewardsPool(_thalesStakingRewardsPool);
        emit ThalesStakingRewardsPoolChanged(_thalesStakingRewardsPool);
    }

    /// @notice Fix the vesting entry for the account
    /// @param account to fix the vesting entry for
    function fixEscrowEntry(address account) external onlyOwner {
        vestingEntries[account][currentVestingPeriod.mod(NUM_PERIODS)].vesting_period = currentVestingPeriod.add(
            NUM_PERIODS
        );
    }

    /// @notice Merge account to transfer all escrow amounts to another account
    /// @param srcAccount to merge
    /// @param destAccount to merge into
    function mergeAccount(address srcAccount, address destAccount) external {
        require(msg.sender == address(iStakingThales), "Can only be called from staking contract");

        if (iStakingThales.stakedBalanceOf(srcAccount) == 0 && iStakingThales.stakedBalanceOf(destAccount) > 0) {
            if (totalAccountEscrowedAmount[srcAccount] > 0) {
                totalEscrowBalanceNotIncludedInStaking = totalEscrowBalanceNotIncludedInStaking.sub(
                    totalAccountEscrowedAmount[srcAccount]
                );
            }
        }
        if (iStakingThales.stakedBalanceOf(destAccount) == 0 && iStakingThales.stakedBalanceOf(srcAccount) > 0) {
            if (totalAccountEscrowedAmount[destAccount] > 0) {
                totalEscrowBalanceNotIncludedInStaking = totalEscrowBalanceNotIncludedInStaking.sub(
                    totalAccountEscrowedAmount[destAccount]
                );
            }
        }

        totalAccountEscrowedAmount[destAccount] = totalAccountEscrowedAmount[destAccount].add(
            totalAccountEscrowedAmount[srcAccount]
        );
        lastPeriodAddedReward[destAccount] = currentVestingPeriod;

        uint vestingEntriesIndex;
        uint vestingEntriesPeriod;
        for (uint i = 1; i <= NUM_PERIODS; i++) {
            vestingEntriesIndex = currentVestingPeriod.add(i).mod(NUM_PERIODS);
            vestingEntriesPeriod = currentVestingPeriod.add(i);

            if (vestingEntriesPeriod != vestingEntries[destAccount][vestingEntriesIndex].vesting_period) {
                vestingEntries[destAccount][vestingEntriesIndex].amount = 0;
                vestingEntries[destAccount][vestingEntriesIndex].vesting_period = vestingEntriesPeriod;
            }

            if (vestingEntriesPeriod == vestingEntries[srcAccount][vestingEntriesIndex].vesting_period) {
                vestingEntries[destAccount][vestingEntriesIndex].amount = vestingEntries[destAccount][vestingEntriesIndex]
                    .amount
                    .add(vestingEntries[srcAccount][vestingEntriesIndex].amount);
            }
        }

        delete totalAccountEscrowedAmount[srcAccount];
        delete lastPeriodAddedReward[srcAccount];
        delete vestingEntries[srcAccount];
    }

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

    function _getVestingNotAvailable(address account) internal view returns (uint) {
        uint vesting_not_available = 0;
        for (uint i = 0; i < NUM_PERIODS; i++) {
            if (vestingEntries[account][i].vesting_period > currentVestingPeriod) {
                vesting_not_available = vesting_not_available.add(vestingEntries[account][i].amount);
            }
        }
        return vesting_not_available;
    }

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

    event AddedToEscrow(address acount, uint amount);
    event Vested(address account, uint amount);
    event StakingThalesContractChanged(address newAddress);
    event AirdropContractChanged(address newAddress);
    event ThalesStakingRewardsPoolChanged(address thalesStakingRewardsPool);
}

File 2 of 12 : SafeMath.sol
pragma solidity ^0.5.0;

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

        return c;
    }

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

        return c;
    }

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

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

        return c;
    }

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

        return c;
    }

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

File 3 of 12 : SafeERC20.sol
pragma solidity ^0.5.0;

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

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

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

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

    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value);
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

pragma solidity ^0.5.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 5 of 12 : ProxyOwned.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.5.16;

// 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 6 of 12 : ProxyPausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.5.16;

// 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 7 of 12 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.4.24 <0.7.0;


/**
 * @title Initializable
 *
 * @dev Helper contract to support initializer functions. To use it, replace
 * the constructor with a function that has the `initializer` modifier.
 * WARNING: Unlike constructors, initializer functions must be manually
 * invoked. This applies both to deploying an Initializable contract, as well
 * as extending an Initializable contract via inheritance.
 * WARNING: When used with inheritance, manual care must be taken to not invoke
 * a parent initializer twice, or ensure that all initializers are idempotent,
 * because this is not dealt with automatically as with constructors.
 */
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 use in the initializer function of a contract.
   */
  modifier initializer() {
    require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");

    bool isTopLevelCall = !initializing;
    if (isTopLevelCall) {
      initializing = true;
      initialized = true;
    }

    _;

    if (isTopLevelCall) {
      initializing = false;
    }
  }

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

  // Reserved storage space to allow for layout changes in the future.
  uint256[50] private ______gap;
}

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

pragma solidity >=0.5.16;

interface IEscrowThales {
    /* ========== VIEWS / VARIABLES ========== */
    function getStakerPeriod(address account, uint index) external view returns (uint);

    function getStakerAmounts(address account, uint index) external view returns (uint);

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

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

    function totalEscrowedRewards() external view returns (uint);

    function totalEscrowBalanceNotIncludedInStaking() external view returns (uint);

    function currentVestingPeriod() external view returns (uint);

    function updateCurrentPeriod() external returns (bool);

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

    function addToEscrow(address account, uint amount) external;

    function vest(uint amount) external returns (bool);

    function addTotalEscrowBalanceNotIncludedInStaking(uint amount) external;

    function subtractTotalEscrowBalanceNotIncludedInStaking(uint amount) external;

    function mergeAccount(address srcAccount, address destAccount) external;
}

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

pragma solidity >=0.5.16;

interface IStakingThales {
    function updateVolume(address account, uint amount) 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);
}

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

pragma solidity ^0.5.16;

interface IThalesStakingRewardsPool {
    function addToEscrow(address account, uint amount) external;
}

File 11 of 12 : IERC20.sol
pragma solidity ^0.5.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see `ERC20Detailed`.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

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

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

File 12 of 12 : Address.sol
pragma solidity ^0.5.0;

/**
 * @dev Collection of functions related to the address type,
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * This test is non-exhaustive, and there may be false-negatives: during the
     * execution of a contract's constructor, its address will be reported as
     * not containing a contract.
     *
     * > It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"acount","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AddedToEscrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"AirdropContractChanged","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":"address","name":"newAddress","type":"address"}],"name":"StakingThalesContractChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"thalesStakingRewardsPool","type":"address"}],"name":"ThalesStakingRewardsPoolChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Vested","type":"event"},{"constant":true,"inputs":[],"name":"NUM_PERIODS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ThalesStakingRewardsPool","outputs":[{"internalType":"contract IThalesStakingRewardsPool","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addToEscrow","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addTotalEscrowBalanceNotIncludedInStaking","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"airdropContract","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentVestingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"enableTestMode","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"fixEscrowEntry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getStakedEscrowedBalanceForRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getStakerAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getStakerPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"iStakingThales","outputs":[{"internalType":"contract IStakingThales","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"initNonReentrant","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_vestingToken","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastPauseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastPeriodAddedReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"srcAccount","type":"address"},{"internalType":"address","name":"destAccount","type":"address"}],"name":"mergeAccount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"AirdropContract","type":"address"}],"name":"setAirdropContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"StakingThalesContract","type":"address"}],"name":"setStakingThalesContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_thalesStakingRewardsPool","type":"address"}],"name":"setThalesStakingRewardsPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"subtractTotalEscrowBalanceNotIncludedInStaking","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalAccountEscrowedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalEscrowBalanceNotIncludedInStaking","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalEscrowedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"proxyAddress","type":"address"}],"name":"transferOwnershipAtInit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"updateCurrentPeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"vest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"vestingEntries","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"vesting_period","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vestingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061246d806100206000396000f3fe608060405234801561001057600080fd5b50600436106102275760003560e01c806379ba509711610130578063acfabbe4116100b8578063c3b83f5f1161007c578063c3b83f5f146105a5578063c6b763f9146105cb578063cf09ce2b146105f1578063ebc79772146105f9578063f388466f1461060157610227565b8063acfabbe414610526578063ad4fe40b1461052e578063ad6d15de14610554578063b01ca88f14610571578063b9d1c70b1461059d57610227565b80638fa6d02e116100ff5780638fa6d02e146104c157806391b4ded9146104c9578063a5d7cb6c146104d1578063ab2be726146104d9578063ab610850146104e157610227565b806379ba50971461045f5780637ef7b42714610467578063857afabd146104935780638da5cb5b146104b957610227565b8063402914f5116101b35780635c975abb116101825780635c975abb146103d25780635d138505146103ee578063698f15ca146103f65780636a760b801461041c5780636f0115381461043957610227565b8063402914f514610359578063485cc9551461037f57806353a47bb7146103ad5780635817d042146103b557610227565b806316c38b3c116101fa57806316c38b3c146102c257806317640e07146102e157806319d152fa146103075780631cb70a951461032b5780631f5329621461033357610227565b80630a0a8bb41461022c5780630faab8cf1461025c57806313af4035146102765780631627540c1461029c575b600080fd5b61025a6004803603604081101561024257600080fd5b506001600160a01b038135811691602001351661062d565b005b610264610b4b565b60408051918252519081900360200190f35b61025a6004803603602081101561028c57600080fd5b50356001600160a01b0316610b50565b61025a600480360360208110156102b257600080fd5b50356001600160a01b0316610c65565b61025a600480360360208110156102d857600080fd5b50351515610cc1565b610264600480360360208110156102f757600080fd5b50356001600160a01b0316610d3b565b61030f610deb565b604080516001600160a01b039092168252519081900360200190f35b61030f610dff565b61025a6004803603602081101561034957600080fd5b50356001600160a01b0316610e13565b6102646004803603602081101561036f57600080fd5b50356001600160a01b0316610ec4565b61025a6004803603604081101561039557600080fd5b506001600160a01b0381358116916020013516610f4a565b61030f61101f565b61025a600480360360208110156103cb57600080fd5b503561102e565b6103da611090565b604080519115158252519081900360200190f35b610264611099565b6102646004803603602081101561040c57600080fd5b50356001600160a01b031661109f565b6103da6004803603602081101561043257600080fd5b50356110b1565b61025a6004803603602081101561044f57600080fd5b50356001600160a01b031661139f565b61025a61144c565b6102646004803603604081101561047d57600080fd5b506001600160a01b038135169060200135611508565b61025a600480360360208110156104a957600080fd5b50356001600160a01b0316611592565b61030f61163f565b61026461164e565b610264611654565b61030f61165a565b61030f611669565b61050d600480360360408110156104f757600080fd5b506001600160a01b038135169060200135611678565b6040805192835260208301919091528051918290030190f35b6103da6116a5565b61025a6004803603602081101561054457600080fd5b50356001600160a01b0316611719565b61025a6004803603602081101561056a57600080fd5b5035611779565b61025a6004803603604081101561058757600080fd5b506001600160a01b0381351690602001356117d5565b610264611b93565b61025a600480360360208110156105bb57600080fd5b50356001600160a01b0316611b99565b610264600480360360208110156105e157600080fd5b50356001600160a01b0316611cb8565b61025a611cca565b61025a611ce1565b6102646004803603604081101561061757600080fd5b506001600160a01b038135169060200135611d44565b6039546001600160a01b031633146106765760405162461bcd60e51b81526004018080602001828103825260288152602001806124116028913960400191505060405180910390fd5b60395460408051631676539160e01b81526001600160a01b038581166004830152915191909216916316765391916024808301926020929190829003018186803b1580156106c357600080fd5b505afa1580156106d7573d6000803e3d6000fd5b505050506040513d60208110156106ed57600080fd5b5051158015610776575060395460408051631676539160e01b81526001600160a01b03848116600483015291516000939290921691631676539191602480820192602092909190829003018186803b15801561074857600080fd5b505afa15801561075c573d6000803e3d6000fd5b505050506040513d602081101561077257600080fd5b5051115b156107c8576001600160a01b038216600090815260406020819052902054156107c8576001600160a01b038216600090815260406020819052902054603c546107c49163ffffffff611dca16565b603c555b60395460408051631676539160e01b81526001600160a01b038481166004830152915191909216916316765391916024808301926020929190829003018186803b15801561081557600080fd5b505afa158015610829573d6000803e3d6000fd5b505050506040513d602081101561083f57600080fd5b50511580156108c8575060395460408051631676539160e01b81526001600160a01b03858116600483015291516000939290921691631676539191602480820192602092909190829003018186803b15801561089a57600080fd5b505afa1580156108ae573d6000803e3d6000fd5b505050506040513d60208110156108c457600080fd5b5051115b1561091a576001600160a01b0381166000908152604060208190529020541561091a576001600160a01b038116600090815260406020819052902054603c546109169163ffffffff611dca16565b603c555b6001600160a01b0380831660009081526040602081905280822054928416825290205461094c9163ffffffff611e2716565b6001600160a01b03821660009081526040602081815281832093909355603d5460419093528120919091558060015b600a8111610b0f576109a9600a61099d83603d54611e2790919063ffffffff16565b9063ffffffff611e8816565b603d549093506109bf908263ffffffff611e2716565b6001600160a01b0385166000908152603f6020526040902090925083600a81106109e557fe5b60020201600101548214610a4c576001600160a01b0384166000908152603f6020526040812084600a8110610a1657fe5b60020201556001600160a01b0384166000908152603f60205260409020829084600a8110610a4057fe5b60020201600101819055505b6001600160a01b0385166000908152603f6020526040902083600a8110610a6f57fe5b6002020160010154821415610b07576001600160a01b0385166000908152603f60205260409020610ade9084600a8110610aa557fe5b60020201546001600160a01b0386166000908152603f6020526040902085600a8110610acd57fe5b60020201549063ffffffff611e2716565b6001600160a01b0385166000908152603f6020526040902084600a8110610b0157fe5b60020201555b60010161097b565b506001600160a01b03841660009081526040602081815281832083905560418152818320839055603f90528120610b4591612231565b50505050565b600a81565b6001600160a01b038116610bab576040805162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b603454600160a01b900460ff1615610bf45760405162461bcd60e51b81526004018080602001828103825260298152602001806122946029913960400191505060405180910390fd5b6034805460ff60a01b1916600160a01b179055603380546001600160a01b0383166001600160a01b031990911681179091556040805160008152602081019290925280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150565b610c6d611eed565b603480546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b610cc9611eed565b60385460ff1615158115151415610cdf57610d38565b6038805460ff1916821515179081905560ff1615610cfc57426037555b6038546040805160ff90921615158252517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59181900360200190a15b50565b603d546001600160a01b03821660009081526041602052604081205490911415610dcb576001600160a01b0382166000908152603f60205260409020603d54610dc49190610d9090600a63ffffffff611e8816565b600a8110610d9a57fe5b60020201546001600160a01b0384166000908152604060208190529020549063ffffffff611dca16565b9050610de6565b506001600160a01b0381166000908152604060208190529020545b919050565b60385461010090046001600160a01b031681565b60425461010090046001600160a01b031681565b610e1b611eed565b6001600160a01b038116610e68576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b604280546001600160a01b0383166101008102610100600160a81b03199092169190911790915560408051918252517fc70f351eb054617c1a59ce7df5868ecc6f691ec895094e2185b4f4d45c987c899181900360200190a150565b60006001600160a01b038216610f13576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b610f44610f1f83611f38565b6001600160a01b0384166000908152604060208190529020549063ffffffff611dca16565b92915050565b600054610100900460ff1680610f635750610f63611fc5565b80610f71575060005460ff16155b610fac5760405162461bcd60e51b815260040180806020018281038252602e8152602001806122ec602e913960400191505060405180910390fd5b600054610100900460ff16158015610fd7576000805460ff1961ff0019909116610100171660011790555b610fe083610b50565b610fe8611ce1565b60388054610100600160a81b0319166101006001600160a01b03851602179055801561101a576000805461ff00191690555b505050565b6034546001600160a01b031681565b6039546001600160a01b031633146110775760405162461bcd60e51b81526004018080602001828103825260288152602001806124116028913960400191505060405180910390fd5b603c5461108a908263ffffffff611e2716565b603c5550565b60385460ff1681565b603d5481565b60406020819052600091825290205481565b60358054600101908190556038546000919060ff16156111025760405162461bcd60e51b815260040180806020018281038252603c81526020018061233d603c913960400191505060405180910390fd5b6000831161114d576040805162461bcd60e51b81526020600482015260136024820152720436c61696d656420616d6f756e74206973203606c1b604482015290519081900360640190fd5b600a603d54101561118f5760405162461bcd60e51b815260040180806020018281038252602381526020018061231a6023913960400191505060405180910390fd5b60006111b961119d33611f38565b336000908152604060208190529020549063ffffffff611dca16565b9050808411156111fa5760405162461bcd60e51b81526004018080602001828103825260248152602001806123796024913960400191505060405180910390fd5b3360009081526040602081905290205461121a908563ffffffff611dca16565b33600090815260406020819052902055603b5461123d908563ffffffff611dca16565b603b55603e54611253908563ffffffff611e2716565b603e556038546112729061010090046001600160a01b03163386611fcb565b60395460408051631676539160e01b815233600482015290516001600160a01b0390921691631676539191602480820192602092909190829003018186803b1580156112bd57600080fd5b505afa1580156112d1573d6000803e3d6000fd5b505050506040513d60208110156112e757600080fd5b505161130457603c54611300908563ffffffff611dca16565b603c555b604080513381526020810186905281517ed5958799b183a7b738d3ad5e711305293dd5076a37a4e3b7e6611dea6114f3929181900390910190a160019250506035548114611399576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b50919050565b6113a7611eed565b6001600160a01b0381166113f8576040805162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081859191c995cdcc81cd95d606a1b604482015290519081900360640190fd5b603a80546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fd010a6b29232520d927f04d85597efb6fc5b0dc8f3b101b9292e8ae32f7b95719181900360200190a150565b6034546001600160a01b031633146114955760405162461bcd60e51b815260040180806020018281038252603581526020018061225f6035913960400191505060405180910390fd5b603354603454604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160348054603380546001600160a01b03199081166001600160a01b03841617909155169055565b60006001600160a01b03831661155f576040805162461bcd60e51b8152602060048201526017602482015276496e76616c6964206163636f756e74206164647265737360481b604482015290519081900360640190fd5b6001600160a01b0383166000908152603f6020526040902082600a811061158257fe5b6002020160010154905092915050565b61159a611eed565b6001600160a01b0381166115eb576040805162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081859191c995cdcc81cd95d606a1b604482015290519081900360640190fd5b603980546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f82e5240229d10cc4b4806dbb17617cfd44ab67bde505b66eec73d21395371a579181900360200190a150565b6033546001600160a01b031681565b603c5481565b60375481565b6039546001600160a01b031681565b603a546001600160a01b031681565b603f60205281600052604060002081600a811061169157fe5b600202018054600190910154909250905082565b60425460009060ff166116fb576039546001600160a01b031633146116fb5760405162461bcd60e51b81526004018080602001828103825260288152602001806124116028913960400191505060405180910390fd5b603d5461170f90600163ffffffff611e2716565b603d555060015b90565b611721611eed565b603d5461173590600a63ffffffff611e2716565b6001600160a01b0382166000908152603f60205260409020603d5461176190600a63ffffffff611e8816565b600a811061176b57fe5b600202016001018190555050565b6039546001600160a01b031633146117c25760405162461bcd60e51b81526004018080602001828103825260288152602001806124116028913960400191505060405180910390fd5b603c5461108a908263ffffffff611dca16565b60385460ff16156118175760405162461bcd60e51b815260040180806020018281038252603c81526020018061233d603c913960400191505060405180910390fd5b6001600160a01b038216611864576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b600081116118a7576040805162461bcd60e51b815260206004820152600b60248201526a0416d6f756e7420697320360ac1b604482015290519081900360640190fd5b60425461010090046001600160a01b03163314806118cf5750603a546001600160a01b031633145b61190a5760405162461bcd60e51b815260040180806020018281038252604a81526020018061239d604a913960600191505060405180910390fd5b6001600160a01b038216600090815260406020819052902054611933908263ffffffff611e2716565b6001600160a01b03831660009081526040602081815281832093909355603d54604190935290205414156119dd576001600160a01b0382166000908152603f60205260409020603d5461199d91839161199390600a63ffffffff611e8816565b600a8110610acd57fe5b6001600160a01b0383166000908152603f60205260409020603d546119c990600a63ffffffff611e8816565b600a81106119d357fe5b6002020155611a1c565b6001600160a01b0382166000908152603f60205260409020603d54829190611a0c90600a63ffffffff611e8816565b600a8110611a1657fe5b60020201555b603d54611a3090600a63ffffffff611e2716565b6001600160a01b0383166000908152603f60205260409020603d54611a5c90600a63ffffffff611e8816565b600a8110611a6657fe5b6002020160010155603d546001600160a01b038316600090815260416020526040902055603b54611a979082611e27565b603b55603854611ab79061010090046001600160a01b031633308461201d565b60395460408051631676539160e01b81526001600160a01b038581166004830152915191909216916316765391916024808301926020929190829003018186803b158015611b0457600080fd5b505afa158015611b18573d6000803e3d6000fd5b505050506040513d6020811015611b2e57600080fd5b5051611b4b57603c54611b47908263ffffffff611e2716565b603c555b604080516001600160a01b03841681526020810183905281517f690a755e9d381a220ee302f6a382749c9cdccbbc983ccdf1c18c978f9281c64d929181900390910190a15050565b603b5481565b611ba1611eed565b6001600160a01b038116611bee576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b603454600160a81b900460ff1615611c43576040805162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b604482015290519081900360640190fd5b603380546001600160a01b038084166001600160a01b03199092168217928390556034805460ff60a81b1916600160a81b17905560408051939091168352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150565b60416020526000908152604090205481565b611cd2611eed565b6042805460ff19166001179055565b60365460ff1615611d2f576040805162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b6036805460ff19166001908117909155603555565b60006001600160a01b038316611d9b576040805162461bcd60e51b8152602060048201526017602482015276496e76616c6964206163636f756e74206164647265737360481b604482015290519081900360640190fd5b6001600160a01b0383166000908152603f6020526040902082600a8110611dbe57fe5b60020201549392505050565b600082821115611e21576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015611e81576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600081611edc576040805162461bcd60e51b815260206004820152601860248201527f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000604482015290519081900360640190fd5b818381611ee557fe5b069392505050565b6033546001600160a01b03163314611f365760405162461bcd60e51b815260040180806020018281038252602f8152602001806122bd602f913960400191505060405180910390fd5b565b600080805b600a811015611fbe57603d546001600160a01b0385166000908152603f6020526040902082600a8110611f6c57fe5b60020201600101541115611fb6576001600160a01b0384166000908152603f60205260409020611fb39082600a8110611fa157fe5b6002020154839063ffffffff611e2716565b91505b600101611f3d565b5092915050565b303b1590565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261101a908490612073565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610b459085905b612085826001600160a01b031661222b565b6120d6576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106121145780518252601f1990920191602091820191016120f5565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612176576040519150601f19603f3d011682016040523d82523d6000602084013e61217b565b606091505b5091509150816121d2576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610b45578080602001905160208110156121ee57600080fd5b5051610b455760405162461bcd60e51b815260040180806020018281038252602a8152602001806123e7602a913960400191505060405180910390fd5b3b151590565b50610d38906117169060148101905b8082111561225a5760008082556001820155600201612240565b509056fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e657273686970416c726561647920696e697469616c697a65642c20757365206e6f6d696e6174654e65774f776e65724f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a656456657374696e672072657761726473207374696c6c206e6f7420617661696c61626c655468697320616374696f6e2063616e6e6f7420626520706572666f726d6564207768696c652074686520636f6e747261637420697320706175736564416d6f756e7420657863656564732074686520636c61696d61626c65207265776172647341646420746f20657363726f772063616e206f6e6c792062652063616c6c65642066726f6d207374616b696e67206f72206f6e676f696e672061697264726f7020636f6e7472616374735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656443616e206f6e6c792062652063616c6c65642066726f6d207374616b696e6720636f6e7472616374a265627a7a7231582077caec7efc186524363bf8bd9458a9fcbef9d12bceec523164e82b5e5053c73764736f6c63430005100032

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