Contract 0x5fa7092d1500d8b9c092a4698c265232611248ee

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

Contract Overview

Balance:
Txn Hash Method
Block
From
To
Value
0x38d440222a55cc373cdac227080fbae6f028f894671c12ac654afe0d8dee2ab60x6080604022702922022-10-25 11:35:11598 days 12 hrs ago0x9841484a4a6c0b61c4eea71376d76453fd05ec9c IN  Create: StakingThales0 ETH0.0375369742680.00001
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x80a6dbfa891c6daa9e5eaf3bdd3e07ccb14f46889ec3e695ba67fe32fd562e6b45653312023-01-24 11:12:10507 days 12 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xf1f883c1cc0e6de2c4805d57f2beb7ab24d26aafa2a30b3463d9bfe2130acc4543550262023-01-19 14:22:00512 days 9 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xe6e4ebc9e51ee18d83fdd3f83d65e72d0c39814fdba83a7fd17a7f19784171f243520252023-01-19 12:41:58512 days 11 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xcfaa5e66b45b8f43526c6f63744a49ef1849ab13ce17cc6944382f836789d74243511192023-01-19 12:11:46512 days 11 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x4b4ec680b7e415146204aac18d4a790bb92b39e55ac521a579ca0150ceacdc8c43494122023-01-19 11:14:52512 days 12 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x7d895add9ba43b300bd6df250620147aca68fd6f86635c6e7ea7e1ff35312dda43492882023-01-19 11:10:44512 days 12 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x99fc8b031d5f7d52ec3fa006e0716df58fd2d4fa121991061e8cbee58a137a0643125852023-01-18 14:47:18513 days 9 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xee0aac40f96ddc605d1db054b959735d60e4cbd46167773fee0f426ad2c1275a43093002023-01-18 12:57:48513 days 11 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xa800668ebd16572d9d175a9bf5b42e5150450a3a6793840722247db66295f9e343092812023-01-18 12:57:10513 days 11 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xd987d9cad4c6090ff471ae42ee0e86bd1e0f65f0c87fc8bb181652c733c58a1643092652023-01-18 12:56:38513 days 11 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x2087d46167e62eca23c08724eea81761fd8365c6154679a862264e581a543e6442837772023-01-17 22:47:02514 days 1 hr ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x17df4a99cb0d442deac5d6284625d963031ae0dda7527ebb4c23fbafa88f89a542832492023-01-17 22:29:26514 days 1 hr ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x6e6c10127390e939a839afaea9cbd70387bc5ea0e4d166e7241295aaa0a88e7c42709062023-01-17 15:38:00514 days 8 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xfd0f4a07bcd98efc3a9595a0d9a5d8ba7da6af457215ad6c29dbaea727b77a2f42616902023-01-17 10:30:48514 days 13 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x033e7ffe2c0eedfa0a102d90c161bafa2567399c1630f3c2c7df691f782e001a42601332023-01-17 9:38:54514 days 14 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xef80a34eb7e1d4e3097f78eb2d4664c6300aa0f01ecf12827747a6f459f2dacd42600762023-01-17 9:37:00514 days 14 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x023b2d324e5ebc276735f055cea7fbdeb8f0c0e2373add8811df6a559d0f253742589472023-01-17 8:59:22514 days 15 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x1ea4c7ce4ea6c6ac78018136a1f6138c2a4535d893d4b37cc4b20f0e283ca81b42589002023-01-17 8:57:48514 days 15 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x8ca2df5b77b714a35e486f43b435a9eeae0c4ab93d0e1adc592de6c0d575451040968922023-01-13 14:57:32518 days 9 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x3cc641748dff0c6d69611134c1a6f3b1d49aa036e5907dc74542dff7e5980ed138034552022-12-29 21:39:29533 days 2 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xa99784c2be37c7073f97292658fcd261ff67714d387680567980e83c51da37f537990812022-12-29 14:36:06533 days 9 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xc2aaa96d7c0ff5057e683750147fb815379c6ce4fa5762f192bee4e1312385c037990012022-12-29 14:28:31533 days 9 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0xd7d6b22ef725f61748a40ce7524bbbf615ab9367005270822f13337ef48d94a137984522022-12-29 13:52:24533 days 10 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x3a5e0907df776468b68f7c336f1cbc03a2c1461df4417bf8411aa9f7ded2245037849192022-12-28 13:49:03534 days 10 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
0x3a5e0907df776468b68f7c336f1cbc03a2c1461df4417bf8411aa9f7ded2245037849192022-12-28 13:49:03534 days 10 hrs ago 0x28d25990f7dec7c606551c28a7a82b9d116dcb67 0x5fa7092d1500d8b9c092a4698c265232611248ee0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StakingThales

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

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

pragma solidity ^0.5.16;

import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.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/ISNXRewards.sol";
import "../interfaces/IThalesRoyale.sol";
import "../interfaces/IPriceFeed.sol";
import "../interfaces/IThalesStakingRewardsPool.sol";
import "../interfaces/IAddressResolver.sol";

/// @title A Staking contract that provides logic for staking and claiming rewards
contract StakingThales is IStakingThales, Initializable, ProxyOwned, ProxyReentrancyGuard, ProxyPausable {
    /* ========== LIBRARIES ========== */

    using SafeMath for uint;
    using SafeERC20 for IERC20;

    /* ========== STATE VARIABLES ========== */

    IEscrowThales public iEscrowThales;
    IERC20 public stakingToken;
    IERC20 public feeToken;
    ISNXRewards public SNXRewards;
    IThalesRoyale public thalesRoyale;
    IPriceFeed public priceFeed;

    uint public periodsOfStaking;
    uint public lastPeriodTimeStamp;
    uint public durationPeriod;
    uint public unstakeDurationPeriod;
    uint public startTimeStamp;
    uint public currentPeriodRewards;
    uint public currentPeriodFees;
    bool public distributeFeesEnabled;
    uint public fixedPeriodReward;
    uint public periodExtraReward;
    uint public totalSNXRewardsInPeriod;
    uint public totalSNXFeesInPeriod;
    bool public claimEnabled;

    mapping(address => uint) public stakerLifetimeRewardsClaimed;
    mapping(address => uint) public stakerFeesClaimed;

    uint private _totalStakedAmount;
    uint private _totalEscrowedAmount;
    uint private _totalPendingStakeAmount;
    uint private _totalUnclaimedRewards;
    uint private _totalRewardsClaimed;
    uint private _totalRewardFeesClaimed;

    mapping(address => uint) public lastUnstakeTime;
    mapping(address => bool) public unstaking;
    mapping(address => uint) public unstakingAmount;
    mapping(address => uint) private _stakedBalances;
    mapping(address => uint) private _lastRewardsClaimedPeriod;
    address public thalesAMM;

    uint constant HUNDRED = 1e18;
    uint constant AMM_EXTRA_REWARD_PERIODS = 4;

    struct AMMVolumeEntry {
        uint amount;
        uint period;
    }
    mapping(address => uint) private lastAMMUpdatePeriod;
    mapping(address => AMMVolumeEntry[AMM_EXTRA_REWARD_PERIODS]) private stakerAMMVolume;

    bool public extraRewardsActive;
    IThalesStakingRewardsPool public ThalesStakingRewardsPool;

    uint public maxSNXRewardsPercentage;
    uint public maxAMMVolumeRewardsPercentage;
    uint public AMMVolumeRewardsMultiplier;
    uint public maxThalesRoyaleRewardsPercentage;

    uint constant ONE = 1e18;
    uint constant ONE_PERCENT = 1e16;

    uint public SNXVolumeRewardsMultiplier;

    mapping(address => uint) private _lastStakingPeriod;

    uint public totalStakedLastPeriodEnd;
    uint public totalEscrowedLastPeriodEnd;
    address public exoticBonds;

    IAddressResolver public addressResolver;

    address public thalesRangedAMM;
    address public sportsAMM;

    mapping(address => uint) private lastThalesAMMUpdatePeriod;
    mapping(address => AMMVolumeEntry[AMM_EXTRA_REWARD_PERIODS]) private thalesAMMVolume;
    mapping(address => uint) private lastThalesRangedAMMUpdatePeriod;
    mapping(address => AMMVolumeEntry[AMM_EXTRA_REWARD_PERIODS]) private thalesRangedAMMVolume;
    mapping(address => uint) private lastExoticMarketsUpdatePeriod;
    mapping(address => AMMVolumeEntry[AMM_EXTRA_REWARD_PERIODS]) private exoticMarketsVolume;
    mapping(address => uint) private lastSportsAMMUpdatePeriod;
    mapping(address => AMMVolumeEntry[AMM_EXTRA_REWARD_PERIODS]) private sportsAMMVolume;

    mapping(address => mapping(address => bool)) public canClaimOnBehalf;

    bool public mergeAccountEnabled;

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

    function initialize(
        address _owner,
        address _iEscrowThales, //THALES
        address _stakingToken, //THALES
        address _feeToken, //sUSD
        uint _durationPeriod,
        uint _unstakeDurationPeriod,
        address _ISNXRewards
    ) public initializer {
        setOwner(_owner);
        initNonReentrant();
        iEscrowThales = IEscrowThales(_iEscrowThales);
        stakingToken = IERC20(_stakingToken);
        feeToken = IERC20(_feeToken);
        stakingToken.approve(_iEscrowThales, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        durationPeriod = _durationPeriod;
        unstakeDurationPeriod = _unstakeDurationPeriod;
        fixedPeriodReward = 70000 * 1e18;
        periodExtraReward = 21000 * 1e18;
        SNXRewards = ISNXRewards(_ISNXRewards);
    }

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

    /// @notice Get the total staked amount on the contract
    /// @return total staked amount
    function totalStakedAmount() external view returns (uint) {
        return _totalStakedAmount;
    }

    /// @notice Get the staked balance for the account
    /// @param account to get the staked balance for
    /// @return the staked balance for the account
    function stakedBalanceOf(address account) external view returns (uint) {
        return _stakedBalances[account];
    }

    /// @notice Get the last period of claimed rewards for the account
    /// @param account to get the last period of claimed rewards for
    /// @return the last period of claimed rewards for the account
    function getLastPeriodOfClaimedRewards(address account) external view returns (uint) {
        return _lastRewardsClaimedPeriod[account];
    }

    /// @notice Get the rewards available for the claim for the account
    /// @param account to get the rewards available for the claim for
    /// @return the rewards available for the claim for the account
    function getRewardsAvailable(address account) external view returns (uint) {
        return _calculateAvailableRewardsToClaim(account);
    }

    /// @notice Get the reward fees available for the claim for the account
    /// @param account to get the reward fees available for the claim for
    /// @return the rewards fees available for the claim for the account
    function getRewardFeesAvailable(address account) external view returns (uint) {
        return _calculateAvailableFeesToClaim(account);
    }

    /// @notice Get the total rewards claimed for the account until now
    /// @param account to get the total rewards claimed for
    /// @return the total rewards claimed for the account until now
    function getAlreadyClaimedRewards(address account) external view returns (uint) {
        return stakerLifetimeRewardsClaimed[account];
    }

    /// @notice Get the rewards funds available on the rewards pool
    /// @return the rewards funds available on the rewards pool
    function getContractRewardFunds() external view returns (uint) {
        return stakingToken.balanceOf(address(ThalesStakingRewardsPool));
    }

    /// @notice Get the fee funds available on the staking contract
    /// @return the fee funds available on the staking contract
    function getContractFeeFunds() external view returns (uint) {
        return feeToken.balanceOf(address(this));
    }

    /// @notice Set staking parametars
    /// @param _claimEnabled enable/disable claim rewards
    /// @param _distributeFeesEnabled enable/disable fees distribution
    /// @param _durationPeriod duration of the staking period
    /// @param _unstakeDurationPeriod duration of the unstaking cooldown period
    /// @param _mergeAccountEnabled enable/disable account merging
    function setStakingParameters(
        bool _claimEnabled,
        bool _distributeFeesEnabled,
        uint _durationPeriod,
        uint _unstakeDurationPeriod,
        bool _mergeAccountEnabled
    ) external onlyOwner {
        claimEnabled = _claimEnabled;
        distributeFeesEnabled = _distributeFeesEnabled;
        durationPeriod = _durationPeriod;
        unstakeDurationPeriod = _unstakeDurationPeriod;
        mergeAccountEnabled = _mergeAccountEnabled;

        emit StakingParametersChanged(
            _claimEnabled,
            _distributeFeesEnabled,
            _durationPeriod,
            _unstakeDurationPeriod,
            _mergeAccountEnabled
        );
    }

    /// @notice Set staking rewards parameters
    /// @param _fixedReward amount for weekly base rewards pool
    /// @param _extraReward amount for weekly bonus rewards pool
    /// @param _extraRewardsActive enable/disable bonus rewards
    /// @param _maxSNXRewardsPercentage maximum percentage for SNX rewards
    /// @param _maxAMMVolumeRewardsPercentage maximum percentage for protocol volume rewards
    /// @param _maxThalesRoyaleRewardsPercentage maximum percentage for rewards for participation in Thales Royale
    /// @param _SNXVolumeRewardsMultiplier multiplier for SNX rewards
    /// @param _AMMVolumeRewardsMultiplier multiplier for protocol volume rewards
    function setStakingRewardsParameters(
        uint _fixedReward,
        uint _extraReward,
        bool _extraRewardsActive,
        uint _maxSNXRewardsPercentage,
        uint _maxAMMVolumeRewardsPercentage,
        uint _maxThalesRoyaleRewardsPercentage,
        uint _SNXVolumeRewardsMultiplier,
        uint _AMMVolumeRewardsMultiplier
    ) public onlyOwner {
        fixedPeriodReward = _fixedReward;
        periodExtraReward = _extraReward;
        extraRewardsActive = _extraRewardsActive;
        maxSNXRewardsPercentage = _maxSNXRewardsPercentage;
        maxAMMVolumeRewardsPercentage = _maxAMMVolumeRewardsPercentage;
        maxThalesRoyaleRewardsPercentage = _maxThalesRoyaleRewardsPercentage;
        SNXVolumeRewardsMultiplier = _SNXVolumeRewardsMultiplier;
        AMMVolumeRewardsMultiplier = _AMMVolumeRewardsMultiplier;

        emit StakingRewardsParametersChanged(
            _fixedReward,
            _extraReward,
            _extraRewardsActive,
            _maxSNXRewardsPercentage,
            _maxAMMVolumeRewardsPercentage,
            _AMMVolumeRewardsMultiplier,
            _maxThalesRoyaleRewardsPercentage,
            _SNXVolumeRewardsMultiplier
        );
    }

    /// @notice Set contract addresses
    /// @param _snxRewards address of SNX rewards contract
    /// @param _royale address of Thales Royale contract
    /// @param _thalesAMM address of Thales AMM contract
    /// @param _thalesRangedAMM address of Thales ranged AMM contract
    /// @param _exoticBonds address of exotic markets bonds contract
    /// @param _sportsAMM address of sport markets AMM contract
    /// @param _priceFeed address of price feed contract
    /// @param _thalesStakingRewardsPool address of Thales staking rewards pool
    /// @param _addressResolver address of address resolver contract
    function setAddresses(
        address _snxRewards,
        address _royale,
        address _thalesAMM,
        address _thalesRangedAMM,
        address _exoticBonds,
        address _sportsAMM,
        address _priceFeed,
        address _thalesStakingRewardsPool,
        address _addressResolver
    ) public onlyOwner {
        require(
            _snxRewards != address(0) &&
                _royale != address(0) &&
                _thalesAMM != address(0) &&
                _thalesRangedAMM != address(0) &&
                _exoticBonds != address(0) &&
                _sportsAMM != address(0) &&
                _priceFeed != address(0) &&
                _thalesStakingRewardsPool != address(0) &&
                _addressResolver != address(0),
            "Invalid address"
        );

        SNXRewards = ISNXRewards(_snxRewards);
        thalesRoyale = IThalesRoyale(_royale);
        thalesAMM = _thalesAMM;
        thalesRangedAMM = _thalesRangedAMM;
        exoticBonds = _exoticBonds;
        sportsAMM = _sportsAMM;
        priceFeed = IPriceFeed(_priceFeed);
        ThalesStakingRewardsPool = IThalesStakingRewardsPool(_thalesStakingRewardsPool);
        addressResolver = IAddressResolver(_addressResolver);

        emit AddressesChanged(
            _snxRewards,
            _royale,
            _thalesAMM,
            _thalesRangedAMM,
            _exoticBonds,
            _sportsAMM,
            _priceFeed,
            _thalesStakingRewardsPool,
            _addressResolver
        );
    }

    /// @notice Set address of Escrow Thales contract
    /// @param _escrowThalesContract address of Escrow Thales contract
    function setEscrow(address _escrowThalesContract) public onlyOwner {
        if (address(iEscrowThales) != address(0)) {
            stakingToken.approve(address(iEscrowThales), 0);
        }
        iEscrowThales = IEscrowThales(_escrowThalesContract);
        stakingToken.approve(_escrowThalesContract, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        emit EscrowChanged(_escrowThalesContract);
    }

    /// @notice Get the address of the SNX rewards contract
    /// @return the address of the SNX rewards contract
    function getSNXRewardsAddress() public view returns (address) {
        if (address(addressResolver) == address(0)) {
            return address(0);
        } else {
            return addressResolver.getAddress("Issuer");
        }
    }

    /// @notice Get the amount of SNX staked for the account
    /// @param account to get the amount of SNX staked for
    /// @return the amount of SNX staked for the account
    function getSNXStaked(address account) external view returns (uint) {
        return _getSNXStakedForAccount(account);
    }

    /// @notice Get the base reward amount available for the claim for the account
    /// @param account to get the base reward amount available for the claim for
    /// @return the base reward amount available for the claim for the account
    function getBaseReward(address account) public view returns (uint _baseRewards) {
        if (
            !((_lastStakingPeriod[account] == periodsOfStaking) ||
                (_stakedBalances[account] == 0) ||
                (_lastRewardsClaimedPeriod[account] == periodsOfStaking) ||
                (totalStakedLastPeriodEnd == 0))
        ) {
            _baseRewards = _stakedBalances[account]
                .add(iEscrowThales.getStakedEscrowedBalanceForRewards(account))
                .mul(currentPeriodRewards)
                .div(totalStakedLastPeriodEnd.add(totalEscrowedLastPeriodEnd));
        }
    }

    /// @notice Get the total protocol volume for the account
    /// @param account to get the total protocol volume for
    /// @return the total protocol volume for the account
    function getAMMVolume(address account) external view returns (uint) {
        return _getTotalAMMVolume(account);
    }

    /// @notice Get the AMM volume for the account
    /// @param account to get the AMM volume for
    /// @return the AMM volume for the account
    function getThalesAMMVolume(address account) external view returns (uint volumeforAccount) {
        for (uint i = 0; i < AMM_EXTRA_REWARD_PERIODS; i++) {
            if (periodsOfStaking < thalesAMMVolume[account][i].period.add(AMM_EXTRA_REWARD_PERIODS))
                volumeforAccount = volumeforAccount.add(thalesAMMVolume[account][i].amount);
        }
    }

    /// @notice Get the ranged AMM volume for the account
    /// @param account to get the ranged AMM volume for
    /// @return the ranged AMM volume for the account
    function getThalesRangedAMMVolume(address account) external view returns (uint volumeforAccount) {
        for (uint i = 0; i < AMM_EXTRA_REWARD_PERIODS; i++) {
            if (periodsOfStaking < thalesRangedAMMVolume[account][i].period.add(AMM_EXTRA_REWARD_PERIODS))
                volumeforAccount = volumeforAccount.add(thalesRangedAMMVolume[account][i].amount);
        }
    }

    /// @notice Get the exotic markets volume for the account
    /// @param account to get exotic markets volume for
    /// @return the exotic markets volume for the account
    function getExoticMarketsVolume(address account) external view returns (uint volumeforAccount) {
        for (uint i = 0; i < AMM_EXTRA_REWARD_PERIODS; i++) {
            if (periodsOfStaking < exoticMarketsVolume[account][i].period.add(AMM_EXTRA_REWARD_PERIODS))
                volumeforAccount = volumeforAccount.add(exoticMarketsVolume[account][i].amount);
        }
    }

    /// @notice Get the sport markets AMM volume for the account
    /// @param account to get the sport markets AMM volume for
    /// @return the sport markets AMM volume for the account
    function getSportsAMMVolume(address account) external view returns (uint volumeforAccount) {
        for (uint i = 0; i < AMM_EXTRA_REWARD_PERIODS; i++) {
            if (periodsOfStaking < sportsAMMVolume[account][i].period.add(AMM_EXTRA_REWARD_PERIODS))
                volumeforAccount = volumeforAccount.add(sportsAMMVolume[account][i].amount);
        }
    }

    /// @notice Get the percentage of SNX rewards for the account
    /// @param account to get the percentage of SNX rewards for
    /// @return the percentage of SNX rewards for the account
    function getSNXBonusPercentage(address account) public view returns (uint) {
        uint baseReward = getBaseReward(account);
        if (baseReward == 0) {
            return 0;
        }
        uint stakedSNX = _getSNXStakedForAccount(account);
        // SNX staked more than base reward
        return
            stakedSNX >= baseReward.mul(SNXVolumeRewardsMultiplier)
                ? maxSNXRewardsPercentage.mul(ONE_PERCENT)
                : stakedSNX.mul(maxSNXRewardsPercentage).mul(ONE_PERCENT).div(baseReward.mul(SNXVolumeRewardsMultiplier));
    }

    /// @notice Get the SNX staking bonus rewards for the account
    /// @param account to get the SNX staking bonus rewards for
    /// @return the SNX staking bonus rewards for the account
    function getSNXBonus(address account) public view returns (uint) {
        uint baseReward = getBaseReward(account);
        uint SNXBonusPercentage = getSNXBonusPercentage(account);

        return baseReward.mul(SNXBonusPercentage).div(ONE);
    }

    /// @notice Get the percentage of protocol volume rewards for the account
    /// @param account to get the percentage of protocol volume rewards for
    /// @return the percentage of protocol volume rewards for the account
    function getAMMBonusPercentage(address account) public view returns (uint) {
        uint baseReward = getBaseReward(account);
        if (baseReward == 0) {
            return 0;
        }
        return
            _getTotalAMMVolume(account) >= baseReward.mul(AMMVolumeRewardsMultiplier)
                ? maxAMMVolumeRewardsPercentage.mul(ONE_PERCENT)
                : _getTotalAMMVolume(account).mul(ONE_PERCENT).mul(maxAMMVolumeRewardsPercentage).div(
                    baseReward.mul(AMMVolumeRewardsMultiplier)
                );
    }

    /// @notice Get the protocol volume bonus rewards for the account
    /// @param account to get the protocol volume bonus rewards for
    /// @return the protocol volume bonus rewards for the account
    function getAMMBonus(address account) public view returns (uint) {
        uint baseReward = getBaseReward(account);
        uint AMMPercentage = getAMMBonusPercentage(account);
        return baseReward.mul(AMMPercentage).div(ONE);
    }

    function getTotalBonusPercentage(address account) public view returns (uint) {
        uint snxPercentage = getSNXBonusPercentage(account);
        uint ammPercentage = getAMMBonusPercentage(account);
        return snxPercentage.add(ammPercentage);
    }

    /// @notice Get the total bonus rewards for the account
    /// @param account to get the total bonus rewards for
    /// @return the total bonus rewards for the account
    function getTotalBonus(address account) public view returns (uint) {
        uint baseReward = getBaseReward(account);
        uint totalBonusPercentage = getTotalBonusPercentage(account);
        // failsafe
        require(totalBonusPercentage < ONE, "Bonus Exceeds base rewards");
        return baseReward.mul(totalBonusPercentage).div(ONE);
    }

    /// @notice Get the flag that indicates whether the current period can be closed
    /// @return the flag that indicates whether the current period can be closed
    function canClosePeriod() external view returns (bool) {
        return (startTimeStamp > 0 && (block.timestamp >= lastPeriodTimeStamp.add(durationPeriod)));
    }

    /// @notice Get the current SNX target ratio
    /// @return the current SNX target ratio
    function getSNXTargetRatio() public view returns (uint) {
        uint hund = 100 * 100 * 1e18;
        return hund.div(ISNXRewards(getSNXRewardsAddress()).issuanceRatio());
    }

    /// @notice Get the current SNX C-Ratio for the account
    /// @param account to get the current SNX C-Ratio for
    /// @return the current SNX C-Ratio for the account
    function getCRatio(address account) public view returns (uint) {
        uint debt = ISNXRewards(getSNXRewardsAddress()).debtBalanceOf(account, "sUSD");
        if (debt == 0) {
            return 0;
        }
        uint hund = 100 * 100 * 1e18;
        (uint cRatio, ) = ISNXRewards(getSNXRewardsAddress()).collateralisationRatioAndAnyRatesInvalid(account);
        return hund.div(cRatio);
    }

    /// @notice Get the current SNX rate
    /// @return the current SNX rate
    function getSNXRateForCurrency() public view returns (uint) {
        return priceFeed.rateForCurrency("SNX");
    }

    /// @notice Get the current SNX debt for the account
    /// @param account to get the current SNX debt for
    /// @return the current SNX debt for the account
    function getSNXDebt(address account) public view returns (uint) {
        return ISNXRewards(getSNXRewardsAddress()).debtBalanceOf(account, "sUSD");
    }

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

    /// @notice Start the first staking period
    function startStakingPeriod() external onlyOwner {
        require(startTimeStamp == 0, "Staking has already started");
        startTimeStamp = block.timestamp;
        periodsOfStaking = 0;
        lastPeriodTimeStamp = startTimeStamp;
        _totalUnclaimedRewards = 0;
        _totalRewardsClaimed = 0;
        _totalRewardFeesClaimed = 0;
        _totalStakedAmount = 0;
        _totalEscrowedAmount = 0;
        _totalPendingStakeAmount = 0;
        emit StakingPeriodStarted();
    }

    /// @notice Close the current staking period
    function closePeriod() external nonReentrant notPaused {
        require(startTimeStamp > 0, "Staking period has not started");
        require(
            block.timestamp >= lastPeriodTimeStamp.add(durationPeriod),
            "A full period has not passed since the last closed period"
        );

        iEscrowThales.updateCurrentPeriod();
        lastPeriodTimeStamp = block.timestamp;
        periodsOfStaking = iEscrowThales.currentVestingPeriod();

        _totalEscrowedAmount = iEscrowThales.totalEscrowedRewards().sub(
            iEscrowThales.totalEscrowBalanceNotIncludedInStaking()
        );

        //Actions taken on every closed period
        currentPeriodRewards = fixedPeriodReward;
        _totalUnclaimedRewards = _totalUnclaimedRewards.add(currentPeriodRewards.add(periodExtraReward));

        currentPeriodFees = feeToken.balanceOf(address(this));

        totalStakedLastPeriodEnd = _totalStakedAmount;
        totalEscrowedLastPeriodEnd = _totalEscrowedAmount;

        emit ClosedPeriod(periodsOfStaking, lastPeriodTimeStamp);
    }

    /// @notice Stake the amount of staking token to get weekly rewards
    /// @param amount to stake
    function stake(uint amount) external nonReentrant notPaused {
        _stake(amount, msg.sender, msg.sender);
        emit Staked(msg.sender, amount);
    }

    /// @notice Start unstaking cooldown for the amount of staking token
    /// @param amount to unstake
    function startUnstake(uint amount) external notPaused {
        require(amount > 0, "Cannot unstake 0");
        require(_stakedBalances[msg.sender] >= amount, "Account doesnt have that much staked");
        require(!unstaking[msg.sender], "Account has already triggered unstake cooldown");

        if (_calculateAvailableRewardsToClaim(msg.sender) > 0) {
            _claimReward(msg.sender);
        }
        lastUnstakeTime[msg.sender] = block.timestamp;
        unstaking[msg.sender] = true;
        _totalStakedAmount = _totalStakedAmount.sub(amount);
        unstakingAmount[msg.sender] = amount;
        _stakedBalances[msg.sender] = _stakedBalances[msg.sender].sub(amount);

        // on full unstake add his escrowed balance to totalEscrowBalanceNotIncludedInStaking
        if (_stakedBalances[msg.sender] == 0) {
            if (iEscrowThales.totalAccountEscrowedAmount(msg.sender) > 0) {
                iEscrowThales.addTotalEscrowBalanceNotIncludedInStaking(
                    iEscrowThales.totalAccountEscrowedAmount(msg.sender)
                );
            }
        }

        emit UnstakeCooldown(msg.sender, lastUnstakeTime[msg.sender].add(unstakeDurationPeriod), amount);
    }

    /// @notice Cancel unstaking cooldown
    function cancelUnstake() external notPaused {
        require(unstaking[msg.sender], "Account is not unstaking");

        // on revert full unstake remove his escrowed balance from totalEscrowBalanceNotIncludedInStaking
        _subtractTotalEscrowBalanceNotIncludedInStaking(msg.sender);

        if (_calculateAvailableRewardsToClaim(msg.sender) > 0) {
            _claimReward(msg.sender);
        }

        unstaking[msg.sender] = false;
        _totalStakedAmount = _totalStakedAmount.add(unstakingAmount[msg.sender]);
        _stakedBalances[msg.sender] = _stakedBalances[msg.sender].add(unstakingAmount[msg.sender]);
        unstakingAmount[msg.sender] = 0;

        emit CancelUnstake(msg.sender);
    }

    /// @notice Unstake after the cooldown period expired
    function unstake() external notPaused {
        require(unstaking[msg.sender], "Account has not triggered unstake cooldown");
        require(
            lastUnstakeTime[msg.sender] < block.timestamp.sub(unstakeDurationPeriod),
            "Cannot unstake yet, cooldown not expired."
        );
        unstaking[msg.sender] = false;
        uint unstakeAmount = unstakingAmount[msg.sender];
        stakingToken.safeTransfer(msg.sender, unstakeAmount);
        unstakingAmount[msg.sender] = 0;
        emit Unstaked(msg.sender, unstakeAmount);
    }

    /// @notice Claim the weekly staking rewards
    function claimReward() public nonReentrant notPaused {
        _claimReward(msg.sender);
    }

    /// @notice Claim the weekly staking rewards on behalf of the account
    /// @param account to claim on behalf of
    function claimRewardOnBehalf(address account) public nonReentrant notPaused {
        require(account != address(0) && account != msg.sender, "Invalid address");
        require(canClaimOnBehalf[account][msg.sender], "Cannot claim on behalf");
        _claimReward(account);
    }

    /// @notice Update the protocol volume for the account
    /// @param account to update the protocol volume for
    /// @param amount to add to the existing protocol volume
    function updateVolume(address account, uint amount) external {
        require(account != address(0) && amount > 0, "Invalid params");
        require(
            msg.sender == thalesAMM || msg.sender == exoticBonds || msg.sender == thalesRangedAMM || msg.sender == sportsAMM,
            "Invalid address"
        );
        if (lastAMMUpdatePeriod[account] < periodsOfStaking) {
            stakerAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = 0;
            stakerAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].period = periodsOfStaking;
            lastAMMUpdatePeriod[account] = periodsOfStaking;
        }
        stakerAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = stakerAMMVolume[account][
            periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)
        ].amount.add(amount);

        if (msg.sender == thalesAMM) {
            if (lastThalesAMMUpdatePeriod[account] < periodsOfStaking) {
                thalesAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = 0;
                thalesAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].period = periodsOfStaking;
                lastThalesAMMUpdatePeriod[account] = periodsOfStaking;
            }
            thalesAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = thalesAMMVolume[account][
                periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)
            ].amount.add(amount);
        }

        if (msg.sender == thalesRangedAMM) {
            if (lastThalesRangedAMMUpdatePeriod[account] < periodsOfStaking) {
                thalesRangedAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = 0;
                thalesRangedAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].period = periodsOfStaking;
                lastThalesRangedAMMUpdatePeriod[account] = periodsOfStaking;
            }
            thalesRangedAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = thalesRangedAMMVolume[
                account
            ][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount.add(amount);
        }

        if (msg.sender == exoticBonds) {
            if (lastExoticMarketsUpdatePeriod[account] < periodsOfStaking) {
                exoticMarketsVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = 0;
                exoticMarketsVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].period = periodsOfStaking;
                lastExoticMarketsUpdatePeriod[account] = periodsOfStaking;
            }
            exoticMarketsVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = exoticMarketsVolume[
                account
            ][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount.add(amount);
        }

        if (msg.sender == sportsAMM) {
            if (lastSportsAMMUpdatePeriod[account] < periodsOfStaking) {
                sportsAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = 0;
                sportsAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].period = periodsOfStaking;
                lastSportsAMMUpdatePeriod[account] = periodsOfStaking;
            }
            sportsAMMVolume[account][periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)].amount = sportsAMMVolume[account][
                periodsOfStaking.mod(AMM_EXTRA_REWARD_PERIODS)
            ].amount.add(amount);
        }

        emit AMMVolumeUpdated(account, amount, msg.sender);
    }

    /// @notice Merge account to transfer all staking amounts to another account
    /// @param destAccount to merge into
    function mergeAccount(address destAccount) external notPaused {
        require(mergeAccountEnabled, "Merge account is disabled");
        require(destAccount != address(0) && destAccount != msg.sender, "Invalid address");
        require(
            _calculateAvailableRewardsToClaim(msg.sender) == 0 && _calculateAvailableRewardsToClaim(destAccount) == 0,
            "Cannot merge, claim rewards on both accounts before merging"
        );
        require(
            !unstaking[msg.sender] && !unstaking[destAccount],
            "Cannot merge, cancel unstaking on both accounts before merging"
        );

        iEscrowThales.mergeAccount(msg.sender, destAccount);

        _stakedBalances[destAccount] = _stakedBalances[destAccount].add(_stakedBalances[msg.sender]);
        stakerLifetimeRewardsClaimed[destAccount] = stakerLifetimeRewardsClaimed[destAccount].add(
            stakerLifetimeRewardsClaimed[msg.sender]
        );
        stakerFeesClaimed[destAccount] = stakerFeesClaimed[destAccount].add(stakerFeesClaimed[msg.sender]);

        _lastRewardsClaimedPeriod[destAccount] = periodsOfStaking;
        _lastStakingPeriod[destAccount] = periodsOfStaking;
        lastAMMUpdatePeriod[destAccount] = periodsOfStaking;

        uint stakerAMMVolumeIndex;
        uint stakerAMMVolumePeriod;
        for (uint i = 1; i <= AMM_EXTRA_REWARD_PERIODS; i++) {
            stakerAMMVolumeIndex = periodsOfStaking.add(i).mod(AMM_EXTRA_REWARD_PERIODS);
            stakerAMMVolumePeriod = periodsOfStaking.sub(AMM_EXTRA_REWARD_PERIODS.sub(i));

            if (stakerAMMVolumePeriod != stakerAMMVolume[destAccount][stakerAMMVolumeIndex].period) {
                stakerAMMVolume[destAccount][stakerAMMVolumeIndex].amount = 0;
                stakerAMMVolume[destAccount][stakerAMMVolumeIndex].period = stakerAMMVolumePeriod;
            }

            if (stakerAMMVolumePeriod == stakerAMMVolume[msg.sender][stakerAMMVolumeIndex].period) {
                stakerAMMVolume[destAccount][stakerAMMVolumeIndex].amount = stakerAMMVolume[destAccount][
                    stakerAMMVolumeIndex
                ].amount.add(stakerAMMVolume[msg.sender][stakerAMMVolumeIndex].amount);
            }
        }

        delete lastUnstakeTime[msg.sender];
        delete unstaking[msg.sender];
        delete unstakingAmount[msg.sender];
        delete _stakedBalances[msg.sender];
        delete stakerLifetimeRewardsClaimed[msg.sender];
        delete stakerFeesClaimed[msg.sender];
        delete _lastRewardsClaimedPeriod[msg.sender];
        delete _lastStakingPeriod[msg.sender];
        delete lastAMMUpdatePeriod[msg.sender];
        delete stakerAMMVolume[msg.sender];

        emit AccountMerged(msg.sender, destAccount);
    }

    /// @notice Set flag to enable/disable claim on behalf of the msg.sender for the account
    /// @param account to enable/disable claim on behalf of msg.sender
    /// @param _canClaimOnBehalf enable/disable claim on behalf of the msg.sender for the account
    function setCanClaimOnBehalf(address account, bool _canClaimOnBehalf) external notPaused {
        require(account != address(0) && account != msg.sender, "Invalid address");
        canClaimOnBehalf[msg.sender][account] = _canClaimOnBehalf;
        emit CanClaimOnBehalfChanged(msg.sender, account, _canClaimOnBehalf);
    }

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

    function _claimReward(address account) internal notPaused {
        require(claimEnabled, "Claiming is not enabled.");
        require(startTimeStamp > 0, "Staking period has not started");

        //Calculate rewards
        if (distributeFeesEnabled) {
            uint availableFeesToClaim = _calculateAvailableFeesToClaim(account);
            if (availableFeesToClaim > 0) {
                feeToken.safeTransfer(account, availableFeesToClaim);
                stakerFeesClaimed[account] = stakerFeesClaimed[account].add(availableFeesToClaim);
                _totalRewardFeesClaimed = _totalRewardFeesClaimed.add(availableFeesToClaim);
                emit FeeRewardsClaimed(account, availableFeesToClaim);
            }
        }
        uint availableRewardsToClaim = _calculateAvailableRewardsToClaim(account);
        if (availableRewardsToClaim > 0) {
            // Transfer THALES to Escrow contract
            ThalesStakingRewardsPool.addToEscrow(account, availableRewardsToClaim);
            // Record the total claimed rewards
            stakerLifetimeRewardsClaimed[account] = stakerLifetimeRewardsClaimed[account].add(availableRewardsToClaim);
            _totalRewardsClaimed = _totalRewardsClaimed.add(availableRewardsToClaim);
            _totalUnclaimedRewards = _totalUnclaimedRewards.sub(availableRewardsToClaim);

            emit RewardsClaimed(
                account,
                availableRewardsToClaim,
                getBaseReward(account),
                getSNXBonus(account),
                getAMMBonus(account)
            );
        }
        // Update last claiming period
        _lastRewardsClaimedPeriod[account] = periodsOfStaking;
    }

    function _stake(
        uint amount,
        address staker,
        address sender
    ) internal {
        require(startTimeStamp > 0, "Staking period has not started");
        require(amount > 0, "Cannot stake 0");
        require(!unstaking[staker], "Cannot stake, the staker is paused from staking due to unstaking");
        // Check if there are not claimable rewards from last period.
        // Claim them, and add new stake
        if (_calculateAvailableRewardsToClaim(staker) > 0) {
            _claimReward(staker);
        }
        _lastStakingPeriod[staker] = periodsOfStaking;

        // if just started staking subtract his escrowed balance from totalEscrowBalanceNotIncludedInStaking
        _subtractTotalEscrowBalanceNotIncludedInStaking(staker);

        _totalStakedAmount = _totalStakedAmount.add(amount);
        _stakedBalances[staker] = _stakedBalances[staker].add(amount);
        stakingToken.safeTransferFrom(sender, address(this), amount);
    }

    function _subtractTotalEscrowBalanceNotIncludedInStaking(address account) internal {
        if (_stakedBalances[account] == 0) {
            if (iEscrowThales.totalAccountEscrowedAmount(account) > 0) {
                iEscrowThales.subtractTotalEscrowBalanceNotIncludedInStaking(
                    iEscrowThales.totalAccountEscrowedAmount(account)
                );
            }
        }
    }

    function _calculateAvailableRewardsToClaim(address account) internal view returns (uint) {
        uint baseReward = getBaseReward(account);
        if (baseReward == 0) {
            return 0;
        }
        if (!extraRewardsActive) {
            return baseReward;
        } else {
            return baseReward.add(getTotalBonus(account));
        }
    }

    function _calculateAvailableFeesToClaim(address account) internal view returns (uint) {
        uint baseReward = getBaseReward(account);
        if (baseReward == 0) {
            return 0;
        }

        return
            _stakedBalances[account]
                .add(iEscrowThales.getStakedEscrowedBalanceForRewards(account))
                .mul(currentPeriodFees)
                .div(totalStakedLastPeriodEnd.add(totalEscrowedLastPeriodEnd));
    }

    function _getSNXStakedForAccount(address account) internal view returns (uint snxStaked) {
        uint cRatio = getCRatio(account);
        uint targetRatio = getSNXTargetRatio();
        uint snxPrice = priceFeed.rateForCurrency("SNX");
        uint debt = ISNXRewards(getSNXRewardsAddress()).debtBalanceOf(account, "sUSD");
        if (cRatio < targetRatio) {
            snxStaked = (cRatio.mul(cRatio).mul(debt).mul(1e14)).div(targetRatio.mul(snxPrice));
        } else {
            snxStaked = (targetRatio.mul(debt).mul(1e14)).div(snxPrice);
        }
    }

    function _getTotalAMMVolume(address account) internal view returns (uint totalAMMforAccount) {
        if (!(periodsOfStaking >= lastAMMUpdatePeriod[account].add(AMM_EXTRA_REWARD_PERIODS))) {
            for (uint i = 0; i < AMM_EXTRA_REWARD_PERIODS; i++) {
                if (periodsOfStaking < stakerAMMVolume[account][i].period.add(AMM_EXTRA_REWARD_PERIODS))
                    totalAMMforAccount = totalAMMforAccount.add(stakerAMMVolume[account][i].amount);
            }
        }
    }

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

    event RewardAdded(uint reward);
    event Staked(address user, uint amount);
    event StakedOnBehalf(address user, address staker, uint amount);
    event ClosedPeriod(uint PeriodOfStaking, uint lastPeriodTimeStamp);
    event RewardsClaimed(address account, uint unclaimedReward, uint baseRewards, uint snxBonus, uint protocolBonus);
    event FeeRewardsClaimed(address account, uint unclaimedFees);
    event UnstakeCooldown(address account, uint cooldownTime, uint amount);
    event CancelUnstake(address account);
    event Unstaked(address account, uint unstakeAmount);
    event StakingParametersChanged(
        bool claimEnabled,
        bool distributeFeesEnabled,
        uint durationPeriod,
        uint unstakeDurationPeriod,
        bool mergeAccountEnabled
    );
    event StakingRewardsParametersChanged(
        uint fixedPeriodReward,
        uint periodExtraReward,
        bool extraRewardsActive,
        uint maxSNXRewardsPercentage,
        uint maxAMMVolumeRewardsPercentage,
        uint maxThalesRoyaleRewardsPercentage,
        uint SNXVolumeRewardsMultiplier,
        uint AMMVolumeRewardsMultiplier
    );
    event AddressesChanged(
        address SNXRewards,
        address thalesRoyale,
        address thalesAMM,
        address thalesRangedAMM,
        address exoticBonds,
        address sportsAMM,
        address priceFeed,
        address ThalesStakingRewardsPool,
        address addressResolver
    );
    event EscrowChanged(address newEscrow);
    event StakingPeriodStarted();
    event AMMVolumeUpdated(address account, uint amount, address source);
    event AccountMerged(address srcAccount, address destAccount);
    event CanClaimOnBehalfChanged(address sender, address account, bool canClaimOnBehalf);
}

File 2 of 17 : 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 3 of 17 : 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 4 of 17 : 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 17 : 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 17 : 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 17 : 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 17 : 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 17 : 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 17 : ISNXRewards.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

interface ISNXRewards {
    /* ========== VIEWS / VARIABLES ========== */
    function collateralisationRatioAndAnyRatesInvalid(address account) external view returns (uint, bool);

    function debtBalanceOf(address _issuer, bytes32 currencyKey) external view returns (uint);

    function issuanceRatio() external view returns (uint);

    function setCRatio(address account, uint _c_ratio) external;

    function setIssuanceRatio(uint _issuanceRation) external;
}

File 11 of 17 : IThalesRoyale.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;
pragma experimental ABIEncoderV2;
import "../interfaces/IPassportPosition.sol";

interface IThalesRoyale {
    /* ========== VIEWS / VARIABLES ========== */
    function getBuyInAmount() external view returns (uint);

    function season() external view returns (uint);

    function tokenSeason(uint tokenId) external view returns (uint);

    function seasonFinished(uint _season) external view returns (bool);

    function roundInASeason(uint _round) external view returns (uint);

    function roundResultPerSeason(uint _season, uint round) external view returns (uint);

    function isTokenAliveInASpecificSeason(uint tokenId, uint _season) external view returns (bool);

    function hasParticipatedInCurrentOrLastRoyale(address _player) external view returns (bool);

    function getTokenPositions(uint tokenId) external view returns (IPassportPosition.Position[] memory);
}

File 12 of 17 : IPriceFeed.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

interface IPriceFeed {
    // Structs
    struct RateAndUpdatedTime {
        uint216 rate;
        uint40 time;
    }

    // Mutative functions
    function addAggregator(bytes32 currencyKey, address aggregatorAddress) external;

    function removeAggregator(bytes32 currencyKey) external;

    // Views

    function rateForCurrency(bytes32 currencyKey) external view returns (uint);

    function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time);

    function getRates() external view returns (uint[] memory);

    function getCurrencies() external view returns (bytes32[] memory);
}

File 13 of 17 : IThalesStakingRewardsPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.5.16;

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

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

pragma solidity ^0.5.16;

interface IAddressResolver {
    /* ========== VIEWS / VARIABLES ========== */
    function getAddress(bytes32 name) external view returns (address);
}

File 15 of 17 : 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 16 of 17 : 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;
    }
}

File 17 of 17 : IPassportPosition.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

interface IPassportPosition {
    struct Position {
        uint round;
        uint position;
    }
}

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":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"source","type":"address"}],"name":"AMMVolumeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"srcAccount","type":"address"},{"indexed":false,"internalType":"address","name":"destAccount","type":"address"}],"name":"AccountMerged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"SNXRewards","type":"address"},{"indexed":false,"internalType":"address","name":"thalesRoyale","type":"address"},{"indexed":false,"internalType":"address","name":"thalesAMM","type":"address"},{"indexed":false,"internalType":"address","name":"thalesRangedAMM","type":"address"},{"indexed":false,"internalType":"address","name":"exoticBonds","type":"address"},{"indexed":false,"internalType":"address","name":"sportsAMM","type":"address"},{"indexed":false,"internalType":"address","name":"priceFeed","type":"address"},{"indexed":false,"internalType":"address","name":"ThalesStakingRewardsPool","type":"address"},{"indexed":false,"internalType":"address","name":"addressResolver","type":"address"}],"name":"AddressesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"canClaimOnBehalf","type":"bool"}],"name":"CanClaimOnBehalfChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"CancelUnstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"PeriodOfStaking","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastPeriodTimeStamp","type":"uint256"}],"name":"ClosedPeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newEscrow","type":"address"}],"name":"EscrowChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"unclaimedFees","type":"uint256"}],"name":"FeeRewardsClaimed","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":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"unclaimedReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"baseRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"snxBonus","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolBonus","type":"uint256"}],"name":"RewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakedOnBehalf","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"claimEnabled","type":"bool"},{"indexed":false,"internalType":"bool","name":"distributeFeesEnabled","type":"bool"},{"indexed":false,"internalType":"uint256","name":"durationPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unstakeDurationPeriod","type":"uint256"},{"indexed":false,"internalType":"bool","name":"mergeAccountEnabled","type":"bool"}],"name":"StakingParametersChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"StakingPeriodStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fixedPeriodReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodExtraReward","type":"uint256"},{"indexed":false,"internalType":"bool","name":"extraRewardsActive","type":"bool"},{"indexed":false,"internalType":"uint256","name":"maxSNXRewardsPercentage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxAMMVolumeRewardsPercentage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxThalesRoyaleRewardsPercentage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"SNXVolumeRewardsMultiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"AMMVolumeRewardsMultiplier","type":"uint256"}],"name":"StakingRewardsParametersChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"cooldownTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnstakeCooldown","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"unstakeAmount","type":"uint256"}],"name":"Unstaked","type":"event"},{"constant":true,"inputs":[],"name":"AMMVolumeRewardsMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SNXRewards","outputs":[{"internalType":"contract ISNXRewards","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SNXVolumeRewardsMultiplier","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":true,"inputs":[],"name":"addressResolver","outputs":[{"internalType":"contract IAddressResolver","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"canClaimOnBehalf","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"canClosePeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"cancelUnstake","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"claimEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"claimReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"claimRewardOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"closePeriod","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"currentPeriodFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentPeriodRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"distributeFeesEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"durationPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"exoticBonds","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"extraRewardsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fixedPeriodReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAMMBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAMMBonusPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAMMVolume","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAlreadyClaimedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getBaseReward","outputs":[{"internalType":"uint256","name":"_baseRewards","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getContractFeeFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getContractRewardFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getExoticMarketsVolume","outputs":[{"internalType":"uint256","name":"volumeforAccount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getLastPeriodOfClaimedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getRewardFeesAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getRewardsAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getSNXBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getSNXBonusPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getSNXDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getSNXRateForCurrency","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getSNXRewardsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getSNXStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getSNXTargetRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getSportsAMMVolume","outputs":[{"internalType":"uint256","name":"volumeforAccount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getThalesAMMVolume","outputs":[{"internalType":"uint256","name":"volumeforAccount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getThalesRangedAMMVolume","outputs":[{"internalType":"uint256","name":"volumeforAccount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getTotalBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getTotalBonusPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"iEscrowThales","outputs":[{"internalType":"contract IEscrowThales","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":"_iEscrowThales","type":"address"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"address","name":"_feeToken","type":"address"},{"internalType":"uint256","name":"_durationPeriod","type":"uint256"},{"internalType":"uint256","name":"_unstakeDurationPeriod","type":"uint256"},{"internalType":"address","name":"_ISNXRewards","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":[],"name":"lastPeriodTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastUnstakeTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxAMMVolumeRewardsPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxSNXRewardsPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxThalesRoyaleRewardsPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"destAccount","type":"address"}],"name":"mergeAccount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"mergeAccountEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","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":true,"inputs":[],"name":"periodExtraReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"periodsOfStaking","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"priceFeed","outputs":[{"internalType":"contract IPriceFeed","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_snxRewards","type":"address"},{"internalType":"address","name":"_royale","type":"address"},{"internalType":"address","name":"_thalesAMM","type":"address"},{"internalType":"address","name":"_thalesRangedAMM","type":"address"},{"internalType":"address","name":"_exoticBonds","type":"address"},{"internalType":"address","name":"_sportsAMM","type":"address"},{"internalType":"address","name":"_priceFeed","type":"address"},{"internalType":"address","name":"_thalesStakingRewardsPool","type":"address"},{"internalType":"address","name":"_addressResolver","type":"address"}],"name":"setAddresses","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"_canClaimOnBehalf","type":"bool"}],"name":"setCanClaimOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_escrowThalesContract","type":"address"}],"name":"setEscrow","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":"bool","name":"_claimEnabled","type":"bool"},{"internalType":"bool","name":"_distributeFeesEnabled","type":"bool"},{"internalType":"uint256","name":"_durationPeriod","type":"uint256"},{"internalType":"uint256","name":"_unstakeDurationPeriod","type":"uint256"},{"internalType":"bool","name":"_mergeAccountEnabled","type":"bool"}],"name":"setStakingParameters","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_fixedReward","type":"uint256"},{"internalType":"uint256","name":"_extraReward","type":"uint256"},{"internalType":"bool","name":"_extraRewardsActive","type":"bool"},{"internalType":"uint256","name":"_maxSNXRewardsPercentage","type":"uint256"},{"internalType":"uint256","name":"_maxAMMVolumeRewardsPercentage","type":"uint256"},{"internalType":"uint256","name":"_maxThalesRoyaleRewardsPercentage","type":"uint256"},{"internalType":"uint256","name":"_SNXVolumeRewardsMultiplier","type":"uint256"},{"internalType":"uint256","name":"_AMMVolumeRewardsMultiplier","type":"uint256"}],"name":"setStakingRewardsParameters","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"sportsAMM","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"stakedBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakerFeesClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakerLifetimeRewardsClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"startStakingPeriod","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"startTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"startUnstake","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"thalesAMM","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"thalesRangedAMM","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"thalesRoyale","outputs":[{"internalType":"contract IThalesRoyale","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalEscrowedLastPeriodEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSNXFeesInPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSNXRewardsInPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalStakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalStakedLastPeriodEnd","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":"unstake","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"unstakeDurationPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"unstaking","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"unstakingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updateVolume","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061532f806100206000396000f3fe608060405234801561001057600080fd5b506004361061050f5760003560e01c80637a685677116102a4578063b88a802f11610172578063d506950a116100d9578063ebc7977211610092578063ebc7977214610d35578063ed778fe814610d3d578063f38d00f014610d63578063faa27d5114610d6b578063faa7b9dd14610d73578063fe3783d314610dae5761050f565b8063d506950a14610ce7578063d66e067714610d0d578063d78fc29014610d15578063da42840014610d1d578063e11cd05514610d25578063ebaf5b3c14610d2d5761050f565b8063c5335ac61161012b578063c5335ac614610c5d578063c598694914610c83578063c731a3d114610ca9578063c992528814610cb1578063cb8d751a14610cb9578063cf26dbbc14610cdf5761050f565b8063b88a802f14610bd3578063b9cce86a14610bdb578063ba47a5d914610c01578063bbe3aa3714610c09578063c10c354614610c11578063c3b83f5f14610c375761050f565b80639a09edab11610216578063a4bce4ac116101cf578063a4bce4ac14610b34578063a4ea739614610b3c578063a694fc3a14610b62578063a7c153a614610b7f578063ac8e71ea14610ba5578063afac7fb114610bcb5761050f565b80639a09edab14610a665780639a109bc214610a8c5780639e6b892b14610ab2578063a00159a814610ad8578063a0ad222914610b06578063a3c4a50b14610b2c5761050f565b80638da5cb5b116102685780638da5cb5b14610a18578063907bfe1214610a20578063915518dc14610a2857806391b4ded914610a4e57806393eb2e6614610a5657806395910db214610a5e5761050f565b80637a685677146109b45780637c17f6fc146109da5780637dbbdea0146109e257806384854b19146109ea5780638a239de8146109f25761050f565b80634c4e75df116103e157806361654fae11610353578063662720441161030c57806366272044146108b85780636dca3b021461092257806372f702f314610976578063741bef1a1461097e57806378d2b6831461098657806379ba5097146109ac5761050f565b806361654fae1461080a57806361c01db71461085457806362139e0e1461087a5780636282719e14610882578063647846a51461088a57806364c83591146108925761050f565b806353cf4115116103a557806353cf4115146107bc578063567e98f9146107c4578063572e36e6146107cc5780635c975abb146107d4578063608daf89146107dc57806360962e06146107e45761050f565b80634c4e75df146107505780634ed25b4314610776578063505b14971461077e578063507a7328146107ac57806353a47bb7146107b45761050f565b806320074354116104855780632f3241581161043e5780632f324158146106cf578063331e03a8146106d757806334dfb268146106fd57806336468b5a1461071a5780633faae534146107405780634ab17969146107485761050f565b8063200743541461066d578063203d3718146106755780632866ed211461067d5780632a1a1e48146106995780632d287886146106a15780632def6620146106c75761050f565b806313af4035116104d757806313af4035146105cc57806315da5064146105f25780631627540c146105fa578063167653911461062057806316c38b3c146106465780631cb70a95146106655761050f565b806302c7739b1461051457806305a2ee2a1461054257806305ce342914610566578063080e2b471461056e5780631314f759146105a6575b600080fd5b6105406004803603604081101561052a57600080fd5b506001600160a01b038135169060200135610db6565b005b61054a611510565b604080516001600160a01b039092168252519081900360200190f35b61054a61151f565b6105946004803603602081101561058457600080fd5b50356001600160a01b031661152e565b60408051918252519081900360200190f35b610594600480360360208110156105bc57600080fd5b50356001600160a01b0316611540565b610540600480360360208110156105e257600080fd5b50356001600160a01b0316611553565b610594611668565b6105406004803603602081101561061057600080fd5b50356001600160a01b031661166e565b6105946004803603602081101561063657600080fd5b50356001600160a01b03166116ca565b6105406004803603602081101561065c57600080fd5b503515156116e5565b61054a61175f565b610594611773565b61054a611779565b610685611788565b604080519115158252519081900360200190f35b610594611791565b610594600480360360208110156106b757600080fd5b50356001600160a01b0316611797565b6105406117a9565b61054a611929565b610594600480360360208110156106ed57600080fd5b50356001600160a01b031661193d565b6105406004803603602081101561071357600080fd5b503561194f565b6105946004803603602081101561073057600080fd5b50356001600160a01b0316611cdd565b610594611d84565b610540611e0f565b6105946004803603602081101561076657600080fd5b50356001600160a01b0316611f8f565b610594611faa565b6105406004803603604081101561079457600080fd5b506001600160a01b0381351690602001351515611fb0565b6105406120cb565b61054a6124f0565b6106856124ff565b610594612508565b61054a61250e565b61068561251d565b610594612526565b610594600480360360208110156107fa57600080fd5b50356001600160a01b031661252c565b610540600480360361010081101561082157600080fd5b50803590602081013590604081013515159060608101359060808101359060a08101359060c08101359060e001356125cb565b6105406004803603602081101561086a57600080fd5b50356001600160a01b0316612675565b6105946127e8565b6105406127ee565b61054a6128a5565b610594600480360360208110156108a857600080fd5b50356001600160a01b03166128b4565b61054060048036036101208110156108cf57600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a081013582169160c082013581169160e081013582169161010090910135166128c6565b610540600480360360e081101561093857600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013582169160808201359160a08101359160c09091013516612ad8565b61054a612c94565b61054a612ca3565b6105946004803603602081101561099c57600080fd5b50356001600160a01b0316612cb2565b610540612d5b565b610594600480360360208110156109ca57600080fd5b50356001600160a01b0316612e17565b610594612e22565b61054a612e28565b610594612eca565b61059460048036036020811015610a0857600080fd5b50356001600160a01b0316612f59565b61054a612f74565b610594612f83565b61059460048036036020811015610a3e57600080fd5b50356001600160a01b0316612f89565b610594612ffa565b610594613000565b610594613006565b61059460048036036020811015610a7c57600080fd5b50356001600160a01b031661300c565b61059460048036036020811015610aa257600080fd5b50356001600160a01b0316613017565b61059460048036036020811015610ac857600080fd5b50356001600160a01b0316613151565b61068560048036036040811015610aee57600080fd5b506001600160a01b0381358116916020013516613188565b61059460048036036020811015610b1c57600080fd5b50356001600160a01b03166131a8565b61054a613219565b610685613228565b61059460048036036020811015610b5257600080fd5b50356001600160a01b0316613231565b61054060048036036020811015610b7857600080fd5b50356132c9565b61059460048036036020811015610b9557600080fd5b50356001600160a01b03166133a0565b61059460048036036020811015610bbb57600080fd5b50356001600160a01b03166134ee565b61068561355f565b61054061358b565b61059460048036036020811015610bf157600080fd5b50356001600160a01b0316613625565b610594613630565b61054a613636565b61054060048036036020811015610c2757600080fd5b50356001600160a01b0316613645565b61054060048036036020811015610c4d57600080fd5b50356001600160a01b03166137ce565b61054060048036036020811015610c7357600080fd5b50356001600160a01b03166138ed565b61059460048036036020811015610c9957600080fd5b50356001600160a01b0316613e62565b610685613e7b565b61054a613e84565b61068560048036036020811015610ccf57600080fd5b50356001600160a01b0316613e93565b610594613ea8565b61059460048036036020811015610cfd57600080fd5b50356001600160a01b0316613eae565b610594613f4e565b610594613f99565b610594613f9f565b610594613ff0565b610594613ff6565b610540613ffc565b61059460048036036020811015610d5357600080fd5b50356001600160a01b031661405f565b61059461408a565b610594614090565b610540600480360360a0811015610d8957600080fd5b5080351515906020810135151590604081013590606081013590608001351515614096565b61059461412a565b6001600160a01b03821615801590610dce5750600081115b610e10576040805162461bcd60e51b815260206004820152600e60248201526d496e76616c696420706172616d7360901b604482015290519081900360640190fd5b6058546001600160a01b0316331480610e3357506064546001600160a01b031633145b80610e4857506066546001600160a01b031633145b80610e5d57506067546001600160a01b031633145b610ea0576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b603e546001600160a01b0383166000908152605960205260409020541015610f58576001600160a01b0382166000908152605a60205260408120603e54610eee90600463ffffffff61413016565b60048110610ef857fe5b6002020155603e546001600160a01b0383166000908152605a60205260409020610f2982600463ffffffff61413016565b60048110610f3357fe5b6002020160010155603e546001600160a01b0383166000908152605960205260409020555b6001600160a01b0382166000908152605a60205260409020603e54610fa5918391610f8a90600463ffffffff61413016565b60048110610f9457fe5b60020201549063ffffffff61419716565b6001600160a01b0383166000908152605a60205260409020603e54610fd190600463ffffffff61413016565b60048110610fdb57fe5b60020201556058546001600160a01b031633141561111957603e546001600160a01b03831660009081526068602052604090205410156110ab576001600160a01b0382166000908152606960205260408120603e5461104190600463ffffffff61413016565b6004811061104b57fe5b6002020155603e546001600160a01b038316600090815260696020526040902061107c82600463ffffffff61413016565b6004811061108657fe5b6002020160010155603e546001600160a01b0383166000908152606860205260409020555b6001600160a01b0382166000908152606960205260409020603e546110dd918391610f8a90600463ffffffff61413016565b6001600160a01b0383166000908152606960205260409020603e5461110990600463ffffffff61413016565b6004811061111357fe5b60020201555b6066546001600160a01b031633141561125257603e546001600160a01b0383166000908152606a602052604090205410156111e4576001600160a01b0382166000908152606b60205260408120603e5461117a90600463ffffffff61413016565b6004811061118457fe5b6002020155603e546001600160a01b0383166000908152606b602052604090206111b582600463ffffffff61413016565b600481106111bf57fe5b6002020160010155603e546001600160a01b0383166000908152606a60205260409020555b6001600160a01b0382166000908152606b60205260409020603e54611216918391610f8a90600463ffffffff61413016565b6001600160a01b0383166000908152606b60205260409020603e5461124290600463ffffffff61413016565b6004811061124c57fe5b60020201555b6064546001600160a01b031633141561138b57603e546001600160a01b0383166000908152606c6020526040902054101561131d576001600160a01b0382166000908152606d60205260408120603e546112b390600463ffffffff61413016565b600481106112bd57fe5b6002020155603e546001600160a01b0383166000908152606d602052604090206112ee82600463ffffffff61413016565b600481106112f857fe5b6002020160010155603e546001600160a01b0383166000908152606c60205260409020555b6001600160a01b0382166000908152606d60205260409020603e5461134f918391610f8a90600463ffffffff61413016565b6001600160a01b0383166000908152606d60205260409020603e5461137b90600463ffffffff61413016565b6004811061138557fe5b60020201555b6067546001600160a01b03163314156114c457603e546001600160a01b0383166000908152606e60205260409020541015611456576001600160a01b0382166000908152606f60205260408120603e546113ec90600463ffffffff61413016565b600481106113f657fe5b6002020155603e546001600160a01b0383166000908152606f6020526040902061142782600463ffffffff61413016565b6004811061143157fe5b6002020160010155603e546001600160a01b0383166000908152606e60205260409020555b6001600160a01b0382166000908152606f60205260409020603e54611488918391610f8a90600463ffffffff61413016565b6001600160a01b0383166000908152606f60205260409020603e546114b490600463ffffffff61413016565b600481106114be57fe5b60020201555b604080516001600160a01b038416815260208101839052338183015290517fb43a20c9abfed93eb48264a3acf807336352ba8cb6ee42c1754b1b1b280a20b99181900360600190a15050565b6065546001600160a01b031681565b6064546001600160a01b031681565b604c6020526000908152604090205481565b600061154b826141f1565b90505b919050565b6001600160a01b0381166115ae576040805162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b603454600160a01b900460ff16156115f75760405162461bcd60e51b81526004018080602001828103825260298152602001806150576029913960400191505060405180910390fd5b6034805460ff60a01b1916600160a01b179055603380546001600160a01b0383166001600160a01b031990911681179091556040805160008152602081019290925280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150565b60465481565b6116766142d5565b603480546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b6001600160a01b031660009081526056602052604090205490565b6116ed6142d5565b60385460ff16151581151514156117035761175c565b6038805460ff1916821515179081905560ff161561172057426037555b6038546040805160ff90921615158252517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59181900360200190a15b50565b605b5461010090046001600160a01b031681565b603f5481565b6066546001600160a01b031681565b604a5460ff1681565b605f5481565b60556020526000908152604090205481565b60385460ff16156117eb5760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b3360009081526054602052604090205460ff166118395760405162461bcd60e51b815260040180806020018281038252602a8152602001806150a9602a913960400191505060405180910390fd5b60415461184d90429063ffffffff61432016565b33600090815260536020526040902054106118995760405162461bcd60e51b81526004018080602001828103825260298152602001806150806029913960400191505060405180910390fd5b336000818152605460209081526040808320805460ff19169055605590915290205460395490916118da916001600160a01b0316908363ffffffff61437d16565b336000818152605560209081526040808320929092558151928352820183905280517f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759281900390910190a150565b60385461010090046001600160a01b031681565b60536020526000908152604090205481565b60385460ff16156119915760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b600081116119d9576040805162461bcd60e51b815260206004820152601060248201526f043616e6e6f7420756e7374616b6520360841b604482015290519081900360640190fd5b33600090815260566020526040902054811115611a275760405162461bcd60e51b81526004018080602001828103825260248152602001806152726024913960400191505060405180910390fd5b3360009081526054602052604090205460ff1615611a765760405162461bcd60e51b815260040180806020018281038252602e8152602001806151ca602e913960400191505060405180910390fd5b6000611a81336143d4565b1115611a9057611a9033614423565b33600090815260536020908152604080832042905560549091529020805460ff19166001179055604d54611aca908263ffffffff61432016565b604d553360009081526055602090815260408083208490556056909152902054611afa908263ffffffff61432016565b336000908152605660205260409020819055611c6c57603854604080516334c78ae560e11b8152336004820152905160009261010090046001600160a01b03169163698f15ca916024808301926020929190829003018186803b158015611b6057600080fd5b505afa158015611b74573d6000803e3d6000fd5b505050506040513d6020811015611b8a57600080fd5b50511115611c6c57603854604080516334c78ae560e11b815233600482015290516101009092046001600160a01b031691635817d04291839163698f15ca91602480820192602092909190829003018186803b158015611be957600080fd5b505afa158015611bfd573d6000803e3d6000fd5b505050506040513d6020811015611c1357600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b158015611c5357600080fd5b505af1158015611c67573d6000803e3d6000fd5b505050505b604154336000818152605360205260409020547f30797de805f090008d8b19fa0c6f92d0f164789f64d6f7a1b097fbf0b1abac6b92611cb1919063ffffffff61419716565b604080516001600160a01b0390931683526020830191909152818101849052519081900360600190a150565b600080611ce983613017565b90506000611cf68461405f565b9050670de0b6b3a76400008110611d54576040805162461bcd60e51b815260206004820152601a60248201527f426f6e7573204578636565647320626173652072657761726473000000000000604482015290519081900360640190fd5b611d7c670de0b6b3a7640000611d70848463ffffffff61477416565b9063ffffffff6147cd16565b949350505050565b603954605b54604080516370a0823160e01b81526101009092046001600160a01b039081166004840152905160009391909116916370a08231916024808301926020929190829003018186803b158015611ddd57600080fd5b505afa158015611df1573d6000803e3d6000fd5b505050506040513d6020811015611e0757600080fd5b505190505b90565b60385460ff1615611e515760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b3360009081526054602052604090205460ff16611eb5576040805162461bcd60e51b815260206004820152601860248201527f4163636f756e74206973206e6f7420756e7374616b696e670000000000000000604482015290519081900360640190fd5b611ebe33614837565b6000611ec9336143d4565b1115611ed857611ed833614423565b336000908152605460209081526040808320805460ff191690556055909152902054604d54611f0c9163ffffffff61419716565b604d5533600090815260556020908152604080832054605690925290912054611f3a9163ffffffff61419716565b336000818152605660209081526040808320949094556055815283822091909155825191825291517f725ee3b9a70aadcb1e002c94935880d7f515620783a5144c90e39201dc6f92da929181900390910190a1565b6001600160a01b031660009081526057602052604090205490565b60475481565b60385460ff1615611ff25760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b6001600160a01b0382161580159061201357506001600160a01b0382163314155b612056576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b3360008181526070602090815260408083206001600160a01b03871680855290835292819020805486151560ff19909116811790915581519485529184019290925282820152517fc939ba7d9b3e1a4e6505db209888366a551f46a85918944eb89becb92289935b9181900360600190a15050565b603580546001019081905560385460ff16156121185760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b60006042541161216f576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e6720706572696f6420686173206e6f7420737461727465640000604482015290519081900360640190fd5b604054603f546121849163ffffffff61419716565b4210156121c25760405162461bcd60e51b81526004018080602001828103825260398152602001806151916039913960400191505060405180910390fd5b603860019054906101000a90046001600160a01b03166001600160a01b031663acfabbe46040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561221257600080fd5b505af1158015612226573d6000803e3d6000fd5b505050506040513d602081101561223c57600080fd5b505042603f5560385460408051635d13850560e01b815290516101009092046001600160a01b031691635d13850591600480820192602092909190829003018186803b15801561228b57600080fd5b505afa15801561229f573d6000803e3d6000fd5b505050506040513d60208110156122b557600080fd5b5051603e55603854604080516347d3681760e11b815290516123b29261010090046001600160a01b031691638fa6d02e916004808301926020929190829003018186803b15801561230557600080fd5b505afa158015612319573d6000803e3d6000fd5b505050506040513d602081101561232f57600080fd5b50516038546040805163b9d1c70b60e01b815290516101009092046001600160a01b03169163b9d1c70b91600480820192602092909190829003018186803b15801561237a57600080fd5b505afa15801561238e573d6000803e3d6000fd5b505050506040513d60208110156123a457600080fd5b50519063ffffffff61432016565b604e5560465460438190556047546123e2916123d39163ffffffff61419716565b6050549063ffffffff61419716565b605055603a54604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561243057600080fd5b505afa158015612444573d6000803e3d6000fd5b505050506040513d602081101561245a57600080fd5b5051604455604d54606255604e54606355603e54603f5460408051928352602083019190915280517f80827f48a8070d07af7887688320aadf44499e3a2751fc41cc965870cf0627d79281900390910190a1603554811461175c576040805162461bcd60e51b815260206004820152601f6024820152600080516020615002833981519152604482015290519081900360640190fd5b6034546001600160a01b031681565b60455460ff1681565b604d5490565b6058546001600160a01b031681565b60385460ff1681565b60625481565b6000805b60048110156125c5576001600160a01b0383166000908152606b60205260409020612578906004908382811061256257fe5b600202016001015461419790919063ffffffff16565b603e5410156125bd576001600160a01b0383166000908152606b602052604090206125ba9082600481106125a857fe5b6002020154839063ffffffff61419716565b91505b600101612530565b50919050565b6125d36142d5565b60468890556047879055605b805487151560ff199091168117909155605c869055605d859055605f8490556060838155605e839055604080518b8152602081018b9052808201939093529082018790526080820186905260a0820183905260c0820185905260e08201849052517fe6737551f1fd7cc268d29269d9fd1f7599b280ac444d09c5d6a2a56e01abe16d918190036101000190a15050505050505050565b603580546001019081905560385460ff16156126c25760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b6001600160a01b038216158015906126e357506001600160a01b0382163314155b612726576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b6001600160a01b038216600090815260706020908152604080832033845290915290205460ff16612797576040805162461bcd60e51b815260206004820152601660248201527521b0b73737ba1031b630b4b69037b7103132b430b63360511b604482015290519081900360640190fd5b6127a082614423565b60355481146127e4576040805162461bcd60e51b815260206004820152601f6024820152600080516020615002833981519152604482015290519081900360640190fd5b5050565b60405481565b6127f66142d5565b6042541561284b576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e672068617320616c726561647920737461727465640000000000604482015290519081900360640190fd5b4260428190556000603e819055603f91909155605081905560518190556052819055604d819055604e819055604f8190556040517f7c01398e484f9a82feaa276906d5d1f84867a0ff5a5bd9a485d4357f58d401839190a1565b603a546001600160a01b031681565b604b6020526000908152604090205481565b6128ce6142d5565b6001600160a01b038916158015906128ee57506001600160a01b03881615155b801561290257506001600160a01b03871615155b801561291657506001600160a01b03861615155b801561292a57506001600160a01b03851615155b801561293e57506001600160a01b03841615155b801561295257506001600160a01b03831615155b801561296657506001600160a01b03821615155b801561297a57506001600160a01b03811615155b6129bd576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b603b80546001600160a01b03808c166001600160a01b03199283168117909355603c80548c83169084168117909155605880548c84169085168117909155606680548c85169086168117909155606480548c86169087168117909155606780548c87169088168117909155603d80548c88169089168117909155605b80548c8916610100818102610100600160a81b03199093169290921790925560658054998d1699909a168917909955604080519a8b5260208b0197909752898701959095526060890193909352608088019190915260a087015260c086015260e085015291830152517f8b90a93e1fb4480272790adc8ac03d681f251a46b41378b2cf8836b2f9fdaf35918190036101200190a1505050505050505050565b600054610100900460ff1680612af15750612af16149bb565b80612aff575060005460ff16155b612b3a5760405162461bcd60e51b815260040180806020018281038252602e815260200180615163602e913960400191505060405180910390fd5b600054610100900460ff16158015612b65576000805460ff1961ff0019909116610100171660011790555b612b6e88611553565b612b76613ffc565b60388054610100600160a81b0319166101006001600160a01b038a811691820292909217909255603980546001600160a01b03199081168a84161791829055603a80549091168984161790556040805163095ea7b360e01b8152600481019490945260001960248501525191169163095ea7b39160448083019260209291908290030181600087803b158015612c0b57600080fd5b505af1158015612c1f573d6000803e3d6000fd5b505050506040513d6020811015612c3557600080fd5b505060408490556041839055690ed2b525841adfc00000604655690472698b413b43200000604755603b80546001600160a01b0319166001600160a01b0384161790558015612c8a576000805461ff00191690555b5050505050505050565b6039546001600160a01b031681565b603d546001600160a01b031681565b600080612cbe83613017565b905080612ccf57600091505061154e565b6000612cda846149c1565b9050612cf16060548361477490919063ffffffff16565b811015612d4157612d3c612d106060548461477490919063ffffffff16565b611d70662386f26fc10000612d30605c548661477490919063ffffffff16565b9063ffffffff61477416565b611d7c565b605c54611d7c90662386f26fc1000063ffffffff61477416565b6034546001600160a01b03163314612da45760405162461bcd60e51b81526004018080602001828103825260358152602001806150226035913960400191505060405180910390fd5b603354603454604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160348054603380546001600160a01b03199081166001600160a01b03841617909155169055565b600061154b826143d4565b603e5481565b6065546000906001600160a01b0316612e4357506000611e0c565b606554604080516321f8a72160e01b81526524b9b9bab2b960d11b600482015290516001600160a01b03909216916321f8a72191602480820192602092909190829003018186803b158015612e9757600080fd5b505afa158015612eab573d6000803e3d6000fd5b505050506040513d6020811015612ec157600080fd5b50519050611e0c565b600069021e19e0c9bab2400000612f53612ee2612e28565b6001600160a01b031663b410a0346040518163ffffffff1660e01b815260040160206040518083038186803b158015612f1a57600080fd5b505afa158015612f2e573d6000803e3d6000fd5b505050506040513d6020811015612f4457600080fd5b5051829063ffffffff6147cd16565b91505090565b6001600160a01b03166000908152604b602052604090205490565b6033546001600160a01b031681565b60495481565b6000805b60048110156125c5576001600160a01b0383166000908152606d60205260409020612fbf906004908382811061256257fe5b603e541015612ff2576001600160a01b0383166000908152606d60205260409020612fef9082600481106125a857fe5b91505b600101612f8d565b60375481565b60415481565b60635481565b600061154b82614b62565b603e546001600160a01b0382166000908152606160205260408120549091148061305757506001600160a01b038216600090815260566020526040902054155b8061307b5750603e546001600160a01b038316600090815260576020526040902054145b806130865750606254155b61154e5761154b6130a460635460625461419790919063ffffffff16565b604354603854604080516317640e0760e01b81526001600160a01b0388811660048301529151611d709493612d309361010090910416916317640e07916024808301926020929190829003018186803b15801561310057600080fd5b505afa158015613114573d6000803e3d6000fd5b505050506040513d602081101561312a57600080fd5b50516001600160a01b0388166000908152605660205260409020549063ffffffff61419716565b60008061315d83613017565b9050600061316a84612cb2565b9050611d7c670de0b6b3a7640000611d70848463ffffffff61477416565b607060209081526000928352604080842090915290825290205460ff1681565b6000805b60048110156125c5576001600160a01b0383166000908152606f602052604090206131de906004908382811061256257fe5b603e541015613211576001600160a01b0383166000908152606f6020526040902061320e9082600481106125a857fe5b91505b6001016131ac565b603c546001600160a01b031681565b605b5460ff1681565b60008061323d83613017565b90508061324e57600091505061154e565b605e5461326290829063ffffffff61477416565b61326b84614b62565b10156132a8576132a3613289605e548361477490919063ffffffff16565b611d70605d54612d30662386f26fc10000612d3089614b62565b6132c2565b605d546132c290662386f26fc1000063ffffffff61477416565b9392505050565b603580546001019081905560385460ff16156133165760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b613321823333614c05565b604080513381526020810184905281517f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d929181900390910190a160355481146127e4576040805162461bcd60e51b815260206004820152601f6024820152600080516020615002833981519152604482015290519081900360640190fd5b6000806133ab612e28565b6001600160a01b031663d37c4d8b846040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200180631cd554d160e21b81525060200191505060206040518083038186803b15801561340f57600080fd5b505afa158015613423573d6000803e3d6000fd5b505050506040513d602081101561343957600080fd5b505190508061344c57600091505061154e565b69021e19e0c9bab24000006000613461612e28565b6040805163ae3bbbbb60e01b81526001600160a01b038881166004830152825193169263ae3bbbbb92602480840193919291829003018186803b1580156134a757600080fd5b505afa1580156134bb573d6000803e3d6000fd5b505050506040513d60408110156134d157600080fd5b505190506134e5828263ffffffff6147cd16565b95945050505050565b6000805b60048110156125c5576001600160a01b0383166000908152606960205260409020613524906004908382811061256257fe5b603e541015613557576001600160a01b03831660009081526069602052604090206135549082600481106125a857fe5b91505b6001016134f2565b6000806042541180156135865750604054603f546135829163ffffffff61419716565b4210155b905090565b603580546001019081905560385460ff16156135d85760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b6135e133614423565b603554811461175c576040805162461bcd60e51b815260206004820152601f6024820152600080516020615002833981519152604482015290519081900360640190fd5b600061154b826149c1565b60445481565b603b546001600160a01b031681565b61364d6142d5565b60385461010090046001600160a01b0316156136f0576039546038546040805163095ea7b360e01b81526101009092046001600160a01b039081166004840152600060248401819052915193169263095ea7b3926044808201936020939283900390910190829087803b1580156136c357600080fd5b505af11580156136d7573d6000803e3d6000fd5b505050506040513d60208110156136ed57600080fd5b50505b60388054610100600160a81b0319166101006001600160a01b03848116918202929092179092556039546040805163095ea7b360e01b8152600481019490945260001960248501525191169163095ea7b39160448083019260209291908290030181600087803b15801561376357600080fd5b505af1158015613777573d6000803e3d6000fd5b505050506040513d602081101561378d57600080fd5b5050604080516001600160a01b038316815290517feb1a4b1e230d212e1644ea31e3890084e2fa17ddee990e46a46e198e1728c4a09181900360200190a150565b6137d66142d5565b6001600160a01b038116613823576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b603454600160a81b900460ff1615613878576040805162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b604482015290519081900360640190fd5b603380546001600160a01b038084166001600160a01b03199092168217928390556034805460ff60a81b1916600160a81b17905560408051939091168352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150565b60385460ff161561392f5760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b60715460ff16613986576040805162461bcd60e51b815260206004820152601960248201527f4d65726765206163636f756e742069732064697361626c656400000000000000604482015290519081900360640190fd5b6001600160a01b038116158015906139a757506001600160a01b0381163314155b6139ea576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b6139f3336143d4565b158015613a065750613a04816143d4565b155b613a415760405162461bcd60e51b815260040180806020018281038252603b815260200180615296603b913960400191505060405180910390fd5b3360009081526054602052604090205460ff16158015613a7a57506001600160a01b03811660009081526054602052604090205460ff16155b613ab55760405162461bcd60e51b815260040180806020018281038252603e8152602001806151f8603e913960400191505060405180910390fd5b60385460408051630282a2ed60e21b81523360048201526001600160a01b038481166024830152915161010090930490911691630a0a8bb49160448082019260009290919082900301818387803b158015613b0f57600080fd5b505af1158015613b23573d6000803e3d6000fd5b505033600090815260566020526040808220546001600160a01b0386168352912054613b579350915063ffffffff61419716565b6001600160a01b038216600081815260566020908152604080832094909455338252604b9052828120549181529190912054613b989163ffffffff61419716565b6001600160a01b0382166000818152604b6020908152604080832094909455338252604c9052828120549181529190912054613bd99163ffffffff61419716565b6001600160a01b0382166000908152604c6020908152604080832093909355603e5460578252838320819055606182528383208190556059909152918120919091558060015b60048111613d9f57613c4d6004613c4183603e5461419790919063ffffffff16565b9063ffffffff61413016565b9250613c72613c6360048363ffffffff61432016565b603e549063ffffffff61432016565b6001600160a01b0385166000908152605a602052604090209092508360048110613c9857fe5b60020201600101548214613cff576001600160a01b0384166000908152605a602052604081208460048110613cc957fe5b60020201556001600160a01b0384166000908152605a6020526040902082908460048110613cf357fe5b60020201600101819055505b336000908152605a602052604090208360048110613d1957fe5b6002020160010154821415613d9757336000908152605a60205260409020613d6e908460048110613d4657fe5b60020201546001600160a01b0386166000908152605a602052604090208560048110610f9457fe5b6001600160a01b0385166000908152605a602052604090208460048110613d9157fe5b60020201555b600101613c1f565b5033600090815260536020908152604080832083905560548252808320805460ff191690556055825280832083905560568252808320839055604b8252808320839055604c8252808320839055605782528083208390556061825280832083905560598252808320839055605a9091528120613e1a91614fc9565b604080513381526001600160a01b038516602082015281517fa0fc26d627101bedf9c6cedb33e9eeac3fa2a7d508f89b597134bcee1a12d32c929181900390910190a1505050565b600080613e6e83613017565b9050600061316a84613231565b60715460ff1681565b6067546001600160a01b031681565b60546020526000908152604090205460ff1681565b605c5481565b6000613eb8612e28565b6001600160a01b031663d37c4d8b836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200180631cd554d160e21b81525060200191505060206040518083038186803b158015613f1c57600080fd5b505afa158015613f30573d6000803e3d6000fd5b505050506040513d6020811015613f4657600080fd5b505192915050565b603a54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611ddd57600080fd5b605e5481565b603d54604080516315905ec160e31b8152620a69cb60eb1b600482015290516000926001600160a01b03169163ac82f608916024808301926020929190829003018186803b158015611ddd57600080fd5b60435481565b605d5481565b60365460ff161561404a576040805162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b6036805460ff19166001908117909155603555565b60008061406b83612cb2565b9050600061407884613231565b9050611d7c828263ffffffff61419716565b60425481565b60605481565b61409e6142d5565b604a805486151560ff199182168117909255604580548715159083168117909155604086815560418690556071805486151594168417905580519384526020840191909152828101869052606083018590526080830191909152517fc3fb08f467537b94d35d16e7ea0c42e3d6ff73af0f2311728cda630fc81bb4f59181900360a00190a15050505050565b60485481565b600081614184576040805162461bcd60e51b815260206004820152601860248201527f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000604482015290519081900360640190fd5b81838161418d57fe5b0690505b92915050565b6000828201838110156132c2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000806141fd83613017565b90508061420e57600091505061154e565b6132c261422860635460625461419790919063ffffffff16565b604454603854604080516317640e0760e01b81526001600160a01b0389811660048301529151611d709493612d309361010090910416916317640e07916024808301926020929190829003018186803b15801561428457600080fd5b505afa158015614298573d6000803e3d6000fd5b505050506040513d60208110156142ae57600080fd5b50516001600160a01b0389166000908152605660205260409020549063ffffffff61419716565b6033546001600160a01b0316331461431e5760405162461bcd60e51b815260040180806020018281038252602f815260200180615113602f913960400191505060405180910390fd5b565b600082821115614377576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526143cf908490614dab565b505050565b6000806143e083613017565b9050806143f157600091505061154e565b605b5460ff1661440257905061154e565b61441b61440e84611cdd565b829063ffffffff61419716565b91505061154e565b60385460ff16156144655760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b604a5460ff166144bc576040805162461bcd60e51b815260206004820152601860248201527f436c61696d696e67206973206e6f7420656e61626c65642e0000000000000000604482015290519081900360640190fd5b600060425411614513576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e6720706572696f6420686173206e6f7420737461727465640000604482015290519081900360640190fd5b60455460ff16156145ed576000614529826141f1565b905080156145eb57603a5461454e906001600160a01b0316838363ffffffff61437d16565b6001600160a01b0382166000908152604c6020526040902054614577908263ffffffff61419716565b6001600160a01b0383166000908152604c60205260409020556052546145a3908263ffffffff61419716565b605255604080516001600160a01b03841681526020810183905281517f5b16e1043a283423361eb77682c99aff55948b34296846800a1a7dc9547a89fc929181900390910190a15b505b60006145f8826143d4565b9050801561475457605b546040805163b01ca88f60e01b81526001600160a01b0385811660048301526024820185905291516101009093049091169163b01ca88f9160448082019260009290919082900301818387803b15801561465b57600080fd5b505af115801561466f573d6000803e3d6000fd5b5050506001600160a01b0383166000908152604b602052604090205461469c91508263ffffffff61419716565b6001600160a01b0383166000908152604b60205260409020556051546146c8908263ffffffff61419716565b6051556050546146de908263ffffffff61432016565b6050557f5619b8583bbbb0760d27ac9ff844cec866b333bf7ad0262c2d809ff42f22e5fc828261470d82613017565b61471686613151565b61471f87613e62565b604080516001600160a01b03909616865260208601949094528484019290925260608401526080830152519081900360a00190a15b50603e546001600160a01b03909116600090815260576020526040902055565b60008261478357506000614191565b8282028284828161479057fe5b04146132c25760405162461bcd60e51b81526004018080602001828103825260218152602001806151426021913960400191505060405180910390fd5b6000808211614823576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161482e57fe5b04949350505050565b6001600160a01b03811660009081526056602052604090205461175c57603854604080516334c78ae560e11b81526001600160a01b038481166004830152915160009361010090049092169163698f15ca91602480820192602092909190829003018186803b1580156148a957600080fd5b505afa1580156148bd573d6000803e3d6000fd5b505050506040513d60208110156148d357600080fd5b5051111561175c57603854604080516334c78ae560e11b81526001600160a01b03848116600483015291516101009093049091169163ad6d15de91839163698f15ca91602480820192602092909190829003018186803b15801561493657600080fd5b505afa15801561494a573d6000803e3d6000fd5b505050506040513d602081101561496057600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b1580156149a057600080fd5b505af11580156149b4573d6000803e3d6000fd5b5050505050565b303b1590565b6000806149cd836133a0565b905060006149d9612eca565b603d54604080516315905ec160e31b8152620a69cb60eb1b600482015290519293506000926001600160a01b039092169163ac82f60891602480820192602092909190829003018186803b158015614a3057600080fd5b505afa158015614a44573d6000803e3d6000fd5b505050506040513d6020811015614a5a57600080fd5b505190506000614a68612e28565b6001600160a01b031663d37c4d8b876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200180631cd554d160e21b81525060200191505060206040518083038186803b158015614acc57600080fd5b505afa158015614ae0573d6000803e3d6000fd5b505050506040513d6020811015614af657600080fd5b5051905082841015614b3857614b31614b15848463ffffffff61477416565b611d70655af3107a4000612d3085818a8063ffffffff61477416565b9450614b59565b614b5682611d70655af3107a4000612d30878663ffffffff61477416565b94505b50505050919050565b6001600160a01b038116600090815260596020526040812054614b8c90600463ffffffff61419716565b603e54101561154e5760005b60048110156125c5576001600160a01b0383166000908152605a60205260409020614bca906004908382811061256257fe5b603e541015614bfd576001600160a01b0383166000908152605a60205260409020614bfa9082600481106125a857fe5b91505b600101614b98565b600060425411614c5c576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e6720706572696f6420686173206e6f7420737461727465640000604482015290519081900360640190fd5b60008311614ca2576040805162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b604482015290519081900360640190fd5b6001600160a01b03821660009081526054602052604090205460ff1615614cfa5760405162461bcd60e51b81526004018080602001828103825260408152602001806150d36040913960400191505060405180910390fd5b6000614d05836143d4565b1115614d1457614d1482614423565b603e546001600160a01b038316600090815260616020526040902055614d3982614837565b604d54614d4c908463ffffffff61419716565b604d556001600160a01b038216600090815260566020526040902054614d78908463ffffffff61419716565b6001600160a01b038084166000908152605660205260409020919091556039546143cf911682308663ffffffff614f6916565b614dbd826001600160a01b0316614fc3565b614e0e576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310614e4c5780518252601f199092019160209182019101614e2d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614eae576040519150601f19603f3d011682016040523d82523d6000602084013e614eb3565b606091505b509150915081614f0a576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115614f6357808060200190516020811015614f2657600080fd5b5051614f635760405162461bcd60e51b815260040180806020018281038252602a8152602001806152d1602a913960400191505060405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052614f63908590614dab565b3b151590565b50600080825560018201819055600282018190556003820181905560048201819055600582018190556006820181905560079091015556fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e657273686970416c726561647920696e697469616c697a65642c20757365206e6f6d696e6174654e65774f776e657243616e6e6f7420756e7374616b65207965742c20636f6f6c646f776e206e6f7420657870697265642e4163636f756e7420686173206e6f742074726967676572656420756e7374616b6520636f6f6c646f776e43616e6e6f74207374616b652c20746865207374616b6572206973207061757365642066726f6d207374616b696e672064756520746f20756e7374616b696e674f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564412066756c6c20706572696f6420686173206e6f74207061737365642073696e636520746865206c61737420636c6f73656420706572696f644163636f756e742068617320616c72656164792074726967676572656420756e7374616b6520636f6f6c646f776e43616e6e6f74206d657267652c2063616e63656c20756e7374616b696e67206f6e20626f7468206163636f756e7473206265666f7265206d657267696e675468697320616374696f6e2063616e6e6f7420626520706572666f726d6564207768696c652074686520636f6e7472616374206973207061757365644163636f756e7420646f65736e7420686176652074686174206d756368207374616b656443616e6e6f74206d657267652c20636c61696d2072657761726473206f6e20626f7468206163636f756e7473206265666f7265206d657267696e675361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158209b41a101e3971b1cbe47ed1b5026b7f03c34ccc9c633aa0dbb9401332f541f9964736f6c63430005100032

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061050f5760003560e01c80637a685677116102a4578063b88a802f11610172578063d506950a116100d9578063ebc7977211610092578063ebc7977214610d35578063ed778fe814610d3d578063f38d00f014610d63578063faa27d5114610d6b578063faa7b9dd14610d73578063fe3783d314610dae5761050f565b8063d506950a14610ce7578063d66e067714610d0d578063d78fc29014610d15578063da42840014610d1d578063e11cd05514610d25578063ebaf5b3c14610d2d5761050f565b8063c5335ac61161012b578063c5335ac614610c5d578063c598694914610c83578063c731a3d114610ca9578063c992528814610cb1578063cb8d751a14610cb9578063cf26dbbc14610cdf5761050f565b8063b88a802f14610bd3578063b9cce86a14610bdb578063ba47a5d914610c01578063bbe3aa3714610c09578063c10c354614610c11578063c3b83f5f14610c375761050f565b80639a09edab11610216578063a4bce4ac116101cf578063a4bce4ac14610b34578063a4ea739614610b3c578063a694fc3a14610b62578063a7c153a614610b7f578063ac8e71ea14610ba5578063afac7fb114610bcb5761050f565b80639a09edab14610a665780639a109bc214610a8c5780639e6b892b14610ab2578063a00159a814610ad8578063a0ad222914610b06578063a3c4a50b14610b2c5761050f565b80638da5cb5b116102685780638da5cb5b14610a18578063907bfe1214610a20578063915518dc14610a2857806391b4ded914610a4e57806393eb2e6614610a5657806395910db214610a5e5761050f565b80637a685677146109b45780637c17f6fc146109da5780637dbbdea0146109e257806384854b19146109ea5780638a239de8146109f25761050f565b80634c4e75df116103e157806361654fae11610353578063662720441161030c57806366272044146108b85780636dca3b021461092257806372f702f314610976578063741bef1a1461097e57806378d2b6831461098657806379ba5097146109ac5761050f565b806361654fae1461080a57806361c01db71461085457806362139e0e1461087a5780636282719e14610882578063647846a51461088a57806364c83591146108925761050f565b806353cf4115116103a557806353cf4115146107bc578063567e98f9146107c4578063572e36e6146107cc5780635c975abb146107d4578063608daf89146107dc57806360962e06146107e45761050f565b80634c4e75df146107505780634ed25b4314610776578063505b14971461077e578063507a7328146107ac57806353a47bb7146107b45761050f565b806320074354116104855780632f3241581161043e5780632f324158146106cf578063331e03a8146106d757806334dfb268146106fd57806336468b5a1461071a5780633faae534146107405780634ab17969146107485761050f565b8063200743541461066d578063203d3718146106755780632866ed211461067d5780632a1a1e48146106995780632d287886146106a15780632def6620146106c75761050f565b806313af4035116104d757806313af4035146105cc57806315da5064146105f25780631627540c146105fa578063167653911461062057806316c38b3c146106465780631cb70a95146106655761050f565b806302c7739b1461051457806305a2ee2a1461054257806305ce342914610566578063080e2b471461056e5780631314f759146105a6575b600080fd5b6105406004803603604081101561052a57600080fd5b506001600160a01b038135169060200135610db6565b005b61054a611510565b604080516001600160a01b039092168252519081900360200190f35b61054a61151f565b6105946004803603602081101561058457600080fd5b50356001600160a01b031661152e565b60408051918252519081900360200190f35b610594600480360360208110156105bc57600080fd5b50356001600160a01b0316611540565b610540600480360360208110156105e257600080fd5b50356001600160a01b0316611553565b610594611668565b6105406004803603602081101561061057600080fd5b50356001600160a01b031661166e565b6105946004803603602081101561063657600080fd5b50356001600160a01b03166116ca565b6105406004803603602081101561065c57600080fd5b503515156116e5565b61054a61175f565b610594611773565b61054a611779565b610685611788565b604080519115158252519081900360200190f35b610594611791565b610594600480360360208110156106b757600080fd5b50356001600160a01b0316611797565b6105406117a9565b61054a611929565b610594600480360360208110156106ed57600080fd5b50356001600160a01b031661193d565b6105406004803603602081101561071357600080fd5b503561194f565b6105946004803603602081101561073057600080fd5b50356001600160a01b0316611cdd565b610594611d84565b610540611e0f565b6105946004803603602081101561076657600080fd5b50356001600160a01b0316611f8f565b610594611faa565b6105406004803603604081101561079457600080fd5b506001600160a01b0381351690602001351515611fb0565b6105406120cb565b61054a6124f0565b6106856124ff565b610594612508565b61054a61250e565b61068561251d565b610594612526565b610594600480360360208110156107fa57600080fd5b50356001600160a01b031661252c565b610540600480360361010081101561082157600080fd5b50803590602081013590604081013515159060608101359060808101359060a08101359060c08101359060e001356125cb565b6105406004803603602081101561086a57600080fd5b50356001600160a01b0316612675565b6105946127e8565b6105406127ee565b61054a6128a5565b610594600480360360208110156108a857600080fd5b50356001600160a01b03166128b4565b61054060048036036101208110156108cf57600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a081013582169160c082013581169160e081013582169161010090910135166128c6565b610540600480360360e081101561093857600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013582169160808201359160a08101359160c09091013516612ad8565b61054a612c94565b61054a612ca3565b6105946004803603602081101561099c57600080fd5b50356001600160a01b0316612cb2565b610540612d5b565b610594600480360360208110156109ca57600080fd5b50356001600160a01b0316612e17565b610594612e22565b61054a612e28565b610594612eca565b61059460048036036020811015610a0857600080fd5b50356001600160a01b0316612f59565b61054a612f74565b610594612f83565b61059460048036036020811015610a3e57600080fd5b50356001600160a01b0316612f89565b610594612ffa565b610594613000565b610594613006565b61059460048036036020811015610a7c57600080fd5b50356001600160a01b031661300c565b61059460048036036020811015610aa257600080fd5b50356001600160a01b0316613017565b61059460048036036020811015610ac857600080fd5b50356001600160a01b0316613151565b61068560048036036040811015610aee57600080fd5b506001600160a01b0381358116916020013516613188565b61059460048036036020811015610b1c57600080fd5b50356001600160a01b03166131a8565b61054a613219565b610685613228565b61059460048036036020811015610b5257600080fd5b50356001600160a01b0316613231565b61054060048036036020811015610b7857600080fd5b50356132c9565b61059460048036036020811015610b9557600080fd5b50356001600160a01b03166133a0565b61059460048036036020811015610bbb57600080fd5b50356001600160a01b03166134ee565b61068561355f565b61054061358b565b61059460048036036020811015610bf157600080fd5b50356001600160a01b0316613625565b610594613630565b61054a613636565b61054060048036036020811015610c2757600080fd5b50356001600160a01b0316613645565b61054060048036036020811015610c4d57600080fd5b50356001600160a01b03166137ce565b61054060048036036020811015610c7357600080fd5b50356001600160a01b03166138ed565b61059460048036036020811015610c9957600080fd5b50356001600160a01b0316613e62565b610685613e7b565b61054a613e84565b61068560048036036020811015610ccf57600080fd5b50356001600160a01b0316613e93565b610594613ea8565b61059460048036036020811015610cfd57600080fd5b50356001600160a01b0316613eae565b610594613f4e565b610594613f99565b610594613f9f565b610594613ff0565b610594613ff6565b610540613ffc565b61059460048036036020811015610d5357600080fd5b50356001600160a01b031661405f565b61059461408a565b610594614090565b610540600480360360a0811015610d8957600080fd5b5080351515906020810135151590604081013590606081013590608001351515614096565b61059461412a565b6001600160a01b03821615801590610dce5750600081115b610e10576040805162461bcd60e51b815260206004820152600e60248201526d496e76616c696420706172616d7360901b604482015290519081900360640190fd5b6058546001600160a01b0316331480610e3357506064546001600160a01b031633145b80610e4857506066546001600160a01b031633145b80610e5d57506067546001600160a01b031633145b610ea0576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b603e546001600160a01b0383166000908152605960205260409020541015610f58576001600160a01b0382166000908152605a60205260408120603e54610eee90600463ffffffff61413016565b60048110610ef857fe5b6002020155603e546001600160a01b0383166000908152605a60205260409020610f2982600463ffffffff61413016565b60048110610f3357fe5b6002020160010155603e546001600160a01b0383166000908152605960205260409020555b6001600160a01b0382166000908152605a60205260409020603e54610fa5918391610f8a90600463ffffffff61413016565b60048110610f9457fe5b60020201549063ffffffff61419716565b6001600160a01b0383166000908152605a60205260409020603e54610fd190600463ffffffff61413016565b60048110610fdb57fe5b60020201556058546001600160a01b031633141561111957603e546001600160a01b03831660009081526068602052604090205410156110ab576001600160a01b0382166000908152606960205260408120603e5461104190600463ffffffff61413016565b6004811061104b57fe5b6002020155603e546001600160a01b038316600090815260696020526040902061107c82600463ffffffff61413016565b6004811061108657fe5b6002020160010155603e546001600160a01b0383166000908152606860205260409020555b6001600160a01b0382166000908152606960205260409020603e546110dd918391610f8a90600463ffffffff61413016565b6001600160a01b0383166000908152606960205260409020603e5461110990600463ffffffff61413016565b6004811061111357fe5b60020201555b6066546001600160a01b031633141561125257603e546001600160a01b0383166000908152606a602052604090205410156111e4576001600160a01b0382166000908152606b60205260408120603e5461117a90600463ffffffff61413016565b6004811061118457fe5b6002020155603e546001600160a01b0383166000908152606b602052604090206111b582600463ffffffff61413016565b600481106111bf57fe5b6002020160010155603e546001600160a01b0383166000908152606a60205260409020555b6001600160a01b0382166000908152606b60205260409020603e54611216918391610f8a90600463ffffffff61413016565b6001600160a01b0383166000908152606b60205260409020603e5461124290600463ffffffff61413016565b6004811061124c57fe5b60020201555b6064546001600160a01b031633141561138b57603e546001600160a01b0383166000908152606c6020526040902054101561131d576001600160a01b0382166000908152606d60205260408120603e546112b390600463ffffffff61413016565b600481106112bd57fe5b6002020155603e546001600160a01b0383166000908152606d602052604090206112ee82600463ffffffff61413016565b600481106112f857fe5b6002020160010155603e546001600160a01b0383166000908152606c60205260409020555b6001600160a01b0382166000908152606d60205260409020603e5461134f918391610f8a90600463ffffffff61413016565b6001600160a01b0383166000908152606d60205260409020603e5461137b90600463ffffffff61413016565b6004811061138557fe5b60020201555b6067546001600160a01b03163314156114c457603e546001600160a01b0383166000908152606e60205260409020541015611456576001600160a01b0382166000908152606f60205260408120603e546113ec90600463ffffffff61413016565b600481106113f657fe5b6002020155603e546001600160a01b0383166000908152606f6020526040902061142782600463ffffffff61413016565b6004811061143157fe5b6002020160010155603e546001600160a01b0383166000908152606e60205260409020555b6001600160a01b0382166000908152606f60205260409020603e54611488918391610f8a90600463ffffffff61413016565b6001600160a01b0383166000908152606f60205260409020603e546114b490600463ffffffff61413016565b600481106114be57fe5b60020201555b604080516001600160a01b038416815260208101839052338183015290517fb43a20c9abfed93eb48264a3acf807336352ba8cb6ee42c1754b1b1b280a20b99181900360600190a15050565b6065546001600160a01b031681565b6064546001600160a01b031681565b604c6020526000908152604090205481565b600061154b826141f1565b90505b919050565b6001600160a01b0381166115ae576040805162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b603454600160a01b900460ff16156115f75760405162461bcd60e51b81526004018080602001828103825260298152602001806150576029913960400191505060405180910390fd5b6034805460ff60a01b1916600160a01b179055603380546001600160a01b0383166001600160a01b031990911681179091556040805160008152602081019290925280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150565b60465481565b6116766142d5565b603480546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b6001600160a01b031660009081526056602052604090205490565b6116ed6142d5565b60385460ff16151581151514156117035761175c565b6038805460ff1916821515179081905560ff161561172057426037555b6038546040805160ff90921615158252517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59181900360200190a15b50565b605b5461010090046001600160a01b031681565b603f5481565b6066546001600160a01b031681565b604a5460ff1681565b605f5481565b60556020526000908152604090205481565b60385460ff16156117eb5760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b3360009081526054602052604090205460ff166118395760405162461bcd60e51b815260040180806020018281038252602a8152602001806150a9602a913960400191505060405180910390fd5b60415461184d90429063ffffffff61432016565b33600090815260536020526040902054106118995760405162461bcd60e51b81526004018080602001828103825260298152602001806150806029913960400191505060405180910390fd5b336000818152605460209081526040808320805460ff19169055605590915290205460395490916118da916001600160a01b0316908363ffffffff61437d16565b336000818152605560209081526040808320929092558151928352820183905280517f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759281900390910190a150565b60385461010090046001600160a01b031681565b60536020526000908152604090205481565b60385460ff16156119915760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b600081116119d9576040805162461bcd60e51b815260206004820152601060248201526f043616e6e6f7420756e7374616b6520360841b604482015290519081900360640190fd5b33600090815260566020526040902054811115611a275760405162461bcd60e51b81526004018080602001828103825260248152602001806152726024913960400191505060405180910390fd5b3360009081526054602052604090205460ff1615611a765760405162461bcd60e51b815260040180806020018281038252602e8152602001806151ca602e913960400191505060405180910390fd5b6000611a81336143d4565b1115611a9057611a9033614423565b33600090815260536020908152604080832042905560549091529020805460ff19166001179055604d54611aca908263ffffffff61432016565b604d553360009081526055602090815260408083208490556056909152902054611afa908263ffffffff61432016565b336000908152605660205260409020819055611c6c57603854604080516334c78ae560e11b8152336004820152905160009261010090046001600160a01b03169163698f15ca916024808301926020929190829003018186803b158015611b6057600080fd5b505afa158015611b74573d6000803e3d6000fd5b505050506040513d6020811015611b8a57600080fd5b50511115611c6c57603854604080516334c78ae560e11b815233600482015290516101009092046001600160a01b031691635817d04291839163698f15ca91602480820192602092909190829003018186803b158015611be957600080fd5b505afa158015611bfd573d6000803e3d6000fd5b505050506040513d6020811015611c1357600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b158015611c5357600080fd5b505af1158015611c67573d6000803e3d6000fd5b505050505b604154336000818152605360205260409020547f30797de805f090008d8b19fa0c6f92d0f164789f64d6f7a1b097fbf0b1abac6b92611cb1919063ffffffff61419716565b604080516001600160a01b0390931683526020830191909152818101849052519081900360600190a150565b600080611ce983613017565b90506000611cf68461405f565b9050670de0b6b3a76400008110611d54576040805162461bcd60e51b815260206004820152601a60248201527f426f6e7573204578636565647320626173652072657761726473000000000000604482015290519081900360640190fd5b611d7c670de0b6b3a7640000611d70848463ffffffff61477416565b9063ffffffff6147cd16565b949350505050565b603954605b54604080516370a0823160e01b81526101009092046001600160a01b039081166004840152905160009391909116916370a08231916024808301926020929190829003018186803b158015611ddd57600080fd5b505afa158015611df1573d6000803e3d6000fd5b505050506040513d6020811015611e0757600080fd5b505190505b90565b60385460ff1615611e515760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b3360009081526054602052604090205460ff16611eb5576040805162461bcd60e51b815260206004820152601860248201527f4163636f756e74206973206e6f7420756e7374616b696e670000000000000000604482015290519081900360640190fd5b611ebe33614837565b6000611ec9336143d4565b1115611ed857611ed833614423565b336000908152605460209081526040808320805460ff191690556055909152902054604d54611f0c9163ffffffff61419716565b604d5533600090815260556020908152604080832054605690925290912054611f3a9163ffffffff61419716565b336000818152605660209081526040808320949094556055815283822091909155825191825291517f725ee3b9a70aadcb1e002c94935880d7f515620783a5144c90e39201dc6f92da929181900390910190a1565b6001600160a01b031660009081526057602052604090205490565b60475481565b60385460ff1615611ff25760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b6001600160a01b0382161580159061201357506001600160a01b0382163314155b612056576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b3360008181526070602090815260408083206001600160a01b03871680855290835292819020805486151560ff19909116811790915581519485529184019290925282820152517fc939ba7d9b3e1a4e6505db209888366a551f46a85918944eb89becb92289935b9181900360600190a15050565b603580546001019081905560385460ff16156121185760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b60006042541161216f576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e6720706572696f6420686173206e6f7420737461727465640000604482015290519081900360640190fd5b604054603f546121849163ffffffff61419716565b4210156121c25760405162461bcd60e51b81526004018080602001828103825260398152602001806151916039913960400191505060405180910390fd5b603860019054906101000a90046001600160a01b03166001600160a01b031663acfabbe46040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561221257600080fd5b505af1158015612226573d6000803e3d6000fd5b505050506040513d602081101561223c57600080fd5b505042603f5560385460408051635d13850560e01b815290516101009092046001600160a01b031691635d13850591600480820192602092909190829003018186803b15801561228b57600080fd5b505afa15801561229f573d6000803e3d6000fd5b505050506040513d60208110156122b557600080fd5b5051603e55603854604080516347d3681760e11b815290516123b29261010090046001600160a01b031691638fa6d02e916004808301926020929190829003018186803b15801561230557600080fd5b505afa158015612319573d6000803e3d6000fd5b505050506040513d602081101561232f57600080fd5b50516038546040805163b9d1c70b60e01b815290516101009092046001600160a01b03169163b9d1c70b91600480820192602092909190829003018186803b15801561237a57600080fd5b505afa15801561238e573d6000803e3d6000fd5b505050506040513d60208110156123a457600080fd5b50519063ffffffff61432016565b604e5560465460438190556047546123e2916123d39163ffffffff61419716565b6050549063ffffffff61419716565b605055603a54604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561243057600080fd5b505afa158015612444573d6000803e3d6000fd5b505050506040513d602081101561245a57600080fd5b5051604455604d54606255604e54606355603e54603f5460408051928352602083019190915280517f80827f48a8070d07af7887688320aadf44499e3a2751fc41cc965870cf0627d79281900390910190a1603554811461175c576040805162461bcd60e51b815260206004820152601f6024820152600080516020615002833981519152604482015290519081900360640190fd5b6034546001600160a01b031681565b60455460ff1681565b604d5490565b6058546001600160a01b031681565b60385460ff1681565b60625481565b6000805b60048110156125c5576001600160a01b0383166000908152606b60205260409020612578906004908382811061256257fe5b600202016001015461419790919063ffffffff16565b603e5410156125bd576001600160a01b0383166000908152606b602052604090206125ba9082600481106125a857fe5b6002020154839063ffffffff61419716565b91505b600101612530565b50919050565b6125d36142d5565b60468890556047879055605b805487151560ff199091168117909155605c869055605d859055605f8490556060838155605e839055604080518b8152602081018b9052808201939093529082018790526080820186905260a0820183905260c0820185905260e08201849052517fe6737551f1fd7cc268d29269d9fd1f7599b280ac444d09c5d6a2a56e01abe16d918190036101000190a15050505050505050565b603580546001019081905560385460ff16156126c25760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b6001600160a01b038216158015906126e357506001600160a01b0382163314155b612726576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b6001600160a01b038216600090815260706020908152604080832033845290915290205460ff16612797576040805162461bcd60e51b815260206004820152601660248201527521b0b73737ba1031b630b4b69037b7103132b430b63360511b604482015290519081900360640190fd5b6127a082614423565b60355481146127e4576040805162461bcd60e51b815260206004820152601f6024820152600080516020615002833981519152604482015290519081900360640190fd5b5050565b60405481565b6127f66142d5565b6042541561284b576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e672068617320616c726561647920737461727465640000000000604482015290519081900360640190fd5b4260428190556000603e819055603f91909155605081905560518190556052819055604d819055604e819055604f8190556040517f7c01398e484f9a82feaa276906d5d1f84867a0ff5a5bd9a485d4357f58d401839190a1565b603a546001600160a01b031681565b604b6020526000908152604090205481565b6128ce6142d5565b6001600160a01b038916158015906128ee57506001600160a01b03881615155b801561290257506001600160a01b03871615155b801561291657506001600160a01b03861615155b801561292a57506001600160a01b03851615155b801561293e57506001600160a01b03841615155b801561295257506001600160a01b03831615155b801561296657506001600160a01b03821615155b801561297a57506001600160a01b03811615155b6129bd576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b603b80546001600160a01b03808c166001600160a01b03199283168117909355603c80548c83169084168117909155605880548c84169085168117909155606680548c85169086168117909155606480548c86169087168117909155606780548c87169088168117909155603d80548c88169089168117909155605b80548c8916610100818102610100600160a81b03199093169290921790925560658054998d1699909a168917909955604080519a8b5260208b0197909752898701959095526060890193909352608088019190915260a087015260c086015260e085015291830152517f8b90a93e1fb4480272790adc8ac03d681f251a46b41378b2cf8836b2f9fdaf35918190036101200190a1505050505050505050565b600054610100900460ff1680612af15750612af16149bb565b80612aff575060005460ff16155b612b3a5760405162461bcd60e51b815260040180806020018281038252602e815260200180615163602e913960400191505060405180910390fd5b600054610100900460ff16158015612b65576000805460ff1961ff0019909116610100171660011790555b612b6e88611553565b612b76613ffc565b60388054610100600160a81b0319166101006001600160a01b038a811691820292909217909255603980546001600160a01b03199081168a84161791829055603a80549091168984161790556040805163095ea7b360e01b8152600481019490945260001960248501525191169163095ea7b39160448083019260209291908290030181600087803b158015612c0b57600080fd5b505af1158015612c1f573d6000803e3d6000fd5b505050506040513d6020811015612c3557600080fd5b505060408490556041839055690ed2b525841adfc00000604655690472698b413b43200000604755603b80546001600160a01b0319166001600160a01b0384161790558015612c8a576000805461ff00191690555b5050505050505050565b6039546001600160a01b031681565b603d546001600160a01b031681565b600080612cbe83613017565b905080612ccf57600091505061154e565b6000612cda846149c1565b9050612cf16060548361477490919063ffffffff16565b811015612d4157612d3c612d106060548461477490919063ffffffff16565b611d70662386f26fc10000612d30605c548661477490919063ffffffff16565b9063ffffffff61477416565b611d7c565b605c54611d7c90662386f26fc1000063ffffffff61477416565b6034546001600160a01b03163314612da45760405162461bcd60e51b81526004018080602001828103825260358152602001806150226035913960400191505060405180910390fd5b603354603454604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160348054603380546001600160a01b03199081166001600160a01b03841617909155169055565b600061154b826143d4565b603e5481565b6065546000906001600160a01b0316612e4357506000611e0c565b606554604080516321f8a72160e01b81526524b9b9bab2b960d11b600482015290516001600160a01b03909216916321f8a72191602480820192602092909190829003018186803b158015612e9757600080fd5b505afa158015612eab573d6000803e3d6000fd5b505050506040513d6020811015612ec157600080fd5b50519050611e0c565b600069021e19e0c9bab2400000612f53612ee2612e28565b6001600160a01b031663b410a0346040518163ffffffff1660e01b815260040160206040518083038186803b158015612f1a57600080fd5b505afa158015612f2e573d6000803e3d6000fd5b505050506040513d6020811015612f4457600080fd5b5051829063ffffffff6147cd16565b91505090565b6001600160a01b03166000908152604b602052604090205490565b6033546001600160a01b031681565b60495481565b6000805b60048110156125c5576001600160a01b0383166000908152606d60205260409020612fbf906004908382811061256257fe5b603e541015612ff2576001600160a01b0383166000908152606d60205260409020612fef9082600481106125a857fe5b91505b600101612f8d565b60375481565b60415481565b60635481565b600061154b82614b62565b603e546001600160a01b0382166000908152606160205260408120549091148061305757506001600160a01b038216600090815260566020526040902054155b8061307b5750603e546001600160a01b038316600090815260576020526040902054145b806130865750606254155b61154e5761154b6130a460635460625461419790919063ffffffff16565b604354603854604080516317640e0760e01b81526001600160a01b0388811660048301529151611d709493612d309361010090910416916317640e07916024808301926020929190829003018186803b15801561310057600080fd5b505afa158015613114573d6000803e3d6000fd5b505050506040513d602081101561312a57600080fd5b50516001600160a01b0388166000908152605660205260409020549063ffffffff61419716565b60008061315d83613017565b9050600061316a84612cb2565b9050611d7c670de0b6b3a7640000611d70848463ffffffff61477416565b607060209081526000928352604080842090915290825290205460ff1681565b6000805b60048110156125c5576001600160a01b0383166000908152606f602052604090206131de906004908382811061256257fe5b603e541015613211576001600160a01b0383166000908152606f6020526040902061320e9082600481106125a857fe5b91505b6001016131ac565b603c546001600160a01b031681565b605b5460ff1681565b60008061323d83613017565b90508061324e57600091505061154e565b605e5461326290829063ffffffff61477416565b61326b84614b62565b10156132a8576132a3613289605e548361477490919063ffffffff16565b611d70605d54612d30662386f26fc10000612d3089614b62565b6132c2565b605d546132c290662386f26fc1000063ffffffff61477416565b9392505050565b603580546001019081905560385460ff16156133165760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b613321823333614c05565b604080513381526020810184905281517f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d929181900390910190a160355481146127e4576040805162461bcd60e51b815260206004820152601f6024820152600080516020615002833981519152604482015290519081900360640190fd5b6000806133ab612e28565b6001600160a01b031663d37c4d8b846040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200180631cd554d160e21b81525060200191505060206040518083038186803b15801561340f57600080fd5b505afa158015613423573d6000803e3d6000fd5b505050506040513d602081101561343957600080fd5b505190508061344c57600091505061154e565b69021e19e0c9bab24000006000613461612e28565b6040805163ae3bbbbb60e01b81526001600160a01b038881166004830152825193169263ae3bbbbb92602480840193919291829003018186803b1580156134a757600080fd5b505afa1580156134bb573d6000803e3d6000fd5b505050506040513d60408110156134d157600080fd5b505190506134e5828263ffffffff6147cd16565b95945050505050565b6000805b60048110156125c5576001600160a01b0383166000908152606960205260409020613524906004908382811061256257fe5b603e541015613557576001600160a01b03831660009081526069602052604090206135549082600481106125a857fe5b91505b6001016134f2565b6000806042541180156135865750604054603f546135829163ffffffff61419716565b4210155b905090565b603580546001019081905560385460ff16156135d85760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b6135e133614423565b603554811461175c576040805162461bcd60e51b815260206004820152601f6024820152600080516020615002833981519152604482015290519081900360640190fd5b600061154b826149c1565b60445481565b603b546001600160a01b031681565b61364d6142d5565b60385461010090046001600160a01b0316156136f0576039546038546040805163095ea7b360e01b81526101009092046001600160a01b039081166004840152600060248401819052915193169263095ea7b3926044808201936020939283900390910190829087803b1580156136c357600080fd5b505af11580156136d7573d6000803e3d6000fd5b505050506040513d60208110156136ed57600080fd5b50505b60388054610100600160a81b0319166101006001600160a01b03848116918202929092179092556039546040805163095ea7b360e01b8152600481019490945260001960248501525191169163095ea7b39160448083019260209291908290030181600087803b15801561376357600080fd5b505af1158015613777573d6000803e3d6000fd5b505050506040513d602081101561378d57600080fd5b5050604080516001600160a01b038316815290517feb1a4b1e230d212e1644ea31e3890084e2fa17ddee990e46a46e198e1728c4a09181900360200190a150565b6137d66142d5565b6001600160a01b038116613823576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b603454600160a81b900460ff1615613878576040805162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b604482015290519081900360640190fd5b603380546001600160a01b038084166001600160a01b03199092168217928390556034805460ff60a81b1916600160a81b17905560408051939091168352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150565b60385460ff161561392f5760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b60715460ff16613986576040805162461bcd60e51b815260206004820152601960248201527f4d65726765206163636f756e742069732064697361626c656400000000000000604482015290519081900360640190fd5b6001600160a01b038116158015906139a757506001600160a01b0381163314155b6139ea576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b6139f3336143d4565b158015613a065750613a04816143d4565b155b613a415760405162461bcd60e51b815260040180806020018281038252603b815260200180615296603b913960400191505060405180910390fd5b3360009081526054602052604090205460ff16158015613a7a57506001600160a01b03811660009081526054602052604090205460ff16155b613ab55760405162461bcd60e51b815260040180806020018281038252603e8152602001806151f8603e913960400191505060405180910390fd5b60385460408051630282a2ed60e21b81523360048201526001600160a01b038481166024830152915161010090930490911691630a0a8bb49160448082019260009290919082900301818387803b158015613b0f57600080fd5b505af1158015613b23573d6000803e3d6000fd5b505033600090815260566020526040808220546001600160a01b0386168352912054613b579350915063ffffffff61419716565b6001600160a01b038216600081815260566020908152604080832094909455338252604b9052828120549181529190912054613b989163ffffffff61419716565b6001600160a01b0382166000818152604b6020908152604080832094909455338252604c9052828120549181529190912054613bd99163ffffffff61419716565b6001600160a01b0382166000908152604c6020908152604080832093909355603e5460578252838320819055606182528383208190556059909152918120919091558060015b60048111613d9f57613c4d6004613c4183603e5461419790919063ffffffff16565b9063ffffffff61413016565b9250613c72613c6360048363ffffffff61432016565b603e549063ffffffff61432016565b6001600160a01b0385166000908152605a602052604090209092508360048110613c9857fe5b60020201600101548214613cff576001600160a01b0384166000908152605a602052604081208460048110613cc957fe5b60020201556001600160a01b0384166000908152605a6020526040902082908460048110613cf357fe5b60020201600101819055505b336000908152605a602052604090208360048110613d1957fe5b6002020160010154821415613d9757336000908152605a60205260409020613d6e908460048110613d4657fe5b60020201546001600160a01b0386166000908152605a602052604090208560048110610f9457fe5b6001600160a01b0385166000908152605a602052604090208460048110613d9157fe5b60020201555b600101613c1f565b5033600090815260536020908152604080832083905560548252808320805460ff191690556055825280832083905560568252808320839055604b8252808320839055604c8252808320839055605782528083208390556061825280832083905560598252808320839055605a9091528120613e1a91614fc9565b604080513381526001600160a01b038516602082015281517fa0fc26d627101bedf9c6cedb33e9eeac3fa2a7d508f89b597134bcee1a12d32c929181900390910190a1505050565b600080613e6e83613017565b9050600061316a84613231565b60715460ff1681565b6067546001600160a01b031681565b60546020526000908152604090205460ff1681565b605c5481565b6000613eb8612e28565b6001600160a01b031663d37c4d8b836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200180631cd554d160e21b81525060200191505060206040518083038186803b158015613f1c57600080fd5b505afa158015613f30573d6000803e3d6000fd5b505050506040513d6020811015613f4657600080fd5b505192915050565b603a54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611ddd57600080fd5b605e5481565b603d54604080516315905ec160e31b8152620a69cb60eb1b600482015290516000926001600160a01b03169163ac82f608916024808301926020929190829003018186803b158015611ddd57600080fd5b60435481565b605d5481565b60365460ff161561404a576040805162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b6036805460ff19166001908117909155603555565b60008061406b83612cb2565b9050600061407884613231565b9050611d7c828263ffffffff61419716565b60425481565b60605481565b61409e6142d5565b604a805486151560ff199182168117909255604580548715159083168117909155604086815560418690556071805486151594168417905580519384526020840191909152828101869052606083018590526080830191909152517fc3fb08f467537b94d35d16e7ea0c42e3d6ff73af0f2311728cda630fc81bb4f59181900360a00190a15050505050565b60485481565b600081614184576040805162461bcd60e51b815260206004820152601860248201527f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000604482015290519081900360640190fd5b81838161418d57fe5b0690505b92915050565b6000828201838110156132c2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000806141fd83613017565b90508061420e57600091505061154e565b6132c261422860635460625461419790919063ffffffff16565b604454603854604080516317640e0760e01b81526001600160a01b0389811660048301529151611d709493612d309361010090910416916317640e07916024808301926020929190829003018186803b15801561428457600080fd5b505afa158015614298573d6000803e3d6000fd5b505050506040513d60208110156142ae57600080fd5b50516001600160a01b0389166000908152605660205260409020549063ffffffff61419716565b6033546001600160a01b0316331461431e5760405162461bcd60e51b815260040180806020018281038252602f815260200180615113602f913960400191505060405180910390fd5b565b600082821115614377576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526143cf908490614dab565b505050565b6000806143e083613017565b9050806143f157600091505061154e565b605b5460ff1661440257905061154e565b61441b61440e84611cdd565b829063ffffffff61419716565b91505061154e565b60385460ff16156144655760405162461bcd60e51b815260040180806020018281038252603c815260200180615236603c913960400191505060405180910390fd5b604a5460ff166144bc576040805162461bcd60e51b815260206004820152601860248201527f436c61696d696e67206973206e6f7420656e61626c65642e0000000000000000604482015290519081900360640190fd5b600060425411614513576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e6720706572696f6420686173206e6f7420737461727465640000604482015290519081900360640190fd5b60455460ff16156145ed576000614529826141f1565b905080156145eb57603a5461454e906001600160a01b0316838363ffffffff61437d16565b6001600160a01b0382166000908152604c6020526040902054614577908263ffffffff61419716565b6001600160a01b0383166000908152604c60205260409020556052546145a3908263ffffffff61419716565b605255604080516001600160a01b03841681526020810183905281517f5b16e1043a283423361eb77682c99aff55948b34296846800a1a7dc9547a89fc929181900390910190a15b505b60006145f8826143d4565b9050801561475457605b546040805163b01ca88f60e01b81526001600160a01b0385811660048301526024820185905291516101009093049091169163b01ca88f9160448082019260009290919082900301818387803b15801561465b57600080fd5b505af115801561466f573d6000803e3d6000fd5b5050506001600160a01b0383166000908152604b602052604090205461469c91508263ffffffff61419716565b6001600160a01b0383166000908152604b60205260409020556051546146c8908263ffffffff61419716565b6051556050546146de908263ffffffff61432016565b6050557f5619b8583bbbb0760d27ac9ff844cec866b333bf7ad0262c2d809ff42f22e5fc828261470d82613017565b61471686613151565b61471f87613e62565b604080516001600160a01b03909616865260208601949094528484019290925260608401526080830152519081900360a00190a15b50603e546001600160a01b03909116600090815260576020526040902055565b60008261478357506000614191565b8282028284828161479057fe5b04146132c25760405162461bcd60e51b81526004018080602001828103825260218152602001806151426021913960400191505060405180910390fd5b6000808211614823576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161482e57fe5b04949350505050565b6001600160a01b03811660009081526056602052604090205461175c57603854604080516334c78ae560e11b81526001600160a01b038481166004830152915160009361010090049092169163698f15ca91602480820192602092909190829003018186803b1580156148a957600080fd5b505afa1580156148bd573d6000803e3d6000fd5b505050506040513d60208110156148d357600080fd5b5051111561175c57603854604080516334c78ae560e11b81526001600160a01b03848116600483015291516101009093049091169163ad6d15de91839163698f15ca91602480820192602092909190829003018186803b15801561493657600080fd5b505afa15801561494a573d6000803e3d6000fd5b505050506040513d602081101561496057600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b1580156149a057600080fd5b505af11580156149b4573d6000803e3d6000fd5b5050505050565b303b1590565b6000806149cd836133a0565b905060006149d9612eca565b603d54604080516315905ec160e31b8152620a69cb60eb1b600482015290519293506000926001600160a01b039092169163ac82f60891602480820192602092909190829003018186803b158015614a3057600080fd5b505afa158015614a44573d6000803e3d6000fd5b505050506040513d6020811015614a5a57600080fd5b505190506000614a68612e28565b6001600160a01b031663d37c4d8b876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200180631cd554d160e21b81525060200191505060206040518083038186803b158015614acc57600080fd5b505afa158015614ae0573d6000803e3d6000fd5b505050506040513d6020811015614af657600080fd5b5051905082841015614b3857614b31614b15848463ffffffff61477416565b611d70655af3107a4000612d3085818a8063ffffffff61477416565b9450614b59565b614b5682611d70655af3107a4000612d30878663ffffffff61477416565b94505b50505050919050565b6001600160a01b038116600090815260596020526040812054614b8c90600463ffffffff61419716565b603e54101561154e5760005b60048110156125c5576001600160a01b0383166000908152605a60205260409020614bca906004908382811061256257fe5b603e541015614bfd576001600160a01b0383166000908152605a60205260409020614bfa9082600481106125a857fe5b91505b600101614b98565b600060425411614c5c576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e6720706572696f6420686173206e6f7420737461727465640000604482015290519081900360640190fd5b60008311614ca2576040805162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b604482015290519081900360640190fd5b6001600160a01b03821660009081526054602052604090205460ff1615614cfa5760405162461bcd60e51b81526004018080602001828103825260408152602001806150d36040913960400191505060405180910390fd5b6000614d05836143d4565b1115614d1457614d1482614423565b603e546001600160a01b038316600090815260616020526040902055614d3982614837565b604d54614d4c908463ffffffff61419716565b604d556001600160a01b038216600090815260566020526040902054614d78908463ffffffff61419716565b6001600160a01b038084166000908152605660205260409020919091556039546143cf911682308663ffffffff614f6916565b614dbd826001600160a01b0316614fc3565b614e0e576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310614e4c5780518252601f199092019160209182019101614e2d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614eae576040519150601f19603f3d011682016040523d82523d6000602084013e614eb3565b606091505b509150915081614f0a576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115614f6357808060200190516020811015614f2657600080fd5b5051614f635760405162461bcd60e51b815260040180806020018281038252602a8152602001806152d1602a913960400191505060405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052614f63908590614dab565b3b151590565b50600080825560018201819055600282018190556003820181905560048201819055600582018190556006820181905560079091015556fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e657273686970416c726561647920696e697469616c697a65642c20757365206e6f6d696e6174654e65774f776e657243616e6e6f7420756e7374616b65207965742c20636f6f6c646f776e206e6f7420657870697265642e4163636f756e7420686173206e6f742074726967676572656420756e7374616b6520636f6f6c646f776e43616e6e6f74207374616b652c20746865207374616b6572206973207061757365642066726f6d207374616b696e672064756520746f20756e7374616b696e674f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564412066756c6c20706572696f6420686173206e6f74207061737365642073696e636520746865206c61737420636c6f73656420706572696f644163636f756e742068617320616c72656164792074726967676572656420756e7374616b6520636f6f6c646f776e43616e6e6f74206d657267652c2063616e63656c20756e7374616b696e67206f6e20626f7468206163636f756e7473206265666f7265206d657267696e675468697320616374696f6e2063616e6e6f7420626520706572666f726d6564207768696c652074686520636f6e7472616374206973207061757365644163636f756e7420646f65736e7420686176652074686174206d756368207374616b656443616e6e6f74206d657267652c20636c61696d2072657761726473206f6e20626f7468206163636f756e7473206265666f7265206d657267696e675361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158209b41a101e3971b1cbe47ed1b5026b7f03c34ccc9c633aa0dbb9401332f541f9964736f6c63430005100032

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