ETH Price: $1,609.22 (+1.10%)
Gas: 6 Gwei
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x60806040148710082022-05-30 6:16:14485 days 23 hrs ago1653891374IN
 Create: AccrualBondsV1
0 ETH0.0636757725.99762509

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AccrualBondsV1

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 17 : AccrualBondsV1.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {TransferHelper}             from "@uniswap/lib/contracts/libraries/TransferHelper.sol";
import {FixedPointMathLib}          from "@rari-capital/solmate/src/utils/FixedPointMathLib.sol";

import {Initializable}              from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {AccessControlUpgradeable}   from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {PausableUpgradeable}        from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {IERC20Upgradeable}          from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import {IERC20Permit}               from "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";

import {BondPriceLib}               from "./libraries/BondPriceLib.sol";
import {AccrualBondLib}             from "./libraries/AccrualBondLib.sol";

import {AccrualBondStorageV1}       from "./AccrualBondStorageV1.sol";

interface ICNV {
    function mint(address guy, uint256 wad) external;
    function burn(address guy, uint256 wad) external;
}

contract AccrualBondsV1 is AccrualBondStorageV1, Initializable, AccessControlUpgradeable, PausableUpgradeable {

    /* -------------------------------------------------------------------------- */
    /*                           ACCESS CONTROL ROLES                             */
    /* -------------------------------------------------------------------------- */

    bytes32 public constant TREASURY_ROLE           = DEFAULT_ADMIN_ROLE;
    bytes32 public constant STAKING_ROLE            = bytes32(keccak256("STAKING_ROLE"));
    bytes32 public constant POLICY_ROLE             = bytes32(keccak256("POLICY_ROLE"));

    /* -------------------------------------------------------------------------- */
    /*                                   EVENTS                                   */
    /* -------------------------------------------------------------------------- */

    /// @notice emitted when a bond is sold/purchased
    /// @param bonder account that purchased the bond
    /// @param token token used to purchase the bond 
    /// @param output amount of output tokens obligated to user
    event BondSold(
        address indexed bonder, 
        address indexed token, 
        uint256 input, 
        uint256 output
    );

    /// @notice emitted when a bond is redeemed/claimed
    /// @param bonder account that purchased the bond
    /// @param bondId users bond position identifier 
    /// @param output amount of output tokens obligated to user
    event BondRedeemed(
        address indexed bonder, 
        uint256 indexed bondId, 
        uint256 output
    );

    /// @notice emitted when a user transfers a bond to another account
    /// @param sender the account that is transfering a bond
    /// @param recipient the account that is receiving the bond
    event BondTransfered(
        address indexed sender,
        address indexed recipient,
        uint256 senderBondId,
        uint256 recipientBondId
    );

    /// @notice emitted when policy updates pricing or mints supply
    /// @param caller presumably policy multi-sig
    /// @param supplyDelta the amount of output tokens to mint to this contract
    /// @param positiveDelta whether the supply delta is postive or negative (mint or burn)
    /// @param newVirtualOutputReserves the new value for virtual output reserves
    /// @param tokens the quote assets that will have their pricing info updated
    /// @param virtualInputReserves the new virtualInputReserves for tokens, used in pricing
    /// @param halfLives the new halfLives for tokens, used in pricing
    /// @param levelBips the new levelBips for tokens, used in pricing
    /// @param updateElapsed whether tokens elapsed time should be updated, used in pricing
    event PolicyUpdate(
        address indexed caller, 
        uint256 supplyDelta, 
        bool indexed positiveDelta,
        uint256 newVirtualOutputReserves, 
        address[] tokens, 
        uint256[] virtualInputReserves, 
        uint256[] halfLives, 
        uint256[] levelBips, 
        bool[] updateElapsed
    );

    /// @notice emitted when quote asset is added
    /// @param caller presumably treasury multi-sig
    /// @param token token used to purchase the bond 
    /// @param virtualInputReserves virtual reserves for input token
    /// @param halfLife rate of change for decay/growth mechanism
    /// @param levelBips percentage of current virtual reserves to target 
    event InputAssetAdded(
        address indexed caller, 
        address indexed token, 
        uint256 virtualInputReserves, 
        uint256 halfLife, 
        uint256 levelBips
    );

    /// @notice emitted when quote asset is removed
    /// @param caller presumably policy or treasury multi-sig
    /// @param token token used to purchase the bond 
    event InputAssetRemoved(
        address indexed caller,
        address indexed token
    );

    /// @notice emitted when policy mint allowance is updated
    /// @param caller presumably policy multi-sig
    event PolicyMintAllowanceSet(
        address indexed caller, 
        uint256 mintAllowance
    );

    /// @notice emitted when revenue beneficiary is set
    /// @param caller presumably the treasury multi-sig
    /// @param beneficiary new account that will receive accrued funds
    event BeneficiarySet(
        address indexed caller, 
        address beneficiary
    );

    /// @notice emitted when staking vebases
    /// @param outputTokensEmitted the amount of output tokens emitted this epoch
    event Vebase(
        uint256 outputTokensEmitted
    );

    /* -------------------------------------------------------------------------- */
    /*                               INITIALIZATION                               */
    /* -------------------------------------------------------------------------- */

    /// @notice OZ upgradeable initialization
    function initialize(
        uint256 _term,
        uint256 _virtualOutputReserves,
        address _outputToken,
        address _beneficiary,
        address _treasury,
        address _policy,
        address _staking
    ) external virtual initializer {
        // make sure contract has not been initialized
        require(term == 0, "INITIALIZED");

        // initialize state
        __Context_init();
        __AccessControl_init();
        __Pausable_init();
        __ERC165_init();

        term = _term;
        virtualOutputReserves = _virtualOutputReserves;
        outputToken = _outputToken;
        beneficiary = _beneficiary;

        // setup roles
        _grantRole(DEFAULT_ADMIN_ROLE, _treasury);
        _grantRole(POLICY_ROLE, _policy);
        _grantRole(STAKING_ROLE, _staking);

        // pause contract
        _pause();
    }



    /* -------------------------------------------------------------------------- */
    /*                             PURCHASE BOND LOGIC                            */
    /* -------------------------------------------------------------------------- */

    /// @notice internal logic that handles bond purchases
    /// @param sender the account that purchased the bond
    /// @param recipient the account that will receive the bond
    /// @param token token used to purchase the bond 
    /// @param input the amount of input tokens used to purchase bond
    /// @param minOutput the min amount of output tokens bonder is willig to receive
    function _purchaseBond(
        address sender,
        address recipient,
        address token,
        uint256 input,
        uint256 minOutput
    ) internal whenNotPaused() virtual returns (uint256 output) {

        // F6: CHECKS
        
        // fetch quote price info from storage
        BondPriceLib.QuotePriceInfo storage quote = quoteInfo[token];
        
        // make sure there is pricing info for token
        require(quote.virtualInputReserves != 0,"!LIQUIDITY");
        
        // calculate and store availableDebt so we can ensure
        // we're not incuring more debt than we can pay back
        uint256 availableDebt = IERC20Upgradeable(outputToken).balanceOf(address(this)) - totalDebt;
        
        // calculate 'output' value
        output = BondPriceLib.getAmountOut(
            input,
            availableDebt,
            virtualOutputReserves,
            quote.virtualInputReserves,
            block.timestamp - quote.lastUpdate,
            quote.halfLife,
            quote.levelBips
        );
        
        // if output is less than min output, or greater than available debt revert
        require(output >= minOutput && availableDebt >= output, "!output");

        // F6: EFFECTS

        // transfer principal from sender -> beneficiary
        TransferHelper.safeTransferFrom(token, sender, beneficiary, input);
        
        // unchecked because cnvEmitted and totalDebt cannot
        // be greater than totalSupply, which is checked 
        unchecked { 
            // increase cnvEmitted by amount sold
            cnvEmitted += output;

            // increase totalDebt by amount sold
            totalDebt += output;
        }

        quote.virtualInputReserves += input;
        
        // push position to user storage
        positions[recipient].push(AccrualBondLib.Position(output, 0, block.timestamp));
      
        // T2 - Are events emitted for every storage mutating function?
        emit BondSold(sender, token, input, output);
    }

    /// @notice purchase an accrual bond
    /// @param recipient the account that will receive the bond
    /// @param token token used to purchase the bond 
    /// @param input the amount of input tokens used to purchase bond
    /// @param minOutput the min amount of output tokens bonder is willig to receive
    function purchaseBond(
        address recipient,
        address token,
        uint256 input,
        uint256 minOutput
    ) external virtual returns (uint256 output) {
        
        // purchase bond on behalf of recipient
        return _purchaseBond(msg.sender, recipient, token, input, minOutput);
    }

    /// @notice purchase an accrual bond using EIP-2612 permit
    /// @param recipient the account that will receive the bond
    /// @param token token used to purchase the bond 
    /// @param input the amount of input tokens used to purchase bond
    /// @param minOutput the min amount of output tokens bonder is willig to receive
    /// @param deadline eip-2612
    /// @param v eip-2612
    /// @param r eip-2612     
    /// @param s eip-2612
    function purchaseBondUsingPermit(
        address recipient,
        address token,
        uint256 input,
        uint256 minOutput,
        uint256 deadline, uint8 v, bytes32 r, bytes32 s
    ) external virtual returns (uint256 output) {
        
        // approve tokens for spender - https://eips.ethereum.org/EIPS/eip-2612
        IERC20Permit(token).permit(msg.sender, address(this), input, deadline, v, r, s);

        // purchase bond on behalf of recipient
        return _purchaseBond(msg.sender, recipient, token, input, minOutput);
    }

    /* -------------------------------------------------------------------------- */
    /*                              REDEEM BOND LOGIC                             */
    /* -------------------------------------------------------------------------- */

    /// @notice redeem your bond with output distrobuted linearly
    /// @param recipient the account that will receive the bond
    /// @param bondId users bond position identifier 
    function redeemBond(
        address recipient,
        uint256 bondId
    ) external whenNotPaused() virtual returns (uint256 output) {

        // F6: CHECKS

        // fetch position from storage
        AccrualBondLib.Position storage position = positions[msg.sender][bondId];
        
        // calculate redemption amount
        output = AccrualBondLib.getRedeemAmountOut(position.owed, position.redeemed, position.creation, term);
        
        // skip redemption if output is zero to save gas
        if (output > 0) {

            // F6: EFFECTS
            
            // decrease total debt by redeemed amount
            totalDebt -= output;
            
            // increase user redeemed amount by redeemed amount
            position.redeemed += output;
            
            // send recipient redeemed output tokens
            TransferHelper.safeTransfer(outputToken, recipient, output);
            
            // T2 - Are events emitted for every storage mutating function?
            emit BondRedeemed(msg.sender, bondId, output);
        }

        // revert is output is equal to zero to save gas 
        require(output > 0, "!output");
    }

    /// @notice redeem your bond with output distrobuted linearly
    /// @param recipient the account that will receive the bond
    /// @param bondIds array of users bond position identifiers
    function redeemBondBatch(
        address recipient,
        uint256[] memory bondIds
    ) external whenNotPaused() virtual returns (uint256 totalOutput) {

        // cache array length to save gas
        uint256 length = bondIds.length;

        // redeem users bonds
        for (uint256 i; i < length;) {

            // fetch position from storage
            AccrualBondLib.Position storage position = positions[msg.sender][bondIds[i]];
            
            // calculate redemption amount
            uint256 output = AccrualBondLib.getRedeemAmountOut(position.owed, position.redeemed, position.creation, term);
            
            // increase user redeemed amount by redeemed amount
            position.redeemed += output;

            // increase totalOutput by this bonds output
            totalOutput += output;

            // T2 - Are events emitted for every storage mutating function?
            emit BondRedeemed(msg.sender, bondIds[i], output);

            // increment loop index
            unchecked { i++; }
        }

        // decrease total debt by total redeemed amount
        totalDebt -= totalOutput;
        
        // send recipient total redeemed output
        TransferHelper.safeTransfer(outputToken, recipient, totalOutput);
    }

    /* -------------------------------------------------------------------------- */
    /*                            BOND TRANSFER LOGIC                             */
    /* -------------------------------------------------------------------------- */

    /// @notice transfer a bond from one account to another
    /// @param recipient the account that will receive the bond
    /// @param bondId users bond position identifier 
    function transferBond(
        address recipient,
        uint256 bondId
    ) external whenNotPaused() virtual {

        // cache position info from storage
        AccrualBondLib.Position memory position = positions[msg.sender][bondId];

        // delete position from senders storage
        delete positions[msg.sender][bondId];

        // push position to recipients storage
        positions[recipient].push(position);

        // T2 - Are events emitted for every storage mutating function?
        emit BondTransfered(msg.sender, recipient, bondId, positions[recipient].length);
    }

    /* -------------------------------------------------------------------------- */
    /*                              MANAGEMENT LOGIC                              */
    /* -------------------------------------------------------------------------- */

    /// @notice update pricing + mint supply if policy and there's sufficient mint allowance
    /// @param supplyDelta the amount of output tokens to mint to this contract
    /// @param positiveDelta whether the supply delta is postive or negative (mint or burn)
    /// @param newVirtualOutputReserves the new value for virtual output reserves
    /// @param tokens the quote assets that will have their pricing info updated
    /// @param virtualInputReserves the new virtualInputReserves for tokens, used in pricing
    /// @param halfLives the new halfLives for tokens, used in pricing
    /// @param levelBips the new levelBips for tokens, used in pricing
    /// @param updateElapsed whether tokens elapsed time should be updated, used in pricing
    function policyUpdate(
        uint256 supplyDelta,
        bool positiveDelta,
        uint256 newVirtualOutputReserves,
        address[] memory tokens,
        uint256[] memory virtualInputReserves,
        uint256[] memory halfLives,
        uint256[] memory levelBips,
        bool[] memory updateElapsed
    ) external virtual onlyRole(POLICY_ROLE) {

        // CHECK THAT WE SUFFICE STAKING.minPrice()

        // if supplyDelta is greater than zero, mint supply
        if (supplyDelta > 0) {

            if (positiveDelta) {
                // F6: CHECKS 

                // decrease policy allowance by mint amount
                // reverts if supplyDelta is greater
                policyMintAllowance -= supplyDelta;

                // F6: EFFECTS

                // mint output tokens to this contract
                ICNV(outputToken).mint(address(this), supplyDelta);
            } else {
                // F6: CHECKS 

                // check that policy is not burning more than available debt
                require(
                    IERC20Upgradeable(outputToken).balanceOf(address(this)) - totalDebt >= supplyDelta, 
                    "!supplyDelta"
                );

                // increase policy allowance by mint amount
                // reverts if supplyDelta is greater
                policyMintAllowance += supplyDelta;

                // F6: EFFECTS

                // mint output tokens to this contract
                ICNV(outputToken).burn(address(this), supplyDelta);
            }
        }

        // if newVirtualOutputReserves is greater than zero update virtual output reserves
        if (newVirtualOutputReserves > 0) virtualOutputReserves = newVirtualOutputReserves;

        // store array length in memory to save gas
        uint256 length = tokens.length;

        // if tokens length is greater than zero batch update quote pricing
        if (length > 0) {

            // make sure all param lengths match
            require(
                length == virtualInputReserves.length &&
                length == halfLives.length       &&
                length == levelBips.length,
                "!LENGTH"
            );

            for (uint256 i; i < length; ) {

                // make sure halfLives are greater than zero
                require(halfLives[i] > 0, "!halfLife");

                // update quote pricing info for each index
                quoteInfo[tokens[i]] = BondPriceLib.QuotePriceInfo(
                    virtualInputReserves[i],
                    updateElapsed[i] ? block.timestamp : quoteInfo[tokens[i]].lastUpdate,
                    halfLives[i],
                    levelBips[i]
                );

                // increment i using unchecked statement to save gas, cannot reasonably overflow
                unchecked { ++i; }
            }
        }

        // T2 - Are events emitted for every storage mutating function?
        emit PolicyUpdate(
            msg.sender, 
            supplyDelta,
            positiveDelta, 
            newVirtualOutputReserves, 
            tokens, 
            virtualInputReserves, 
            halfLives, 
            levelBips, 
            updateElapsed
        );
    }

    /// @notice add quote asset and update quote pricing info
    /// @param token token used to purchase the bond
    /// @param virtualInputReserves virtual reserves for input token
    /// @param halfLife rate of change for decay/growth mechanism
    /// @param levelBips percentage of current virtual reserves to target 
    function addQuoteAsset(
        address token,
        uint256 virtualInputReserves,
        uint256 halfLife,
        uint256 levelBips
    ) external virtual onlyRole(TREASURY_ROLE) {

        // make sure pricing info for this asset does not already exist
        require(quoteInfo[token].lastUpdate == 0, "!EXISTENT");

        // increment totalAssets to account for newly added input token
        unchecked { ++totalAssets; }

        // update pricing info for added asset
        quoteInfo[token] = BondPriceLib.QuotePriceInfo(
            virtualInputReserves,
            block.timestamp,
            halfLife,
            levelBips
        );

        // T2 - Are events emitted for every storage mutating function?
        emit InputAssetAdded(msg.sender, token, virtualInputReserves, halfLife, levelBips);
    }

    /// @notice remove a quote asset
    /// @param token token used to purchase the bond
    function removeQuoteAsset(
        address token
    ) external virtual {

        // make sure caller has either policy role or treasury role
        require(hasRole(POLICY_ROLE, msg.sender) || hasRole(TREASURY_ROLE, msg.sender));

        // fetch quote pricing info from storage
        BondPriceLib.QuotePriceInfo memory quote = quoteInfo[token];

        // make sure quote pricing info doesn't already exist for this token
        require(quote.lastUpdate != 0, "!NONEXISTENT");

        // decrement total assets to account for removed asset
        --totalAssets;

        // delete quote pricing info for removed token 
        delete quoteInfo[token];

        // T2 - Are events emitted for every storage mutating function?
        emit InputAssetRemoved(msg.sender, token);
    }

    /// @notice update policy output token mint allowance if treasury
    /// @param mintAllowance the amount policy is allowed to mint until next update
    function setPolicyMintAllowance(
        uint256 mintAllowance
    ) external virtual onlyRole(TREASURY_ROLE) {

        // update policy mint allowance
        policyMintAllowance = mintAllowance;

        // T2 - Are events emitted for every storage mutating function?
        emit PolicyMintAllowanceSet(msg.sender, mintAllowance);
    }

    /// @notice update the beneficiary address if treasury
    /// @param accrualTo account that receives accrued revenue
    function setBeneficiary(
        address accrualTo
    ) external virtual onlyRole(TREASURY_ROLE) {
        
        // update beneficiary account
        beneficiary = accrualTo;
        
        // T2 - Are events emitted for every storage mutating function?
        emit BeneficiarySet(msg.sender, accrualTo);
    }

    /// @notice pause contract interactions if policy or treasury
    function pause() external virtual {
        
        // make sure caller has either policy role or treasury role
        require(hasRole(POLICY_ROLE, msg.sender) || hasRole(TREASURY_ROLE, msg.sender));
        
        _pause();
    }

    /// @notice unpause contract interactions if policy or treasury
    function unpause() external virtual {

        // make sure caller has either policy role or treasury role
        require(hasRole(POLICY_ROLE, msg.sender) || hasRole(TREASURY_ROLE, msg.sender));
        
        _unpause();
    }

    /* -------------------------------------------------------------------------- */
    /*                                VEBASE LOGIC                                */
    /* -------------------------------------------------------------------------- */

    function vebase() external virtual onlyRole(STAKING_ROLE) returns (bool) {

        // T2 - Are events emitted for every storage mutating function?
        emit Vebase(cnvEmitted);

        // reset/delete cnvEmitted
        delete cnvEmitted;

        // return true
        return true;
    }

    /* -------------------------------------------------------------------------- */
    /*                             PRICE HELPER LOGIC                             */
    /* -------------------------------------------------------------------------- */

    function getVirtualInputReserves(
        address token
    ) external virtual view returns (uint256) {
        // fetch quote pricing info from storage
        BondPriceLib.QuotePriceInfo memory quote = quoteInfo[token];

        // decay virtual reserves
        return BondPriceLib.expToLevel(
            quote.virtualInputReserves, 
            block.timestamp - quote.lastUpdate, 
            quote.halfLife, 
            quote.levelBips
        );
    }

    function getUserPositionCount(
        address account
    ) external virtual view returns (uint256) {
        return positions[account].length;
    }

    function getAvailableSupply() external virtual view returns (uint256) {
        return IERC20Upgradeable(outputToken).balanceOf(address(this)) - totalDebt;
    }

    function getSpotPrice(
        address token
    ) external virtual view returns (uint256) {

        // fetch quote pricing info from storage
        BondPriceLib.QuotePriceInfo memory quote = quoteInfo[token];

        // decay virtual reserves
        uint256 virtualInputReserves = BondPriceLib.expToLevel(
            quote.virtualInputReserves, 
            block.timestamp - quote.lastUpdate, 
            quote.halfLife, 
            quote.levelBips
        );

        // 1 * virtual input token reserves / (availableDebt + virtual output token reserves)
        return FixedPointMathLib.fmul(
            1e18,
            virtualInputReserves,
            IERC20Upgradeable(outputToken).balanceOf(address(this)) - totalDebt + virtualOutputReserves
        );
    }

    function getAmountOut(
        address token,
        uint256 input
    ) external virtual view returns (uint256 output) {

        // fetch quote pricing info from storage
        BondPriceLib.QuotePriceInfo memory quote = quoteInfo[token];

        // calculate available debt, the max amount of output tokens we can distrobute
        uint256 availableDebt = IERC20Upgradeable(outputToken).balanceOf(address(this)) - totalDebt;

        // calculate amount out
        output = BondPriceLib.getAmountOut(
            input,
            availableDebt,
            virtualOutputReserves,
            quote.virtualInputReserves,
            block.timestamp - quote.lastUpdate,
            quote.halfLife,
            quote.levelBips
        );
    }
}

File 2 of 17 : TransferHelper.sol
pragma solidity >=0.6.0;

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

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

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

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

File 3 of 17 : FixedPointMathLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Arithmetic library with operations for fixed-point numbers.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)
library FixedPointMathLib {
    /*///////////////////////////////////////////////////////////////
                            COMMON BASE UNITS
    //////////////////////////////////////////////////////////////*/

    uint256 internal constant YAD = 1e8;
    uint256 internal constant WAD = 1e18;
    uint256 internal constant RAY = 1e27;
    uint256 internal constant RAD = 1e45;

    /*///////////////////////////////////////////////////////////////
                         FIXED POINT OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function fmul(
        uint256 x,
        uint256 y,
        uint256 baseUnit
    ) internal pure returns (uint256 z) {
        assembly {
            // Store x * y in z for now.
            z := mul(x, y)

            // Equivalent to require(x == 0 || (x * y) / x == y)
            if iszero(or(iszero(x), eq(div(z, x), y))) {
                revert(0, 0)
            }

            // If baseUnit is zero this will return zero instead of reverting.
            z := div(z, baseUnit)
        }
    }

    function fdiv(
        uint256 x,
        uint256 y,
        uint256 baseUnit
    ) internal pure returns (uint256 z) {
        assembly {
            // Store x * baseUnit in z for now.
            z := mul(x, baseUnit)

            // Equivalent to require(y != 0 && (x == 0 || (x * baseUnit) / x == baseUnit))
            if iszero(and(iszero(iszero(y)), or(iszero(x), eq(div(z, x), baseUnit)))) {
                revert(0, 0)
            }

            // We ensure y is not zero above, so there is never division by zero here.
            z := div(z, y)
        }
    }

    function fpow(
        uint256 x,
        uint256 n,
        uint256 baseUnit
    ) internal pure returns (uint256 z) {
        assembly {
            switch x
            case 0 {
                switch n
                case 0 {
                    // 0 ** 0 = 1
                    z := baseUnit
                }
                default {
                    // 0 ** n = 0
                    z := 0
                }
            }
            default {
                switch mod(n, 2)
                case 0 {
                    // If n is even, store baseUnit in z for now.
                    z := baseUnit
                }
                default {
                    // If n is odd, store x in z for now.
                    z := x
                }

                // Shifting right by 1 is like dividing by 2.
                let half := shr(1, baseUnit)

                for {
                    // Shift n right by 1 before looping to halve it.
                    n := shr(1, n)
                } n {
                    // Shift n right by 1 each iteration to halve it.
                    n := shr(1, n)
                } {
                    // Revert immediately if x ** 2 would overflow.
                    // Equivalent to iszero(eq(div(xx, x), x)) here.
                    if shr(128, x) {
                        revert(0, 0)
                    }

                    // Store x squared.
                    let xx := mul(x, x)

                    // Round to the nearest number.
                    let xxRound := add(xx, half)

                    // Revert if xx + half overflowed.
                    if lt(xxRound, xx) {
                        revert(0, 0)
                    }

                    // Set x to scaled xxRound.
                    x := div(xxRound, baseUnit)

                    // If n is even:
                    if mod(n, 2) {
                        // Compute z * x.
                        let zx := mul(z, x)

                        // If z * x overflowed:
                        if iszero(eq(div(zx, x), z)) {
                            // Revert if x is non-zero.
                            if iszero(iszero(x)) {
                                revert(0, 0)
                            }
                        }

                        // Round to the nearest number.
                        let zxRound := add(zx, half)

                        // Revert if zx + half overflowed.
                        if lt(zxRound, zx) {
                            revert(0, 0)
                        }

                        // Return properly scaled zxRound.
                        z := div(zxRound, baseUnit)
                    }
                }
            }
        }
    }

    /*///////////////////////////////////////////////////////////////
                        GENERAL NUMBER UTILITIES
    //////////////////////////////////////////////////////////////*/

    function sqrt(uint256 x) internal pure returns (uint256 z) {
        assembly {
            // Start off with z at 1.
            z := 1

            // Used below to help find a nearby power of 2.
            let y := x

            // Find the lowest power of 2 that is at least sqrt(x).
            if iszero(lt(y, 0x100000000000000000000000000000000)) {
                y := shr(128, y) // Like dividing by 2 ** 128.
                z := shl(64, z)
            }
            if iszero(lt(y, 0x10000000000000000)) {
                y := shr(64, y) // Like dividing by 2 ** 64.
                z := shl(32, z)
            }
            if iszero(lt(y, 0x100000000)) {
                y := shr(32, y) // Like dividing by 2 ** 32.
                z := shl(16, z)
            }
            if iszero(lt(y, 0x10000)) {
                y := shr(16, y) // Like dividing by 2 ** 16.
                z := shl(8, z)
            }
            if iszero(lt(y, 0x100)) {
                y := shr(8, y) // Like dividing by 2 ** 8.
                z := shl(4, z)
            }
            if iszero(lt(y, 0x10)) {
                y := shr(4, y) // Like dividing by 2 ** 4.
                z := shl(2, z)
            }
            if iszero(lt(y, 0x8)) {
                // Equivalent to 2 ** z.
                z := shl(1, z)
            }

            // Shifting right by 1 is like dividing by 2.
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))

            // Compute a rounded down version of z.
            let zRoundDown := div(x, z)

            // If zRoundDown is smaller, use it.
            if lt(zRoundDown, z) {
                z := zRoundDown
            }
        }
    }
}

File 4 of 17 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 5 of 17 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 6 of 17 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 7 of 17 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        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 8 of 17 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 9 of 17 : BondPriceLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import "@rari-capital/solmate/src/utils/FixedPointMathLib.sol";

library BondPriceLib {

    using FixedPointMathLib for uint256;

    struct QuotePriceInfo {
        uint256 virtualInputReserves; 
        uint256 lastUpdate;
        uint256 halfLife;
        uint256 levelBips;
    }

    /// @notice Calculates an output for a given bond purchase.
    /// @param input amount of input tokens provided
    /// @param outputReserves physical output reserves (IE CNV)
    /// @param virtualOutputReserves virtual output reserves (IE CNV)
    /// @param virtualInputReserves virtual input reserves (IE DAI)
    /// @param elapsed time since last policy update
    /// @param halfLife rate of change for virtual input reserves 
    /// @param levelBips percentage to growth/decay virtual input reserves to in bips
    function getAmountOut(
        uint256 input,
        uint256 outputReserves,
        uint256 virtualOutputReserves,
        uint256 virtualInputReserves,
        uint256 elapsed,
        uint256 halfLife,
        uint256 levelBips
    ) internal pure returns (uint256 output) {

        // Calculate an output (IE in CNV) given a purchase size of 'input' using 
        // the CPMM formula, while applying an exponential function that grows or decays 
        // virtual input reserves to a specific level. 
        output = input.fmul(
            outputReserves + virtualOutputReserves, 
            expToLevel(virtualInputReserves, elapsed, halfLife, levelBips) + input
        );
    }

    function expToLevel(
        uint256 x, 
        uint256 elapsed, 
        uint256 halfLife,
        uint256 levelBips
    ) internal pure returns (uint256 z) {

        // Shift z right by whole epochs elapsed
        z = x >> (elapsed / halfLife);

        z -= z.fmul(elapsed % halfLife, halfLife) >> 1;
        
        z += FixedPointMathLib.fmul(x - z, levelBips, 1e4);
    }
}

File 10 of 17 : AccrualBondLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import "@rari-capital/solmate/src/utils/FixedPointMathLib.sol";

library AccrualBondLib {

    struct Position {
        uint256 owed;
        uint256 redeemed;
        uint256 creation;
    }

    function getRedeemAmountOut(
        uint256 owed,
        uint256 redeemed,
        uint256 creation,
        uint256 term
    ) internal view returns (uint256) {
        
        uint256 elapsed = block.timestamp - creation;

        if (elapsed > term) elapsed = term;

        return FixedPointMathLib.fmul(owed, elapsed, term) - redeemed;
    }
}

File 11 of 17 : AccrualBondStorageV1.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import "./libraries/BondPriceLib.sol";
import "./libraries/AccrualBondLib.sol";

contract AccrualBondStorageV1 {
    
    /// @notice address that receives revenue
    address public beneficiary;
    
    /// @notice bond payout token
    address public outputToken;

    /// @notice total amount currently outstanding to bonders
    uint256 public totalDebt;
    
    /// @notice virtual output token reserves used in pricing
    uint256 public virtualOutputReserves;
    
    /// @notice total amount of assets currently exchangeable for bonds
    uint256 public totalAssets;
    
    /// @notice length after bond purchase when bond is fully redeemable
    uint256 public term;
    
    /// @notice tracks how many output tokens have been emitted since the last veBase
    uint256 public cnvEmitted;
    
    /// @notice tracks the amount that policy it allowed to mint
    uint256 public policyMintAllowance;

    /// @notice mapping containing pricing info for exchangeable assets
    mapping(address => BondPriceLib.QuotePriceInfo) public quoteInfo;
    
    /// @notice mapping containing posistions for individual users
    mapping(address => AccrualBondLib.Position[]) public positions;
}

File 12 of 17 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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

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

File 13 of 17 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 14 of 17 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 15 of 17 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 16 of 17 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 17 of 17 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"beneficiary","type":"address"}],"name":"BeneficiarySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bonder","type":"address"},{"indexed":true,"internalType":"uint256","name":"bondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"output","type":"uint256"}],"name":"BondRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bonder","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"input","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"output","type":"uint256"}],"name":"BondSold","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"senderBondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"recipientBondId","type":"uint256"}],"name":"BondTransfered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"virtualInputReserves","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"halfLife","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"levelBips","type":"uint256"}],"name":"InputAssetAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"InputAssetRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAllowance","type":"uint256"}],"name":"PolicyMintAllowanceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"supplyDelta","type":"uint256"},{"indexed":true,"internalType":"bool","name":"positiveDelta","type":"bool"},{"indexed":false,"internalType":"uint256","name":"newVirtualOutputReserves","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"virtualInputReserves","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"halfLives","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"levelBips","type":"uint256[]"},{"indexed":false,"internalType":"bool[]","name":"updateElapsed","type":"bool[]"}],"name":"PolicyUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"outputTokensEmitted","type":"uint256"}],"name":"Vebase","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POLICY_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREASURY_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"virtualInputReserves","type":"uint256"},{"internalType":"uint256","name":"halfLife","type":"uint256"},{"internalType":"uint256","name":"levelBips","type":"uint256"}],"name":"addQuoteAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"beneficiary","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cnvEmitted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"input","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"output","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAvailableSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getSpotPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getUserPositionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getVirtualInputReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_term","type":"uint256"},{"internalType":"uint256","name":"_virtualOutputReserves","type":"uint256"},{"internalType":"address","name":"_outputToken","type":"address"},{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_policy","type":"address"},{"internalType":"address","name":"_staking","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"outputToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"policyMintAllowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"supplyDelta","type":"uint256"},{"internalType":"bool","name":"positiveDelta","type":"bool"},{"internalType":"uint256","name":"newVirtualOutputReserves","type":"uint256"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"virtualInputReserves","type":"uint256[]"},{"internalType":"uint256[]","name":"halfLives","type":"uint256[]"},{"internalType":"uint256[]","name":"levelBips","type":"uint256[]"},{"internalType":"bool[]","name":"updateElapsed","type":"bool[]"}],"name":"policyUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"positions","outputs":[{"internalType":"uint256","name":"owed","type":"uint256"},{"internalType":"uint256","name":"redeemed","type":"uint256"},{"internalType":"uint256","name":"creation","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"minOutput","type":"uint256"}],"name":"purchaseBond","outputs":[{"internalType":"uint256","name":"output","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"minOutput","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"purchaseBondUsingPermit","outputs":[{"internalType":"uint256","name":"output","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"quoteInfo","outputs":[{"internalType":"uint256","name":"virtualInputReserves","type":"uint256"},{"internalType":"uint256","name":"lastUpdate","type":"uint256"},{"internalType":"uint256","name":"halfLife","type":"uint256"},{"internalType":"uint256","name":"levelBips","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"bondId","type":"uint256"}],"name":"redeemBond","outputs":[{"internalType":"uint256","name":"output","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"bondIds","type":"uint256[]"}],"name":"redeemBondBatch","outputs":[{"internalType":"uint256","name":"totalOutput","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"removeQuoteAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"accrualTo","type":"address"}],"name":"setBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintAllowance","type":"uint256"}],"name":"setPolicyMintAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"term","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"bondId","type":"uint256"}],"name":"transferBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vebase","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"virtualOutputReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50612b57806100206000396000f3fe608060405234801561001057600080fd5b50600436106102485760003560e01c8063973cb3781161013b578063c1d8d1d9116100b8578063d72ef1c01161007c578063d72ef1c014610542578063dd5b23df14610555578063ddbfd94114610568578063f0c483241461057b578063fc7b9c181461058457600080fd5b8063c1d8d1d914610501578063ca706bcf14610514578063d11a57ec1461048a578063d52c899814610527578063d547741f1461052f57600080fd5b8063b2779a8d116100ff578063b2779a8d14610492578063bc8aee41146104a5578063bfa35f4d146104b8578063c167d1cd146104cb578063c1be6677146104d357600080fd5b8063973cb37814610452578063994396de146104655780639d98771e14610478578063a10ffbed14610481578063a217fddf1461048a57600080fd5b806331e8a7ef116101c95780635cd9e0191161018d5780635cd9e019146103ea5780638456cb59146103fd5780638b363c2d14610405578063910528161461041857806391d148541461043f57600080fd5b806331e8a7ef1461037057806336568abe1461039957806338af3eed146103ac5780633f4ba83a146103d75780635c975abb146103df57600080fd5b80631c31f710116102105780631c31f71014610309578063225729ed1461031c5780632298524614610325578063248a9ca31461033a5780632f2ff15d1461035d57600080fd5b806301e1d1141461024d57806301ffc9a714610269578063040f87cd1461028c5780631268a28f146102a1578063166afeb3146102b4575b600080fd5b61025660045481565b6040519081526020015b60405180910390f35b61027c61027736600461223a565b61058d565b6040519015158152602001610260565b61029f61029a366004612438565b6105c4565b005b61029f6102af36600461252e565b610a0b565b6102e96102c23660046125a6565b60086020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610260565b61029f6103173660046125a6565b610bb7565b61025660065481565b610256600080516020612b0283398151915281565b6102566103483660046125c1565b6000908152606f602052604090206001015490565b61029f61036b3660046125da565b610c1b565b61025661037e3660046125a6565b6001600160a01b031660009081526009602052604090205490565b61029f6103a73660046125da565b610c46565b6000546103bf906001600160a01b031681565b6040516001600160a01b039091168152602001610260565b61029f610cc4565b60a15460ff1661027c565b6102566103f83660046125a6565b610d00565b61029f610e14565b610256610413366004612606565b610e4e565b6102567ff18246d2e788c2a885ec6aeee43fc7c89077b8b7a1e52e99f27f5889e429e2f581565b61027c61044d3660046125da565b610eef565b610256610460366004612682565b610f1a565b6102566104733660046126c4565b610f32565b61025660035481565b61025660055481565b610256600081565b61029f6104a03660046126ee565b611072565b61029f6104b33660046125c1565b61117f565b6102566104c63660046125a6565b6111c2565b610256611232565b6104e66104e13660046126c4565b6112b2565b60408051938452602084019290925290820152606001610260565b6001546103bf906001600160a01b031681565b6102566105223660046126c4565b6112f4565b61027c6113e1565b61029f61053d3660046125da565b611455565b610256610550366004612727565b61147b565b61029f6105633660046126c4565b6115d8565b61029f6105763660046125a6565b611721565b61025660075481565b61025660025481565b60006001600160e01b03198216637965db0b60e01b14806105be57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080516020612b028339815191526105dd8133611843565b88156107a15787156106695788600760008282546105fb919061278b565b90915550506001546040516340c10f1960e01b8152306004820152602481018b90526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561064c57600080fd5b505af1158015610660573d6000803e3d6000fd5b505050506107a1565b6002546001546040516370a0823160e01b81523060048201528b92916001600160a01b0316906370a0823190602401602060405180830381865afa1580156106b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d991906127a2565b6106e3919061278b565b10156107255760405162461bcd60e51b815260206004820152600c60248201526b21737570706c7944656c746160a01b60448201526064015b60405180910390fd5b886007600082825461073791906127bb565b9091555050600154604051632770a7eb60e21b8152306004820152602481018b90526001600160a01b0390911690639dc29fac90604401600060405180830381600087803b15801561078857600080fd5b505af115801561079c573d6000803e3d6000fd5b505050505b86156107ad5760038790555b855180156109af578551811480156107c55750845181145b80156107d15750835181145b6108075760405162461bcd60e51b8152602060048201526007602482015266042988a9c8ea8960cb1b604482015260640161071c565b60005b818110156109ad576000868281518110610826576108266127d3565b6020026020010151116108675760405162461bcd60e51b81526020600482015260096024820152682168616c664c69666560b81b604482015260640161071c565b6040518060800160405280888381518110610884576108846127d3565b602002602001015181526020018583815181106108a3576108a36127d3565b60200260200101516108f657600860008b85815181106108c5576108c56127d3565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600101546108f8565b425b815260200187838151811061090f5761090f6127d3565b6020026020010151815260200186838151811061092e5761092e6127d3565b6020026020010151815250600860008a848151811061094f5761094f6127d3565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015590505080600101905061080a565b505b881515336001600160a01b03167f6d16e4456b1d323c5ff472fc6e66b323726bf18d96f033753e2004092a054a0a8c8b8b8b8b8b8b6040516109f79796959493929190612856565b60405180910390a350505050505050505050565b600a54610100900460ff16610a2657600a5460ff1615610a2a565b303b155b610a8d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161071c565b600a54610100900460ff16158015610aaf57600a805461ffff19166101011790555b60055415610aed5760405162461bcd60e51b815260206004820152600b60248201526a125392551250531256915160aa1b604482015260640161071c565b610af56118a7565b610afd6118a7565b610b056118ce565b610b0d6118a7565b60058890556003879055600180546001600160a01b038089166001600160a01b0319928316179092556000805492881692909116919091178155610b5190856118fd565b610b69600080516020612b02833981519152846118fd565b610b937ff18246d2e788c2a885ec6aeee43fc7c89077b8b7a1e52e99f27f5889e429e2f5836118fd565b610b9b611983565b8015610bad57600a805461ff00191690555b5050505050505050565b6000610bc38133611843565b600080546001600160a01b0319166001600160a01b03841690811790915560405190815233907f2906d223dc4163733bb374af8641c7e9ae256e2bae53c90e0c9a2be2e611ae44906020015b60405180910390a25050565b6000828152606f6020526040902060010154610c378133611843565b610c4183836118fd565b505050565b6001600160a01b0381163314610cb65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161071c565b610cc082826119f8565b5050565b610cdc600080516020612b0283398151915233610eef565b80610ced5750610ced600033610eef565b610cf657600080fd5b610cfe611a5f565b565b6001600160a01b03811660009081526008602090815260408083208151608081018352815480825260018301549482018590526002830154938201939093526003909101546060820152918391610d6a91610d5b904261278b565b84604001518560600151611ad9565b6003546002546001546040516370a0823160e01b8152306004820152939450610e0c93670de0b6b3a7640000938693909290916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df391906127a2565b610dfd919061278b565b610e0791906127bb565b611b2e565b949350505050565b610e2c600080516020612b0283398151915233610eef565b80610e3d5750610e3d600033610eef565b610e4657600080fd5b610cfe611983565b60405163d505accf60e01b8152336004820152306024820152604481018790526064810185905260ff8416608482015260a4810183905260c481018290526000906001600160a01b0389169063d505accf9060e401600060405180830381600087803b158015610ebd57600080fd5b505af1158015610ed1573d6000803e3d6000fd5b50505050610ee2338a8a8a8a611b49565b9998505050505050505050565b6000918252606f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610f293386868686611b49565b95945050505050565b6000610f4060a15460ff1690565b15610f5d5760405162461bcd60e51b815260040161071c90612907565b336000908152600960205260408120805484908110610f7e57610f7e6127d3565b90600052602060002090600302019050610fa8816000015482600101548360020154600554611dac565b91508115611031578160026000828254610fc2919061278b565b9250508190555081816001016000828254610fdd91906127bb565b9091555050600154610ff9906001600160a01b03168584611de6565b604051828152839033907f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b19060200160405180910390a35b6000821161106b5760405162461bcd60e51b8152602060048201526007602482015266085bdd5d1c1d5d60ca1b604482015260640161071c565b5092915050565b600061107e8133611843565b6001600160a01b038516600090815260086020526040902060010154156110d35760405162461bcd60e51b81526020600482015260096024820152680851561254d511539560ba1b604482015260640161071c565b6004805460019081019091556040805160808101825286815242602080830191825282840188815260608085018981526001600160a01b038d16600081815260088652889020965187559451978601979097559051600285015594516003909301929092558251888152918201879052918101859052909133917fb77ca2e0349708985dbcf613b1e704209d8f1ba8a2711021b807126b8b0b98b1910160405180910390a35050505050565b600061118b8133611843565b600782905560405182815233907febdc064ea11a59f10ae4f519348e9c6a62eff3619f43504fadd768ac9b2b02a090602001610c0f565b6001600160a01b038116600090815260086020908152604080832081516080810183528154808252600183015494820185905260028301549382019390935260039091015460608201529161122b919061121c904261278b565b83604001518460600151611ad9565b9392505050565b6002546001546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa15801561127f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a391906127a2565b6112ad919061278b565b905090565b600960205281600052604060002081815481106112ce57600080fd5b600091825260209091206003909102018054600182015460029092015490935090915083565b6001600160a01b038281166000908152600860209081526040808320815160808101835281548152600180830154948201949094526002808301548285015260039092015460608201529054925491516370a0823160e01b815230600482015293949093859392909116906370a0823190602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906127a2565b6113b3919061278b565b9050610f29848260035485600001518660200151426113d2919061278b565b87604001518860600151611f01565b60007ff18246d2e788c2a885ec6aeee43fc7c89077b8b7a1e52e99f27f5889e429e2f561140e8133611843565b7f81a5044df5842f3c82a74884003121d56a6a8947e00541b9b625385c9b2190e460065460405161144191815260200190565b60405180910390a150506000600655600190565b6000828152606f60205260409020600101546114718133611843565b610c4183836119f8565b600061148960a15460ff1690565b156114a65760405162461bcd60e51b815260040161071c90612907565b815160005b818110156115a95733600090815260096020526040812085518690849081106114d6576114d66127d3565b6020026020010151815481106114ee576114ee6127d3565b90600052602060002090600302019050600061151a826000015483600101548460020154600554611dac565b90508082600101600082825461153091906127bb565b90915550611540905081866127bb565b9450858381518110611554576115546127d3565b6020026020010151336001600160a01b03167f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b18360405161159791815260200190565b60405180910390a350506001016114ab565b5081600260008282546115bc919061278b565b909155505060015461106b906001600160a01b03168584611de6565b60a15460ff16156115fb5760405162461bcd60e51b815260040161071c90612907565b33600090815260096020526040812080548390811061161c5761161c6127d3565b6000918252602080832060408051606081018252600390940290910180548452600181015484840152600201548382015233845260099091529091208054919250908390811061166e5761166e6127d3565b60009182526020808320600392830201838155600180820185905560029182018590556001600160a01b038816808652600984526040808720805480850182558189528689208a519190980290970196875594880151928601929092558682015194909201939093559283905254905133917f3d7a7edfc7b138c151d31aecb9c6eb8ff81df3cabad50f3d6dddae4ccc0710439161171491878252602082015260400190565b60405180910390a3505050565b611739600080516020612b0283398151915233610eef565b8061174a575061174a600033610eef565b61175357600080fd5b6001600160a01b03811660009081526008602090815260409182902082516080810184528154815260018201549281018390526002820154938101939093526003015460608301526117d65760405162461bcd60e51b815260206004820152600c60248201526b085393d391561254d511539560a21b604482015260640161071c565b6004600081546117e590612931565b909155506001600160a01b03821660008181526008602052604080822082815560018101839055600281018390556003018290555133917f9b0b658574799baf31f8c52b9140477861460c951e7bffc6e56b270bb8af420991a35050565b61184d8282610eef565b610cc057611865816001600160a01b03166014611f3b565b611870836020611f3b565b604051602001611881929190612978565b60408051601f198184030181529082905262461bcd60e51b825261071c916004016129ed565b600a54610100900460ff16610cfe5760405162461bcd60e51b815260040161071c90612a20565b600a54610100900460ff166118f55760405162461bcd60e51b815260040161071c90612a20565b610cfe6120d7565b6119078282610eef565b610cc0576000828152606f602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561193f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60a15460ff16156119a65760405162461bcd60e51b815260040161071c90612907565b60a1805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119db3390565b6040516001600160a01b03909116815260200160405180910390a1565b611a028282610eef565b15610cc0576000828152606f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60a15460ff16611aa85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161071c565b60a1805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336119db565b6000611ae58385612a81565b85901c90506001611b01611af98587612a95565b839086611b2e565b611b0c911c8261278b565b9050611b24611b1b828761278b565b83612710611b2e565b610f2990826127bb565b8282028315848204841417611b4257600080fd5b0492915050565b6000611b5760a15460ff1690565b15611b745760405162461bcd60e51b815260040161071c90612907565b6001600160a01b03841660009081526008602052604090208054611bc75760405162461bcd60e51b815260206004820152600a602482015269214c495155494449545960b01b604482015260640161071c565b6002546001546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa158015611c14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3891906127a2565b611c42919061278b565b9050611c7085826003548560000154866001015442611c61919061278b565b87600201548860030154611f01565b9250838310158015611c825750828110155b611cb85760405162461bcd60e51b8152602060048201526007602482015266085bdd5d1c1d5d60ca1b604482015260640161071c565b600054611cd29087908a906001600160a01b03168861210a565b60068054840190556002805484019055815485908390600090611cf69084906127bb565b90915550506001600160a01b03808816600090815260096020908152604080832081516060810183528881528084018581524282850190815283546001818101865594885295909620915160039095029091019384555190830155915160029091015551878216918a16907f8e5101242b74cdfce3a74e64844cf2cc76186195bf6d8cfe04c7f519f64dfbb390611d999089908890918252602082015260400190565b60405180910390a3505095945050505050565b600080611db9844261278b565b905082811115611dc65750815b84611dd2878386611b2e565b611ddc919061278b565b9695505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611e429190612aa9565b6000604051808303816000865af19150503d8060008114611e7f576040519150601f19603f3d011682016040523d82523d6000602084013e611e84565b606091505b5091509150818015611eae575080511580611eae575080806020019051810190611eae9190612ac5565b611efa5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015260640161071c565b5050505050565b6000611f2f611f1087896127bb565b89611f1d88888888611ad9565b611f2791906127bb565b8a9190611b2e565b98975050505050505050565b60606000611f4a836002612ae2565b611f559060026127bb565b67ffffffffffffffff811115611f6d57611f6d612285565b6040519080825280601f01601f191660200182016040528015611f97576020820181803683370190505b509050600360fc1b81600081518110611fb257611fb26127d3565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611fe157611fe16127d3565b60200101906001600160f81b031916908160001a9053506000612005846002612ae2565b6120109060016127bb565b90505b6001811115612088576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612044576120446127d3565b1a60f81b82828151811061205a5761205a6127d3565b60200101906001600160f81b031916908160001a90535060049490941c9361208181612931565b9050612013565b50831561122b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161071c565b600a54610100900460ff166120fe5760405162461bcd60e51b815260040161071c90612a20565b60a1805460ff19169055565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161216e9190612aa9565b6000604051808303816000865af19150503d80600081146121ab576040519150601f19603f3d011682016040523d82523d6000602084013e6121b0565b606091505b50915091508180156121da5750805115806121da5750808060200190518101906121da9190612ac5565b6122325760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b606482015260840161071c565b505050505050565b60006020828403121561224c57600080fd5b81356001600160e01b03198116811461122b57600080fd5b801515811461227257600080fd5b50565b803561228081612264565b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156122c4576122c4612285565b604052919050565b600067ffffffffffffffff8211156122e6576122e6612285565b5060051b60200190565b80356001600160a01b038116811461228057600080fd5b600082601f83011261231857600080fd5b8135602061232d612328836122cc565b61229b565b82815260059290921b8401810191818101908684111561234c57600080fd5b8286015b8481101561236e57612361816122f0565b8352918301918301612350565b509695505050505050565b600082601f83011261238a57600080fd5b8135602061239a612328836122cc565b82815260059290921b840181019181810190868411156123b957600080fd5b8286015b8481101561236e57803583529183019183016123bd565b600082601f8301126123e557600080fd5b813560206123f5612328836122cc565b82815260059290921b8401810191818101908684111561241457600080fd5b8286015b8481101561236e57803561242b81612264565b8352918301918301612418565b600080600080600080600080610100898b03121561245557600080fd5b8835975061246560208a01612275565b965060408901359550606089013567ffffffffffffffff8082111561248957600080fd5b6124958c838d01612307565b965060808b01359150808211156124ab57600080fd5b6124b78c838d01612379565b955060a08b01359150808211156124cd57600080fd5b6124d98c838d01612379565b945060c08b01359150808211156124ef57600080fd5b6124fb8c838d01612379565b935060e08b013591508082111561251157600080fd5b5061251e8b828c016123d4565b9150509295985092959890939650565b600080600080600080600060e0888a03121561254957600080fd5b8735965060208801359550612560604089016122f0565b945061256e606089016122f0565b935061257c608089016122f0565b925061258a60a089016122f0565b915061259860c089016122f0565b905092959891949750929550565b6000602082840312156125b857600080fd5b61122b826122f0565b6000602082840312156125d357600080fd5b5035919050565b600080604083850312156125ed57600080fd5b823591506125fd602084016122f0565b90509250929050565b600080600080600080600080610100898b03121561262357600080fd5b61262c896122f0565b975061263a60208a016122f0565b965060408901359550606089013594506080890135935060a089013560ff8116811461266557600080fd5b979a969950949793969295929450505060c08201359160e0013590565b6000806000806080858703121561269857600080fd5b6126a1856122f0565b93506126af602086016122f0565b93969395505050506040820135916060013590565b600080604083850312156126d757600080fd5b6126e0836122f0565b946020939093013593505050565b6000806000806080858703121561270457600080fd5b61270d856122f0565b966020860135965060408601359560600135945092505050565b6000806040838503121561273a57600080fd5b612743836122f0565b9150602083013567ffffffffffffffff81111561275f57600080fd5b61276b85828601612379565b9150509250929050565b634e487b7160e01b600052601160045260246000fd5b60008282101561279d5761279d612775565b500390565b6000602082840312156127b457600080fd5b5051919050565b600082198211156127ce576127ce612775565b500190565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b83811015612819578151875295820195908201906001016127fd565b509495945050505050565b600081518084526020808501945080840160005b83811015612819578151151587529582019590820190600101612838565b600060e082018983526020898185015260e0604085015281895180845261010086019150828b01935060005b818110156128a75784516001600160a01b031683529383019391830191600101612882565b505084810360608601526128bb818a6127e9565b9250505082810360808401526128d181876127e9565b905082810360a08401526128e581866127e9565b905082810360c08401526128f98185612824565b9a9950505050505050505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60008161294057612940612775565b506000190190565b60005b8381101561296357818101518382015260200161294b565b83811115612972576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516129b0816017850160208801612948565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516129e1816028840160208801612948565b01602801949350505050565b6020815260008251806020840152612a0c816040850160208701612948565b601f01601f19169190910160400192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b600082612a9057612a90612a6b565b500490565b600082612aa457612aa4612a6b565b500690565b60008251612abb818460208701612948565b9190910192915050565b600060208284031215612ad757600080fd5b815161122b81612264565b6000816000190483118215151615612afc57612afc612775565b50029056fefb5864e8ff833c3cb2d2d08505e82ff02a43554c74a35d4f5a64e85261278311a2646970667358221220ebab5f6166ee7c2b48bfe187260032b569f7b46a172d4561a107397f331398cd64736f6c634300080b0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102485760003560e01c8063973cb3781161013b578063c1d8d1d9116100b8578063d72ef1c01161007c578063d72ef1c014610542578063dd5b23df14610555578063ddbfd94114610568578063f0c483241461057b578063fc7b9c181461058457600080fd5b8063c1d8d1d914610501578063ca706bcf14610514578063d11a57ec1461048a578063d52c899814610527578063d547741f1461052f57600080fd5b8063b2779a8d116100ff578063b2779a8d14610492578063bc8aee41146104a5578063bfa35f4d146104b8578063c167d1cd146104cb578063c1be6677146104d357600080fd5b8063973cb37814610452578063994396de146104655780639d98771e14610478578063a10ffbed14610481578063a217fddf1461048a57600080fd5b806331e8a7ef116101c95780635cd9e0191161018d5780635cd9e019146103ea5780638456cb59146103fd5780638b363c2d14610405578063910528161461041857806391d148541461043f57600080fd5b806331e8a7ef1461037057806336568abe1461039957806338af3eed146103ac5780633f4ba83a146103d75780635c975abb146103df57600080fd5b80631c31f710116102105780631c31f71014610309578063225729ed1461031c5780632298524614610325578063248a9ca31461033a5780632f2ff15d1461035d57600080fd5b806301e1d1141461024d57806301ffc9a714610269578063040f87cd1461028c5780631268a28f146102a1578063166afeb3146102b4575b600080fd5b61025660045481565b6040519081526020015b60405180910390f35b61027c61027736600461223a565b61058d565b6040519015158152602001610260565b61029f61029a366004612438565b6105c4565b005b61029f6102af36600461252e565b610a0b565b6102e96102c23660046125a6565b60086020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610260565b61029f6103173660046125a6565b610bb7565b61025660065481565b610256600080516020612b0283398151915281565b6102566103483660046125c1565b6000908152606f602052604090206001015490565b61029f61036b3660046125da565b610c1b565b61025661037e3660046125a6565b6001600160a01b031660009081526009602052604090205490565b61029f6103a73660046125da565b610c46565b6000546103bf906001600160a01b031681565b6040516001600160a01b039091168152602001610260565b61029f610cc4565b60a15460ff1661027c565b6102566103f83660046125a6565b610d00565b61029f610e14565b610256610413366004612606565b610e4e565b6102567ff18246d2e788c2a885ec6aeee43fc7c89077b8b7a1e52e99f27f5889e429e2f581565b61027c61044d3660046125da565b610eef565b610256610460366004612682565b610f1a565b6102566104733660046126c4565b610f32565b61025660035481565b61025660055481565b610256600081565b61029f6104a03660046126ee565b611072565b61029f6104b33660046125c1565b61117f565b6102566104c63660046125a6565b6111c2565b610256611232565b6104e66104e13660046126c4565b6112b2565b60408051938452602084019290925290820152606001610260565b6001546103bf906001600160a01b031681565b6102566105223660046126c4565b6112f4565b61027c6113e1565b61029f61053d3660046125da565b611455565b610256610550366004612727565b61147b565b61029f6105633660046126c4565b6115d8565b61029f6105763660046125a6565b611721565b61025660075481565b61025660025481565b60006001600160e01b03198216637965db0b60e01b14806105be57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080516020612b028339815191526105dd8133611843565b88156107a15787156106695788600760008282546105fb919061278b565b90915550506001546040516340c10f1960e01b8152306004820152602481018b90526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561064c57600080fd5b505af1158015610660573d6000803e3d6000fd5b505050506107a1565b6002546001546040516370a0823160e01b81523060048201528b92916001600160a01b0316906370a0823190602401602060405180830381865afa1580156106b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d991906127a2565b6106e3919061278b565b10156107255760405162461bcd60e51b815260206004820152600c60248201526b21737570706c7944656c746160a01b60448201526064015b60405180910390fd5b886007600082825461073791906127bb565b9091555050600154604051632770a7eb60e21b8152306004820152602481018b90526001600160a01b0390911690639dc29fac90604401600060405180830381600087803b15801561078857600080fd5b505af115801561079c573d6000803e3d6000fd5b505050505b86156107ad5760038790555b855180156109af578551811480156107c55750845181145b80156107d15750835181145b6108075760405162461bcd60e51b8152602060048201526007602482015266042988a9c8ea8960cb1b604482015260640161071c565b60005b818110156109ad576000868281518110610826576108266127d3565b6020026020010151116108675760405162461bcd60e51b81526020600482015260096024820152682168616c664c69666560b81b604482015260640161071c565b6040518060800160405280888381518110610884576108846127d3565b602002602001015181526020018583815181106108a3576108a36127d3565b60200260200101516108f657600860008b85815181106108c5576108c56127d3565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600101546108f8565b425b815260200187838151811061090f5761090f6127d3565b6020026020010151815260200186838151811061092e5761092e6127d3565b6020026020010151815250600860008a848151811061094f5761094f6127d3565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015590505080600101905061080a565b505b881515336001600160a01b03167f6d16e4456b1d323c5ff472fc6e66b323726bf18d96f033753e2004092a054a0a8c8b8b8b8b8b8b6040516109f79796959493929190612856565b60405180910390a350505050505050505050565b600a54610100900460ff16610a2657600a5460ff1615610a2a565b303b155b610a8d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161071c565b600a54610100900460ff16158015610aaf57600a805461ffff19166101011790555b60055415610aed5760405162461bcd60e51b815260206004820152600b60248201526a125392551250531256915160aa1b604482015260640161071c565b610af56118a7565b610afd6118a7565b610b056118ce565b610b0d6118a7565b60058890556003879055600180546001600160a01b038089166001600160a01b0319928316179092556000805492881692909116919091178155610b5190856118fd565b610b69600080516020612b02833981519152846118fd565b610b937ff18246d2e788c2a885ec6aeee43fc7c89077b8b7a1e52e99f27f5889e429e2f5836118fd565b610b9b611983565b8015610bad57600a805461ff00191690555b5050505050505050565b6000610bc38133611843565b600080546001600160a01b0319166001600160a01b03841690811790915560405190815233907f2906d223dc4163733bb374af8641c7e9ae256e2bae53c90e0c9a2be2e611ae44906020015b60405180910390a25050565b6000828152606f6020526040902060010154610c378133611843565b610c4183836118fd565b505050565b6001600160a01b0381163314610cb65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161071c565b610cc082826119f8565b5050565b610cdc600080516020612b0283398151915233610eef565b80610ced5750610ced600033610eef565b610cf657600080fd5b610cfe611a5f565b565b6001600160a01b03811660009081526008602090815260408083208151608081018352815480825260018301549482018590526002830154938201939093526003909101546060820152918391610d6a91610d5b904261278b565b84604001518560600151611ad9565b6003546002546001546040516370a0823160e01b8152306004820152939450610e0c93670de0b6b3a7640000938693909290916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df391906127a2565b610dfd919061278b565b610e0791906127bb565b611b2e565b949350505050565b610e2c600080516020612b0283398151915233610eef565b80610e3d5750610e3d600033610eef565b610e4657600080fd5b610cfe611983565b60405163d505accf60e01b8152336004820152306024820152604481018790526064810185905260ff8416608482015260a4810183905260c481018290526000906001600160a01b0389169063d505accf9060e401600060405180830381600087803b158015610ebd57600080fd5b505af1158015610ed1573d6000803e3d6000fd5b50505050610ee2338a8a8a8a611b49565b9998505050505050505050565b6000918252606f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610f293386868686611b49565b95945050505050565b6000610f4060a15460ff1690565b15610f5d5760405162461bcd60e51b815260040161071c90612907565b336000908152600960205260408120805484908110610f7e57610f7e6127d3565b90600052602060002090600302019050610fa8816000015482600101548360020154600554611dac565b91508115611031578160026000828254610fc2919061278b565b9250508190555081816001016000828254610fdd91906127bb565b9091555050600154610ff9906001600160a01b03168584611de6565b604051828152839033907f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b19060200160405180910390a35b6000821161106b5760405162461bcd60e51b8152602060048201526007602482015266085bdd5d1c1d5d60ca1b604482015260640161071c565b5092915050565b600061107e8133611843565b6001600160a01b038516600090815260086020526040902060010154156110d35760405162461bcd60e51b81526020600482015260096024820152680851561254d511539560ba1b604482015260640161071c565b6004805460019081019091556040805160808101825286815242602080830191825282840188815260608085018981526001600160a01b038d16600081815260088652889020965187559451978601979097559051600285015594516003909301929092558251888152918201879052918101859052909133917fb77ca2e0349708985dbcf613b1e704209d8f1ba8a2711021b807126b8b0b98b1910160405180910390a35050505050565b600061118b8133611843565b600782905560405182815233907febdc064ea11a59f10ae4f519348e9c6a62eff3619f43504fadd768ac9b2b02a090602001610c0f565b6001600160a01b038116600090815260086020908152604080832081516080810183528154808252600183015494820185905260028301549382019390935260039091015460608201529161122b919061121c904261278b565b83604001518460600151611ad9565b9392505050565b6002546001546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa15801561127f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a391906127a2565b6112ad919061278b565b905090565b600960205281600052604060002081815481106112ce57600080fd5b600091825260209091206003909102018054600182015460029092015490935090915083565b6001600160a01b038281166000908152600860209081526040808320815160808101835281548152600180830154948201949094526002808301548285015260039092015460608201529054925491516370a0823160e01b815230600482015293949093859392909116906370a0823190602401602060405180830381865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a991906127a2565b6113b3919061278b565b9050610f29848260035485600001518660200151426113d2919061278b565b87604001518860600151611f01565b60007ff18246d2e788c2a885ec6aeee43fc7c89077b8b7a1e52e99f27f5889e429e2f561140e8133611843565b7f81a5044df5842f3c82a74884003121d56a6a8947e00541b9b625385c9b2190e460065460405161144191815260200190565b60405180910390a150506000600655600190565b6000828152606f60205260409020600101546114718133611843565b610c4183836119f8565b600061148960a15460ff1690565b156114a65760405162461bcd60e51b815260040161071c90612907565b815160005b818110156115a95733600090815260096020526040812085518690849081106114d6576114d66127d3565b6020026020010151815481106114ee576114ee6127d3565b90600052602060002090600302019050600061151a826000015483600101548460020154600554611dac565b90508082600101600082825461153091906127bb565b90915550611540905081866127bb565b9450858381518110611554576115546127d3565b6020026020010151336001600160a01b03167f51c99f515c87b0d95ba97f616edd182e8f161c4932eac17c6fefe9dab58b77b18360405161159791815260200190565b60405180910390a350506001016114ab565b5081600260008282546115bc919061278b565b909155505060015461106b906001600160a01b03168584611de6565b60a15460ff16156115fb5760405162461bcd60e51b815260040161071c90612907565b33600090815260096020526040812080548390811061161c5761161c6127d3565b6000918252602080832060408051606081018252600390940290910180548452600181015484840152600201548382015233845260099091529091208054919250908390811061166e5761166e6127d3565b60009182526020808320600392830201838155600180820185905560029182018590556001600160a01b038816808652600984526040808720805480850182558189528689208a519190980290970196875594880151928601929092558682015194909201939093559283905254905133917f3d7a7edfc7b138c151d31aecb9c6eb8ff81df3cabad50f3d6dddae4ccc0710439161171491878252602082015260400190565b60405180910390a3505050565b611739600080516020612b0283398151915233610eef565b8061174a575061174a600033610eef565b61175357600080fd5b6001600160a01b03811660009081526008602090815260409182902082516080810184528154815260018201549281018390526002820154938101939093526003015460608301526117d65760405162461bcd60e51b815260206004820152600c60248201526b085393d391561254d511539560a21b604482015260640161071c565b6004600081546117e590612931565b909155506001600160a01b03821660008181526008602052604080822082815560018101839055600281018390556003018290555133917f9b0b658574799baf31f8c52b9140477861460c951e7bffc6e56b270bb8af420991a35050565b61184d8282610eef565b610cc057611865816001600160a01b03166014611f3b565b611870836020611f3b565b604051602001611881929190612978565b60408051601f198184030181529082905262461bcd60e51b825261071c916004016129ed565b600a54610100900460ff16610cfe5760405162461bcd60e51b815260040161071c90612a20565b600a54610100900460ff166118f55760405162461bcd60e51b815260040161071c90612a20565b610cfe6120d7565b6119078282610eef565b610cc0576000828152606f602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561193f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60a15460ff16156119a65760405162461bcd60e51b815260040161071c90612907565b60a1805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119db3390565b6040516001600160a01b03909116815260200160405180910390a1565b611a028282610eef565b15610cc0576000828152606f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60a15460ff16611aa85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161071c565b60a1805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336119db565b6000611ae58385612a81565b85901c90506001611b01611af98587612a95565b839086611b2e565b611b0c911c8261278b565b9050611b24611b1b828761278b565b83612710611b2e565b610f2990826127bb565b8282028315848204841417611b4257600080fd5b0492915050565b6000611b5760a15460ff1690565b15611b745760405162461bcd60e51b815260040161071c90612907565b6001600160a01b03841660009081526008602052604090208054611bc75760405162461bcd60e51b815260206004820152600a602482015269214c495155494449545960b01b604482015260640161071c565b6002546001546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa158015611c14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3891906127a2565b611c42919061278b565b9050611c7085826003548560000154866001015442611c61919061278b565b87600201548860030154611f01565b9250838310158015611c825750828110155b611cb85760405162461bcd60e51b8152602060048201526007602482015266085bdd5d1c1d5d60ca1b604482015260640161071c565b600054611cd29087908a906001600160a01b03168861210a565b60068054840190556002805484019055815485908390600090611cf69084906127bb565b90915550506001600160a01b03808816600090815260096020908152604080832081516060810183528881528084018581524282850190815283546001818101865594885295909620915160039095029091019384555190830155915160029091015551878216918a16907f8e5101242b74cdfce3a74e64844cf2cc76186195bf6d8cfe04c7f519f64dfbb390611d999089908890918252602082015260400190565b60405180910390a3505095945050505050565b600080611db9844261278b565b905082811115611dc65750815b84611dd2878386611b2e565b611ddc919061278b565b9695505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611e429190612aa9565b6000604051808303816000865af19150503d8060008114611e7f576040519150601f19603f3d011682016040523d82523d6000602084013e611e84565b606091505b5091509150818015611eae575080511580611eae575080806020019051810190611eae9190612ac5565b611efa5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015260640161071c565b5050505050565b6000611f2f611f1087896127bb565b89611f1d88888888611ad9565b611f2791906127bb565b8a9190611b2e565b98975050505050505050565b60606000611f4a836002612ae2565b611f559060026127bb565b67ffffffffffffffff811115611f6d57611f6d612285565b6040519080825280601f01601f191660200182016040528015611f97576020820181803683370190505b509050600360fc1b81600081518110611fb257611fb26127d3565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611fe157611fe16127d3565b60200101906001600160f81b031916908160001a9053506000612005846002612ae2565b6120109060016127bb565b90505b6001811115612088576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612044576120446127d3565b1a60f81b82828151811061205a5761205a6127d3565b60200101906001600160f81b031916908160001a90535060049490941c9361208181612931565b9050612013565b50831561122b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161071c565b600a54610100900460ff166120fe5760405162461bcd60e51b815260040161071c90612a20565b60a1805460ff19169055565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b179052915160009283929088169161216e9190612aa9565b6000604051808303816000865af19150503d80600081146121ab576040519150601f19603f3d011682016040523d82523d6000602084013e6121b0565b606091505b50915091508180156121da5750805115806121da5750808060200190518101906121da9190612ac5565b6122325760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b606482015260840161071c565b505050505050565b60006020828403121561224c57600080fd5b81356001600160e01b03198116811461122b57600080fd5b801515811461227257600080fd5b50565b803561228081612264565b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156122c4576122c4612285565b604052919050565b600067ffffffffffffffff8211156122e6576122e6612285565b5060051b60200190565b80356001600160a01b038116811461228057600080fd5b600082601f83011261231857600080fd5b8135602061232d612328836122cc565b61229b565b82815260059290921b8401810191818101908684111561234c57600080fd5b8286015b8481101561236e57612361816122f0565b8352918301918301612350565b509695505050505050565b600082601f83011261238a57600080fd5b8135602061239a612328836122cc565b82815260059290921b840181019181810190868411156123b957600080fd5b8286015b8481101561236e57803583529183019183016123bd565b600082601f8301126123e557600080fd5b813560206123f5612328836122cc565b82815260059290921b8401810191818101908684111561241457600080fd5b8286015b8481101561236e57803561242b81612264565b8352918301918301612418565b600080600080600080600080610100898b03121561245557600080fd5b8835975061246560208a01612275565b965060408901359550606089013567ffffffffffffffff8082111561248957600080fd5b6124958c838d01612307565b965060808b01359150808211156124ab57600080fd5b6124b78c838d01612379565b955060a08b01359150808211156124cd57600080fd5b6124d98c838d01612379565b945060c08b01359150808211156124ef57600080fd5b6124fb8c838d01612379565b935060e08b013591508082111561251157600080fd5b5061251e8b828c016123d4565b9150509295985092959890939650565b600080600080600080600060e0888a03121561254957600080fd5b8735965060208801359550612560604089016122f0565b945061256e606089016122f0565b935061257c608089016122f0565b925061258a60a089016122f0565b915061259860c089016122f0565b905092959891949750929550565b6000602082840312156125b857600080fd5b61122b826122f0565b6000602082840312156125d357600080fd5b5035919050565b600080604083850312156125ed57600080fd5b823591506125fd602084016122f0565b90509250929050565b600080600080600080600080610100898b03121561262357600080fd5b61262c896122f0565b975061263a60208a016122f0565b965060408901359550606089013594506080890135935060a089013560ff8116811461266557600080fd5b979a969950949793969295929450505060c08201359160e0013590565b6000806000806080858703121561269857600080fd5b6126a1856122f0565b93506126af602086016122f0565b93969395505050506040820135916060013590565b600080604083850312156126d757600080fd5b6126e0836122f0565b946020939093013593505050565b6000806000806080858703121561270457600080fd5b61270d856122f0565b966020860135965060408601359560600135945092505050565b6000806040838503121561273a57600080fd5b612743836122f0565b9150602083013567ffffffffffffffff81111561275f57600080fd5b61276b85828601612379565b9150509250929050565b634e487b7160e01b600052601160045260246000fd5b60008282101561279d5761279d612775565b500390565b6000602082840312156127b457600080fd5b5051919050565b600082198211156127ce576127ce612775565b500190565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b83811015612819578151875295820195908201906001016127fd565b509495945050505050565b600081518084526020808501945080840160005b83811015612819578151151587529582019590820190600101612838565b600060e082018983526020898185015260e0604085015281895180845261010086019150828b01935060005b818110156128a75784516001600160a01b031683529383019391830191600101612882565b505084810360608601526128bb818a6127e9565b9250505082810360808401526128d181876127e9565b905082810360a08401526128e581866127e9565b905082810360c08401526128f98185612824565b9a9950505050505050505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60008161294057612940612775565b506000190190565b60005b8381101561296357818101518382015260200161294b565b83811115612972576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516129b0816017850160208801612948565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516129e1816028840160208801612948565b01602801949350505050565b6020815260008251806020840152612a0c816040850160208701612948565b601f01601f19169190910160400192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b600082612a9057612a90612a6b565b500490565b600082612aa457612aa4612a6b565b500690565b60008251612abb818460208701612948565b9190910192915050565b600060208284031215612ad757600080fd5b815161122b81612264565b6000816000190483118215151615612afc57612afc612775565b50029056fefb5864e8ff833c3cb2d2d08505e82ff02a43554c74a35d4f5a64e85261278311a2646970667358221220ebab5f6166ee7c2b48bfe187260032b569f7b46a172d4561a107397f331398cd64736f6c634300080b0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.