ETH Price: $2,441.11 (+9.65%)

Contract

0xc04c82c1D8931C95B164D2C58cA0Cc09f8A2cc8B
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Redeem207007322024-09-07 19:11:11176 days ago1725736271IN
0xc04c82c1...9f8A2cc8B
0 ETH0.000219073.21658683
Redeem187833982023-12-14 9:09:47444 days ago1702544987IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0034319350.41628829
Redeem185550232023-11-12 9:45:11476 days ago1699782311IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0014041720.62776346
Redeem179698422023-08-22 11:05:11558 days ago1692702311IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0011959217.56853968
Redeem179625182023-08-21 10:29:47559 days ago1692613787IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0009787214.37968111
Redeem179496712023-08-19 15:20:11561 days ago1692458411IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0011462714.02139009
Redeem179280782023-08-16 14:47:11564 days ago1692197231IN
0xc04c82c1...9f8A2cc8B
0 ETH0.002608431.90631334
Redeem179182522023-08-15 5:47:23565 days ago1692078443IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0011409913.95680153
Redeem179133942023-08-14 13:30:11566 days ago1692019811IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0019571123.93971343
Redeem176597692023-07-10 0:40:23602 days ago1688949623IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0009301213.66559356
Redeem176597662023-07-10 0:39:47602 days ago1688949587IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0011523714.09604019
Redeem175275162023-06-21 10:43:35620 days ago1687344215IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0004963813.61068643
Redeem175275072023-06-21 10:41:47620 days ago1687344107IN
0xc04c82c1...9f8A2cc8B
0 ETH0.001146314.02326271
Redeem175088722023-06-18 19:54:23623 days ago1687118063IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0011421813.97287252
Redeem174941732023-06-16 18:26:59625 days ago1686940019IN
0xc04c82c1...9f8A2cc8B
0 ETH0.002043825
Deposit174865982023-06-15 16:55:11626 days ago1686848111IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0077878825.90246349
Update Whitelist174855652023-06-15 13:25:59626 days ago1686835559IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0011974125.8041148
Update Whitelist174853852023-06-15 12:49:47626 days ago1686833387IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0011751725.32475997
Update Whitelist174853842023-06-15 12:49:35626 days ago1686833375IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0011099523.91943438
Deposit174835802023-06-15 6:42:47626 days ago1686811367IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0058605519.18511941
Redeem174835592023-06-15 6:38:35626 days ago1686811115IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0015679719.17967846
Deposit174258522023-06-07 3:30:35635 days ago1686108635IN
0xc04c82c1...9f8A2cc8B
0 ETH0.005922919.69955943
Deposit174167322023-06-05 20:38:59636 days ago1685997539IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0113077437.60948821
Deposit173766012023-05-31 4:51:59641 days ago1685508719IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0097128232.30479668
Redeem173765782023-05-31 4:47:11641 days ago1685508431IN
0xc04c82c1...9f8A2cc8B
0 ETH0.0019085723.34846311
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SwapBondDepository

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : BondDepository.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./external/Ownable.sol";
import "./interface/IERC20Metadata.sol";
import "./interface/IBondingCalculator.sol";
import "./library/SafeMath.sol";
import "./library/SafeERC20.sol";
import "./library/FixedPoint.sol";

contract SwapBondDepository is Ownable, ReentrancyGuard {

    using FixedPoint for *;
    using SafeERC20 for IERC20;
    using SafeMath for uint;

    /* ======== 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 ======== */

    address public immutable SWAP; // token given as payment for bond
    address public immutable principal; // token used to create bond
    address public immutable treasury; // mints SWAP when receives principal
    address public immutable DAO; // receives profit share from bond

    bool public immutable isLiquidityBond; // LP and Reserve bonds are treated slightly different
    address public immutable bondCalculator; // calculates value of LP tokens
    address private pairAddressSwap;
    address private pairAddressPrinciple;

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

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

    uint public totalDebt; // total value of outstanding bonds; used for pricing
    uint public lastDecay; // reference timestamp for debt decay
    uint public constant CONTROL_VARIABLE_PRECISION = 10_000;


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

    // Info for creating new bonds
    struct Terms {
        uint controlVariable; // scaling variable for price, in hundreths
        uint[] vestingTerm; // in time
        uint minimumPrice; // vs principal value
        uint maxPayout; // in thousandths of a %. i.e. 500 = 0.5%
        uint[] fee; // as % of bond payout, in hundreths. ( 500 = 5% = 0.05 for every 1 paid)
        uint maxDebt; // 9 decimal debt ratio, max % total supply created as debt
    }

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

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

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

    constructor ( 
        address _SWAP,
        address _principal,
        address _treasury, 
        address _DAO, 
        address _bondCalculator,
        address _pairAddressSwap,
        address _pairAddressPrinciple
    ) {
        require( _SWAP != address(0) );
        SWAP = _SWAP;
        require( _principal != address(0) );
        principal = _principal;
        require( _treasury != address(0) );
        treasury = _treasury;
        require( _DAO != address(0) );
        DAO = _DAO;
        // bondCalculator should be address(0) if not LP bond
        bondCalculator = _bondCalculator;
        pairAddressSwap = _pairAddressSwap;
        pairAddressPrinciple = _pairAddressPrinciple;
        isLiquidityBond = ( _bondCalculator != address(0) );
        whitelist[_msgSender()] = true;
    }

    /**
     *  @notice whitelist modifier
     */
    modifier onlyWhitelisted() {
        require(whitelist[_msgSender()], "Not Whitelisted");
        _;
    }

    /**
     *  @notice contract checker modifier
     */
    modifier notContract(address _addr) {
        require(!isContract(_addr), "Contract address");
        _;
    }

    /**
     *  @notice update whitelist
     *  @param _target address
     *  @param _value bool
     */
    function updateWhitelist(address _target, bool _value) external onlyOwner {
        whitelist[_target] = _value;
    }

    /**
     *  @notice update pair address
     *  @param _pair address
     */
    function updatePairAddress(address _pair, bool _swap) external onlyOwner {
        if (_swap) {
            pairAddressSwap = _pair;
        } else {
            pairAddressPrinciple = _pair;
        }
    }

    /**
     *  @notice update whitelistfor multiple addresses
     *  @param _target address[]
     *  @param _value bool[]
     */
    function updateBatchWhitelist(address[] calldata _target, bool[] calldata _value) external onlyOwner {
        require(_target.length == _value.length, "Invalid request");
        for (uint256 index = 0; index < _target.length; index++) {
            whitelist[_target[index]] = _value[index];
        }
    }

    /**
     *  @notice initializes bond parameters
     *  @param _controlVariable uint
     *  @param _vestingTerm uint
     *  @param _minimumPrice uint
     *  @param _maxPayout uint
     *  @param _fee uint
     *  @param _maxDebt uint
     *  @param _initialDebt uint
     */
    function initializeBondTerms( 
        uint _controlVariable, 
        uint[] calldata _vestingTerm,
        uint _minimumPrice,
        uint _maxPayout,
        uint[] calldata _fee,
        uint _maxDebt,
        uint _initialDebt
    ) external onlyOwner {
        require( terms.controlVariable == 0, "Bonds must be initialized from 0" );
        terms = Terms ({
            controlVariable: _controlVariable,
            vestingTerm: _vestingTerm,
            minimumPrice: _minimumPrice,
            maxPayout: _maxPayout,
            fee: _fee,
            maxDebt: _maxDebt
        });
        totalDebt = _initialDebt;
        lastDecay = block.timestamp;
    }

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

    enum PARAMETER { VESTING, PAYOUT, FEE, DEBT }
    /**
     *  @notice set parameters for new bonds
     *  @param _parameter PARAMETER
     *  @param _input uint
     */
    function setBondTerms ( PARAMETER _parameter, uint _input, uint _term ) external onlyOwner {
        if ( _parameter == PARAMETER.VESTING ) { // 0
            require( _input >= 3, "Vesting must be longer than 3 days" );
            terms.vestingTerm[_term] = _input;
        } else if ( _parameter == PARAMETER.PAYOUT ) { // 1
            require( _input <= 1000, "Payout cannot be above 1 percent" );
            terms.maxPayout = _input;
        } else if ( _parameter == PARAMETER.FEE ) { // 2
            require( _input <= 10000, "DAO fee cannot exceed payout" );
            terms.fee[_term] = _input;
        } else if ( _parameter == PARAMETER.DEBT ) { // 3
            terms.maxDebt = _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,
        uint _buffer 
    ) external onlyOwner {
        require( _increment <= terms.controlVariable.mul( 25 ).div( 1000 ), "Increment too large" );

        adjustment = Adjust({
            add: _addition,
            rate: _increment,
            target: _target,
            buffer: _buffer,
            lastTimestamp: block.timestamp
        });
    }
    
    /* ======== USER FUNCTIONS ======== */

    /**
     *  @notice deposit bond
     *  @param _amount uint
     *  @param _maxPrice uint
     *  @param _depositor address
     *  @return uint
     */
    function deposit( 
        uint _amount, 
        uint _maxPrice,
        address _depositor,
        uint _term
    ) external onlyWhitelisted nonReentrant notContract(_msgSender()) returns ( uint ) {
        require( _depositor != address(0), "Invalid address" );

        require( totalDebt <= terms.maxDebt, "Max capacity reached" );
        
        uint priceInUSD = bondPriceInUSD(_term); // Stored in bond info
        uint nativePrice = _bondPrice();

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

        uint value = tokenValue( principal, _amount );

        require( value >= 1e16, "Bond too small" ); // must be > 0.01 SWAP ( underflow protection )
        require( value <= maxPayout(), "Bond too large"); // size protection because there is no slippage

        // profits are calculated
        uint payout = value.mul( nativePrice ).div( priceInUSD );

        /**
            principal is transferred in
            approved and
            deposited into the treasury, returning (_amount - profit) SWAP
         */
        IERC20( principal ).safeTransferFrom( msg.sender, address( treasury ), _amount );

        IERC20( SWAP ).safeTransferFrom(address( treasury ), address(this), payout);

        // total debt is increased
        totalDebt = totalDebt.add( value ); 
                
        // depositor info is stored
        bondInfo[_term][ _depositor ] = Bond({ 
            payout: bondInfo[_term][ _depositor ].payout.add( payout ),
            vesting: terms.vestingTerm[_term] * 1 days,
            lastTimestamp: block.timestamp,
            pricePaid: priceInUSD
        });

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

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

    /** 
     *  @notice redeem bond for user
     *  @param _recipient address
     *  @return uint
     */ 
    function redeem( address _recipient, uint _term ) external onlyWhitelisted nonReentrant notContract(_msgSender()) returns ( uint ) {        
        Bond memory info = bondInfo[_term][ _recipient ];
        uint percentVested = percentVestedFor( _recipient, _term ); // (blocks since last interaction / vesting term remaining)

        if ( percentVested >= 1e9 ) { // if fully vested
            delete bondInfo[_term][ _recipient ]; // delete user info
            emit BondRedeemed( _recipient, info.payout, 0 ); // emit bond data
            return sendTo( _recipient, info.payout ); // pay user everything due
        }
    }


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

    /**
     *  @notice allow user to payout automatically
     *  @param _amount uint
     *  @return uint
     */
    function sendTo( address _recipient, uint _amount ) internal returns ( uint ) {
        IERC20( SWAP ).transfer( _recipient, _amount ); // send payout
        return _amount;
    }

    /**
     *  @notice makes incremental adjustment to control variable
     */
    function adjust() internal {
        uint blockCanAdjust = adjustment.lastTimestamp.add( adjustment.buffer );
        if( adjustment.rate != 0 && block.timestamp >= blockCanAdjust ) {
            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.lastTimestamp = block.timestamp;
            emit ControlVariableAdjustment( initial, terms.controlVariable, adjustment.rate, adjustment.add );
        }
    }

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


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

    /**
     *  @notice contract checker viewer
     */
    function isContract(address _addr) private view returns (bool){
        uint32 size;
        assembly {
            size := extcodesize(_addr)
        }
        return (size > 0);
    }

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

    /**
     *  @notice calculate current bond premium
     *  @return price_ uint
     */
    function bondPrice() internal view returns ( uint price_ ) {
        uint bondTokenPrice;
        if (pairAddressPrinciple != address(0)) {
            bondTokenPrice = IBondingCalculator( bondCalculator ).getBondTokenPrice( pairAddressSwap, pairAddressPrinciple );
        } else {
            bondTokenPrice = IBondingCalculator( bondCalculator ).getBondTokenPrice( pairAddressSwap );
        }
        price_ = CONTROL_VARIABLE_PRECISION.sub(terms.controlVariable).mul(bondTokenPrice).div(CONTROL_VARIABLE_PRECISION);

        if ( price_ < terms.minimumPrice ) {
            price_ = terms.minimumPrice;
        }
    }

    /**
     *  @notice calculate current bond price and remove floor if above
     *  @return price_ uint
     */
    function _bondPrice() internal returns ( uint price_ ) {
        if (pairAddressPrinciple != address(0)) {
            price_ = IBondingCalculator( bondCalculator ).getBondTokenPrice( pairAddressSwap, pairAddressPrinciple );
        } else {
            price_ = IBondingCalculator( bondCalculator ).getBondTokenPrice( pairAddressSwap );
        }
        if ( price_ < terms.minimumPrice ) {
            price_ = terms.minimumPrice;        
        } else if ( terms.minimumPrice != 0 ) {
            terms.minimumPrice = 0;
        }
    }

    /**
     * @notice returns SWAP valuation of asset
     * @param _token address
     * @param _amount uint256
     * @return value_ uint256
     */
    function tokenValue(address _token, uint256 _amount) internal view returns (uint256 value_) {
        if ( !isLiquidityBond ) {
            // convert amount to match SWAP decimals
            value_ = _amount.mul( 10 ** IERC20Metadata( SWAP ).decimals() ).div( 10 ** IERC20Metadata( _token ).decimals() );
        } else {
            if (pairAddressPrinciple != address(0)) {
                value_ = IBondingCalculator( bondCalculator ).getPrincipleTokenValue( pairAddressSwap, pairAddressPrinciple, _amount );
            } else {
                value_ = IBondingCalculator( bondCalculator ).getPrincipleTokenValue( pairAddressSwap, _amount );
            }
        }
    }

    /**
     *  @notice converts bond price to DAI value
     *  @return price_ uint
     */
    function bondPriceInUSD(uint _term) public view returns ( uint price_ ) {
        if( isLiquidityBond ) {
            price_ = bondPrice().mul( CONTROL_VARIABLE_PRECISION - terms.fee[_term] ).div( CONTROL_VARIABLE_PRECISION );
        } else {
            price_ = bondPrice().mul( 10 ** IERC20Metadata( principal ).decimals() ).div( 100 );
        }
    }

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

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

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

        if ( vesting > 0 && blocksSinceLast >= vesting ) {
            percentVested_ = 1e9;
        } else {
            percentVested_ = 0;
        }
    }

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

        if ( percentVested >= 1e9 ) {
            pendingPayout_ = payout;
        } else {
            pendingPayout_ = payout.mul( percentVested ).div( 1e9 );
        }
    }


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

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

File 2 of 12 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^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() {
        _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 making 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;
    }
}

File 3 of 12 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 4 of 12 : IERC20Metadata.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8;

import "./IERC20.sol";

interface IERC20Metadata is IERC20 {

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);
}

File 5 of 12 : IBondingCalculator.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8;

interface IBondingCalculator {
    function valuation( address pair_, uint amount_ ) external view returns ( uint _value );

    function getBondTokenValue( address _pair, uint amount_ ) external view returns ( uint _value );

    function getPrincipleTokenValue( address _pair, uint amount_ ) external view returns ( uint _value );

    function getPrincipleTokenValue( address _pairSwap, address _pairPrinciple, uint amount_ ) external view returns ( uint _value );

    function getBondTokenPrice( address _pair ) external view returns ( uint _value );

    function getBondTokenPrice( address _pairSwap, address _pairPrinciple ) external view returns ( uint _value );
}

File 6 of 12 : SafeMath.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8;

library SafeMath {

    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

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

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }

    function sqrrt(uint256 a) internal pure returns (uint c) {
        if (a > 3) {
            c = a;
            uint b = add( div( a, 2), 1 );
            while (b < c) {
                c = b;
                b = div( add( div( a, b ), b), 2 );
            }
        } else if (a != 0) {
            c = 1;
        }
    }
}

File 7 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using 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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. 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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 8 of 12 : FixedPoint.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8;

import "./FullMath.sol";

library Babylonian {

    function sqrt(uint256 x) internal pure returns (uint256) {
        if (x == 0) return 0;

        uint256 xx = x;
        uint256 r = 1;
        if (xx >= 0x100000000000000000000000000000000) {
            xx >>= 128;
            r <<= 64;
        }
        if (xx >= 0x10000000000000000) {
            xx >>= 64;
            r <<= 32;
        }
        if (xx >= 0x100000000) {
            xx >>= 32;
            r <<= 16;
        }
        if (xx >= 0x10000) {
            xx >>= 16;
            r <<= 8;
        }
        if (xx >= 0x100) {
            xx >>= 8;
            r <<= 4;
        }
        if (xx >= 0x10) {
            xx >>= 4;
            r <<= 2;
        }
        if (xx >= 0x8) {
            r <<= 1;
        }
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1; // Seven iterations should be enough
        uint256 r1 = x / r;
        return (r < r1 ? r : r1);
    }
}

library BitMath {

    function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
        require(x > 0, "BitMath::mostSignificantBit: zero");

        if (x >= 0x100000000000000000000000000000000) {
            x >>= 128;
            r += 128;
        }
        if (x >= 0x10000000000000000) {
            x >>= 64;
            r += 64;
        }
        if (x >= 0x100000000) {
            x >>= 32;
            r += 32;
        }
        if (x >= 0x10000) {
            x >>= 16;
            r += 16;
        }
        if (x >= 0x100) {
            x >>= 8;
            r += 8;
        }
        if (x >= 0x10) {
            x >>= 4;
            r += 4;
        }
        if (x >= 0x4) {
            x >>= 2;
            r += 2;
        }
        if (x >= 0x2) r += 1;
    }
}

library FixedPoint {
    // range: [0, 2**112 - 1]
    // resolution: 1 / 2**112
    struct uq112x112 {
        uint224 _x;
    }

    // range: [0, 2**144 - 1]
    // resolution: 1 / 2**112
    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)

    // decode a UQ112x112 into a uint112 by truncating after the radix point
    function decode(uq112x112 memory self) internal pure returns (uint112) {
        return uint112(self._x >> RESOLUTION);
    }

    // decode a uq112x112 into a uint with 18 decimals of precision
    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 <= type(uint144).max) {
            uint256 result = (numerator << RESOLUTION) / denominator;
            require(result <= type(uint224).max, "FixedPoint::fraction: overflow");
            return uq112x112(uint224(result));
        } else {
            uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
            require(result <= type(uint224).max, "FixedPoint::fraction: overflow");
            return uq112x112(uint224(result));
        }
    }

    // square root of a UQ112x112
    // lossy between 0/1 and 40 bits
    function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        if (self._x <= type(uint144).max) {
            return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
        }

        uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
        safeShiftBits -= safeShiftBits % 2;
        return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
    }
}

File 9 of 12 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 10 of 12 : IERC20.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8;

interface IERC20 {
  /**
   * @dev Returns the amount of tokens in existence.
   */
  function totalSupply() external view returns (uint256);

  /**
   * @dev Returns the amount of tokens owned by `account`.
   */
  function balanceOf(address account) external view returns (uint256);

  /**
   * @dev Moves `amount` tokens from the caller's account to `recipient`.
   *
   * Returns a boolean value indicating whether the operation succeeded.
   *
   * Emits a {Transfer} event.
   */
  function transfer(address recipient, uint256 amount) external returns (bool);

  /**
   * @dev Returns the remaining number of tokens that `spender` will be
   * allowed to spend on behalf of `owner` through {transferFrom}. This is
   * zero by default.
   *
   * This value changes when {approve} or {transferFrom} are called.
   */
  function allowance(address owner, address spender) external view returns (uint256);

  /**
   * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
   *
   * Returns a boolean value indicating whether the operation succeeded.
   *
   * IMPORTANT: Beware that changing an allowance with this method brings the risk
   * that someone may use both the old and the new allowance by unfortunate
   * transaction ordering. One possible solution to mitigate this race
   * condition is to first reduce the spender's allowance to 0 and set the
   * desired value afterwards:
   * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
   *
   * Emits an {Approval} event.
   */
  function approve(address spender, uint256 amount) external returns (bool);

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

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

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

File 11 of 12 : Address.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8;


// TODO(zx): replace with OZ implementation.
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 in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

    /**
     * @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");
    //     return _functionCallWithValue(target, data, value, errorMessage);
    // }
    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);
            }
        }
    }

  /**
     * @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.3._
     */
    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.3._
     */
    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);
            }
        }
    }

    function addressToString(address _address) internal pure returns(string memory) {
        bytes32 _bytes = bytes32(uint256(uint160(_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);

    }
}

File 12 of 12 : FullMath.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8;

library FullMath {
    function fullMul(uint256 x, uint256 y) private pure returns (uint256 l, uint256 h) {
        uint256 mm = mulmod(x, y, type(uint256).max);
        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 & (type(uint256).max - d + 1);
        d /= pow2;
        l /= pow2;
        l += h * ((type(uint256).max - pow2 + 1) / 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);
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_SWAP","type":"address"},{"internalType":"address","name":"_principal","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_DAO","type":"address"},{"internalType":"address","name":"_bondCalculator","type":"address"},{"internalType":"address","name":"_pairAddressSwap","type":"address"},{"internalType":"address","name":"_pairAddressPrinciple","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"deposit","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"payout","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"expires","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"priceInUSD","type":"uint256"}],"name":"BondCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"priceInUSD","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"internalPrice","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"debtRatio","type":"uint256"}],"name":"BondPriceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"payout","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remaining","type":"uint256"}],"name":"BondRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"initialBCV","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBCV","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"adjustment","type":"uint256"},{"indexed":false,"internalType":"bool","name":"addition","type":"bool"}],"name":"ControlVariableAdjustment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"CONTROL_VARIABLE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAO","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SWAP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adjustment","outputs":[{"internalType":"bool","name":"add","type":"bool"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"target","type":"uint256"},{"internalType":"uint256","name":"buffer","type":"uint256"},{"internalType":"uint256","name":"lastTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bondCalculator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"bondInfo","outputs":[{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vesting","type":"uint256"},{"internalType":"uint256","name":"lastTimestamp","type":"uint256"},{"internalType":"uint256","name":"pricePaid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_term","type":"uint256"}],"name":"bondPriceInUSD","outputs":[{"internalType":"uint256","name":"price_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"debtRatio","outputs":[{"internalType":"uint256","name":"debtRatio_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxPrice","type":"uint256"},{"internalType":"address","name":"_depositor","type":"address"},{"internalType":"uint256","name":"_term","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_controlVariable","type":"uint256"},{"internalType":"uint256[]","name":"_vestingTerm","type":"uint256[]"},{"internalType":"uint256","name":"_minimumPrice","type":"uint256"},{"internalType":"uint256","name":"_maxPayout","type":"uint256"},{"internalType":"uint256[]","name":"_fee","type":"uint256[]"},{"internalType":"uint256","name":"_maxDebt","type":"uint256"},{"internalType":"uint256","name":"_initialDebt","type":"uint256"}],"name":"initializeBondTerms","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isLiquidityBond","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastDecay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPayout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_depositor","type":"address"},{"internalType":"uint256","name":"_term","type":"uint256"}],"name":"pendingPayoutFor","outputs":[{"internalType":"uint256","name":"pendingPayout_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_depositor","type":"address"},{"internalType":"uint256","name":"_term","type":"uint256"}],"name":"percentVestedFor","outputs":[{"internalType":"uint256","name":"percentVested_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"principal","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"recoverLostToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_term","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_addition","type":"bool"},{"internalType":"uint256","name":"_increment","type":"uint256"},{"internalType":"uint256","name":"_target","type":"uint256"},{"internalType":"uint256","name":"_buffer","type":"uint256"}],"name":"setAdjustment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum SwapBondDepository.PARAMETER","name":"_parameter","type":"uint8"},{"internalType":"uint256","name":"_input","type":"uint256"},{"internalType":"uint256","name":"_term","type":"uint256"}],"name":"setBondTerms","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"terms","outputs":[{"internalType":"uint256","name":"controlVariable","type":"uint256"},{"internalType":"uint256","name":"minimumPrice","type":"uint256"},{"internalType":"uint256","name":"maxPayout","type":"uint256"},{"internalType":"uint256","name":"maxDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_target","type":"address[]"},{"internalType":"bool[]","name":"_value","type":"bool[]"}],"name":"updateBatchWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pair","type":"address"},{"internalType":"bool","name":"_swap","type":"bool"}],"name":"updatePairAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"bool","name":"_value","type":"bool"}],"name":"updateWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

6101406040523480156200001257600080fd5b50604051620031ed380380620031ed8339810160408190526200003591620001b5565b600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180556001600160a01b0387166200008e57600080fd5b6001600160601b0319606088901b166080526001600160a01b038616620000b457600080fd5b6001600160601b0319606087901b1660a0526001600160a01b038516620000da57600080fd5b6001600160601b0319606086901b1660c0526001600160a01b0384166200010057600080fd5b6001600160601b0319606085811b821660e05284901b1661012052600280546001600160a01b038481166001600160a01b0319928316179092556003805484841692169190911790558316151560f81b61010052600160106000620001623390565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055506200024995505050505050565b80516001600160a01b0381168114620001b057600080fd5b919050565b600080600080600080600060e0888a031215620001d0578283fd5b620001db8862000198565b9650620001eb6020890162000198565b9550620001fb6040890162000198565b94506200020b6060890162000198565b93506200021b6080890162000198565b92506200022b60a0890162000198565b91506200023b60c0890162000198565b905092959891949750929550565b60805160601c60a05160601c60c05160601c60e05160601c6101005160f81c6101205160601c612eaf6200033e6000396000818161046701528181611938015281816119dd01528181611e4f01528181611ef40152818161212d01526121d20152600081816104bf015281816105960152611f990152600081816103b70152610e2c015260008181610349015281816114b201526115060152600081816104400152818161062201528181610dd6015281816113b9015261148f0152600081816101ef01528181610d970152818161104b01528181611124015281816114e401528181611b8801526120400152612eaf6000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80639b19251a1161010f578063d5025625116100a2578063ef7f8bef11610071578063ef7f8bef146104fc578063f2fde38b1461050f578063f5c2ab5b14610522578063fc7b9c181461052b57600080fd5b8063d5025625146104a4578063d7969060146104ba578063e0176de8146104e1578063e78f0949146104e957600080fd5b8063ba5d3078116100de578063ba5d30781461043b578063c5332b7c14610462578063ca17428014610489578063cea55f571461049c57600080fd5b80639b19251a146103d95780639d2158f01461040c578063a1e4c0161461041f578063b4abccba1461042857600080fd5b8063451ee4a111610187578063759076e511610156578063759076e5146103865780638da5cb5b1461038e5780638f7cbc401461039f57806398fabd3a146103b257600080fd5b8063451ee4a1146102fd57806361d027b3146103445780636e979c6a1461036b578063715018a61461037e57600080fd5b80631a36daed116101c35780631a36daed146102645780631a3d0068146102c45780631e9a6950146102d75780633796c67e146102ea57600080fd5b806304d84108146101ea5780630d392cd91461022e57806319a6421514610243575b600080fd5b6102117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61024161023c366004612971565b610534565b005b610256610251366004612ae2565b610592565b604051908152602001610225565b6102a4610272366004612b12565b600f60209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610225565b6102416102d2366004612a71565b6106c1565b6102566102e53660046129a7565b610791565b6102566102f83660046129a7565b610983565b600a54600b54600c54600d54600e5461031a9460ff169392919085565b6040805195151586526020860194909452928401919091526060830152608082015260a001610225565b6102117f000000000000000000000000000000000000000000000000000000000000000081565b6102566103793660046129a7565b6109e6565b610241610a77565b601154610256565b6000546001600160a01b0316610211565b6102416103ad366004612971565b610aeb565b6102117f000000000000000000000000000000000000000000000000000000000000000081565b6103fc6103e7366004612957565b60106020526000908152604090205460ff1681565b6040519015158152602001610225565b61024161041a366004612aab565b610b5d565b61025661271081565b6103fc610436366004612957565b610d93565b6102117f000000000000000000000000000000000000000000000000000000000000000081565b6102117f000000000000000000000000000000000000000000000000000000000000000081565b610241610497366004612b3d565b610ec9565b610256611046565b6004546006546007546009546102a49392919084565b6103fc7f000000000000000000000000000000000000000000000000000000000000000081565b610256611110565b6102566104f7366004612bd9565b6111b8565b61024161050a3660046129d0565b6116e6565b61024161051d366004612957565b61180b565b61025660125481565b61025660115481565b6000546001600160a01b031633146105675760405162461bcd60e51b815260040161055e90612c85565b60405180910390fd5b6001600160a01b03919091166000908152601060205260409020805460ff1916911515919091179055565b60007f0000000000000000000000000000000000000000000000000000000000000000156106185761061261271061060c6004800185815481106105e657634e487b7160e01b600052603260045260246000fd5b90600052602060002001546127106105fe9190612df7565b6106066118f5565b90611a97565b90611b1d565b92915050565b610612606461060c7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561067957600080fd5b505afa15801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b19190612c15565b6105fe90600a612d2d565b919050565b6000546001600160a01b031633146106eb5760405162461bcd60e51b815260040161055e90612c85565b600454610701906103e89061060c906019611a97565b8311156107465760405162461bcd60e51b8152602060048201526013602482015272496e6372656d656e7420746f6f206c6172676560681b604482015260640161055e565b6040805160a0810182529415158086526020860185905290850183905260608501829052426080909501859052600a805460ff19169091179055600b92909255600c55600d55600e55565b3360009081526010602052604081205460ff166107e25760405162461bcd60e51b815260206004820152600f60248201526e139bdd0815da1a5d195b1a5cdd1959608a1b604482015260640161055e565b600260015414156108355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161055e565b600260015533803b63ffffffff16156108835760405162461bcd60e51b815260206004820152601060248201526f436f6e7472616374206164647265737360801b604482015260640161055e565b6000838152600f602090815260408083206001600160a01b03881684528252808320815160808101835281548152600182015493810193909352600281015491830191909152600301546060820152906108dd86866109e6565b9050633b9aca008110610975576000858152600f602090815260408083206001600160a01b038a16808552908352818420848155600181018590556002810185905560030184905585518251908152928301939093527f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b1910160405180910390a261096c868360000151611b5f565b93505050610978565b50505b506001805592915050565b60008061099084846109e6565b6000848152600f602090815260408083206001600160a01b0389168452909152902054909150633b9aca0082106109c9578092506109de565b6109db633b9aca0061060c8385611a97565b92505b505092915050565b6000818152600f602090815260408083206001600160a01b0386168452825280832081516080810183528154815260018201549381019390935260028101549183018290526003015460608301528290610a41904290611c0e565b60208301519091508015801590610a585750808210155b15610a6957633b9aca009350610a6e565b600093505b50505092915050565b6000546001600160a01b03163314610aa15760405162461bcd60e51b815260040161055e90612c85565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610b155760405162461bcd60e51b815260040161055e90612c85565b8015610b3c57600280546001600160a01b0384166001600160a01b03199091161790555050565b600380546001600160a01b0384166001600160a01b03199091161790555050565b6000546001600160a01b03163314610b875760405162461bcd60e51b815260040161055e90612c85565b6000836003811115610ba957634e487b7160e01b600052602160045260246000fd5b1415610c41576003821015610c0b5760405162461bcd60e51b815260206004820152602260248201527f56657374696e67206d757374206265206c6f6e676572207468616e2033206461604482015261797360f01b606482015260840161055e565b8160046001018281548110610c3057634e487b7160e01b600052603260045260246000fd5b600091825260209091200155505050565b6001836003811115610c6357634e487b7160e01b600052602160045260246000fd5b1415610cc2576103e8821115610cbb5760405162461bcd60e51b815260206004820181905260248201527f5061796f75742063616e6e6f742062652061626f766520312070657263656e74604482015260640161055e565b5060075550565b6002836003811115610ce457634e487b7160e01b600052602160045260246000fd5b1415610d6057612710821115610d3c5760405162461bcd60e51b815260206004820152601c60248201527f44414f206665652063616e6e6f7420657863656564207061796f757400000000604482015260640161055e565b81600480018281548110610c3057634e487b7160e01b600052603260045260246000fd5b6003836003811115610d8257634e487b7160e01b600052602160045260246000fd5b1415610d8e5760098290555b505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415610dd457600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415610e1357600080fd5b6040516370a0823160e01b8152306004820152610ec1907f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b038516906370a082319060240160206040518083038186803b158015610e7857600080fd5b505afa158015610e8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb09190612afa565b6001600160a01b0385169190611c50565b506001919050565b6000546001600160a01b03163314610ef35760405162461bcd60e51b815260040161055e90612c85565b60045415610f435760405162461bcd60e51b815260206004820181905260248201527f426f6e6473206d75737420626520696e697469616c697a65642066726f6d2030604482015260640161055e565b6040518060c001604052808a8152602001898980806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602080820189905260408083018990528051878302818101840190925287815260609093019291889188918291908501908490808284376000920191909152505050908252506020908101849052815160049081558282015180519192610ff7926005929091019061289f565b5060408201516002820155606082015160038201556080820151805161102791600484019160209091019061289f565b5060a09190910151600590910155601155505042601255505050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156110a257600080fd5b505afa1580156110b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110da9190612afa565b905061110a670de0b6b3a764000061060c6111056110ff633b9aca0061060660115490565b85611cb3565b611dee565b91505090565b60006111b3620186a061060c6004600301547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561117b57600080fd5b505afa15801561118f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106069190612afa565b905090565b3360009081526010602052604081205460ff166112095760405162461bcd60e51b815260206004820152600f60248201526e139bdd0815da1a5d195b1a5cdd1959608a1b604482015260640161055e565b6002600154141561125c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161055e565b600260015533803b63ffffffff16156112aa5760405162461bcd60e51b815260206004820152601060248201526f436f6e7472616374206164647265737360801b604482015260640161055e565b6001600160a01b0384166112f25760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161055e565b600954601154111561133d5760405162461bcd60e51b815260206004820152601460248201527313585e0818d85c1858da5d1e481c995858da195960621b604482015260640161055e565b600061134884610592565b90506000611354611e0e565b9050808710156113b25760405162461bcd60e51b815260206004820152602360248201527f536c697070616765206c696d69743a206d6f7265207468616e206d617820707260448201526269636560e81b606482015260840161055e565b60006113de7f00000000000000000000000000000000000000000000000000000000000000008a611f95565b9050662386f26fc100008110156114285760405162461bcd60e51b815260206004820152600e60248201526d109bdb99081d1bdbc81cdb585b1b60921b604482015260640161055e565b611430611110565b8111156114705760405162461bcd60e51b815260206004820152600e60248201526d426f6e6420746f6f206c6172676560901b604482015260640161055e565b60006114808461060c8486611a97565b90506114d76001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016337f00000000000000000000000000000000000000000000000000000000000000008d61224e565b61152c6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000308461224e565b601154611539908361228c565b601155604080516080810182526000898152600f60209081528382206001600160a01b038d168352905291909120548190611574908461228c565b81526020016004600101898154811061159d57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154620151806115b69190612dd8565b815242602080830191909152604091820187905260008a8152600f82528281206001600160a01b038d168252825282902083518155908301516001820155908201516002820155606090910151600390910155600580548591611651918a90811061163157634e487b7160e01b600052603260045260246000fd5b90600052602060002001546201518061164a9190612dd8565b429061228c565b827f1fec6dc81f140574bf43f6b1e420ae1dd47928b9d57db8cbd7b8611063b85ae58d60405161168391815260200190565b60405180910390a4611693611046565b61169b611e0e565b6116a489610592565b6040517f375b221f40939bfd8f49723a17cf7bc6d576ebf72efe2cc3e991826f5b3f390a90600090a46116d56122eb565b600180559998505050505050505050565b6000546001600160a01b031633146117105760405162461bcd60e51b815260040161055e90612c85565b8281146117515760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081c995c5d595cdd608a1b604482015260640161055e565b60005b838110156118045782828281811061177c57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906117919190612a39565b601060008787858181106117b557634e487b7160e01b600052603260045260246000fd5b90506020020160208101906117ca9190612957565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806117fc81612e3a565b915050611754565b5050505050565b6000546001600160a01b031633146118355760405162461bcd60e51b815260040161055e90612c85565b6001600160a01b03811661189a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161055e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60035460009081906001600160a01b0316156119bb576002546003546040516354513a0f60e11b81526001600160a01b03928316600482015290821660248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a8a2741e9060440160206040518083038186803b15801561197c57600080fd5b505afa158015611990573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b49190612afa565b9050611a5c565b6002546040516366048d1360e11b81526001600160a01b0391821660048201527f00000000000000000000000000000000000000000000000000000000000000009091169063cc091a269060240160206040518083038186803b158015611a2157600080fd5b505afa158015611a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a599190612afa565b90505b611a8061271061060c83610606600460000154612710611c0e90919063ffffffff16565b600654909250821015611a935760065491505b5090565b600082611aa657506000610612565b6000611ab28385612dd8565b905082611abf8583612cd2565b14611b165760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161055e565b9392505050565b6000611b1683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123cc565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000917f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb90604401602060405180830381600087803b158015611bce57600080fd5b505af1158015611be2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c069190612a55565b509092915050565b6000611b1683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612403565b6040516001600160a01b038316602482015260448101829052610d8e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612434565b60408051602081019091526000815260008211611d215760405162461bcd60e51b815260206004820152602660248201527f4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206260448201526579207a65726f60d01b606482015260840161055e565b82611d3b5750604080516020810190915260008152610612565b71ffffffffffffffffffffffffffffffffffff8311611ddd576000611d6483607086901b612cd2565b90506001600160e01b03811115611dbd5760405162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015260640161055e565b6040518060200160405280826001600160e01b0316815250915050610612565b6000611d6484600160701b85612506565b8051600090610612906612725dd1d243ab906001600160e01b0316612cd2565b6003546000906001600160a01b031615611ed2576002546003546040516354513a0f60e11b81526001600160a01b03928316600482015290821660248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a8a2741e9060440160206040518083038186803b158015611e9357600080fd5b505afa158015611ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecb9190612afa565b9050611f73565b6002546040516366048d1360e11b81526001600160a01b0391821660048201527f00000000000000000000000000000000000000000000000000000000000000009091169063cc091a269060240160206040518083038186803b158015611f3857600080fd5b505afa158015611f4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f709190612afa565b90505b600654811015611f84575060065490565b60065415611f925760006006555b90565b60007f00000000000000000000000000000000000000000000000000000000000000006120e8576120e1836001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611ff857600080fd5b505afa15801561200c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120309190612c15565b61203b90600a612d2d565b61060c7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561209757600080fd5b505afa1580156120ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120cf9190612c15565b6120da90600a612d2d565b8590611a97565b9050610612565b6003546001600160a01b0316156121a957600254600354604051632956565360e01b81526001600160a01b0392831660048201529082166024820152604481018490527f00000000000000000000000000000000000000000000000000000000000000009091169063295656539060640160206040518083038186803b15801561217157600080fd5b505afa158015612185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e19190612afa565b60025460405163e67263af60e01b81526001600160a01b039182166004820152602481018490527f00000000000000000000000000000000000000000000000000000000000000009091169063e67263af9060440160206040518083038186803b15801561221657600080fd5b505afa15801561222a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b169190612afa565b6040516001600160a01b03808516602483015283166044820152606481018290526122869085906323b872dd60e01b90608401611c7c565b50505050565b6000806122998385612cba565b905083811015611b165760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161055e565b600d54600e546000916122fe919061228c565b600b54909150158015906123125750804210155b156123c957600454600a5460ff161561234c57600b546004546123349161228c565b6004819055600c5411612347576000600b555b61236e565b600b5460045461235b91611c0e565b6004819055600c541061236e576000600b555b42600e55600454600b54600a5460408051858152602081019490945283019190915260ff16151560608201527fb923e581a0f83128e9e1d8297aa52b18d6744310476e0b54509c054cd7a93b2a9060800160405180910390a1505b50565b600081836123ed5760405162461bcd60e51b815260040161055e9190612c52565b5060006123fa8486612cd2565b95945050505050565b600081848411156124275760405162461bcd60e51b815260040161055e9190612c52565b5060006123fa8486612df7565b6000612489826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125c39092919063ffffffff16565b805190915015610d8e57808060200190518101906124a79190612a55565b610d8e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161055e565b600080600061251586866125da565b915091506000848061253757634e487b7160e01b600052601260045260246000fd5b8688099050828111156125525761254f600183612df7565b91505b61255c8184612df7565b92508482106125ad5760405162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f77000000000000604482015260640161055e565b6125b883838761261c565b979650505050505050565b60606125d284846000856127b3565b949350505050565b6000808060001984860990506125f08486612dd8565b92506125fc8382612df7565b91508281101561261457612611600183612df7565b91505b509250929050565b60008061262b83600019612df7565b612636906001612cba565b831690506126448184612cd2565b92506126508186612cd2565b94508061265f81600019612df7565b61266a906001612cba565b6126749190612cd2565b61267f906001612cba565b6126899085612dd8565b6126939086612cba565b945060016126a18185612dd8565b6126ac906002612df7565b6126b69082612dd8565b90506126c28185612dd8565b6126cd906002612df7565b6126d79082612dd8565b90506126e38185612dd8565b6126ee906002612df7565b6126f89082612dd8565b90506127048185612dd8565b61270f906002612df7565b6127199082612dd8565b90506127258185612dd8565b612730906002612df7565b61273a9082612dd8565b90506127468185612dd8565b612751906002612df7565b61275b9082612dd8565b90506127678185612dd8565b612772906002612df7565b61277c9082612dd8565b90506127888185612dd8565b612793906002612df7565b61279d9082612dd8565b90506127a98187612dd8565b9695505050505050565b6060843b6128035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161055e565b600080866001600160a01b0316858760405161281f9190612c36565b60006040518083038185875af1925050503d806000811461285c576040519150601f19603f3d011682016040523d82523d6000602084013e612861565b606091505b509150915081156128755791506125d29050565b8051156128855780518082602001fd5b8360405162461bcd60e51b815260040161055e9190612c52565b8280548282559060005260206000209081019282156128da579160200282015b828111156128da5782518255916020019190600101906128bf565b50611a939291505b80821115611a9357600081556001016128e2565b80356001600160a01b03811681146106bc57600080fd5b60008083601f84011261291e578182fd5b50813567ffffffffffffffff811115612935578182fd5b6020830191508360208260051b850101111561295057600080fd5b9250929050565b600060208284031215612968578081fd5b611b16826128f6565b60008060408385031215612983578081fd5b61298c836128f6565b9150602083013561299c81612e6b565b809150509250929050565b600080604083850312156129b9578182fd5b6129c2836128f6565b946020939093013593505050565b600080600080604085870312156129e5578182fd5b843567ffffffffffffffff808211156129fc578384fd5b612a088883890161290d565b90965094506020870135915080821115612a20578384fd5b50612a2d8782880161290d565b95989497509550505050565b600060208284031215612a4a578081fd5b8135611b1681612e6b565b600060208284031215612a66578081fd5b8151611b1681612e6b565b60008060008060808587031215612a86578384fd5b8435612a9181612e6b565b966020860135965060408601359560600135945092505050565b600080600060608486031215612abf578283fd5b833560048110612acd578384fd5b95602085013595506040909401359392505050565b600060208284031215612af3578081fd5b5035919050565b600060208284031215612b0b578081fd5b5051919050565b60008060408385031215612b24578182fd5b82359150612b34602084016128f6565b90509250929050565b600080600080600080600080600060e08a8c031215612b5a578485fd5b8935985060208a013567ffffffffffffffff80821115612b78578687fd5b612b848d838e0161290d565b909a50985060408c0135975060608c0135965060808c0135915080821115612baa578586fd5b50612bb78c828d0161290d565b9a9d999c50979a96999598959660a08101359660c09091013595509350505050565b60008060008060808587031215612bee578182fd5b8435935060208501359250612c05604086016128f6565b9396929550929360600135925050565b600060208284031215612c26578081fd5b815160ff81168114611b16578182fd5b60008251612c48818460208701612e0e565b9190910192915050565b6020815260008251806020840152612c71816040850160208701612e0e565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115612ccd57612ccd612e55565b500190565b600082612ced57634e487b7160e01b81526012600452602481fd5b500490565b600181815b80851115612614578160001904821115612d1357612d13612e55565b80851615612d2057918102915b93841c9390800290612cf7565b6000611b1660ff841683600082612d4657506001610612565b81612d5357506000610612565b8160018114612d695760028114612d7357612d8f565b6001915050610612565b60ff841115612d8457612d84612e55565b50506001821b610612565b5060208310610133831016604e8410600b8410161715612db2575081810a610612565b612dbc8383612cf2565b8060001904821115612dd057612dd0612e55565b029392505050565b6000816000190483118215151615612df257612df2612e55565b500290565b600082821015612e0957612e09612e55565b500390565b60005b83811015612e29578181015183820152602001612e11565b838111156122865750506000910152565b6000600019821415612e4e57612e4e612e55565b5060010190565b634e487b7160e01b600052601160045260246000fd5b80151581146123c957600080fdfea2646970667358221220dae2274f1b7581b516f4fc82e5dc0e5969a47cc010e4f42f68986dbd4dacb94e64736f6c63430008040033000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b6379000000000000000000000000d90a1ba0cbaaaabfdc6c814cdf1611306a26e1f80000000000000000000000000d4a11d5eeaac28ec3f61d100daf4d40471f1852

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80639b19251a1161010f578063d5025625116100a2578063ef7f8bef11610071578063ef7f8bef146104fc578063f2fde38b1461050f578063f5c2ab5b14610522578063fc7b9c181461052b57600080fd5b8063d5025625146104a4578063d7969060146104ba578063e0176de8146104e1578063e78f0949146104e957600080fd5b8063ba5d3078116100de578063ba5d30781461043b578063c5332b7c14610462578063ca17428014610489578063cea55f571461049c57600080fd5b80639b19251a146103d95780639d2158f01461040c578063a1e4c0161461041f578063b4abccba1461042857600080fd5b8063451ee4a111610187578063759076e511610156578063759076e5146103865780638da5cb5b1461038e5780638f7cbc401461039f57806398fabd3a146103b257600080fd5b8063451ee4a1146102fd57806361d027b3146103445780636e979c6a1461036b578063715018a61461037e57600080fd5b80631a36daed116101c35780631a36daed146102645780631a3d0068146102c45780631e9a6950146102d75780633796c67e146102ea57600080fd5b806304d84108146101ea5780630d392cd91461022e57806319a6421514610243575b600080fd5b6102117f000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe81565b6040516001600160a01b0390911681526020015b60405180910390f35b61024161023c366004612971565b610534565b005b610256610251366004612ae2565b610592565b604051908152602001610225565b6102a4610272366004612b12565b600f60209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610225565b6102416102d2366004612a71565b6106c1565b6102566102e53660046129a7565b610791565b6102566102f83660046129a7565b610983565b600a54600b54600c54600d54600e5461031a9460ff169392919085565b6040805195151586526020860194909452928401919091526060830152608082015260a001610225565b6102117f000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd81565b6102566103793660046129a7565b6109e6565b610241610a77565b601154610256565b6000546001600160a01b0316610211565b6102416103ad366004612971565b610aeb565b6102117f000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd81565b6103fc6103e7366004612957565b60106020526000908152604090205460ff1681565b6040519015158152602001610225565b61024161041a366004612aab565b610b5d565b61025661271081565b6103fc610436366004612957565b610d93565b6102117f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b6102117f000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b637981565b610241610497366004612b3d565b610ec9565b610256611046565b6004546006546007546009546102a49392919084565b6103fc7f000000000000000000000000000000000000000000000000000000000000000181565b610256611110565b6102566104f7366004612bd9565b6111b8565b61024161050a3660046129d0565b6116e6565b61024161051d366004612957565b61180b565b61025660125481565b61025660115481565b6000546001600160a01b031633146105675760405162461bcd60e51b815260040161055e90612c85565b60405180910390fd5b6001600160a01b03919091166000908152601060205260409020805460ff1916911515919091179055565b60007f0000000000000000000000000000000000000000000000000000000000000001156106185761061261271061060c6004800185815481106105e657634e487b7160e01b600052603260045260246000fd5b90600052602060002001546127106105fe9190612df7565b6106066118f5565b90611a97565b90611b1d565b92915050565b610612606461060c7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561067957600080fd5b505afa15801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b19190612c15565b6105fe90600a612d2d565b919050565b6000546001600160a01b031633146106eb5760405162461bcd60e51b815260040161055e90612c85565b600454610701906103e89061060c906019611a97565b8311156107465760405162461bcd60e51b8152602060048201526013602482015272496e6372656d656e7420746f6f206c6172676560681b604482015260640161055e565b6040805160a0810182529415158086526020860185905290850183905260608501829052426080909501859052600a805460ff19169091179055600b92909255600c55600d55600e55565b3360009081526010602052604081205460ff166107e25760405162461bcd60e51b815260206004820152600f60248201526e139bdd0815da1a5d195b1a5cdd1959608a1b604482015260640161055e565b600260015414156108355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161055e565b600260015533803b63ffffffff16156108835760405162461bcd60e51b815260206004820152601060248201526f436f6e7472616374206164647265737360801b604482015260640161055e565b6000838152600f602090815260408083206001600160a01b03881684528252808320815160808101835281548152600182015493810193909352600281015491830191909152600301546060820152906108dd86866109e6565b9050633b9aca008110610975576000858152600f602090815260408083206001600160a01b038a16808552908352818420848155600181018590556002810185905560030184905585518251908152928301939093527f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b1910160405180910390a261096c868360000151611b5f565b93505050610978565b50505b506001805592915050565b60008061099084846109e6565b6000848152600f602090815260408083206001600160a01b0389168452909152902054909150633b9aca0082106109c9578092506109de565b6109db633b9aca0061060c8385611a97565b92505b505092915050565b6000818152600f602090815260408083206001600160a01b0386168452825280832081516080810183528154815260018201549381019390935260028101549183018290526003015460608301528290610a41904290611c0e565b60208301519091508015801590610a585750808210155b15610a6957633b9aca009350610a6e565b600093505b50505092915050565b6000546001600160a01b03163314610aa15760405162461bcd60e51b815260040161055e90612c85565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610b155760405162461bcd60e51b815260040161055e90612c85565b8015610b3c57600280546001600160a01b0384166001600160a01b03199091161790555050565b600380546001600160a01b0384166001600160a01b03199091161790555050565b6000546001600160a01b03163314610b875760405162461bcd60e51b815260040161055e90612c85565b6000836003811115610ba957634e487b7160e01b600052602160045260246000fd5b1415610c41576003821015610c0b5760405162461bcd60e51b815260206004820152602260248201527f56657374696e67206d757374206265206c6f6e676572207468616e2033206461604482015261797360f01b606482015260840161055e565b8160046001018281548110610c3057634e487b7160e01b600052603260045260246000fd5b600091825260209091200155505050565b6001836003811115610c6357634e487b7160e01b600052602160045260246000fd5b1415610cc2576103e8821115610cbb5760405162461bcd60e51b815260206004820181905260248201527f5061796f75742063616e6e6f742062652061626f766520312070657263656e74604482015260640161055e565b5060075550565b6002836003811115610ce457634e487b7160e01b600052602160045260246000fd5b1415610d6057612710821115610d3c5760405162461bcd60e51b815260206004820152601c60248201527f44414f206665652063616e6e6f7420657863656564207061796f757400000000604482015260640161055e565b81600480018281548110610c3057634e487b7160e01b600052603260045260246000fd5b6003836003811115610d8257634e487b7160e01b600052602160045260246000fd5b1415610d8e5760098290555b505050565b60007f000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe6001600160a01b0316826001600160a01b03161415610dd457600080fd5b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316826001600160a01b03161415610e1357600080fd5b6040516370a0823160e01b8152306004820152610ec1907f000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd906001600160a01b038516906370a082319060240160206040518083038186803b158015610e7857600080fd5b505afa158015610e8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb09190612afa565b6001600160a01b0385169190611c50565b506001919050565b6000546001600160a01b03163314610ef35760405162461bcd60e51b815260040161055e90612c85565b60045415610f435760405162461bcd60e51b815260206004820181905260248201527f426f6e6473206d75737420626520696e697469616c697a65642066726f6d2030604482015260640161055e565b6040518060c001604052808a8152602001898980806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602080820189905260408083018990528051878302818101840190925287815260609093019291889188918291908501908490808284376000920191909152505050908252506020908101849052815160049081558282015180519192610ff7926005929091019061289f565b5060408201516002820155606082015160038201556080820151805161102791600484019160209091019061289f565b5060a09190910151600590910155601155505042601255505050505050565b6000807f000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156110a257600080fd5b505afa1580156110b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110da9190612afa565b905061110a670de0b6b3a764000061060c6111056110ff633b9aca0061060660115490565b85611cb3565b611dee565b91505090565b60006111b3620186a061060c6004600301547f000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561117b57600080fd5b505afa15801561118f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106069190612afa565b905090565b3360009081526010602052604081205460ff166112095760405162461bcd60e51b815260206004820152600f60248201526e139bdd0815da1a5d195b1a5cdd1959608a1b604482015260640161055e565b6002600154141561125c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161055e565b600260015533803b63ffffffff16156112aa5760405162461bcd60e51b815260206004820152601060248201526f436f6e7472616374206164647265737360801b604482015260640161055e565b6001600160a01b0384166112f25760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161055e565b600954601154111561133d5760405162461bcd60e51b815260206004820152601460248201527313585e0818d85c1858da5d1e481c995858da195960621b604482015260640161055e565b600061134884610592565b90506000611354611e0e565b9050808710156113b25760405162461bcd60e51b815260206004820152602360248201527f536c697070616765206c696d69743a206d6f7265207468616e206d617820707260448201526269636560e81b606482015260840161055e565b60006113de7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec78a611f95565b9050662386f26fc100008110156114285760405162461bcd60e51b815260206004820152600e60248201526d109bdb99081d1bdbc81cdb585b1b60921b604482015260640161055e565b611430611110565b8111156114705760405162461bcd60e51b815260206004820152600e60248201526d426f6e6420746f6f206c6172676560901b604482015260640161055e565b60006114808461060c8486611a97565b90506114d76001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec716337f000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd8d61224e565b61152c6001600160a01b037f000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe167f000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd308461224e565b601154611539908361228c565b601155604080516080810182526000898152600f60209081528382206001600160a01b038d168352905291909120548190611574908461228c565b81526020016004600101898154811061159d57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154620151806115b69190612dd8565b815242602080830191909152604091820187905260008a8152600f82528281206001600160a01b038d168252825282902083518155908301516001820155908201516002820155606090910151600390910155600580548591611651918a90811061163157634e487b7160e01b600052603260045260246000fd5b90600052602060002001546201518061164a9190612dd8565b429061228c565b827f1fec6dc81f140574bf43f6b1e420ae1dd47928b9d57db8cbd7b8611063b85ae58d60405161168391815260200190565b60405180910390a4611693611046565b61169b611e0e565b6116a489610592565b6040517f375b221f40939bfd8f49723a17cf7bc6d576ebf72efe2cc3e991826f5b3f390a90600090a46116d56122eb565b600180559998505050505050505050565b6000546001600160a01b031633146117105760405162461bcd60e51b815260040161055e90612c85565b8281146117515760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081c995c5d595cdd608a1b604482015260640161055e565b60005b838110156118045782828281811061177c57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906117919190612a39565b601060008787858181106117b557634e487b7160e01b600052603260045260246000fd5b90506020020160208101906117ca9190612957565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806117fc81612e3a565b915050611754565b5050505050565b6000546001600160a01b031633146118355760405162461bcd60e51b815260040161055e90612c85565b6001600160a01b03811661189a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161055e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60035460009081906001600160a01b0316156119bb576002546003546040516354513a0f60e11b81526001600160a01b03928316600482015290821660248201527f000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b63799091169063a8a2741e9060440160206040518083038186803b15801561197c57600080fd5b505afa158015611990573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b49190612afa565b9050611a5c565b6002546040516366048d1360e11b81526001600160a01b0391821660048201527f000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b63799091169063cc091a269060240160206040518083038186803b158015611a2157600080fd5b505afa158015611a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a599190612afa565b90505b611a8061271061060c83610606600460000154612710611c0e90919063ffffffff16565b600654909250821015611a935760065491505b5090565b600082611aa657506000610612565b6000611ab28385612dd8565b905082611abf8583612cd2565b14611b165760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161055e565b9392505050565b6000611b1683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123cc565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390526000917f000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe9091169063a9059cbb90604401602060405180830381600087803b158015611bce57600080fd5b505af1158015611be2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c069190612a55565b509092915050565b6000611b1683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612403565b6040516001600160a01b038316602482015260448101829052610d8e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612434565b60408051602081019091526000815260008211611d215760405162461bcd60e51b815260206004820152602660248201527f4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206260448201526579207a65726f60d01b606482015260840161055e565b82611d3b5750604080516020810190915260008152610612565b71ffffffffffffffffffffffffffffffffffff8311611ddd576000611d6483607086901b612cd2565b90506001600160e01b03811115611dbd5760405162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015260640161055e565b6040518060200160405280826001600160e01b0316815250915050610612565b6000611d6484600160701b85612506565b8051600090610612906612725dd1d243ab906001600160e01b0316612cd2565b6003546000906001600160a01b031615611ed2576002546003546040516354513a0f60e11b81526001600160a01b03928316600482015290821660248201527f000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b63799091169063a8a2741e9060440160206040518083038186803b158015611e9357600080fd5b505afa158015611ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecb9190612afa565b9050611f73565b6002546040516366048d1360e11b81526001600160a01b0391821660048201527f000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b63799091169063cc091a269060240160206040518083038186803b158015611f3857600080fd5b505afa158015611f4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f709190612afa565b90505b600654811015611f84575060065490565b60065415611f925760006006555b90565b60007f00000000000000000000000000000000000000000000000000000000000000016120e8576120e1836001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611ff857600080fd5b505afa15801561200c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120309190612c15565b61203b90600a612d2d565b61060c7f000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561209757600080fd5b505afa1580156120ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120cf9190612c15565b6120da90600a612d2d565b8590611a97565b9050610612565b6003546001600160a01b0316156121a957600254600354604051632956565360e01b81526001600160a01b0392831660048201529082166024820152604481018490527f000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b63799091169063295656539060640160206040518083038186803b15801561217157600080fd5b505afa158015612185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e19190612afa565b60025460405163e67263af60e01b81526001600160a01b039182166004820152602481018490527f000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b63799091169063e67263af9060440160206040518083038186803b15801561221657600080fd5b505afa15801561222a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b169190612afa565b6040516001600160a01b03808516602483015283166044820152606481018290526122869085906323b872dd60e01b90608401611c7c565b50505050565b6000806122998385612cba565b905083811015611b165760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161055e565b600d54600e546000916122fe919061228c565b600b54909150158015906123125750804210155b156123c957600454600a5460ff161561234c57600b546004546123349161228c565b6004819055600c5411612347576000600b555b61236e565b600b5460045461235b91611c0e565b6004819055600c541061236e576000600b555b42600e55600454600b54600a5460408051858152602081019490945283019190915260ff16151560608201527fb923e581a0f83128e9e1d8297aa52b18d6744310476e0b54509c054cd7a93b2a9060800160405180910390a1505b50565b600081836123ed5760405162461bcd60e51b815260040161055e9190612c52565b5060006123fa8486612cd2565b95945050505050565b600081848411156124275760405162461bcd60e51b815260040161055e9190612c52565b5060006123fa8486612df7565b6000612489826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125c39092919063ffffffff16565b805190915015610d8e57808060200190518101906124a79190612a55565b610d8e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161055e565b600080600061251586866125da565b915091506000848061253757634e487b7160e01b600052601260045260246000fd5b8688099050828111156125525761254f600183612df7565b91505b61255c8184612df7565b92508482106125ad5760405162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f77000000000000604482015260640161055e565b6125b883838761261c565b979650505050505050565b60606125d284846000856127b3565b949350505050565b6000808060001984860990506125f08486612dd8565b92506125fc8382612df7565b91508281101561261457612611600183612df7565b91505b509250929050565b60008061262b83600019612df7565b612636906001612cba565b831690506126448184612cd2565b92506126508186612cd2565b94508061265f81600019612df7565b61266a906001612cba565b6126749190612cd2565b61267f906001612cba565b6126899085612dd8565b6126939086612cba565b945060016126a18185612dd8565b6126ac906002612df7565b6126b69082612dd8565b90506126c28185612dd8565b6126cd906002612df7565b6126d79082612dd8565b90506126e38185612dd8565b6126ee906002612df7565b6126f89082612dd8565b90506127048185612dd8565b61270f906002612df7565b6127199082612dd8565b90506127258185612dd8565b612730906002612df7565b61273a9082612dd8565b90506127468185612dd8565b612751906002612df7565b61275b9082612dd8565b90506127678185612dd8565b612772906002612df7565b61277c9082612dd8565b90506127888185612dd8565b612793906002612df7565b61279d9082612dd8565b90506127a98187612dd8565b9695505050505050565b6060843b6128035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161055e565b600080866001600160a01b0316858760405161281f9190612c36565b60006040518083038185875af1925050503d806000811461285c576040519150601f19603f3d011682016040523d82523d6000602084013e612861565b606091505b509150915081156128755791506125d29050565b8051156128855780518082602001fd5b8360405162461bcd60e51b815260040161055e9190612c52565b8280548282559060005260206000209081019282156128da579160200282015b828111156128da5782518255916020019190600101906128bf565b50611a939291505b80821115611a9357600081556001016128e2565b80356001600160a01b03811681146106bc57600080fd5b60008083601f84011261291e578182fd5b50813567ffffffffffffffff811115612935578182fd5b6020830191508360208260051b850101111561295057600080fd5b9250929050565b600060208284031215612968578081fd5b611b16826128f6565b60008060408385031215612983578081fd5b61298c836128f6565b9150602083013561299c81612e6b565b809150509250929050565b600080604083850312156129b9578182fd5b6129c2836128f6565b946020939093013593505050565b600080600080604085870312156129e5578182fd5b843567ffffffffffffffff808211156129fc578384fd5b612a088883890161290d565b90965094506020870135915080821115612a20578384fd5b50612a2d8782880161290d565b95989497509550505050565b600060208284031215612a4a578081fd5b8135611b1681612e6b565b600060208284031215612a66578081fd5b8151611b1681612e6b565b60008060008060808587031215612a86578384fd5b8435612a9181612e6b565b966020860135965060408601359560600135945092505050565b600080600060608486031215612abf578283fd5b833560048110612acd578384fd5b95602085013595506040909401359392505050565b600060208284031215612af3578081fd5b5035919050565b600060208284031215612b0b578081fd5b5051919050565b60008060408385031215612b24578182fd5b82359150612b34602084016128f6565b90509250929050565b600080600080600080600080600060e08a8c031215612b5a578485fd5b8935985060208a013567ffffffffffffffff80821115612b78578687fd5b612b848d838e0161290d565b909a50985060408c0135975060608c0135965060808c0135915080821115612baa578586fd5b50612bb78c828d0161290d565b9a9d999c50979a96999598959660a08101359660c09091013595509350505050565b60008060008060808587031215612bee578182fd5b8435935060208501359250612c05604086016128f6565b9396929550929360600135925050565b600060208284031215612c26578081fd5b815160ff81168114611b16578182fd5b60008251612c48818460208701612e0e565b9190910192915050565b6020815260008251806020840152612c71816040850160208701612e0e565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115612ccd57612ccd612e55565b500190565b600082612ced57634e487b7160e01b81526012600452602481fd5b500490565b600181815b80851115612614578160001904821115612d1357612d13612e55565b80851615612d2057918102915b93841c9390800290612cf7565b6000611b1660ff841683600082612d4657506001610612565b81612d5357506000610612565b8160018114612d695760028114612d7357612d8f565b6001915050610612565b60ff841115612d8457612d84612e55565b50506001821b610612565b5060208310610133831016604e8410600b8410161715612db2575081810a610612565b612dbc8383612cf2565b8060001904821115612dd057612dd0612e55565b029392505050565b6000816000190483118215151615612df257612df2612e55565b500290565b600082821015612e0957612e09612e55565b500390565b60005b83811015612e29578181015183820152602001612e11565b838111156122865750506000910152565b6000600019821415612e4e57612e4e612e55565b5060010190565b634e487b7160e01b600052601160045260246000fd5b80151581146123c957600080fdfea2646970667358221220dae2274f1b7581b516f4fc82e5dc0e5969a47cc010e4f42f68986dbd4dacb94e64736f6c63430008040033

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

000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b6379000000000000000000000000d90a1ba0cbaaaabfdc6c814cdf1611306a26e1f80000000000000000000000000d4a11d5eeaac28ec3f61d100daf4d40471f1852

-----Decoded View---------------
Arg [0] : _SWAP (address): 0xCC4304A31d09258b0029eA7FE63d032f52e44EFe
Arg [1] : _principal (address): 0xdAC17F958D2ee523a2206206994597C13D831ec7
Arg [2] : _treasury (address): 0xB5440E3E78aF49364C255f8507B4930e816e88fD
Arg [3] : _DAO (address): 0xB5440E3E78aF49364C255f8507B4930e816e88fD
Arg [4] : _bondCalculator (address): 0xEBfCd7f7F424f5A72939aAed18939c90733b6379
Arg [5] : _pairAddressSwap (address): 0xD90a1ba0cbaaaabfdC6C814cDF1611306A26E1f8
Arg [6] : _pairAddressPrinciple (address): 0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 000000000000000000000000cc4304a31d09258b0029ea7fe63d032f52e44efe
Arg [1] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Arg [2] : 000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd
Arg [3] : 000000000000000000000000b5440e3e78af49364c255f8507b4930e816e88fd
Arg [4] : 000000000000000000000000ebfcd7f7f424f5a72939aaed18939c90733b6379
Arg [5] : 000000000000000000000000d90a1ba0cbaaaabfdc6c814cdf1611306a26e1f8
Arg [6] : 0000000000000000000000000d4a11d5eeaac28ec3f61d100daf4d40471f1852


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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