ETH Price: $3,395.88 (-1.17%)
Gas: 2 Gwei

Contract

0x65b35d6Eb7006e0e607BC54EB2dFD459923476fE
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x2aec5eea323d040d9c01cf02df26b7abbdb65385f281b2bcd38422f580eada4e Mint(pending)2024-06-23 1:41:126 days ago1719106872IN
Inverse Finance: xINV
0 ETH(Pending)(Pending)
0x7603e3b03f461a46fb083e1e3fd5b4560b58645c94e31681af2f20593f6332be Mint(pending)2024-06-23 1:41:126 days ago1719106872IN
Inverse Finance: xINV
0 ETH(Pending)(Pending)
Redeem189895562024-01-12 8:14:23169 days ago1705047263IN
Inverse Finance: xINV
0 ETH0.0036648416.70562102
Redeem Underlyin...189358392024-01-04 18:46:23176 days ago1704393983IN
Inverse Finance: xINV
0 ETH0.0127490623.07298401
Redeem179554392023-08-20 10:44:23314 days ago1692528263IN
Inverse Finance: xINV
0 ETH0.0037952413.29141081
Redeem162444822022-12-23 2:39:11554 days ago1671763151IN
Inverse Finance: xINV
0 ETH0.0039256712.12649772
Redeem161935532022-12-16 0:03:59561 days ago1671149039IN
Inverse Finance: xINV
0 ETH0.0039659613.88629768
Redeem161572512022-12-10 22:20:23566 days ago1670710823IN
Inverse Finance: xINV
0 ETH0.0023763512.78482174
Redeem161309352022-12-07 5:59:59570 days ago1670392799IN
Inverse Finance: xINV
0 ETH0.003684313.72166128
Redeem159027982022-11-05 9:03:23602 days ago1667639003IN
Inverse Finance: xINV
0 ETH0.0044475113.93734381
Redeem156758482022-10-04 16:05:59633 days ago1664899559IN
Inverse Finance: xINV
0 ETH0.0057721.48953077
Redeem154544162022-09-01 18:26:48666 days ago1662056808IN
Inverse Finance: xINV
0 ETH0.0033786518.17720261
Redeem154389602022-08-30 7:01:06669 days ago1661842866IN
Inverse Finance: xINV
0 ETH0.001634838.05443671
Redeem Underlyin...154056912022-08-24 23:05:51674 days ago1661382351IN
Inverse Finance: xINV
0 ETH0.0045800510
Redeem154056282022-08-24 22:46:59674 days ago1661381219IN
Inverse Finance: xINV
0 ETH0.003429529.57105355
Redeem154056212022-08-24 22:45:03674 days ago1661381103IN
Inverse Finance: xINV
0 ETH0.002781147.76155359
Redeem154055802022-08-24 22:36:50674 days ago1661380610IN
Inverse Finance: xINV
0 ETH0.0051903314.48506182
Redeem Underlyin...153906912022-08-22 14:15:52676 days ago1661177752IN
Inverse Finance: xINV
0 ETH0.0077457224.47150779
Redeem153906872022-08-22 14:14:44676 days ago1661177684IN
Inverse Finance: xINV
0 ETH0.0058276426.8766908
Redeem153906802022-08-22 14:13:21676 days ago1661177601IN
Inverse Finance: xINV
0 ETH0.0068317331.50748079
Redeem153773192022-08-20 11:21:21679 days ago1660994481IN
Inverse Finance: xINV
0 ETH0.001467287.22895976
Redeem152941012022-08-07 8:30:30692 days ago1659861030IN
Inverse Finance: xINV
0 ETH0.002162246.7761593
Redeem152863712022-08-06 3:34:41693 days ago1659756881IN
Inverse Finance: xINV
0 ETH0.001431237.05133695
Redeem152726672022-08-04 0:24:21695 days ago1659572661IN
Inverse Finance: xINV
0 ETH0.001554598.36375457
Redeem148020762022-05-19 1:11:59772 days ago1652922719IN
Inverse Finance: xINV
0 ETH0.0183553257.9257103
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To Value
124373272021-05-15 6:25:251141 days ago1621059925
Inverse Finance: xINV
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
XINV

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 10 : XINV.sol
pragma solidity ^0.5.16;

import "./ComptrollerInterface.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./SafeMath.sol";
import "./Governance/IINV.sol";
/**
 * @title xINV Core contract
 * @notice Abstract base for xINV
 * @author Inverse Finance
 */
contract xInvCore is Exponential, TokenErrorReporter {

    /**
     * @dev Guard variable for re-entrancy checks
     */
    bool internal _notEntered;

    /**
     * @notice EIP-20 token name for this token
     */
    string public name;

    /**
     * @notice EIP-20 token symbol for this token
     */
    string public symbol;

    /**
     * @notice EIP-20 token decimals for this token
     */
    uint8 public decimals;

    /**
     * @notice Maximum fraction of interest that can be set aside for reserves
     */
    uint internal constant reserveFactorMaxMantissa = 1e18;

    /**
     * @notice Administrator for this contract
     */
    address payable public admin;

    /**
     * @notice Pending administrator for this contract
     */
    address payable public pendingAdmin;

    /**
     * @notice Contract which oversees inter-cToken operations
     */
    ComptrollerInterface public comptroller;

    /**
     * @notice Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)
     */
    uint internal initialExchangeRateMantissa;

    /**
     * @notice Block number that interest was last accrued at
     */
    uint public accrualBlockNumber;

    /**
     * @notice Total number of tokens in circulation
     */
    uint public totalSupply;

    uint public rewardPerBlock;

    address public rewardTreasury;

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

    /**
     * @notice Indicator that this is a CToken contract (for inspection)
     */
    bool public constant isCToken = true;

    /*** Market Events ***/

    /**
     * @notice Event emitted when tokens are minted
     */
    event Mint(address minter, uint mintAmount, uint mintTokens);

    /**
     * @notice Event emitted when tokens are redeemed
     */
    event Redeem(address redeemer, uint redeemAmount, uint redeemTokens);

    /*** Admin Events ***/

    /**
     * @notice Event emitted when pendingAdmin is changed
     */
    event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);

    /**
     * @notice Event emitted when pendingAdmin is accepted, which means admin is updated
     */
    event NewAdmin(address oldAdmin, address newAdmin);

    /**
     * @notice Event emitted when comptroller is changed
     */
    event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);

    /**
     * @notice Event emitted when reward treasury is changed
     */
    event NewRewardTreasury(address oldRewardTreasury, address newRewardTreasury);

    /**
     * @notice Event emitted when reward per block is changed
     */
    event NewRewardPerBlock(uint oldRewardPerBlock, uint newRewardPerBlock);

    /**
     * @notice EIP20 Transfer event
     */
    event Transfer(address indexed from, address indexed to, uint amount);

    /**
     * @notice Failure event
     */
    event Failure(uint error, uint info, uint detail);

    /**
     * @notice Initialize the money market
     * @param comptroller_ The address of the Comptroller
     * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18
     * @param name_ EIP-20 name of this token
     * @param symbol_ EIP-20 symbol of this token
     * @param decimals_ EIP-20 decimal precision of this token
     */
    function initialize(ComptrollerInterface comptroller_,
                        uint initialExchangeRateMantissa_,
                        uint rewardPerBlock_,
                        address rewardTreasury_,
                        string memory name_,
                        string memory symbol_,
                        uint8 decimals_) internal {
        require(msg.sender == admin, "only admin may initialize the market");
        require(accrualBlockNumber == 0, "market may only be initialized once");

        // Set initial exchange rate
        initialExchangeRateMantissa = initialExchangeRateMantissa_;
        require(initialExchangeRateMantissa > 0, "initial exchange rate must be greater than zero.");

        // Set the comptroller
        uint err = _setComptroller(comptroller_);
        require(err == uint(Error.NO_ERROR), "setting comptroller failed");

        name = name_;
        symbol = symbol_;
        decimals = decimals_;
        accrualBlockNumber = getBlockNumber();
        rewardPerBlock = rewardPerBlock_;
        rewardTreasury = rewardTreasury_;

        // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)
        _notEntered = true;
    }
    
    /**
     * @notice Get the token balance of the `owner`
     * @param owner The address of the account to query
     * @return The number of tokens owned by `owner`
     */
    function balanceOf(address owner) external view returns (uint256) {
        return accountTokens[owner];
    }

    /**
     * @notice Get the underlying balance of the `owner`
     * @param owner The address of the account to query
     * @return The amount of underlying owned by `owner`
     */
    function balanceOfUnderlying(address owner) external returns (uint) {
        Exp memory exchangeRate = Exp({mantissa: exchangeRateCurrent()});
        (MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);
        require(mErr == MathError.NO_ERROR, "balance could not be calculated");
        return balance;
    }

    /**
     * @notice Get a snapshot of the account's balances, and the cached exchange rate
     * @dev This is used by comptroller to more efficiently perform liquidity checks.
     * @param account Address of the account to snapshot
     * @return (possible error, token balance, borrow balance, exchange rate mantissa)
     */
    function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {
        uint cTokenBalance = accountTokens[account];
        uint exchangeRateMantissa;

        MathError mErr;

        (mErr, exchangeRateMantissa) = exchangeRateStoredInternal();
        if (mErr != MathError.NO_ERROR) {
            return (uint(Error.MATH_ERROR), 0, 0, 0);
        }

        return (uint(Error.NO_ERROR), cTokenBalance, 0, exchangeRateMantissa);
    }

    /**
     * @dev Function to simply retrieve block number
     *  This exists mainly for inheriting test contracts to stub this result.
     */
    function getBlockNumber() internal view returns (uint) {
        return block.number;
    }

    /**
     * @return Calculated exchange rate scaled by 1e18
     */
    function exchangeRateCurrent() public nonReentrant returns (uint) {
        require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed");
        return exchangeRateStored();
    }

    /**
     * @notice Calculates the exchange rate from the underlying to the CToken
     * @return Calculated exchange rate scaled by 1e18
     */
    function exchangeRateStored() public view returns (uint) {
        (MathError err, uint result) = exchangeRateStoredInternal();
        require(err == MathError.NO_ERROR, "exchangeRateStored: exchangeRateStoredInternal failed");
        return result;
    }

    /**
     * @notice Calculates the exchange rate from the underlying to the CToken
     * @return (error code, calculated exchange rate scaled by 1e18)
     */
    function exchangeRateStoredInternal() internal view returns (MathError, uint) {
        uint _totalSupply = totalSupply;
        if (_totalSupply == 0) {
            /*
             * If there are no tokens minted:
             *  exchangeRate = initialExchangeRate
             */
            return (MathError.NO_ERROR, initialExchangeRateMantissa);
        } else {
            /*
             * Otherwise:
             *  exchangeRate = totalCash / totalSupply
             */
            uint totalCash = getCashPrior();
            Exp memory exchangeRate;
            MathError mathErr;

            (mathErr, exchangeRate) = getExp(totalCash, _totalSupply);
            if (mathErr != MathError.NO_ERROR) {
                return (mathErr, 0);
            }

            return (MathError.NO_ERROR, exchangeRate.mantissa);
        }
    }

    /**
     * @notice Get cash balance of this cToken in the underlying asset
     * @return The quantity of underlying asset owned by this contract
     */
    function getCash() external view returns (uint) {
        return getCashPrior();
    }

    // brings rewards from treasury into this contract
    function accrueInterest() public returns (uint) {
        /* Remember the initial block number */
        uint currentBlockNumber = getBlockNumber();
        uint accrualBlockNumberPrior = accrualBlockNumber;

        /* Short-circuit accumulating 0 interest */
        if (accrualBlockNumberPrior == currentBlockNumber) {
            return uint(Error.NO_ERROR);
        }

        /* Calculate the number of blocks elapsed since the last accrual */
        (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);
        require(mathErr == MathError.NO_ERROR, "could not calculate block delta");
        
        /* Calculate accumulated reward amount */
        uint reward;
        
        (mathErr, reward) = mulUInt(rewardPerBlock, blockDelta);
        require(mathErr == MathError.NO_ERROR, "could not calculate reward");

        if(totalSupply > 0 && rewardTreasury != address(0) && canTransferIn(rewardTreasury, reward)) {
            doTransferIn(rewardTreasury, reward);
        }

        /////////////////////////
        // EFFECTS & INTERACTIONS
        // (No safe failures beyond this point)

        accrualBlockNumber = currentBlockNumber;

        return uint(Error.NO_ERROR);
    }

    /**
     * @notice Sender supplies assets into the market and receives cTokens in exchange
     * @param mintAmount The amount of the underlying asset to supply
     * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.
     */
    function mintInternal(uint mintAmount) internal nonReentrant returns (uint, uint) {
        uint error = accrueInterest();
        if (error != uint(Error.NO_ERROR)) {
            // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed
            return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);
        }
        // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to
        return mintFresh(msg.sender, mintAmount);
    }

    struct MintLocalVars {
        Error err;
        MathError mathErr;
        uint exchangeRateMantissa;
        uint mintTokens;
        uint totalSupplyNew;
        uint accountTokensNew;
        uint actualMintAmount;
    }

    /**
     * @notice User supplies assets into the market and receives cTokens in exchange
     * @param minter The address of the account which is supplying the assets
     * @param mintAmount The amount of the underlying asset to supply
     * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.
     */
    function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) {
        /* Fail if mint not allowed */
        uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount);
        if (allowed != 0) {
            return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);
        }

        MintLocalVars memory vars;

        (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
        if (vars.mathErr != MathError.NO_ERROR) {
            return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);
        }

        /////////////////////////
        // EFFECTS & INTERACTIONS
        // (No safe failures beyond this point)

        /*
         *  We call `doTransferIn` for the minter and the mintAmount.
         *  Note: The cToken must handle variations between ERC-20 and ETH underlying.
         *  `doTransferIn` reverts if anything goes wrong, since we can't be sure if
         *  side-effects occurred. The function returns the amount actually transferred,
         *  in case of a fee. On success, the cToken holds an additional `actualMintAmount`
         *  of cash.
         */
        vars.actualMintAmount = doTransferIn(minter, mintAmount);

        /*
         * We get the current exchange rate and calculate the number of cTokens to be minted:
         *  mintTokens = actualMintAmount / exchangeRate
         */

        (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(vars.actualMintAmount, Exp({mantissa: vars.exchangeRateMantissa}));
        require(vars.mathErr == MathError.NO_ERROR, "MINT_EXCHANGE_CALCULATION_FAILED");

        /*
         * We calculate the new total supply of cTokens and minter token balance, checking for overflow:
         *  totalSupplyNew = totalSupply + mintTokens
         *  accountTokensNew = accountTokens[minter] + mintTokens
         */
        (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);
        require(vars.mathErr == MathError.NO_ERROR, "MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED");
        require(vars.totalSupplyNew < 2**96, "MINT_NEW_TOTAL_SUPPLY_OVER_CAPACITY");

        (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[minter], vars.mintTokens);
        require(vars.mathErr == MathError.NO_ERROR, "MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED");

        /* We write previously calculated values into storage */
        totalSupply = vars.totalSupplyNew;
        accountTokens[minter] = vars.accountTokensNew;

        /* We emit a Mint event, and a Transfer event */
        emit Mint(minter, vars.actualMintAmount, vars.mintTokens);
        emit Transfer(address(this), minter, vars.mintTokens);

        /* we move delegates */
        _moveDelegates(address(0), minter, uint96(vars.mintTokens)); // NOTE: Check for potential overflows due to conversion from uint256 to uint96

        /* We call the defense hook */
        comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);

        return (uint(Error.NO_ERROR), vars.actualMintAmount);
    }

    /**
     * @notice Sender redeems cTokens in exchange for the underlying asset
     * @param redeemTokens The number of cTokens to redeem into underlying
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function redeemInternal(uint redeemTokens, bool useEscrow) internal nonReentrant returns (uint) {
        uint error = accrueInterest();
        if (error != uint(Error.NO_ERROR)) {
            // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
            return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
        }
        // redeemFresh emits redeem-specific logs on errors, so we don't need to
        return redeemFresh(msg.sender, redeemTokens, 0, useEscrow);
    }

    /**
     * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset
     * @param redeemAmount The amount of underlying to receive from redeeming cTokens
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function redeemUnderlyingInternal(uint redeemAmount, bool useEscrow) internal nonReentrant returns (uint) {
        uint error = accrueInterest();
        if (error != uint(Error.NO_ERROR)) {
            // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
            return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
        }
        // redeemFresh emits redeem-specific logs on errors, so we don't need to
        return redeemFresh(msg.sender, 0, redeemAmount, useEscrow);
    }

    struct RedeemLocalVars {
        Error err;
        MathError mathErr;
        uint exchangeRateMantissa;
        uint redeemTokens;
        uint redeemAmount;
        uint totalSupplyNew;
        uint accountTokensNew;
    }

    /**
     * @notice User redeems cTokens in exchange for the underlying asset
     * @param redeemer The address of the account which is redeeming the tokens
     * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)
     * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn, bool useEscrow) internal returns (uint) {
        require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");

        RedeemLocalVars memory vars;

        /* exchangeRate = invoke Exchange Rate Stored() */
        (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
        if (vars.mathErr != MathError.NO_ERROR) {
            return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr));
        }

        /* If redeemTokensIn > 0: */
        if (redeemTokensIn > 0) {
            /*
             * We calculate the exchange rate and the amount of underlying to be redeemed:
             *  redeemTokens = redeemTokensIn
             *  redeemAmount = redeemTokensIn x exchangeRateCurrent
             */
            vars.redeemTokens = redeemTokensIn;

            (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(Exp({mantissa: vars.exchangeRateMantissa}), redeemTokensIn);
            if (vars.mathErr != MathError.NO_ERROR) {
                return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint(vars.mathErr));
            }
        } else {
            /*
             * We get the current exchange rate and calculate the amount to be redeemed:
             *  redeemTokens = redeemAmountIn / exchangeRate
             *  redeemAmount = redeemAmountIn
             */

            (vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(redeemAmountIn, Exp({mantissa: vars.exchangeRateMantissa}));
            if (vars.mathErr != MathError.NO_ERROR) {
                return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED, uint(vars.mathErr));
            }

            vars.redeemAmount = redeemAmountIn;
        }

        /* Fail if redeem not allowed */
        uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);
        if (allowed != 0) {
            return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);
        }

        /*
         * We calculate the new total supply and redeemer balance, checking for underflow:
         *  totalSupplyNew = totalSupply - redeemTokens
         *  accountTokensNew = accountTokens[redeemer] - redeemTokens
         */
        (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);
        if (vars.mathErr != MathError.NO_ERROR) {
            return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint(vars.mathErr));
        }

        (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);
        if (vars.mathErr != MathError.NO_ERROR) {
            return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint(vars.mathErr));
        }

        /* Fail gracefully if protocol has insufficient cash */
        if (getCashPrior() < vars.redeemAmount) {
            return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);
        }

        /////////////////////////
        // EFFECTS & INTERACTIONS
        // (No safe failures beyond this point)

        /*
         * We invoke doTransferOut for the redeemer and the redeemAmount.
         *  Note: The cToken must handle variations between ERC-20 and ETH underlying.
         *  On success, the cToken has redeemAmount less of cash.
         *  doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.
         */
        doTransferOut(redeemer, vars.redeemAmount, useEscrow);

        /* We write previously calculated values into storage */
        totalSupply = vars.totalSupplyNew;
        accountTokens[redeemer] = vars.accountTokensNew;

        /* We emit a Transfer event, and a Redeem event */
        emit Transfer(redeemer, address(this), vars.redeemTokens);
        emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);

        /* We move delegates */
        _moveDelegates(redeemer, address(0), uint96(vars.redeemTokens)); // NOTE: Check for potential overflows due to conversion from uint256 to uint96

        /* We call the defense hook */
        comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);

        return uint(Error.NO_ERROR);
    }

    /**
     * @notice Transfers collateral tokens (this market) to the liquidator.
     * @dev Will fail unless called by another cToken during the process of liquidation.
     *  Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.
     * @param liquidator The account receiving seized collateral
     * @param borrower The account having collateral seized
     * @param seizeTokens The number of cTokens to seize
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) {
        return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);
    }

    /**
     * @notice Transfers collateral tokens (this market) to the liquidator.
     * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.
     *  Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.
     * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)
     * @param liquidator The account receiving seized collateral
     * @param borrower The account having collateral seized
     * @param seizeTokens The number of cTokens to seize
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function seizeInternal(address seizerToken, address liquidator, address borrower, uint seizeTokens) internal returns (uint) {
        /* Fail if seize not allowed */
        uint allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);
        if (allowed != 0) {
            return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);
        }

        /* Fail if borrower = liquidator */
        if (borrower == liquidator) {
            return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);
        }

        MathError mathErr;
        uint borrowerTokensNew;
        uint liquidatorTokensNew;

        /*
         * We calculate the new borrower and liquidator token balances, failing on underflow/overflow:
         *  borrowerTokensNew = accountTokens[borrower] - seizeTokens
         *  liquidatorTokensNew = accountTokens[liquidator] + seizeTokens
         */
        (mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);
        if (mathErr != MathError.NO_ERROR) {
            return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr));
        }

        (mathErr, liquidatorTokensNew) = addUInt(accountTokens[liquidator], seizeTokens);
        if (mathErr != MathError.NO_ERROR) {
            return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint(mathErr));
        }

        /////////////////////////
        // EFFECTS & INTERACTIONS
        // (No safe failures beyond this point)

        /* We write the previously calculated values into storage */
        accountTokens[borrower] = borrowerTokensNew;
        accountTokens[liquidator] = liquidatorTokensNew;

        /* Emit a Transfer event */
        emit Transfer(borrower, liquidator, seizeTokens);

        /* We move delegates to liquidator although they'll be burned in the redeemFresh call after */
        _moveDelegates(borrower, liquidator, uint96(seizeTokens)); // NOTE: Check for potential overflows due to conversion from uint256 to uint96

        /* We call the defense hook */
        comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);

        // Auto-redeem liquidator and skip escrow (cast liquidator to payable)
        redeemFresh(address(uint160(liquidator)), seizeTokens, 0, false);

        return uint(Error.NO_ERROR);
    }


    /*** Admin Functions ***/

    /**
      * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
      * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
      * @param newPendingAdmin New pending admin.
      * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
      */
    function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {
        // Check caller = admin
        if (msg.sender != admin) {
            return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
        }

        // Save current value, if any, for inclusion in log
        address oldPendingAdmin = pendingAdmin;

        // Store pendingAdmin with value newPendingAdmin
        pendingAdmin = newPendingAdmin;

        // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
        emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);

        return uint(Error.NO_ERROR);
    }

    /**
      * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
      * @dev Admin function for pending admin to accept role and update admin
      * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
      */
    function _acceptAdmin() external returns (uint) {
        // Check caller is pendingAdmin and pendingAdmin ≠ address(0)
        if (msg.sender != pendingAdmin || msg.sender == address(0)) {
            return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);
        }

        // Save current values for inclusion in log
        address oldAdmin = admin;
        address oldPendingAdmin = pendingAdmin;

        // Store admin with value pendingAdmin
        admin = pendingAdmin;

        // Clear the pending value
        pendingAdmin = address(0);

        emit NewAdmin(oldAdmin, admin);
        emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);

        return uint(Error.NO_ERROR);
    }

    /**
      * @notice Sets a new comptroller for the market
      * @dev Admin function to set a new comptroller
      * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
      */
    function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {
        // Check caller is admin
        if (msg.sender != admin) {
            return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);
        }

        ComptrollerInterface oldComptroller = comptroller;
        // Ensure invoke comptroller.isComptroller() returns true
        require(newComptroller.isComptroller(), "marker method returned false");

        // Set market's comptroller to newComptroller
        comptroller = newComptroller;

        // Emit NewComptroller(oldComptroller, newComptroller)
        emit NewComptroller(oldComptroller, newComptroller);

        return uint(Error.NO_ERROR);
    }

    function _setRewardTreasury(address newRewardTreasury) public returns (uint) {
        // Check caller is admin
        if (msg.sender != admin) {
            return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);
        }
        
        address oldRewardTreasury = rewardTreasury;
        rewardTreasury = newRewardTreasury; // it's acceptable to set it as address(0)

        emit NewRewardTreasury(oldRewardTreasury, newRewardTreasury);
    }

    function _setRewardPerBlock(uint newRewardPerBlock) public returns (uint) {
        // Check caller is admin
        if (msg.sender != admin) {
            return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);
        }

        uint oldRewardPerBlock = rewardPerBlock;
        rewardPerBlock = newRewardPerBlock; // it's acceptable to set it as 0

        emit NewRewardPerBlock(oldRewardPerBlock, newRewardPerBlock);

    }

    /*** Safe Token ***/

    /**
     * @notice Gets balance of this contract in terms of the underlying
     * @dev This excludes the value of the current message, if any
     * @return The quantity of underlying owned by this contract
     */
    function getCashPrior() internal view returns (uint);

    /**
     * @dev Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee.
     *  This may revert due to insufficient balance or insufficient allowance.
     */
    function doTransferIn(address from, uint amount) internal returns (uint);

    function canTransferIn(address from, uint amount) internal view returns (bool);
    
    /**
     * @dev Performs a transfer out, ideally returning an explanatory error code upon failure tather than reverting.
     *  If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract.
     *  If caller has checked protocol's balance, and verified it is >= amount, this should not revert in normal conditions.
     */
    function doTransferOut(address payable to, uint amount, bool useEscrow) internal;


    /*** Reentrancy Guard ***/

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     */
    modifier nonReentrant() {
        require(_notEntered, "re-entered");
        _notEntered = false;
        _;
        _notEntered = true; // get a gas-refund post-Istanbul
    }

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

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

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

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

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

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

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

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

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

    /**
     * @notice Delegate votes from `msg.sender` to `delegatee`
     * @param delegatee The address to delegate votes to
     */
    function delegate(address delegatee) public {
        return _delegate(msg.sender, delegatee);
    }

    /**
     * @notice Delegates votes from signatory to `delegatee`
     * @param delegatee The address to delegate votes to
     * @param nonce The contract state required to match the signature
     * @param expiry The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
        bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
        bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "INV::delegateBySig: invalid signature");
        require(nonce == nonces[signatory]++, "INV::delegateBySig: invalid nonce");
        require(now <= expiry, "INV::delegateBySig: signature expired");
        return _delegate(signatory, delegatee);
    }

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

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

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

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

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

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

    function _delegate(address delegator, address delegatee) internal {
        address currentDelegate = delegates[delegator];
        uint96 delegatorBalance = uint96(accountTokens[delegator]); // NOTE: Check for potential overflows due to conversion from uint256 to uint96
        delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveDelegates(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
        if (srcRep != dstRep && amount > 0) {
            if (srcRep != address(0)) {
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
                uint96 srcRepNew = sub96(srcRepOld, amount, "INV::_moveVotes: vote amount underflows");
                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
            }

            if (dstRep != address(0)) {
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
                uint96 dstRepNew = add96(dstRepOld, amount, "INV::_moveVotes: vote amount overflows");
                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
            }
        }
    }

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

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

      emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
    }

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

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

    function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
        uint96 c = a + b;
        require(c >= a, errorMessage);
        return c;
    }

    function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
        require(b <= a, errorMessage);
        return a - b;
    }
}

contract TimelockEscrow {
    using SafeMath for uint;

    address public underlying;
    address public governance;
    address public market;
    uint public duration = 14 days;
    mapping (address => EscrowData) public pendingWithdrawals;

    struct EscrowData {
        uint withdrawalTimestamp;
        uint amount;
    }

    constructor(address underlying_, address governance_) public {
        underlying = underlying_;
        governance = governance_;
        market = msg.sender;
    }

    // set to 0 to send funds directly to users
    function _setEscrowDuration(uint duration_) public {
        require(msg.sender == governance, "only governance can set escrow duration");
        duration = duration_;
    }

    function _setGov(address governance_) public {
        require(msg.sender == governance, "only governance can set its new address");
        governance = governance_;
    }

    /**
     * @notice assumes funds were already sent to this contract by the market. Resets escrow timelock on each withdrawal
     */
    function escrow(address user, uint amount) public {
        require(msg.sender == market, "only market can escrow");
        if(duration > 0) {
            EscrowData memory withdrawal = pendingWithdrawals[user];
            pendingWithdrawals[user] = EscrowData({
                // we set the future withdrawal timestamp based on current `duration` to avoid applying future `duration` changes to existing withdrawals in the event of a governance attack
                withdrawalTimestamp: block.timestamp + duration,
                amount: withdrawal.amount.add(amount)
            });
            emit Escrow(user, block.timestamp + duration, amount);
        } else { // if duration is 0, we send the funds directly to the user
            EIP20Interface token = EIP20Interface(underlying);
            token.transfer(user, amount);
        }
    }

    /**
     * @notice returns user withdrawable amount
     */
    function withdrawable(address user) public view returns (uint amount) {
        EscrowData memory withdrawal = pendingWithdrawals[user];
        if(withdrawal.withdrawalTimestamp <= block.timestamp) {
            amount = withdrawal.amount;
        }
    }

    function withdraw() public {
        uint amount = withdrawable(msg.sender);
        require(amount > 0, "Nothing to withdraw");
        EIP20Interface token = EIP20Interface(underlying);
        delete pendingWithdrawals[msg.sender];
        token.transfer(msg.sender, amount);
        emit Withdraw(msg.sender, amount);
    }

    event Escrow(address to, uint withdrawalTimestamp, uint amount);
    event Withdraw(address to, uint amount);
}

/**
 * @title xINV contract
 * @notice wraps INV token
 * @author Inverse Finance
 */
contract XINV is xInvCore {

    address public underlying;
    TimelockEscrow public escrow;

    /**
     * @notice Construct the xINV market
     * @param underlying_ The address of the underlying asset
     * @param comptroller_ The address of the Comptroller
     * @param name_ ERC-20 name of this token
     * @param symbol_ ERC-20 symbol of this token
     * @param decimals_ ERC-20 decimal precision of this token
     * @param admin_ Address of the administrator of this token
     */
    constructor(address underlying_,
                ComptrollerInterface comptroller_,
                uint rewardPerBlock_,        
                address rewardTreasury_,
                string memory name_,
                string memory symbol_,
                uint8 decimals_,
                address payable admin_) public {
        // Creator of the contract is admin during initialization
        admin = msg.sender;

        // CToken initialize does the bulk of the work
        super.initialize(comptroller_, 1e18, rewardPerBlock_, rewardTreasury_, name_, symbol_, decimals_);

        // Set underlying and sanity check it
        underlying = underlying_;
        EIP20Interface(underlying).totalSupply();

        // Set the proper admin now that initialization is done
        admin = admin_;

        // Create escrow contract
        escrow = new TimelockEscrow(underlying_, admin_);
    }

    /*** User Interface ***/

    /**
     * @notice Sender supplies assets into the market and receives cTokens in exchange
     * @param mintAmount The amount of the underlying asset to supply
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function mint(uint mintAmount) external returns (uint) {
        (uint err,) = mintInternal(mintAmount);
        
        /* if user has no delegate, we inherit delegate from INV */
        if(delegates[msg.sender] == address(0)) {
            address invDelegate = IINV(underlying).delegates(msg.sender);
            if(invDelegate != address(0)) {
                _delegate(msg.sender, invDelegate);
            }
        }
        return err;
    }

    /**
     * @notice Sender redeems cTokens in exchange for the underlying asset
     * @param redeemTokens The number of cTokens to redeem into underlying
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function redeem(uint redeemTokens) external returns (uint) {
        return redeemInternal(redeemTokens, true);
    }

    /**
     * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset
     * @param redeemAmount The amount of underlying to redeem
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function redeemUnderlying(uint redeemAmount) external returns (uint) {
        return redeemUnderlyingInternal(redeemAmount, true);
    }

    /*** Safe Token ***/

    /**
     * @notice Gets balance of this contract in terms of the underlying
     * @dev This excludes the value of the current message, if any
     * @return The quantity of underlying tokens owned by this contract
     */
    function getCashPrior() internal view returns (uint) {
        EIP20Interface token = EIP20Interface(underlying);
        return token.balanceOf(address(this));
    }

    /**
     * @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.
     *      This will revert due to insufficient balance or insufficient allowance.
     *      This function returns the actual amount received,
     *      which may be less than `amount` if there is a fee attached to the transfer.
     *
     *      Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.
     *            See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
     */
    function doTransferIn(address from, uint amount) internal returns (uint) {
        EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
        uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this));
        token.transferFrom(from, address(this), amount);

        bool success;
        assembly {
            switch returndatasize()
                case 0 {                       // This is a non-standard ERC-20
                    success := not(0)          // set success to true
                }
                case 32 {                      // This is a compliant ERC-20
                    returndatacopy(0, 0, 32)
                    success := mload(0)        // Set `success = returndata` of external call
                }
                default {                      // This is an excessively non-compliant ERC-20, revert.
                    revert(0, 0)
                }
        }
        require(success, "TOKEN_TRANSFER_IN_FAILED");

        // Calculate the amount that was *actually* transferred
        uint balanceAfter = EIP20Interface(underlying).balanceOf(address(this));
        require(balanceAfter >= balanceBefore, "TOKEN_TRANSFER_IN_OVERFLOW");
        return balanceAfter - balanceBefore;   // underflow already checked above, just subtract
    }

    /**
     * @dev returns true if `from` has sufficient allowance and balance to to send `amount` to this address
     */
    function canTransferIn(address from, uint amount) internal view returns (bool) {
        EIP20Interface token = EIP20Interface(underlying);
        uint balance = token.balanceOf(from);
        uint allowance = token.allowance(from, address(this));
        return balance >= amount && allowance >= amount;
    }

    /**
     * @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory
     *      error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to
     *      insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified
     *      it is >= amount, this should not revert in normal conditions.
     *
     *      Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.
     *            See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
     */
    function doTransferOut(address payable to, uint amount, bool useEscrow) internal {
        EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
        if(useEscrow) {
            token.transfer(address(escrow), amount);
        } else {
            token.transfer(to, amount);
        }

        bool success;
        assembly {
            switch returndatasize()
                case 0 {                      // This is a non-standard ERC-20
                    success := not(0)          // set success to true
                }
                case 32 {                     // This is a complaint ERC-20
                    returndatacopy(0, 0, 32)
                    success := mload(0)        // Set `success = returndata` of external call
                }
                default {                     // This is an excessively non-compliant ERC-20, revert.
                    revert(0, 0)
                }
        }
        require(success, "TOKEN_TRANSFER_OUT_FAILED");
        if(useEscrow) {
            escrow.escrow(to, amount);
        }
    }

    function _setTimelockEscrow(TimelockEscrow newTimelockEscrow) public returns (uint) {
        require(newTimelockEscrow.market() == address(this), "sanity check: newTimelockEscrow must use this market");
        // Check caller is admin
        if (msg.sender != admin) {
            return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);
        }
        
        TimelockEscrow oldTimelockEscrow = escrow;
        escrow = newTimelockEscrow;

        emit NewTimelockEscrow(oldTimelockEscrow, newTimelockEscrow);
    }

    event NewTimelockEscrow(TimelockEscrow oldTimelockEscrow, TimelockEscrow newTimelockEscrow);
}

File 2 of 10 : ComptrollerInterface.sol
pragma solidity ^0.5.16;

contract ComptrollerInterface {
    /// @notice Indicator that this is a Comptroller contract (for inspection)
    bool public constant isComptroller = true;

    /*** Assets You Are In ***/

    function enterMarkets(address[] calldata cTokens) external returns (uint[] memory);
    function exitMarket(address cToken) external returns (uint);

    /*** Policy Hooks ***/

    function mintAllowed(address cToken, address minter, uint mintAmount) external returns (uint);
    function mintVerify(address cToken, address minter, uint mintAmount, uint mintTokens) external;

    function redeemAllowed(address cToken, address redeemer, uint redeemTokens) external returns (uint);
    function redeemVerify(address cToken, address redeemer, uint redeemAmount, uint redeemTokens) external;

    function borrowAllowed(address cToken, address borrower, uint borrowAmount) external returns (uint);
    function borrowVerify(address cToken, address borrower, uint borrowAmount) external;

    function repayBorrowAllowed(
        address cToken,
        address payer,
        address borrower,
        uint repayAmount) external returns (uint);
    function repayBorrowVerify(
        address cToken,
        address payer,
        address borrower,
        uint repayAmount,
        uint borrowerIndex) external;

    function liquidateBorrowAllowed(
        address cTokenBorrowed,
        address cTokenCollateral,
        address liquidator,
        address borrower,
        uint repayAmount) external returns (uint);
    function liquidateBorrowVerify(
        address cTokenBorrowed,
        address cTokenCollateral,
        address liquidator,
        address borrower,
        uint repayAmount,
        uint seizeTokens) external;

    function seizeAllowed(
        address cTokenCollateral,
        address cTokenBorrowed,
        address liquidator,
        address borrower,
        uint seizeTokens) external returns (uint);
    function seizeVerify(
        address cTokenCollateral,
        address cTokenBorrowed,
        address liquidator,
        address borrower,
        uint seizeTokens) external;

    function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint);
    function transferVerify(address cToken, address src, address dst, uint transferTokens) external;

    /*** Liquidity/Liquidation Calculations ***/

    function liquidateCalculateSeizeTokens(
        address cTokenBorrowed,
        address cTokenCollateral,
        uint repayAmount) external view returns (uint, uint);
}

File 3 of 10 : ErrorReporter.sol
pragma solidity ^0.5.16;

contract ComptrollerErrorReporter {
    enum Error {
        NO_ERROR,
        UNAUTHORIZED,
        COMPTROLLER_MISMATCH,
        INSUFFICIENT_SHORTFALL,
        INSUFFICIENT_LIQUIDITY,
        INVALID_CLOSE_FACTOR,
        INVALID_COLLATERAL_FACTOR,
        INVALID_LIQUIDATION_INCENTIVE,
        MARKET_NOT_ENTERED, // no longer possible
        MARKET_NOT_LISTED,
        MARKET_ALREADY_LISTED,
        MATH_ERROR,
        NONZERO_BORROW_BALANCE,
        PRICE_ERROR,
        REJECTION,
        SNAPSHOT_ERROR,
        TOO_MANY_ASSETS,
        TOO_MUCH_REPAY
    }

    enum FailureInfo {
        ACCEPT_ADMIN_PENDING_ADMIN_CHECK,
        ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,
        EXIT_MARKET_BALANCE_OWED,
        EXIT_MARKET_REJECTION,
        SET_CLOSE_FACTOR_OWNER_CHECK,
        SET_CLOSE_FACTOR_VALIDATION,
        SET_COLLATERAL_FACTOR_OWNER_CHECK,
        SET_COLLATERAL_FACTOR_NO_EXISTS,
        SET_COLLATERAL_FACTOR_VALIDATION,
        SET_COLLATERAL_FACTOR_WITHOUT_PRICE,
        SET_IMPLEMENTATION_OWNER_CHECK,
        SET_LIQUIDATION_INCENTIVE_OWNER_CHECK,
        SET_LIQUIDATION_INCENTIVE_VALIDATION,
        SET_MAX_ASSETS_OWNER_CHECK,
        SET_PENDING_ADMIN_OWNER_CHECK,
        SET_PENDING_IMPLEMENTATION_OWNER_CHECK,
        SET_PRICE_ORACLE_OWNER_CHECK,
        SUPPORT_MARKET_EXISTS,
        SUPPORT_MARKET_OWNER_CHECK,
        SET_PAUSE_GUARDIAN_OWNER_CHECK
    }

    /**
      * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary
      * contract-specific code that enables us to report opaque error codes from upgradeable contracts.
      **/
    event Failure(uint error, uint info, uint detail);

    /**
      * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator
      */
    function fail(Error err, FailureInfo info) internal returns (uint) {
        emit Failure(uint(err), uint(info), 0);

        return uint(err);
    }

    /**
      * @dev use this when reporting an opaque error from an upgradeable collaborator contract
      */
    function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) {
        emit Failure(uint(err), uint(info), opaqueError);

        return uint(err);
    }
}

contract TokenErrorReporter {
    enum Error {
        NO_ERROR,
        UNAUTHORIZED,
        BAD_INPUT,
        COMPTROLLER_REJECTION,
        COMPTROLLER_CALCULATION_ERROR,
        INTEREST_RATE_MODEL_ERROR,
        INVALID_ACCOUNT_PAIR,
        INVALID_CLOSE_AMOUNT_REQUESTED,
        INVALID_COLLATERAL_FACTOR,
        MATH_ERROR,
        MARKET_NOT_FRESH,
        MARKET_NOT_LISTED,
        TOKEN_INSUFFICIENT_ALLOWANCE,
        TOKEN_INSUFFICIENT_BALANCE,
        TOKEN_INSUFFICIENT_CASH,
        TOKEN_TRANSFER_IN_FAILED,
        TOKEN_TRANSFER_OUT_FAILED
    }

    /*
     * Note: FailureInfo (but not Error) is kept in alphabetical order
     *       This is because FailureInfo grows significantly faster, and
     *       the order of Error has some meaning, while the order of FailureInfo
     *       is entirely arbitrary.
     */
    enum FailureInfo {
        ACCEPT_ADMIN_PENDING_ADMIN_CHECK,
        ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED,
        ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED,
        ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED,
        ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED,
        ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED,
        ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED,
        BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
        BORROW_ACCRUE_INTEREST_FAILED,
        BORROW_CASH_NOT_AVAILABLE,
        BORROW_FRESHNESS_CHECK,
        BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
        BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,
        BORROW_MARKET_NOT_LISTED,
        BORROW_COMPTROLLER_REJECTION,
        LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED,
        LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED,
        LIQUIDATE_COLLATERAL_FRESHNESS_CHECK,
        LIQUIDATE_COMPTROLLER_REJECTION,
        LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED,
        LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX,
        LIQUIDATE_CLOSE_AMOUNT_IS_ZERO,
        LIQUIDATE_FRESHNESS_CHECK,
        LIQUIDATE_LIQUIDATOR_IS_BORROWER,
        LIQUIDATE_REPAY_BORROW_FRESH_FAILED,
        LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED,
        LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED,
        LIQUIDATE_SEIZE_COMPTROLLER_REJECTION,
        LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER,
        LIQUIDATE_SEIZE_TOO_MUCH,
        MINT_ACCRUE_INTEREST_FAILED,
        MINT_COMPTROLLER_REJECTION,
        MINT_EXCHANGE_CALCULATION_FAILED,
        MINT_EXCHANGE_RATE_READ_FAILED,
        MINT_FRESHNESS_CHECK,
        MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,
        MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,
        MINT_TRANSFER_IN_FAILED,
        MINT_TRANSFER_IN_NOT_POSSIBLE,
        REDEEM_ACCRUE_INTEREST_FAILED,
        REDEEM_COMPTROLLER_REJECTION,
        REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED,
        REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED,
        REDEEM_EXCHANGE_RATE_READ_FAILED,
        REDEEM_FRESHNESS_CHECK,
        REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED,
        REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,
        REDEEM_TRANSFER_OUT_NOT_POSSIBLE,
        REDUCE_RESERVES_ACCRUE_INTEREST_FAILED,
        REDUCE_RESERVES_ADMIN_CHECK,
        REDUCE_RESERVES_CASH_NOT_AVAILABLE,
        REDUCE_RESERVES_FRESH_CHECK,
        REDUCE_RESERVES_VALIDATION,
        REPAY_BEHALF_ACCRUE_INTEREST_FAILED,
        REPAY_BORROW_ACCRUE_INTEREST_FAILED,
        REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
        REPAY_BORROW_COMPTROLLER_REJECTION,
        REPAY_BORROW_FRESHNESS_CHECK,
        REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED,
        REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
        REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,
        SET_COLLATERAL_FACTOR_OWNER_CHECK,
        SET_COLLATERAL_FACTOR_VALIDATION,
        SET_COMPTROLLER_OWNER_CHECK,
        SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED,
        SET_INTEREST_RATE_MODEL_FRESH_CHECK,
        SET_INTEREST_RATE_MODEL_OWNER_CHECK,
        SET_MAX_ASSETS_OWNER_CHECK,
        SET_ORACLE_MARKET_NOT_LISTED,
        SET_PENDING_ADMIN_OWNER_CHECK,
        SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED,
        SET_RESERVE_FACTOR_ADMIN_CHECK,
        SET_RESERVE_FACTOR_FRESH_CHECK,
        SET_RESERVE_FACTOR_BOUNDS_CHECK,
        TRANSFER_COMPTROLLER_REJECTION,
        TRANSFER_NOT_ALLOWED,
        TRANSFER_NOT_ENOUGH,
        TRANSFER_TOO_MUCH,
        ADD_RESERVES_ACCRUE_INTEREST_FAILED,
        ADD_RESERVES_FRESH_CHECK,
        ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE
    }

    /**
      * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary
      * contract-specific code that enables us to report opaque error codes from upgradeable contracts.
      **/
    event Failure(uint error, uint info, uint detail);

    /**
      * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator
      */
    function fail(Error err, FailureInfo info) internal returns (uint) {
        emit Failure(uint(err), uint(info), 0);

        return uint(err);
    }

    /**
      * @dev use this when reporting an opaque error from an upgradeable collaborator contract
      */
    function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) {
        emit Failure(uint(err), uint(info), opaqueError);

        return uint(err);
    }
}

File 4 of 10 : Exponential.sol
pragma solidity ^0.5.16;

import "./CarefulMath.sol";
import "./ExponentialNoError.sol";

/**
 * @title Exponential module for storing fixed-precision decimals
 * @author Compound
 * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError
 * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.
 *         Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:
 *         `Exp({mantissa: 5100000000000000000})`.
 */
contract Exponential is CarefulMath, ExponentialNoError {
    /**
     * @dev Creates an exponential from numerator and denominator values.
     *      Note: Returns an error if (`num` * 10e18) > MAX_INT,
     *            or if `denom` is zero.
     */
    function getExp(uint num, uint denom) pure internal returns (MathError, Exp memory) {
        (MathError err0, uint scaledNumerator) = mulUInt(num, expScale);
        if (err0 != MathError.NO_ERROR) {
            return (err0, Exp({mantissa: 0}));
        }

        (MathError err1, uint rational) = divUInt(scaledNumerator, denom);
        if (err1 != MathError.NO_ERROR) {
            return (err1, Exp({mantissa: 0}));
        }

        return (MathError.NO_ERROR, Exp({mantissa: rational}));
    }

    /**
     * @dev Adds two exponentials, returning a new exponential.
     */
    function addExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) {
        (MathError error, uint result) = addUInt(a.mantissa, b.mantissa);

        return (error, Exp({mantissa: result}));
    }

    /**
     * @dev Subtracts two exponentials, returning a new exponential.
     */
    function subExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) {
        (MathError error, uint result) = subUInt(a.mantissa, b.mantissa);

        return (error, Exp({mantissa: result}));
    }

    /**
     * @dev Multiply an Exp by a scalar, returning a new Exp.
     */
    function mulScalar(Exp memory a, uint scalar) pure internal returns (MathError, Exp memory) {
        (MathError err0, uint scaledMantissa) = mulUInt(a.mantissa, scalar);
        if (err0 != MathError.NO_ERROR) {
            return (err0, Exp({mantissa: 0}));
        }

        return (MathError.NO_ERROR, Exp({mantissa: scaledMantissa}));
    }

    /**
     * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.
     */
    function mulScalarTruncate(Exp memory a, uint scalar) pure internal returns (MathError, uint) {
        (MathError err, Exp memory product) = mulScalar(a, scalar);
        if (err != MathError.NO_ERROR) {
            return (err, 0);
        }

        return (MathError.NO_ERROR, truncate(product));
    }

    /**
     * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.
     */
    function mulScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) pure internal returns (MathError, uint) {
        (MathError err, Exp memory product) = mulScalar(a, scalar);
        if (err != MathError.NO_ERROR) {
            return (err, 0);
        }

        return addUInt(truncate(product), addend);
    }

    /**
     * @dev Divide an Exp by a scalar, returning a new Exp.
     */
    function divScalar(Exp memory a, uint scalar) pure internal returns (MathError, Exp memory) {
        (MathError err0, uint descaledMantissa) = divUInt(a.mantissa, scalar);
        if (err0 != MathError.NO_ERROR) {
            return (err0, Exp({mantissa: 0}));
        }

        return (MathError.NO_ERROR, Exp({mantissa: descaledMantissa}));
    }

    /**
     * @dev Divide a scalar by an Exp, returning a new Exp.
     */
    function divScalarByExp(uint scalar, Exp memory divisor) pure internal returns (MathError, Exp memory) {
        /*
          We are doing this as:
          getExp(mulUInt(expScale, scalar), divisor.mantissa)

          How it works:
          Exp = a / b;
          Scalar = s;
          `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale`
        */
        (MathError err0, uint numerator) = mulUInt(expScale, scalar);
        if (err0 != MathError.NO_ERROR) {
            return (err0, Exp({mantissa: 0}));
        }
        return getExp(numerator, divisor.mantissa);
    }

    /**
     * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer.
     */
    function divScalarByExpTruncate(uint scalar, Exp memory divisor) pure internal returns (MathError, uint) {
        (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);
        if (err != MathError.NO_ERROR) {
            return (err, 0);
        }

        return (MathError.NO_ERROR, truncate(fraction));
    }

    /**
     * @dev Multiplies two exponentials, returning a new exponential.
     */
    function mulExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) {

        (MathError err0, uint doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);
        if (err0 != MathError.NO_ERROR) {
            return (err0, Exp({mantissa: 0}));
        }

        // We add half the scale before dividing so that we get rounding instead of truncation.
        //  See "Listing 6" and text above it at https://accu.org/index.php/journals/1717
        // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.
        (MathError err1, uint doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct);
        if (err1 != MathError.NO_ERROR) {
            return (err1, Exp({mantissa: 0}));
        }

        (MathError err2, uint product) = divUInt(doubleScaledProductWithHalfScale, expScale);
        // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero.
        assert(err2 == MathError.NO_ERROR);

        return (MathError.NO_ERROR, Exp({mantissa: product}));
    }

    /**
     * @dev Multiplies two exponentials given their mantissas, returning a new exponential.
     */
    function mulExp(uint a, uint b) pure internal returns (MathError, Exp memory) {
        return mulExp(Exp({mantissa: a}), Exp({mantissa: b}));
    }

    /**
     * @dev Multiplies three exponentials, returning a new exponential.
     */
    function mulExp3(Exp memory a, Exp memory b, Exp memory c) pure internal returns (MathError, Exp memory) {
        (MathError err, Exp memory ab) = mulExp(a, b);
        if (err != MathError.NO_ERROR) {
            return (err, ab);
        }
        return mulExp(ab, c);
    }

    /**
     * @dev Divides two exponentials, returning a new exponential.
     *     (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,
     *  which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)
     */
    function divExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) {
        return getExp(a.mantissa, b.mantissa);
    }
}

File 5 of 10 : EIP20Interface.sol
pragma solidity ^0.5.16;

/**
 * @title ERC 20 Token Standard Interface
 *  https://eips.ethereum.org/EIPS/eip-20
 */
interface EIP20Interface {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);

    /**
      * @notice Get the total number of tokens in circulation
      * @return The supply of tokens
      */
    function totalSupply() external view returns (uint256);

    /**
     * @notice Gets the balance of the specified address
     * @param owner The address from which the balance will be retrieved
     * @return The balance
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
      * @notice Transfer `amount` tokens from `msg.sender` to `dst`
      * @param dst The address of the destination account
      * @param amount The number of tokens to transfer
      * @return Whether or not the transfer succeeded
      */
    function transfer(address dst, uint256 amount) external returns (bool success);

    /**
      * @notice Transfer `amount` tokens from `src` to `dst`
      * @param src The address of the source account
      * @param dst The address of the destination account
      * @param amount The number of tokens to transfer
      * @return Whether or not the transfer succeeded
      */
    function transferFrom(address src, address dst, uint256 amount) external returns (bool success);

    /**
      * @notice Approve `spender` to transfer up to `amount` from `src`
      * @dev This will overwrite the approval amount for `spender`
      *  and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
      * @param spender The address of the account which may transfer tokens
      * @param amount The number of tokens that are approved (-1 means infinite)
      * @return Whether or not the approval succeeded
      */
    function approve(address spender, uint256 amount) external returns (bool success);

    /**
      * @notice Get the current allowance from `owner` for `spender`
      * @param owner The address of the account which owns the tokens to be spent
      * @param spender The address of the account which may transfer tokens
      * @return The number of tokens allowed to be spent (-1 means infinite)
      */
    function allowance(address owner, address spender) external view returns (uint256 remaining);

    event Transfer(address indexed from, address indexed to, uint256 amount);
    event Approval(address indexed owner, address indexed spender, uint256 amount);
}

File 6 of 10 : EIP20NonStandardInterface.sol
pragma solidity ^0.5.16;

/**
 * @title EIP20NonStandardInterface
 * @dev Version of ERC20 with no return values for `transfer` and `transferFrom`
 *  See https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
 */
interface EIP20NonStandardInterface {

    /**
     * @notice Get the total number of tokens in circulation
     * @return The supply of tokens
     */
    function totalSupply() external view returns (uint256);

    /**
     * @notice Gets the balance of the specified address
     * @param owner The address from which the balance will be retrieved
     * @return The balance
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    ///
    /// !!!!!!!!!!!!!!
    /// !!! NOTICE !!! `transfer` does not return a value, in violation of the ERC-20 specification
    /// !!!!!!!!!!!!!!
    ///

    /**
      * @notice Transfer `amount` tokens from `msg.sender` to `dst`
      * @param dst The address of the destination account
      * @param amount The number of tokens to transfer
      */
    function transfer(address dst, uint256 amount) external;

    ///
    /// !!!!!!!!!!!!!!
    /// !!! NOTICE !!! `transferFrom` does not return a value, in violation of the ERC-20 specification
    /// !!!!!!!!!!!!!!
    ///

    /**
      * @notice Transfer `amount` tokens from `src` to `dst`
      * @param src The address of the source account
      * @param dst The address of the destination account
      * @param amount The number of tokens to transfer
      */
    function transferFrom(address src, address dst, uint256 amount) external;

    /**
      * @notice Approve `spender` to transfer up to `amount` from `src`
      * @dev This will overwrite the approval amount for `spender`
      *  and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
      * @param spender The address of the account which may transfer tokens
      * @param amount The number of tokens that are approved
      * @return Whether or not the approval succeeded
      */
    function approve(address spender, uint256 amount) external returns (bool success);

    /**
      * @notice Get the current allowance from `owner` for `spender`
      * @param owner The address of the account which owns the tokens to be spent
      * @param spender The address of the account which may transfer tokens
      * @return The number of tokens allowed to be spent
      */
    function allowance(address owner, address spender) external view returns (uint256 remaining);

    event Transfer(address indexed from, address indexed to, uint256 amount);
    event Approval(address indexed owner, address indexed spender, uint256 amount);
}

File 7 of 10 : SafeMath.sol
pragma solidity ^0.5.16;

// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

        return c;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, errorMessage);

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers.
     * Reverts on division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers.
     * Reverts with custom message on division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

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

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

File 8 of 10 : IINV.sol
pragma solidity ^0.5.16;

interface IINV {
    function balanceOf(address) external view returns (uint);
    function transfer(address,uint) external returns (bool);
    function delegates(address) external view returns (address);
    function delegate(address) external;
}

File 9 of 10 : CarefulMath.sol
pragma solidity ^0.5.16;

/**
  * @title Careful Math
  * @author Compound
  * @notice Derived from OpenZeppelin's SafeMath library
  *         https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
  */
contract CarefulMath {

    /**
     * @dev Possible error codes that we can return
     */
    enum MathError {
        NO_ERROR,
        DIVISION_BY_ZERO,
        INTEGER_OVERFLOW,
        INTEGER_UNDERFLOW
    }

    /**
    * @dev Multiplies two numbers, returns an error on overflow.
    */
    function mulUInt(uint a, uint b) internal pure returns (MathError, uint) {
        if (a == 0) {
            return (MathError.NO_ERROR, 0);
        }

        uint c = a * b;

        if (c / a != b) {
            return (MathError.INTEGER_OVERFLOW, 0);
        } else {
            return (MathError.NO_ERROR, c);
        }
    }

    /**
    * @dev Integer division of two numbers, truncating the quotient.
    */
    function divUInt(uint a, uint b) internal pure returns (MathError, uint) {
        if (b == 0) {
            return (MathError.DIVISION_BY_ZERO, 0);
        }

        return (MathError.NO_ERROR, a / b);
    }

    /**
    * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).
    */
    function subUInt(uint a, uint b) internal pure returns (MathError, uint) {
        if (b <= a) {
            return (MathError.NO_ERROR, a - b);
        } else {
            return (MathError.INTEGER_UNDERFLOW, 0);
        }
    }

    /**
    * @dev Adds two numbers, returns an error on overflow.
    */
    function addUInt(uint a, uint b) internal pure returns (MathError, uint) {
        uint c = a + b;

        if (c >= a) {
            return (MathError.NO_ERROR, c);
        } else {
            return (MathError.INTEGER_OVERFLOW, 0);
        }
    }

    /**
    * @dev add a and b and then subtract c
    */
    function addThenSubUInt(uint a, uint b, uint c) internal pure returns (MathError, uint) {
        (MathError err0, uint sum) = addUInt(a, b);

        if (err0 != MathError.NO_ERROR) {
            return (err0, 0);
        }

        return subUInt(sum, c);
    }
}

File 10 of 10 : ExponentialNoError.sol
pragma solidity ^0.5.16;

/**
 * @title Exponential module for storing fixed-precision decimals
 * @author Compound
 * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.
 *         Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:
 *         `Exp({mantissa: 5100000000000000000})`.
 */
contract ExponentialNoError {
    uint constant expScale = 1e18;
    uint constant doubleScale = 1e36;
    uint constant halfExpScale = expScale/2;
    uint constant mantissaOne = expScale;

    struct Exp {
        uint mantissa;
    }

    struct Double {
        uint mantissa;
    }

    /**
     * @dev Truncates the given exp to a whole number value.
     *      For example, truncate(Exp{mantissa: 15 * expScale}) = 15
     */
    function truncate(Exp memory exp) pure internal returns (uint) {
        // Note: We are not using careful math here as we're performing a division that cannot fail
        return exp.mantissa / expScale;
    }

    /**
     * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer.
     */
    function mul_ScalarTruncate(Exp memory a, uint scalar) pure internal returns (uint) {
        Exp memory product = mul_(a, scalar);
        return truncate(product);
    }

    /**
     * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.
     */
    function mul_ScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) pure internal returns (uint) {
        Exp memory product = mul_(a, scalar);
        return add_(truncate(product), addend);
    }

    /**
     * @dev Checks if first Exp is less than second Exp.
     */
    function lessThanExp(Exp memory left, Exp memory right) pure internal returns (bool) {
        return left.mantissa < right.mantissa;
    }

    /**
     * @dev Checks if left Exp <= right Exp.
     */
    function lessThanOrEqualExp(Exp memory left, Exp memory right) pure internal returns (bool) {
        return left.mantissa <= right.mantissa;
    }

    /**
     * @dev Checks if left Exp > right Exp.
     */
    function greaterThanExp(Exp memory left, Exp memory right) pure internal returns (bool) {
        return left.mantissa > right.mantissa;
    }

    /**
     * @dev returns true if Exp is exactly zero
     */
    function isZeroExp(Exp memory value) pure internal returns (bool) {
        return value.mantissa == 0;
    }

    function safe224(uint n, string memory errorMessage) pure internal returns (uint224) {
        require(n < 2**224, errorMessage);
        return uint224(n);
    }

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

    function add_(Exp memory a, Exp memory b) pure internal returns (Exp memory) {
        return Exp({mantissa: add_(a.mantissa, b.mantissa)});
    }

    function add_(Double memory a, Double memory b) pure internal returns (Double memory) {
        return Double({mantissa: add_(a.mantissa, b.mantissa)});
    }

    function add_(uint a, uint b) pure internal returns (uint) {
        return add_(a, b, "addition overflow");
    }

    function add_(uint a, uint b, string memory errorMessage) pure internal returns (uint) {
        uint c = a + b;
        require(c >= a, errorMessage);
        return c;
    }

    function sub_(Exp memory a, Exp memory b) pure internal returns (Exp memory) {
        return Exp({mantissa: sub_(a.mantissa, b.mantissa)});
    }

    function sub_(Double memory a, Double memory b) pure internal returns (Double memory) {
        return Double({mantissa: sub_(a.mantissa, b.mantissa)});
    }

    function sub_(uint a, uint b) pure internal returns (uint) {
        return sub_(a, b, "subtraction underflow");
    }

    function sub_(uint a, uint b, string memory errorMessage) pure internal returns (uint) {
        require(b <= a, errorMessage);
        return a - b;
    }

    function mul_(Exp memory a, Exp memory b) pure internal returns (Exp memory) {
        return Exp({mantissa: mul_(a.mantissa, b.mantissa) / expScale});
    }

    function mul_(Exp memory a, uint b) pure internal returns (Exp memory) {
        return Exp({mantissa: mul_(a.mantissa, b)});
    }

    function mul_(uint a, Exp memory b) pure internal returns (uint) {
        return mul_(a, b.mantissa) / expScale;
    }

    function mul_(Double memory a, Double memory b) pure internal returns (Double memory) {
        return Double({mantissa: mul_(a.mantissa, b.mantissa) / doubleScale});
    }

    function mul_(Double memory a, uint b) pure internal returns (Double memory) {
        return Double({mantissa: mul_(a.mantissa, b)});
    }

    function mul_(uint a, Double memory b) pure internal returns (uint) {
        return mul_(a, b.mantissa) / doubleScale;
    }

    function mul_(uint a, uint b) pure internal returns (uint) {
        return mul_(a, b, "multiplication overflow");
    }

    function mul_(uint a, uint b, string memory errorMessage) pure internal returns (uint) {
        if (a == 0 || b == 0) {
            return 0;
        }
        uint c = a * b;
        require(c / a == b, errorMessage);
        return c;
    }

    function div_(Exp memory a, Exp memory b) pure internal returns (Exp memory) {
        return Exp({mantissa: div_(mul_(a.mantissa, expScale), b.mantissa)});
    }

    function div_(Exp memory a, uint b) pure internal returns (Exp memory) {
        return Exp({mantissa: div_(a.mantissa, b)});
    }

    function div_(uint a, Exp memory b) pure internal returns (uint) {
        return div_(mul_(a, expScale), b.mantissa);
    }

    function div_(Double memory a, Double memory b) pure internal returns (Double memory) {
        return Double({mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa)});
    }

    function div_(Double memory a, uint b) pure internal returns (Double memory) {
        return Double({mantissa: div_(a.mantissa, b)});
    }

    function div_(uint a, Double memory b) pure internal returns (uint) {
        return div_(mul_(a, doubleScale), b.mantissa);
    }

    function div_(uint a, uint b) pure internal returns (uint) {
        return div_(a, b, "divide by zero");
    }

    function div_(uint a, uint b, string memory errorMessage) pure internal returns (uint) {
        require(b > 0, errorMessage);
        return a / b;
    }

    function fraction(uint a, uint b) pure internal returns (Double memory) {
        return Double({mantissa: div_(mul_(a, doubleScale), b)});
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"underlying_","type":"address"},{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"uint256","name":"rewardPerBlock_","type":"uint256"},{"internalType":"address","name":"rewardTreasury_","type":"address"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"address payable","name":"admin_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"error","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"info","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"detail","type":"uint256"}],"name":"Failure","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract ComptrollerInterface","name":"oldComptroller","type":"address"},{"indexed":false,"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPendingAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"NewPendingAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRewardPerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRewardPerBlock","type":"uint256"}],"name":"NewRewardPerBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRewardTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"newRewardTreasury","type":"address"}],"name":"NewRewardTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract TimelockEscrow","name":"oldTimelockEscrow","type":"address"},{"indexed":false,"internalType":"contract TimelockEscrow","name":"newTimelockEscrow","type":"address"}],"name":"NewTimelockEscrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DELEGATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"_acceptAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newRewardPerBlock","type":"uint256"}],"name":"_setRewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newRewardTreasury","type":"address"}],"name":"_setRewardTreasury","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract TimelockEscrow","name":"newTimelockEscrow","type":"address"}],"name":"_setTimelockEscrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpoints","outputs":[{"internalType":"uint32","name":"fromBlock","type":"uint32"},{"internalType":"uint96","name":"votes","type":"uint96"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"escrow","outputs":[{"internalType":"contract TimelockEscrow","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCurrentVotes","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPriorVotes","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isCToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b5060405162004bb638038062004bb683398181016040526101008110156200003857600080fd5b81516020830151604080850151606086015160808701805193519597949692959194919392820192846401000000008211156200007457600080fd5b9083019060208201858111156200008a57600080fd5b8251640100000000811182820188101715620000a557600080fd5b82525081516020918201929091019080838360005b83811015620000d4578181015183820152602001620000ba565b50505050905090810190601f168015620001025780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200012657600080fd5b9083019060208201858111156200013c57600080fd5b82516401000000008111828201881017156200015757600080fd5b82525081516020918201929091019080838360005b83811015620001865781810151838201526020016200016c565b50505050905090810190601f168015620001b45780820380516001836020036101000a031916815260200191505b506040908152602082810151929091015160038054610100600160a81b03191633610100021790559193509091506200020c908890670de0b6b3a764000090899089908990899089906200032d811b6200367b17901c565b601080546001600160a01b0319166001600160a01b038a81169190911791829055604080516318160ddd60e01b8152905192909116916318160ddd91600480820192602092909190829003018186803b1580156200026957600080fd5b505afa1580156200027e573d6000803e3d6000fd5b505050506040513d60208110156200029557600080fd5b505060038054610100600160a81b0319166101006001600160a01b0384160217905560405188908290620002c990620006cc565b6001600160a01b03928316815291166020820152604080519182900301906000f080158015620002fd573d6000803e3d6000fd5b50601180546001600160a01b0319166001600160a01b0392909216919091179055506200077c9650505050505050565b60035461010090046001600160a01b031633146200037d5760405162461bcd60e51b815260040180806020018281038252602481526020018062004b3f6024913960400191505060405180910390fd5b60075415620003be5760405162461bcd60e51b815260040180806020018281038252602381526020018062004b636023913960400191505060405180910390fd5b600686905585620004015760405162461bcd60e51b815260040180806020018281038252603081526020018062004b866030913960400191505060405180910390fd5b600062000417886001600160e01b03620004f016565b905080156200046d576040805162461bcd60e51b815260206004820152601a60248201527f73657474696e6720636f6d7074726f6c6c6572206661696c6564000000000000604482015290519081900360640190fd5b835162000482906001906020870190620006da565b50825162000498906002906020860190620006da565b506003805460ff191660ff8416179055620004b262000657565b600755505050600992909255600a80546001600160a01b0319166001600160a01b039290921691909117905550506000805460ff1916600117905550565b60035460009061010090046001600160a01b031633146200052a57620005226001603f6001600160e01b036200065c16565b905062000652565b60055460408051623f1ee960e11b815290516001600160a01b0392831692851691627e3dd2916004808301926020929190829003018186803b1580156200057057600080fd5b505afa15801562000585573d6000803e3d6000fd5b505050506040513d60208110156200059c57600080fd5b5051620005f0576040805162461bcd60e51b815260206004820152601c60248201527f6d61726b6572206d6574686f642072657475726e65642066616c736500000000604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b03858116918217909255604080519284168352602083019190915280517f7ac369dbd14fa5ea3f473ed67cc9d598964a77501540ba6751eb0b3decf5870d9281900390910190a160009150505b919050565b435b90565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360108111156200068c57fe5b8360508111156200069957fe5b604080519283526020830191909152600082820152519081900360600190a1826010811115620006c557fe5b9392505050565b6107a8806200439783390190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200071d57805160ff19168380011785556200074d565b828001600101855582156200074d579182015b828111156200074d57825182559160200191906001019062000730565b506200075b9291506200075f565b5090565b6200065991905b808211156200075b576000815560010162000766565b613c0b806200078c6000396000f3fe608060405234801561001057600080fd5b50600436106102485760003560e01c8063852a12e31161013b578063c37f68e2116100b8578063e7a324dc1161007c578063e7a324dc146106c8578063e9c714f2146106d0578063f1127ed8146106d8578063f851a44014610732578063fe9c44ae1461073a57610248565b8063c37f68e214610608578063c3cda52014610654578063c7c934a11461069b578063db006a75146106a3578063e2fdcc17146106c057610248565b8063a6afed95116100ff578063a6afed9514610576578063b2a02ff11461057e578063b4b5ea57146105b4578063b71d1a0c146105da578063bd6d894d1461060057610248565b8063852a12e31461050f5780638aa1c05f1461052c5780638ae39cac1461054957806395d89b4114610551578063a0712d681461055957610248565b80634576b5db116101c95780636f307dc31161018d5780636f307dc3146104345780636fcfff451461043c57806370a082311461047b578063782d6fe1146104a15780637ecebe00146104e957610248565b80634576b5db146103b0578063587cde1e146103d65780635c19a95c146103fc5780635fe3b567146104245780636c540baf1461042c57610248565b806320606b701161021057806320606b70146103385780632678224714610340578063313ce567146103645780633af9e669146103825780633b1d21a2146103a857610248565b806306fdde031461024d5780630c19dc3a146102ca57806317c50d061461030257806318160ddd14610328578063182df0f514610330575b600080fd5b610255610756565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028f578181015183820152602001610277565b50505050905090810190601f1680156102bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102f0600480360360208110156102e057600080fd5b50356001600160a01b03166107e3565b60408051918252519081900360200190f35b6102f06004803603602081101561031857600080fd5b50356001600160a01b0316610929565b6102f06109b4565b6102f06109ba565b6102f0610a1d565b610348610a38565b604080516001600160a01b039092168252519081900360200190f35b61036c610a47565b6040805160ff9092168252519081900360200190f35b6102f06004803603602081101561039857600080fd5b50356001600160a01b0316610a50565b6102f0610b06565b6102f0600480360360208110156103c657600080fd5b50356001600160a01b0316610b15565b610348600480360360208110156103ec57600080fd5b50356001600160a01b0316610c63565b6104226004803603602081101561041257600080fd5b50356001600160a01b0316610c7e565b005b610348610c8b565b6102f0610c9a565b610348610ca0565b6104626004803603602081101561045257600080fd5b50356001600160a01b0316610caf565b6040805163ffffffff9092168252519081900360200190f35b6102f06004803603602081101561049157600080fd5b50356001600160a01b0316610cc7565b6104cd600480360360408110156104b757600080fd5b506001600160a01b038135169060200135610ce2565b604080516001600160601b039092168252519081900360200190f35b6102f0600480360360208110156104ff57600080fd5b50356001600160a01b0316610f10565b6102f06004803603602081101561052557600080fd5b5035610f22565b6102f06004803603602081101561054257600080fd5b5035610f2f565b6102f0610f9e565b610255610fa4565b6102f06004803603602081101561056f57600080fd5b5035610ffc565b6102f06110c2565b6102f06004803603606081101561059457600080fd5b506001600160a01b03813581169160208101359091169060400135611232565b6104cd600480360360208110156105ca57600080fd5b50356001600160a01b03166112a3565b6102f0600480360360208110156105f057600080fd5b50356001600160a01b0316611315565b6102f06113a1565b61062e6004803603602081101561061e57600080fd5b50356001600160a01b031661145d565b604080519485526020850193909352838301919091526060830152519081900360800190f35b610422600480360360c081101561066a57600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a001356114ca565b61034861179b565b6102f0600480360360208110156106b957600080fd5b50356117aa565b6103486117b7565b6102f06117c6565b6102f06117e1565b61070a600480360360408110156106ee57600080fd5b5080356001600160a01b0316906020013563ffffffff166118e4565b6040805163ffffffff90931683526001600160601b0390911660208301528051918290030190f35b610348611919565b61074261192d565b604080519115158252519081900360200190f35b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107db5780601f106107b0576101008083540402835291602001916107db565b820191906000526020600020905b8154815290600101906020018083116107be57829003601f168201915b505050505081565b6000306001600160a01b0316826001600160a01b03166380f556056040518163ffffffff1660e01b815260040160206040518083038186803b15801561082857600080fd5b505afa15801561083c573d6000803e3d6000fd5b505050506040513d602081101561085257600080fd5b50516001600160a01b0316146108995760405162461bcd60e51b8152600401808060200182810382526034815260200180613a116034913960400191505060405180910390fd5b60035461010090046001600160a01b031633146108c3576108bc6001603f611932565b9050610924565b601180546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517f8a0324ea550ac953d4515436f05889f90a816b559ca26ee450b104d4d5a248fa929181900390910190a1505b919050565b60035460009061010090046001600160a01b0316331461094f576108bc6001603f611932565b600a80546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517f2856afeddd63e06a55f7d242638b9ce830a95d17f6ac86997a9acd7de2761628929181900390910190a150919050565b60085481565b60008060006109c7611998565b909250905060008260038111156109da57fe5b14610a165760405162461bcd60e51b8152600401808060200182810382526035815260200180613a9d6035913960400191505060405180910390fd5b9150505b90565b6040518060436139ad82396043019050604051809103902081565b6004546001600160a01b031681565b60035460ff1681565b6000610a5a613613565b6040518060200160405280610a6d6113a1565b90526001600160a01b0384166000908152600b6020526040812054919250908190610a99908490611a0d565b90925090506000826003811115610aac57fe5b14610afe576040805162461bcd60e51b815260206004820152601f60248201527f62616c616e636520636f756c64206e6f742062652063616c63756c6174656400604482015290519081900360640190fd5b949350505050565b6000610b10611a61565b905090565b60035460009061010090046001600160a01b03163314610b3b576108bc6001603f611932565b60055460408051623f1ee960e11b815290516001600160a01b0392831692851691627e3dd2916004808301926020929190829003018186803b158015610b8057600080fd5b505afa158015610b94573d6000803e3d6000fd5b505050506040513d6020811015610baa57600080fd5b5051610bfd576040805162461bcd60e51b815260206004820152601c60248201527f6d61726b6572206d6574686f642072657475726e65642066616c736500000000604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b03858116918217909255604080519284168352602083019190915280517f7ac369dbd14fa5ea3f473ed67cc9d598964a77501540ba6751eb0b3decf5870d9281900390910190a160005b9392505050565b600c602052600090815260409020546001600160a01b031681565b610c883382611ae1565b50565b6005546001600160a01b031681565b60075481565b6010546001600160a01b031681565b600e6020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600b602052604090205490565b6000438210610d225760405162461bcd60e51b81526004018080602001828103825260268152602001806139066026913960400191505060405180910390fd5b6001600160a01b0383166000908152600e602052604090205463ffffffff1680610d50576000915050610f0a565b6001600160a01b0384166000908152600d6020908152604080832063ffffffff600019860181168552925290912054168310610dcc576001600160a01b0384166000908152600d602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b03169050610f0a565b6001600160a01b0384166000908152600d6020908152604080832083805290915290205463ffffffff16831015610e07576000915050610f0a565b600060001982015b8163ffffffff168163ffffffff161115610eca57600282820363ffffffff16048103610e39613626565b506001600160a01b0387166000908152600d6020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610ea557602001519450610f0a9350505050565b805163ffffffff16871115610ebc57819350610ec3565b6001820392505b5050610e0f565b506001600160a01b0385166000908152600d6020908152604080832063ffffffff909416835292905220546001600160601b03600160201b909104169150505b92915050565b600f6020526000908152604090205481565b6000610f0a826001611b61565b60035460009061010090046001600160a01b03163314610f55576108bc6001603f611932565b6009805490839055604080518281526020810185905281517f3b7a406bf2b66d0f83f6b1cf4c39edf1269cad80712b94cd80a44d13f61f1357929181900390910190a150919050565b60095481565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156107db5780601f106107b0576101008083540402835291602001916107db565b60008061100883611c02565b50336000908152600c60205260409020549091506001600160a01b0316610f0a5760105460408051632c3e6f0f60e11b815233600482015290516000926001600160a01b03169163587cde1e916024808301926020929190829003018186803b15801561107457600080fd5b505afa158015611088573d6000803e3d6000fd5b505050506040513d602081101561109e57600080fd5b505190506001600160a01b038116156110bb576110bb3382611ae1565b5092915050565b6000806110cd611caa565b600754909150808214156110e657600092505050610a1a565b6000806110f38484611cae565b9092509050600082600381111561110657fe5b14611158576040805162461bcd60e51b815260206004820152601f60248201527f636f756c64206e6f742063616c63756c61746520626c6f636b2064656c746100604482015290519081900360640190fd5b600061116660095483611cd1565b9093509050600083600381111561117957fe5b146111cb576040805162461bcd60e51b815260206004820152601a60248201527f636f756c64206e6f742063616c63756c61746520726577617264000000000000604482015290519081900360640190fd5b60006008541180156111e75750600a546001600160a01b031615155b80156112045750600a54611204906001600160a01b031682611d10565b1561122157600a5461121f906001600160a01b031682611e2f565b505b600785905560009550505050505090565b6000805460ff16611277576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff1916905561128d33858585612079565b90506000805460ff191660011790559392505050565b6001600160a01b0381166000908152600e602052604081205463ffffffff16806112ce576000610c5c565b6001600160a01b0383166000908152600d6020908152604080832063ffffffff60001986011684529091529020546001600160601b03600160201b90910416915050919050565b60035460009061010090046001600160a01b0316331461133b576108bc60016045611932565b600480546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a16000610c5c565b6000805460ff166113e6576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff191681556113f86110c2565b14611443576040805162461bcd60e51b81526020600482015260166024820152751858d8dc9d59481a5b9d195c995cdd0819985a5b195960521b604482015290519081900360640190fd5b61144b6109ba565b90506000805460ff1916600117905590565b6001600160a01b0381166000908152600b60205260408120548190819081908180611486611998565b92509050600081600381111561149857fe5b146114b45760099650600095508594508493506114c392505050565b60009650919450600093509150505b9193509193565b600060405180806139ad6043913960430190506040518091039020600160405180828054600181600116156101000203166002900480156115425780601f10611520576101008083540402835291820191611542565b820191906000526020600020905b81548152906001019060200180831161152e575b50509150506040518091039020611557612310565b3060405160200180858152602001848152602001838152602001826001600160a01b03166001600160a01b0316815260200194505050505060405160208183030381529060405280519060200120905060006040518080613afa603a91396040805191829003603a0182206020808401919091526001600160a01b038c1683830152606083018b905260808084018b90528251808503909101815260a08401835280519082012061190160f01b60c085015260c2840187905260e2808501829052835180860390910181526101028501808552815191840191909120600091829052610122860180865281905260ff8c1661014287015261016286018b905261018286018a9052935191965092945091926001926101a28083019392601f198301929081900390910190855afa158015611695573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166116e75760405162461bcd60e51b8152600401808060200182810382526025815260200180613a786025913960400191505060405180910390fd5b6001600160a01b0381166000908152600f6020526040902080546001810190915589146117455760405162461bcd60e51b81526004018080602001828103825260218152602001806139f06021913960400191505060405180910390fd5b874211156117845760405162461bcd60e51b8152600401808060200182810382526025815260200180613b686025913960400191505060405180910390fd5b61178e818b611ae1565b505050505b505050505050565b600a546001600160a01b031681565b6000610f0a826001612314565b6011546001600160a01b031681565b60405180603a613afa8239603a019050604051809103902081565b6004546000906001600160a01b0316331415806117fc575033155b156118145761180d60016000611932565b9050610a1a565b60038054600480546001600160a01b03818116610100818102610100600160a81b0319871617968790556001600160a01b031990931690935560408051948390048216808652929095041660208401528351909391927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600454604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a160009250505090565b600d60209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b60035461010090046001600160a01b031681565b600181565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa083601081111561196157fe5b83605081111561196d57fe5b604080519283526020830191909152600082820152519081900360600190a1826010811115610c5c57fe5b6008546000908190806119b357505060065460009150611a09565b60006119bd611a61565b90506119c7613613565b60006119d3838561238f565b9250905060008160038111156119e557fe5b146119f957945060009350611a0992505050565b5051600094509250611a09915050565b9091565b6000806000611a1a613613565b611a24868661243f565b90925090506000826003811115611a3757fe5b14611a485750915060009050611a5a565b6000611a53826124a7565b9350935050505b9250929050565b601054604080516370a0823160e01b815230600482015290516000926001600160a01b03169182916370a0823191602480820192602092909190829003018186803b158015611aaf57600080fd5b505afa158015611ac3573d6000803e3d6000fd5b505050506040513d6020811015611ad957600080fd5b505191505090565b6001600160a01b038083166000818152600c602081815260408084208054600b845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4611b5b8284836124b6565b50505050565b6000805460ff16611ba6576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff19168155611bb86110c2565b90508015611bde57611bd6816010811115611bcf57fe5b6027611932565b915050611bef565b611beb336000868661264d565b9150505b6000805460ff1916600117905592915050565b60008054819060ff16611c49576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff19168155611c5b6110c2565b90508015611c8657611c79816010811115611c7257fe5b601e611932565b925060009150611c969050565b611c903385612b14565b92509250505b6000805460ff191660011790559092909150565b4390565b600080838311611cc5575060009050818303611a5a565b50600390506000611a5a565b60008083611ce457506000905080611a5a565b83830283858281611cf157fe5b0414611d0557506002915060009050611a5a565b600092509050611a5a565b601054604080516370a0823160e01b81526001600160a01b03858116600483015291516000939290921691839183916370a0823191602480820192602092909190829003018186803b158015611d6557600080fd5b505afa158015611d79573d6000803e3d6000fd5b505050506040513d6020811015611d8f57600080fd5b505160408051636eb1769f60e11b81526001600160a01b03888116600483015230602483015291519293506000929185169163dd62ed3e91604480820192602092909190829003018186803b158015611de757600080fd5b505afa158015611dfb573d6000803e3d6000fd5b505050506040513d6020811015611e1157600080fd5b50519050848210801590611e255750848110155b9695505050505050565b601054604080516370a0823160e01b815230600482015290516000926001600160a01b031691839183916370a08231916024808301926020929190829003018186803b158015611e7e57600080fd5b505afa158015611e92573d6000803e3d6000fd5b505050506040513d6020811015611ea857600080fd5b5051604080516323b872dd60e01b81526001600160a01b038881166004830152306024830152604482018890529151929350908416916323b872dd9160648082019260009290919082900301818387803b158015611f0557600080fd5b505af1158015611f19573d6000803e3d6000fd5b5050505060003d60008114611f355760208114611f3f57600080fd5b6000199150611f4b565b60206000803e60005191505b5080611f9e576040805162461bcd60e51b815260206004820152601860248201527f544f4b454e5f5452414e534645525f494e5f4641494c45440000000000000000604482015290519081900360640190fd5b601054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611fe957600080fd5b505afa158015611ffd573d6000803e3d6000fd5b505050506040513d602081101561201357600080fd5b505190508281101561206c576040805162461bcd60e51b815260206004820152601a60248201527f544f4b454e5f5452414e534645525f494e5f4f564552464c4f57000000000000604482015290519081900360640190fd5b9190910395945050505050565b6005546040805163d02f735160e01b81523060048201526001600160a01b038781166024830152868116604483015285811660648301526084820185905291516000938493169163d02f73519160a480830192602092919082900301818787803b1580156120e657600080fd5b505af11580156120fa573d6000803e3d6000fd5b505050506040513d602081101561211057600080fd5b50519050801561212f576121276003601b83612fbf565b915050610afe565b846001600160a01b0316846001600160a01b03161415612155576121276006601c611932565b6001600160a01b0384166000908152600b60205260408120548190819061217c9087611cae565b9093509150600083600381111561218f57fe5b146121b7576121ac6009601a8560038111156121a757fe5b612fbf565b945050505050610afe565b6001600160a01b0388166000908152600b60205260409020546121da9087613025565b909350905060008360038111156121ed57fe5b14612205576121ac600960198560038111156121a757fe5b6001600160a01b038088166000818152600b60209081526040808320879055938c168083529184902085905583518a8152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a36122708789886124b6565b60055460408051636d35bf9160e01b81523060048201526001600160a01b038c811660248301528b811660448301528a81166064830152608482018a905291519190921691636d35bf919160a480830192600092919082900301818387803b1580156122db57600080fd5b505af11580156122ef573d6000803e3d6000fd5b50505050612300888760008061264d565b5060009998505050505050505050565b4690565b6000805460ff16612359576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff1916815561236b6110c2565b9050801561238257611bd6816010811115611bcf57fe5b611beb338560008661264d565b6000612399613613565b6000806123ae86670de0b6b3a7640000611cd1565b909250905060008260038111156123c157fe5b146123e057506040805160208101909152600081529092509050611a5a565b6000806123ed838861304b565b9092509050600082600381111561240057fe5b1461242257506040805160208101909152600081529094509250611a5a915050565b604080516020810190915290815260009890975095505050505050565b6000612449613613565b60008061245a866000015186611cd1565b9092509050600082600381111561246d57fe5b1461248c57506040805160208101909152600081529092509050611a5a565b60408051602081019091529081526000969095509350505050565b51670de0b6b3a7640000900490565b816001600160a01b0316836001600160a01b0316141580156124e157506000816001600160601b0316115b15612648576001600160a01b03831615612599576001600160a01b0383166000908152600e602052604081205463ffffffff169081612521576000612560565b6001600160a01b0385166000908152600d60209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006125878285604051806060016040528060278152602001613bb060279139613076565b905061259586848484613120565b5050505b6001600160a01b03821615612648576001600160a01b0382166000908152600e602052604081205463ffffffff1690816125d4576000612613565b6001600160a01b0384166000908152600d60209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061263a828560405180606001604052806026815260200161392c602691396132df565b905061179385848484613120565b505050565b600083158061265a575082155b6126955760405162461bcd60e51b8152600401808060200182810382526034815260200180613b346034913960400191505060405180910390fd5b61269d61363d565b6126a5611998565b60408301819052602083018260038111156126bc57fe5b60038111156126c757fe5b90525060009050816020015160038111156126de57fe5b146126fa576121276009602b836020015160038111156121a757fe5b841561277b5760608101859052604080516020810182529082015181526127219086611a0d565b608083018190526020830182600381111561273857fe5b600381111561274357fe5b905250600090508160200151600381111561275a57fe5b146127765761212760096029836020015160038111156121a757fe5b6127f4565b6127978460405180602001604052808460400151815250613349565b60608301819052602083018260038111156127ae57fe5b60038111156127b957fe5b90525060009050816020015160038111156127d057fe5b146127ec576121276009602a836020015160038111156121a757fe5b608081018490525b60055460608201516040805163eabe7d9160e01b81523060048201526001600160a01b038a8116602483015260448201939093529051600093929092169163eabe7d919160648082019260209290919082900301818787803b15801561285957600080fd5b505af115801561286d573d6000803e3d6000fd5b505050506040513d602081101561288357600080fd5b5051905080156128a35761289a6003602883612fbf565b92505050610afe565b6128b36008548360600151611cae565b60a08401819052602084018260038111156128ca57fe5b60038111156128d557fe5b90525060009050826020015160038111156128ec57fe5b146129085761289a6009602e846020015160038111156121a757fe5b6001600160a01b0387166000908152600b602052604090205460608301516129309190611cae565b60c084018190526020840182600381111561294757fe5b600381111561295257fe5b905250600090508260200151600381111561296957fe5b146129855761289a6009602d846020015160038111156121a757fe5b8160800151612992611a61565b10156129a45761289a600e602f611932565b6129b387836080015186613360565b60a082015160085560c08201516001600160a01b0388166000818152600b60209081526040918290209390935560608501518151908152905130937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a36080820151606080840151604080516001600160a01b038c168152602081019490945283810191909152517fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a9299281900390910190a1612a7b87600084606001516124b6565b60055460808301516060840151604080516351dff98960e01b81523060048201526001600160a01b038c81166024830152604482019490945260648101929092525191909216916351dff98991608480830192600092919082900301818387803b158015612ae857600080fd5b505af1158015612afc573d6000803e3d6000fd5b5060009250612b09915050565b979650505050505050565b60055460408051634ef4c3e160e01b81523060048201526001600160a01b03858116602483015260448201859052915160009384938493911691634ef4c3e19160648082019260209290919082900301818787803b158015612b7557600080fd5b505af1158015612b89573d6000803e3d6000fd5b505050506040513d6020811015612b9f57600080fd5b505190508015612bc357612bb66003601f83612fbf565b925060009150611a5a9050565b612bcb61363d565b612bd3611998565b6040830181905260208301826003811115612bea57fe5b6003811115612bf557fe5b9052506000905081602001516003811115612c0c57fe5b14612c3657612c2860096021836020015160038111156121a757fe5b935060009250611a5a915050565b612c408686611e2f565b60c0820181905260408051602081018252908301518152612c619190613349565b6060830181905260208301826003811115612c7857fe5b6003811115612c8357fe5b9052506000905081602001516003811115612c9a57fe5b14612cec576040805162461bcd60e51b815260206004820181905260248201527f4d494e545f45584348414e47455f43414c43554c4154494f4e5f4641494c4544604482015290519081900360640190fd5b612cfc6008548260600151613025565b6080830181905260208301826003811115612d1357fe5b6003811115612d1e57fe5b9052506000905081602001516003811115612d3557fe5b14612d715760405162461bcd60e51b8152600401808060200182810382526028815260200180613ad26028913960400191505060405180910390fd5b600160601b816080015110612db75760405162461bcd60e51b8152600401808060200182810382526023815260200180613b8d6023913960400191505060405180910390fd5b6001600160a01b0386166000908152600b60205260409020546060820151612ddf9190613025565b60a0830181905260208301826003811115612df657fe5b6003811115612e0157fe5b9052506000905081602001516003811115612e1857fe5b14612e545760405162461bcd60e51b815260040180806020018281038252602b815260200180613982602b913960400191505060405180910390fd5b608081015160085560a08101516001600160a01b0387166000818152600b60209081526040918290209390935560c084015160608086015183519485529484019190915282820193909352517f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f929181900390910190a1606081015160408051918252516001600160a01b0388169130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3612f1f60008783606001516124b6565b60055460c08201516060830151604080516341c728b960e01b81523060048201526001600160a01b038b81166024830152604482019490945260648101929092525191909216916341c728b991608480830192600092919082900301818387803b158015612f8c57600080fd5b505af1158015612fa0573d6000803e3d6000fd5b5060009250612fad915050565b8160c001519350935050509250929050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0846010811115612fee57fe5b846050811115612ffa57fe5b604080519283526020830191909152818101859052519081900360600190a1836010811115610afe57fe5b60008083830184811061303d57600092509050611a5a565b506002915060009050611a5a565b6000808261305f5750600190506000611a5a565b600083858161306a57fe5b04915091509250929050565b6000836001600160601b0316836001600160601b0316111582906131185760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156130dd5781810151838201526020016130c5565b50505050905090810190601f16801561310a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600061314443604051806060016040528060338152602001613a4560339139613557565b905060008463ffffffff1611801561318d57506001600160a01b0385166000908152600d6020908152604080832063ffffffff6000198901811685529252909120548282169116145b156131ec576001600160a01b0385166000908152600d60209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b0385160217905561328b565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600d83528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600e90935292909220805460018801909316929091169190911790555b604080516001600160601b0380861682528416602082015281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b6000838301826001600160601b0380871690831610156133405760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156130dd5781810151838201526020016130c5565b50949350505050565b6000806000613356613613565b611a2486866135b4565b6010546001600160a01b031681156133e4576011546040805163a9059cbb60e01b81526001600160a01b0392831660048201526024810186905290519183169163a9059cbb9160448082019260009290919082900301818387803b1580156133c757600080fd5b505af11580156133db573d6000803e3d6000fd5b5050505061345d565b806001600160a01b031663a9059cbb85856040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561344457600080fd5b505af1158015613458573d6000803e3d6000fd5b505050505b60003d8015613473576020811461347d57600080fd5b6000199150613489565b60206000803e60005191505b50806134dc576040805162461bcd60e51b815260206004820152601960248201527f544f4b454e5f5452414e534645525f4f55545f4641494c454400000000000000604482015290519081900360640190fd5b8215613550576011546040805163177ead8360e11b81526001600160a01b0388811660048301526024820188905291519190921691632efd5b0691604480830192600092919082900301818387803b15801561353757600080fd5b505af115801561354b573d6000803e3d6000fd5b505050505b5050505050565b600081600160201b84106135ac5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156130dd5781810151838201526020016130c5565b509192915050565b60006135be613613565b6000806135d3670de0b6b3a764000087611cd1565b909250905060008260038111156135e657fe5b1461360557506040805160208101909152600081529092509050611a5a565b611a5381866000015161238f565b6040518060200160405280600081525090565b604080518082019091526000808252602082015290565b6040805160e0810190915280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b60035461010090046001600160a01b031633146136c95760405162461bcd60e51b81526004018080602001828103825260248152602001806138bf6024913960400191505060405180910390fd5b600754156137085760405162461bcd60e51b81526004018080602001828103825260238152602001806138e36023913960400191505060405180910390fd5b6006869055856137495760405162461bcd60e51b81526004018080602001828103825260308152602001806139526030913960400191505060405180910390fd5b600061375488610b15565b905080156137a9576040805162461bcd60e51b815260206004820152601a60248201527f73657474696e6720636f6d7074726f6c6c6572206661696c6564000000000000604482015290519081900360640190fd5b83516137bc906001906020870190613826565b5082516137d0906002906020860190613826565b506003805460ff191660ff84161790556137e8611caa565b600755505050600992909255600a80546001600160a01b0319166001600160a01b039290921691909117905550506000805460ff1916600117905550565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061386757805160ff1916838001178555613894565b82800160010185558215613894579182015b82811115613894578251825591602001919060010190613879565b506138a09291506138a4565b5090565b610a1a91905b808211156138a057600081556001016138aa56fe6f6e6c792061646d696e206d617920696e697469616c697a6520746865206d61726b65746d61726b6574206d6179206f6e6c7920626520696e697469616c697a6564206f6e6365494e563a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e6564494e563a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773696e697469616c2065786368616e67652072617465206d7573742062652067726561746572207468616e207a65726f2e4d494e545f4e45575f4143434f554e545f42414c414e43455f43414c43554c4154494f4e5f4641494c4544454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429494e563a3a64656c656761746542795369673a20696e76616c6964206e6f6e636573616e69747920636865636b3a206e657754696d656c6f636b457363726f77206d757374207573652074686973206d61726b6574494e563a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473494e563a3a64656c656761746542795369673a20696e76616c6964207369676e617475726565786368616e67655261746553746f7265643a2065786368616e67655261746553746f726564496e7465726e616c206661696c65644d494e545f4e45575f544f54414c5f535550504c595f43414c43554c4154494f4e5f4641494c454444656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279296f6e65206f662072656465656d546f6b656e73496e206f722072656465656d416d6f756e74496e206d757374206265207a65726f494e563a3a64656c656761746542795369673a207369676e617475726520657870697265644d494e545f4e45575f544f54414c5f535550504c595f4f5645525f4341504143495459494e563a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773a265627a7a72315820db72ac88970eca2d3b7d250ccdb12dac4c77aa6419550a12d12b9da4ffeefb1b64736f6c6343000510003260806040526212750060035534801561001757600080fd5b506040516107a83803806107a88339818101604052604081101561003a57600080fd5b508051602090910151600080546001600160a01b039384166001600160a01b0319918216179091556001805493909216928116929092179055600280549091163317905561071b8061008d6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80636f307dc3116100665780636f307dc31461013457806380f556051461013c578063ce513b6f14610144578063d215f3181461016a578063f3f43703146101905761009e565b80630fb5a6b4146100a35780631c411df3146100bd5780632efd5b06146100dc5780633ccfd60b146101085780635aa6e67514610110575b600080fd5b6100ab6101cf565b60408051918252519081900360200190f35b6100da600480360360208110156100d357600080fd5b50356101d5565b005b6100da600480360360408110156100f257600080fd5b506001600160a01b038135169060200135610223565b6100da6103e8565b610118610517565b604080516001600160a01b039092168252519081900360200190f35b610118610526565b610118610535565b6100ab6004803603602081101561015a57600080fd5b50356001600160a01b0316610544565b6100da6004803603602081101561018057600080fd5b50356001600160a01b0316610599565b6101b6600480360360208110156101a657600080fd5b50356001600160a01b0316610604565b6040805192835260208301919091528051918290030190f35b60035481565b6001546001600160a01b0316331461021e5760405162461bcd60e51b81526004018080602001828103825260278152602001806106c06027913960400191505060405180910390fd5b600355565b6002546001600160a01b0316331461027b576040805162461bcd60e51b81526020600482015260166024820152756f6e6c79206d61726b65742063616e20657363726f7760501b604482015290519081900360640190fd5b6003541561035d5761028b61067e565b506001600160a01b0382166000908152600460209081526040918290208251808401845281548152600190910154818301908152835180850190945260035442018452519092918201906102e5908563ffffffff61061d16565b90526001600160a01b0384166000818152600460209081526040918290208451815593810151600190940193909355600354815192835242019282019290925280820184905290517fdbe3ea2036231446c1c0e4706a5d2a242036540e5708cb7972a396fad591606d9181900360600190a1506103e4565b600080546040805163a9059cbb60e01b81526001600160a01b0386811660048301526024820186905291519190921692839263a9059cbb9260448083019360209383900390910190829087803b1580156103b657600080fd5b505af11580156103ca573d6000803e3d6000fd5b505050506040513d60208110156103e057600080fd5b5050505b5050565b60006103f333610544565b905060008111610440576040805162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b604482015290519081900360640190fd5b6000805433808352600460208181526040808620868155600101869055805163a9059cbb60e01b8152928301939093526024820186905291516001600160a01b0390931693849363a9059cbb936044808501949193918390030190829087803b1580156104ac57600080fd5b505af11580156104c0573d6000803e3d6000fd5b505050506040513d60208110156104d657600080fd5b5050604080513381526020810184905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a15050565b6001546001600160a01b031681565b6000546001600160a01b031681565b6002546001600160a01b031681565b600061054e61067e565b506001600160a01b0382166000908152600460209081526040918290208251808401909352805480845260019091015491830191909152421061059357806020015191505b50919050565b6001546001600160a01b031633146105e25760405162461bcd60e51b81526004018080602001828103825260278152602001806106996027913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6004602052600090815260409020805460019091015482565b600082820183811015610677576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60405180604001604052806000815260200160008152509056fe6f6e6c7920676f7665726e616e63652063616e2073657420697473206e657720616464726573736f6e6c7920676f7665726e616e63652063616e2073657420657363726f77206475726174696f6ea265627a7a723158201ec80ddaa1cfa806c09a521ac2f315cdf492b6820c6091c4d55a10be8ae6e40564736f6c634300051000326f6e6c792061646d696e206d617920696e697469616c697a6520746865206d61726b65746d61726b6574206d6179206f6e6c7920626520696e697469616c697a6564206f6e6365696e697469616c2065786368616e67652072617465206d7573742062652067726561746572207468616e207a65726f2e00000000000000000000000041d5d79431a913c4ae7d69a668ecdfe5ff9dfb680000000000000000000000004dcf7407ae5c07f8681e1659f626e114a7667339000000000000000000000000000000000000000000000000001c6bf526340000000000000000000000000000926df14a23be491164dcf93f4c468a50ef659d5b000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000012000000000000000000000000926df14a23be491164dcf93f4c468a50ef659d5b000000000000000000000000000000000000000000000000000000000000000478494e5600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000458494e5600000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102485760003560e01c8063852a12e31161013b578063c37f68e2116100b8578063e7a324dc1161007c578063e7a324dc146106c8578063e9c714f2146106d0578063f1127ed8146106d8578063f851a44014610732578063fe9c44ae1461073a57610248565b8063c37f68e214610608578063c3cda52014610654578063c7c934a11461069b578063db006a75146106a3578063e2fdcc17146106c057610248565b8063a6afed95116100ff578063a6afed9514610576578063b2a02ff11461057e578063b4b5ea57146105b4578063b71d1a0c146105da578063bd6d894d1461060057610248565b8063852a12e31461050f5780638aa1c05f1461052c5780638ae39cac1461054957806395d89b4114610551578063a0712d681461055957610248565b80634576b5db116101c95780636f307dc31161018d5780636f307dc3146104345780636fcfff451461043c57806370a082311461047b578063782d6fe1146104a15780637ecebe00146104e957610248565b80634576b5db146103b0578063587cde1e146103d65780635c19a95c146103fc5780635fe3b567146104245780636c540baf1461042c57610248565b806320606b701161021057806320606b70146103385780632678224714610340578063313ce567146103645780633af9e669146103825780633b1d21a2146103a857610248565b806306fdde031461024d5780630c19dc3a146102ca57806317c50d061461030257806318160ddd14610328578063182df0f514610330575b600080fd5b610255610756565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028f578181015183820152602001610277565b50505050905090810190601f1680156102bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102f0600480360360208110156102e057600080fd5b50356001600160a01b03166107e3565b60408051918252519081900360200190f35b6102f06004803603602081101561031857600080fd5b50356001600160a01b0316610929565b6102f06109b4565b6102f06109ba565b6102f0610a1d565b610348610a38565b604080516001600160a01b039092168252519081900360200190f35b61036c610a47565b6040805160ff9092168252519081900360200190f35b6102f06004803603602081101561039857600080fd5b50356001600160a01b0316610a50565b6102f0610b06565b6102f0600480360360208110156103c657600080fd5b50356001600160a01b0316610b15565b610348600480360360208110156103ec57600080fd5b50356001600160a01b0316610c63565b6104226004803603602081101561041257600080fd5b50356001600160a01b0316610c7e565b005b610348610c8b565b6102f0610c9a565b610348610ca0565b6104626004803603602081101561045257600080fd5b50356001600160a01b0316610caf565b6040805163ffffffff9092168252519081900360200190f35b6102f06004803603602081101561049157600080fd5b50356001600160a01b0316610cc7565b6104cd600480360360408110156104b757600080fd5b506001600160a01b038135169060200135610ce2565b604080516001600160601b039092168252519081900360200190f35b6102f0600480360360208110156104ff57600080fd5b50356001600160a01b0316610f10565b6102f06004803603602081101561052557600080fd5b5035610f22565b6102f06004803603602081101561054257600080fd5b5035610f2f565b6102f0610f9e565b610255610fa4565b6102f06004803603602081101561056f57600080fd5b5035610ffc565b6102f06110c2565b6102f06004803603606081101561059457600080fd5b506001600160a01b03813581169160208101359091169060400135611232565b6104cd600480360360208110156105ca57600080fd5b50356001600160a01b03166112a3565b6102f0600480360360208110156105f057600080fd5b50356001600160a01b0316611315565b6102f06113a1565b61062e6004803603602081101561061e57600080fd5b50356001600160a01b031661145d565b604080519485526020850193909352838301919091526060830152519081900360800190f35b610422600480360360c081101561066a57600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a001356114ca565b61034861179b565b6102f0600480360360208110156106b957600080fd5b50356117aa565b6103486117b7565b6102f06117c6565b6102f06117e1565b61070a600480360360408110156106ee57600080fd5b5080356001600160a01b0316906020013563ffffffff166118e4565b6040805163ffffffff90931683526001600160601b0390911660208301528051918290030190f35b610348611919565b61074261192d565b604080519115158252519081900360200190f35b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107db5780601f106107b0576101008083540402835291602001916107db565b820191906000526020600020905b8154815290600101906020018083116107be57829003601f168201915b505050505081565b6000306001600160a01b0316826001600160a01b03166380f556056040518163ffffffff1660e01b815260040160206040518083038186803b15801561082857600080fd5b505afa15801561083c573d6000803e3d6000fd5b505050506040513d602081101561085257600080fd5b50516001600160a01b0316146108995760405162461bcd60e51b8152600401808060200182810382526034815260200180613a116034913960400191505060405180910390fd5b60035461010090046001600160a01b031633146108c3576108bc6001603f611932565b9050610924565b601180546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517f8a0324ea550ac953d4515436f05889f90a816b559ca26ee450b104d4d5a248fa929181900390910190a1505b919050565b60035460009061010090046001600160a01b0316331461094f576108bc6001603f611932565b600a80546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517f2856afeddd63e06a55f7d242638b9ce830a95d17f6ac86997a9acd7de2761628929181900390910190a150919050565b60085481565b60008060006109c7611998565b909250905060008260038111156109da57fe5b14610a165760405162461bcd60e51b8152600401808060200182810382526035815260200180613a9d6035913960400191505060405180910390fd5b9150505b90565b6040518060436139ad82396043019050604051809103902081565b6004546001600160a01b031681565b60035460ff1681565b6000610a5a613613565b6040518060200160405280610a6d6113a1565b90526001600160a01b0384166000908152600b6020526040812054919250908190610a99908490611a0d565b90925090506000826003811115610aac57fe5b14610afe576040805162461bcd60e51b815260206004820152601f60248201527f62616c616e636520636f756c64206e6f742062652063616c63756c6174656400604482015290519081900360640190fd5b949350505050565b6000610b10611a61565b905090565b60035460009061010090046001600160a01b03163314610b3b576108bc6001603f611932565b60055460408051623f1ee960e11b815290516001600160a01b0392831692851691627e3dd2916004808301926020929190829003018186803b158015610b8057600080fd5b505afa158015610b94573d6000803e3d6000fd5b505050506040513d6020811015610baa57600080fd5b5051610bfd576040805162461bcd60e51b815260206004820152601c60248201527f6d61726b6572206d6574686f642072657475726e65642066616c736500000000604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b03858116918217909255604080519284168352602083019190915280517f7ac369dbd14fa5ea3f473ed67cc9d598964a77501540ba6751eb0b3decf5870d9281900390910190a160005b9392505050565b600c602052600090815260409020546001600160a01b031681565b610c883382611ae1565b50565b6005546001600160a01b031681565b60075481565b6010546001600160a01b031681565b600e6020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600b602052604090205490565b6000438210610d225760405162461bcd60e51b81526004018080602001828103825260268152602001806139066026913960400191505060405180910390fd5b6001600160a01b0383166000908152600e602052604090205463ffffffff1680610d50576000915050610f0a565b6001600160a01b0384166000908152600d6020908152604080832063ffffffff600019860181168552925290912054168310610dcc576001600160a01b0384166000908152600d602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b03169050610f0a565b6001600160a01b0384166000908152600d6020908152604080832083805290915290205463ffffffff16831015610e07576000915050610f0a565b600060001982015b8163ffffffff168163ffffffff161115610eca57600282820363ffffffff16048103610e39613626565b506001600160a01b0387166000908152600d6020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610ea557602001519450610f0a9350505050565b805163ffffffff16871115610ebc57819350610ec3565b6001820392505b5050610e0f565b506001600160a01b0385166000908152600d6020908152604080832063ffffffff909416835292905220546001600160601b03600160201b909104169150505b92915050565b600f6020526000908152604090205481565b6000610f0a826001611b61565b60035460009061010090046001600160a01b03163314610f55576108bc6001603f611932565b6009805490839055604080518281526020810185905281517f3b7a406bf2b66d0f83f6b1cf4c39edf1269cad80712b94cd80a44d13f61f1357929181900390910190a150919050565b60095481565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156107db5780601f106107b0576101008083540402835291602001916107db565b60008061100883611c02565b50336000908152600c60205260409020549091506001600160a01b0316610f0a5760105460408051632c3e6f0f60e11b815233600482015290516000926001600160a01b03169163587cde1e916024808301926020929190829003018186803b15801561107457600080fd5b505afa158015611088573d6000803e3d6000fd5b505050506040513d602081101561109e57600080fd5b505190506001600160a01b038116156110bb576110bb3382611ae1565b5092915050565b6000806110cd611caa565b600754909150808214156110e657600092505050610a1a565b6000806110f38484611cae565b9092509050600082600381111561110657fe5b14611158576040805162461bcd60e51b815260206004820152601f60248201527f636f756c64206e6f742063616c63756c61746520626c6f636b2064656c746100604482015290519081900360640190fd5b600061116660095483611cd1565b9093509050600083600381111561117957fe5b146111cb576040805162461bcd60e51b815260206004820152601a60248201527f636f756c64206e6f742063616c63756c61746520726577617264000000000000604482015290519081900360640190fd5b60006008541180156111e75750600a546001600160a01b031615155b80156112045750600a54611204906001600160a01b031682611d10565b1561122157600a5461121f906001600160a01b031682611e2f565b505b600785905560009550505050505090565b6000805460ff16611277576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff1916905561128d33858585612079565b90506000805460ff191660011790559392505050565b6001600160a01b0381166000908152600e602052604081205463ffffffff16806112ce576000610c5c565b6001600160a01b0383166000908152600d6020908152604080832063ffffffff60001986011684529091529020546001600160601b03600160201b90910416915050919050565b60035460009061010090046001600160a01b0316331461133b576108bc60016045611932565b600480546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a16000610c5c565b6000805460ff166113e6576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff191681556113f86110c2565b14611443576040805162461bcd60e51b81526020600482015260166024820152751858d8dc9d59481a5b9d195c995cdd0819985a5b195960521b604482015290519081900360640190fd5b61144b6109ba565b90506000805460ff1916600117905590565b6001600160a01b0381166000908152600b60205260408120548190819081908180611486611998565b92509050600081600381111561149857fe5b146114b45760099650600095508594508493506114c392505050565b60009650919450600093509150505b9193509193565b600060405180806139ad6043913960430190506040518091039020600160405180828054600181600116156101000203166002900480156115425780601f10611520576101008083540402835291820191611542565b820191906000526020600020905b81548152906001019060200180831161152e575b50509150506040518091039020611557612310565b3060405160200180858152602001848152602001838152602001826001600160a01b03166001600160a01b0316815260200194505050505060405160208183030381529060405280519060200120905060006040518080613afa603a91396040805191829003603a0182206020808401919091526001600160a01b038c1683830152606083018b905260808084018b90528251808503909101815260a08401835280519082012061190160f01b60c085015260c2840187905260e2808501829052835180860390910181526101028501808552815191840191909120600091829052610122860180865281905260ff8c1661014287015261016286018b905261018286018a9052935191965092945091926001926101a28083019392601f198301929081900390910190855afa158015611695573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166116e75760405162461bcd60e51b8152600401808060200182810382526025815260200180613a786025913960400191505060405180910390fd5b6001600160a01b0381166000908152600f6020526040902080546001810190915589146117455760405162461bcd60e51b81526004018080602001828103825260218152602001806139f06021913960400191505060405180910390fd5b874211156117845760405162461bcd60e51b8152600401808060200182810382526025815260200180613b686025913960400191505060405180910390fd5b61178e818b611ae1565b505050505b505050505050565b600a546001600160a01b031681565b6000610f0a826001612314565b6011546001600160a01b031681565b60405180603a613afa8239603a019050604051809103902081565b6004546000906001600160a01b0316331415806117fc575033155b156118145761180d60016000611932565b9050610a1a565b60038054600480546001600160a01b03818116610100818102610100600160a81b0319871617968790556001600160a01b031990931690935560408051948390048216808652929095041660208401528351909391927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600454604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a160009250505090565b600d60209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b60035461010090046001600160a01b031681565b600181565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa083601081111561196157fe5b83605081111561196d57fe5b604080519283526020830191909152600082820152519081900360600190a1826010811115610c5c57fe5b6008546000908190806119b357505060065460009150611a09565b60006119bd611a61565b90506119c7613613565b60006119d3838561238f565b9250905060008160038111156119e557fe5b146119f957945060009350611a0992505050565b5051600094509250611a09915050565b9091565b6000806000611a1a613613565b611a24868661243f565b90925090506000826003811115611a3757fe5b14611a485750915060009050611a5a565b6000611a53826124a7565b9350935050505b9250929050565b601054604080516370a0823160e01b815230600482015290516000926001600160a01b03169182916370a0823191602480820192602092909190829003018186803b158015611aaf57600080fd5b505afa158015611ac3573d6000803e3d6000fd5b505050506040513d6020811015611ad957600080fd5b505191505090565b6001600160a01b038083166000818152600c602081815260408084208054600b845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4611b5b8284836124b6565b50505050565b6000805460ff16611ba6576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff19168155611bb86110c2565b90508015611bde57611bd6816010811115611bcf57fe5b6027611932565b915050611bef565b611beb336000868661264d565b9150505b6000805460ff1916600117905592915050565b60008054819060ff16611c49576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff19168155611c5b6110c2565b90508015611c8657611c79816010811115611c7257fe5b601e611932565b925060009150611c969050565b611c903385612b14565b92509250505b6000805460ff191660011790559092909150565b4390565b600080838311611cc5575060009050818303611a5a565b50600390506000611a5a565b60008083611ce457506000905080611a5a565b83830283858281611cf157fe5b0414611d0557506002915060009050611a5a565b600092509050611a5a565b601054604080516370a0823160e01b81526001600160a01b03858116600483015291516000939290921691839183916370a0823191602480820192602092909190829003018186803b158015611d6557600080fd5b505afa158015611d79573d6000803e3d6000fd5b505050506040513d6020811015611d8f57600080fd5b505160408051636eb1769f60e11b81526001600160a01b03888116600483015230602483015291519293506000929185169163dd62ed3e91604480820192602092909190829003018186803b158015611de757600080fd5b505afa158015611dfb573d6000803e3d6000fd5b505050506040513d6020811015611e1157600080fd5b50519050848210801590611e255750848110155b9695505050505050565b601054604080516370a0823160e01b815230600482015290516000926001600160a01b031691839183916370a08231916024808301926020929190829003018186803b158015611e7e57600080fd5b505afa158015611e92573d6000803e3d6000fd5b505050506040513d6020811015611ea857600080fd5b5051604080516323b872dd60e01b81526001600160a01b038881166004830152306024830152604482018890529151929350908416916323b872dd9160648082019260009290919082900301818387803b158015611f0557600080fd5b505af1158015611f19573d6000803e3d6000fd5b5050505060003d60008114611f355760208114611f3f57600080fd5b6000199150611f4b565b60206000803e60005191505b5080611f9e576040805162461bcd60e51b815260206004820152601860248201527f544f4b454e5f5452414e534645525f494e5f4641494c45440000000000000000604482015290519081900360640190fd5b601054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611fe957600080fd5b505afa158015611ffd573d6000803e3d6000fd5b505050506040513d602081101561201357600080fd5b505190508281101561206c576040805162461bcd60e51b815260206004820152601a60248201527f544f4b454e5f5452414e534645525f494e5f4f564552464c4f57000000000000604482015290519081900360640190fd5b9190910395945050505050565b6005546040805163d02f735160e01b81523060048201526001600160a01b038781166024830152868116604483015285811660648301526084820185905291516000938493169163d02f73519160a480830192602092919082900301818787803b1580156120e657600080fd5b505af11580156120fa573d6000803e3d6000fd5b505050506040513d602081101561211057600080fd5b50519050801561212f576121276003601b83612fbf565b915050610afe565b846001600160a01b0316846001600160a01b03161415612155576121276006601c611932565b6001600160a01b0384166000908152600b60205260408120548190819061217c9087611cae565b9093509150600083600381111561218f57fe5b146121b7576121ac6009601a8560038111156121a757fe5b612fbf565b945050505050610afe565b6001600160a01b0388166000908152600b60205260409020546121da9087613025565b909350905060008360038111156121ed57fe5b14612205576121ac600960198560038111156121a757fe5b6001600160a01b038088166000818152600b60209081526040808320879055938c168083529184902085905583518a8152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a36122708789886124b6565b60055460408051636d35bf9160e01b81523060048201526001600160a01b038c811660248301528b811660448301528a81166064830152608482018a905291519190921691636d35bf919160a480830192600092919082900301818387803b1580156122db57600080fd5b505af11580156122ef573d6000803e3d6000fd5b50505050612300888760008061264d565b5060009998505050505050505050565b4690565b6000805460ff16612359576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6000805460ff1916815561236b6110c2565b9050801561238257611bd6816010811115611bcf57fe5b611beb338560008661264d565b6000612399613613565b6000806123ae86670de0b6b3a7640000611cd1565b909250905060008260038111156123c157fe5b146123e057506040805160208101909152600081529092509050611a5a565b6000806123ed838861304b565b9092509050600082600381111561240057fe5b1461242257506040805160208101909152600081529094509250611a5a915050565b604080516020810190915290815260009890975095505050505050565b6000612449613613565b60008061245a866000015186611cd1565b9092509050600082600381111561246d57fe5b1461248c57506040805160208101909152600081529092509050611a5a565b60408051602081019091529081526000969095509350505050565b51670de0b6b3a7640000900490565b816001600160a01b0316836001600160a01b0316141580156124e157506000816001600160601b0316115b15612648576001600160a01b03831615612599576001600160a01b0383166000908152600e602052604081205463ffffffff169081612521576000612560565b6001600160a01b0385166000908152600d60209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006125878285604051806060016040528060278152602001613bb060279139613076565b905061259586848484613120565b5050505b6001600160a01b03821615612648576001600160a01b0382166000908152600e602052604081205463ffffffff1690816125d4576000612613565b6001600160a01b0384166000908152600d60209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061263a828560405180606001604052806026815260200161392c602691396132df565b905061179385848484613120565b505050565b600083158061265a575082155b6126955760405162461bcd60e51b8152600401808060200182810382526034815260200180613b346034913960400191505060405180910390fd5b61269d61363d565b6126a5611998565b60408301819052602083018260038111156126bc57fe5b60038111156126c757fe5b90525060009050816020015160038111156126de57fe5b146126fa576121276009602b836020015160038111156121a757fe5b841561277b5760608101859052604080516020810182529082015181526127219086611a0d565b608083018190526020830182600381111561273857fe5b600381111561274357fe5b905250600090508160200151600381111561275a57fe5b146127765761212760096029836020015160038111156121a757fe5b6127f4565b6127978460405180602001604052808460400151815250613349565b60608301819052602083018260038111156127ae57fe5b60038111156127b957fe5b90525060009050816020015160038111156127d057fe5b146127ec576121276009602a836020015160038111156121a757fe5b608081018490525b60055460608201516040805163eabe7d9160e01b81523060048201526001600160a01b038a8116602483015260448201939093529051600093929092169163eabe7d919160648082019260209290919082900301818787803b15801561285957600080fd5b505af115801561286d573d6000803e3d6000fd5b505050506040513d602081101561288357600080fd5b5051905080156128a35761289a6003602883612fbf565b92505050610afe565b6128b36008548360600151611cae565b60a08401819052602084018260038111156128ca57fe5b60038111156128d557fe5b90525060009050826020015160038111156128ec57fe5b146129085761289a6009602e846020015160038111156121a757fe5b6001600160a01b0387166000908152600b602052604090205460608301516129309190611cae565b60c084018190526020840182600381111561294757fe5b600381111561295257fe5b905250600090508260200151600381111561296957fe5b146129855761289a6009602d846020015160038111156121a757fe5b8160800151612992611a61565b10156129a45761289a600e602f611932565b6129b387836080015186613360565b60a082015160085560c08201516001600160a01b0388166000818152600b60209081526040918290209390935560608501518151908152905130937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a36080820151606080840151604080516001600160a01b038c168152602081019490945283810191909152517fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a9299281900390910190a1612a7b87600084606001516124b6565b60055460808301516060840151604080516351dff98960e01b81523060048201526001600160a01b038c81166024830152604482019490945260648101929092525191909216916351dff98991608480830192600092919082900301818387803b158015612ae857600080fd5b505af1158015612afc573d6000803e3d6000fd5b5060009250612b09915050565b979650505050505050565b60055460408051634ef4c3e160e01b81523060048201526001600160a01b03858116602483015260448201859052915160009384938493911691634ef4c3e19160648082019260209290919082900301818787803b158015612b7557600080fd5b505af1158015612b89573d6000803e3d6000fd5b505050506040513d6020811015612b9f57600080fd5b505190508015612bc357612bb66003601f83612fbf565b925060009150611a5a9050565b612bcb61363d565b612bd3611998565b6040830181905260208301826003811115612bea57fe5b6003811115612bf557fe5b9052506000905081602001516003811115612c0c57fe5b14612c3657612c2860096021836020015160038111156121a757fe5b935060009250611a5a915050565b612c408686611e2f565b60c0820181905260408051602081018252908301518152612c619190613349565b6060830181905260208301826003811115612c7857fe5b6003811115612c8357fe5b9052506000905081602001516003811115612c9a57fe5b14612cec576040805162461bcd60e51b815260206004820181905260248201527f4d494e545f45584348414e47455f43414c43554c4154494f4e5f4641494c4544604482015290519081900360640190fd5b612cfc6008548260600151613025565b6080830181905260208301826003811115612d1357fe5b6003811115612d1e57fe5b9052506000905081602001516003811115612d3557fe5b14612d715760405162461bcd60e51b8152600401808060200182810382526028815260200180613ad26028913960400191505060405180910390fd5b600160601b816080015110612db75760405162461bcd60e51b8152600401808060200182810382526023815260200180613b8d6023913960400191505060405180910390fd5b6001600160a01b0386166000908152600b60205260409020546060820151612ddf9190613025565b60a0830181905260208301826003811115612df657fe5b6003811115612e0157fe5b9052506000905081602001516003811115612e1857fe5b14612e545760405162461bcd60e51b815260040180806020018281038252602b815260200180613982602b913960400191505060405180910390fd5b608081015160085560a08101516001600160a01b0387166000818152600b60209081526040918290209390935560c084015160608086015183519485529484019190915282820193909352517f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f929181900390910190a1606081015160408051918252516001600160a01b0388169130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3612f1f60008783606001516124b6565b60055460c08201516060830151604080516341c728b960e01b81523060048201526001600160a01b038b81166024830152604482019490945260648101929092525191909216916341c728b991608480830192600092919082900301818387803b158015612f8c57600080fd5b505af1158015612fa0573d6000803e3d6000fd5b5060009250612fad915050565b8160c001519350935050509250929050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0846010811115612fee57fe5b846050811115612ffa57fe5b604080519283526020830191909152818101859052519081900360600190a1836010811115610afe57fe5b60008083830184811061303d57600092509050611a5a565b506002915060009050611a5a565b6000808261305f5750600190506000611a5a565b600083858161306a57fe5b04915091509250929050565b6000836001600160601b0316836001600160601b0316111582906131185760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156130dd5781810151838201526020016130c5565b50505050905090810190601f16801561310a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600061314443604051806060016040528060338152602001613a4560339139613557565b905060008463ffffffff1611801561318d57506001600160a01b0385166000908152600d6020908152604080832063ffffffff6000198901811685529252909120548282169116145b156131ec576001600160a01b0385166000908152600d60209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b0385160217905561328b565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600d83528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600e90935292909220805460018801909316929091169190911790555b604080516001600160601b0380861682528416602082015281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b6000838301826001600160601b0380871690831610156133405760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156130dd5781810151838201526020016130c5565b50949350505050565b6000806000613356613613565b611a2486866135b4565b6010546001600160a01b031681156133e4576011546040805163a9059cbb60e01b81526001600160a01b0392831660048201526024810186905290519183169163a9059cbb9160448082019260009290919082900301818387803b1580156133c757600080fd5b505af11580156133db573d6000803e3d6000fd5b5050505061345d565b806001600160a01b031663a9059cbb85856040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561344457600080fd5b505af1158015613458573d6000803e3d6000fd5b505050505b60003d8015613473576020811461347d57600080fd5b6000199150613489565b60206000803e60005191505b50806134dc576040805162461bcd60e51b815260206004820152601960248201527f544f4b454e5f5452414e534645525f4f55545f4641494c454400000000000000604482015290519081900360640190fd5b8215613550576011546040805163177ead8360e11b81526001600160a01b0388811660048301526024820188905291519190921691632efd5b0691604480830192600092919082900301818387803b15801561353757600080fd5b505af115801561354b573d6000803e3d6000fd5b505050505b5050505050565b600081600160201b84106135ac5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156130dd5781810151838201526020016130c5565b509192915050565b60006135be613613565b6000806135d3670de0b6b3a764000087611cd1565b909250905060008260038111156135e657fe5b1461360557506040805160208101909152600081529092509050611a5a565b611a5381866000015161238f565b6040518060200160405280600081525090565b604080518082019091526000808252602082015290565b6040805160e0810190915280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b60035461010090046001600160a01b031633146136c95760405162461bcd60e51b81526004018080602001828103825260248152602001806138bf6024913960400191505060405180910390fd5b600754156137085760405162461bcd60e51b81526004018080602001828103825260238152602001806138e36023913960400191505060405180910390fd5b6006869055856137495760405162461bcd60e51b81526004018080602001828103825260308152602001806139526030913960400191505060405180910390fd5b600061375488610b15565b905080156137a9576040805162461bcd60e51b815260206004820152601a60248201527f73657474696e6720636f6d7074726f6c6c6572206661696c6564000000000000604482015290519081900360640190fd5b83516137bc906001906020870190613826565b5082516137d0906002906020860190613826565b506003805460ff191660ff84161790556137e8611caa565b600755505050600992909255600a80546001600160a01b0319166001600160a01b039290921691909117905550506000805460ff1916600117905550565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061386757805160ff1916838001178555613894565b82800160010185558215613894579182015b82811115613894578251825591602001919060010190613879565b506138a09291506138a4565b5090565b610a1a91905b808211156138a057600081556001016138aa56fe6f6e6c792061646d696e206d617920696e697469616c697a6520746865206d61726b65746d61726b6574206d6179206f6e6c7920626520696e697469616c697a6564206f6e6365494e563a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e6564494e563a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773696e697469616c2065786368616e67652072617465206d7573742062652067726561746572207468616e207a65726f2e4d494e545f4e45575f4143434f554e545f42414c414e43455f43414c43554c4154494f4e5f4641494c4544454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429494e563a3a64656c656761746542795369673a20696e76616c6964206e6f6e636573616e69747920636865636b3a206e657754696d656c6f636b457363726f77206d757374207573652074686973206d61726b6574494e563a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473494e563a3a64656c656761746542795369673a20696e76616c6964207369676e617475726565786368616e67655261746553746f7265643a2065786368616e67655261746553746f726564496e7465726e616c206661696c65644d494e545f4e45575f544f54414c5f535550504c595f43414c43554c4154494f4e5f4641494c454444656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279296f6e65206f662072656465656d546f6b656e73496e206f722072656465656d416d6f756e74496e206d757374206265207a65726f494e563a3a64656c656761746542795369673a207369676e617475726520657870697265644d494e545f4e45575f544f54414c5f535550504c595f4f5645525f4341504143495459494e563a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773a265627a7a72315820db72ac88970eca2d3b7d250ccdb12dac4c77aa6419550a12d12b9da4ffeefb1b64736f6c63430005100032

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

00000000000000000000000041d5d79431a913c4ae7d69a668ecdfe5ff9dfb680000000000000000000000004dcf7407ae5c07f8681e1659f626e114a7667339000000000000000000000000000000000000000000000000001c6bf526340000000000000000000000000000926df14a23be491164dcf93f4c468a50ef659d5b000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000012000000000000000000000000926df14a23be491164dcf93f4c468a50ef659d5b000000000000000000000000000000000000000000000000000000000000000478494e5600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000458494e5600000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : underlying_ (address): 0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68
Arg [1] : comptroller_ (address): 0x4dCf7407AE5C07f8681e1659f626E114A7667339
Arg [2] : rewardPerBlock_ (uint256): 8000000000000000
Arg [3] : rewardTreasury_ (address): 0x926dF14a23BE491164dCF93f4c468A50ef659D5B
Arg [4] : name_ (string): xINV
Arg [5] : symbol_ (string): XINV
Arg [6] : decimals_ (uint8): 18
Arg [7] : admin_ (address): 0x926dF14a23BE491164dCF93f4c468A50ef659D5B

-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 00000000000000000000000041d5d79431a913c4ae7d69a668ecdfe5ff9dfb68
Arg [1] : 0000000000000000000000004dcf7407ae5c07f8681e1659f626e114a7667339
Arg [2] : 000000000000000000000000000000000000000000000000001c6bf526340000
Arg [3] : 000000000000000000000000926df14a23be491164dcf93f4c468a50ef659d5b
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [7] : 000000000000000000000000926df14a23be491164dcf93f4c468a50ef659d5b
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [9] : 78494e5600000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [11] : 58494e5600000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

Added based on https://docs.inverse.finance/smart-contracts - Azfar 20/10

Validator Index Block Amount
View All Withdrawals

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

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