false
false
0

Contract Address Details

0xEc69ecD8D6F1301e4bD9dE5a4e91364B01cDc963

Contract Name
MaiaBondDepository
Creator
0x88e07a–da1c98 at 0x9bbcb5–0fb984
Balance
0 METIS ( )
Tokens
Fetching tokens...
Transactions
266 Transactions
Transfers
262 Transfers
Gas Used
33,240,233
Last Balance Update
14113222
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
MaiaBondDepository




Optimization enabled
true
Compiler version
v0.7.5+commit.eb77ed08




Optimization runs
200
EVM Version
default




Verified at
2022-01-10T01:07:02.656195Z

Constructor Arguments

00000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead00000000000000000000000000003d183e4f3eef0191ecffafd7ffc5df8d38520fa900000000000000000000000088e07a0457aa113ab910103d9a01217315da1c98

Arg [0] (address) : 0x72c232d56542ba082592dee7c77b1c6cfa758bcd
Arg [1] (address) : 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000
Arg [2] (address) : 0x3d183e4f3eef0191ecffafd7ffc5df8d38520fa9
Arg [3] (address) : 0x88e07a0457aa113ab910103d9a01217315da1c98

              

Contract source code

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;

interface IOwnable {
  function policy() external view returns (address);

  function renounceManagement() external;
  
  function pushManagement( address newOwner_ ) external;
  
  function pullManagement() external;
}

contract Ownable is IOwnable {

    address internal _owner;
    address internal _newOwner;

    event OwnershipPushed(address indexed previousOwner, address indexed newOwner);
    event OwnershipPulled(address indexed previousOwner, address indexed newOwner);

    constructor () {
        _owner = msg.sender;
        emit OwnershipPushed( address(0), _owner );
    }

    function policy() public view override returns (address) {
        return _owner;
    }

    modifier onlyPolicy() {
        require( _owner == msg.sender, "Ownable: caller is not the owner" );
        _;
    }

    function renounceManagement() public virtual override onlyPolicy() {
        emit OwnershipPushed( _owner, address(0) );
        _owner = address(0);
    }

    function pushManagement( address newOwner_ ) public virtual override onlyPolicy() {
        require( newOwner_ != address(0), "Ownable: new owner is the zero address");
        emit OwnershipPushed( _owner, newOwner_ );
        _newOwner = newOwner_;
    }
    
    function pullManagement() public virtual override {
        require( msg.sender == _newOwner, "Ownable: must be new owner to pull");
        emit OwnershipPulled( _owner, _newOwner );
        _owner = _newOwner;
    }
}

library LowGasSafeMath {
    /// @notice Returns x + y, reverts if sum overflows uint256
    /// @param x The augend
    /// @param y The addend
    /// @return z The sum of x and y
    function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
        require((z = x + y) >= x);
    }

    function add32(uint32 x, uint32 y) internal pure returns (uint32 z) {
        require((z = x + y) >= x);
    }

    /// @notice Returns x - y, reverts if underflows
    /// @param x The minuend
    /// @param y The subtrahend
    /// @return z The difference of x and y
    function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
        require((z = x - y) <= x);
    }

    function sub32(uint32 x, uint32 y) internal pure returns (uint32 z) {
        require((z = x - y) <= x);
    }

    /// @notice Returns x * y, reverts if overflows
    /// @param x The multiplicand
    /// @param y The multiplier
    /// @return z The product of x and y
    function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
        require(x == 0 || (z = x * y) / x == y);
    }

    /// @notice Returns x + y, reverts if overflows or underflows
    /// @param x The augend
    /// @param y The addend
    /// @return z The sum of x and y
    function add(int256 x, int256 y) internal pure returns (int256 z) {
        require((z = x + y) >= x == (y >= 0));
    }

    /// @notice Returns x - y, reverts if overflows or underflows
    /// @param x The minuend
    /// @param y The subtrahend
    /// @return z The difference of x and y
    function sub(int256 x, int256 y) internal pure returns (int256 z) {
        require((z = x - y) <= x == (y >= 0));
    }

    function div(uint256 x, uint256 y) internal pure returns(uint256 z){
        require(y > 0);
        z=x/y;
    }
}

library Address {

    function isContract(address account) internal view returns (bool) {

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

    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");
    }

    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    function functionCall(
        address target, 
        bytes memory data, 
        string memory errorMessage
    ) internal returns (bytes memory) {
        return _functionCallWithValue(target, data, 0, errorMessage);
    }

    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");
    }

    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);
    }

    function _functionCallWithValue(
        address target, 
        bytes memory data, 
        uint256 weiValue, 
        string memory errorMessage
    ) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        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);
            }
        }
    }

    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    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);
    }

    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    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 {
            if (returndata.length > 0) {

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }

    function addressToString(address _address) internal pure returns(string memory) {
        bytes32 _bytes = bytes32(uint256(_address));
        bytes memory HEX = "0123456789abcdef";
        bytes memory _addr = new bytes(42);

        _addr[0] = '0';
        _addr[1] = 'x';

        for(uint256 i = 0; i < 20; i++) {
            _addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)];
            _addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
        }

        return string(_addr);

    }
}

interface IERC20 {
    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

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

    function transfer(address recipient, uint256 amount) external returns (bool);

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

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

    event Approval(address indexed owner, address indexed spender, uint256 value);
}

library SafeERC20 {
    using LowGasSafeMath for uint256;
    using Address for address;

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

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

    function safeApprove(IERC20 token, address spender, uint256 value) internal {

        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

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

    function _callOptionalReturn(IERC20 token, bytes memory data) private {

        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");
        }
    }
}

library FullMath {
    function fullMul(uint256 x, uint256 y) private pure returns (uint256 l, uint256 h) {
        uint256 mm = mulmod(x, y, uint256(-1));
        l = x * y;
        h = mm - l;
        if (mm < l) h -= 1;
    }

    function fullDiv(
        uint256 l,
        uint256 h,
        uint256 d
    ) private pure returns (uint256) {
        uint256 pow2 = d & -d;
        d /= pow2;
        l /= pow2;
        l += h * ((-pow2) / pow2 + 1);
        uint256 r = 1;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        return l * r;
    }

    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 d
    ) internal pure returns (uint256) {
        (uint256 l, uint256 h) = fullMul(x, y);
        uint256 mm = mulmod(x, y, d);
        if (mm > l) h -= 1;
        l -= mm;
        require(h < d, 'FullMath::mulDiv: overflow');
        return fullDiv(l, h, d);
    }
}

library FixedPoint {

    struct uq112x112 {
        uint224 _x;
    }

    struct uq144x112 {
        uint256 _x;
    }

    uint8 private constant RESOLUTION = 112;
    uint256 private constant Q112 = 0x10000000000000000000000000000;
    uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000;
    uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)

    function decode(uq112x112 memory self) internal pure returns (uint112) {
        return uint112(self._x >> RESOLUTION);
    }

    function decode112with18(uq112x112 memory self) internal pure returns (uint) {

        return uint(self._x) / 5192296858534827;
    }

    function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
        require(denominator > 0, 'FixedPoint::fraction: division by zero');
        if (numerator == 0) return FixedPoint.uq112x112(0);

        if (numerator <= uint144(-1)) {
            uint256 result = (numerator << RESOLUTION) / denominator;
            require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
            return uq112x112(uint224(result));
        } else {
            uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
            require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
            return uq112x112(uint224(result));
        }
    }
}

interface ITreasury {
    function deposit( uint _amount, address _token, uint _profit ) external returns ( uint );
    function valueOfToken( address _token, uint _amount ) external view returns ( uint value_ );
    function mintRewards( address _recipient, uint _amount ) external;
}

interface IStaking {
    function stake( uint _amount, address _recipient ) external returns ( bool );
}

interface IStakingHelper {
    function stake( uint _amount, address _recipient ) external;
}

interface IWMATIC9 is IERC20 {
    /// @notice Deposit ether to get wrapped ether
    function deposit() external payable;
}

contract MaiaBondDepository is Ownable {

    using FixedPoint for *;
    using SafeERC20 for IERC20;
    using SafeERC20 for IWMATIC9;
    using LowGasSafeMath for uint;
    using LowGasSafeMath for uint32;




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

    event BondCreated( uint deposit, uint indexed payout, uint indexed expires, uint indexed priceInUSD );
    event BondRedeemed( address indexed recipient, uint payout, uint remaining );
    event BondPriceChanged( uint indexed priceInUSD, uint indexed internalPrice, uint indexed debtRatio );
    event ControlVariableAdjustment( uint initialBCV, uint newBCV, uint adjustment, bool addition );




    /* ======== STATE VARIABLES ======== */
    IERC20 public immutable Time; // token given as payment for bond
    IWMATIC9 public immutable principle; // token used to create bond
    ITreasury public immutable treasury; // mints Time when receives principle
    address public immutable DAO; // receives profit share from bond

    IStaking public staking; // to auto-stake payout
    IStakingHelper public stakingHelper; // to stake and claim if no staking warmup
    bool public useHelper;

    Terms public terms; // stores terms for new bonds
    Adjust public adjustment; // stores adjustment to BCV data

    mapping( address => Bond ) public bondInfo; // stores bond information for depositors

    uint public totalDebt; // total value of outstanding bonds; used for pricing
    uint32 public lastDecay; // reference time for debt decay


    mapping (address => bool) public allowedZappers;


    /* ======== STRUCTS ======== */

    // Info for creating new bonds
    struct Terms {
        uint controlVariable; // scaling variable for price
        uint minimumPrice; // vs principle value. 4 decimals (1500 = 0.15)
        uint maxPayout; // in thousandths of a %. i.e. 500 = 0.5%
        uint maxDebt; // 9 decimal debt ratio, max % total supply created as debt
        uint32 vestingTerm; // in seconds
    }

    // Info for bond holder
    struct Bond {
        uint payout; // Time remaining to be paid
        uint pricePaid; // In DAI, for front end viewing
        uint32 vesting; // Seconds left to vest
        uint32 lastTime; // Last interaction
    }

    // Info for incremental adjustments to control variable 
    struct Adjust {
        bool add; // addition or subtraction
        uint rate; // increment
        uint target; // BCV when adjustment finished
        uint32 buffer; // minimum length (in seconds) between adjustments
        uint32 lastTime; // time when last adjustment made
    }




    /* ======== INITIALIZATION ======== */

    constructor ( 
        address _Time,
        address _principle,
        address _treasury, 
        address _DAO
    ) {
        require( _Time != address(0) );
        Time = IERC20(_Time);
        require( _principle != address(0) );
        principle = IWMATIC9(_principle);
        require( _treasury != address(0) );
        treasury = ITreasury(_treasury);
        require( _DAO != address(0) );
        DAO = _DAO;
    }

    /**
     *  @notice initializes bond parameters
     *  @param _controlVariable uint
     *  @param _vestingTerm uint
     *  @param _minimumPrice uint
     *  @param _maxPayout uint
     *  @param _maxDebt uint
     */
    function initializeBondTerms( 
        uint _controlVariable, 
        uint _minimumPrice,
        uint _maxPayout,
        uint _maxDebt,
        uint32 _vestingTerm
    ) external onlyPolicy() {
        require( currentDebt() == 0, "Debt must be 0 for initialization" );
        require( _controlVariable >= 40, "Can lock adjustment" );
        require( _maxPayout <= 10000, "Payout cannot be above 1 percent" );
        require( _vestingTerm >= 129600, "Vesting must be longer than 36 hours" );
        terms = Terms ({
            controlVariable: _controlVariable,
            vestingTerm: _vestingTerm,
            minimumPrice: _minimumPrice,
            maxPayout: _maxPayout,
            maxDebt: _maxDebt
        });
        lastDecay = uint32(block.timestamp);
    }



    
    /* ======== POLICY FUNCTIONS ======== */

    enum PARAMETER { VESTING, PAYOUT, DEBT, MINPRICE }
    /**
     *  @notice set parameters for new bonds
     *  @param _parameter PARAMETER
     *  @param _input uint
     */
    function setBondTerms ( PARAMETER _parameter, uint _input ) external onlyPolicy() {
        if ( _parameter == PARAMETER.VESTING ) { // 0
            require( _input >= 129600, "Vesting must be longer than 36 hours" );
            terms.vestingTerm = uint32(_input);
        } else if ( _parameter == PARAMETER.PAYOUT ) { // 1
            require( _input <= 10000, "Payout cannot be above 1 percent" );
            terms.maxPayout = _input;
        } else if ( _parameter == PARAMETER.DEBT ) { // 2
            terms.maxDebt = _input;
        } else if ( _parameter == PARAMETER.MINPRICE ) { // 3
            terms.minimumPrice = _input;
        }
    }

    /**
     *  @notice set control variable adjustment
     *  @param _addition bool
     *  @param _increment uint
     *  @param _target uint
     *  @param _buffer uint
     */
    function setAdjustment ( 
        bool _addition,
        uint _increment, 
        uint _target,
        uint32 _buffer 
    ) external onlyPolicy() {
        require( _increment <= terms.controlVariable.mul( 25 )/ 1000, "Increment too large" );
        require(_target >= 40, "Next Adjustment could be locked");
        adjustment = Adjust({
            add: _addition,
            rate: _increment,
            target: _target,
            buffer: _buffer,
            lastTime: uint32(block.timestamp)
        });
    }

    /**
     *  @notice set contract for auto stake
     *  @param _staking address
     *  @param _helper bool
     */
    function setStaking( address _staking, bool _helper ) external onlyPolicy() {
        require( _staking != address(0) , "IA");
        if ( _helper ) {
            useHelper = true;
            stakingHelper = IStakingHelper(_staking);
        } else {
            useHelper = false;
            staking = IStaking(_staking);
        }
    }

    function allowZapper(address zapper) external onlyPolicy {
        require(zapper != address(0), "ZNA");
        
        allowedZappers[zapper] = true;
    }

    function removeZapper(address zapper) external onlyPolicy {
       
        allowedZappers[zapper] = false;
    }


    

    /* ======== USER FUNCTIONS ======== */

    /**
     *  @notice deposit bond
     *  @param _amount uint
     *  @param _maxPrice uint
     *  @param _depositor address
     *  @return uint
     */
    function deposit( 
        uint _amount, 
        uint _maxPrice,
        address _depositor
    ) external payable returns ( uint ) {
        require( _depositor != address(0), "Invalid address" );
        require(msg.sender == _depositor || allowedZappers[msg.sender], "LFNA");
        decayDebt();
        require( totalDebt <= terms.maxDebt, "Max capacity reached" );
        
        uint priceInUSD = bondPriceInUSD(); // Stored in bond info
        uint nativePrice = _bondPrice();

        require( _maxPrice >= nativePrice, "Slippage limit: more than max price" ); // slippage protection

        uint value = treasury.valueOfToken( address(principle), _amount );
        uint payout = payoutFor( value ); // payout to bonder is computed

        require( payout >= 10000000, "Bond too small" ); // must be > 0.01 Time ( underflow protection )
        require( payout <= maxPayout(), "Bond too large"); // size protection because there is no slippage

        /**
            asset carries risk and is not minted against
            asset transfered to treasury and rewards minted as payout
         */
        if (address(this).balance >= _amount) {
            // pay with WETH9
            require(msg.value == _amount, "UA");
            principle.deposit{value: _amount}(); // wrap only what is needed to pay
            principle.transfer(address(treasury), _amount);
        } else {
            principle.safeTransferFrom( msg.sender, address(treasury), _amount );
        }
        
        treasury.mintRewards( address(this), payout );
        
        // total debt is increased
        totalDebt = totalDebt.add( value ); 
                
        // depositor info is stored
        bondInfo[ _depositor ] = Bond({ 
            payout: bondInfo[ _depositor ].payout.add( payout ),
            vesting: terms.vestingTerm,
            lastTime: uint32(block.timestamp),
            pricePaid: priceInUSD
        });

        // indexed events are emitted
        emit BondCreated( _amount, payout, block.timestamp.add( terms.vestingTerm ), priceInUSD );
        emit BondPriceChanged( bondPriceInUSD(), _bondPrice(), debtRatio() );

        adjust(); // control variable is adjusted
        return payout; 
    }

    /** 
     *  @notice redeem bond for user
     *  @param _recipient address
     *  @param _stake bool
     *  @return uint
     */ 
    function redeem( address _recipient, bool _stake ) external returns ( uint ) { 
        require(msg.sender == _recipient, "NA");       
        Bond memory info = bondInfo[ _recipient ];
        uint percentVested = percentVestedFor( _recipient ); // (seconds since last interaction / vesting term remaining)

        if ( percentVested >= 10000 ) { // if fully vested
            delete bondInfo[ _recipient ]; // delete user info
            emit BondRedeemed( _recipient, info.payout, 0 ); // emit bond data
            return stakeOrSend( _recipient, _stake, info.payout ); // pay user everything due

        } else { // if unfinished
            // calculate payout vested
            uint payout = info.payout.mul( percentVested )/ 10000;

            // store updated deposit info
            bondInfo[ _recipient ] = Bond({
                payout: info.payout.sub( payout ),
                vesting: info.vesting.sub32( uint32( block.timestamp ).sub32( info.lastTime ) ),
                lastTime: uint32( block.timestamp ),
                pricePaid: info.pricePaid
            });

            emit BondRedeemed( _recipient, payout, bondInfo[ _recipient ].payout );
            return stakeOrSend( _recipient, _stake, payout );
        }
    }



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

    /**
     *  @notice allow user to stake payout automatically
     *  @param _stake bool
     *  @param _amount uint
     *  @return uint
     */
    function stakeOrSend( address _recipient, bool _stake, uint _amount ) internal returns ( uint ) {
        if ( !_stake ) { // if user does not want to stake
            Time.transfer( _recipient, _amount ); // send payout
        } else { // if user wants to stake
            if ( useHelper ) { // use if staking warmup is 0
                Time.approve( address(stakingHelper), _amount );
                stakingHelper.stake( _amount, _recipient );
            } else {
                Time.approve( address(staking), _amount );
                staking.stake( _amount, _recipient );
            }
        }
        return _amount;
    }

    /**
     *  @notice makes incremental adjustment to control variable
     */
    function adjust() internal {
         uint timeCanAdjust = adjustment.lastTime.add32( adjustment.buffer );
         if( adjustment.rate != 0 && block.timestamp >= timeCanAdjust ) {
            uint initial = terms.controlVariable;
            if ( adjustment.add ) {
                terms.controlVariable = terms.controlVariable.add( adjustment.rate );
                if ( terms.controlVariable >= adjustment.target ) {
                    adjustment.rate = 0;
                }
            } else {
                terms.controlVariable = terms.controlVariable.sub( adjustment.rate );
                if ( terms.controlVariable <= adjustment.target ) {
                    adjustment.rate = 0;
                }
            }
            adjustment.lastTime = uint32(block.timestamp);
            emit ControlVariableAdjustment( initial, terms.controlVariable, adjustment.rate, adjustment.add );
        }
    }

    /**
     *  @notice reduce total debt
     */
    function decayDebt() internal {
        totalDebt = totalDebt.sub( debtDecay() );
        lastDecay = uint32(block.timestamp);
    }




    /* ======== VIEW FUNCTIONS ======== */

    /**
     *  @notice determine maximum bond size
     *  @return uint
     */
    function maxPayout() public view returns ( uint ) {
        return Time.totalSupply().mul( terms.maxPayout )/ 100000;
    }

    /**
     *  @notice calculate interest due for new bond
     *  @param _value uint
     *  @return uint
     */
    function payoutFor( uint _value ) public view returns ( uint ) {
        return FixedPoint.fraction( _value, bondPrice() ).decode112with18()/ 1e14;
    }

    /**
     *  @notice calculate current bond premium
     *  @return price_ uint
     */
    function bondPrice() public view returns ( uint price_ ) {        
        price_ = terms.minimumPrice;        
    }

    /**
     *  @notice calculate current bond price and remove floor if above
     *  @return price_ uint
     */
    function _bondPrice() internal returns ( uint price_ ) {
        price_ = terms.minimumPrice;        
    }

      /**
     *  @notice converts bond price to DAI value
     *  @return price_ uint
     */
    function bondPriceInUSD() public view returns ( uint price_ ) {
        price_ = bondPrice().mul( 10 ** principle.decimals() ) / 100;
    }

    /**
     *  @notice calculate current ratio of debt to Time supply
     *  @return debtRatio_ uint
     */
    function debtRatio() public view returns ( uint debtRatio_ ) {   
        uint supply = Time.totalSupply();
        debtRatio_ = FixedPoint.fraction( 
            currentDebt().mul( 1e9 ), 
            supply
        ).decode112with18()/ 1e18;
    }

    /**
     *  @notice debt ratio in same terms as reserve bonds
     *  @return uint
     */
    function standardizedDebtRatio() external view returns ( uint ) {
        return debtRatio();
    }

    /**
     *  @notice calculate debt factoring in decay
     *  @return uint
     */
    function currentDebt() public view returns ( uint ) {
        return totalDebt.sub( debtDecay() );
    }

    /**
     *  @notice amount to decay total debt by
     *  @return decay_ uint
     */
    function debtDecay() public view returns ( uint decay_ ) {
        uint32 timeSinceLast = uint32(block.timestamp).sub32( lastDecay );
        decay_ = (totalDebt.mul( timeSinceLast )).div(terms.vestingTerm);
        if ( decay_ > totalDebt ) {
            decay_ = totalDebt;
        }
    }


    /**
     *  @notice calculate how far into vesting a depositor is
     *  @param _depositor address
     *  @return percentVested_ uint
     */
    function percentVestedFor( address _depositor ) public view returns ( uint percentVested_ ) {
        Bond memory bond = bondInfo[ _depositor ];
        uint secondsSinceLast = uint32(block.timestamp).sub32( bond.lastTime );
        uint vesting = bond.vesting;

        if ( vesting > 0 ) {
            percentVested_ = (secondsSinceLast.mul( 10000 )).div(vesting);
        } else {
            percentVested_ = 0;
        }
    }

    /**
     *  @notice calculate amount of Time available for claim by depositor
     *  @param _depositor address
     *  @return pendingPayout_ uint
     */
    function pendingPayoutFor( address _depositor ) external view returns ( uint pendingPayout_ ) {
        uint percentVested = percentVestedFor( _depositor );
        uint payout = bondInfo[ _depositor ].payout;

        if ( percentVested >= 10000 ) {
            pendingPayout_ = payout;
        } else {
            pendingPayout_ = payout.mul( percentVested )/ 10000;
        }
    }




    /* ======= AUXILLIARY ======= */

    /**
     *  @notice allow anyone to send lost tokens (excluding principle or Time) to the DAO
     *  @return bool
     */
    function recoverLostToken( IERC20 _token ) external returns ( bool ) {
        require( _token != Time, "NAT" );
        require( _token != principle, "NAP" );
        _token.safeTransfer( DAO, _token.balanceOf( address(this) ) );
        return true;
    }

    function recoverLostETH() internal {
        if (address(this).balance > 0) safeTransferETH(DAO, address(this).balance);
    }

    /// @notice Transfers ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_Time","internalType":"address"},{"type":"address","name":"_principle","internalType":"address"},{"type":"address","name":"_treasury","internalType":"address"},{"type":"address","name":"_DAO","internalType":"address"}]},{"type":"event","name":"BondCreated","inputs":[{"type":"uint256","name":"deposit","internalType":"uint256","indexed":false},{"type":"uint256","name":"payout","internalType":"uint256","indexed":true},{"type":"uint256","name":"expires","internalType":"uint256","indexed":true},{"type":"uint256","name":"priceInUSD","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"BondPriceChanged","inputs":[{"type":"uint256","name":"priceInUSD","internalType":"uint256","indexed":true},{"type":"uint256","name":"internalPrice","internalType":"uint256","indexed":true},{"type":"uint256","name":"debtRatio","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"BondRedeemed","inputs":[{"type":"address","name":"recipient","internalType":"address","indexed":true},{"type":"uint256","name":"payout","internalType":"uint256","indexed":false},{"type":"uint256","name":"remaining","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ControlVariableAdjustment","inputs":[{"type":"uint256","name":"initialBCV","internalType":"uint256","indexed":false},{"type":"uint256","name":"newBCV","internalType":"uint256","indexed":false},{"type":"uint256","name":"adjustment","internalType":"uint256","indexed":false},{"type":"bool","name":"addition","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipPulled","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipPushed","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"DAO","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"Time","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"add","internalType":"bool"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"target","internalType":"uint256"},{"type":"uint32","name":"buffer","internalType":"uint32"},{"type":"uint32","name":"lastTime","internalType":"uint32"}],"name":"adjustment","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"allowZapper","inputs":[{"type":"address","name":"zapper","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"allowedZappers","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"payout","internalType":"uint256"},{"type":"uint256","name":"pricePaid","internalType":"uint256"},{"type":"uint32","name":"vesting","internalType":"uint32"},{"type":"uint32","name":"lastTime","internalType":"uint32"}],"name":"bondInfo","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"price_","internalType":"uint256"}],"name":"bondPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"price_","internalType":"uint256"}],"name":"bondPriceInUSD","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentDebt","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"decay_","internalType":"uint256"}],"name":"debtDecay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"debtRatio_","internalType":"uint256"}],"name":"debtRatio","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"deposit","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"uint256","name":"_maxPrice","internalType":"uint256"},{"type":"address","name":"_depositor","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initializeBondTerms","inputs":[{"type":"uint256","name":"_controlVariable","internalType":"uint256"},{"type":"uint256","name":"_minimumPrice","internalType":"uint256"},{"type":"uint256","name":"_maxPayout","internalType":"uint256"},{"type":"uint256","name":"_maxDebt","internalType":"uint256"},{"type":"uint32","name":"_vestingTerm","internalType":"uint32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"lastDecay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxPayout","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"payoutFor","inputs":[{"type":"uint256","name":"_value","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"pendingPayout_","internalType":"uint256"}],"name":"pendingPayoutFor","inputs":[{"type":"address","name":"_depositor","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"percentVested_","internalType":"uint256"}],"name":"percentVestedFor","inputs":[{"type":"address","name":"_depositor","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"policy","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IWMATIC9"}],"name":"principle","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pullManagement","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pushManagement","inputs":[{"type":"address","name":"newOwner_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"recoverLostToken","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"redeem","inputs":[{"type":"address","name":"_recipient","internalType":"address"},{"type":"bool","name":"_stake","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeZapper","inputs":[{"type":"address","name":"zapper","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceManagement","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdjustment","inputs":[{"type":"bool","name":"_addition","internalType":"bool"},{"type":"uint256","name":"_increment","internalType":"uint256"},{"type":"uint256","name":"_target","internalType":"uint256"},{"type":"uint32","name":"_buffer","internalType":"uint32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBondTerms","inputs":[{"type":"uint8","name":"_parameter","internalType":"enum MaiaBondDepository.PARAMETER"},{"type":"uint256","name":"_input","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStaking","inputs":[{"type":"address","name":"_staking","internalType":"address"},{"type":"bool","name":"_helper","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IStaking"}],"name":"staking","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IStakingHelper"}],"name":"stakingHelper","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"standardizedDebtRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"controlVariable","internalType":"uint256"},{"type":"uint256","name":"minimumPrice","internalType":"uint256"},{"type":"uint256","name":"maxPayout","internalType":"uint256"},{"type":"uint256","name":"maxDebt","internalType":"uint256"},{"type":"uint32","name":"vestingTerm","internalType":"uint32"}],"name":"terms","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalDebt","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ITreasury"}],"name":"treasury","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"useHelper","inputs":[]}]
              

Contract Creation Code

0x6101006040523480156200001257600080fd5b5060405162002eeb38038062002eeb833981810160405260808110156200003857600080fd5b5080516020820151604080840151606090940151600080546001600160a01b031916331780825592519495939491926001600160a01b0316917fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba908290a36001600160a01b038416620000aa57600080fd5b6001600160601b0319606085901b166080526001600160a01b038316620000d057600080fd5b6001600160601b0319606084901b1660a0526001600160a01b038216620000f657600080fd5b6001600160601b0319606083901b1660c0526001600160a01b0381166200011c57600080fd5b6001600160601b031960609190911b1660e05250505060805160601c60a05160601c60c05160601c60e05160601c612d22620001c960003980611a515280611cd25250806111e75280611524528061176d528061183552806118815250806107e8528061131e528061155352806116ca528061173e52806118125280611c62525080611bf55280611dba5280611fa6528061209652806120eb52806121d052806122e55250612d226000f3fe60806040526004361061020f5760003560e01c80637927ebf811610118578063d4d863ce116100a0578063e0176de81161006f578063e0176de814610764578063e392a26214610779578063f5c2ab5b1461078e578063f8e157ea146107bc578063fc7b9c18146107d15761020f565b8063d4d863ce1461069b578063d5025625146106d6578063d7ccfb0b1461071c578063dc6549fb146107315761020f565b806398fabd3a116100e757806398fabd3a1461059b578063ae9832cf146105b0578063b4abccba146105f4578063cd1234b314610627578063cea55f57146106865761020f565b80637927ebf814610515578063844b5c7c1461053f5780638dbdbe6d14610554578063904b3ece146105865761020f565b8063451ee4a11161019b5780635a96ac0a1161016a5780635a96ac0a1461048e57806361d027b3146104a357806363b3256b146104b8578063759076e5146104eb57806377b81895146105005761020f565b8063451ee4a1146103c857806346f68ee9146104135780634cf088d914610446578063507930ec1461045b5761020f565b80630ab69367116101e25780630ab69367146102b65780631e321a0f146102fe5780631ed2d71a146103315780631feed31f146103645780632f3f470a1461039f5761020f565b8063016a42841461021457806301b88ee8146102455780630505c8c91461028a578063089208d81461029f575b600080fd5b34801561022057600080fd5b506102296107e6565b604080516001600160a01b039092168252519081900360200190f35b34801561025157600080fd5b506102786004803603602081101561026857600080fd5b50356001600160a01b031661080a565b60408051918252519081900360200190f35b34801561029657600080fd5b50610229610862565b3480156102ab57600080fd5b506102b4610871565b005b3480156102c257600080fd5b506102b4600480360360a08110156102d957600080fd5b508035906020810135906040810135906060810135906080013563ffffffff16610908565b34801561030a57600080fd5b506102b46004803603604081101561032157600080fd5b5060ff8135169060200135610aec565b34801561033d57600080fd5b506102b46004803603602081101561035457600080fd5b50356001600160a01b0316610c5a565b34801561037057600080fd5b506102786004803603604081101561038757600080fd5b506001600160a01b0381351690602001351515610cc8565b3480156103ab57600080fd5b506103b4610f56565b604080519115158252519081900360200190f35b3480156103d457600080fd5b506103dd610f66565b60408051951515865260208601949094528484019290925263ffffffff9081166060850152166080830152519081900360a00190f35b34801561041f57600080fd5b506102b46004803603602081101561043657600080fd5b50356001600160a01b0316610f8c565b34801561045257600080fd5b50610229611079565b34801561046757600080fd5b506102786004803603602081101561047e57600080fd5b50356001600160a01b0316611088565b34801561049a57600080fd5b506102b461113b565b3480156104af57600080fd5b506102296111e5565b3480156104c457600080fd5b506102b4600480360360208110156104db57600080fd5b50356001600160a01b0316611209565b3480156104f757600080fd5b506102786112bb565b34801561050c57600080fd5b506102296112d6565b34801561052157600080fd5b506102786004803603602081101561053857600080fd5b50356112e5565b34801561054b57600080fd5b50610278611315565b6102786004803603606081101561056a57600080fd5b50803590602081013590604001356001600160a01b03166113c2565b34801561059257600080fd5b50610278611a45565b3480156105a757600080fd5b50610229611a4f565b3480156105bc57600080fd5b506102b4600480360360808110156105d357600080fd5b5080351515906020810135906040810135906060013563ffffffff16611a73565b34801561060057600080fd5b506103b46004803603602081101561061757600080fd5b50356001600160a01b0316611bf1565b34801561063357600080fd5b5061065a6004803603602081101561064a57600080fd5b50356001600160a01b0316611d83565b60408051948552602085019390935263ffffffff91821684840152166060830152519081900360800190f35b34801561069257600080fd5b50610278611db5565b3480156106a757600080fd5b506102b4600480360360408110156106be57600080fd5b506001600160a01b0381351690602001351515611e72565b3480156106e257600080fd5b506106eb611f62565b60408051958652602086019490945284840192909252606084015263ffffffff166080830152519081900360a00190f35b34801561072857600080fd5b50610278611f7a565b34801561073d57600080fd5b506103b46004803603602081101561075457600080fd5b50356001600160a01b0316611f80565b34801561077057600080fd5b50610278611f95565b34801561078557600080fd5b5061027861202f565b34801561079a57600080fd5b506107a3612088565b6040805163ffffffff9092168252519081900360200190f35b3480156107c857600080fd5b50610229612094565b3480156107dd57600080fd5b506102786120b8565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008061081683611088565b6001600160a01b0384166000908152600d602052604090205490915061271082106108435780925061085b565b61271061085082846120be565b8161085757fe5b0492505b5050919050565b6000546001600160a01b031690565b6000546001600160a01b031633146108be576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610955576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b61095d6112bb565b156109995760405162461bcd60e51b8152600401808060200182810382526021815260200180612c3b6021913960400191505060405180910390fd5b60288510156109e5576040805162461bcd60e51b815260206004820152601360248201527210d85b881b1bd8dac818591a9d5cdd1b595b9d606a1b604482015290519081900360640190fd5b612710831115610a3c576040805162461bcd60e51b815260206004820181905260248201527f5061796f75742063616e6e6f742062652061626f766520312070657263656e74604482015290519081900360640190fd5b6201fa408163ffffffff161015610a845760405162461bcd60e51b8152600401808060200182810382526024815260200180612c9f6024913960400191505060405180910390fd5b6040805160a081018252868152602081018690529081018490526060810183905263ffffffff91821660809091018190526004959095556005939093556006919091556007556008805463ffffffff199081169093179055600f805490921642909116179055565b6000546001600160a01b03163314610b39576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6000826003811115610b4757fe5b1415610ba9576201fa40811015610b8f5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c9f6024913960400191505060405180910390fd5b6008805463ffffffff191663ffffffff8316179055610c56565b6001826003811115610bb757fe5b1415610c1e57612710811115610c14576040805162461bcd60e51b815260206004820181905260248201527f5061796f75742063616e6e6f742062652061626f766520312070657263656e74604482015290519081900360640190fd5b6006819055610c56565b6002826003811115610c2c57fe5b1415610c3c576007819055610c56565b6003826003811115610c4a57fe5b1415610c565760058190555b5050565b6000546001600160a01b03163314610ca7576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000336001600160a01b03841614610d0c576040805162461bcd60e51b81526020600482015260026024820152614e4160f01b604482015290519081900360640190fd5b610d14612b86565b506001600160a01b0383166000908152600d602090815260408083208151608081018352815481526001820154938101939093526002015463ffffffff80821692840192909252600160201b900416606082015290610d7285611088565b90506127108110610e07576001600160a01b0385166000818152600d6020908152604080832083815560018101849055600201805467ffffffffffffffff19169055855181519081529182019290925281517f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b1929181900390910190a2610dfe858584600001516120e2565b92505050610f50565b815160009061271090610e1a90846120be565b81610e2157fe5b0490506040518060800160405280610e468386600001516123e690919063ffffffff16565b815260200184602001518152602001610e8e610e7586606001514263ffffffff166123f690919063ffffffff16565b866040015163ffffffff166123f690919063ffffffff16565b63ffffffff90811682524281166020928301526001600160a01b0389166000818152600d8452604090819020855180825586860151600183015586830151600290920180546060909801518616600160201b0267ffffffff00000000199390961663ffffffff19909816979097179190911693909317909455835185815292830191909152825190927f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b1928290030190a2610f4a8686836120e2565b93505050505b92915050565b600354600160a01b900460ff1681565b600954600a54600b54600c5460ff9093169263ffffffff80821691600160201b90041685565b6000546001600160a01b03163314610fd9576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6001600160a01b03811661101e5760405162461bcd60e51b8152600401808060200182810382526026815260200180612bcd6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba91a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031681565b6000611092612b86565b506001600160a01b0382166000908152600d602090815260408083208151608081018352815481526001820154938101939093526002015463ffffffff80821692840192909252600160201b90048116606083018190529192916110fb9142811691906123f616565b604083015163ffffffff918216925016801561112e5761112781611121846127106120be565b9061240f565b9350611133565b600093505b505050919050565b6001546001600160a01b031633146111845760405162461bcd60e51b8152600401808060200182810382526022815260200180612bf36022913960400191505060405180910390fd5b600154600080546040516001600160a01b0393841693909116917faa151555690c956fc3ea32f106bb9f119b5237a061eaa8557cff3e51e3792c8d91a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b03163314611256576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6001600160a01b038116611297576040805162461bcd60e51b81526020600482015260036024820152625a4e4160e81b604482015290519081900360640190fd5b6001600160a01b03166000908152601060205260409020805460ff19166001179055565b60006112d16112c861202f565b600e54906123e6565b905090565b6003546001600160a01b031681565b6000655af3107a4000611307611302846112fd611f7a565b61242e565b6125a5565b8161130e57fe5b0492915050565b600060646113b57f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561137557600080fd5b505afa158015611389573d6000803e3d6000fd5b505050506040513d602081101561139f57600080fd5b505160ff16600a0a6113af611f7a565b906120be565b816113bc57fe5b04905090565b60006001600160a01b038216611411576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b336001600160a01b038316148061143757503360009081526010602052604090205460ff165b611471576040805162461bcd60e51b815260206004808301919091526024820152634c464e4160e01b604482015290519081900360640190fd5b6114796125c1565b600754600e5411156114c9576040805162461bcd60e51b815260206004820152601460248201527313585e0818d85c1858da5d1e481c995858da195960621b604482015290519081900360640190fd5b60006114d3611315565b905060006114df611f7a565b9050808510156115205760405162461bcd60e51b8152600401808060200182810382526023815260200180612c7c6023913960400191505060405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d1b317e57f0000000000000000000000000000000000000000000000000000000000000000896040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b1580156115b757600080fd5b505afa1580156115cb573d6000803e3d6000fd5b505050506040513d60208110156115e157600080fd5b5051905060006115f0826112e5565b90506298968081101561163b576040805162461bcd60e51b815260206004820152600e60248201526d109bdb99081d1bdbc81cdb585b1b60921b604482015290519081900360640190fd5b611643611f95565b811115611688576040805162461bcd60e51b815260206004820152600e60248201526d426f6e6420746f6f206c6172676560901b604482015290519081900360640190fd5b874710611805578734146116c8576040805162461bcd60e51b8152602060048201526002602482015261554160f01b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0896040518263ffffffff1660e01b81526004016000604051808303818588803b15801561172357600080fd5b505af1158015611737573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb7f00000000000000000000000000000000000000000000000000000000000000008a6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156117d357600080fd5b505af11580156117e7573d6000803e3d6000fd5b505050506040513d60208110156117fd57600080fd5b5061185a9050565b61185a6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016337f00000000000000000000000000000000000000000000000000000000000000008b6125e6565b604080516335106f4960e11b81523060048201526024810183905290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691636a20de9291604480830192600092919082900301818387803b1580156118c857600080fd5b505af11580156118dc573d6000803e3d6000fd5b5050600e546118ee9250905083612646565b600e55604080516080810182526001600160a01b0388166000908152600d602052919091205481906119209084612646565b815260208082018790526008805463ffffffff908116604080860191909152428083166060968701526001600160a01b038d166000908152600d865282902087518155948701516001860155908601516002909401805496909501518216600160201b0267ffffffff000000001994831663ffffffff19909716969096179390931694909417909255905486926119bb929181169061264616565b604080518b8152905184917f1fec6dc81f140574bf43f6b1e420ae1dd47928b9d57db8cbd7b8611063b85ae5919081900360200190a46119f9611db5565b611a01611f7a565b611a09611315565b6040517f375b221f40939bfd8f49723a17cf7bc6d576ebf72efe2cc3e991826f5b3f390a90600090a4611a3a612656565b979650505050505050565b60006112d1611db5565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b03163314611ac0576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6004546103e890611ad29060196120be565b81611ad957fe5b04831115611b24576040805162461bcd60e51b8152602060048201526013602482015272496e6372656d656e7420746f6f206c6172676560681b604482015290519081900360640190fd5b6028821015611b7a576040805162461bcd60e51b815260206004820152601f60248201527f4e6578742041646a7573746d656e7420636f756c64206265206c6f636b656400604482015290519081900360640190fd5b6040805160a0810182529415158086526020860185905290850183905263ffffffff918216606086018190524290921660809095018590526009805460ff19169091179055600a92909255600b55600c805463ffffffff191690911767ffffffff000000001916600160201b909202919091179055565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415611c60576040805162461bcd60e51b815260206004820152600360248201526213905560ea1b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415611ccd576040805162461bcd60e51b815260206004820152600360248201526204e41560ec1b604482015290519081900360640190fd5b611d7b7f0000000000000000000000000000000000000000000000000000000000000000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611d3e57600080fd5b505afa158015611d52573d6000803e3d6000fd5b505050506040513d6020811015611d6857600080fd5b50516001600160a01b038516919061276b565b506001919050565b600d6020526000908152604090208054600182015460029092015490919063ffffffff80821691600160201b90041684565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1157600080fd5b505afa158015611e25573d6000803e3d6000fd5b505050506040513d6020811015611e3b57600080fd5b50519050670de0b6b3a7640000611e64611302611e5e633b9aca006113af6112bb565b8461242e565b81611e6b57fe5b0491505090565b6000546001600160a01b03163314611ebf576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6001600160a01b038216611eff576040805162461bcd60e51b8152602060048201526002602482015261494160f01b604482015290519081900360640190fd5b8015611f345760038054600160a01b60ff60a01b19909116176001600160a01b0319166001600160a01b038416179055610c56565b6003805460ff60a01b19169055600280546001600160a01b0384166001600160a01b03199091161790555050565b60045460055460065460075460085463ffffffff1685565b60055490565b60106020526000908152604090205460ff1681565b6000620186a06113b56004600201547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ffd57600080fd5b505afa158015612011573d6000803e3d6000fd5b505050506040513d602081101561202757600080fd5b5051906120be565b600f54600090819061204d9063ffffffff428116918116906123f616565b600854600e549192506120729163ffffffff918216916111219190808616906120be16565b9150600e5482111561208457600e5491505b5090565b600f5463ffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b600e5481565b60008215806120d9575050818102818382816120d657fe5b04145b610f5057600080fd5b600082612192577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb85846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561216057600080fd5b505af1158015612174573d6000803e3d6000fd5b505050506040513d602081101561218a57600080fd5b506123df9050565b600354600160a01b900460ff16156122b9576003546040805163095ea7b360e01b81526001600160a01b0392831660048201526024810185905290517f00000000000000000000000000000000000000000000000000000000000000009092169163095ea7b3916044808201926020929091908290030181600087803b15801561221b57600080fd5b505af115801561222f573d6000803e3d6000fd5b505050506040513d602081101561224557600080fd5b505060035460408051637acb775760e01b8152600481018590526001600160a01b03878116602483015291519190921691637acb775791604480830192600092919082900301818387803b15801561229c57600080fd5b505af11580156122b0573d6000803e3d6000fd5b505050506123df565b6002546040805163095ea7b360e01b81526001600160a01b0392831660048201526024810185905290517f00000000000000000000000000000000000000000000000000000000000000009092169163095ea7b3916044808201926020929091908290030181600087803b15801561233057600080fd5b505af1158015612344573d6000803e3d6000fd5b505050506040513d602081101561235a57600080fd5b505060025460408051637acb775760e01b8152600481018590526001600160a01b03878116602483015291519190921691637acb77579160448083019260209291908290030181600087803b1580156123b257600080fd5b505af11580156123c6573d6000803e3d6000fd5b505050506040513d60208110156123dc57600080fd5b50505b5092915050565b80820382811115610f5057600080fd5b80820363ffffffff8084169082161115610f5057600080fd5b600080821161241d57600080fd5b81838161242657fe5b049392505050565b612436612bba565b600082116124755760405162461bcd60e51b8152600401808060200182810382526026815260200180612c156026913960400191505060405180910390fd5b8261248f5750604080516020810190915260008152610f50565b71ffffffffffffffffffffffffffffffffffff831161253657600082607085901b816124b757fe5b0490506001600160e01b03811115612516576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6040518060200160405280826001600160e01b0316815250915050610f50565b600061254784600160701b856127c2565b90506001600160e01b03811115612516576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b80516000906612725dd1d243ab906001600160e01b031661130e565b6125cc6112c861202f565b600e55600f805463ffffffff19164263ffffffff16179055565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612640908590612857565b50505050565b80820182811015610f5057600080fd5b600c546000906126789063ffffffff600160201b820481169181169061290816565b63ffffffff1690506009600101546000141580156126965750804210155b156127685760045460095460ff16156126d057600a546004546126b891612646565b6004819055600b54116126cb576000600a555b6126f2565b600a546004546126df916123e6565b6004819055600b54106126f2576000600a555b600c805467ffffffff000000001916600160201b4263ffffffff1602179055600454600a546009546040805185815260208101949094528381019290925260ff1615156060830152517fb923e581a0f83128e9e1d8297aa52b18d6744310476e0b54509c054cd7a93b2a916080908290030190a1505b50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526127bd908490612857565b505050565b60008060006127d18686612921565b91509150600084806127df57fe5b8688099050828111156127f3576001820391505b808303925084821061284c576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f77000000000000604482015290519081900360640190fd5b611a3a83838761294e565b60606128ac826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129be9092919063ffffffff16565b8051909150156127bd578080602001905160208110156128cb57600080fd5b50516127bd5760405162461bcd60e51b815260040180806020018281038252602a815260200180612cc3602a913960400191505060405180910390fd5b80820163ffffffff8084169082161015610f5057600080fd5b6000808060001984860990508385029250828103915082811015612946576001820391505b509250929050565b6000818103821680838161295e57fe5b04925080858161296a57fe5b04945080816000038161297957fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b60606129cd84846000856129d5565b949350505050565b60606129e085612b80565b612a31576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612a705780518252601f199092019160209182019101612a51565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612ad2576040519150601f19603f3d011682016040523d82523d6000602084013e612ad7565b606091505b50915091508115612aeb5791506129cd9050565b805115612afb5780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b45578181015183820152602001612b2d565b50505050905090810190601f168015612b725780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b3b151590565b60405180608001604052806000815260200160008152602001600063ffffffff168152602001600063ffffffff1681525090565b6040805160208101909152600081529056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a206d757374206265206e6577206f776e657220746f2070756c6c4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f44656274206d757374206265203020666f7220696e697469616c697a6174696f6e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572536c697070616765206c696d69743a206d6f7265207468616e206d617820707269636556657374696e67206d757374206265206c6f6e676572207468616e20333620686f7572735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220dc5893bc95e08e0a1f9adc90060bdb7ff37061e7dae1440015a53654109fb53864736f6c6343000705003300000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead00000000000000000000000000003d183e4f3eef0191ecffafd7ffc5df8d38520fa900000000000000000000000088e07a0457aa113ab910103d9a01217315da1c98

Deployed ByteCode

0x60806040526004361061020f5760003560e01c80637927ebf811610118578063d4d863ce116100a0578063e0176de81161006f578063e0176de814610764578063e392a26214610779578063f5c2ab5b1461078e578063f8e157ea146107bc578063fc7b9c18146107d15761020f565b8063d4d863ce1461069b578063d5025625146106d6578063d7ccfb0b1461071c578063dc6549fb146107315761020f565b806398fabd3a116100e757806398fabd3a1461059b578063ae9832cf146105b0578063b4abccba146105f4578063cd1234b314610627578063cea55f57146106865761020f565b80637927ebf814610515578063844b5c7c1461053f5780638dbdbe6d14610554578063904b3ece146105865761020f565b8063451ee4a11161019b5780635a96ac0a1161016a5780635a96ac0a1461048e57806361d027b3146104a357806363b3256b146104b8578063759076e5146104eb57806377b81895146105005761020f565b8063451ee4a1146103c857806346f68ee9146104135780634cf088d914610446578063507930ec1461045b5761020f565b80630ab69367116101e25780630ab69367146102b65780631e321a0f146102fe5780631ed2d71a146103315780631feed31f146103645780632f3f470a1461039f5761020f565b8063016a42841461021457806301b88ee8146102455780630505c8c91461028a578063089208d81461029f575b600080fd5b34801561022057600080fd5b506102296107e6565b604080516001600160a01b039092168252519081900360200190f35b34801561025157600080fd5b506102786004803603602081101561026857600080fd5b50356001600160a01b031661080a565b60408051918252519081900360200190f35b34801561029657600080fd5b50610229610862565b3480156102ab57600080fd5b506102b4610871565b005b3480156102c257600080fd5b506102b4600480360360a08110156102d957600080fd5b508035906020810135906040810135906060810135906080013563ffffffff16610908565b34801561030a57600080fd5b506102b46004803603604081101561032157600080fd5b5060ff8135169060200135610aec565b34801561033d57600080fd5b506102b46004803603602081101561035457600080fd5b50356001600160a01b0316610c5a565b34801561037057600080fd5b506102786004803603604081101561038757600080fd5b506001600160a01b0381351690602001351515610cc8565b3480156103ab57600080fd5b506103b4610f56565b604080519115158252519081900360200190f35b3480156103d457600080fd5b506103dd610f66565b60408051951515865260208601949094528484019290925263ffffffff9081166060850152166080830152519081900360a00190f35b34801561041f57600080fd5b506102b46004803603602081101561043657600080fd5b50356001600160a01b0316610f8c565b34801561045257600080fd5b50610229611079565b34801561046757600080fd5b506102786004803603602081101561047e57600080fd5b50356001600160a01b0316611088565b34801561049a57600080fd5b506102b461113b565b3480156104af57600080fd5b506102296111e5565b3480156104c457600080fd5b506102b4600480360360208110156104db57600080fd5b50356001600160a01b0316611209565b3480156104f757600080fd5b506102786112bb565b34801561050c57600080fd5b506102296112d6565b34801561052157600080fd5b506102786004803603602081101561053857600080fd5b50356112e5565b34801561054b57600080fd5b50610278611315565b6102786004803603606081101561056a57600080fd5b50803590602081013590604001356001600160a01b03166113c2565b34801561059257600080fd5b50610278611a45565b3480156105a757600080fd5b50610229611a4f565b3480156105bc57600080fd5b506102b4600480360360808110156105d357600080fd5b5080351515906020810135906040810135906060013563ffffffff16611a73565b34801561060057600080fd5b506103b46004803603602081101561061757600080fd5b50356001600160a01b0316611bf1565b34801561063357600080fd5b5061065a6004803603602081101561064a57600080fd5b50356001600160a01b0316611d83565b60408051948552602085019390935263ffffffff91821684840152166060830152519081900360800190f35b34801561069257600080fd5b50610278611db5565b3480156106a757600080fd5b506102b4600480360360408110156106be57600080fd5b506001600160a01b0381351690602001351515611e72565b3480156106e257600080fd5b506106eb611f62565b60408051958652602086019490945284840192909252606084015263ffffffff166080830152519081900360a00190f35b34801561072857600080fd5b50610278611f7a565b34801561073d57600080fd5b506103b46004803603602081101561075457600080fd5b50356001600160a01b0316611f80565b34801561077057600080fd5b50610278611f95565b34801561078557600080fd5b5061027861202f565b34801561079a57600080fd5b506107a3612088565b6040805163ffffffff9092168252519081900360200190f35b3480156107c857600080fd5b50610229612094565b3480156107dd57600080fd5b506102786120b8565b7f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead000081565b60008061081683611088565b6001600160a01b0384166000908152600d602052604090205490915061271082106108435780925061085b565b61271061085082846120be565b8161085757fe5b0492505b5050919050565b6000546001600160a01b031690565b6000546001600160a01b031633146108be576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610955576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b61095d6112bb565b156109995760405162461bcd60e51b8152600401808060200182810382526021815260200180612c3b6021913960400191505060405180910390fd5b60288510156109e5576040805162461bcd60e51b815260206004820152601360248201527210d85b881b1bd8dac818591a9d5cdd1b595b9d606a1b604482015290519081900360640190fd5b612710831115610a3c576040805162461bcd60e51b815260206004820181905260248201527f5061796f75742063616e6e6f742062652061626f766520312070657263656e74604482015290519081900360640190fd5b6201fa408163ffffffff161015610a845760405162461bcd60e51b8152600401808060200182810382526024815260200180612c9f6024913960400191505060405180910390fd5b6040805160a081018252868152602081018690529081018490526060810183905263ffffffff91821660809091018190526004959095556005939093556006919091556007556008805463ffffffff199081169093179055600f805490921642909116179055565b6000546001600160a01b03163314610b39576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6000826003811115610b4757fe5b1415610ba9576201fa40811015610b8f5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c9f6024913960400191505060405180910390fd5b6008805463ffffffff191663ffffffff8316179055610c56565b6001826003811115610bb757fe5b1415610c1e57612710811115610c14576040805162461bcd60e51b815260206004820181905260248201527f5061796f75742063616e6e6f742062652061626f766520312070657263656e74604482015290519081900360640190fd5b6006819055610c56565b6002826003811115610c2c57fe5b1415610c3c576007819055610c56565b6003826003811115610c4a57fe5b1415610c565760058190555b5050565b6000546001600160a01b03163314610ca7576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000336001600160a01b03841614610d0c576040805162461bcd60e51b81526020600482015260026024820152614e4160f01b604482015290519081900360640190fd5b610d14612b86565b506001600160a01b0383166000908152600d602090815260408083208151608081018352815481526001820154938101939093526002015463ffffffff80821692840192909252600160201b900416606082015290610d7285611088565b90506127108110610e07576001600160a01b0385166000818152600d6020908152604080832083815560018101849055600201805467ffffffffffffffff19169055855181519081529182019290925281517f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b1929181900390910190a2610dfe858584600001516120e2565b92505050610f50565b815160009061271090610e1a90846120be565b81610e2157fe5b0490506040518060800160405280610e468386600001516123e690919063ffffffff16565b815260200184602001518152602001610e8e610e7586606001514263ffffffff166123f690919063ffffffff16565b866040015163ffffffff166123f690919063ffffffff16565b63ffffffff90811682524281166020928301526001600160a01b0389166000818152600d8452604090819020855180825586860151600183015586830151600290920180546060909801518616600160201b0267ffffffff00000000199390961663ffffffff19909816979097179190911693909317909455835185815292830191909152825190927f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b1928290030190a2610f4a8686836120e2565b93505050505b92915050565b600354600160a01b900460ff1681565b600954600a54600b54600c5460ff9093169263ffffffff80821691600160201b90041685565b6000546001600160a01b03163314610fd9576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6001600160a01b03811661101e5760405162461bcd60e51b8152600401808060200182810382526026815260200180612bcd6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba91a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031681565b6000611092612b86565b506001600160a01b0382166000908152600d602090815260408083208151608081018352815481526001820154938101939093526002015463ffffffff80821692840192909252600160201b90048116606083018190529192916110fb9142811691906123f616565b604083015163ffffffff918216925016801561112e5761112781611121846127106120be565b9061240f565b9350611133565b600093505b505050919050565b6001546001600160a01b031633146111845760405162461bcd60e51b8152600401808060200182810382526022815260200180612bf36022913960400191505060405180910390fd5b600154600080546040516001600160a01b0393841693909116917faa151555690c956fc3ea32f106bb9f119b5237a061eaa8557cff3e51e3792c8d91a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b7f0000000000000000000000003d183e4f3eef0191ecffafd7ffc5df8d38520fa981565b6000546001600160a01b03163314611256576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6001600160a01b038116611297576040805162461bcd60e51b81526020600482015260036024820152625a4e4160e81b604482015290519081900360640190fd5b6001600160a01b03166000908152601060205260409020805460ff19166001179055565b60006112d16112c861202f565b600e54906123e6565b905090565b6003546001600160a01b031681565b6000655af3107a4000611307611302846112fd611f7a565b61242e565b6125a5565b8161130e57fe5b0492915050565b600060646113b57f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead00006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561137557600080fd5b505afa158015611389573d6000803e3d6000fd5b505050506040513d602081101561139f57600080fd5b505160ff16600a0a6113af611f7a565b906120be565b816113bc57fe5b04905090565b60006001600160a01b038216611411576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b336001600160a01b038316148061143757503360009081526010602052604090205460ff165b611471576040805162461bcd60e51b815260206004808301919091526024820152634c464e4160e01b604482015290519081900360640190fd5b6114796125c1565b600754600e5411156114c9576040805162461bcd60e51b815260206004820152601460248201527313585e0818d85c1858da5d1e481c995858da195960621b604482015290519081900360640190fd5b60006114d3611315565b905060006114df611f7a565b9050808510156115205760405162461bcd60e51b8152600401808060200182810382526023815260200180612c7c6023913960400191505060405180910390fd5b60007f0000000000000000000000003d183e4f3eef0191ecffafd7ffc5df8d38520fa96001600160a01b031663d1b317e57f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead0000896040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b1580156115b757600080fd5b505afa1580156115cb573d6000803e3d6000fd5b505050506040513d60208110156115e157600080fd5b5051905060006115f0826112e5565b90506298968081101561163b576040805162461bcd60e51b815260206004820152600e60248201526d109bdb99081d1bdbc81cdb585b1b60921b604482015290519081900360640190fd5b611643611f95565b811115611688576040805162461bcd60e51b815260206004820152600e60248201526d426f6e6420746f6f206c6172676560901b604482015290519081900360640190fd5b874710611805578734146116c8576040805162461bcd60e51b8152602060048201526002602482015261554160f01b604482015290519081900360640190fd5b7f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead00006001600160a01b031663d0e30db0896040518263ffffffff1660e01b81526004016000604051808303818588803b15801561172357600080fd5b505af1158015611737573d6000803e3d6000fd5b50505050507f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead00006001600160a01b031663a9059cbb7f0000000000000000000000003d183e4f3eef0191ecffafd7ffc5df8d38520fa98a6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156117d357600080fd5b505af11580156117e7573d6000803e3d6000fd5b505050506040513d60208110156117fd57600080fd5b5061185a9050565b61185a6001600160a01b037f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead000016337f0000000000000000000000003d183e4f3eef0191ecffafd7ffc5df8d38520fa98b6125e6565b604080516335106f4960e11b81523060048201526024810183905290516001600160a01b037f0000000000000000000000003d183e4f3eef0191ecffafd7ffc5df8d38520fa91691636a20de9291604480830192600092919082900301818387803b1580156118c857600080fd5b505af11580156118dc573d6000803e3d6000fd5b5050600e546118ee9250905083612646565b600e55604080516080810182526001600160a01b0388166000908152600d602052919091205481906119209084612646565b815260208082018790526008805463ffffffff908116604080860191909152428083166060968701526001600160a01b038d166000908152600d865282902087518155948701516001860155908601516002909401805496909501518216600160201b0267ffffffff000000001994831663ffffffff19909716969096179390931694909417909255905486926119bb929181169061264616565b604080518b8152905184917f1fec6dc81f140574bf43f6b1e420ae1dd47928b9d57db8cbd7b8611063b85ae5919081900360200190a46119f9611db5565b611a01611f7a565b611a09611315565b6040517f375b221f40939bfd8f49723a17cf7bc6d576ebf72efe2cc3e991826f5b3f390a90600090a4611a3a612656565b979650505050505050565b60006112d1611db5565b7f00000000000000000000000088e07a0457aa113ab910103d9a01217315da1c9881565b6000546001600160a01b03163314611ac0576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6004546103e890611ad29060196120be565b81611ad957fe5b04831115611b24576040805162461bcd60e51b8152602060048201526013602482015272496e6372656d656e7420746f6f206c6172676560681b604482015290519081900360640190fd5b6028821015611b7a576040805162461bcd60e51b815260206004820152601f60248201527f4e6578742041646a7573746d656e7420636f756c64206265206c6f636b656400604482015290519081900360640190fd5b6040805160a0810182529415158086526020860185905290850183905263ffffffff918216606086018190524290921660809095018590526009805460ff19169091179055600a92909255600b55600c805463ffffffff191690911767ffffffff000000001916600160201b909202919091179055565b60007f00000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd6001600160a01b0316826001600160a01b03161415611c60576040805162461bcd60e51b815260206004820152600360248201526213905560ea1b604482015290519081900360640190fd5b7f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead00006001600160a01b0316826001600160a01b03161415611ccd576040805162461bcd60e51b815260206004820152600360248201526204e41560ec1b604482015290519081900360640190fd5b611d7b7f00000000000000000000000088e07a0457aa113ab910103d9a01217315da1c98836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611d3e57600080fd5b505afa158015611d52573d6000803e3d6000fd5b505050506040513d6020811015611d6857600080fd5b50516001600160a01b038516919061276b565b506001919050565b600d6020526000908152604090208054600182015460029092015490919063ffffffff80821691600160201b90041684565b6000807f00000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1157600080fd5b505afa158015611e25573d6000803e3d6000fd5b505050506040513d6020811015611e3b57600080fd5b50519050670de0b6b3a7640000611e64611302611e5e633b9aca006113af6112bb565b8461242e565b81611e6b57fe5b0491505090565b6000546001600160a01b03163314611ebf576040805162461bcd60e51b81526020600482018190526024820152600080516020612c5c833981519152604482015290519081900360640190fd5b6001600160a01b038216611eff576040805162461bcd60e51b8152602060048201526002602482015261494160f01b604482015290519081900360640190fd5b8015611f345760038054600160a01b60ff60a01b19909116176001600160a01b0319166001600160a01b038416179055610c56565b6003805460ff60a01b19169055600280546001600160a01b0384166001600160a01b03199091161790555050565b60045460055460065460075460085463ffffffff1685565b60055490565b60106020526000908152604090205460ff1681565b6000620186a06113b56004600201547f00000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ffd57600080fd5b505afa158015612011573d6000803e3d6000fd5b505050506040513d602081101561202757600080fd5b5051906120be565b600f54600090819061204d9063ffffffff428116918116906123f616565b600854600e549192506120729163ffffffff918216916111219190808616906120be16565b9150600e5482111561208457600e5491505b5090565b600f5463ffffffff1681565b7f00000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd81565b600e5481565b60008215806120d9575050818102818382816120d657fe5b04145b610f5057600080fd5b600082612192577f00000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd6001600160a01b031663a9059cbb85846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561216057600080fd5b505af1158015612174573d6000803e3d6000fd5b505050506040513d602081101561218a57600080fd5b506123df9050565b600354600160a01b900460ff16156122b9576003546040805163095ea7b360e01b81526001600160a01b0392831660048201526024810185905290517f00000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd9092169163095ea7b3916044808201926020929091908290030181600087803b15801561221b57600080fd5b505af115801561222f573d6000803e3d6000fd5b505050506040513d602081101561224557600080fd5b505060035460408051637acb775760e01b8152600481018590526001600160a01b03878116602483015291519190921691637acb775791604480830192600092919082900301818387803b15801561229c57600080fd5b505af11580156122b0573d6000803e3d6000fd5b505050506123df565b6002546040805163095ea7b360e01b81526001600160a01b0392831660048201526024810185905290517f00000000000000000000000072c232d56542ba082592dee7c77b1c6cfa758bcd9092169163095ea7b3916044808201926020929091908290030181600087803b15801561233057600080fd5b505af1158015612344573d6000803e3d6000fd5b505050506040513d602081101561235a57600080fd5b505060025460408051637acb775760e01b8152600481018590526001600160a01b03878116602483015291519190921691637acb77579160448083019260209291908290030181600087803b1580156123b257600080fd5b505af11580156123c6573d6000803e3d6000fd5b505050506040513d60208110156123dc57600080fd5b50505b5092915050565b80820382811115610f5057600080fd5b80820363ffffffff8084169082161115610f5057600080fd5b600080821161241d57600080fd5b81838161242657fe5b049392505050565b612436612bba565b600082116124755760405162461bcd60e51b8152600401808060200182810382526026815260200180612c156026913960400191505060405180910390fd5b8261248f5750604080516020810190915260008152610f50565b71ffffffffffffffffffffffffffffffffffff831161253657600082607085901b816124b757fe5b0490506001600160e01b03811115612516576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6040518060200160405280826001600160e01b0316815250915050610f50565b600061254784600160701b856127c2565b90506001600160e01b03811115612516576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b80516000906612725dd1d243ab906001600160e01b031661130e565b6125cc6112c861202f565b600e55600f805463ffffffff19164263ffffffff16179055565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612640908590612857565b50505050565b80820182811015610f5057600080fd5b600c546000906126789063ffffffff600160201b820481169181169061290816565b63ffffffff1690506009600101546000141580156126965750804210155b156127685760045460095460ff16156126d057600a546004546126b891612646565b6004819055600b54116126cb576000600a555b6126f2565b600a546004546126df916123e6565b6004819055600b54106126f2576000600a555b600c805467ffffffff000000001916600160201b4263ffffffff1602179055600454600a546009546040805185815260208101949094528381019290925260ff1615156060830152517fb923e581a0f83128e9e1d8297aa52b18d6744310476e0b54509c054cd7a93b2a916080908290030190a1505b50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526127bd908490612857565b505050565b60008060006127d18686612921565b91509150600084806127df57fe5b8688099050828111156127f3576001820391505b808303925084821061284c576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f77000000000000604482015290519081900360640190fd5b611a3a83838761294e565b60606128ac826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129be9092919063ffffffff16565b8051909150156127bd578080602001905160208110156128cb57600080fd5b50516127bd5760405162461bcd60e51b815260040180806020018281038252602a815260200180612cc3602a913960400191505060405180910390fd5b80820163ffffffff8084169082161015610f5057600080fd5b6000808060001984860990508385029250828103915082811015612946576001820391505b509250929050565b6000818103821680838161295e57fe5b04925080858161296a57fe5b04945080816000038161297957fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b60606129cd84846000856129d5565b949350505050565b60606129e085612b80565b612a31576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612a705780518252601f199092019160209182019101612a51565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612ad2576040519150601f19603f3d011682016040523d82523d6000602084013e612ad7565b606091505b50915091508115612aeb5791506129cd9050565b805115612afb5780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b45578181015183820152602001612b2d565b50505050905090810190601f168015612b725780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b3b151590565b60405180608001604052806000815260200160008152602001600063ffffffff168152602001600063ffffffff1681525090565b6040805160208101909152600081529056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a206d757374206265206e6577206f776e657220746f2070756c6c4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f44656274206d757374206265203020666f7220696e697469616c697a6174696f6e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572536c697070616765206c696d69743a206d6f7265207468616e206d617820707269636556657374696e67206d757374206265206c6f6e676572207468616e20333620686f7572735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220dc5893bc95e08e0a1f9adc90060bdb7ff37061e7dae1440015a53654109fb53864736f6c63430007050033