ETH Price: $2,360.31 (+1.39%)

Contract

0x50066C4e8C7cD99EBda536cDC9746E9e60112018
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Unstake116847402021-01-19 8:48:421333 days ago1611046122IN
0x50066C4e...e60112018
0 ETH0.0194084100
Unstake116313172021-01-11 3:58:321341 days ago1610337512IN
0x50066C4e...e60112018
0 ETH0.09153132448
Unstake115704152021-01-01 19:45:201350 days ago1609530320IN
0x50066C4e...e60112018
0 ETH0.0083767541
Unstake114410272020-12-12 23:14:321370 days ago1607814872IN
0x50066C4e...e60112018
0 ETH0.0033709316.5
Unstake114410132020-12-12 23:10:351370 days ago1607814635IN
0x50066C4e...e60112018
0 ETH0.0034730817
Stake114408862020-12-12 22:41:341370 days ago1607812894IN
0x50066C4e...e60112018
0 ETH0.0118843841
Stake114215642020-12-09 23:04:131373 days ago1607555053IN
0x50066C4e...e60112018
0 ETH0.0119550248
Unstake114215292020-12-09 22:56:441373 days ago1607554604IN
0x50066C4e...e60112018
0 ETH0.0129978248
Unstake114194382020-12-09 15:13:241373 days ago1607526804IN
0x50066C4e...e60112018
0 ETH0.0118500358
Unstake113814362020-12-03 19:00:021379 days ago1607022002IN
0x50066C4e...e60112018
0 ETH0.0058400730
Stake113754872020-12-02 21:15:281380 days ago1606943728IN
0x50066C4e...e60112018
0 ETH0.0072465725
Stake112487762020-11-13 10:21:221400 days ago1605262882IN
0x50066C4e...e60112018
0 ETH0.0145658353
Stake112344802020-11-11 5:43:221402 days ago1605073402IN
0x50066C4e...e60112018
0 ETH0.008717235
Stake112327842020-11-10 23:35:041402 days ago1605051304IN
0x50066C4e...e60112018
0 ETH0.0081859531
Unstake112305252020-11-10 15:16:201402 days ago1605021380IN
0x50066C4e...e60112018
0 ETH0.0145043771
Unstake112279442020-11-10 5:27:501403 days ago1604986070IN
0x50066C4e...e60112018
0 ETH0.005127325.1
Stake112279022020-11-10 5:20:251403 days ago1604985625IN
0x50066C4e...e60112018
0 ETH0.0103976637
Unstake112040962020-11-06 13:34:481407 days ago1604669688IN
0x50066C4e...e60112018
0 ETH0.0065789730
Unstake112018442020-11-06 5:19:161407 days ago1604639956IN
0x50066C4e...e60112018
0 ETH0.0081714840.00000145
Unstake111988832020-11-05 18:36:361407 days ago1604601396IN
0x50066C4e...e60112018
0 ETH0.02321988120
Unstake111970052020-11-05 11:42:561408 days ago1604576576IN
0x50066C4e...e60112018
0 ETH0.0072360733
Stake111960232020-11-05 8:14:571408 days ago1604564097IN
0x50066C4e...e60112018
0 ETH0.0072459725
Unstake111915292020-11-04 15:40:391408 days ago1604504439IN
0x50066C4e...e60112018
0 ETH0.0083737941
Stake111915132020-11-04 15:37:561408 days ago1604504276IN
0x50066C4e...e60112018
0 ETH0.0112392840.00000145
Unstake111890602020-11-04 6:23:421409 days ago1604471022IN
0x50066C4e...e60112018
0 ETH0.0270764100
View all transactions

Latest 3 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
111652972020-10-31 14:49:231413 days ago1604155763
0x50066C4e...e60112018
 Contract Creation0 ETH
111652972020-10-31 14:49:231413 days ago1604155763
0x50066C4e...e60112018
 Contract Creation0 ETH
111652972020-10-31 14:49:231413 days ago1604155763
0x50066C4e...e60112018
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenGeyser

Compiler Version
v0.5.17+commit.d19bba13

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-10-31
*/

pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;


/**
 *Submitted for verification at Etherscan.io on 2020-09-23
*/
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
 * @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;
    }
}

// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.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);
}

// File: openzeppelin-solidity/contracts/GSN/Context.sol
/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

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

// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        _owner = _msgSender();
        emit OwnershipTransferred(address(0), _owner);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(isOwner(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _owner;
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// File: contracts/IStaking.sol
/**
 * @title Staking interface, as defined by EIP-900.
 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-900.md
 */
contract IStaking {
    event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
    event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);

    function stake(uint256 amount, bytes calldata data) external;
    function stakeFor(address user, uint256 amount, bytes calldata data) external;
    function unstake(uint256 amount, bytes calldata data) external;
    function totalStakedFor(address addr) public view returns (uint256);
    function totalStaked() public view returns (uint256);
    function token() external view returns (address);

    /**
     * @return False. This application does not support staking history.
     */
    function supportsHistory() external pure returns (bool) {
        return false;
    }
}

// File: contracts/TokenPool.sol
/**
 * @title A simple holder of tokens.
 * This is a simple contract to hold tokens. It's useful in the case where a separate contract
 * needs to hold multiple distinct pools of the same token.
 */
contract TokenPool is Ownable {
    IERC20 public token;

    constructor(IERC20 _token) public {
        token = _token;
    }

    function balance() public view returns (uint256) {
        return token.balanceOf(address(this));
    }

    function transfer(address to, uint256 value) external onlyOwner returns (bool) {
        return token.transfer(to, value);
    }

    function rescueFunds(address tokenToRescue, address to, uint256 amount) external onlyOwner returns (bool) {
        require(address(token) != tokenToRescue, 'TokenPool: Cannot claim token held by the contract');

        return IERC20(tokenToRescue).transfer(to, amount);
    }
}

// File: contracts/TokenGeyser.sol
/**
 * @title Token Geyser
 * @dev A smart-contract based mechanism to distribute tokens over time, inspired loosely by
 *      Compound and Uniswap.
 *
 *      Distribution tokens are added to a locked pool in the contract and become unlocked over time
 *      according to a once-configurable unlock schedule. Once unlocked, they are available to be
 *      claimed by users.
 *
 *      A user may deposit tokens to accrue ownership share over the unlocked pool. This owner share
 *      is a function of the number of tokens deposited as well as the length of time deposited.
 *      Specifically, a user's share of the currently-unlocked pool equals their "deposit-seconds"
 *      divided by the global "deposit-seconds". This aligns the new token distribution with long
 *      term supporters of the project, addressing one of the major drawbacks of simple airdrops.
 *
 *      More background and motivation available at:
 *      https://github.com/ampleforth/RFCs/blob/master/RFCs/rfc-1.md
 */
contract TokenGeyser is IStaking, Ownable {
    using SafeMath for uint256;

    event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
    event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
    event TokensClaimed(address indexed user, uint256 amount);
    event TokensLocked(uint256 amount, uint256 durationSec, uint256 total);
    // amount: Unlocked tokens, total: Total locked tokens
    event TokensUnlocked(uint256 amount, uint256 total);

    TokenPool private _stakingPool;
    TokenPool private _unlockedPool;
    TokenPool private _lockedPool;

    //
    // Time-bonus params
    //
    uint256 public constant BONUS_DECIMALS = 2;
    uint256 public startBonus = 0;
    uint256 public bonusPeriodSec = 0;

    //
    // Global accounting state
    //
    uint256 public totalLockedShares = 0;
    uint256 public totalStakingShares = 0;
    uint256 private _totalStakingShareSeconds = 0;
    uint256 private _lastAccountingTimestampSec = now;
    uint256 private _maxUnlockSchedules = 0;
    uint256 private _initialSharesPerToken = 0;

    //
    // User accounting state
    //
    // Represents a single stake for a user. A user may have multiple.
    struct Stake {
        uint256 stakingShares;
        uint256 timestampSec;
    }

    // Caches aggregated values from the User->Stake[] map to save computation.
    // If lastAccountingTimestampSec is 0, there's no entry for that user.
    struct UserTotals {
        uint256 stakingShares;
        uint256 stakingShareSeconds;
        uint256 lastAccountingTimestampSec;
    }

    // Aggregated staking values per user
    mapping(address => UserTotals) private _userTotals;

    // The collection of stakes for each user. Ordered by timestamp, earliest to latest.
    mapping(address => Stake[]) private _userStakes;

    //
    // Locked/Unlocked Accounting state
    //
    struct UnlockSchedule {
        uint256 initialLockedShares;
        uint256 unlockedShares;
        uint256 lastUnlockTimestampSec;
        uint256 endAtSec;
        uint256 durationSec;
    }

    UnlockSchedule[] public unlockSchedules;

    /**
     * @param stakingToken The token users deposit as stake.
     * @param distributionToken The token users receive as they unstake.
     * @param maxUnlockSchedules Max number of unlock stages, to guard against hitting gas limit.
     * @param startBonus_ Starting time bonus, BONUS_DECIMALS fixed point.
     *                    e.g. 25% means user gets 25% of max distribution tokens.
     * @param bonusPeriodSec_ Length of time for bonus to increase linearly to max.
     * @param initialSharesPerToken Number of shares to mint per staking token on first stake.
     */
    constructor(IERC20 stakingToken, IERC20 distributionToken, uint256 maxUnlockSchedules,
                uint256 startBonus_, uint256 bonusPeriodSec_, uint256 initialSharesPerToken) public {
        // The start bonus must be some fraction of the max. (i.e. <= 100%)
        require(startBonus_ <= 10**BONUS_DECIMALS, 'TokenGeyser: start bonus too high');
        // If no period is desired, instead set startBonus = 100%
        // and bonusPeriod to a small value like 1sec.
        require(bonusPeriodSec_ != 0, 'TokenGeyser: bonus period is zero');
        require(initialSharesPerToken > 0, 'TokenGeyser: initialSharesPerToken is zero');

        _stakingPool = new TokenPool(stakingToken);
        _unlockedPool = new TokenPool(distributionToken);
        _lockedPool = new TokenPool(distributionToken);
        startBonus = startBonus_;
        bonusPeriodSec = bonusPeriodSec_;
        _maxUnlockSchedules = maxUnlockSchedules;
        _initialSharesPerToken = initialSharesPerToken;
    }

    /**
     * @return The token users deposit as stake.
     */
    function getStakingToken() public view returns (IERC20) {
        return _stakingPool.token();
    }

    /**
     * @return The token users receive as they unstake.
     */
    function getDistributionToken() public view returns (IERC20) {
        assert(_unlockedPool.token() == _lockedPool.token());
        return _unlockedPool.token();
    }

    /**
     * @dev Transfers amount of deposit tokens from the user.
     * @param amount Number of deposit tokens to stake.
     * @param data Not used.
     */
    function stake(uint256 amount, bytes calldata data) external {
        _stakeFor(msg.sender, msg.sender, amount);
    }

    /**
     * @dev Transfers amount of deposit tokens from the caller on behalf of user.
     * @param user User address who gains credit for this stake operation.
     * @param amount Number of deposit tokens to stake.
     * @param data Not used.
     */
    function stakeFor(address user, uint256 amount, bytes calldata data) external {
        _stakeFor(msg.sender, user, amount);
    }

    /**
     * @dev Private implementation of staking methods.
     * @param staker User address who deposits tokens to stake.
     * @param beneficiary User address who gains credit for this stake operation.
     * @param amount Number of deposit tokens to stake.
     */
    function _stakeFor(address staker, address beneficiary, uint256 amount) private {
        require(amount > 0, 'TokenGeyser: stake amount is zero');
        require(beneficiary != address(0), 'TokenGeyser: beneficiary is zero address');
        require(totalStakingShares == 0 || totalStaked() > 0,
                'TokenGeyser: Invalid state. Staking shares exist, but no staking tokens do');

        uint256 mintedStakingShares = (totalStakingShares > 0)
            ? totalStakingShares.mul(amount).div(totalStaked())
            : amount.mul(_initialSharesPerToken);
        require(mintedStakingShares > 0, 'TokenGeyser: Stake amount is too small');

        updateAccounting();

        // 1. User Accounting
        UserTotals storage totals = _userTotals[beneficiary];
        totals.stakingShares = totals.stakingShares.add(mintedStakingShares);
        totals.lastAccountingTimestampSec = now;

        Stake memory newStake = Stake(mintedStakingShares, now);
        _userStakes[beneficiary].push(newStake);

        // 2. Global Accounting
        totalStakingShares = totalStakingShares.add(mintedStakingShares);
        // Already set in updateAccounting()
        // _lastAccountingTimestampSec = now;

        // interactions
        require(_stakingPool.token().transferFrom(staker, address(_stakingPool), amount),
            'TokenGeyser: transfer into staking pool failed');

        emit Staked(beneficiary, amount, totalStakedFor(beneficiary), "");
    }

    /**
     * @dev Unstakes a certain amount of previously deposited tokens. User also receives their
     * alotted number of distribution tokens.
     * @param amount Number of deposit tokens to unstake / withdraw.
     * @param data Not used.
     */
    function unstake(uint256 amount, bytes calldata data) external {
        _unstake(amount);
    }

    /**
     * @param amount Number of deposit tokens to unstake / withdraw.
     * @return The total number of distribution tokens that would be rewarded.
     */
    function unstakeQuery(uint256 amount) public returns (uint256) {
        return _unstake(amount);
    }

    /**
     * @dev Unstakes a certain amount of previously deposited tokens. User also receives their
     * alotted number of distribution tokens.
     * @param amount Number of deposit tokens to unstake / withdraw.
     * @return The total number of distribution tokens rewarded.
     */
    function _unstake(uint256 amount) private returns (uint256) {
        updateAccounting();

        // checks
        require(amount > 0, 'TokenGeyser: unstake amount is zero');
        require(totalStakedFor(msg.sender) >= amount,
            'TokenGeyser: unstake amount is greater than total user stakes');
        uint256 stakingSharesToBurn = totalStakingShares.mul(amount).div(totalStaked());
        require(stakingSharesToBurn > 0, 'TokenGeyser: Unable to unstake amount this small');

        // 1. User Accounting
        UserTotals storage totals = _userTotals[msg.sender];
        Stake[] storage accountStakes = _userStakes[msg.sender];

        // Redeem from most recent stake and go backwards in time.
        uint256 stakingShareSecondsToBurn = 0;
        uint256 sharesLeftToBurn = stakingSharesToBurn;
        uint256 rewardAmount = 0;
        while (sharesLeftToBurn > 0) {
            Stake storage lastStake = accountStakes[accountStakes.length - 1];
            uint256 stakeTimeSec = now.sub(lastStake.timestampSec);
            uint256 newStakingShareSecondsToBurn = 0;
            if (lastStake.stakingShares <= sharesLeftToBurn) {
                // fully redeem a past stake
                newStakingShareSecondsToBurn = lastStake.stakingShares.mul(stakeTimeSec);
                rewardAmount = computeNewReward(rewardAmount, newStakingShareSecondsToBurn, stakeTimeSec);
                stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn);
                sharesLeftToBurn = sharesLeftToBurn.sub(lastStake.stakingShares);
                accountStakes.length--;
            } else {
                // partially redeem a past stake
                newStakingShareSecondsToBurn = sharesLeftToBurn.mul(stakeTimeSec);
                rewardAmount = computeNewReward(rewardAmount, newStakingShareSecondsToBurn, stakeTimeSec);
                stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn);
                lastStake.stakingShares = lastStake.stakingShares.sub(sharesLeftToBurn);
                sharesLeftToBurn = 0;
            }
        }
        totals.stakingShareSeconds = totals.stakingShareSeconds.sub(stakingShareSecondsToBurn);
        totals.stakingShares = totals.stakingShares.sub(stakingSharesToBurn);
        // Already set in updateAccounting
        // totals.lastAccountingTimestampSec = now;

        // 2. Global Accounting
        _totalStakingShareSeconds = _totalStakingShareSeconds.sub(stakingShareSecondsToBurn);
        totalStakingShares = totalStakingShares.sub(stakingSharesToBurn);
        // Already set in updateAccounting
        // _lastAccountingTimestampSec = now;

        // interactions
        require(_stakingPool.transfer(msg.sender, amount),
            'TokenGeyser: transfer out of staking pool failed');
        require(_unlockedPool.transfer(msg.sender, rewardAmount),
            'TokenGeyser: transfer out of unlocked pool failed');

        emit Unstaked(msg.sender, amount, totalStakedFor(msg.sender), "");
        emit TokensClaimed(msg.sender, rewardAmount);

        require(totalStakingShares == 0 || totalStaked() > 0,
                "TokenGeyser: Error unstaking. Staking shares exist, but no staking tokens do");
        return rewardAmount;
    }

    /**
     * @dev Applies an additional time-bonus to a distribution amount. This is necessary to
     *      encourage long-term deposits instead of constant unstake/restakes.
     *      The bonus-multiplier is the result of a linear function that starts at startBonus and
     *      ends at 100% over bonusPeriodSec, then stays at 100% thereafter.
     * @param currentRewardTokens The current number of distribution tokens already alotted for this
     *                            unstake op. Any bonuses are already applied.
     * @param stakingShareSeconds The stakingShare-seconds that are being burned for new
     *                            distribution tokens.
     * @param stakeTimeSec Length of time for which the tokens were staked. Needed to calculate
     *                     the time-bonus.
     * @return Updated amount of distribution tokens to award, with any bonus included on the
     *         newly added tokens.
     */
    function computeNewReward(uint256 currentRewardTokens,
                                uint256 stakingShareSeconds,
                                uint256 stakeTimeSec) private view returns (uint256) {

        uint256 newRewardTokens =
            totalUnlocked()
            .mul(stakingShareSeconds)
            .div(_totalStakingShareSeconds);

        if (stakeTimeSec >= bonusPeriodSec) {
            return currentRewardTokens.add(newRewardTokens);
        }

        uint256 oneHundredPct = 10**BONUS_DECIMALS;
        uint256 bonusedReward =
            startBonus
            .add(oneHundredPct.sub(startBonus).mul(stakeTimeSec).div(bonusPeriodSec))
            .mul(newRewardTokens)
            .div(oneHundredPct);
        return currentRewardTokens.add(bonusedReward);
    }

    /**
     * @param addr The user to look up staking information for.
     * @return The number of staking tokens deposited for addr.
     */
    function totalStakedFor(address addr) public view returns (uint256) {
        return totalStakingShares > 0 ?
            totalStaked().mul(_userTotals[addr].stakingShares).div(totalStakingShares) : 0;
    }

    /**
     * @return The total number of deposit tokens staked globally, by all users.
     */
    function totalStaked() public view returns (uint256) {
        return _stakingPool.balance();
    }

    /**
     * @dev Note that this application has a staking token as well as a distribution token, which
     * may be different. This function is required by EIP-900.
     * @return The deposit token used for staking.
     */
    function token() external view returns (address) {
        return address(getStakingToken());
    }

    /**
     * @dev A globally callable function to update the accounting state of the system.
     *      Global state and state for the caller are updated.
     * @return [0] balance of the locked pool
     * @return [1] balance of the unlocked pool
     * @return [2] caller's staking share seconds
     * @return [3] global staking share seconds
     * @return [4] Rewards caller has accumulated, optimistically assumes max time-bonus.
     * @return [5] block timestamp
     */
    function updateAccounting() public returns (
        uint256, uint256, uint256, uint256, uint256, uint256) {

        unlockTokens();

        // Global accounting
        uint256 newStakingShareSeconds =
            now
            .sub(_lastAccountingTimestampSec)
            .mul(totalStakingShares);
        _totalStakingShareSeconds = _totalStakingShareSeconds.add(newStakingShareSeconds);
        _lastAccountingTimestampSec = now;

        // User Accounting
        UserTotals storage totals = _userTotals[msg.sender];
        uint256 newUserStakingShareSeconds =
            now
            .sub(totals.lastAccountingTimestampSec)
            .mul(totals.stakingShares);
        totals.stakingShareSeconds =
            totals.stakingShareSeconds
            .add(newUserStakingShareSeconds);
        totals.lastAccountingTimestampSec = now;

        uint256 totalUserRewards = (_totalStakingShareSeconds > 0)
            ? totalUnlocked().mul(totals.stakingShareSeconds).div(_totalStakingShareSeconds)
            : 0;

        return (
            totalLocked(),
            totalUnlocked(),
            totals.stakingShareSeconds,
            _totalStakingShareSeconds,
            totalUserRewards,
            now
        );
    }

    /**
     * @return Total number of locked distribution tokens.
     */
    function totalLocked() public view returns (uint256) {
        return _lockedPool.balance();
    }

    /**
     * @return Total number of unlocked distribution tokens.
     */
    function totalUnlocked() public view returns (uint256) {
        return _unlockedPool.balance();
    }

    /**
     * @return Number of unlock schedules.
     */
    function unlockScheduleCount() public view returns (uint256) {
        return unlockSchedules.length;
    }

    /**
     * @dev This funcion allows the contract owner to add more locked distribution tokens, along
     *      with the associated "unlock schedule". These locked tokens immediately begin unlocking
     *      linearly over the duraction of durationSec timeframe.
     * @param amount Number of distribution tokens to lock. These are transferred from the caller.
     * @param durationSec Length of time to linear unlock the tokens.
     */
    function lockTokens(uint256 amount, uint256 durationSec) external onlyOwner {
        require(unlockSchedules.length < _maxUnlockSchedules,
            'TokenGeyser: reached maximum unlock schedules');

        // Update lockedTokens amount before using it in computations after.
        updateAccounting();

        uint256 lockedTokens = totalLocked();
        uint256 mintedLockedShares = (lockedTokens > 0)
            ? totalLockedShares.mul(amount).div(lockedTokens)
            : amount.mul(_initialSharesPerToken);

        UnlockSchedule memory schedule;
        schedule.initialLockedShares = mintedLockedShares;
        schedule.lastUnlockTimestampSec = now;
        schedule.endAtSec = now.add(durationSec);
        schedule.durationSec = durationSec;
        unlockSchedules.push(schedule);

        totalLockedShares = totalLockedShares.add(mintedLockedShares);

        require(_lockedPool.token().transferFrom(msg.sender, address(_lockedPool), amount),
            'TokenGeyser: transfer into locked pool failed');
        emit TokensLocked(amount, durationSec, totalLocked());
    }

    /**
     * @dev Moves distribution tokens from the locked pool to the unlocked pool, according to the
     *      previously defined unlock schedules. Publicly callable.
     * @return Number of newly unlocked distribution tokens.
     */
    function unlockTokens() public returns (uint256) {
        uint256 unlockedTokens = 0;
        uint256 lockedTokens = totalLocked();

        if (totalLockedShares == 0) {
            unlockedTokens = lockedTokens;
        } else {
            uint256 unlockedShares = 0;
            for (uint256 s = 0; s < unlockSchedules.length; s++) {
                unlockedShares = unlockedShares.add(unlockScheduleShares(s));
            }
            unlockedTokens = unlockedShares.mul(lockedTokens).div(totalLockedShares);
            totalLockedShares = totalLockedShares.sub(unlockedShares);
        }

        if (unlockedTokens > 0) {
            require(_lockedPool.transfer(address(_unlockedPool), unlockedTokens),
                'TokenGeyser: transfer out of locked pool failed');
            emit TokensUnlocked(unlockedTokens, totalLocked());
        }

        return unlockedTokens;
    }

    /**
     * @dev Returns the number of unlockable shares from a given schedule. The returned value
     *      depends on the time since the last unlock. This function updates schedule accounting,
     *      but does not actually transfer any tokens.
     * @param s Index of the unlock schedule.
     * @return The number of unlocked shares.
     */
    function unlockScheduleShares(uint256 s) private returns (uint256) {
        UnlockSchedule storage schedule = unlockSchedules[s];

        if(schedule.unlockedShares >= schedule.initialLockedShares) {
            return 0;
        }

        uint256 sharesToUnlock = 0;
        // Special case to handle any leftover dust from integer division
        if (now >= schedule.endAtSec) {
            sharesToUnlock = (schedule.initialLockedShares.sub(schedule.unlockedShares));
            schedule.lastUnlockTimestampSec = schedule.endAtSec;
        } else {
            sharesToUnlock = now.sub(schedule.lastUnlockTimestampSec)
                .mul(schedule.initialLockedShares)
                .div(schedule.durationSec);
            schedule.lastUnlockTimestampSec = now;
        }

        schedule.unlockedShares = schedule.unlockedShares.add(sharesToUnlock);
        return sharesToUnlock;
    }

    /**
     * @dev Lets the owner rescue funds air-dropped to the staking pool.
     * @param tokenToRescue Address of the token to be rescued.
     * @param to Address to which the rescued funds are to be sent.
     * @param amount Amount of tokens to be rescued.
     * @return Transfer success.
     */
    function rescueFundsFromStakingPool(address tokenToRescue, address to, uint256 amount)
        public onlyOwner returns (bool) {

        return _stakingPool.rescueFunds(tokenToRescue, to, amount);
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"stakingToken","type":"address"},{"internalType":"contract IERC20","name":"distributionToken","type":"address"},{"internalType":"uint256","name":"maxUnlockSchedules","type":"uint256"},{"internalType":"uint256","name":"startBonus_","type":"uint256"},{"internalType":"uint256","name":"bonusPeriodSec_","type":"uint256"},{"internalType":"uint256","name":"initialSharesPerToken","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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":"total","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"durationSec","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"total","type":"uint256"}],"name":"TokensLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"total","type":"uint256"}],"name":"TokensUnlocked","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":"total","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Unstaked","type":"event"},{"constant":true,"inputs":[],"name":"BONUS_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"bonusPeriodSec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getDistributionToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getStakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"durationSec","type":"uint256"}],"name":"lockTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"tokenToRescue","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueFundsFromStakingPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"stake","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"stakeFor","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"startBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"supportsHistory","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalLockedShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"totalStakedFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalStakingShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalUnlocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"unlockScheduleCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"unlockSchedules","outputs":[{"internalType":"uint256","name":"initialLockedShares","type":"uint256"},{"internalType":"uint256","name":"unlockedShares","type":"uint256"},{"internalType":"uint256","name":"lastUnlockTimestampSec","type":"uint256"},{"internalType":"uint256","name":"endAtSec","type":"uint256"},{"internalType":"uint256","name":"durationSec","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unlockTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"unstake","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstakeQuery","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"updateAccounting","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405260006004556000600555600060065560006007556000600855426009556000600a556000600b553480156200003857600080fd5b5060405162002bce38038062002bce833981810160405260c08110156200005e57600080fd5b508051602082015160408301516060840151608085015160a0909501519394929391929091620000966001600160e01b03620002d616565b600080546001600160a01b0319166001600160a01b03928316178082556040519216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36064831115620001205760405162461bcd60e51b815260040180806020018281038252602181526020018062002b626021913960400191505060405180910390fd5b816200015e5760405162461bcd60e51b815260040180806020018281038252602181526020018062002bad6021913960400191505060405180910390fd5b600081116200019f5760405162461bcd60e51b815260040180806020018281038252602a81526020018062002b83602a913960400191505060405180910390fd5b85604051620001ae90620002da565b6001600160a01b03909116815260405190819003602001906000f080158015620001dc573d6000803e3d6000fd5b50600180546001600160a01b0319166001600160a01b039290921691909117905560405185906200020d90620002da565b6001600160a01b03909116815260405190819003602001906000f0801580156200023b573d6000803e3d6000fd5b50600280546001600160a01b0319166001600160a01b039290921691909117905560405185906200026c90620002da565b6001600160a01b03909116815260405190819003602001906000f0801580156200029a573d6000803e3d6000fd5b50600380546001600160a01b0319166001600160a01b0392909216919091179055600492909255600555600a91909155600b5550620002e89050565b3390565b610736806200242c83390190565b61213480620002f86000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c80637c6aa6f4116100f95780639f9106d111610097578063c8fd6ed011610071578063c8fd6ed014610485578063f2fde38b146104fc578063f968f49314610522578063fc0c546a1461052a576101a9565b80639f9106d11461046d578063a779d08014610475578063c7ae20071461047d576101a9565b806386805dd1116100d357806386805dd11461041d57806389158d8e1461043a5780638da5cb5b1461045d5780638f32d59b14610465576101a9565b80637c6aa6f414610405578063817b1cd21461040d57806381c39bec14610415576101a9565b80634b341aed116101665780635c94bcb2116101405780635c94bcb2146103a55780637033e4a6146103ed57806370c6a17e146103f5578063715018a6146103fd576101a9565b80634b341aed1461032d57806356891412146103535780635a72bbef1461035b576101a9565b80630e89439b146101ae5780630ef96356146102275780631dc27fde146102ac57806322c12b84146102c657806338b45fde146102ea578063494347e7146102f2575b600080fd5b610225600480360360408110156101c457600080fd5b813591908101906040810160208201356401000000008111156101e657600080fd5b8201836020820111156101f857600080fd5b8035906020019184600183028401116401000000008311171561021a57600080fd5b509092509050610532565b005b6102256004803603606081101561023d57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561026d57600080fd5b82018360208201111561027f57600080fd5b803590602001918460018302840111640100000000831117156102a157600080fd5b509092509050610542565b6102b4610553565b60408051918252519081900360200190f35b6102ce610558565b604080516001600160a01b039092168252519081900360200190f35b6102b46106ce565b6102fa6106d4565b604080519687526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b6102b46004803603602081101561034357600080fd5b50356001600160a01b03166107e0565b6102b4610827565b6103916004803603606081101561037157600080fd5b506001600160a01b0381358116916020810135909116906040013561086c565b604080519115158252519081900360200190f35b6103c2600480360360208110156103bb57600080fd5b5035610949565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b610391610987565b6102b461098c565b610225610992565b6102b4610a23565b6102b4610a29565b6102b4610a6e565b6102b46004803603602081101561043357600080fd5b5035610a74565b6102256004803603604081101561045057600080fd5b5080359060200135610a7f565b6102ce610dfd565b610391610e0c565b6102ce610e30565b6102b4610e75565b6102b4610eba565b6102256004803603604081101561049b57600080fd5b813591908101906040810160208201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050610ec0565b6102256004803603602081101561051257600080fd5b50356001600160a01b0316610ec9565b6102b4610f1c565b6102ce6110b0565b61053d3333856110bf565b505050565b61054d3385856110bf565b50505050565b600281565b60035460408051637e062a3560e11b815290516000926001600160a01b03169163fc0c546a916004808301926020929190829003018186803b15801561059d57600080fd5b505afa1580156105b1573d6000803e3d6000fd5b505050506040513d60208110156105c757600080fd5b505160025460408051637e062a3560e11b815290516001600160a01b03938416939092169163fc0c546a91600480820192602092909190829003018186803b15801561061257600080fd5b505afa158015610626573d6000803e3d6000fd5b505050506040513d602081101561063c57600080fd5b50516001600160a01b03161461064e57fe5b600260009054906101000a90046001600160a01b03166001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561069c57600080fd5b505afa1580156106b0573d6000803e3d6000fd5b505050506040513d60208110156106c657600080fd5b505190505b90565b60045481565b6000806000806000806106e5610f1c565b50600061070f6007546107036009544261145a90919063ffffffff16565b9063ffffffff6114a516565b600854909150610725908263ffffffff6114fe16565b600855426009819055336000908152600c6020526040812080546002820154919361075a92610703919063ffffffff61145a16565b6001830154909150610772908263ffffffff6114fe16565b600183015542600283015560085460009061078e5760006107b0565b6107b06008546107a48560010154610703610e75565b9063ffffffff61155816565b90506107ba610827565b6107c2610e75565b600190940154600854919c949b509950975095504294509092505050565b600080600754116107f257600061081f565b6007546001600160a01b0383166000908152600c602052604090205461081f91906107a490610703610a29565b90505b919050565b600354604080516316d3df1560e31b815290516000926001600160a01b03169163b69ef8a8916004808301926020929190829003018186803b15801561069c57600080fd5b6000610876610e0c565b6108b5576040805162461bcd60e51b81526020600482018190526024820152600080516020612039833981519152604482015290519081900360640190fd5b60015460408051631b32b81560e21b81526001600160a01b03878116600483015286811660248301526044820186905291519190921691636ccae0549160648083019260209291908290030181600087803b15801561091357600080fd5b505af1158015610927573d6000803e3d6000fd5b505050506040513d602081101561093d57600080fd5b505190505b9392505050565b600e818154811061095657fe5b6000918252602090912060059091020180546001820154600283015460038401546004909401549294509092909185565b600090565b60075481565b61099a610e0c565b6109d9576040805162461bcd60e51b81526020600482018190526024820152600080516020612039833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60055481565b600154604080516316d3df1560e31b815290516000926001600160a01b03169163b69ef8a8916004808301926020929190829003018186803b15801561069c57600080fd5b60065481565b600061081f8261159a565b610a87610e0c565b610ac6576040805162461bcd60e51b81526020600482018190526024820152600080516020612039833981519152604482015290519081900360640190fd5b600a54600e5410610b085760405162461bcd60e51b815260040180806020018281038252602d8152602001806120a3602d913960400191505060405180910390fd5b610b106106d4565b5050505050506000610b20610827565b90506000808211610b4457600b54610b3f90859063ffffffff6114a516565b610b5d565b610b5d826107a4866006546114a590919063ffffffff16565b9050610b67611d5a565b8181524260408201819052610b82908563ffffffff6114fe16565b6060820190815260808201858152600e805460018101825560009190915283517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd60059092029182015560208401517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fe82015560408401517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3ff82015591517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c400830155517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c40190910155600654610c7790836114fe565b60065560035460408051637e062a3560e11b815290516001600160a01b039092169163fc0c546a91600480820192602092909190829003018186803b158015610cbf57600080fd5b505afa158015610cd3573d6000803e3d6000fd5b505050506040513d6020811015610ce957600080fd5b5051600354604080516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101899052905191909216916323b872dd9160648083019260209291908290030181600087803b158015610d4757600080fd5b505af1158015610d5b573d6000803e3d6000fd5b505050506040513d6020811015610d7157600080fd5b5051610dae5760405162461bcd60e51b815260040180806020018281038252602d815260200180611dec602d913960400191505060405180910390fd5b7ff346961af4c52f314df1b45964746280fe409abb959d4a2458d58f79408b1fe88585610dd9610827565b60408051938452602084019290925282820152519081900360600190a15050505050565b6000546001600160a01b031690565b600080546001600160a01b0316610e21611a69565b6001600160a01b031614905090565b60015460408051637e062a3560e11b815290516000926001600160a01b03169163fc0c546a916004808301926020929190829003018186803b15801561069c57600080fd5b600254604080516316d3df1560e31b815290516000926001600160a01b03169163b69ef8a8916004808301926020929190829003018186803b15801561069c57600080fd5b600e5490565b61054d8361159a565b610ed1610e0c565b610f10576040805162461bcd60e51b81526020600482018190526024820152600080516020612039833981519152604482015290519081900360640190fd5b610f1981611a6d565b50565b60008080610f28610827565b905060065460001415610f3d57809150610fa1565b6000805b600e54811015610f6e57610f64610f5782611b0d565b839063ffffffff6114fe16565b9150600101610f41565b50600654610f86906107a4838563ffffffff6114a516565b600654909350610f9c908263ffffffff61145a16565b600655505b81156110aa576003546002546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018690529051919092169163a9059cbb9160448083019260209291908290030181600087803b15801561100057600080fd5b505af1158015611014573d6000803e3d6000fd5b505050506040513d602081101561102a57600080fd5b50516110675760405162461bcd60e51b815260040180806020018281038252602f815260200180611f28602f913960400191505060405180910390fd5b7f2e444eb379b177e88ce0649c6110a3b01099f03e297127919dd5e3b63a761a9c82611091610827565b6040805192835260208301919091528051918290030190a15b50905090565b60006110ba610e30565b905090565b600081116110fe5760405162461bcd60e51b8152600401808060200182810382526021815260200180611ff76021913960400191505060405180910390fd5b6001600160a01b0382166111435760405162461bcd60e51b8152600401808060200182810382526028815260200180611edd6028913960400191505060405180910390fd5b600754158061115957506000611157610a29565b115b6111945760405162461bcd60e51b815260040180806020018281038252604a815260200180612059604a913960600191505060405180910390fd5b600080600754116111b857600b546111b390839063ffffffff6114a516565b6111d6565b6111d66111c3610a29565b6007546107a4908563ffffffff6114a516565b9050600081116112175760405162461bcd60e51b8152600401808060200182810382526026815260200180611f576026913960400191505060405180910390fd5b61121f6106d4565b505050506001600160a01b0385166000908152600c60205260409020805490925061124b9150836114fe565b815542600282015561125b611d89565b506040805180820182528381524260208083019182526001600160a01b0388166000908152600d825293842080546001818101835591865291909420835160029092020190815590519201919091556007546112bd908463ffffffff6114fe16565b60075560015460408051637e062a3560e11b815290516001600160a01b039092169163fc0c546a91600480820192602092909190829003018186803b15801561130557600080fd5b505afa158015611319573d6000803e3d6000fd5b505050506040513d602081101561132f57600080fd5b5051600154604080516323b872dd60e01b81526001600160a01b038a81166004830152928316602482015260448101889052905191909216916323b872dd9160648083019260209291908290030181600087803b15801561138f57600080fd5b505af11580156113a3573d6000803e3d6000fd5b505050506040513d60208110156113b957600080fd5b50516113f65760405162461bcd60e51b815260040180806020018281038252602e815260200180611fc9602e913960400191505060405180910390fd5b846001600160a01b03167fc65e53b88159e7d2c0fc12a0600072e28ae53ff73b4c1715369c30f1609351428561142b886107e0565b6040805192835260208301919091526060828201819052600090830152519081900360a00190a2505050505050565b600061149c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bd0565b90505b92915050565b6000826114b45750600061149f565b828202828482816114c157fe5b041461149c5760405162461bcd60e51b81526004018080602001828103825260218152602001806120186021913960400191505060405180910390fd5b60008282018381101561149c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061149c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c67565b60006115a46106d4565b505050505050600082116115e95760405162461bcd60e51b8152600401808060200182810382526023815260200180611f056023913960400191505060405180910390fd5b816115f3336107e0565b10156116305760405162461bcd60e51b815260040180806020018281038252603d815260200180611ea0603d913960400191505060405180910390fd5b600061165061163d610a29565b6007546107a4908663ffffffff6114a516565b9050600081116116915760405162461bcd60e51b8152600401808060200182810382526030815260200180611e196030913960400191505060405180910390fd5b336000908152600c60209081526040808320600d9092528220909183815b81156117b4578354600090859060001981019081106116ca57fe5b9060005260206000209060020201905060006116f382600101544261145a90919063ffffffff16565b82549091506000908510611761578254611713908363ffffffff6114a516565b9050611720848284611ccc565b9350611732868263ffffffff6114fe16565b835490965061174890869063ffffffff61145a16565b875490955061175b886000198301611da3565b506117ac565b611771858363ffffffff6114a516565b905061177e848284611ccc565b9350611790868263ffffffff6114fe16565b83549096506117a5908663ffffffff61145a16565b8355600094505b5050506116af565b60018501546117c9908463ffffffff61145a16565b600186015584546117e0908763ffffffff61145a16565b85556008546117f5908463ffffffff61145a16565b60085560075461180b908763ffffffff61145a16565b6007556001546040805163a9059cbb60e01b8152336004820152602481018b905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561186257600080fd5b505af1158015611876573d6000803e3d6000fd5b505050506040513d602081101561188c57600080fd5b50516118c95760405162461bcd60e51b81526004018080602001828103825260308152602001806120d06030913960400191505060405180910390fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561191d57600080fd5b505af1158015611931573d6000803e3d6000fd5b505050506040513d602081101561194757600080fd5b50516119845760405162461bcd60e51b8152600401808060200182810382526031815260200180611e6f6031913960400191505060405180910390fd5b337faf01bfc8475df280aca00b578c4a948e6d95700f0db8c13365240f7f973c8754896119b0836107e0565b6040805192835260208301919091526060828201819052600090830152519081900360a00190a260408051828152905133917f896e034966eaaf1adc54acc0f257056febbd300c9e47182cf761982cf1f5e430919081900360200190a26007541580611a2357506000611a21610a29565b115b611a5e5760405162461bcd60e51b815260040180806020018281038252604c815260200180611f7d604c913960600191505060405180910390fd5b979650505050505050565b3390565b6001600160a01b038116611ab25760405162461bcd60e51b8152600401808060200182810382526026815260200180611e496026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080600e8381548110611b1d57fe5b906000526020600020906005020190508060000154816001015410611b46576000915050610822565b60038101546000904210611b7b5760018201548254611b6a9163ffffffff61145a16565b600383015460028401559050611bab565b611ba282600401546107a4846000015461070386600201544261145a90919063ffffffff16565b42600284015590505b6001820154611bc0908263ffffffff6114fe16565b6001909201919091559050919050565b60008184841115611c5f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c24578181015183820152602001611c0c565b50505050905090810190601f168015611c515780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611cb65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611c24578181015183820152602001611c0c565b506000838581611cc257fe5b0495945050505050565b600080611ce16008546107a486610703610e75565b90506005548310611d0457611cfc858263ffffffff6114fe16565b915050610942565b60006002600a0a90506000611d48826107a485610703611d396005546107a48c6107036004548c61145a90919063ffffffff16565b6004549063ffffffff6114fe16565b9050611a5e878263ffffffff6114fe16565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b604051806040016040528060008152602001600081525090565b81548183558181111561053d5760008381526020902061053d916106cb9160029182028101918502015b80821115611de75760008082556001820155600201611dcd565b509056fe546f6b656e4765797365723a207472616e7366657220696e746f206c6f636b656420706f6f6c206661696c6564546f6b656e4765797365723a20556e61626c6520746f20756e7374616b6520616d6f756e74207468697320736d616c6c4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373546f6b656e4765797365723a207472616e73666572206f7574206f6620756e6c6f636b656420706f6f6c206661696c6564546f6b656e4765797365723a20756e7374616b6520616d6f756e742069732067726561746572207468616e20746f74616c2075736572207374616b6573546f6b656e4765797365723a2062656e6566696369617279206973207a65726f2061646472657373546f6b656e4765797365723a20756e7374616b6520616d6f756e74206973207a65726f546f6b656e4765797365723a207472616e73666572206f7574206f66206c6f636b656420706f6f6c206661696c6564546f6b656e4765797365723a205374616b6520616d6f756e7420697320746f6f20736d616c6c546f6b656e4765797365723a204572726f7220756e7374616b696e672e205374616b696e67207368617265732065786973742c20627574206e6f207374616b696e6720746f6b656e7320646f546f6b656e4765797365723a207472616e7366657220696e746f207374616b696e6720706f6f6c206661696c6564546f6b656e4765797365723a207374616b6520616d6f756e74206973207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572546f6b656e4765797365723a20496e76616c69642073746174652e205374616b696e67207368617265732065786973742c20627574206e6f207374616b696e6720746f6b656e7320646f546f6b656e4765797365723a2072656163686564206d6178696d756d20756e6c6f636b207363686564756c6573546f6b656e4765797365723a207472616e73666572206f7574206f66207374616b696e6720706f6f6c206661696c6564a265627a7a72315820fafe7eda7751b214d3cf837ad7dbdb5aba27cbc55ee9bdcd196b0a8624413cf964736f6c63430005110032608060405234801561001057600080fd5b506040516107363803806107368339818101604052602081101561003357600080fd5b50516100466001600160e01b036100b316565b600080546001600160a01b0319166001600160a01b03928316178082556040519216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600180546001600160a01b0319166001600160a01b03929092169190911790556100b7565b3390565b610670806100c66000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063a9059cbb1161005b578063a9059cbb1461010d578063b69ef8a814610139578063f2fde38b14610153578063fc0c546a1461017957610088565b80636ccae0541461008d578063715018a6146100d75780638da5cb5b146100e15780638f32d59b14610105575b600080fd5b6100c3600480360360608110156100a357600080fd5b506001600160a01b03813581169160208101359091169060400135610181565b604080519115158252519081900360200190f35b6100df6102ab565b005b6100e961033c565b604080516001600160a01b039092168252519081900360200190f35b6100c361034b565b6100c36004803603604081101561012357600080fd5b506001600160a01b03813516906020013561036f565b610141610441565b60408051918252519081900360200190f35b6100df6004803603602081101561016957600080fd5b50356001600160a01b03166104bd565b6100e9610510565b600061018b61034b565b6101ca576040805162461bcd60e51b815260206004820181905260248201526000805160206105ea833981519152604482015290519081900360640190fd5b6001546001600160a01b03858116911614156102175760405162461bcd60e51b815260040180806020018281038252603281526020018061060a6032913960400191505060405180910390fd5b836001600160a01b031663a9059cbb84846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561027757600080fd5b505af115801561028b573d6000803e3d6000fd5b505050506040513d60208110156102a157600080fd5b5051949350505050565b6102b361034b565b6102f2576040805162461bcd60e51b815260206004820181905260248201526000805160206105ea833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600080546001600160a01b031661036061051f565b6001600160a01b031614905090565b600061037961034b565b6103b8576040805162461bcd60e51b815260206004820181905260248201526000805160206105ea833981519152604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561040e57600080fd5b505af1158015610422573d6000803e3d6000fd5b505050506040513d602081101561043857600080fd5b50519392505050565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561048c57600080fd5b505afa1580156104a0573d6000803e3d6000fd5b505050506040513d60208110156104b657600080fd5b5051905090565b6104c561034b565b610504576040805162461bcd60e51b815260206004820181905260248201526000805160206105ea833981519152604482015290519081900360640190fd5b61050d81610523565b50565b6001546001600160a01b031681565b3390565b6001600160a01b0381166105685760405162461bcd60e51b81526004018080602001828103825260268152602001806105c46026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572546f6b656e506f6f6c3a2043616e6e6f7420636c61696d20746f6b656e2068656c642062792074686520636f6e7472616374a265627a7a723158202ca234c6c862c4282e49d0394d9def20d5716ab9f7f90507152f98278001559064736f6c63430005110032546f6b656e4765797365723a20737461727420626f6e757320746f6f2068696768546f6b656e4765797365723a20696e697469616c536861726573506572546f6b656e206973207a65726f546f6b656e4765797365723a20626f6e757320706572696f64206973207a65726f000000000000000000000000ff40805f099e74716d72c4ad03a8a8713c8b1940000000000000000000000000e5b0792400a47af372486704eda0f1799ee83f54000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000076a70000000000000000000000000000000000000000000000000000000000000f4240

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80637c6aa6f4116100f95780639f9106d111610097578063c8fd6ed011610071578063c8fd6ed014610485578063f2fde38b146104fc578063f968f49314610522578063fc0c546a1461052a576101a9565b80639f9106d11461046d578063a779d08014610475578063c7ae20071461047d576101a9565b806386805dd1116100d357806386805dd11461041d57806389158d8e1461043a5780638da5cb5b1461045d5780638f32d59b14610465576101a9565b80637c6aa6f414610405578063817b1cd21461040d57806381c39bec14610415576101a9565b80634b341aed116101665780635c94bcb2116101405780635c94bcb2146103a55780637033e4a6146103ed57806370c6a17e146103f5578063715018a6146103fd576101a9565b80634b341aed1461032d57806356891412146103535780635a72bbef1461035b576101a9565b80630e89439b146101ae5780630ef96356146102275780631dc27fde146102ac57806322c12b84146102c657806338b45fde146102ea578063494347e7146102f2575b600080fd5b610225600480360360408110156101c457600080fd5b813591908101906040810160208201356401000000008111156101e657600080fd5b8201836020820111156101f857600080fd5b8035906020019184600183028401116401000000008311171561021a57600080fd5b509092509050610532565b005b6102256004803603606081101561023d57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561026d57600080fd5b82018360208201111561027f57600080fd5b803590602001918460018302840111640100000000831117156102a157600080fd5b509092509050610542565b6102b4610553565b60408051918252519081900360200190f35b6102ce610558565b604080516001600160a01b039092168252519081900360200190f35b6102b46106ce565b6102fa6106d4565b604080519687526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b6102b46004803603602081101561034357600080fd5b50356001600160a01b03166107e0565b6102b4610827565b6103916004803603606081101561037157600080fd5b506001600160a01b0381358116916020810135909116906040013561086c565b604080519115158252519081900360200190f35b6103c2600480360360208110156103bb57600080fd5b5035610949565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b610391610987565b6102b461098c565b610225610992565b6102b4610a23565b6102b4610a29565b6102b4610a6e565b6102b46004803603602081101561043357600080fd5b5035610a74565b6102256004803603604081101561045057600080fd5b5080359060200135610a7f565b6102ce610dfd565b610391610e0c565b6102ce610e30565b6102b4610e75565b6102b4610eba565b6102256004803603604081101561049b57600080fd5b813591908101906040810160208201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050610ec0565b6102256004803603602081101561051257600080fd5b50356001600160a01b0316610ec9565b6102b4610f1c565b6102ce6110b0565b61053d3333856110bf565b505050565b61054d3385856110bf565b50505050565b600281565b60035460408051637e062a3560e11b815290516000926001600160a01b03169163fc0c546a916004808301926020929190829003018186803b15801561059d57600080fd5b505afa1580156105b1573d6000803e3d6000fd5b505050506040513d60208110156105c757600080fd5b505160025460408051637e062a3560e11b815290516001600160a01b03938416939092169163fc0c546a91600480820192602092909190829003018186803b15801561061257600080fd5b505afa158015610626573d6000803e3d6000fd5b505050506040513d602081101561063c57600080fd5b50516001600160a01b03161461064e57fe5b600260009054906101000a90046001600160a01b03166001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561069c57600080fd5b505afa1580156106b0573d6000803e3d6000fd5b505050506040513d60208110156106c657600080fd5b505190505b90565b60045481565b6000806000806000806106e5610f1c565b50600061070f6007546107036009544261145a90919063ffffffff16565b9063ffffffff6114a516565b600854909150610725908263ffffffff6114fe16565b600855426009819055336000908152600c6020526040812080546002820154919361075a92610703919063ffffffff61145a16565b6001830154909150610772908263ffffffff6114fe16565b600183015542600283015560085460009061078e5760006107b0565b6107b06008546107a48560010154610703610e75565b9063ffffffff61155816565b90506107ba610827565b6107c2610e75565b600190940154600854919c949b509950975095504294509092505050565b600080600754116107f257600061081f565b6007546001600160a01b0383166000908152600c602052604090205461081f91906107a490610703610a29565b90505b919050565b600354604080516316d3df1560e31b815290516000926001600160a01b03169163b69ef8a8916004808301926020929190829003018186803b15801561069c57600080fd5b6000610876610e0c565b6108b5576040805162461bcd60e51b81526020600482018190526024820152600080516020612039833981519152604482015290519081900360640190fd5b60015460408051631b32b81560e21b81526001600160a01b03878116600483015286811660248301526044820186905291519190921691636ccae0549160648083019260209291908290030181600087803b15801561091357600080fd5b505af1158015610927573d6000803e3d6000fd5b505050506040513d602081101561093d57600080fd5b505190505b9392505050565b600e818154811061095657fe5b6000918252602090912060059091020180546001820154600283015460038401546004909401549294509092909185565b600090565b60075481565b61099a610e0c565b6109d9576040805162461bcd60e51b81526020600482018190526024820152600080516020612039833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60055481565b600154604080516316d3df1560e31b815290516000926001600160a01b03169163b69ef8a8916004808301926020929190829003018186803b15801561069c57600080fd5b60065481565b600061081f8261159a565b610a87610e0c565b610ac6576040805162461bcd60e51b81526020600482018190526024820152600080516020612039833981519152604482015290519081900360640190fd5b600a54600e5410610b085760405162461bcd60e51b815260040180806020018281038252602d8152602001806120a3602d913960400191505060405180910390fd5b610b106106d4565b5050505050506000610b20610827565b90506000808211610b4457600b54610b3f90859063ffffffff6114a516565b610b5d565b610b5d826107a4866006546114a590919063ffffffff16565b9050610b67611d5a565b8181524260408201819052610b82908563ffffffff6114fe16565b6060820190815260808201858152600e805460018101825560009190915283517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd60059092029182015560208401517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fe82015560408401517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3ff82015591517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c400830155517fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c40190910155600654610c7790836114fe565b60065560035460408051637e062a3560e11b815290516001600160a01b039092169163fc0c546a91600480820192602092909190829003018186803b158015610cbf57600080fd5b505afa158015610cd3573d6000803e3d6000fd5b505050506040513d6020811015610ce957600080fd5b5051600354604080516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101899052905191909216916323b872dd9160648083019260209291908290030181600087803b158015610d4757600080fd5b505af1158015610d5b573d6000803e3d6000fd5b505050506040513d6020811015610d7157600080fd5b5051610dae5760405162461bcd60e51b815260040180806020018281038252602d815260200180611dec602d913960400191505060405180910390fd5b7ff346961af4c52f314df1b45964746280fe409abb959d4a2458d58f79408b1fe88585610dd9610827565b60408051938452602084019290925282820152519081900360600190a15050505050565b6000546001600160a01b031690565b600080546001600160a01b0316610e21611a69565b6001600160a01b031614905090565b60015460408051637e062a3560e11b815290516000926001600160a01b03169163fc0c546a916004808301926020929190829003018186803b15801561069c57600080fd5b600254604080516316d3df1560e31b815290516000926001600160a01b03169163b69ef8a8916004808301926020929190829003018186803b15801561069c57600080fd5b600e5490565b61054d8361159a565b610ed1610e0c565b610f10576040805162461bcd60e51b81526020600482018190526024820152600080516020612039833981519152604482015290519081900360640190fd5b610f1981611a6d565b50565b60008080610f28610827565b905060065460001415610f3d57809150610fa1565b6000805b600e54811015610f6e57610f64610f5782611b0d565b839063ffffffff6114fe16565b9150600101610f41565b50600654610f86906107a4838563ffffffff6114a516565b600654909350610f9c908263ffffffff61145a16565b600655505b81156110aa576003546002546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018690529051919092169163a9059cbb9160448083019260209291908290030181600087803b15801561100057600080fd5b505af1158015611014573d6000803e3d6000fd5b505050506040513d602081101561102a57600080fd5b50516110675760405162461bcd60e51b815260040180806020018281038252602f815260200180611f28602f913960400191505060405180910390fd5b7f2e444eb379b177e88ce0649c6110a3b01099f03e297127919dd5e3b63a761a9c82611091610827565b6040805192835260208301919091528051918290030190a15b50905090565b60006110ba610e30565b905090565b600081116110fe5760405162461bcd60e51b8152600401808060200182810382526021815260200180611ff76021913960400191505060405180910390fd5b6001600160a01b0382166111435760405162461bcd60e51b8152600401808060200182810382526028815260200180611edd6028913960400191505060405180910390fd5b600754158061115957506000611157610a29565b115b6111945760405162461bcd60e51b815260040180806020018281038252604a815260200180612059604a913960600191505060405180910390fd5b600080600754116111b857600b546111b390839063ffffffff6114a516565b6111d6565b6111d66111c3610a29565b6007546107a4908563ffffffff6114a516565b9050600081116112175760405162461bcd60e51b8152600401808060200182810382526026815260200180611f576026913960400191505060405180910390fd5b61121f6106d4565b505050506001600160a01b0385166000908152600c60205260409020805490925061124b9150836114fe565b815542600282015561125b611d89565b506040805180820182528381524260208083019182526001600160a01b0388166000908152600d825293842080546001818101835591865291909420835160029092020190815590519201919091556007546112bd908463ffffffff6114fe16565b60075560015460408051637e062a3560e11b815290516001600160a01b039092169163fc0c546a91600480820192602092909190829003018186803b15801561130557600080fd5b505afa158015611319573d6000803e3d6000fd5b505050506040513d602081101561132f57600080fd5b5051600154604080516323b872dd60e01b81526001600160a01b038a81166004830152928316602482015260448101889052905191909216916323b872dd9160648083019260209291908290030181600087803b15801561138f57600080fd5b505af11580156113a3573d6000803e3d6000fd5b505050506040513d60208110156113b957600080fd5b50516113f65760405162461bcd60e51b815260040180806020018281038252602e815260200180611fc9602e913960400191505060405180910390fd5b846001600160a01b03167fc65e53b88159e7d2c0fc12a0600072e28ae53ff73b4c1715369c30f1609351428561142b886107e0565b6040805192835260208301919091526060828201819052600090830152519081900360a00190a2505050505050565b600061149c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bd0565b90505b92915050565b6000826114b45750600061149f565b828202828482816114c157fe5b041461149c5760405162461bcd60e51b81526004018080602001828103825260218152602001806120186021913960400191505060405180910390fd5b60008282018381101561149c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061149c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c67565b60006115a46106d4565b505050505050600082116115e95760405162461bcd60e51b8152600401808060200182810382526023815260200180611f056023913960400191505060405180910390fd5b816115f3336107e0565b10156116305760405162461bcd60e51b815260040180806020018281038252603d815260200180611ea0603d913960400191505060405180910390fd5b600061165061163d610a29565b6007546107a4908663ffffffff6114a516565b9050600081116116915760405162461bcd60e51b8152600401808060200182810382526030815260200180611e196030913960400191505060405180910390fd5b336000908152600c60209081526040808320600d9092528220909183815b81156117b4578354600090859060001981019081106116ca57fe5b9060005260206000209060020201905060006116f382600101544261145a90919063ffffffff16565b82549091506000908510611761578254611713908363ffffffff6114a516565b9050611720848284611ccc565b9350611732868263ffffffff6114fe16565b835490965061174890869063ffffffff61145a16565b875490955061175b886000198301611da3565b506117ac565b611771858363ffffffff6114a516565b905061177e848284611ccc565b9350611790868263ffffffff6114fe16565b83549096506117a5908663ffffffff61145a16565b8355600094505b5050506116af565b60018501546117c9908463ffffffff61145a16565b600186015584546117e0908763ffffffff61145a16565b85556008546117f5908463ffffffff61145a16565b60085560075461180b908763ffffffff61145a16565b6007556001546040805163a9059cbb60e01b8152336004820152602481018b905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561186257600080fd5b505af1158015611876573d6000803e3d6000fd5b505050506040513d602081101561188c57600080fd5b50516118c95760405162461bcd60e51b81526004018080602001828103825260308152602001806120d06030913960400191505060405180910390fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561191d57600080fd5b505af1158015611931573d6000803e3d6000fd5b505050506040513d602081101561194757600080fd5b50516119845760405162461bcd60e51b8152600401808060200182810382526031815260200180611e6f6031913960400191505060405180910390fd5b337faf01bfc8475df280aca00b578c4a948e6d95700f0db8c13365240f7f973c8754896119b0836107e0565b6040805192835260208301919091526060828201819052600090830152519081900360a00190a260408051828152905133917f896e034966eaaf1adc54acc0f257056febbd300c9e47182cf761982cf1f5e430919081900360200190a26007541580611a2357506000611a21610a29565b115b611a5e5760405162461bcd60e51b815260040180806020018281038252604c815260200180611f7d604c913960600191505060405180910390fd5b979650505050505050565b3390565b6001600160a01b038116611ab25760405162461bcd60e51b8152600401808060200182810382526026815260200180611e496026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080600e8381548110611b1d57fe5b906000526020600020906005020190508060000154816001015410611b46576000915050610822565b60038101546000904210611b7b5760018201548254611b6a9163ffffffff61145a16565b600383015460028401559050611bab565b611ba282600401546107a4846000015461070386600201544261145a90919063ffffffff16565b42600284015590505b6001820154611bc0908263ffffffff6114fe16565b6001909201919091559050919050565b60008184841115611c5f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c24578181015183820152602001611c0c565b50505050905090810190601f168015611c515780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611cb65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611c24578181015183820152602001611c0c565b506000838581611cc257fe5b0495945050505050565b600080611ce16008546107a486610703610e75565b90506005548310611d0457611cfc858263ffffffff6114fe16565b915050610942565b60006002600a0a90506000611d48826107a485610703611d396005546107a48c6107036004548c61145a90919063ffffffff16565b6004549063ffffffff6114fe16565b9050611a5e878263ffffffff6114fe16565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b604051806040016040528060008152602001600081525090565b81548183558181111561053d5760008381526020902061053d916106cb9160029182028101918502015b80821115611de75760008082556001820155600201611dcd565b509056fe546f6b656e4765797365723a207472616e7366657220696e746f206c6f636b656420706f6f6c206661696c6564546f6b656e4765797365723a20556e61626c6520746f20756e7374616b6520616d6f756e74207468697320736d616c6c4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373546f6b656e4765797365723a207472616e73666572206f7574206f6620756e6c6f636b656420706f6f6c206661696c6564546f6b656e4765797365723a20756e7374616b6520616d6f756e742069732067726561746572207468616e20746f74616c2075736572207374616b6573546f6b656e4765797365723a2062656e6566696369617279206973207a65726f2061646472657373546f6b656e4765797365723a20756e7374616b6520616d6f756e74206973207a65726f546f6b656e4765797365723a207472616e73666572206f7574206f66206c6f636b656420706f6f6c206661696c6564546f6b656e4765797365723a205374616b6520616d6f756e7420697320746f6f20736d616c6c546f6b656e4765797365723a204572726f7220756e7374616b696e672e205374616b696e67207368617265732065786973742c20627574206e6f207374616b696e6720746f6b656e7320646f546f6b656e4765797365723a207472616e7366657220696e746f207374616b696e6720706f6f6c206661696c6564546f6b656e4765797365723a207374616b6520616d6f756e74206973207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572546f6b656e4765797365723a20496e76616c69642073746174652e205374616b696e67207368617265732065786973742c20627574206e6f207374616b696e6720746f6b656e7320646f546f6b656e4765797365723a2072656163686564206d6178696d756d20756e6c6f636b207363686564756c6573546f6b656e4765797365723a207472616e73666572206f7574206f66207374616b696e6720706f6f6c206661696c6564a265627a7a72315820fafe7eda7751b214d3cf837ad7dbdb5aba27cbc55ee9bdcd196b0a8624413cf964736f6c63430005110032

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

000000000000000000000000ff40805f099e74716d72c4ad03a8a8713c8b1940000000000000000000000000e5b0792400a47af372486704eda0f1799ee83f54000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000076a70000000000000000000000000000000000000000000000000000000000000f4240

-----Decoded View---------------
Arg [0] : stakingToken (address): 0xff40805f099E74716d72C4ad03A8A8713C8b1940
Arg [1] : distributionToken (address): 0xe5B0792400a47Af372486704EDA0f1799EE83F54
Arg [2] : maxUnlockSchedules (uint256): 90
Arg [3] : startBonus_ (uint256): 25
Arg [4] : bonusPeriodSec_ (uint256): 7776000
Arg [5] : initialSharesPerToken (uint256): 1000000

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000ff40805f099e74716d72c4ad03a8a8713c8b1940
Arg [1] : 000000000000000000000000e5b0792400a47af372486704eda0f1799ee83f54
Arg [2] : 000000000000000000000000000000000000000000000000000000000000005a
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [4] : 000000000000000000000000000000000000000000000000000000000076a700
Arg [5] : 00000000000000000000000000000000000000000000000000000000000f4240


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ 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.