false
false

Contract Address Details

0x27CCB1F9Abc27F6A92DC4bD6b974Cd152419813c

Contract Name
XOLE
Creator
0x68b6f4–0b8438 at 0x95f9cd–2f9ee3
Implementation
0x0000000000000000000000000000000000000000
Balance
0 KCS ( )
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
45214060
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
XOLE




Optimization enabled
true
Compiler version
v0.7.6+commit.7338295f




Optimization runs
200
Verified at
2022-03-31T11:47:37.978412Z

project:/contracts/XOLE.sol

// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./lib/SignedSafeMath128.sol";
import "./Adminable.sol";
import "./DelegateInterface.sol";
import "./XOLEInterface.sol";
import "./DelegateInterface.sol";
import "./lib/DexData.sol";


/// @title Voting Escrowed Token
/// @author OpenLeverage
/// @notice Lock OLE to get time and amount weighted xOLE
/// @dev The weight in this implementation is linear, and lock cannot be more than maxtime (4 years)
contract XOLE is DelegateInterface, Adminable, XOLEInterface, XOLEStorage, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using SignedSafeMath128 for int128;
    using DexData for bytes;

    /* We cannot really do block numbers per se b/c slope is per time, not per block
    and per block could be fairly bad b/c Ethereum changes blocktimes.
    What we can do is to extrapolate ***At functions
    */
    constructor() {
    }

    /// @notice initialize proxy contract
    /// @dev This function is not supposed to call multiple times. All configs can be set through other functions.
    /// @param _oleToken Address of contract _oleToken.
    /// @param _dexAgg Contract DexAggregatorDelegator.
    /// @param _devFundRatio Ratio of token reserved to Dev team
    /// @param _dev Address of Dev team.
    function initialize(
        address _oleToken,
        DexAggregatorInterface _dexAgg,
        uint _devFundRatio,
        address _dev
    ) public {
        require(msg.sender == admin, "Not admin");
        require(_oleToken != address(0), "_oleToken address cannot be 0");
        require(_dev != address(0), "_dev address cannot be 0");
        oleToken = IERC20(_oleToken);
        devFundRatio = _devFundRatio;
        dev = _dev;
        dexAgg = _dexAgg;
    }

    function setDexAgg(DexAggregatorInterface newDexAgg) external override onlyAdmin {
        dexAgg = newDexAgg;
    }

    // Fees sharing functions  =====

    function withdrawDevFund() external override {
        require(msg.sender == dev, "Dev only");
        require(devFund != 0, "No fund to withdraw");
        uint toSend = devFund;
        devFund = 0;
        oleToken.transfer(dev, toSend);
    }

    /// @dev swap feeCollected to reward token
    function convertToSharingToken(uint amount, uint minBuyAmount, bytes memory dexData) external override onlyAdminOrDeveloper() {
        require(totalSupply > 0, "Can't share without locked OLE");
        address fromToken;
        address toToken;
        // If no swapping, then assuming OLE reward distribution
        if (dexData.length == 0) {
            fromToken = address(oleToken);
        }
        // Not OLE
        else {
            if (dexData.isUniV2Class()) {
                address[] memory path = dexData.toUniV2Path();
                fromToken = path[0];
                toToken = path[path.length - 1];
            } else {
                DexData.V3PoolData[] memory path = dexData.toUniV3Path();
                fromToken = path[0].tokenA;
                toToken = path[path.length - 1].tokenB;
            }
        }
        uint newReward;
        if (fromToken == address(oleToken)) {
            uint claimable = totalRewarded.sub(withdrewReward);
            uint toShare = oleToken.balanceOf(address(this)).sub(claimable).sub(totalLocked).sub(devFund);
            require(toShare >= amount, 'Exceed OLE balance');
            newReward = toShare;
        } else {
            require(IERC20(fromToken).balanceOf(address(this)) >= amount, "Exceed available balance");
            (IERC20(fromToken)).safeApprove(address(dexAgg), 0);
            (IERC20(fromToken)).safeApprove(address(dexAgg), amount);
            newReward = dexAgg.sellMul(amount, minBuyAmount, dexData);
        }
        //fromToken or toToken equal OLE ,update reward
        if (fromToken == address(oleToken) || toToken == address(oleToken)) {
            uint newDevFund = newReward.mul(devFundRatio).div(10000);
            newReward = newReward.sub(newDevFund);
            devFund = devFund.add(newDevFund);
            totalRewarded = totalRewarded.add(newReward);
            lastUpdateTime = block.timestamp;
            rewardPerTokenStored = rewardPerToken(newReward);
            emit RewardAdded(fromToken, amount, newReward);
        } else {
            emit RewardConvert(fromToken, toToken, amount, newReward);
        }

    }

    /// @notice calculate the amount of token reward
    function earned(address account) external override view returns (uint) {
        return earnedInternal(account);
    }

    function earnedInternal(address account) internal view returns (uint) {
        return (balances[account])
        .mul(rewardPerToken(0).sub(userRewardPerTokenPaid[account]))
        .div(1e18)
        .add(rewards[account]);
    }

    function rewardPerToken(uint newReward) internal view returns (uint) {
        if (totalSupply == 0) {
            return rewardPerTokenStored;
        }

        if (block.timestamp == lastUpdateTime) {
            return rewardPerTokenStored.add(newReward
            .mul(1e18)
            .div(totalSupply));
        } else {
            return rewardPerTokenStored;
        }
    }

    /// @notice transfer rewarded ole to msg.sender
    function withdrawReward() external override {
        uint reward = getReward();
        oleToken.safeTransfer(msg.sender, reward);
        emit RewardPaid(msg.sender, reward);
    }

    function getReward() internal updateReward(msg.sender) returns (uint) {
        uint reward = rewards[msg.sender];
        if (reward > 0) {
            rewards[msg.sender] = 0;
            withdrewReward = withdrewReward.add(reward);
        }
        return reward;
    }

    modifier updateReward(address account) {
        rewardPerTokenStored = rewardPerToken(0);
        rewards[account] = earnedInternal(account);
        userRewardPerTokenPaid[account] = rewardPerTokenStored;
        _;
    }

    /*** Admin Functions ***/
    function setDevFundRatio(uint newRatio) external override onlyAdmin {
        require(newRatio <= 10000);
        devFundRatio = newRatio;
    }

    function setDev(address newDev) external override onlyAdmin {
        dev = newDev;
    }


    function _mint(address account, uint amount) internal {
        totalSupply = totalSupply.add(amount);
        balances[account] = balances[account].add(amount);
        emit Transfer(address(0), account, amount);
        if (delegates[account] == address(0)) {
            delegates[account] = account;
        }
        _moveDelegates(address(0), delegates[account], amount);
        _updateTotalSupplyCheckPoints();
    }

    function _burn(address account) internal {
        uint burnAmount = balances[account];
        totalSupply = totalSupply.sub(burnAmount);
        balances[account] = 0;
        emit Transfer(account, address(0), burnAmount);
        _moveDelegates(delegates[account], address(0), burnAmount);
        _updateTotalSupplyCheckPoints();
    }

    function _updateTotalSupplyCheckPoints() internal {
        uint32 blockNumber = safe32(block.number, "block number exceeds 32 bits");
        if (totalSupplyNumCheckpoints > 0 && totalSupplyCheckpoints[totalSupplyNumCheckpoints - 1].fromBlock == blockNumber) {
            totalSupplyCheckpoints[totalSupplyNumCheckpoints - 1].votes = totalSupply;
        }
        else {
            totalSupplyCheckpoints[totalSupplyNumCheckpoints] = Checkpoint(blockNumber, totalSupply);
            totalSupplyNumCheckpoints = totalSupplyNumCheckpoints + 1;
        }

    }

    function balanceOf(address addr) external view override returns (uint256){
        return balances[addr];
    }

    /// @dev get supply amount by blocknumber
    function totalSupplyAt(uint256 blockNumber) external view returns (uint){
        if (totalSupplyNumCheckpoints == 0) {
            return 0;
        }
        if (totalSupplyCheckpoints[totalSupplyNumCheckpoints - 1].fromBlock <= blockNumber) {
            return totalSupplyCheckpoints[totalSupplyNumCheckpoints - 1].votes;
        }

        // Next check implicit zero balance
        if (totalSupplyCheckpoints[0].fromBlock > blockNumber) {
            return 0;
        }

        uint lower;
        uint upper = totalSupplyNumCheckpoints - 1;
        while (upper > lower) {
            uint center = upper - (upper - lower) / 2;
            // ceil, avoiding overflow
            Checkpoint memory cp = totalSupplyCheckpoints[center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return totalSupplyCheckpoints[lower].votes;
    }

    /// @notice Deposit `_value` tokens for `msg.sender` and lock until `_unlock_time`
    /// @param _value Amount to deposit
    /// @param _unlock_time Epoch time when tokens unlock, rounded down to whole weeks
    function create_lock(uint256 _value, uint256 _unlock_time) external override nonReentrant() {
        // Locktime is rounded down to weeks
        uint256 unlock_time = _unlock_time.div(WEEK).mul(WEEK);
        LockedBalance memory _locked = locked[msg.sender];

        require(_value > 0, "Non zero value");
        require(_locked.amount == 0, "Withdraw old tokens first");
        require(unlock_time > block.timestamp, "Can only lock until time in the future");
        require(unlock_time <= block.timestamp + MAXTIME, "Voting lock can be 4 years max");

        _deposit_for(msg.sender, _value, unlock_time, _locked, CREATE_LOCK_TYPE);
    }

    
    /// @notice Deposit `_value` additional tokens for `msg.sender`
    /// without modifying the unlock time
    /// @param _value Amount of tokens to deposit and add to the lock
    function increase_amount(uint256 _value) external override nonReentrant() {
        LockedBalance memory _locked = locked[msg.sender];
        require(_value > 0, "need non - zero value");
        require(_locked.amount > 0, "No existing lock found");
        require(_locked.end > block.timestamp, "Cannot add to expired lock. Withdraw");
        _deposit_for(msg.sender, _value, 0, _locked, INCREASE_LOCK_AMOUNT);
    }

    /// @notice Extend the unlock time for `msg.sender` to `_unlock_time`
    /// @param _unlock_time New epoch time for unlocking
    function increase_unlock_time(uint256 _unlock_time) external override nonReentrant() {
        LockedBalance memory _locked = locked[msg.sender];
        // Locktime is rounded down to weeks
        uint256 unlock_time = _unlock_time.div(WEEK).mul(WEEK);
        require(_locked.end > block.timestamp, "Lock expired");
        require(_locked.amount > 0, "Nothing is locked");
        require(unlock_time > _locked.end, "Can only increase lock duration");
        require(unlock_time <= block.timestamp + MAXTIME, "Voting lock can be 4 years max");

        _deposit_for(msg.sender, 0, unlock_time, _locked, INCREASE_UNLOCK_TIME);
    }

    /// @notice Deposit and lock tokens for a user
    /// @param _addr User's wallet address
    /// @param _value Amount to deposit
    /// @param unlock_time New time when to unlock the tokens, or 0 if unchanged
    /// @param _locked Previous locked amount / timestamp
    /// @param _type For event only.
    function _deposit_for(address _addr, uint256 _value, uint256 unlock_time, LockedBalance memory _locked, int128 _type) internal updateReward(_addr) {
        uint256 locked_before = totalLocked;
        totalLocked = locked_before.add(_value);
        // Adding to existing lock, or if a lock is expired - creating a new one
        _locked.amount = _locked.amount.add(_value);

        if (unlock_time != 0) {
            _locked.end = unlock_time;
        }
        locked[_addr] = _locked;

        if (_value != 0) {
            require(IERC20(oleToken).transferFrom(msg.sender, address(this), _value));
        }

        uint calExtraValue = _value;
        // only increase unlock time
        if (_value == 0) {
            _burn(_addr);
            calExtraValue = locked[_addr].amount;
        }
        uint weekCount = locked[_addr].end.sub(block.timestamp).div(WEEK);
        if (weekCount > 1) {
            uint extraToken = calExtraValue.mul(oneWeekExtraRaise).mul(weekCount - 1).div(10000);
            _mint(_addr, calExtraValue + extraToken);
        } else {
            _mint(_addr, calExtraValue);
        }
        emit Deposit(_addr, _value, _locked.end, _type, block.timestamp);
    }

    /// @notice Withdraw all tokens for `msg.sender`
    /// @dev Only possible if the lock has expired
    function withdraw() external override nonReentrant() updateReward(msg.sender) {
        LockedBalance memory _locked = locked[msg.sender];
        require(_locked.amount > 0, "Nothing to withdraw");
        require(block.timestamp >= _locked.end, "The lock didn't expire");
        uint256 value = _locked.amount;
        totalLocked = totalLocked.sub(value);
        _locked.end = 0;
        _locked.amount = 0;
        locked[msg.sender] = _locked;
        uint reward = getReward();
        require(IERC20(oleToken).transfer(msg.sender, value.add(reward)));
        _burn(msg.sender);
        emit Withdraw(msg.sender, value, block.timestamp);
        emit RewardPaid(msg.sender, reward);
    }


    /// Delegate votes from `msg.sender` to `delegatee`
    /// @param delegatee The address to delegate votes to
    function delegate(address delegatee) public {
        require(delegatee != address(0), 'delegatee:0x');
        return _delegate(msg.sender, delegatee);
    }

    /// Delegates votes from signatory to `delegatee`
    /// @param delegatee The address to delegate votes to
    /// @param nonce The contract state required to match the signature
    /// @param expiry The time at which to expire the signature
    /// @param v The recovery byte of the signature
    /// @param r Half of the ECDSA signature pair
    /// @param s Half of the ECDSA signature pair
    function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
        delegateBySigInternal(delegatee, nonce, expiry, v, r, s);
    }

    function delegateBySigs(address delegatee, uint[] memory nonce, uint[] memory expiry, uint8[] memory v, bytes32[] memory r, bytes32[] memory s) public {
        require(nonce.length == expiry.length && nonce.length == v.length && nonce.length == r.length && nonce.length == s.length);
        for (uint i = 0; i < nonce.length; i++) {
            (bool success,) = address(this).call(
                abi.encodeWithSelector(XOLE(address(this)).delegateBySig.selector, delegatee, nonce[i], expiry[i], v[i], r[i], s[i])
            );
            if (!success) emit FailedDelegateBySig(delegatee, nonce[i], expiry[i], v[i], r[i], s[i]);
        }
    }

    function delegateBySigInternal(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) internal {
        require(delegatee != address(0), 'delegatee:0x');
        require(block.timestamp <= expiry, "delegateBySig: signature expired");

        bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
        bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "delegateBySig: invalid signature");
        require(nonce == nonces[signatory], "delegateBySig: invalid nonce");

        _delegate(signatory, delegatee);
    }

    /// Gets the current votes balance for `account`
    /// @param account The address to get votes balance
    /// @return The number of current votes for `account`
    function getCurrentVotes(address account) external view returns (uint) {
        uint32 nCheckpoints = numCheckpoints[account];
        return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
    }

    /// Determine the prior number of votes for an account as of a block number
    /// @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
    /// @param account The address of the account to check
    /// @param blockNumber The block number to get the vote balance at
    /// @return The number of votes the account had as of the given block
    function getPriorVotes(address account, uint blockNumber) public view returns (uint) {
        require(blockNumber < block.number, "getPriorVotes:not yet determined");

        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }

        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
            return checkpoints[account][nCheckpoints - 1].votes;
        }

        // Next check implicit zero balance
        if (checkpoints[account][0].fromBlock > blockNumber) {
            return 0;
        }

        uint32 lower;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2;
            // ceil, avoiding overflow
            Checkpoint memory cp = checkpoints[account][center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return checkpoints[account][lower].votes;
    }

    function _delegate(address delegator, address delegatee) internal {
        nonces[delegator]++;
        address currentDelegate = delegates[delegator];
        uint delegatorBalance = balances[delegator];
        delegates[delegator] = delegatee;
        emit DelegateChanged(delegator, currentDelegate, delegatee);
        _moveDelegates(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveDelegates(address srcRep, address dstRep, uint amount) internal {
        if (srcRep != dstRep && amount > 0) {
            if (srcRep != address(0)) {
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
                uint srcRepNew = srcRepOld.sub(amount);
                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
            }

            if (dstRep != address(0)) {
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
                uint dstRepNew = dstRepOld.add(amount);
                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
            }
        }
    }

    function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint oldVotes, uint newVotes) internal {
        uint32 blockNumber = safe32(block.number, "block number exceeds 32 bits");

        if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
            checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
        } else {
            checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
            numCheckpoints[delegatee] = nCheckpoints + 1;
        }

        emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
    }

    function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
        require(n < 2 ** 32, errorMessage);
        return uint32(n);
    }

    function getChainId() internal pure returns (uint) {
        uint256 chainId;
        assembly {chainId := chainid()}
        return chainId;
    }
}
        

@openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
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);
}
          

@openzeppelin/contracts/math/SafeMath.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

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

    /**
     * @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) {
        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, reverting 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) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}
          

@openzeppelin/contracts/token/ERC20/SafeERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for 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");
        }
    }
}
          

@openzeppelin/contracts/utils/Address.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.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);
            }
        }
    }
}
          

@openzeppelin/contracts/utils/ReentrancyGuard.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be 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;
    }
}
          

@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol

pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}
          

project:/contracts/Adminable.sol

// SPDX-License-Identifier: BUSL-1.1


pragma solidity 0.7.6;

abstract contract Adminable {
    address payable public admin;
    address payable public pendingAdmin;
    address payable public developer;

    event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);

    event NewAdmin(address oldAdmin, address newAdmin);
    constructor () {
        developer = msg.sender;
    }

    modifier onlyAdmin() {
        require(msg.sender == admin, "caller must be admin");
        _;
    }
    modifier onlyAdminOrDeveloper() {
        require(msg.sender == admin || msg.sender == developer, "caller must be admin or developer");
        _;
    }

    function setPendingAdmin(address payable newPendingAdmin) external virtual onlyAdmin {
        // Save current value, if any, for inclusion in log
        address oldPendingAdmin = pendingAdmin;
        // Store pendingAdmin with value newPendingAdmin
        pendingAdmin = newPendingAdmin;
        // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
        emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
    }

    function acceptAdmin() external virtual {
        require(msg.sender == pendingAdmin, "only pendingAdmin can accept admin");
        // Save current values for inclusion in log
        address oldAdmin = admin;
        address oldPendingAdmin = pendingAdmin;
        // Store admin with value pendingAdmin
        admin = pendingAdmin;
        // Clear the pending value
        pendingAdmin = address(0);
        emit NewAdmin(oldAdmin, admin);
        emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);
    }

}
          

project:/contracts/DelegateInterface.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;


contract DelegateInterface {
    /**
     * Implementation address for this contract
     */
    address public implementation;

}


          

project:/contracts/XOLEInterface.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;

import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./dex/DexAggregatorInterface.sol";


contract XOLEStorage {

    // EIP-20 token name for this token
    string public constant name = 'xOLE';

    // EIP-20 token symbol for this token
    string public constant symbol = 'xOLE';

    // EIP-20 token decimals for this token
    uint8 public constant decimals = 18;

    // Total number of tokens supply
    uint public totalSupply;

    // Total number of tokens locked
    uint public totalLocked;

    // Official record of token balances for each account
    mapping(address => uint) internal balances;

    mapping(address => LockedBalance) public locked;

    DexAggregatorInterface public dexAgg;

    IERC20 public oleToken;

    struct LockedBalance {
        uint256 amount;
        uint256 end;
    }

    uint constant oneWeekExtraRaise = 208;// 2.08% * 210 = 436% (4 years raise)

    int128 constant DEPOSIT_FOR_TYPE = 0;
    int128 constant CREATE_LOCK_TYPE = 1;
    int128 constant INCREASE_LOCK_AMOUNT = 2;
    int128 constant INCREASE_UNLOCK_TIME = 3;

    uint256 constant WEEK = 7 * 86400;  // all future times are rounded by week
    uint256 constant MAXTIME = 4 * 365 * 86400;  // 4 years
    uint256 constant MULTIPLIER = 10 ** 18;


    // dev team account
    address public dev;

    uint public devFund;

    uint public devFundRatio; // ex. 5000 => 50%

    // user => reward
    mapping(address => uint256) public rewards;

    // useless
    uint public totalStaked;

    // total to shared
    uint public totalRewarded;

    uint public withdrewReward;

    uint public lastUpdateTime;

    uint public rewardPerTokenStored;

    mapping(address => uint256) public userRewardPerTokenPaid;


    // A record of each accounts delegate
    mapping(address => address) public delegates;

    // A checkpoint for marking number of votes from a given block
    struct Checkpoint {
        uint32 fromBlock;
        uint votes;
    }

    mapping(uint256 => Checkpoint) public totalSupplyCheckpoints;

    uint256 public totalSupplyNumCheckpoints;

    // A record of votes checkpoints for each account, by index
    mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;

    // The number of checkpoints for each account
    mapping(address => uint32) public numCheckpoints;

    // The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");

    // The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    // A record of states for signing / validating signatures
    mapping(address => uint) public nonces;

    // An event thats emitted when an account changes its delegate
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    // An event thats emitted when a delegate account's vote balance changes
    event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);


    event RewardAdded(address fromToken, uint convertAmount, uint reward);
    event RewardConvert(address fromToken, address toToken, uint convertAmount, uint returnAmount);

    event Transfer(address indexed from, address indexed to, uint256 value);

    event Deposit (
        address indexed provider,
        uint256 value,
        uint256 indexed locktime,
        int128 type_,
        uint256 ts
    );

    event Withdraw (
        address indexed provider,
        uint256 value,
        uint256 ts
    );

    event Supply (
        uint256 prevSupply,
        uint256 supply
    );

    event RewardPaid (
        address paidTo,
        uint256 amount
    );

    event FailedDelegateBySig(
        address indexed delegatee,
        uint indexed nonce, 
        uint expiry,
        uint8 v, 
        bytes32 r, 
        bytes32 s
    );
}


interface XOLEInterface {

    function convertToSharingToken(uint amount, uint minBuyAmount, bytes memory data) external;

    function withdrawDevFund() external;

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

    function withdrawReward() external;

    /*** Admin Functions ***/

    function setDevFundRatio(uint newRatio) external;

    function setDev(address newDev) external;

    function setDexAgg(DexAggregatorInterface newDexAgg) external;

    // xOLE functions

    function create_lock(uint256 _value, uint256 _unlock_time) external;

    function increase_amount(uint256 _value) external;

    function increase_unlock_time(uint256 _unlock_time) external;

    function withdraw() external;

    function balanceOf(address addr) external view returns (uint256);

}

          

project:/contracts/dex/DexAggregatorInterface.sol

// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";

interface DexAggregatorInterface {

    function sell(address buyToken, address sellToken, uint sellAmount, uint minBuyAmount, bytes memory data) external returns (uint buyAmount);

    function sellMul(uint sellAmount, uint minBuyAmount, bytes memory data) external returns (uint buyAmount);

    function buy(address buyToken, address sellToken, uint24 buyTax, uint24 sellTax, uint buyAmount, uint maxSellAmount, bytes memory data) external returns (uint sellAmount);

    function calBuyAmount(address buyToken, address sellToken, uint24 buyTax, uint24 sellTax, uint sellAmount, bytes memory data) external view returns (uint);

    function calSellAmount(address buyToken, address sellToken, uint24 buyTax, uint24 sellTax, uint buyAmount, bytes memory data) external view returns (uint);

    function getPrice(address desToken, address quoteToken, bytes memory data) external view returns (uint256 price, uint8 decimals);

    function getAvgPrice(address desToken, address quoteToken, uint32 secondsAgo, bytes memory data) external view returns (uint256 price, uint8 decimals, uint256 timestamp);

    //cal current avg price and get history avg price
    function getPriceCAvgPriceHAvgPrice(address desToken, address quoteToken, uint32 secondsAgo, bytes memory dexData) external view returns (uint price, uint cAvgPrice, uint256 hAvgPrice, uint8 decimals, uint256 timestamp);

    function updatePriceOracle(address desToken, address quoteToken, uint32 timeWindow, bytes memory data) external returns(bool);

    function updateV3Observation(address desToken, address quoteToken, bytes memory data) external;

    function setDexInfo(uint8[] memory dexName, IUniswapV2Factory[] memory factoryAddr, uint16[] memory fees) external;
}
          

project:/contracts/lib/DexData.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

/// @dev DexDataFormat addPair = byte(dexID) + bytes3(feeRate) + bytes(arrayLength) + byte3[arrayLength](trasferFeeRate Lpool <-> openlev) 
/// + byte3[arrayLength](transferFeeRate openLev -> Dex) + byte3[arrayLength](Dex -> transferFeeRate openLev)
/// exp: 0x0100000002011170000000011170000000011170000000
/// DexDataFormat dexdata = byte(dexID)+ bytes3(feeRate) + byte(arrayLength) + path
/// uniV2Path = bytes20[arraylength](address)
/// uniV3Path = bytes20(address)+ bytes20[arraylength-1](address + fee)
library DexData {
    // in byte
    uint constant DEX_INDEX = 0;
    uint constant FEE_INDEX = 1;
    uint constant ARRYLENTH_INDEX = 4;
    uint constant TRANSFERFEE_INDEX = 5;
    uint constant PATH_INDEX = 5;
    uint constant FEE_SIZE = 3;
    uint constant ADDRESS_SIZE = 20;
    uint constant NEXT_OFFSET = ADDRESS_SIZE + FEE_SIZE;

    uint8 constant DEX_UNIV2 = 1;
    uint8 constant DEX_UNIV3 = 2;
    uint8 constant DEX_PANCAKE = 3;
    uint8 constant DEX_SUSHI = 4;
    uint8 constant DEX_MDEX = 5;
    uint8 constant DEX_TRADERJOE = 6;
    uint8 constant DEX_SPOOKY = 7;
    uint8 constant DEX_QUICK = 8;
    uint8 constant DEX_SHIBA = 9;
    uint8 constant DEX_APE = 10;
    uint8 constant DEX_PANCAKEV1 = 11;
    uint8 constant DEX_BABY = 12;
    uint8 constant DEX_MOJITO = 13;
    uint8 constant DEX_KU = 14;

    struct V3PoolData {
        address tokenA;
        address tokenB;
        uint24 fee;
    }

    function toDex(bytes memory data) internal pure returns (uint8) {
        require(data.length >= FEE_INDEX, "DexData: toDex wrong data format");
        uint8 temp;
        assembly {
            temp := byte(0, mload(add(data, add(0x20, DEX_INDEX))))
        }
        return temp;
    }

    function toFee(bytes memory data) internal pure returns (uint24) {
        require(data.length >= ARRYLENTH_INDEX, "DexData: toFee wrong data format");
        uint temp;
        assembly {
            temp := mload(add(data, add(0x20, FEE_INDEX)))
        }
        return uint24(temp >> (256 - (ARRYLENTH_INDEX - FEE_INDEX) * 8));
    }

    function toDexDetail(bytes memory data) internal pure returns (uint32) {
        require (data.length >= FEE_INDEX, "DexData: toDexDetail wrong data format");
        if (isUniV2Class(data)){
            uint8 temp;
            assembly {
                temp := byte(0, mload(add(data, add(0x20, DEX_INDEX))))
            }
            return uint32(temp);
        } else {
            uint temp;
            assembly {
                temp := mload(add(data, add(0x20, DEX_INDEX)))
            }
            return uint32(temp >> (256 - ((FEE_SIZE + FEE_INDEX) * 8)));
        }
    }

    function toArrayLength(bytes memory data) internal pure returns(uint8 length){
        require(data.length >= TRANSFERFEE_INDEX, "DexData: toArrayLength wrong data format");

        assembly {
            length := byte(0, mload(add(data, add(0x20, ARRYLENTH_INDEX))))
        }
    }

    // only for add pair
    function toTransferFeeRates(bytes memory data) internal pure returns (uint24[] memory transferFeeRates){
        uint8 length = toArrayLength(data) * 3;
        uint start = TRANSFERFEE_INDEX;

        transferFeeRates = new uint24[](length);
        for (uint i = 0; i < length; i++){
            // use default value
            if (data.length <= start){
                transferFeeRates[i] = 0;
                continue;
            }

            // use input value
            uint temp;
            assembly {
                temp := mload(add(data, add(0x20, start)))
            }

            transferFeeRates[i] = uint24(temp >> (256 - FEE_SIZE * 8));
            start += FEE_SIZE;
        }
    }

    function toUniV2Path(bytes memory data) internal pure returns (address[] memory path) {
        uint8 length = toArrayLength(data);
        uint end =  PATH_INDEX + ADDRESS_SIZE * length;
        require(data.length >= end, "DexData: toUniV2Path wrong data format");

        uint start = PATH_INDEX;
        path = new address[](length);
        for (uint i = 0; i < length; i++) {
            uint startIndex = start + ADDRESS_SIZE * i;
            uint temp;
            assembly {
                temp := mload(add(data, add(0x20, startIndex)))
            }

            path[i] = address(temp >> (256 - ADDRESS_SIZE * 8));
        }
    }

    function isUniV2Class(bytes memory data) internal pure returns(bool){
        return toDex(data) != DEX_UNIV3;
    }

    function toUniV3Path(bytes memory data) internal pure returns (V3PoolData[] memory path) {
        uint8 length = toArrayLength(data);
        uint end = PATH_INDEX + (FEE_SIZE  + ADDRESS_SIZE) * length - FEE_SIZE;
        require(data.length >= end, "DexData: toUniV3Path wrong data format");
        require(length > 1, "DexData: toUniV3Path path too short");

        uint temp;
        uint index = PATH_INDEX;
        path = new V3PoolData[](length - 1);

        for (uint i = 0; i < length - 1; i++) {
            V3PoolData memory pool;

            // get tokenA
            if (i == 0) {
                assembly {
                    temp := mload(add(data, add(0x20, index)))
                }
                pool.tokenA = address(temp >> (256 - ADDRESS_SIZE * 8));
                index += ADDRESS_SIZE;
            }else{
                pool.tokenA = path[i-1].tokenB;
                index += NEXT_OFFSET;
            }

            // get TokenB
            assembly {
                temp := mload(add(data, add(0x20, index)))
            }

            uint tokenBAndFee = temp >> (256 - NEXT_OFFSET * 8);
            pool.tokenB = address(tokenBAndFee >> (FEE_SIZE * 8));
            pool.fee = uint24(tokenBAndFee - (tokenBAndFee << (FEE_SIZE * 8)));

            path[i] = pool;
        }
    }
}
          

project:/contracts/lib/SignedSafeMath128.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

/**
 * @title SignedSafeMath128
 * @dev Signed math operations with safety checks that revert on error.
 */
library SignedSafeMath128 {
    int128 constant private _INT128_MIN = -2**127;

    /**
     * @dev Returns the multiplication of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(int128 a, int128 b) internal pure returns (int128) {
        // 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;
        }

        require(!(a == -1 && b == _INT128_MIN), "SignedSafeMath128: multiplication overflow");

        int128 c = a * b;
        require(c / a == b, "SignedSafeMath128: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two signed 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(int128 a, int128 b) internal pure returns (int128) {
        require(b != 0, "SignedSafeMath128: division by zero");
        require(!(b == -1 && a == _INT128_MIN), "SignedSafeMath128: division overflow");

        int128 c = a / b;
        return c;
    }

    /**
     * @dev Returns the subtraction of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(int128 a, int128 b) internal pure returns (int128) {
        int128 c = a - b;
        require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath128: subtraction overflow");

        return c;
    }

    /**
     * @dev Returns the addition of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(int128 a, int128 b) internal pure returns (int128) {
        int128 c = a + b;
        require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath128: addition overflow");

        return c;
    }
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"DelegateChanged","inputs":[{"type":"address","name":"delegator","internalType":"address","indexed":true},{"type":"address","name":"fromDelegate","internalType":"address","indexed":true},{"type":"address","name":"toDelegate","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"DelegateVotesChanged","inputs":[{"type":"address","name":"delegate","internalType":"address","indexed":true},{"type":"uint256","name":"previousBalance","internalType":"uint256","indexed":false},{"type":"uint256","name":"newBalance","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"provider","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false},{"type":"uint256","name":"locktime","internalType":"uint256","indexed":true},{"type":"int128","name":"type_","internalType":"int128","indexed":false},{"type":"uint256","name":"ts","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FailedDelegateBySig","inputs":[{"type":"address","name":"delegatee","internalType":"address","indexed":true},{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true},{"type":"uint256","name":"expiry","internalType":"uint256","indexed":false},{"type":"uint8","name":"v","internalType":"uint8","indexed":false},{"type":"bytes32","name":"r","internalType":"bytes32","indexed":false},{"type":"bytes32","name":"s","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"NewAdmin","inputs":[{"type":"address","name":"oldAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"NewPendingAdmin","inputs":[{"type":"address","name":"oldPendingAdmin","internalType":"address","indexed":false},{"type":"address","name":"newPendingAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RewardAdded","inputs":[{"type":"address","name":"fromToken","internalType":"address","indexed":false},{"type":"uint256","name":"convertAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"reward","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardConvert","inputs":[{"type":"address","name":"fromToken","internalType":"address","indexed":false},{"type":"address","name":"toToken","internalType":"address","indexed":false},{"type":"uint256","name":"convertAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"returnAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardPaid","inputs":[{"type":"address","name":"paidTo","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Supply","inputs":[{"type":"uint256","name":"prevSupply","internalType":"uint256","indexed":false},{"type":"uint256","name":"supply","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"provider","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false},{"type":"uint256","name":"ts","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DELEGATION_TYPEHASH","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DOMAIN_TYPEHASH","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"admin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"addr","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"fromBlock","internalType":"uint32"},{"type":"uint256","name":"votes","internalType":"uint256"}],"name":"checkpoints","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint32","name":"","internalType":"uint32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"convertToSharingToken","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"minBuyAmount","internalType":"uint256"},{"type":"bytes","name":"dexData","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"create_lock","inputs":[{"type":"uint256","name":"_value","internalType":"uint256"},{"type":"uint256","name":"_unlock_time","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"delegate","inputs":[{"type":"address","name":"delegatee","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"delegateBySig","inputs":[{"type":"address","name":"delegatee","internalType":"address"},{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"uint256","name":"expiry","internalType":"uint256"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"delegateBySigs","inputs":[{"type":"address","name":"delegatee","internalType":"address"},{"type":"uint256[]","name":"nonce","internalType":"uint256[]"},{"type":"uint256[]","name":"expiry","internalType":"uint256[]"},{"type":"uint8[]","name":"v","internalType":"uint8[]"},{"type":"bytes32[]","name":"r","internalType":"bytes32[]"},{"type":"bytes32[]","name":"s","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"delegates","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"dev","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"devFund","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"devFundRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"developer","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract DexAggregatorInterface"}],"name":"dexAgg","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"earned","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCurrentVotes","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPriorVotes","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"blockNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"implementation","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"increase_amount","inputs":[{"type":"uint256","name":"_value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"increase_unlock_time","inputs":[{"type":"uint256","name":"_unlock_time","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_oleToken","internalType":"address"},{"type":"address","name":"_dexAgg","internalType":"contract DexAggregatorInterface"},{"type":"uint256","name":"_devFundRatio","internalType":"uint256"},{"type":"address","name":"_dev","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastUpdateTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"end","internalType":"uint256"}],"name":"locked","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nonces","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"numCheckpoints","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"oleToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"pendingAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPerTokenStored","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewards","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDev","inputs":[{"type":"address","name":"newDev","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDevFundRatio","inputs":[{"type":"uint256","name":"newRatio","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDexAgg","inputs":[{"type":"address","name":"newDexAgg","internalType":"contract DexAggregatorInterface"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPendingAdmin","inputs":[{"type":"address","name":"newPendingAdmin","internalType":"address payable"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalLocked","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalRewarded","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalStaked","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupplyAt","inputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"fromBlock","internalType":"uint32"},{"type":"uint256","name":"votes","internalType":"uint256"}],"name":"totalSupplyCheckpoints","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupplyNumCheckpoints","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userRewardPerTokenPaid","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawDevFund","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawReward","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrewReward","inputs":[]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50600380546001600160a01b031916331790556001601a55613fa0806100376000396000f3fe608060405234801561001057600080fd5b50600436106102f05760003560e01c8063782d6fe11161019d578063c3cda520116100e9578063d8fdb23a116100a2578063e7a324dc1161007c578063e7a324dc146105ca578063eff7a612146105d2578063f1127ed8146105e5578063f851a440146105f8576102f0565b8063d8fdb23a146105a7578063df136d65146105ba578063df589f3a146105c2576102f0565b8063c3cda52014610548578063c885bc581461055b578063c8f33c9114610563578063ca4b208b1461056b578063cbf9fe5f14610573578063d477f05f14610594576102f0565b806395d89b4111610156578063b40f603411610130578063b40f6034146104f9578063b4b5ea5714610501578063b66e4cdf14610514578063be20309414610535576102f0565b806395d89b4114610333578063981b24d0146104de578063aed29d07146104f1576102f0565b8063782d6fe11461048d5780637ecebe00146104a0578063817b1cd2146104b35780638471eb44146104bb5780638b876347146104c357806391cca3db146104d6576102f0565b80634390d2a81161025c578063587cde1e1161021557806364d16ac4116101ef57806364d16ac41461043457806365fc3873146104475780636fcfff451461045a57806370a082311461047a576102f0565b8063587cde1e146104065780635c19a95c146104195780635c60da1b1461042c576102f0565b80634390d2a8146103b557806348b3ec11146103bd5780634957677c146103d05780634dd18bf5146103e357806353e083a8146103f657806356891412146103fe576102f0565b806320606b70116102ae57806320606b701461036d5780632678224714610375578063313ce5671461037d5780633be60f2e146103925780633ccfd60b1461039a5780633e842df5146103a2576102f0565b80628cc262146102f5578063060d83971461031e57806306fdde03146103335780630700037d146103485780630e18b6811461035b57806318160ddd14610365575b600080fd5b610308610303366004613262565b610600565b60405161031591906136b1565b60405180910390f35b610326610613565b60405161031591906135e0565b61033b610622565b6040516103159190613720565b610308610356366004613262565b610642565b610363610654565b005b610308610754565b61030861075a565b61032661077e565b61038561078d565b6040516103159190613dcf565b610308610792565b610363610798565b6103636103b036600461348f565b6109f8565b610308610a62565b6103636103cb366004613262565b610a68565b6103636103de36600461348f565b610ae0565b6103636103f1366004613262565b610bc8565b610326610c81565b610308610c90565b610326610414366004613262565b610c96565b610363610427366004613262565b610cb1565b610326610ce4565b6103636104423660046134e0565b610cf3565b6103636104553660046134bf565b6111a7565b61046d610468366004613262565b6112cf565b6040516103159190613da8565b610308610488366004613262565b6112e7565b61030861049b3660046133ab565b611302565b6103086104ae366004613262565b6114e7565b6103086114f9565b6103086114ff565b6103086104d1366004613262565b611505565b610326611517565b6103086104ec36600461348f565b611526565b61030861165d565b610363611663565b61030861050f366004613262565b611741565b61052761052236600461348f565b6117a5565b604051610315929190613db9565b610363610543366004613359565b6117c7565b6103636105563660046133d6565b611881565b61036361188f565b6103086118ef565b6103266118f5565b610586610581366004613262565b611904565b604051610315929190613d72565b6103636105a2366004613262565b61191d565b6103636105b536600461327e565b611995565b610308611ba7565b610308611bad565b610308611bb3565b6103636105e036600461348f565b611bd7565b6105276105f336600461342f565b611d02565b610326611d2f565b600061060b82611d3e565b90505b919050565b6008546001600160a01b031681565b60405180604001604052806004815260200163784f4c4560e01b81525081565b600d6020526000908152604090205481565b6002546001600160a01b0316331461069d5760405162461bcd60e51b8152600401808060200182810382526022815260200180613e816022913960400191505060405180910390fd5b60018054600280546001600160a01b038082166001600160a01b031980861682179687905590921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600254604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a15050565b60045481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6002546001600160a01b031681565b601281565b60165481565b6002601a5414156107de576040805162461bcd60e51b815260206004820152601f6024820152600080516020613e61833981519152604482015290519081900360640190fd5b6002601a55336107ee6000611dab565b6012556107fa81611d3e565b6001600160a01b0382166000908152600d602090815260408083209390935560125460138252838320553382526007815290829020825180840190935280548084526001909101549183019190915261086e5760405162461bcd60e51b8152600401610865906137f3565b60405180910390fd5b80602001514210156108925760405162461bcd60e51b815260040161086590613d29565b80516005546108a19082611e01565b600555600060208084018281528285523383526007909152604082208451815590516001909101556108d1611e5e565b6009549091506001600160a01b031663a9059cbb336108f08585611ed4565b6040518363ffffffff1660e01b815260040161090d929190613618565b602060405180830381600087803b15801561092757600080fd5b505af115801561093b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095f919061346f565b61096857600080fd5b61097133611f2e565b336001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56883426040516109ac929190613d72565b60405180910390a27fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048633826040516109e5929190613618565b60405180910390a150506001601a555050565b6001546001600160a01b03163314610a4e576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b612710811115610a5d57600080fd5b600c55565b600b5481565b6001546001600160a01b03163314610abe576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6002601a541415610b26576040805162461bcd60e51b815260206004820152601f6024820152600080516020613e61833981519152604482015290519081900360640190fd5b6002601a5533600090815260076020908152604091829020825180840190935280548352600101549082015281610b6f5760405162461bcd60e51b815260040161086590613cd7565b8051610b8d5760405162461bcd60e51b815260040161086590613c43565b42816020015111610bb05760405162461bcd60e51b815260040161086590613820565b610bbf33836000846002611fda565b50506001601a55565b6001546001600160a01b03163314610c1e576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a15050565b6009546001600160a01b031681565b60055481565b6014602052600090815260409020546001600160a01b031681565b6001600160a01b038116610cd75760405162461bcd60e51b815260040161086590613a4b565b610ce133826121f8565b50565b6000546001600160a01b031681565b6001546001600160a01b0316331480610d1657506003546001600160a01b031633145b610d515760405162461bcd60e51b8152600401808060200182810382526021815260200180613eea6021913960400191505060405180910390fd5b600060045411610d735760405162461bcd60e51b815260040161086590613b0a565b600080825160001415610d93576009546001600160a01b03169150610e2d565b610d9c83612285565b15610de5576000610dac8461229d565b905080600081518110610dbb57fe5b6020026020010151925080600182510381518110610dd557fe5b6020026020010151915050610e2d565b6000610df08461237e565b905080600081518110610dff57fe5b602002602001015160000151925080600182510381518110610e1d57fe5b6020026020010151602001519150505b6009546000906001600160a01b0384811691161415610f35576000610e5f601054600f54611e0190919063ffffffff16565b90506000610f0a600b54610f04600554610f0486600960009054906101000a90046001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610eb491906135e0565b60206040518083038186803b158015610ecc57600080fd5b505afa158015610ee0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0491906134a7565b90611e01565b905087811015610f2c5760405162461bcd60e51b8152600401610865906138aa565b915061108f9050565b6040516370a0823160e01b815286906001600160a01b038516906370a0823190610f639030906004016135e0565b60206040518083038186803b158015610f7b57600080fd5b505afa158015610f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb391906134a7565b1015610fd15760405162461bcd60e51b815260040161086590613a9c565b600854610fec906001600160a01b038581169116600061250f565b600854611006906001600160a01b0385811691168861250f565b600854604051636a91508f60e11b81526001600160a01b039091169063d522a11e9061103a90899089908990600401613d80565b602060405180830381600087803b15801561105457600080fd5b505af1158015611068573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108c91906134a7565b90505b6009546001600160a01b03848116911614806110b857506009546001600160a01b038381169116145b156111615760006110e06127106110da600c548561262790919063ffffffff16565b90612680565b90506110ec8282611e01565b600b549092506110fc9082611ed4565b600b55600f5461110c9083611ed4565b600f554260115561111c82611dab565b6012556040517f6a6f77044107a33658235d41bedbbaf2fe9ccdceb313143c947a5e76e1ec8474906111539086908a90869061365a565b60405180910390a15061119f565b7fb0bb0f37039c5230cd4e55bddd2eb8074cd1cb9eeccf7a8c0ac2ccff3e839aec838388846040516111969493929190613631565b60405180910390a15b505050505050565b6002601a5414156111ed576040805162461bcd60e51b815260206004820152601f6024820152600080516020613e61833981519152604482015290519081900360640190fd5b6002601a55600061120b62093a806112058482612680565b90612627565b336000908152600760209081526040918290208251808401909352805483526001015490820152909150836112525760405162461bcd60e51b815260040161086590613b78565b8051156112715760405162461bcd60e51b815260040161086590613b41565b4282116112905760405162461bcd60e51b815260040161086590613ba0565b630784ce0042018211156112b65760405162461bcd60e51b815260040161086590613ad3565b6112c4338584846001611fda565b50506001601a555050565b60186020526000908152604090205463ffffffff1681565b6001600160a01b031660009081526006602052604090205490565b60004382106113235760405162461bcd60e51b81526004016108659061390b565b6001600160a01b03831660009081526018602052604090205463ffffffff16806113515760009150506114e1565b6001600160a01b038416600090815260176020908152604080832063ffffffff6000198601811685529252909120541683106113c0576001600160a01b03841660009081526017602090815260408083206000199490940163ffffffff168352929052206001015490506114e1565b6001600160a01b038416600090815260176020908152604080832083805290915290205463ffffffff168310156113fb5760009150506114e1565b600060001982015b8163ffffffff168163ffffffff1611156114af576000600263ffffffff848403166001600160a01b038916600090815260176020908152604080832094909304860363ffffffff818116845294825291839020835180850190945280549094168084526001909401549083015292509087141561148a576020015194506114e19350505050565b805163ffffffff168711156114a1578193506114a8565b6001820392505b5050611403565b506001600160a01b038516600090815260176020908152604080832063ffffffff909416835292905220600101549150505b92915050565b60196020526000908152604090205481565b600e5481565b60105481565b60136020526000908152604090205481565b600a546001600160a01b031681565b60006016546000141561153b5750600061060e565b6016546000190160009081526015602052604090205463ffffffff16821061157c57506016546000190160009081526015602052604090206001015461060e565b6000805260156020527fa31547ce6245cdb9ecea19cf8c7eb9f5974025bb4075011409251ae855b30aed5463ffffffff168210156115bc5750600061060e565b601654600090600019015b818111156116445760028282030481036000818152601560209081526040918290208251808401909352805463ffffffff168084526001909101549183019190915286141561161f5760200151935061060e92505050565b805163ffffffff168611156116365781935061163d565b6001820392505b50506115c7565b5060009081526015602052604090206001015492915050565b600f5481565b600a546001600160a01b0316331461168d5760405162461bcd60e51b8152600401610865906139bd565b600b546116ac5760405162461bcd60e51b815260040161086590613c73565b600b80546000909155600954600a5460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb926116eb929116908590600401613618565b602060405180830381600087803b15801561170557600080fd5b505af1158015611719573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173d919061346f565b5050565b6001600160a01b03811660009081526018602052604081205463ffffffff168061176c57600061179e565b6001600160a01b038316600090815260176020908152604080832063ffffffff60001986011684529091529020600101545b9392505050565b6015602052600090815260409020805460019091015463ffffffff9091169082565b6001546001600160a01b031633146117f15760405162461bcd60e51b815260040161086590613d06565b6001600160a01b0384166118175760405162461bcd60e51b815260040161086590613ca0565b6001600160a01b03811661183d5760405162461bcd60e51b8152600401610865906139df565b600980546001600160a01b039586166001600160a01b031991821617909155600c92909255600a805491851691831691909117905560088054929093169116179055565b61119f8686868686866126e7565b6000611899611e5e565b6009549091506118b3906001600160a01b03163383612906565b7fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048633826040516118e4929190613618565b60405180910390a150565b60115481565b6003546001600160a01b031681565b6007602052600090815260409020805460019091015482565b6001546001600160a01b03163314611973576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b835185511480156119a7575082518551145b80156119b4575081518551145b80156119c1575080518551145b6119ca57600080fd5b60005b8551811015611b9e576000306001600160a01b031663c3cda52060e01b898985815181106119f757fe5b6020026020010151898681518110611a0b57fe5b6020026020010151898781518110611a1f57fe5b6020026020010151898881518110611a3357fe5b6020026020010151898981518110611a4757fe5b6020026020010151604051602401611a649695949392919061367b565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611aa291906135a9565b6000604051808303816000865af19150503d8060008114611adf576040519150601f19603f3d011682016040523d82523d6000602084013e611ae4565b606091505b5050905080611b9557868281518110611af957fe5b6020026020010151886001600160a01b03167f1bffed5e02e1c7b996a1ac0a6ddce76606170e66ebd6883b4d87abfed2c657d9888581518110611b3857fe5b6020026020010151888681518110611b4c57fe5b6020026020010151888781518110611b6057fe5b6020026020010151888881518110611b7457fe5b6020026020010151604051611b8c9493929190613702565b60405180910390a35b506001016119cd565b50505050505050565b60125481565b600c5481565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6002601a541415611c1d576040805162461bcd60e51b815260206004820152601f6024820152600080516020613e61833981519152604482015290519081900360640190fd5b6002601a55336000908152600760209081526040808320815180830190925280548252600101549181019190915290611c5d62093a806112058582612680565b905042826020015111611c825760405162461bcd60e51b815260040161086590613c1d565b8151611ca05760405162461bcd60e51b815260040161086590613a71565b81602001518111611cc35760405162461bcd60e51b815260040161086590613940565b630784ce004201811115611ce95760405162461bcd60e51b815260040161086590613ad3565b611cf833600083856003611fda565b50506001601a5550565b60176020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6001546001600160a01b031681565b6001600160a01b0381166000908152600d6020908152604080832054601390925282205461060b9190611da590670de0b6b3a7640000906110da90611d8690610f0488611dab565b6001600160a01b03881660009081526006602052604090205490612627565b90611ed4565b600060045460001415611dc1575060125461060e565b601154421415611df857600454611df190611de8906110da85670de0b6b3a7640000612627565b60125490611ed4565b905061060e565b5060125461060e565b600082821115611e58576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600033611e6b6000611dab565b601255611e7781611d3e565b6001600160a01b0382166000908152600d602081815260408084209490945560125460138252848420553383525220548015611ece57336000908152600d6020526040812055601054611eca9082611ed4565b6010555b91505090565b60008282018381101561179e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b038116600090815260066020526040902054600454611f549082611e01565b6004556001600160a01b038216600081815260066020526040808220829055519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611fa49085906136b1565b60405180910390a36001600160a01b03808316600090815260146020526040812054611fd292169083612958565b61173d612a95565b84611fe56000611dab565b601255611ff181611d3e565b6001600160a01b0382166000908152600d60209081526040808320939093556012546013909152919020556005546120298187611ed4565b60055583516120389087611ed4565b8452841561204857602084018590525b6001600160a01b038716600090815260076020908152604090912085518155908501516001909101558515612106576009546040516323b872dd60e01b81526001600160a01b03909116906323b872dd906120ab90339030908b906004016135f4565b602060405180830381600087803b1580156120c557600080fd5b505af11580156120d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120fd919061346f565b61210657600080fd5b85806121305761211588611f2e565b506001600160a01b0387166000908152600760205260409020545b6001600160a01b03881660009081526007602052604081206001015461215f9062093a80906110da9042611e01565b905060018111156121995760006121856127106110da60001985016112058760d0612627565b90506121938a828501612b80565b506121a3565b6121a38983612b80565b8560200151896001600160a01b03167f4566dfc29f6f11d13a418c26a02bef7c28bae749d4de47e4e6a7cddea6730d598a88426040516121e593929190613d59565b60405180910390a3505050505050505050565b6001600160a01b03808316600081815260196020908152604080832080546001019055601480835281842080546006855283862054929094528787166001600160a01b0319851681179091559151929095169493909285927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461227f828483612958565b50505050565b6000600261229283612c78565b60ff16141592915050565b606060006122aa83612ca7565b905060008160ff16601402600501905080845110156122db5760405162461bcd60e51b815260040161086590613864565b600560ff831667ffffffffffffffff811180156122f757600080fd5b50604051908082528060200260200182016040528015612321578160200160208202803683370190505b50935060005b8360ff1681101561237557601481028201868101602001518651606082901c9088908590811061235357fe5b6001600160a01b03909216602092830291909101909101525050600101612327565b50505050919050565b6060600061238b83612ca7565b83519091506002601760ff84160201908111156123ba5760405162461bcd60e51b815260040161086590613977565b60018260ff16116123dd5760405162461bcd60e51b815260040161086590613733565b6000600560ff60001985011667ffffffffffffffff811180156123ff57600080fd5b5060405190808252806020026020018201604052801561243957816020015b612426613159565b81526020019060019003908161241e5790505b50945060005b6001850360ff1681101561250557612455613159565b816124755787830160200151606081901c825293506014909201916124a5565b86600183038151811061248457fe5b60209081029190910181015101516001600160a01b03168152601792909201915b6020838901810151606081901c91830191909152603081901c6301000000600160d01b0316604882901c90810362ffffff16604084015288519195509082908990859081106124f057fe5b6020908102919091010152505060010161243f565b5050505050919050565b801580612595575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561256757600080fd5b505afa15801561257b573d6000803e3d6000fd5b505050506040513d602081101561259157600080fd5b5051155b6125d05760405162461bcd60e51b8152600401808060200182810382526036815260200180613f356036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612622908490612cd6565b505050565b600082612636575060006114e1565b8282028284828161264357fe5b041461179e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613ec96021913960400191505060405180910390fd5b60008082116126d6576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816126df57fe5b049392505050565b6001600160a01b03861661270d5760405162461bcd60e51b815260040161086590613a4b565b8342111561272d5760405162461bcd60e51b815260040161086590613a16565b604080518082019091526004815263784f4c4560e01b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fc63a62895c37b93149fa0b6f2c8d497a0c91951682a9dd0c7a49b82beb78f55e612795612d87565b306040516020016127a994939291906136de565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016127fa94939291906136ba565b604051602081830303815290604052805190602001209050600082826040516020016128279291906135c5565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516128649493929190613702565b6020604051602081039080840390855afa158015612886573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166128b95760405162461bcd60e51b8152600401610865906138d6565b6001600160a01b03811660009081526019602052604090205489146128f05760405162461bcd60e51b815260040161086590613be6565b6128fa818b6121f8565b50505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612622908490612cd6565b816001600160a01b0316836001600160a01b03161415801561297a5750600081115b15612622576001600160a01b03831615612a0c576001600160a01b03831660009081526018602052604081205463ffffffff1690816129ba5760006129ec565b6001600160a01b038516600090815260176020908152604080832063ffffffff60001987011684529091529020600101545b905060006129fa8285611e01565b9050612a0886848484612d8b565b5050505b6001600160a01b03821615612622576001600160a01b03821660009081526018602052604081205463ffffffff169081612a47576000612a79565b6001600160a01b038416600090815260176020908152604080832063ffffffff60001987011684529091529020600101545b90506000612a878285611ed4565b905061119f85848484612d8b565b6000612ad6436040518060400160405280601c81526020017f626c6f636b206e756d6265722065786365656473203332206269747300000000815250612f0d565b90506000601654118015612b0757506016546000190160009081526015602052604090205463ffffffff8281169116145b15612b2d5760045460165460001901600090815260156020526040902060010155610ce1565b60408051808201825263ffffffff80841682526004546020808401918252601680546000908152601590925294902092518354921663ffffffff1990921691909117825551600191820155815401905550565b600454612b8d9082611ed4565b6004556001600160a01b038216600090815260066020526040902054612bb39082611ed4565b6001600160a01b0383166000818152600660205260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612c029085906136b1565b60405180910390a36001600160a01b0382811660009081526014602052604090205416612c53576001600160a01b038216600081815260146020526040902080546001600160a01b03191690911790555b6001600160a01b03808316600090815260146020526040812054611fd2921683612958565b6000600182511015612c9c5760405162461bcd60e51b815260040161086590613776565b506020015160001a90565b6000600582511015612ccb5760405162461bcd60e51b8152600401610865906137ab565b506024015160001a90565b6000612d2b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f3d9092919063ffffffff16565b80519091501561262257808060200190516020811015612d4a57600080fd5b50516126225760405162461bcd60e51b815260040180806020018281038252602a815260200180613f0b602a913960400191505060405180910390fd5b4690565b6000612dcc436040518060400160405280601c81526020017f626c6f636b206e756d6265722065786365656473203332206269747300000000815250612f0d565b905060008463ffffffff16118015612e1557506001600160a01b038516600090815260176020908152604080832063ffffffff6000198901811685529252909120548282169116145b15612e52576001600160a01b038516600090815260176020908152604080832063ffffffff60001989011684529091529020600101829055612ec3565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152601784528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260189092529390208054928801909116919092161790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051612efe929190613d72565b60405180910390a25050505050565b6000816401000000008410612f355760405162461bcd60e51b81526004016108659190613720565b509192915050565b6060612f4c8484600085612f54565b949350505050565b606082471015612f955760405162461bcd60e51b8152600401808060200182810382526026815260200180613ea36026913960400191505060405180910390fd5b612f9e856130af565b612fef576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b6020831061302d5780518252601f19909201916020918201910161300e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461308f576040519150601f19603f3d011682016040523d82523d6000602084013e613094565b606091505b50915091506130a48282866130b5565b979650505050505050565b3b151590565b606083156130c457508161179e565b8251156130d45782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561311e578181015183820152602001613106565b50505050905090810190601f16801561314b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080516060810182526000808252602082018190529181019190915290565b803561060e81613e4b565b600082601f830112613194578081fd5b813560206131a96131a483613e01565b613ddd565b82815281810190858301838502870184018810156131c5578586fd5b855b858110156131e3578135845292840192908401906001016131c7565b5090979650505050505050565b600082601f830112613200578081fd5b813560206132106131a483613e01565b828152818101908583018385028701840188101561322c578586fd5b855b858110156131e35761323f82613251565b8452928401929084019060010161322e565b803560ff8116811461060e57600080fd5b600060208284031215613273578081fd5b813561179e81613e4b565b60008060008060008060c08789031215613296578182fd5b61329f87613179565b9550602087013567ffffffffffffffff808211156132bb578384fd5b6132c78a838b01613184565b965060408901359150808211156132dc578384fd5b6132e88a838b01613184565b955060608901359150808211156132fd578384fd5b6133098a838b016131f0565b9450608089013591508082111561331e578384fd5b61332a8a838b01613184565b935060a089013591508082111561333f578283fd5b5061334c89828a01613184565b9150509295509295509295565b6000806000806080858703121561336e578384fd5b843561337981613e4b565b9350602085013561338981613e4b565b92506040850135915060608501356133a081613e4b565b939692955090935050565b600080604083850312156133bd578182fd5b82356133c881613e4b565b946020939093013593505050565b60008060008060008060c087890312156133ee578182fd5b86356133f981613e4b565b9550602087013594506040870135935061341560608801613251565b92506080870135915060a087013590509295509295509295565b60008060408385031215613441578182fd5b823561344c81613e4b565b9150602083013563ffffffff81168114613464578182fd5b809150509250929050565b600060208284031215613480578081fd5b8151801515811461179e578182fd5b6000602082840312156134a0578081fd5b5035919050565b6000602082840312156134b8578081fd5b5051919050565b600080604083850312156134d1578182fd5b50508035926020909101359150565b6000806000606084860312156134f4578081fd5b833592506020808501359250604085013567ffffffffffffffff8082111561351a578384fd5b818701915087601f83011261352d578384fd5b81358181111561353957fe5b61354b601f8201601f19168501613ddd565b91508082528884828501011115613560578485fd5b808484018584013784848284010152508093505050509250925092565b60008151808452613595816020860160208601613e1f565b601f01601f19169290920160200192915050565b600082516135bb818460208701613e1f565b9190910192915050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b039690961686526020860194909452604085019290925260ff166060840152608083015260a082015260c00190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b60006020825261179e602083018461357d565b60208082526023908201527f446578446174613a20746f556e69563350617468207061746820746f6f2073686040820152621bdc9d60ea1b606082015260800190565b6020808252818101527f446578446174613a20746f4465782077726f6e67206461746120666f726d6174604082015260600190565b60208082526028908201527f446578446174613a20746f41727261794c656e6774682077726f6e67206461746040820152671848199bdc9b585d60c21b606082015260800190565b6020808252601390820152724e6f7468696e6720746f20776974686472617760681b604082015260600190565b60208082526024908201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e20576974686040820152636472617760e01b606082015260800190565b60208082526026908201527f446578446174613a20746f556e695632506174682077726f6e67206461746120604082015265199bdc9b585d60d21b606082015260800190565b602080825260129082015271457863656564204f4c452062616c616e636560701b604082015260600190565b6020808252818101527f64656c656761746542795369673a20696e76616c6964207369676e6174757265604082015260600190565b6020808252818101527f6765745072696f72566f7465733a6e6f74207965742064657465726d696e6564604082015260600190565b6020808252601f908201527f43616e206f6e6c7920696e637265617365206c6f636b206475726174696f6e00604082015260600190565b60208082526026908201527f446578446174613a20746f556e695633506174682077726f6e67206461746120604082015265199bdc9b585d60d21b606082015260800190565b602080825260089082015267446576206f6e6c7960c01b604082015260600190565b60208082526018908201527f5f64657620616464726573732063616e6e6f7420626520300000000000000000604082015260600190565b6020808252818101527f64656c656761746542795369673a207369676e61747572652065787069726564604082015260600190565b6020808252600c908201526b0c8cad8cacec2e8caca7460f60a31b604082015260600190565b602080825260119082015270139bdd1a1a5b99c81a5cc81b1bd8dad959607a1b604082015260600190565b60208082526018908201527f45786365656420617661696c61626c652062616c616e63650000000000000000604082015260600190565b6020808252601e908201527f566f74696e67206c6f636b2063616e2062652034207965617273206d61780000604082015260600190565b6020808252601e908201527f43616e277420736861726520776974686f7574206c6f636b6564204f4c450000604082015260600190565b60208082526019908201527f5769746864726177206f6c6420746f6b656e7320666972737400000000000000604082015260600190565b6020808252600e908201526d4e6f6e207a65726f2076616c756560901b604082015260600190565b60208082526026908201527f43616e206f6e6c79206c6f636b20756e74696c2074696d6520696e207468652060408201526566757475726560d01b606082015260800190565b6020808252601c908201527f64656c656761746542795369673a20696e76616c6964206e6f6e636500000000604082015260600190565b6020808252600c908201526b131bd8dac8195e1c1a5c995960a21b604082015260600190565b602080825260169082015275139bc8195e1a5cdd1a5b99c81b1bd8dac8199bdd5b9960521b604082015260600190565b6020808252601390820152724e6f2066756e6420746f20776974686472617760681b604082015260600190565b6020808252601d908201527f5f6f6c65546f6b656e20616464726573732063616e6e6f742062652030000000604082015260600190565b6020808252601590820152746e656564206e6f6e202d207a65726f2076616c756560581b604082015260600190565b6020808252600990820152682737ba1030b236b4b760b91b604082015260600190565b602080825260169082015275546865206c6f636b206469646e27742065787069726560501b604082015260600190565b928352600f9190910b6020830152604082015260600190565b918252602082015260400190565b600084825283602083015260606040830152613d9f606083018461357d565b95945050505050565b63ffffffff91909116815260200190565b63ffffffff929092168252602082015260400190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715613df957fe5b604052919050565b600067ffffffffffffffff821115613e1557fe5b5060209081020190565b60005b83811015613e3a578181015183820152602001613e22565b8381111561227f5750506000910152565b6001600160a01b0381168114610ce157600080fdfe5265656e7472616e637947756172643a207265656e7472616e742063616c6c006f6e6c792070656e64696e6741646d696e2063616e206163636570742061646d696e416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7763616c6c6572206d7573742062652061646d696e206f7220646576656c6f7065725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220477bf4a1e3961a7c0b7f6eec98dc1f88320065fc14e263d762c35203e221d32e64736f6c63430007060033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102f05760003560e01c8063782d6fe11161019d578063c3cda520116100e9578063d8fdb23a116100a2578063e7a324dc1161007c578063e7a324dc146105ca578063eff7a612146105d2578063f1127ed8146105e5578063f851a440146105f8576102f0565b8063d8fdb23a146105a7578063df136d65146105ba578063df589f3a146105c2576102f0565b8063c3cda52014610548578063c885bc581461055b578063c8f33c9114610563578063ca4b208b1461056b578063cbf9fe5f14610573578063d477f05f14610594576102f0565b806395d89b4111610156578063b40f603411610130578063b40f6034146104f9578063b4b5ea5714610501578063b66e4cdf14610514578063be20309414610535576102f0565b806395d89b4114610333578063981b24d0146104de578063aed29d07146104f1576102f0565b8063782d6fe11461048d5780637ecebe00146104a0578063817b1cd2146104b35780638471eb44146104bb5780638b876347146104c357806391cca3db146104d6576102f0565b80634390d2a81161025c578063587cde1e1161021557806364d16ac4116101ef57806364d16ac41461043457806365fc3873146104475780636fcfff451461045a57806370a082311461047a576102f0565b8063587cde1e146104065780635c19a95c146104195780635c60da1b1461042c576102f0565b80634390d2a8146103b557806348b3ec11146103bd5780634957677c146103d05780634dd18bf5146103e357806353e083a8146103f657806356891412146103fe576102f0565b806320606b70116102ae57806320606b701461036d5780632678224714610375578063313ce5671461037d5780633be60f2e146103925780633ccfd60b1461039a5780633e842df5146103a2576102f0565b80628cc262146102f5578063060d83971461031e57806306fdde03146103335780630700037d146103485780630e18b6811461035b57806318160ddd14610365575b600080fd5b610308610303366004613262565b610600565b60405161031591906136b1565b60405180910390f35b610326610613565b60405161031591906135e0565b61033b610622565b6040516103159190613720565b610308610356366004613262565b610642565b610363610654565b005b610308610754565b61030861075a565b61032661077e565b61038561078d565b6040516103159190613dcf565b610308610792565b610363610798565b6103636103b036600461348f565b6109f8565b610308610a62565b6103636103cb366004613262565b610a68565b6103636103de36600461348f565b610ae0565b6103636103f1366004613262565b610bc8565b610326610c81565b610308610c90565b610326610414366004613262565b610c96565b610363610427366004613262565b610cb1565b610326610ce4565b6103636104423660046134e0565b610cf3565b6103636104553660046134bf565b6111a7565b61046d610468366004613262565b6112cf565b6040516103159190613da8565b610308610488366004613262565b6112e7565b61030861049b3660046133ab565b611302565b6103086104ae366004613262565b6114e7565b6103086114f9565b6103086114ff565b6103086104d1366004613262565b611505565b610326611517565b6103086104ec36600461348f565b611526565b61030861165d565b610363611663565b61030861050f366004613262565b611741565b61052761052236600461348f565b6117a5565b604051610315929190613db9565b610363610543366004613359565b6117c7565b6103636105563660046133d6565b611881565b61036361188f565b6103086118ef565b6103266118f5565b610586610581366004613262565b611904565b604051610315929190613d72565b6103636105a2366004613262565b61191d565b6103636105b536600461327e565b611995565b610308611ba7565b610308611bad565b610308611bb3565b6103636105e036600461348f565b611bd7565b6105276105f336600461342f565b611d02565b610326611d2f565b600061060b82611d3e565b90505b919050565b6008546001600160a01b031681565b60405180604001604052806004815260200163784f4c4560e01b81525081565b600d6020526000908152604090205481565b6002546001600160a01b0316331461069d5760405162461bcd60e51b8152600401808060200182810382526022815260200180613e816022913960400191505060405180910390fd5b60018054600280546001600160a01b038082166001600160a01b031980861682179687905590921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600254604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a15050565b60045481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6002546001600160a01b031681565b601281565b60165481565b6002601a5414156107de576040805162461bcd60e51b815260206004820152601f6024820152600080516020613e61833981519152604482015290519081900360640190fd5b6002601a55336107ee6000611dab565b6012556107fa81611d3e565b6001600160a01b0382166000908152600d602090815260408083209390935560125460138252838320553382526007815290829020825180840190935280548084526001909101549183019190915261086e5760405162461bcd60e51b8152600401610865906137f3565b60405180910390fd5b80602001514210156108925760405162461bcd60e51b815260040161086590613d29565b80516005546108a19082611e01565b600555600060208084018281528285523383526007909152604082208451815590516001909101556108d1611e5e565b6009549091506001600160a01b031663a9059cbb336108f08585611ed4565b6040518363ffffffff1660e01b815260040161090d929190613618565b602060405180830381600087803b15801561092757600080fd5b505af115801561093b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095f919061346f565b61096857600080fd5b61097133611f2e565b336001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56883426040516109ac929190613d72565b60405180910390a27fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048633826040516109e5929190613618565b60405180910390a150506001601a555050565b6001546001600160a01b03163314610a4e576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b612710811115610a5d57600080fd5b600c55565b600b5481565b6001546001600160a01b03163314610abe576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6002601a541415610b26576040805162461bcd60e51b815260206004820152601f6024820152600080516020613e61833981519152604482015290519081900360640190fd5b6002601a5533600090815260076020908152604091829020825180840190935280548352600101549082015281610b6f5760405162461bcd60e51b815260040161086590613cd7565b8051610b8d5760405162461bcd60e51b815260040161086590613c43565b42816020015111610bb05760405162461bcd60e51b815260040161086590613820565b610bbf33836000846002611fda565b50506001601a55565b6001546001600160a01b03163314610c1e576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a15050565b6009546001600160a01b031681565b60055481565b6014602052600090815260409020546001600160a01b031681565b6001600160a01b038116610cd75760405162461bcd60e51b815260040161086590613a4b565b610ce133826121f8565b50565b6000546001600160a01b031681565b6001546001600160a01b0316331480610d1657506003546001600160a01b031633145b610d515760405162461bcd60e51b8152600401808060200182810382526021815260200180613eea6021913960400191505060405180910390fd5b600060045411610d735760405162461bcd60e51b815260040161086590613b0a565b600080825160001415610d93576009546001600160a01b03169150610e2d565b610d9c83612285565b15610de5576000610dac8461229d565b905080600081518110610dbb57fe5b6020026020010151925080600182510381518110610dd557fe5b6020026020010151915050610e2d565b6000610df08461237e565b905080600081518110610dff57fe5b602002602001015160000151925080600182510381518110610e1d57fe5b6020026020010151602001519150505b6009546000906001600160a01b0384811691161415610f35576000610e5f601054600f54611e0190919063ffffffff16565b90506000610f0a600b54610f04600554610f0486600960009054906101000a90046001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610eb491906135e0565b60206040518083038186803b158015610ecc57600080fd5b505afa158015610ee0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0491906134a7565b90611e01565b905087811015610f2c5760405162461bcd60e51b8152600401610865906138aa565b915061108f9050565b6040516370a0823160e01b815286906001600160a01b038516906370a0823190610f639030906004016135e0565b60206040518083038186803b158015610f7b57600080fd5b505afa158015610f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb391906134a7565b1015610fd15760405162461bcd60e51b815260040161086590613a9c565b600854610fec906001600160a01b038581169116600061250f565b600854611006906001600160a01b0385811691168861250f565b600854604051636a91508f60e11b81526001600160a01b039091169063d522a11e9061103a90899089908990600401613d80565b602060405180830381600087803b15801561105457600080fd5b505af1158015611068573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108c91906134a7565b90505b6009546001600160a01b03848116911614806110b857506009546001600160a01b038381169116145b156111615760006110e06127106110da600c548561262790919063ffffffff16565b90612680565b90506110ec8282611e01565b600b549092506110fc9082611ed4565b600b55600f5461110c9083611ed4565b600f554260115561111c82611dab565b6012556040517f6a6f77044107a33658235d41bedbbaf2fe9ccdceb313143c947a5e76e1ec8474906111539086908a90869061365a565b60405180910390a15061119f565b7fb0bb0f37039c5230cd4e55bddd2eb8074cd1cb9eeccf7a8c0ac2ccff3e839aec838388846040516111969493929190613631565b60405180910390a15b505050505050565b6002601a5414156111ed576040805162461bcd60e51b815260206004820152601f6024820152600080516020613e61833981519152604482015290519081900360640190fd5b6002601a55600061120b62093a806112058482612680565b90612627565b336000908152600760209081526040918290208251808401909352805483526001015490820152909150836112525760405162461bcd60e51b815260040161086590613b78565b8051156112715760405162461bcd60e51b815260040161086590613b41565b4282116112905760405162461bcd60e51b815260040161086590613ba0565b630784ce0042018211156112b65760405162461bcd60e51b815260040161086590613ad3565b6112c4338584846001611fda565b50506001601a555050565b60186020526000908152604090205463ffffffff1681565b6001600160a01b031660009081526006602052604090205490565b60004382106113235760405162461bcd60e51b81526004016108659061390b565b6001600160a01b03831660009081526018602052604090205463ffffffff16806113515760009150506114e1565b6001600160a01b038416600090815260176020908152604080832063ffffffff6000198601811685529252909120541683106113c0576001600160a01b03841660009081526017602090815260408083206000199490940163ffffffff168352929052206001015490506114e1565b6001600160a01b038416600090815260176020908152604080832083805290915290205463ffffffff168310156113fb5760009150506114e1565b600060001982015b8163ffffffff168163ffffffff1611156114af576000600263ffffffff848403166001600160a01b038916600090815260176020908152604080832094909304860363ffffffff818116845294825291839020835180850190945280549094168084526001909401549083015292509087141561148a576020015194506114e19350505050565b805163ffffffff168711156114a1578193506114a8565b6001820392505b5050611403565b506001600160a01b038516600090815260176020908152604080832063ffffffff909416835292905220600101549150505b92915050565b60196020526000908152604090205481565b600e5481565b60105481565b60136020526000908152604090205481565b600a546001600160a01b031681565b60006016546000141561153b5750600061060e565b6016546000190160009081526015602052604090205463ffffffff16821061157c57506016546000190160009081526015602052604090206001015461060e565b6000805260156020527fa31547ce6245cdb9ecea19cf8c7eb9f5974025bb4075011409251ae855b30aed5463ffffffff168210156115bc5750600061060e565b601654600090600019015b818111156116445760028282030481036000818152601560209081526040918290208251808401909352805463ffffffff168084526001909101549183019190915286141561161f5760200151935061060e92505050565b805163ffffffff168611156116365781935061163d565b6001820392505b50506115c7565b5060009081526015602052604090206001015492915050565b600f5481565b600a546001600160a01b0316331461168d5760405162461bcd60e51b8152600401610865906139bd565b600b546116ac5760405162461bcd60e51b815260040161086590613c73565b600b80546000909155600954600a5460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb926116eb929116908590600401613618565b602060405180830381600087803b15801561170557600080fd5b505af1158015611719573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173d919061346f565b5050565b6001600160a01b03811660009081526018602052604081205463ffffffff168061176c57600061179e565b6001600160a01b038316600090815260176020908152604080832063ffffffff60001986011684529091529020600101545b9392505050565b6015602052600090815260409020805460019091015463ffffffff9091169082565b6001546001600160a01b031633146117f15760405162461bcd60e51b815260040161086590613d06565b6001600160a01b0384166118175760405162461bcd60e51b815260040161086590613ca0565b6001600160a01b03811661183d5760405162461bcd60e51b8152600401610865906139df565b600980546001600160a01b039586166001600160a01b031991821617909155600c92909255600a805491851691831691909117905560088054929093169116179055565b61119f8686868686866126e7565b6000611899611e5e565b6009549091506118b3906001600160a01b03163383612906565b7fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048633826040516118e4929190613618565b60405180910390a150565b60115481565b6003546001600160a01b031681565b6007602052600090815260409020805460019091015482565b6001546001600160a01b03163314611973576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b835185511480156119a7575082518551145b80156119b4575081518551145b80156119c1575080518551145b6119ca57600080fd5b60005b8551811015611b9e576000306001600160a01b031663c3cda52060e01b898985815181106119f757fe5b6020026020010151898681518110611a0b57fe5b6020026020010151898781518110611a1f57fe5b6020026020010151898881518110611a3357fe5b6020026020010151898981518110611a4757fe5b6020026020010151604051602401611a649695949392919061367b565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611aa291906135a9565b6000604051808303816000865af19150503d8060008114611adf576040519150601f19603f3d011682016040523d82523d6000602084013e611ae4565b606091505b5050905080611b9557868281518110611af957fe5b6020026020010151886001600160a01b03167f1bffed5e02e1c7b996a1ac0a6ddce76606170e66ebd6883b4d87abfed2c657d9888581518110611b3857fe5b6020026020010151888681518110611b4c57fe5b6020026020010151888781518110611b6057fe5b6020026020010151888881518110611b7457fe5b6020026020010151604051611b8c9493929190613702565b60405180910390a35b506001016119cd565b50505050505050565b60125481565b600c5481565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6002601a541415611c1d576040805162461bcd60e51b815260206004820152601f6024820152600080516020613e61833981519152604482015290519081900360640190fd5b6002601a55336000908152600760209081526040808320815180830190925280548252600101549181019190915290611c5d62093a806112058582612680565b905042826020015111611c825760405162461bcd60e51b815260040161086590613c1d565b8151611ca05760405162461bcd60e51b815260040161086590613a71565b81602001518111611cc35760405162461bcd60e51b815260040161086590613940565b630784ce004201811115611ce95760405162461bcd60e51b815260040161086590613ad3565b611cf833600083856003611fda565b50506001601a5550565b60176020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6001546001600160a01b031681565b6001600160a01b0381166000908152600d6020908152604080832054601390925282205461060b9190611da590670de0b6b3a7640000906110da90611d8690610f0488611dab565b6001600160a01b03881660009081526006602052604090205490612627565b90611ed4565b600060045460001415611dc1575060125461060e565b601154421415611df857600454611df190611de8906110da85670de0b6b3a7640000612627565b60125490611ed4565b905061060e565b5060125461060e565b600082821115611e58576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600033611e6b6000611dab565b601255611e7781611d3e565b6001600160a01b0382166000908152600d602081815260408084209490945560125460138252848420553383525220548015611ece57336000908152600d6020526040812055601054611eca9082611ed4565b6010555b91505090565b60008282018381101561179e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b038116600090815260066020526040902054600454611f549082611e01565b6004556001600160a01b038216600081815260066020526040808220829055519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611fa49085906136b1565b60405180910390a36001600160a01b03808316600090815260146020526040812054611fd292169083612958565b61173d612a95565b84611fe56000611dab565b601255611ff181611d3e565b6001600160a01b0382166000908152600d60209081526040808320939093556012546013909152919020556005546120298187611ed4565b60055583516120389087611ed4565b8452841561204857602084018590525b6001600160a01b038716600090815260076020908152604090912085518155908501516001909101558515612106576009546040516323b872dd60e01b81526001600160a01b03909116906323b872dd906120ab90339030908b906004016135f4565b602060405180830381600087803b1580156120c557600080fd5b505af11580156120d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120fd919061346f565b61210657600080fd5b85806121305761211588611f2e565b506001600160a01b0387166000908152600760205260409020545b6001600160a01b03881660009081526007602052604081206001015461215f9062093a80906110da9042611e01565b905060018111156121995760006121856127106110da60001985016112058760d0612627565b90506121938a828501612b80565b506121a3565b6121a38983612b80565b8560200151896001600160a01b03167f4566dfc29f6f11d13a418c26a02bef7c28bae749d4de47e4e6a7cddea6730d598a88426040516121e593929190613d59565b60405180910390a3505050505050505050565b6001600160a01b03808316600081815260196020908152604080832080546001019055601480835281842080546006855283862054929094528787166001600160a01b0319851681179091559151929095169493909285927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461227f828483612958565b50505050565b6000600261229283612c78565b60ff16141592915050565b606060006122aa83612ca7565b905060008160ff16601402600501905080845110156122db5760405162461bcd60e51b815260040161086590613864565b600560ff831667ffffffffffffffff811180156122f757600080fd5b50604051908082528060200260200182016040528015612321578160200160208202803683370190505b50935060005b8360ff1681101561237557601481028201868101602001518651606082901c9088908590811061235357fe5b6001600160a01b03909216602092830291909101909101525050600101612327565b50505050919050565b6060600061238b83612ca7565b83519091506002601760ff84160201908111156123ba5760405162461bcd60e51b815260040161086590613977565b60018260ff16116123dd5760405162461bcd60e51b815260040161086590613733565b6000600560ff60001985011667ffffffffffffffff811180156123ff57600080fd5b5060405190808252806020026020018201604052801561243957816020015b612426613159565b81526020019060019003908161241e5790505b50945060005b6001850360ff1681101561250557612455613159565b816124755787830160200151606081901c825293506014909201916124a5565b86600183038151811061248457fe5b60209081029190910181015101516001600160a01b03168152601792909201915b6020838901810151606081901c91830191909152603081901c6301000000600160d01b0316604882901c90810362ffffff16604084015288519195509082908990859081106124f057fe5b6020908102919091010152505060010161243f565b5050505050919050565b801580612595575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561256757600080fd5b505afa15801561257b573d6000803e3d6000fd5b505050506040513d602081101561259157600080fd5b5051155b6125d05760405162461bcd60e51b8152600401808060200182810382526036815260200180613f356036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612622908490612cd6565b505050565b600082612636575060006114e1565b8282028284828161264357fe5b041461179e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613ec96021913960400191505060405180910390fd5b60008082116126d6576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816126df57fe5b049392505050565b6001600160a01b03861661270d5760405162461bcd60e51b815260040161086590613a4b565b8342111561272d5760405162461bcd60e51b815260040161086590613a16565b604080518082019091526004815263784f4c4560e01b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fc63a62895c37b93149fa0b6f2c8d497a0c91951682a9dd0c7a49b82beb78f55e612795612d87565b306040516020016127a994939291906136de565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016127fa94939291906136ba565b604051602081830303815290604052805190602001209050600082826040516020016128279291906135c5565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516128649493929190613702565b6020604051602081039080840390855afa158015612886573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166128b95760405162461bcd60e51b8152600401610865906138d6565b6001600160a01b03811660009081526019602052604090205489146128f05760405162461bcd60e51b815260040161086590613be6565b6128fa818b6121f8565b50505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612622908490612cd6565b816001600160a01b0316836001600160a01b03161415801561297a5750600081115b15612622576001600160a01b03831615612a0c576001600160a01b03831660009081526018602052604081205463ffffffff1690816129ba5760006129ec565b6001600160a01b038516600090815260176020908152604080832063ffffffff60001987011684529091529020600101545b905060006129fa8285611e01565b9050612a0886848484612d8b565b5050505b6001600160a01b03821615612622576001600160a01b03821660009081526018602052604081205463ffffffff169081612a47576000612a79565b6001600160a01b038416600090815260176020908152604080832063ffffffff60001987011684529091529020600101545b90506000612a878285611ed4565b905061119f85848484612d8b565b6000612ad6436040518060400160405280601c81526020017f626c6f636b206e756d6265722065786365656473203332206269747300000000815250612f0d565b90506000601654118015612b0757506016546000190160009081526015602052604090205463ffffffff8281169116145b15612b2d5760045460165460001901600090815260156020526040902060010155610ce1565b60408051808201825263ffffffff80841682526004546020808401918252601680546000908152601590925294902092518354921663ffffffff1990921691909117825551600191820155815401905550565b600454612b8d9082611ed4565b6004556001600160a01b038216600090815260066020526040902054612bb39082611ed4565b6001600160a01b0383166000818152600660205260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612c029085906136b1565b60405180910390a36001600160a01b0382811660009081526014602052604090205416612c53576001600160a01b038216600081815260146020526040902080546001600160a01b03191690911790555b6001600160a01b03808316600090815260146020526040812054611fd2921683612958565b6000600182511015612c9c5760405162461bcd60e51b815260040161086590613776565b506020015160001a90565b6000600582511015612ccb5760405162461bcd60e51b8152600401610865906137ab565b506024015160001a90565b6000612d2b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f3d9092919063ffffffff16565b80519091501561262257808060200190516020811015612d4a57600080fd5b50516126225760405162461bcd60e51b815260040180806020018281038252602a815260200180613f0b602a913960400191505060405180910390fd5b4690565b6000612dcc436040518060400160405280601c81526020017f626c6f636b206e756d6265722065786365656473203332206269747300000000815250612f0d565b905060008463ffffffff16118015612e1557506001600160a01b038516600090815260176020908152604080832063ffffffff6000198901811685529252909120548282169116145b15612e52576001600160a01b038516600090815260176020908152604080832063ffffffff60001989011684529091529020600101829055612ec3565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152601784528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260189092529390208054928801909116919092161790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051612efe929190613d72565b60405180910390a25050505050565b6000816401000000008410612f355760405162461bcd60e51b81526004016108659190613720565b509192915050565b6060612f4c8484600085612f54565b949350505050565b606082471015612f955760405162461bcd60e51b8152600401808060200182810382526026815260200180613ea36026913960400191505060405180910390fd5b612f9e856130af565b612fef576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b6020831061302d5780518252601f19909201916020918201910161300e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461308f576040519150601f19603f3d011682016040523d82523d6000602084013e613094565b606091505b50915091506130a48282866130b5565b979650505050505050565b3b151590565b606083156130c457508161179e565b8251156130d45782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561311e578181015183820152602001613106565b50505050905090810190601f16801561314b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080516060810182526000808252602082018190529181019190915290565b803561060e81613e4b565b600082601f830112613194578081fd5b813560206131a96131a483613e01565b613ddd565b82815281810190858301838502870184018810156131c5578586fd5b855b858110156131e3578135845292840192908401906001016131c7565b5090979650505050505050565b600082601f830112613200578081fd5b813560206132106131a483613e01565b828152818101908583018385028701840188101561322c578586fd5b855b858110156131e35761323f82613251565b8452928401929084019060010161322e565b803560ff8116811461060e57600080fd5b600060208284031215613273578081fd5b813561179e81613e4b565b60008060008060008060c08789031215613296578182fd5b61329f87613179565b9550602087013567ffffffffffffffff808211156132bb578384fd5b6132c78a838b01613184565b965060408901359150808211156132dc578384fd5b6132e88a838b01613184565b955060608901359150808211156132fd578384fd5b6133098a838b016131f0565b9450608089013591508082111561331e578384fd5b61332a8a838b01613184565b935060a089013591508082111561333f578283fd5b5061334c89828a01613184565b9150509295509295509295565b6000806000806080858703121561336e578384fd5b843561337981613e4b565b9350602085013561338981613e4b565b92506040850135915060608501356133a081613e4b565b939692955090935050565b600080604083850312156133bd578182fd5b82356133c881613e4b565b946020939093013593505050565b60008060008060008060c087890312156133ee578182fd5b86356133f981613e4b565b9550602087013594506040870135935061341560608801613251565b92506080870135915060a087013590509295509295509295565b60008060408385031215613441578182fd5b823561344c81613e4b565b9150602083013563ffffffff81168114613464578182fd5b809150509250929050565b600060208284031215613480578081fd5b8151801515811461179e578182fd5b6000602082840312156134a0578081fd5b5035919050565b6000602082840312156134b8578081fd5b5051919050565b600080604083850312156134d1578182fd5b50508035926020909101359150565b6000806000606084860312156134f4578081fd5b833592506020808501359250604085013567ffffffffffffffff8082111561351a578384fd5b818701915087601f83011261352d578384fd5b81358181111561353957fe5b61354b601f8201601f19168501613ddd565b91508082528884828501011115613560578485fd5b808484018584013784848284010152508093505050509250925092565b60008151808452613595816020860160208601613e1f565b601f01601f19169290920160200192915050565b600082516135bb818460208701613e1f565b9190910192915050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b039690961686526020860194909452604085019290925260ff166060840152608083015260a082015260c00190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b60006020825261179e602083018461357d565b60208082526023908201527f446578446174613a20746f556e69563350617468207061746820746f6f2073686040820152621bdc9d60ea1b606082015260800190565b6020808252818101527f446578446174613a20746f4465782077726f6e67206461746120666f726d6174604082015260600190565b60208082526028908201527f446578446174613a20746f41727261794c656e6774682077726f6e67206461746040820152671848199bdc9b585d60c21b606082015260800190565b6020808252601390820152724e6f7468696e6720746f20776974686472617760681b604082015260600190565b60208082526024908201527f43616e6e6f742061646420746f2065787069726564206c6f636b2e20576974686040820152636472617760e01b606082015260800190565b60208082526026908201527f446578446174613a20746f556e695632506174682077726f6e67206461746120604082015265199bdc9b585d60d21b606082015260800190565b602080825260129082015271457863656564204f4c452062616c616e636560701b604082015260600190565b6020808252818101527f64656c656761746542795369673a20696e76616c6964207369676e6174757265604082015260600190565b6020808252818101527f6765745072696f72566f7465733a6e6f74207965742064657465726d696e6564604082015260600190565b6020808252601f908201527f43616e206f6e6c7920696e637265617365206c6f636b206475726174696f6e00604082015260600190565b60208082526026908201527f446578446174613a20746f556e695633506174682077726f6e67206461746120604082015265199bdc9b585d60d21b606082015260800190565b602080825260089082015267446576206f6e6c7960c01b604082015260600190565b60208082526018908201527f5f64657620616464726573732063616e6e6f7420626520300000000000000000604082015260600190565b6020808252818101527f64656c656761746542795369673a207369676e61747572652065787069726564604082015260600190565b6020808252600c908201526b0c8cad8cacec2e8caca7460f60a31b604082015260600190565b602080825260119082015270139bdd1a1a5b99c81a5cc81b1bd8dad959607a1b604082015260600190565b60208082526018908201527f45786365656420617661696c61626c652062616c616e63650000000000000000604082015260600190565b6020808252601e908201527f566f74696e67206c6f636b2063616e2062652034207965617273206d61780000604082015260600190565b6020808252601e908201527f43616e277420736861726520776974686f7574206c6f636b6564204f4c450000604082015260600190565b60208082526019908201527f5769746864726177206f6c6420746f6b656e7320666972737400000000000000604082015260600190565b6020808252600e908201526d4e6f6e207a65726f2076616c756560901b604082015260600190565b60208082526026908201527f43616e206f6e6c79206c6f636b20756e74696c2074696d6520696e207468652060408201526566757475726560d01b606082015260800190565b6020808252601c908201527f64656c656761746542795369673a20696e76616c6964206e6f6e636500000000604082015260600190565b6020808252600c908201526b131bd8dac8195e1c1a5c995960a21b604082015260600190565b602080825260169082015275139bc8195e1a5cdd1a5b99c81b1bd8dac8199bdd5b9960521b604082015260600190565b6020808252601390820152724e6f2066756e6420746f20776974686472617760681b604082015260600190565b6020808252601d908201527f5f6f6c65546f6b656e20616464726573732063616e6e6f742062652030000000604082015260600190565b6020808252601590820152746e656564206e6f6e202d207a65726f2076616c756560581b604082015260600190565b6020808252600990820152682737ba1030b236b4b760b91b604082015260600190565b602080825260169082015275546865206c6f636b206469646e27742065787069726560501b604082015260600190565b928352600f9190910b6020830152604082015260600190565b918252602082015260400190565b600084825283602083015260606040830152613d9f606083018461357d565b95945050505050565b63ffffffff91909116815260200190565b63ffffffff929092168252602082015260400190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715613df957fe5b604052919050565b600067ffffffffffffffff821115613e1557fe5b5060209081020190565b60005b83811015613e3a578181015183820152602001613e22565b8381111561227f5750506000910152565b6001600160a01b0381168114610ce157600080fdfe5265656e7472616e637947756172643a207265656e7472616e742063616c6c006f6e6c792070656e64696e6741646d696e2063616e206163636570742061646d696e416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7763616c6c6572206d7573742062652061646d696e206f7220646576656c6f7065725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220477bf4a1e3961a7c0b7f6eec98dc1f88320065fc14e263d762c35203e221d32e64736f6c63430007060033