ETH Price: $3,072.37 (-1.53%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw Locked191667622024-02-06 4:16:35677 days ago1707192995IN
Frax Finance : USH Farm
0 ETH0.0043978717.47524668
Get Reward191031042024-01-28 5:59:11686 days ago1706421551IN
Frax Finance : USH Farm
0 ETH0.0025668311.9760652
Withdraw Locked184061482023-10-22 13:30:47784 days ago1697981447IN
Frax Finance : USH Farm
0 ETH0.001121287.70190519
Withdraw Locked184061202023-10-22 13:24:47784 days ago1697981087IN
Frax Finance : USH Farm
0 ETH0.000799246.66355812
Withdraw Locked184061182023-10-22 13:24:23784 days ago1697981063IN
Frax Finance : USH Farm
0 ETH0.0017776.87925973
Withdraw Locked182795872023-10-04 20:37:47802 days ago1696451867IN
Frax Finance : USH Farm
0 ETH0.0028761411.51935327
Withdraw Locked181404162023-09-15 8:25:11821 days ago1694766311IN
Frax Finance : USH Farm
0 ETH0.001442329.7362869
Get Reward181404112023-09-15 8:24:11821 days ago1694766251IN
Frax Finance : USH Farm
0 ETH0.0022065610.2951914
Withdraw Locked180450832023-09-01 23:50:23835 days ago1693612223IN
Frax Finance : USH Farm
0 ETH0.0015199110.26008741
Get Reward180450082023-09-01 23:35:23835 days ago1693611323IN
Frax Finance : USH Farm
0 ETH0.002210811.20926446
Withdraw Locked178023002023-07-30 0:33:59869 days ago1690677239IN
Frax Finance : USH Farm
0 ETH0.0027298316.76022951
Get Reward178022992023-07-30 0:33:47869 days ago1690677227IN
Frax Finance : USH Farm
0 ETH0.0034353917.4332512
Withdraw Locked177837882023-07-27 10:24:23871 days ago1690453463IN
Frax Finance : USH Farm
0 ETH0.005215520.72418207
Withdraw Locked177787522023-07-26 17:29:35872 days ago1690392575IN
Frax Finance : USH Farm
0 ETH0.0105813840.07509532
Withdraw Locked176989152023-07-15 12:55:11883 days ago1689425711IN
Frax Finance : USH Farm
0 ETH0.0032165613.71301497
Get Reward176010222023-07-01 18:36:47897 days ago1688236607IN
Frax Finance : USH Farm
0 ETH0.004393417.1676283
Withdraw Locked175629332023-06-26 10:13:11902 days ago1687774391IN
Frax Finance : USH Farm
0 ETH0.001977712.15694891
Withdraw Locked175606972023-06-26 2:40:11902 days ago1687747211IN
Frax Finance : USH Farm
0 ETH0.003065512.79986392
Withdraw Locked175504382023-06-24 16:02:11904 days ago1687622531IN
Frax Finance : USH Farm
0 ETH0.0074035128.83717528
Change Token Man...175232602023-06-20 20:24:47908 days ago1687292687IN
Frax Finance : USH Farm
0 ETH0.0009176930.94150712
Nominate New Own...175232572023-06-20 20:24:11908 days ago1687292651IN
Frax Finance : USH Farm
0 ETH0.0014855331.46649588
Withdraw Locked175159562023-06-19 19:47:11909 days ago1687204031IN
Frax Finance : USH Farm
0 ETH0.0048487232.7309171
Get Reward175159502023-06-19 19:45:59909 days ago1687203959IN
Frax Finance : USH Farm
0 ETH0.0059706529.53620943
Withdraw Locked174979692023-06-17 7:13:35911 days ago1686986015IN
Frax Finance : USH Farm
0 ETH0.0044500918.97184932
Withdraw Locked174661962023-06-12 19:59:23916 days ago1686599963IN
Frax Finance : USH Farm
0 ETH0.0032158716.94391653
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
USHFarm

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 10 : CommunalFarm.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;

// ====================================================================
// |     ______                   _______                             |
// |    / _____________ __  __   / ____(_____  ____ _____  ________   |
// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \/ __ `/ __ \/ ___/ _ \  |
// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |
// | /_/   /_/   \__,_/_/|_|  /_/   /_/_/ /_/\__,_/_/ /_/\___/\___/   |
// |                                                                  |
// ====================================================================
// =========================== CommunalFarm ===========================
// ====================================================================
// Multiple tokens with different reward rates can be emitted
// Multiple teams can set the reward rates for their token(s)
// Apes together strong

// Frax Finance: https://github.com/FraxFinance

// Primary Author(s)
// Travis Moore: https://github.com/FortisFortuna

// Reviewer(s) / Contributor(s)
// Jason Huan: https://github.com/jasonhuan 
// Sam Kazemian: https://github.com/samkazemian
// Saddle Team: https://github.com/saddle-finance
// Fei Team: https://github.com/fei-protocol
// Alchemix Team: https://github.com/alchemix-finance
// Liquity Team: https://github.com/liquity

// Originally inspired by Synthetix.io, but heavily modified by the Frax team
// https://raw.githubusercontent.com/Synthetixio/synthetix/develop/contracts/StakingRewards.sol

import "communal/Math.sol";
import "communal/SafeMath.sol";
import "communal/SafeERC20.sol";
import 'communal/TransferHelper.sol';
import "communal/ReentrancyGuard.sol";

// Inheritance
import "communal/Owned.sol";

contract USHFarm is Owned, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

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

    // Instances
    IERC20 public stakingToken;
    
    // Constant for various precisions
    uint256 private constant MULTIPLIER_PRECISION = 1e18;

    // Time tracking
    uint256 public periodFinish;
    uint256 public lastUpdateTime;

    // Lock time and multiplier settings
    uint256 public lock_max_multiplier = uint256(3e18); // E18. 1x = e18
    uint256 public lock_time_for_max_multiplier = 1 * 60 * 86400; // 1 year
    uint256 public lock_time_min = 86400; // 1 * 86400  (1 day)

    // Reward addresses, rates, and managers
    mapping(address => address) public rewardManagers; // token addr -> manager addr
    address[] public rewardTokens;
    uint256[] public rewardRates;
    string[] public rewardSymbols;
    mapping(address => uint256) public rewardTokenAddrToIdx; // token addr -> token index
    
    // Reward period
    uint256 public rewardsDuration = 604800; // 7 * 86400  (7 days)

    // Reward tracking
    uint256[] private rewardsPerTokenStored;
    mapping(address => mapping(uint256 => uint256)) private userRewardsPerTokenPaid; // staker addr -> token id -> paid amount
    mapping(address => mapping(uint256 => uint256)) private rewards; // staker addr -> token id -> reward amount
    mapping(address => uint256) private lastRewardClaimTime; // staker addr -> timestamp

    // Balance tracking
    uint256 private _total_liquidity_locked;
    uint256 private _total_combined_weight;
    mapping(address => uint256) private _locked_liquidity;
    mapping(address => uint256) private _combined_weights;

    // Stake tracking
    mapping(address => LockedStake[]) private lockedStakes;

    // Greylisting of bad addresses
    mapping(address => bool) public greylist; //how long until this one is offensive too?

    // Administrative booleans
    bool public stakesUnlocked; // Release locked stakes in case of emergency
    bool public withdrawalsPaused; // For emergencies
    bool public rewardsCollectionPaused; // For emergencies
    bool public stakingPaused; // For emergencies

    /* ========== STRUCTS ========== */
    
    struct LockedStake {
        bytes32 kek_id;
        uint256 start_timestamp;
        uint256 liquidity;
        uint256 ending_timestamp;
        uint256 lock_multiplier; // 6 decimals of precision. 1x = 1000000
    }

    /* ========== MODIFIERS ========== */

    modifier onlyByOwner() {
        require(msg.sender == owner, "Not the owner");
        _;
    }

    modifier onlyTknMgrs(address reward_token_address) {
        require(msg.sender == owner || isTokenManagerFor(msg.sender, reward_token_address), "Not owner or tkn mgr");
        _;
    }

    modifier notStakingPaused() {
        require(stakingPaused == false, "Staking paused");
        _;
    }

    modifier updateRewardAndBalance(address account, bool sync_too) {
        _updateRewardAndBalance(account, sync_too);
        _;
    }
    
    /* ========== CONSTRUCTOR ========== */

    constructor (
        address _owner,
        address _stakingToken,
        string[] memory _rewardSymbols,
        address[] memory _rewardTokens,
        address[] memory _rewardManagers,
        uint256[] memory _rewardRates
    ) Owned(_owner){
        stakingToken = IERC20(_stakingToken);

        rewardTokens = _rewardTokens;
        rewardRates = _rewardRates;
        rewardSymbols = _rewardSymbols;

        for (uint256 i = 0; i < _rewardTokens.length; i++){ 
            // For fast token address -> token ID lookups later
            rewardTokenAddrToIdx[_rewardTokens[i]] = i;

            // Initialize the stored rewards
            rewardsPerTokenStored.push(0);

            // Initialize the reward managers
            rewardManagers[_rewardTokens[i]] = _rewardManagers[i];
        }

        // Other booleans
        stakesUnlocked = false;

        // Initialization
        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(rewardsDuration);
    }

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

    // Total locked liquidity tokens
    function totalLiquidityLocked() external view returns (uint256) {
        return _total_liquidity_locked;
    }

    // Locked liquidity for a given account
    function lockedLiquidityOf(address account) external view returns (uint256) {
        return _locked_liquidity[account];
    }

    // Total 'balance' used for calculating the percent of the pool the account owns
    // Takes into account the locked stake time multiplier
    function totalCombinedWeight() external view returns (uint256) {
        return _total_combined_weight;
    }

    // Combined weight for a specific account
    function combinedWeightOf(address account) external view returns (uint256) {
        return _combined_weights[account];
    }

    // Calculated the combined weight for an account
    function calcCurCombinedWeight(address account) public view
        returns (
            uint256 old_combined_weight,
            uint256 new_combined_weight
        )
    {
        // Get the old combined weight
        old_combined_weight = _combined_weights[account];

        // Loop through the locked stakes, first by getting the liquidity * lock_multiplier portion
        new_combined_weight = 0;
        for (uint256 i = 0; i < lockedStakes[account].length; i++) {
            LockedStake memory thisStake = lockedStakes[account][i];
            uint256 lock_multiplier = thisStake.lock_multiplier;

            // If the lock is expired
            if (thisStake.ending_timestamp <= block.timestamp) {
                // If the lock expired in the time since the last claim, the weight needs to be proportionately averaged this time
                if (lastRewardClaimTime[account] < thisStake.ending_timestamp){
                    uint256 time_before_expiry = (thisStake.ending_timestamp).sub(lastRewardClaimTime[account]);
                    uint256 time_after_expiry = (block.timestamp).sub(thisStake.ending_timestamp);

                    // Get the weighted-average lock_multiplier
                    uint256 numerator = ((lock_multiplier).mul(time_before_expiry)).add(((MULTIPLIER_PRECISION).mul(time_after_expiry)));
                    lock_multiplier = numerator.div(time_before_expiry.add(time_after_expiry));
                }
                // Otherwise, it needs to just be 1x
                else {
                    lock_multiplier = MULTIPLIER_PRECISION;
                }
            }

            uint256 liquidity = thisStake.liquidity;
            uint256 combined_boosted_amount = liquidity.mul(lock_multiplier).div(MULTIPLIER_PRECISION);
            new_combined_weight = new_combined_weight.add(combined_boosted_amount);
        }
    }

    // All the locked stakes for a given account
    function lockedStakesOf(address account) external view returns (LockedStake[] memory) {
        return lockedStakes[account];
    }

    // All the locked stakes for a given account
    function getRewardSymbols() external view returns (string[] memory) {
        return rewardSymbols;
    }

    // All the reward tokens
    function getAllRewardTokens() external view returns (address[] memory) {
        return rewardTokens;
    }

    // All the reward rates
    function getAllRewardRates() external view returns (uint256[] memory) {
        return rewardRates;
    }
    
    // Multiplier amount, given the length of the lock
    function lockMultiplier(uint256 secs) public view returns (uint256) {
        uint256 lock_multiplier =
            uint256(MULTIPLIER_PRECISION).add(
                secs
                    .mul(lock_max_multiplier.sub(MULTIPLIER_PRECISION))
                    .div(lock_time_for_max_multiplier)
            );
        if (lock_multiplier > lock_max_multiplier) lock_multiplier = lock_max_multiplier;
        return lock_multiplier;
    }

    // Last time the reward was applicable
    function lastTimeRewardApplicable() internal view returns (uint256) {
        return Math.min(block.timestamp, periodFinish);
    }

    // Amount of reward tokens per LP token
    function rewardsPerToken() public view returns (uint256[] memory newRewardsPerTokenStored) {
        if (_total_liquidity_locked == 0 || _total_combined_weight == 0) {
            return rewardsPerTokenStored;
        }
        else {
            newRewardsPerTokenStored = new uint256[](rewardTokens.length);
            for (uint256 i = 0; i < rewardsPerTokenStored.length; i++){ 
                newRewardsPerTokenStored[i] = rewardsPerTokenStored[i].add(
                    lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRates[i]).mul(1e18).div(_total_combined_weight)
                );
            }
            return newRewardsPerTokenStored;
        }
    }

    // Amount of reward tokens an account has earned / accrued
    // Note: In the edge-case of one of the account's stake expiring since the last claim, this will
    // return a slightly inflated number
    function earned(address account) public view returns (uint256[] memory new_earned) {
        uint256[] memory reward_arr = rewardsPerToken();
        new_earned = new uint256[](rewardTokens.length);

        if (_combined_weights[account] == 0){
            for (uint256 i = 0; i < rewardTokens.length; i++){ 
                new_earned[i] = 0;
            }
        }
        else {
            for (uint256 i = 0; i < rewardTokens.length; i++){ 
                new_earned[i] = (_combined_weights[account])
                    .mul(reward_arr[i].sub(userRewardsPerTokenPaid[account][i]))
                    .div(1e18)
                    .add(rewards[account][i]);
            }
        }
    }

    // Total reward tokens emitted in the given period
    function getRewardForDuration() external view returns (uint256[] memory rewards_per_duration_arr) {
        rewards_per_duration_arr = new uint256[](rewardRates.length);

        for (uint256 i = 0; i < rewardRates.length; i++){ 
            rewards_per_duration_arr[i] = rewardRates[i].mul(rewardsDuration);
        }
    }

    // See if the caller_addr is a manager for the reward token 
    function isTokenManagerFor(address caller_addr, address reward_token_addr) public view returns (bool){
        if (caller_addr == owner) return true; // Contract owner
        else if (rewardManagers[reward_token_addr] == caller_addr) return true; // Reward manager
        return false; 
    }

    /* ========== MUTATIVE FUNCTIONS ========== */

    function _updateRewardAndBalance(address account, bool sync_too) internal {
        // Need to retro-adjust some things if the period hasn't been renewed, then start a new one
        if (sync_too){
            sync();
        }
        
        if (account != address(0)) {
            // To keep the math correct, the user's combined weight must be recomputed
            (   
                uint256 old_combined_weight,
                uint256 new_combined_weight
            ) = calcCurCombinedWeight(account);

            // Calculate the earnings first
            _syncEarned(account);

            // Update the user's and the global combined weights
            if (new_combined_weight >= old_combined_weight) {
                uint256 weight_diff = new_combined_weight.sub(old_combined_weight);
                _total_combined_weight = _total_combined_weight.add(weight_diff);
                _combined_weights[account] = old_combined_weight.add(weight_diff);
            } else {
                uint256 weight_diff = old_combined_weight.sub(new_combined_weight);
                _total_combined_weight = _total_combined_weight.sub(weight_diff);
                _combined_weights[account] = old_combined_weight.sub(weight_diff);
            }

        }
    }

    function _syncEarned(address account) internal {
        if (account != address(0)) {
            // Calculate the earnings
            uint256[] memory earned_arr = earned(account);

            // Update the rewards array
            for (uint256 i = 0; i < earned_arr.length; i++){ 
                rewards[account][i] = earned_arr[i];
            }

            // Update the rewards paid array
            for (uint256 i = 0; i < earned_arr.length; i++){ 
                userRewardsPerTokenPaid[account][i] = rewardsPerTokenStored[i];
            }
        }
    }

    // Two different stake functions are needed because of delegateCall and msg.sender issues
    function stakeLocked(uint256 liquidity, uint256 secs) nonReentrant public {
        _stakeLocked(msg.sender, msg.sender, liquidity, secs, block.timestamp);
    }

    // If this were not internal, and source_address had an infinite approve, this could be exploitable
    // (pull funds from source_address and stake for an arbitrary staker_address)
    function _stakeLocked(
        address staker_address, 
        address source_address, 
        uint256 liquidity, 
        uint256 secs,
        uint256 start_timestamp
    ) internal updateRewardAndBalance(staker_address, true) {
        require(!stakingPaused, "Staking paused");
        require(liquidity > 0, "Must stake more than zero");
        require(greylist[staker_address] == false, "Address has been greylisted");
        require(secs >= lock_time_min, "Minimum stake time not met");
        require(secs <= lock_time_for_max_multiplier,"Trying to lock for too long");

        uint256 lock_multiplier = lockMultiplier(secs);
        bytes32 kek_id = keccak256(abi.encodePacked(staker_address, start_timestamp, liquidity, _locked_liquidity[staker_address]));
        lockedStakes[staker_address].push(LockedStake(
            kek_id,
            start_timestamp,
            liquidity,
            start_timestamp.add(secs),
            lock_multiplier
        ));

        // Pull the tokens from the source_address
        //TODO: do we even need this if we're dealing with Sushi LP not saddle?
        TransferHelper.safeTransferFrom(address(stakingToken), source_address, address(this), liquidity);

        // Update liquidities
        _total_liquidity_locked = _total_liquidity_locked.add(liquidity);
        _locked_liquidity[staker_address] = _locked_liquidity[staker_address].add(liquidity);

        // Need to call to update the combined weights
        _updateRewardAndBalance(staker_address, false);

        // Needed for edge case if the staker only claims once, and after the lock expired
        if (lastRewardClaimTime[staker_address] == 0) lastRewardClaimTime[staker_address] = block.timestamp;

        emit StakeLocked(staker_address, liquidity, secs, kek_id, source_address);
    }

    // Two different withdrawLocked functions are needed because of delegateCall and msg.sender issues
    function withdrawLocked(bytes32 kek_id) nonReentrant public {
        require(withdrawalsPaused == false, "Withdrawals paused");
        _withdrawLocked(msg.sender, msg.sender, kek_id);
    }

    // No withdrawer == msg.sender check needed since this is only internally callable and the checks are done in the wrapper
    // functions like withdraw()
    function _withdrawLocked(address staker_address, address destination_address, bytes32 kek_id) internal  {
        // Collect rewards first and then update the balances
        _getReward(staker_address, destination_address);

        LockedStake memory thisStake;
        thisStake.liquidity = 0;
        uint theArrayIndex;
        for (uint256 i = 0; i < lockedStakes[staker_address].length; i++){ 
            if (kek_id == lockedStakes[staker_address][i].kek_id){
                thisStake = lockedStakes[staker_address][i];
                theArrayIndex = i;
                break;
            }
        }
        require(thisStake.kek_id == kek_id, "Stake not found");
        require(block.timestamp >= thisStake.ending_timestamp || stakesUnlocked == true, "Stake is still locked!");

        uint256 liquidity = thisStake.liquidity;

        if (liquidity > 0) {
            // Update liquidities
            _total_liquidity_locked = _total_liquidity_locked.sub(liquidity);
            _locked_liquidity[staker_address] = _locked_liquidity[staker_address].sub(liquidity);

            // Remove the stake from the array
            delete lockedStakes[staker_address][theArrayIndex];

            // Need to call to update the combined weights
            _updateRewardAndBalance(staker_address, false);

            // Give the tokens to the destination_address
            // Should throw if insufficient balance
            stakingToken.transfer(destination_address, liquidity);

            emit WithdrawLocked(staker_address, liquidity, kek_id, destination_address);
        }

    }
    
    // Two different getReward functions are needed because of delegateCall and msg.sender issues
    function getReward() external nonReentrant returns (uint256[] memory) {
        require(rewardsCollectionPaused == false,"Rewards collection paused");
        return _getReward(msg.sender, msg.sender);
    }

    // No withdrawer == msg.sender check needed since this is only internally callable
    function _getReward(address rewardee, address destination_address) internal updateRewardAndBalance(rewardee, true) returns (uint256[] memory rewards_before) {
        // Update the rewards array and distribute rewards
        rewards_before = new uint256[](rewardTokens.length);

        for (uint256 i = 0; i < rewardTokens.length; i++){ 
            rewards_before[i] = rewards[rewardee][i];
            rewards[rewardee][i] = 0;
            //use SafeERC20.transfer
            IERC20(rewardTokens[i]).transfer(destination_address, rewards_before[i]);
            emit RewardPaid(rewardee, rewards_before[i], rewardTokens[i], destination_address);
        }

        lastRewardClaimTime[rewardee] = block.timestamp;
    }

    // If the period expired, renew it
    function retroCatchUp() internal {
        // Failsafe check
        require(block.timestamp > periodFinish, "Period has not expired yet!");

        // Ensure the provided reward amount is not more than the balance in the contract.
        // This keeps the reward rate in the right range, preventing overflows due to
        // very high values of rewardRate in the earned and rewardsPerToken functions;
        // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.
        uint256 num_periods_elapsed = uint256(block.timestamp.sub(periodFinish)) / rewardsDuration; // Floor division to the nearest period
        
        // Make sure there are enough tokens to renew the reward period
        for (uint256 i = 0; i < rewardTokens.length; i++){ 
            require(rewardRates[i].mul(rewardsDuration).mul(num_periods_elapsed + 1) <= IERC20(rewardTokens[i]).balanceOf(address(this)), string(abi.encodePacked("Not enough reward tokens available: ", rewardTokens[i])) );
        }
        
        // uint256 old_lastUpdateTime = lastUpdateTime;
        // uint256 new_lastUpdateTime = block.timestamp;

        // lastUpdateTime = periodFinish;
        periodFinish = periodFinish.add((num_periods_elapsed.add(1)).mul(rewardsDuration));

        _updateStoredRewardsAndTime();

        emit RewardsPeriodRenewed(address(stakingToken));
    }

    function _updateStoredRewardsAndTime() internal {
        // Get the rewards
        uint256[] memory rewards_per_token = rewardsPerToken();

        // Update the rewardsPerTokenStored
        for (uint256 i = 0; i < rewardsPerTokenStored.length; i++){ 
            rewardsPerTokenStored[i] = rewards_per_token[i];
        }

        // Update the last stored time
        lastUpdateTime = lastTimeRewardApplicable();
    }

    function sync() public {
        if (block.timestamp > periodFinish) {
            retroCatchUp();
        }
        else {
            _updateStoredRewardsAndTime();
        }
    }

    /* ========== RESTRICTED FUNCTIONS ========== */

    // Added to support recovering LP Rewards and other mistaken tokens from other systems to be distributed to holders
    function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyTknMgrs(tokenAddress) {
        // Cannot rug the staking / LP tokens
        require(tokenAddress != address(stakingToken), "Cannot rug staking / LP tokens");

        // Check if the desired token is a reward token
        bool isRewardToken = false;
        for (uint256 i = 0; i < rewardTokens.length; i++){ 
            if (rewardTokens[i] == tokenAddress) {
                isRewardToken = true;
                break;
            }
        }

        // Only the reward managers can take back their reward tokens
        if (isRewardToken && rewardManagers[tokenAddress] == msg.sender){
            IERC20(tokenAddress).transfer(msg.sender, tokenAmount);
            emit Recovered(msg.sender, tokenAddress, tokenAmount);
            return;
        }

        // Other tokens, like airdrops or accidental deposits, can be withdrawn by the owner
        else if (!isRewardToken && (msg.sender == owner)){
            IERC20(tokenAddress).transfer(msg.sender, tokenAmount);
            emit Recovered(msg.sender, tokenAddress, tokenAmount);
            return;
        }

        // If none of the above conditions are true
        else {
            revert("No valid tokens to recover");
        }
    }

    function setRewardsDuration(uint256 _rewardsDuration) external onlyByOwner {
        require(_rewardsDuration >= 86400, "Rewards duration too short");
        require(
            periodFinish == 0 || block.timestamp > periodFinish,
            "Reward period incomplete"
        );
        rewardsDuration = _rewardsDuration;
        emit RewardsDurationUpdated(rewardsDuration);
    }

    function setMultipliers(uint256 _lock_max_multiplier) external onlyByOwner {
        require(_lock_max_multiplier >= uint256(1e18), "Multiplier must be greater than or equal to 1e18");
        lock_max_multiplier = _lock_max_multiplier;
        emit LockedStakeMaxMultiplierUpdated(lock_max_multiplier);
    }

    function setLockedStakeTimeForMinAndMaxMultiplier(uint256 _lock_time_for_max_multiplier, uint256 _lock_time_min) external onlyByOwner {
        require(_lock_time_for_max_multiplier >= 1, "Mul max time must be >= 1");
        require(_lock_time_min >= 1, "Mul min time must be >= 1");

        lock_time_for_max_multiplier = _lock_time_for_max_multiplier;
        lock_time_min = _lock_time_min;

        emit LockedStakeTimeForMaxMultiplier(lock_time_for_max_multiplier);
        emit LockedStakeMinTime(_lock_time_min);
    }

    function greylistAddress(address _address) external onlyByOwner {
        greylist[_address] = !(greylist[_address]);
    }

    function unlockStakes() external onlyByOwner {
        stakesUnlocked = !stakesUnlocked;
    }

    function toggleStaking() external onlyByOwner {
        stakingPaused = !stakingPaused;
    }

    function toggleWithdrawals() external onlyByOwner {
        withdrawalsPaused = !withdrawalsPaused;
    }

    function toggleRewardsCollection() external onlyByOwner {
        rewardsCollectionPaused = !rewardsCollectionPaused;
    }

    // The owner or the reward token managers can set reward rates 
    function setRewardRate(address reward_token_address, uint256 new_rate, bool sync_too) external onlyTknMgrs(reward_token_address) {
        rewardRates[rewardTokenAddrToIdx[reward_token_address]] = new_rate;
        
        if (sync_too){
            sync();
        }
    }

    // The owner or the reward token managers can change managers
    function changeTokenManager(address reward_token_address, address new_manager_address) external onlyTknMgrs(reward_token_address) {
        rewardManagers[reward_token_address] = new_manager_address;
    }

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

    event StakeLocked(address indexed user, uint256 amount, uint256 secs, bytes32 kek_id, address source_address);
    event WithdrawLocked(address indexed user, uint256 amount, bytes32 kek_id, address destination_address);
    event RewardPaid(address indexed user, uint256 reward, address token_address, address destination_address);
    event RewardsDurationUpdated(uint256 newDuration);
    event Recovered(address destination_address, address token, uint256 amount);
    event RewardsPeriodRenewed(address token);
    event LockedStakeMaxMultiplierUpdated(uint256 multiplier);
    event LockedStakeTimeForMaxMultiplier(uint256 secs);
    event LockedStakeMinTime(uint256 secs);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11 <0.9.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;

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

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;

import "./Context.sol";
import "./SafeMath.sol";

/**
 * @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.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

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

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

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

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }

    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.11;

// https://docs.synthetix.io/contracts/Owned
contract Owned {
    address public owner;
    address public nominatedOwner;

    constructor (address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        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);
    }

    modifier onlyOwner {
        require(msg.sender == owner, "Only the contract owner may perform this action");
        _;
    }

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

File 7 of 10 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied 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.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     *
     * _Available since v2.4.0._
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        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-contracts/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) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message 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.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        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) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address token, address from, address to, uint value) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

Settings
{
  "remappings": [
    "@prb/math/=lib/prb-math/src/",
    "@prb/test/=lib/prb-math/lib/prb-test/src/",
    "communal/=lib/communal/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "local/=src/",
    "openzeppelin/=lib/openzeppelin/",
    "prb-math/=lib/prb-math/src/",
    "prb-test/=lib/prb-math/lib/prb-test/src/",
    "src/=lib/prb-math/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"string[]","name":"_rewardSymbols","type":"string[]"},{"internalType":"address[]","name":"_rewardTokens","type":"address[]"},{"internalType":"address[]","name":"_rewardManagers","type":"address[]"},{"internalType":"uint256[]","name":"_rewardRates","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"multiplier","type":"uint256"}],"name":"LockedStakeMaxMultiplierUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"secs","type":"uint256"}],"name":"LockedStakeMinTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"secs","type":"uint256"}],"name":"LockedStakeTimeForMaxMultiplier","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":"address","name":"destination_address","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"address","name":"token_address","type":"address"},{"indexed":false,"internalType":"address","name":"destination_address","type":"address"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"RewardsDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"RewardsPeriodRenewed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"secs","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"kek_id","type":"bytes32"},{"indexed":false,"internalType":"address","name":"source_address","type":"address"}],"name":"StakeLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"kek_id","type":"bytes32"},{"indexed":false,"internalType":"address","name":"destination_address","type":"address"}],"name":"WithdrawLocked","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"calcCurCombinedWeight","outputs":[{"internalType":"uint256","name":"old_combined_weight","type":"uint256"},{"internalType":"uint256","name":"new_combined_weight","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"reward_token_address","type":"address"},{"internalType":"address","name":"new_manager_address","type":"address"}],"name":"changeTokenManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"combinedWeightOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256[]","name":"new_earned","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllRewardRates","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReward","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getRewardForDuration","outputs":[{"internalType":"uint256[]","name":"rewards_per_duration_arr","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardSymbols","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"greylist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"greylistAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"caller_addr","type":"address"},{"internalType":"address","name":"reward_token_addr","type":"address"}],"name":"isTokenManagerFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"secs","type":"uint256"}],"name":"lockMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lock_max_multiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lock_time_for_max_multiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lock_time_min","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"lockedLiquidityOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"lockedStakesOf","outputs":[{"components":[{"internalType":"bytes32","name":"kek_id","type":"bytes32"},{"internalType":"uint256","name":"start_timestamp","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"ending_timestamp","type":"uint256"},{"internalType":"uint256","name":"lock_multiplier","type":"uint256"}],"internalType":"struct USHFarm.LockedStake[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardManagers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardSymbols","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardTokenAddrToIdx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsCollectionPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerToken","outputs":[{"internalType":"uint256[]","name":"newRewardsPerTokenStored","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lock_time_for_max_multiplier","type":"uint256"},{"internalType":"uint256","name":"_lock_time_min","type":"uint256"}],"name":"setLockedStakeTimeForMinAndMaxMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lock_max_multiplier","type":"uint256"}],"name":"setMultipliers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"reward_token_address","type":"address"},{"internalType":"uint256","name":"new_rate","type":"uint256"},{"internalType":"bool","name":"sync_too","type":"bool"}],"name":"setRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsDuration","type":"uint256"}],"name":"setRewardsDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"secs","type":"uint256"}],"name":"stakeLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakesUnlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sync","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleRewardsCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalCombinedWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLiquidityLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unlockStakes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"kek_id","type":"bytes32"}],"name":"withdrawLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalsPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60806040526729a2241af62c0000600655624f1a006007556201518060085562093a80600e553480156200003257600080fd5b5060405162003a7e38038062003a7e8339810160408190526200005591620007aa565b856001600160a01b038116620000b25760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b03831690811782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1506001600255600380546001600160a01b0319166001600160a01b03871617905582516200013f90600a9060208601906200032c565b5080516200015590600b90602084019062000396565b5083516200016b90600c906020870190620003d4565b5060005b8351811015620002865780600d600086848151811062000193576200019362000888565b6020908102919091018101516001600160a01b03168252810191909152604001600090812091909155600f80546001810182559082527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020155825183908290811062000203576200020362000888565b60200260200101516009600086848151811062000224576200022462000888565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080806200027d90620008b4565b9150506200016f565b506019805460ff19169055426005819055600e54620002b29190620002c2602090811b62001b4017901c565b6004555062000927945050505050565b600080620002d18385620008d0565b905083811015620003255760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401620000a9565b9392505050565b82805482825590600052602060002090810192821562000384579160200282015b828111156200038457825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200034d565b506200039292915062000434565b5090565b82805482825590600052602060002090810192821562000384579160200282015b8281111562000384578251825591602001919060010190620003b7565b82805482825590600052602060002090810192821562000426579160200282015b82811115620004265782518051620004159184916020909101906200044b565b5091602001919060010190620003f5565b5062000392929150620004c7565b5b8082111562000392576000815560010162000435565b8280546200045990620008eb565b90600052602060002090601f0160209004810192826200047d576000855562000384565b82601f106200049857805160ff191683800117855562000384565b8280016001018555821562000384579182018281111562000384578251825591602001919060010190620003b7565b8082111562000392576000620004de8282620004e8565b50600101620004c7565b508054620004f690620008eb565b6000825580601f1062000507575050565b601f01602090049060005260206000209081019062000527919062000434565b50565b80516001600160a01b03811681146200054257600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171562000588576200058862000547565b604052919050565b60006001600160401b03821115620005ac57620005ac62000547565b5060051b60200190565b6000601f8381840112620005c957600080fd5b82516020620005e2620005dc8362000590565b6200055d565b82815260059290921b850181019181810190878411156200060257600080fd5b8287015b84811015620006c65780516001600160401b0380821115620006285760008081fd5b818a0191508a603f8301126200063e5760008081fd5b858201518181111562000655576200065562000547565b62000668818a01601f191688016200055d565b915080825260408c81838601011115620006825760008081fd5b60005b82811015620006a2578481018201518482018a0152880162000685565b82811115620006b45760008984860101525b50505084525091830191830162000606565b50979650505050505050565b600082601f830112620006e457600080fd5b81516020620006f7620005dc8362000590565b82815260059290921b840181019181810190868411156200071757600080fd5b8286015b848110156200073d576200072f816200052a565b83529183019183016200071b565b509695505050505050565b600082601f8301126200075a57600080fd5b815160206200076d620005dc8362000590565b82815260059290921b840181019181810190868411156200078d57600080fd5b8286015b848110156200073d578051835291830191830162000791565b60008060008060008060c08789031215620007c457600080fd5b620007cf876200052a565b9550620007df602088016200052a565b60408801519095506001600160401b0380821115620007fd57600080fd5b6200080b8a838b01620005b6565b955060608901519150808211156200082257600080fd5b620008308a838b01620006d2565b945060808901519150808211156200084757600080fd5b620008558a838b01620006d2565b935060a08901519150808211156200086c57600080fd5b506200087b89828a0162000748565b9150509295509295509295565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201620008c957620008c96200089e565b5060010190565b60008219821115620008e657620008e66200089e565b500190565b600181811c908216806200090057607f821691505b6020821081036200092157634e487b7160e01b600052602260045260246000fd5b50919050565b61314780620009376000396000f3fe608060405234801561001057600080fd5b50600436106102d55760003560e01c806372f702f311610182578063c8f33c91116100e9578063e01f62bf116100a2578063ebe2b12b1161007c578063ebe2b12b1461067e578063f2caeb1e14610687578063f43155531461069a578063fff6cae9146106a257600080fd5b8063e01f62bf1461065c578063e1ba95d214610664578063e9f2838e1461066c57600080fd5b8063c8f33c91146105f3578063cc1a378f146105fc578063cdc82e801461060f578063d239f00314610618578063d9f96e8d14610620578063de1a65511461064957600080fd5b80638da5cb5b1161013b5780638da5cb5b14610590578063941d9f65146105a35780639637927f146105b6578063af00f4e2146105c3578063b94c4dcb146105d6578063bbb781cc146105df57600080fd5b806372f702f31461051f57806379ba5097146105325780637b31c19a1461053a5780637bb7bed1146105425780638980f11f146105555780638bad86a71461056857600080fd5b806336f89af21161024157806351e3fc17116101fa57806366e9e9b3116101d457806366e9e9b3146104d957806369339245146104ee5780636e27cef91461050e57806370641a361461051757600080fd5b806351e3fc17146104ab57806353a47bb7146104be57806364f2c060146104d157600080fd5b806336f89af214610415578063386a95251461043e5780633b8105b3146104475780633d18b9121461044f57806341a16f3f1461045757806347b9bc221461049857600080fd5b80631e090f01116102935780631e090f01146103695780631e368980146103895780631f5848de146103a9578063231b68dc146103bc57806331ca208c146103df578063323331ca1461040257600080fd5b80628cc262146102da5780630d7bac4f1461030357806312edb24c146103245780631627540c1461033957806317b18c891461034e5780631c1f78eb14610361575b600080fd5b6102ed6102e8366004612c73565b6106aa565b6040516102fa9190612c8e565b60405180910390f35b610316610311366004612cd2565b61084f565b6040519081526020016102fa565b61032c6108a8565b6040516102fa9190612ceb565b61034c610347366004612c73565b61090a565b005b61034c61035c366004612d2c565b6109d6565b6102ed610a11565b61037c610377366004612c73565b610acd565b6040516102fa9190612d4e565b61039c610397366004612cd2565b610b74565b6040516102fa9190612e14565b61034c6103b7366004612e35565b610c20565b6103cf6103ca366004612e75565b610caa565b60405190151581526020016102fa565b6103cf6103ed366004612c73565b60186020526000908152604090205460ff1681565b6019546103cf9062010000900460ff1681565b610316610423366004612c73565b6001600160a01b031660009081526016602052604090205490565b610316600e5481565b61034c610cfe565b6102ed610d49565b610480610465366004612c73565b6009602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102fa565b61034c6104a6366004612cd2565b610ddd565b61034c6104b9366004612cd2565b610ead565b600154610480906001600160a01b031681565b601454610316565b6104e1610f32565b6040516102fa9190612ea8565b6103166104fc366004612c73565b600d6020526000908152604090205481565b61031660085481565b6102ed61100b565b600354610480906001600160a01b031681565b61034c611177565b61034c611261565b610480610550366004612cd2565b6112aa565b61034c610563366004612f0a565b6112d4565b61057b610576366004612c73565b611559565b604080519283526020830191909152016102fa565b600054610480906001600160a01b031681565b61034c6105b1366004612c73565b61171c565b6019546103cf9060ff1681565b61034c6105d1366004612d2c565b61176f565b61031660075481565b6019546103cf906301000000900460ff1681565b61031660055481565b61034c61060a366004612cd2565b6118af565b61031660065481565b61034c6119bd565b61031661062e366004612c73565b6001600160a01b031660009081526015602052604090205490565b61034c610657366004612e75565b611a04565b601354610316565b61034c611a6f565b6019546103cf90610100900460ff1681565b61031660045481565b610316610695366004612cd2565b611aad565b6102ed611ace565b61034c611b24565b606060006106b661100b565b600a5490915067ffffffffffffffff8111156106d4576106d4612f34565b6040519080825280602002602001820160405280156106fd578160200160208202803683370190505b506001600160a01b038416600090815260166020526040812054919350036107635760005b600a5481101561075d57600083828151811061074057610740612f4a565b60209081029190910101528061075581612f76565b915050610722565b50610849565b60005b600a54811015610847576001600160a01b0384166000818152601160209081526040808320858452825280832054938352601082528083208584529091529020548351610818929161081291670de0b6b3a76400009161080c916107ed91908990899081106107d7576107d7612f4a565b6020026020010151611ba690919063ffffffff16565b6001600160a01b038a1660009081526016602052604090205490611be8565b90611c6a565b90611b40565b83828151811061082a5761082a612f4a565b60209081029190910101528061083f81612f76565b915050610766565b505b50919050565b60008061089161088260075461080c61087b670de0b6b3a7640000600654611ba690919063ffffffff16565b8790611be8565b670de0b6b3a764000090611b40565b90506006548111156108a257506006545b92915050565b6060600a80548060200260200160405190810160405280929190818152602001828054801561090057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116108e2575b5050505050905090565b6000546001600160a01b031633146109815760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b60648201526084015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b60028054036109f75760405162461bcd60e51b815260040161097890612f8f565b60028055610a083380848442611cac565b50506001600255565b600b5460609067ffffffffffffffff811115610a2f57610a2f612f34565b604051908082528060200260200182016040528015610a58578160200160208202803683370190505b50905060005b600b54811015610ac957610a9a600e54600b8381548110610a8157610a81612f4a565b9060005260206000200154611be890919063ffffffff16565b828281518110610aac57610aac612f4a565b602090810291909101015280610ac181612f76565b915050610a5e565b5090565b6001600160a01b0381166000908152601760209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610b6957838290600052602060002090600502016040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505081526020019060010190610b05565b505050509050919050565b600c8181548110610b8457600080fd5b906000526020600020016000915090508054610b9f90612fc6565b80601f0160208091040260200160405190810160405280929190818152602001828054610bcb90612fc6565b8015610c185780601f10610bed57610100808354040283529160200191610c18565b820191906000526020600020905b815481529060010190602001808311610bfb57829003601f168201915b505050505081565b60005483906001600160a01b0316331480610c405750610c403382610caa565b610c5c5760405162461bcd60e51b815260040161097890612ffa565b6001600160a01b0384166000908152600d6020526040902054600b80548592908110610c8a57610c8a612f4a565b6000918252602090912001558115610ca457610ca4611b24565b50505050565b600080546001600160a01b0390811690841603610cc9575060016108a2565b6001600160a01b03828116600090815260096020526040902054818516911603610cf5575060016108a2565b50600092915050565b6000546001600160a01b03163314610d285760405162461bcd60e51b815260040161097890613028565b6019805463ff00000019811663010000009182900460ff1615909102179055565b60606002805403610d6c5760405162461bcd60e51b815260040161097890612f8f565b6002805560195462010000900460ff1615610dc95760405162461bcd60e51b815260206004820152601960248201527f5265776172647320636f6c6c656374696f6e20706175736564000000000000006044820152606401610978565b610dd33333612077565b9050600160025590565b6000546001600160a01b03163314610e075760405162461bcd60e51b815260040161097890613028565b670de0b6b3a7640000811015610e785760405162461bcd60e51b815260206004820152603060248201527f4d756c7469706c696572206d7573742062652067726561746572207468616e2060448201526f0dee440cae2eac2d840e8de4062ca62760831b6064820152608401610978565b60068190556040518181527fa1676084a9eea08c6f205b60799323b364a1bd8e10aba89f0fbd94cfbf68b5dd906020016109cb565b6002805403610ece5760405162461bcd60e51b815260040161097890612f8f565b60028055601954610100900460ff1615610f1f5760405162461bcd60e51b815260206004820152601260248201527115da5d1a191c985dd85b1cc81c185d5cd95960721b6044820152606401610978565b610f2a3333836122d7565b506001600255565b6060600c805480602002602001604051908101604052809291908181526020016000905b82821015611002578382906000526020600020018054610f7590612fc6565b80601f0160208091040260200160405190810160405280929190818152602001828054610fa190612fc6565b8015610fee5780601f10610fc357610100808354040283529160200191610fee565b820191906000526020600020905b815481529060010190602001808311610fd157829003601f168201915b505050505081526020019060010190610f56565b50505050905090565b60606013546000148061101e5750601454155b1561107857600f80548060200260200160405190810160405280929190818152602001828054801561090057602002820191906000526020600020905b81548152602001906001019080831161105b575050505050905090565b600a5467ffffffffffffffff81111561109357611093612f34565b6040519080825280602002602001820160405280156110bc578160200160208202803683370190505b50905060005b600f54811015610ac95761114861111c60145461080c670de0b6b3a7640000611116600b87815481106110f7576110f7612f4a565b9060005260206000200154611116600554611110612631565b90611ba6565b90611be8565b600f838154811061112f5761112f612f4a565b9060005260206000200154611b4090919063ffffffff16565b82828151811061115a5761115a612f4a565b60209081029190910101528061116f81612f76565b9150506110c2565b6001546001600160a01b031633146111ef5760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610978565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b0316331461128b5760405162461bcd60e51b815260040161097890613028565b6019805462ff0000198116620100009182900460ff1615909102179055565b600a81815481106112ba57600080fd5b6000918252602090912001546001600160a01b0316905081565b60005482906001600160a01b03163314806112f457506112f43382610caa565b6113105760405162461bcd60e51b815260040161097890612ffa565b6003546001600160a01b039081169084160361136e5760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f7420727567207374616b696e67202f204c5020746f6b656e7300006044820152606401610978565b6000805b600a548110156113ce57846001600160a01b0316600a828154811061139957611399612f4a565b6000918252602090912001546001600160a01b0316036113bc57600191506113ce565b806113c681612f76565b915050611372565b508080156113f557506001600160a01b038481166000908152600960205260409020541633145b156114bc5760405163a9059cbb60e01b8152336004820152602481018490526001600160a01b0385169063a9059cbb906044015b6020604051808303816000875af1158015611448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146c919061304f565b50604080513381526001600160a01b03861660208201529081018490527ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b6489060600160405180910390a150505050565b801580156114d457506000546001600160a01b031633145b1561150c5760405163a9059cbb60e01b8152336004820152602481018490526001600160a01b0385169063a9059cbb90604401611429565b60405162461bcd60e51b815260206004820152601a60248201527f4e6f2076616c696420746f6b656e7320746f207265636f7665720000000000006044820152606401610978565b505050565b6001600160a01b03811660009081526016602052604081205490805b6001600160a01b038416600090815260176020526040902054811015611716576001600160a01b03841660009081526017602052604081208054839081106115bf576115bf612f4a565b90600052602060002090600502016040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815250509050600081608001519050428260600151116116d45760608201516001600160a01b03871660009081526012602052604090205410156116c9576001600160a01b038616600090815260126020526040812054606084015161166b91611ba6565b90506000611686846060015142611ba690919063ffffffff16565b905060006116a961169f670de0b6b3a764000084611be8565b6108128686611be8565b90506116bf6116b88484611b40565b8290611c6a565b93505050506116d4565b50670de0b6b3a76400005b604082015160006116f1670de0b6b3a764000061080c8486611be8565b90506116fd8682611b40565b955050505050808061170e90612f76565b915050611575565b50915091565b6000546001600160a01b031633146117465760405162461bcd60e51b815260040161097890613028565b6001600160a01b03166000908152601860205260409020805460ff19811660ff90911615179055565b6000546001600160a01b031633146117995760405162461bcd60e51b815260040161097890613028565b60018210156117ea5760405162461bcd60e51b815260206004820152601960248201527f4d756c206d61782074696d65206d757374206265203e3d2031000000000000006044820152606401610978565b600181101561183b5760405162461bcd60e51b815260206004820152601960248201527f4d756c206d696e2074696d65206d757374206265203e3d2031000000000000006044820152606401610978565b600782905560088190556040518281527f0e3e3fae480c6f92291358a02bc83f04ee1971d5488596bffda7929d57ab470f9060200160405180910390a16040518181527f0534d208d75dfdbfacc1204745dd9b3c4c37e8cfc05eb5e8e3ae538aedb0a9fa9060200160405180910390a15050565b6000546001600160a01b031633146118d95760405162461bcd60e51b815260040161097890613028565b6201518081101561192c5760405162461bcd60e51b815260206004820152601a60248201527f52657761726473206475726174696f6e20746f6f2073686f72740000000000006044820152606401610978565b600454158061193c575060045442115b6119885760405162461bcd60e51b815260206004820152601860248201527f52657761726420706572696f6420696e636f6d706c65746500000000000000006044820152606401610978565b600e8190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d3906020016109cb565b6000546001600160a01b031633146119e75760405162461bcd60e51b815260040161097890613028565b6019805461ff001981166101009182900460ff1615909102179055565b60005482906001600160a01b0316331480611a245750611a243382610caa565b611a405760405162461bcd60e51b815260040161097890612ffa565b506001600160a01b03918216600090815260096020526040902080546001600160a01b03191691909216179055565b6000546001600160a01b03163314611a995760405162461bcd60e51b815260040161097890613028565b6019805460ff19811660ff90911615179055565b600b8181548110611abd57600080fd5b600091825260209091200154905081565b6060600b805480602002602001604051908101604052809291908181526020018280548015610900576020028201919060005260206000209081548152602001906001019080831161105b575050505050905090565b600454421115611b3857611b36612644565b565b611b36612893565b600080611b4d838561306c565b905083811015611b9f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610978565b9392505050565b6000611b9f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612906565b600082600003611bfa575060006108a2565b6000611c068385613084565b905082611c1385836130a3565b14611b9f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610978565b6000611b9f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612940565b846001611cb9828261296e565b6019546301000000900460ff1615611d045760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c81c185d5cd95960921b6044820152606401610978565b60008511611d545760405162461bcd60e51b815260206004820152601960248201527f4d757374207374616b65206d6f7265207468616e207a65726f000000000000006044820152606401610978565b6001600160a01b03871660009081526018602052604090205460ff1615611dbd5760405162461bcd60e51b815260206004820152601b60248201527f4164647265737320686173206265656e20677265796c697374656400000000006044820152606401610978565b600854841015611e0f5760405162461bcd60e51b815260206004820152601a60248201527f4d696e696d756d207374616b652074696d65206e6f74206d65740000000000006044820152606401610978565b600754841115611e615760405162461bcd60e51b815260206004820152601b60248201527f547279696e6720746f206c6f636b20666f7220746f6f206c6f6e6700000000006044820152606401610978565b6000611e6c8561084f565b6001600160a01b03891660009081526015602090815260408083205490516bffffffffffffffffffffffff1960608e901b169281019290925260348201889052605482018a905260748201529192509060940160408051601f1981840301815282825280516020918201206001600160a01b038d1660009081526017835283902060a0850184528185529184018990529183018a90529092509060608101611f14888a611b40565b815260209081018590528254600181810185556000948552938290208351600590920201908155908201519281019290925560408101516002830155606081015160038084019190915560809091015160049092019190915554611f83906001600160a01b031689308a612a3d565b601354611f909088611b40565b6013556001600160a01b038916600090815260156020526040902054611fb69088611b40565b6001600160a01b038a16600090815260156020526040812091909155611fdd908a9061296e565b6001600160a01b0389166000908152601260205260408120549003612018576001600160a01b03891660009081526012602052604090204290555b60408051888152602081018890529081018290526001600160a01b0389811660608301528a16907ff400e72e69ef4402819dfc57eeddc66f5eb69bf405e0e8098b1946ec1ac14a229060800160405180910390a2505050505050505050565b6060826001612086828261296e565b600a5467ffffffffffffffff8111156120a1576120a1612f34565b6040519080825280602002602001820160405280156120ca578160200160208202803683370190505b50925060005b600a548110156122b4576001600160a01b0386166000908152601160209081526040808320848452909152902054845185908390811061211257612112612f4a565b6020908102919091018101919091526001600160a01b038716600090815260118252604080822084835290925290812055600a80548290811061215757612157612f4a565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663a9059cbb8686848151811061219657612196612f4a565b60200260200101516040518363ffffffff1660e01b81526004016121cf9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156121ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612212919061304f565b50856001600160a01b03167f1d2f2ca53af5d2f333bd32fdd45f9c52ad8ebe31414f7792912077fcb3876dff85838151811061225057612250612f4a565b6020026020010151600a848154811061226b5761226b612f4a565b60009182526020918290200154604080519384526001600160a01b039182169284019290925289169082015260600160405180910390a2806122ac81612f76565b9150506120d0565b5050506001600160a01b0390921660009081526012602052604090204290555090565b6122e18383612077565b506123176040518060a0016040528060008019168152602001600081526020016000815260200160008152602001600081525090565b600060408201819052805b6001600160a01b038616600090815260176020526040902054811015612415576001600160a01b038616600090815260176020526040902080548290811061236c5761236c612f4a565b9060005260206000209060050201600001548403612403576001600160a01b03861660009081526017602052604090208054829081106123ae576123ae612f4a565b90600052602060002090600502016040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815250509250809150612415565b8061240d81612f76565b915050612322565b50815183146124585760405162461bcd60e51b815260206004820152600f60248201526e14dd185ad9481b9bdd08199bdd5b99608a1b6044820152606401610978565b816060015142101580612472575060195460ff1615156001145b6124b75760405162461bcd60e51b81526020600482015260166024820152755374616b65206973207374696c6c206c6f636b65642160501b6044820152606401610978565b60408201518015612629576013546124cf9082611ba6565b6013556001600160a01b0386166000908152601560205260409020546124f59082611ba6565b6001600160a01b038716600090815260156020908152604080832093909355601790522080548390811061252b5761252b612f4a565b60009182526020822060059091020181815560018101829055600281018290556003810182905560040181905561256390879061296e565b60035460405163a9059cbb60e01b81526001600160a01b038781166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af11580156125b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125da919061304f565b5060408051828152602081018690526001600160a01b03878116828401529151918816917f1d9308f6b22a2754a1c622bb30889e8f8f956c83e524d039e9d65d5f052eb9089181900360600190a25b505050505050565b600061263f42600454612b65565b905090565b60045442116126955760405162461bcd60e51b815260206004820152601b60248201527f506572696f6420686173206e6f742065787069726564207965742100000000006044820152606401610978565b6000600e546126af60045442611ba690919063ffffffff16565b6126b991906130a3565b905060005b600a5481101561282b57600a81815481106126db576126db612f4a565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561272c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275091906130c5565b61277761275e84600161306c565b611116600e54600b8681548110610a8157610a81612f4a565b1115600a828154811061278c5761278c612f4a565b60009182526020918290200154604080517f4e6f7420656e6f7567682072657761726420746f6b656e7320617661696c61629381019390935263036329d160e51b9083015260601b6bffffffffffffffffffffffff19166044820152605801604051602081830303815290604052906128185760405162461bcd60e51b81526004016109789190612e14565b508061282381612f76565b9150506126be565b50600e5461284b9061284290611116846001611b40565b60045490611b40565b600455612856612893565b6003546040516001600160a01b0390911681527f6f2b3b3aaf1881d69a5d40565500f93ea73df36e7b6a29bf48b21479a9237fe9906020016109cb565b600061289d61100b565b905060005b600f548110156128f7578181815181106128be576128be612f4a565b6020026020010151600f82815481106128d9576128d9612f4a565b600091825260209091200155806128ef81612f76565b9150506128a2565b50612900612631565b60055550565b6000818484111561292a5760405162461bcd60e51b81526004016109789190612e14565b50600061293784866130de565b95945050505050565b600081836129615760405162461bcd60e51b81526004016109789190612e14565b50600061293784866130a3565b801561297c5761297c611b24565b6001600160a01b03821615612a395760008061299784611559565b915091506129a484612b7b565b8181106129f35760006129b78284611ba6565b6014549091506129c79082611b40565b6014556129d48382611b40565b6001600160a01b03861660009081526016602052604090205550610ca4565b60006129ff8383611ba6565b601454909150612a0f9082611ba6565b601455612a1c8382611ba6565b6001600160a01b0386166000908152601660205260409020555050505b5050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092839290881691612aa191906130f5565b6000604051808303816000865af19150503d8060008114612ade576040519150601f19603f3d011682016040523d82523d6000602084013e612ae3565b606091505b5091509150818015612b0d575080511580612b0d575080806020019051810190612b0d919061304f565b6126295760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610978565b6000818310612b745781611b9f565b5090919050565b6001600160a01b03811615612c54576000612b95826106aa565b905060005b8151811015612bf657818181518110612bb557612bb5612f4a565b6020908102919091018101516001600160a01b0385166000908152601183526040808220858352909352919091205580612bee81612f76565b915050612b9a565b5060005b815181101561155457600f8181548110612c1657612c16612f4a565b60009182526020808320909101546001600160a01b038616835260108252604080842085855290925291205580612c4c81612f76565b915050612bfa565b50565b80356001600160a01b0381168114612c6e57600080fd5b919050565b600060208284031215612c8557600080fd5b611b9f82612c57565b6020808252825182820181905260009190848201906040850190845b81811015612cc657835183529284019291840191600101612caa565b50909695505050505050565b600060208284031215612ce457600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015612cc65783516001600160a01b031683529284019291840191600101612d07565b60008060408385031215612d3f57600080fd5b50508035926020909101359150565b602080825282518282018190526000919060409081850190868401855b82811015612daf5781518051855286810151878601528581015186860152606080820151908601526080908101519085015260a09093019290850190600101612d6b565b5091979650505050505050565b60005b83811015612dd7578181015183820152602001612dbf565b83811115610ca45750506000910152565b60008151808452612e00816020860160208601612dbc565b601f01601f19169290920160200192915050565b602081526000611b9f6020830184612de8565b8015158114612c5457600080fd5b600080600060608486031215612e4a57600080fd5b612e5384612c57565b9250602084013591506040840135612e6a81612e27565b809150509250925092565b60008060408385031215612e8857600080fd5b612e9183612c57565b9150612e9f60208401612c57565b90509250929050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612efd57603f19888603018452612eeb858351612de8565b94509285019290850190600101612ecf565b5092979650505050505050565b60008060408385031215612f1d57600080fd5b612f2683612c57565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612f8857612f88612f60565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600181811c90821680612fda57607f821691505b60208210810361084957634e487b7160e01b600052602260045260246000fd5b6020808252601490820152732737ba1037bbb732b91037b9103a35b71036b3b960611b604082015260600190565b6020808252600d908201526c2737ba103a34329037bbb732b960991b604082015260600190565b60006020828403121561306157600080fd5b8151611b9f81612e27565b6000821982111561307f5761307f612f60565b500190565b600081600019048311821515161561309e5761309e612f60565b500290565b6000826130c057634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156130d757600080fd5b5051919050565b6000828210156130f0576130f0612f60565b500390565b60008251613107818460208701612dbc565b919091019291505056fea2646970667358221220ca60a5fcbd81e736c7a15bf6eeaef8bbb2560f3194824769366523e79343591264736f6c634300080d0033000000000000000000000000d88e7d30f7548b7a7c6bfe513629724916449e6d000000000000000000000000aaf448d30f01b429fb6e7f9af6a8ff66e694f31200000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000355534800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e60779cc1b2c1d0580611c526a8df0e3f870ec480000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d88e7d30f7548b7a7c6bfe513629724916449e6d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b1a2bc2ec500000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102d55760003560e01c806372f702f311610182578063c8f33c91116100e9578063e01f62bf116100a2578063ebe2b12b1161007c578063ebe2b12b1461067e578063f2caeb1e14610687578063f43155531461069a578063fff6cae9146106a257600080fd5b8063e01f62bf1461065c578063e1ba95d214610664578063e9f2838e1461066c57600080fd5b8063c8f33c91146105f3578063cc1a378f146105fc578063cdc82e801461060f578063d239f00314610618578063d9f96e8d14610620578063de1a65511461064957600080fd5b80638da5cb5b1161013b5780638da5cb5b14610590578063941d9f65146105a35780639637927f146105b6578063af00f4e2146105c3578063b94c4dcb146105d6578063bbb781cc146105df57600080fd5b806372f702f31461051f57806379ba5097146105325780637b31c19a1461053a5780637bb7bed1146105425780638980f11f146105555780638bad86a71461056857600080fd5b806336f89af21161024157806351e3fc17116101fa57806366e9e9b3116101d457806366e9e9b3146104d957806369339245146104ee5780636e27cef91461050e57806370641a361461051757600080fd5b806351e3fc17146104ab57806353a47bb7146104be57806364f2c060146104d157600080fd5b806336f89af214610415578063386a95251461043e5780633b8105b3146104475780633d18b9121461044f57806341a16f3f1461045757806347b9bc221461049857600080fd5b80631e090f01116102935780631e090f01146103695780631e368980146103895780631f5848de146103a9578063231b68dc146103bc57806331ca208c146103df578063323331ca1461040257600080fd5b80628cc262146102da5780630d7bac4f1461030357806312edb24c146103245780631627540c1461033957806317b18c891461034e5780631c1f78eb14610361575b600080fd5b6102ed6102e8366004612c73565b6106aa565b6040516102fa9190612c8e565b60405180910390f35b610316610311366004612cd2565b61084f565b6040519081526020016102fa565b61032c6108a8565b6040516102fa9190612ceb565b61034c610347366004612c73565b61090a565b005b61034c61035c366004612d2c565b6109d6565b6102ed610a11565b61037c610377366004612c73565b610acd565b6040516102fa9190612d4e565b61039c610397366004612cd2565b610b74565b6040516102fa9190612e14565b61034c6103b7366004612e35565b610c20565b6103cf6103ca366004612e75565b610caa565b60405190151581526020016102fa565b6103cf6103ed366004612c73565b60186020526000908152604090205460ff1681565b6019546103cf9062010000900460ff1681565b610316610423366004612c73565b6001600160a01b031660009081526016602052604090205490565b610316600e5481565b61034c610cfe565b6102ed610d49565b610480610465366004612c73565b6009602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102fa565b61034c6104a6366004612cd2565b610ddd565b61034c6104b9366004612cd2565b610ead565b600154610480906001600160a01b031681565b601454610316565b6104e1610f32565b6040516102fa9190612ea8565b6103166104fc366004612c73565b600d6020526000908152604090205481565b61031660085481565b6102ed61100b565b600354610480906001600160a01b031681565b61034c611177565b61034c611261565b610480610550366004612cd2565b6112aa565b61034c610563366004612f0a565b6112d4565b61057b610576366004612c73565b611559565b604080519283526020830191909152016102fa565b600054610480906001600160a01b031681565b61034c6105b1366004612c73565b61171c565b6019546103cf9060ff1681565b61034c6105d1366004612d2c565b61176f565b61031660075481565b6019546103cf906301000000900460ff1681565b61031660055481565b61034c61060a366004612cd2565b6118af565b61031660065481565b61034c6119bd565b61031661062e366004612c73565b6001600160a01b031660009081526015602052604090205490565b61034c610657366004612e75565b611a04565b601354610316565b61034c611a6f565b6019546103cf90610100900460ff1681565b61031660045481565b610316610695366004612cd2565b611aad565b6102ed611ace565b61034c611b24565b606060006106b661100b565b600a5490915067ffffffffffffffff8111156106d4576106d4612f34565b6040519080825280602002602001820160405280156106fd578160200160208202803683370190505b506001600160a01b038416600090815260166020526040812054919350036107635760005b600a5481101561075d57600083828151811061074057610740612f4a565b60209081029190910101528061075581612f76565b915050610722565b50610849565b60005b600a54811015610847576001600160a01b0384166000818152601160209081526040808320858452825280832054938352601082528083208584529091529020548351610818929161081291670de0b6b3a76400009161080c916107ed91908990899081106107d7576107d7612f4a565b6020026020010151611ba690919063ffffffff16565b6001600160a01b038a1660009081526016602052604090205490611be8565b90611c6a565b90611b40565b83828151811061082a5761082a612f4a565b60209081029190910101528061083f81612f76565b915050610766565b505b50919050565b60008061089161088260075461080c61087b670de0b6b3a7640000600654611ba690919063ffffffff16565b8790611be8565b670de0b6b3a764000090611b40565b90506006548111156108a257506006545b92915050565b6060600a80548060200260200160405190810160405280929190818152602001828054801561090057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116108e2575b5050505050905090565b6000546001600160a01b031633146109815760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b60648201526084015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b60028054036109f75760405162461bcd60e51b815260040161097890612f8f565b60028055610a083380848442611cac565b50506001600255565b600b5460609067ffffffffffffffff811115610a2f57610a2f612f34565b604051908082528060200260200182016040528015610a58578160200160208202803683370190505b50905060005b600b54811015610ac957610a9a600e54600b8381548110610a8157610a81612f4a565b9060005260206000200154611be890919063ffffffff16565b828281518110610aac57610aac612f4a565b602090810291909101015280610ac181612f76565b915050610a5e565b5090565b6001600160a01b0381166000908152601760209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610b6957838290600052602060002090600502016040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505081526020019060010190610b05565b505050509050919050565b600c8181548110610b8457600080fd5b906000526020600020016000915090508054610b9f90612fc6565b80601f0160208091040260200160405190810160405280929190818152602001828054610bcb90612fc6565b8015610c185780601f10610bed57610100808354040283529160200191610c18565b820191906000526020600020905b815481529060010190602001808311610bfb57829003601f168201915b505050505081565b60005483906001600160a01b0316331480610c405750610c403382610caa565b610c5c5760405162461bcd60e51b815260040161097890612ffa565b6001600160a01b0384166000908152600d6020526040902054600b80548592908110610c8a57610c8a612f4a565b6000918252602090912001558115610ca457610ca4611b24565b50505050565b600080546001600160a01b0390811690841603610cc9575060016108a2565b6001600160a01b03828116600090815260096020526040902054818516911603610cf5575060016108a2565b50600092915050565b6000546001600160a01b03163314610d285760405162461bcd60e51b815260040161097890613028565b6019805463ff00000019811663010000009182900460ff1615909102179055565b60606002805403610d6c5760405162461bcd60e51b815260040161097890612f8f565b6002805560195462010000900460ff1615610dc95760405162461bcd60e51b815260206004820152601960248201527f5265776172647320636f6c6c656374696f6e20706175736564000000000000006044820152606401610978565b610dd33333612077565b9050600160025590565b6000546001600160a01b03163314610e075760405162461bcd60e51b815260040161097890613028565b670de0b6b3a7640000811015610e785760405162461bcd60e51b815260206004820152603060248201527f4d756c7469706c696572206d7573742062652067726561746572207468616e2060448201526f0dee440cae2eac2d840e8de4062ca62760831b6064820152608401610978565b60068190556040518181527fa1676084a9eea08c6f205b60799323b364a1bd8e10aba89f0fbd94cfbf68b5dd906020016109cb565b6002805403610ece5760405162461bcd60e51b815260040161097890612f8f565b60028055601954610100900460ff1615610f1f5760405162461bcd60e51b815260206004820152601260248201527115da5d1a191c985dd85b1cc81c185d5cd95960721b6044820152606401610978565b610f2a3333836122d7565b506001600255565b6060600c805480602002602001604051908101604052809291908181526020016000905b82821015611002578382906000526020600020018054610f7590612fc6565b80601f0160208091040260200160405190810160405280929190818152602001828054610fa190612fc6565b8015610fee5780601f10610fc357610100808354040283529160200191610fee565b820191906000526020600020905b815481529060010190602001808311610fd157829003601f168201915b505050505081526020019060010190610f56565b50505050905090565b60606013546000148061101e5750601454155b1561107857600f80548060200260200160405190810160405280929190818152602001828054801561090057602002820191906000526020600020905b81548152602001906001019080831161105b575050505050905090565b600a5467ffffffffffffffff81111561109357611093612f34565b6040519080825280602002602001820160405280156110bc578160200160208202803683370190505b50905060005b600f54811015610ac95761114861111c60145461080c670de0b6b3a7640000611116600b87815481106110f7576110f7612f4a565b9060005260206000200154611116600554611110612631565b90611ba6565b90611be8565b600f838154811061112f5761112f612f4a565b9060005260206000200154611b4090919063ffffffff16565b82828151811061115a5761115a612f4a565b60209081029190910101528061116f81612f76565b9150506110c2565b6001546001600160a01b031633146111ef5760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610978565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b0316331461128b5760405162461bcd60e51b815260040161097890613028565b6019805462ff0000198116620100009182900460ff1615909102179055565b600a81815481106112ba57600080fd5b6000918252602090912001546001600160a01b0316905081565b60005482906001600160a01b03163314806112f457506112f43382610caa565b6113105760405162461bcd60e51b815260040161097890612ffa565b6003546001600160a01b039081169084160361136e5760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f7420727567207374616b696e67202f204c5020746f6b656e7300006044820152606401610978565b6000805b600a548110156113ce57846001600160a01b0316600a828154811061139957611399612f4a565b6000918252602090912001546001600160a01b0316036113bc57600191506113ce565b806113c681612f76565b915050611372565b508080156113f557506001600160a01b038481166000908152600960205260409020541633145b156114bc5760405163a9059cbb60e01b8152336004820152602481018490526001600160a01b0385169063a9059cbb906044015b6020604051808303816000875af1158015611448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146c919061304f565b50604080513381526001600160a01b03861660208201529081018490527ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b6489060600160405180910390a150505050565b801580156114d457506000546001600160a01b031633145b1561150c5760405163a9059cbb60e01b8152336004820152602481018490526001600160a01b0385169063a9059cbb90604401611429565b60405162461bcd60e51b815260206004820152601a60248201527f4e6f2076616c696420746f6b656e7320746f207265636f7665720000000000006044820152606401610978565b505050565b6001600160a01b03811660009081526016602052604081205490805b6001600160a01b038416600090815260176020526040902054811015611716576001600160a01b03841660009081526017602052604081208054839081106115bf576115bf612f4a565b90600052602060002090600502016040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815250509050600081608001519050428260600151116116d45760608201516001600160a01b03871660009081526012602052604090205410156116c9576001600160a01b038616600090815260126020526040812054606084015161166b91611ba6565b90506000611686846060015142611ba690919063ffffffff16565b905060006116a961169f670de0b6b3a764000084611be8565b6108128686611be8565b90506116bf6116b88484611b40565b8290611c6a565b93505050506116d4565b50670de0b6b3a76400005b604082015160006116f1670de0b6b3a764000061080c8486611be8565b90506116fd8682611b40565b955050505050808061170e90612f76565b915050611575565b50915091565b6000546001600160a01b031633146117465760405162461bcd60e51b815260040161097890613028565b6001600160a01b03166000908152601860205260409020805460ff19811660ff90911615179055565b6000546001600160a01b031633146117995760405162461bcd60e51b815260040161097890613028565b60018210156117ea5760405162461bcd60e51b815260206004820152601960248201527f4d756c206d61782074696d65206d757374206265203e3d2031000000000000006044820152606401610978565b600181101561183b5760405162461bcd60e51b815260206004820152601960248201527f4d756c206d696e2074696d65206d757374206265203e3d2031000000000000006044820152606401610978565b600782905560088190556040518281527f0e3e3fae480c6f92291358a02bc83f04ee1971d5488596bffda7929d57ab470f9060200160405180910390a16040518181527f0534d208d75dfdbfacc1204745dd9b3c4c37e8cfc05eb5e8e3ae538aedb0a9fa9060200160405180910390a15050565b6000546001600160a01b031633146118d95760405162461bcd60e51b815260040161097890613028565b6201518081101561192c5760405162461bcd60e51b815260206004820152601a60248201527f52657761726473206475726174696f6e20746f6f2073686f72740000000000006044820152606401610978565b600454158061193c575060045442115b6119885760405162461bcd60e51b815260206004820152601860248201527f52657761726420706572696f6420696e636f6d706c65746500000000000000006044820152606401610978565b600e8190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d3906020016109cb565b6000546001600160a01b031633146119e75760405162461bcd60e51b815260040161097890613028565b6019805461ff001981166101009182900460ff1615909102179055565b60005482906001600160a01b0316331480611a245750611a243382610caa565b611a405760405162461bcd60e51b815260040161097890612ffa565b506001600160a01b03918216600090815260096020526040902080546001600160a01b03191691909216179055565b6000546001600160a01b03163314611a995760405162461bcd60e51b815260040161097890613028565b6019805460ff19811660ff90911615179055565b600b8181548110611abd57600080fd5b600091825260209091200154905081565b6060600b805480602002602001604051908101604052809291908181526020018280548015610900576020028201919060005260206000209081548152602001906001019080831161105b575050505050905090565b600454421115611b3857611b36612644565b565b611b36612893565b600080611b4d838561306c565b905083811015611b9f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610978565b9392505050565b6000611b9f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612906565b600082600003611bfa575060006108a2565b6000611c068385613084565b905082611c1385836130a3565b14611b9f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610978565b6000611b9f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612940565b846001611cb9828261296e565b6019546301000000900460ff1615611d045760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c81c185d5cd95960921b6044820152606401610978565b60008511611d545760405162461bcd60e51b815260206004820152601960248201527f4d757374207374616b65206d6f7265207468616e207a65726f000000000000006044820152606401610978565b6001600160a01b03871660009081526018602052604090205460ff1615611dbd5760405162461bcd60e51b815260206004820152601b60248201527f4164647265737320686173206265656e20677265796c697374656400000000006044820152606401610978565b600854841015611e0f5760405162461bcd60e51b815260206004820152601a60248201527f4d696e696d756d207374616b652074696d65206e6f74206d65740000000000006044820152606401610978565b600754841115611e615760405162461bcd60e51b815260206004820152601b60248201527f547279696e6720746f206c6f636b20666f7220746f6f206c6f6e6700000000006044820152606401610978565b6000611e6c8561084f565b6001600160a01b03891660009081526015602090815260408083205490516bffffffffffffffffffffffff1960608e901b169281019290925260348201889052605482018a905260748201529192509060940160408051601f1981840301815282825280516020918201206001600160a01b038d1660009081526017835283902060a0850184528185529184018990529183018a90529092509060608101611f14888a611b40565b815260209081018590528254600181810185556000948552938290208351600590920201908155908201519281019290925560408101516002830155606081015160038084019190915560809091015160049092019190915554611f83906001600160a01b031689308a612a3d565b601354611f909088611b40565b6013556001600160a01b038916600090815260156020526040902054611fb69088611b40565b6001600160a01b038a16600090815260156020526040812091909155611fdd908a9061296e565b6001600160a01b0389166000908152601260205260408120549003612018576001600160a01b03891660009081526012602052604090204290555b60408051888152602081018890529081018290526001600160a01b0389811660608301528a16907ff400e72e69ef4402819dfc57eeddc66f5eb69bf405e0e8098b1946ec1ac14a229060800160405180910390a2505050505050505050565b6060826001612086828261296e565b600a5467ffffffffffffffff8111156120a1576120a1612f34565b6040519080825280602002602001820160405280156120ca578160200160208202803683370190505b50925060005b600a548110156122b4576001600160a01b0386166000908152601160209081526040808320848452909152902054845185908390811061211257612112612f4a565b6020908102919091018101919091526001600160a01b038716600090815260118252604080822084835290925290812055600a80548290811061215757612157612f4a565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663a9059cbb8686848151811061219657612196612f4a565b60200260200101516040518363ffffffff1660e01b81526004016121cf9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156121ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612212919061304f565b50856001600160a01b03167f1d2f2ca53af5d2f333bd32fdd45f9c52ad8ebe31414f7792912077fcb3876dff85838151811061225057612250612f4a565b6020026020010151600a848154811061226b5761226b612f4a565b60009182526020918290200154604080519384526001600160a01b039182169284019290925289169082015260600160405180910390a2806122ac81612f76565b9150506120d0565b5050506001600160a01b0390921660009081526012602052604090204290555090565b6122e18383612077565b506123176040518060a0016040528060008019168152602001600081526020016000815260200160008152602001600081525090565b600060408201819052805b6001600160a01b038616600090815260176020526040902054811015612415576001600160a01b038616600090815260176020526040902080548290811061236c5761236c612f4a565b9060005260206000209060050201600001548403612403576001600160a01b03861660009081526017602052604090208054829081106123ae576123ae612f4a565b90600052602060002090600502016040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815250509250809150612415565b8061240d81612f76565b915050612322565b50815183146124585760405162461bcd60e51b815260206004820152600f60248201526e14dd185ad9481b9bdd08199bdd5b99608a1b6044820152606401610978565b816060015142101580612472575060195460ff1615156001145b6124b75760405162461bcd60e51b81526020600482015260166024820152755374616b65206973207374696c6c206c6f636b65642160501b6044820152606401610978565b60408201518015612629576013546124cf9082611ba6565b6013556001600160a01b0386166000908152601560205260409020546124f59082611ba6565b6001600160a01b038716600090815260156020908152604080832093909355601790522080548390811061252b5761252b612f4a565b60009182526020822060059091020181815560018101829055600281018290556003810182905560040181905561256390879061296e565b60035460405163a9059cbb60e01b81526001600160a01b038781166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af11580156125b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125da919061304f565b5060408051828152602081018690526001600160a01b03878116828401529151918816917f1d9308f6b22a2754a1c622bb30889e8f8f956c83e524d039e9d65d5f052eb9089181900360600190a25b505050505050565b600061263f42600454612b65565b905090565b60045442116126955760405162461bcd60e51b815260206004820152601b60248201527f506572696f6420686173206e6f742065787069726564207965742100000000006044820152606401610978565b6000600e546126af60045442611ba690919063ffffffff16565b6126b991906130a3565b905060005b600a5481101561282b57600a81815481106126db576126db612f4a565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561272c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275091906130c5565b61277761275e84600161306c565b611116600e54600b8681548110610a8157610a81612f4a565b1115600a828154811061278c5761278c612f4a565b60009182526020918290200154604080517f4e6f7420656e6f7567682072657761726420746f6b656e7320617661696c61629381019390935263036329d160e51b9083015260601b6bffffffffffffffffffffffff19166044820152605801604051602081830303815290604052906128185760405162461bcd60e51b81526004016109789190612e14565b508061282381612f76565b9150506126be565b50600e5461284b9061284290611116846001611b40565b60045490611b40565b600455612856612893565b6003546040516001600160a01b0390911681527f6f2b3b3aaf1881d69a5d40565500f93ea73df36e7b6a29bf48b21479a9237fe9906020016109cb565b600061289d61100b565b905060005b600f548110156128f7578181815181106128be576128be612f4a565b6020026020010151600f82815481106128d9576128d9612f4a565b600091825260209091200155806128ef81612f76565b9150506128a2565b50612900612631565b60055550565b6000818484111561292a5760405162461bcd60e51b81526004016109789190612e14565b50600061293784866130de565b95945050505050565b600081836129615760405162461bcd60e51b81526004016109789190612e14565b50600061293784866130a3565b801561297c5761297c611b24565b6001600160a01b03821615612a395760008061299784611559565b915091506129a484612b7b565b8181106129f35760006129b78284611ba6565b6014549091506129c79082611b40565b6014556129d48382611b40565b6001600160a01b03861660009081526016602052604090205550610ca4565b60006129ff8383611ba6565b601454909150612a0f9082611ba6565b601455612a1c8382611ba6565b6001600160a01b0386166000908152601660205260409020555050505b5050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092839290881691612aa191906130f5565b6000604051808303816000865af19150503d8060008114612ade576040519150601f19603f3d011682016040523d82523d6000602084013e612ae3565b606091505b5091509150818015612b0d575080511580612b0d575080806020019051810190612b0d919061304f565b6126295760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610978565b6000818310612b745781611b9f565b5090919050565b6001600160a01b03811615612c54576000612b95826106aa565b905060005b8151811015612bf657818181518110612bb557612bb5612f4a565b6020908102919091018101516001600160a01b0385166000908152601183526040808220858352909352919091205580612bee81612f76565b915050612b9a565b5060005b815181101561155457600f8181548110612c1657612c16612f4a565b60009182526020808320909101546001600160a01b038616835260108252604080842085855290925291205580612c4c81612f76565b915050612bfa565b50565b80356001600160a01b0381168114612c6e57600080fd5b919050565b600060208284031215612c8557600080fd5b611b9f82612c57565b6020808252825182820181905260009190848201906040850190845b81811015612cc657835183529284019291840191600101612caa565b50909695505050505050565b600060208284031215612ce457600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015612cc65783516001600160a01b031683529284019291840191600101612d07565b60008060408385031215612d3f57600080fd5b50508035926020909101359150565b602080825282518282018190526000919060409081850190868401855b82811015612daf5781518051855286810151878601528581015186860152606080820151908601526080908101519085015260a09093019290850190600101612d6b565b5091979650505050505050565b60005b83811015612dd7578181015183820152602001612dbf565b83811115610ca45750506000910152565b60008151808452612e00816020860160208601612dbc565b601f01601f19169290920160200192915050565b602081526000611b9f6020830184612de8565b8015158114612c5457600080fd5b600080600060608486031215612e4a57600080fd5b612e5384612c57565b9250602084013591506040840135612e6a81612e27565b809150509250925092565b60008060408385031215612e8857600080fd5b612e9183612c57565b9150612e9f60208401612c57565b90509250929050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612efd57603f19888603018452612eeb858351612de8565b94509285019290850190600101612ecf565b5092979650505050505050565b60008060408385031215612f1d57600080fd5b612f2683612c57565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612f8857612f88612f60565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600181811c90821680612fda57607f821691505b60208210810361084957634e487b7160e01b600052602260045260246000fd5b6020808252601490820152732737ba1037bbb732b91037b9103a35b71036b3b960611b604082015260600190565b6020808252600d908201526c2737ba103a34329037bbb732b960991b604082015260600190565b60006020828403121561306157600080fd5b8151611b9f81612e27565b6000821982111561307f5761307f612f60565b500190565b600081600019048311821515161561309e5761309e612f60565b500290565b6000826130c057634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156130d757600080fd5b5051919050565b6000828210156130f0576130f0612f60565b500390565b60008251613107818460208701612dbc565b919091019291505056fea2646970667358221220ca60a5fcbd81e736c7a15bf6eeaef8bbb2560f3194824769366523e79343591264736f6c634300080d0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000d88e7d30f7548b7a7c6bfe513629724916449e6d000000000000000000000000aaf448d30f01b429fb6e7f9af6a8ff66e694f31200000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000355534800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e60779cc1b2c1d0580611c526a8df0e3f870ec480000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d88e7d30f7548b7a7c6bfe513629724916449e6d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b1a2bc2ec500000

-----Decoded View---------------
Arg [0] : _owner (address): 0xD88e7D30f7548B7a7C6BFE513629724916449e6D
Arg [1] : _stakingToken (address): 0xAAF448d30F01b429FB6e7F9AF6A8FF66e694F312
Arg [2] : _rewardSymbols (string[]): USH
Arg [3] : _rewardTokens (address[]): 0xE60779CC1b2c1d0580611c526a8DF0E3f870EC48
Arg [4] : _rewardManagers (address[]): 0xD88e7D30f7548B7a7C6BFE513629724916449e6D
Arg [5] : _rewardRates (uint256[]): 800000000000000000

-----Encoded View---------------
16 Constructor Arguments found :
Arg [0] : 000000000000000000000000d88e7d30f7548b7a7c6bfe513629724916449e6d
Arg [1] : 000000000000000000000000aaf448d30f01b429fb6e7f9af6a8ff66e694f312
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [5] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [9] : 5553480000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [11] : 000000000000000000000000e60779cc1b2c1d0580611c526a8df0e3f870ec48
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [13] : 000000000000000000000000d88e7d30f7548b7a7c6bfe513629724916449e6d
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [15] : 0000000000000000000000000000000000000000000000000b1a2bc2ec500000


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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