ETH Price: $3,150.32 (-7.92%)
Gas: 5 Gwei

Contract

0xE351832D873673f771CCe54c07Cf8fFAe5c55809
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040161243732022-12-06 7:51:35597 days ago1670313095IN
 Create: LPool
0 ETH0.0802921618

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LPool

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 15 : LPool.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;


import "./LPoolInterface.sol";
import "./LPoolDepositor.sol";
import "../lib/Exponential.sol";
import "../Adminable.sol";
import "../lib/CarefulMath.sol";
import "../lib/TransferHelper.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

import "../DelegateInterface.sol";
import "../ControllerInterface.sol";
import "../IWETH.sol";

/// @title OpenLeverage's LToken Contract
/// @dev Abstract base for LTokens
/// @author OpenLeverage
contract LPool is DelegateInterface, Adminable, LPoolInterface, Exponential, ReentrancyGuard {
    using TransferHelper for IERC20;
    using SafeMath for uint;

    constructor() {

    }

    /// @notice Initialize the money market
    /// @param controller_ The address of the Controller
    /// @param baseRatePerBlock_ The base interest rate which is the y-intercept when utilization rate is 0
    /// @param multiplierPerBlock_ The multiplier of utilization rate that gives the slope of the interest rate
    /// @param jumpMultiplierPerBlock_ The multiplierPerBlock after hitting a specified utilization point
    /// @param kink_ The utilization point at which the jump multiplier is applied
    /// @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(
        address underlying_,
        bool isWethPool_,
        address controller_,
        uint256 baseRatePerBlock_,
        uint256 multiplierPerBlock_,
        uint256 jumpMultiplierPerBlock_,
        uint256 kink_,
        uint initialExchangeRateMantissa_,
        string memory name_,
        string memory symbol_,
        uint8 decimals_) public {
        require(underlying_ != address(0), "underlying_ address cannot be 0");
        require(controller_ != address(0), "controller_ address cannot be 0");
        require(msg.sender == admin, "Only allow to be called by admin");
        require(accrualBlockNumber == 0 && borrowIndex == 0, "inited once");

        // Set initial exchange rate
        initialExchangeRateMantissa = initialExchangeRateMantissa_;
        require(initialExchangeRateMantissa > 0, "Initial Exchange Rate Mantissa should be greater zero");
        //set controller
        controller = controller_;
        isWethPool = isWethPool_;
        //set interestRateModel
        baseRatePerBlock = baseRatePerBlock_;
        multiplierPerBlock = multiplierPerBlock_;
        jumpMultiplierPerBlock = jumpMultiplierPerBlock_;
        kink = kink_;

        // Initialize block number and borrow index (block number mocks depend on controller being set)
        accrualBlockNumber = getBlockNumber();
        borrowIndex = 1e25;
        //80%
        borrowCapFactorMantissa = 0.8e18;
        //10%
        reserveFactorMantissa = 0.1e18;


        name = name_;
        symbol = symbol_;
        decimals = decimals_;

        _notEntered = true;

        // Set underlying and sanity check it
        underlying = underlying_;
        IERC20(underlying).totalSupply();
        emit Transfer(address(0), msg.sender, 0);
    }

    /// @notice Transfer `tokens` tokens from `src` to `dst` by `spender`
    /// @dev Called by both `transfer` and `transferFrom` internally
    /// @param spender The address of the account performing the transfer
    /// @param src The address of the source account
    /// @param dst The address of the destination account
    /// @param tokens The number of tokens to transfer
    /// @return Whether or not the transfer succeeded
    function transferTokens(address spender, address src, address dst, uint tokens) internal returns (bool) {
        require(dst != address(0), "dst address cannot be 0");
        /* Do not allow self-transfers */
        require(src != dst, "src = dst");

        (ControllerInterface(controller)).transferAllowed(src, dst, tokens);

        /* Get the allowance, infinite for the account owner */
        uint startingAllowance = 0;
        if (spender == src) {
            startingAllowance = uint(- 1);
        } else {
            startingAllowance = transferAllowances[src][spender];
        }

        /* Do the calculations, checking for {under,over}flow */
        MathError mathErr;
        uint allowanceNew;
        uint srcTokensNew;
        uint dstTokensNew;

        (mathErr, allowanceNew) = subUInt(startingAllowance, tokens);
        require(mathErr == MathError.NO_ERROR, 'not allowed');

        (mathErr, srcTokensNew) = subUInt(accountTokens[src], tokens);
        require(mathErr == MathError.NO_ERROR, 'not enough');

        (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);
        require(mathErr == MathError.NO_ERROR, 'too much');

        accountTokens[src] = srcTokensNew;
        accountTokens[dst] = dstTokensNew;

        /* Eat some of the allowance (if necessary) */
        if (startingAllowance != uint(- 1)) {
            transferAllowances[src][spender] = allowanceNew;
        }
        /* We emit a Transfer event */
        emit Transfer(src, dst, tokens);
        return true;
    }

    /// @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 override nonReentrant returns (bool) {
        return transferTokens(msg.sender, msg.sender, dst, amount);
    }

    /// @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 override nonReentrant returns (bool) {
        return transferTokens(msg.sender, src, dst, amount);
    }

    /// @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 override returns (bool) {
        address src = msg.sender;
        transferAllowances[src][spender] = amount;
        emit Approval(src, spender, amount);
        return true;
    }

    /// @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 override view returns (uint256) {
        return transferAllowances[owner][spender];
    }

    /// @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 override view returns (uint256) {
        return accountTokens[owner];
    }

    /// @notice Get the underlying balance of the `owner`
    /// @dev This also accrues interest in a transaction
    /// @param owner The address of the account to query
    /// @return The amount of underlying owned by `owner`
    function balanceOfUnderlying(address owner) external override returns (uint) {
        Exp memory exchangeRate = Exp({mantissa : exchangeRateCurrent()});
        (MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);
        require(mErr == MathError.NO_ERROR, "calc failed");
        return balance;
    }

    /*** User Interface ***/

    /// @notice Sender supplies assets into the market and receives lTokens in exchange
    /// @dev Accrues interest whether or not the operation succeeds, unless reverted
    /// @param mintAmount The amount of the underlying asset to supply
    function mint(uint mintAmount) external override nonReentrant {
        accrueInterest();
        mintFresh(msg.sender, mintAmount, false);
    }

    function mintTo(address to, uint amount) external payable override nonReentrant {
        accrueInterest();
        if (isWethPool) {
            mintFresh(to, msg.value, false);
        } else {
            mintFresh(to, amount, true);
        }
    }

    function mintEth() external payable override nonReentrant {
        require(isWethPool, "not eth pool");
        accrueInterest();
        mintFresh(msg.sender, msg.value, false);
    }

    /// @notice Sender redeems lTokens in exchange for the underlying asset
    /// @dev Accrues interest whether or not the operation succeeds, unless reverted
    /// @param redeemTokens The number of lTokens to redeem into underlying
    function redeem(uint redeemTokens) external override nonReentrant {
        accrueInterest();
        // redeemFresh emits redeem-specific logs on errors, so we don't need to
        redeemFresh(msg.sender, redeemTokens, 0);
    }

    /// @notice Sender redeems lTokens in exchange for a specified amount of underlying asset
    /// @dev Accrues interest whether or not the operation succeeds, unless reverted
    /// @param redeemAmount The amount of underlying to redeem
    function redeemUnderlying(uint redeemAmount) external override nonReentrant {
        accrueInterest();
        // redeemFresh emits redeem-specific logs on errors, so we don't need to
        redeemFresh(msg.sender, 0, redeemAmount);
    }

    function borrowBehalf(address borrower, uint borrowAmount) external override nonReentrant {
        accrueInterest();
        // borrowFresh emits borrow-specific logs on errors, so we don't need to
        borrowFresh(payable(borrower), msg.sender, borrowAmount);
    }

    /// @notice Sender repays a borrow belonging to borrower
    /// @param borrower the account with the debt being payed off
    /// @param repayAmount The amount to repay
    function repayBorrowBehalf(address borrower, uint repayAmount) external override nonReentrant {
        accrueInterest();
        // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to
        repayBorrowFresh(msg.sender, borrower, repayAmount, false);
    }

    function repayBorrowEndByOpenLev(address borrower, uint repayAmount) external override nonReentrant {
        accrueInterest();
        repayBorrowFresh(msg.sender, borrower, repayAmount, true);
    }


    /*** Safe Token ***/

    /// 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) {
        return IERC20(underlying).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, bool convertWeth) internal returns (uint actualAmount) {
        if (isWethPool && convertWeth) {
            actualAmount = msg.value;
            IWETH(underlying).deposit{value : actualAmount}();
        } else {
            actualAmount = IERC20(underlying).safeTransferFrom(from, address(this), 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 convertWeth) internal {
        if (isWethPool && convertWeth) {
            IWETH(underlying).withdraw(amount);
            (bool success, ) = to.call{value: amount}("");
            require(success);
        } else {
            IERC20(underlying).safeTransfer(to, amount);
        }
    }

    function availableForBorrow() external view override returns (uint){
        uint cash = getCashPrior();
        (MathError err0, uint sum) = addThenSubUInt(cash, totalBorrows, totalReserves);
        if (err0 != MathError.NO_ERROR) {
            return 0;
        }
        (MathError err1, uint maxAvailable) = mulScalarTruncate(Exp({mantissa : sum}), borrowCapFactorMantissa);
        if (err1 != MathError.NO_ERROR) {
            return 0;
        }
        if (totalBorrows > maxAvailable) {
            return 0;
        }
        return maxAvailable - totalBorrows;
    }


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

        MathError mErr;

        (mErr, borrowBalance) = borrowBalanceStoredInternal(account);
        if (mErr != MathError.NO_ERROR) {
            return (0, 0, 0);
        }

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

        return (cTokenBalance, borrowBalance, 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;
    }

    /// @notice Returns the current per-block borrow interest rate for this cToken
    /// @return The borrow interest rate per block, scaled by 1e18
    function borrowRatePerBlock() external override view returns (uint) {
        return getBorrowRateInternal(getCashPrior(), totalBorrows, totalReserves);
    }


    /// @notice Returns the current per-block supply interest rate for this cToken
    /// @return The supply interest rate per block, scaled by 1e18
    function supplyRatePerBlock() external override view returns (uint) {
        return getSupplyRateInternal(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa);
    }

    function utilizationRate(uint cash, uint borrows, uint reserves) internal pure returns (uint) {
        // Utilization rate is 0 when there are no borrows
        if (borrows == 0) {
            return 0;
        }
        return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));
    }

    /// @notice Calculates the current borrow rate per block, with the error code expected by the market
    /// @param cash The amount of cash in the market
    /// @param borrows The amount of borrows in the market
    /// @return The borrow rate percentage per block as a mantissa (scaled by 1e18)
    function getBorrowRateInternal(uint cash, uint borrows, uint reserves) internal view returns (uint) {
        uint util = utilizationRate(cash, borrows, reserves);
        if (util <= kink) {
            return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
        } else {
            uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
            uint excessUtil = util.sub(kink);
            return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);
        }
    }

    /// @notice Calculates the current supply rate per block
    /// @param cash The amount of cash in the market
    /// @param borrows The amount of borrows in the market
    /// @return The supply rate percentage per block as a mantissa (scaled by 1e18)
    function getSupplyRateInternal(uint cash, uint borrows, uint reserves, uint reserveFactor) internal view returns (uint) {
        uint oneMinusReserveFactor = uint(1e18).sub(reserveFactor);
        uint borrowRate = getBorrowRateInternal(cash, borrows, reserves);
        uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);
        return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);
    }

    /// @notice Returns the current total borrows plus accrued interest
    /// @return The total borrows with interest
    function totalBorrowsCurrent() external override view returns (uint) {
        /* Remember the initial block number */
        uint currentBlockNumber = getBlockNumber();
        uint accrualBlockNumberPrior = accrualBlockNumber;

        /* Short-circuit accumulating 0 interest */
        if (accrualBlockNumberPrior == currentBlockNumber) {
            return totalBorrows;
        }

        /* Read the previous values out of storage */
        uint cashPrior = getCashPrior();
        uint borrowsPrior = totalBorrows;
        uint reservesPrior = totalReserves;

        /* Calculate the current borrow interest rate */
        uint borrowRateMantissa = getBorrowRateInternal(cashPrior, borrowsPrior, reservesPrior);
        require(borrowRateMantissa <= borrowRateMaxMantissa, "borrower rate higher");

        /* Calculate the number of blocks elapsed since the last accrual */
        (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);
        require(mathErr == MathError.NO_ERROR, "calc block delta erro");

        Exp memory simpleInterestFactor;
        uint interestAccumulated;
        uint totalBorrowsNew;

        (mathErr, simpleInterestFactor) = mulScalar(Exp({mantissa : borrowRateMantissa}), blockDelta);
        require(mathErr == MathError.NO_ERROR, 'calc interest factor error');

        (mathErr, interestAccumulated) = mulScalarTruncate(simpleInterestFactor, borrowsPrior);
        require(mathErr == MathError.NO_ERROR, 'calc interest acc error');

        (mathErr, totalBorrowsNew) = addUInt(interestAccumulated, borrowsPrior);
        require(mathErr == MathError.NO_ERROR, 'calc total borrows error');

        return totalBorrowsNew;
    }

    /// @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex
    /// @param account The address whose balance should be calculated after updating borrowIndex
    /// @return The calculated balance
    function borrowBalanceCurrent(address account) external view override returns (uint) {
        (MathError err0, uint borrowIndex) = calCurrentBorrowIndex();
        require(err0 == MathError.NO_ERROR, "calc borrow index fail");
        (MathError err1, uint result) = borrowBalanceStoredInternalWithBorrowerIndex(account, borrowIndex);
        require(err1 == MathError.NO_ERROR, "calc fail");
        return result;
    }

    function borrowBalanceStored(address account) external override view returns (uint){
        return accountBorrows[account].principal;
    }


    /// @notice Return the borrow balance of account based on stored data
    /// @param account The address whose balance should be calculated
    /// @return (error code, the calculated balance or 0 if error code is non-zero)
    function borrowBalanceStoredInternal(address account) internal view returns (MathError, uint) {
        return borrowBalanceStoredInternalWithBorrowerIndex(account, borrowIndex);
    }

    /// @notice Return the borrow balance of account based on stored data
    /// @param account The address whose balance should be calculated
    /// @return (error code, the calculated balance or 0 if error code is non-zero)
    function borrowBalanceStoredInternalWithBorrowerIndex(address account, uint borrowIndex) internal view returns (MathError, uint) {
        /* Note: we do not assert that the market is up to date */
        MathError mathErr;
        uint principalTimesIndex;
        uint result;

        /* Get borrowBalance and borrowIndex */
        BorrowSnapshot storage borrowSnapshot = accountBorrows[account];

        /* If borrowBalance = 0 then borrowIndex is likely also 0.
         * Rather than failing the calculation with a division by 0, we immediately return 0 in this case.
         */
        if (borrowSnapshot.principal == 0) {
            return (MathError.NO_ERROR, 0);
        }

        /* Calculate new borrow balance using the interest index:
         *  recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex
         */
        (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, borrowIndex);
        if (mathErr != MathError.NO_ERROR) {
            return (mathErr, 0);
        }

        (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);
        if (mathErr != MathError.NO_ERROR) {
            return (mathErr, 0);
        }

        return (MathError.NO_ERROR, result);
    }

    /// @notice Accrue interest then return the up-to-date exchange rate
    /// @return Calculated exchange rate scaled by 1e18
    function exchangeRateCurrent() public override nonReentrant returns (uint) {
        accrueInterest();
        return exchangeRateStored();
    }

    /// Calculates the exchange rate from the underlying to the LToken
    /// @dev This function does not accrue interest before calculating the exchange rate
    /// @return Calculated exchange rate scaled by 1e18
    function exchangeRateStored() public override view returns (uint) {
        (MathError err, uint result) = exchangeRateStoredInternal();
        require(err == MathError.NO_ERROR, "calc fail");
        return result;
    }

    /// @notice Calculates the exchange rate from the underlying to the LToken
    /// @dev This function does not accrue interest before calculating the exchange rate
    /// @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 + totalBorrows - totalReserves) / totalSupply
             */
            uint _totalCash = getCashPrior();
            uint cashPlusBorrowsMinusReserves;
            Exp memory exchangeRate;
            MathError mathErr;

            (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(_totalCash, totalBorrows, totalReserves);
            if (mathErr != MathError.NO_ERROR) {
                return (mathErr, 0);
            }

            (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _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 override view returns (uint) {
        return IERC20(underlying).balanceOf(address(this));
    }

    function calCurrentBorrowIndex() internal view returns (MathError, uint) {
        /* Remember the initial block number */
        uint currentBlockNumber = getBlockNumber();
        uint accrualBlockNumberPrior = accrualBlockNumber;
        uint borrowIndexNew;
        /* Short-circuit accumulating 0 interest */
        if (accrualBlockNumberPrior == currentBlockNumber) {
            return (MathError.NO_ERROR, borrowIndex);
        }
        uint borrowRateMantissa = getBorrowRateInternal(getCashPrior(), totalBorrows, totalReserves);
        (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);

        Exp memory simpleInterestFactor;
        (mathErr, simpleInterestFactor) = mulScalar(Exp({mantissa : borrowRateMantissa}), blockDelta);
        if (mathErr != MathError.NO_ERROR) {
            return (mathErr, 0);
        }
        (mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndex, borrowIndex);
        return (mathErr, borrowIndexNew);
    }

    /// @notice Applies accrued interest to total borrows and reserves
    /// @dev This calculates interest accrued from the last checkpointed block
    ///   up to the current block and writes new checkpoint to storage.
    function accrueInterest() public override {
        /* Remember the initial block number */
        uint currentBlockNumber = getBlockNumber();
        uint accrualBlockNumberPrior = accrualBlockNumber;

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

        /* Read the previous values out of storage */
        uint cashPrior = getCashPrior();
        uint borrowsPrior = totalBorrows;
        uint borrowIndexPrior = borrowIndex;
        uint reservesPrior = totalReserves;

        /* Calculate the current borrow interest rate */
        uint borrowRateMantissa = getBorrowRateInternal(cashPrior, borrowsPrior, reservesPrior);
        require(borrowRateMantissa <= borrowRateMaxMantissa, "borrower rate higher");

        /* Calculate the number of blocks elapsed since the last accrual */
        (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior);
        require(mathErr == MathError.NO_ERROR, "calc block delta erro");


        /*
         * Calculate the interest accumulated into borrows and reserves and the new index:
         *  simpleInterestFactor = borrowRate * blockDelta
         *  interestAccumulated = simpleInterestFactor * totalBorrows
         *  totalBorrowsNew = interestAccumulated + totalBorrows
         *  borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex
         */

        Exp memory simpleInterestFactor;
        uint interestAccumulated;
        uint totalBorrowsNew;
        uint borrowIndexNew;
        uint totalReservesNew;

        (mathErr, simpleInterestFactor) = mulScalar(Exp({mantissa : borrowRateMantissa}), blockDelta);
        require(mathErr == MathError.NO_ERROR, 'calc interest factor error');

        (mathErr, interestAccumulated) = mulScalarTruncate(simpleInterestFactor, borrowsPrior);
        require(mathErr == MathError.NO_ERROR, 'calc interest acc error');

        (mathErr, totalBorrowsNew) = addUInt(interestAccumulated, borrowsPrior);
        require(mathErr == MathError.NO_ERROR, 'calc total borrows error');

        (mathErr, totalReservesNew) = mulScalarTruncateAddUInt(Exp({mantissa : reserveFactorMantissa}), interestAccumulated, reservesPrior);
        require(mathErr == MathError.NO_ERROR, 'calc total reserves error');

        (mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndexPrior, borrowIndexPrior);
        require(mathErr == MathError.NO_ERROR, 'calc borrows index error');


        /* We write the previously calculated values into storage */
        accrualBlockNumber = currentBlockNumber;
        borrowIndex = borrowIndexNew;
        totalBorrows = totalBorrowsNew;
        totalReserves = totalReservesNew;

        /* We emit an AccrueInterest event */
        emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew);

    }

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

    /// @notice User supplies assets into the market and receives lTokens in exchange
    /// @dev Assumes interest has already been accrued up to the current block
    /// @param minter The address of the account which is supplying the assets
    /// @param mintAmount The amount of the underlying asset to supply
    /// @return uint the actual mint amount.
    function mintFresh(address minter, uint mintAmount, bool isDelegete) internal sameBlock returns (uint) {
        MintLocalVars memory vars;
        (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
        require(vars.mathErr == MathError.NO_ERROR, 'calc exchangerate error');

        /*
         *  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.
         */
        if (isDelegete) {
            uint balanceBefore = getCashPrior();
            LPoolDepositor(msg.sender).transferToPool(minter, mintAmount);
            uint balanceAfter = getCashPrior();
            require(balanceAfter > balanceBefore, 'mint 0');
            vars.actualMintAmount = balanceAfter - balanceBefore;
        } else {
            vars.actualMintAmount = doTransferIn(minter, mintAmount, true);
        }
        /*
         * We get the current exchange rate and calculate the number of lTokens to be minted:
         *  mintTokens = actualMintAmount / exchangeRate
         */

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

        (ControllerInterface(controller)).mintAllowed(minter, vars.mintTokens);
        /*
         * We calculate the new total supply of lTokens 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, "calc supply new failed");

        (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[minter], vars.mintTokens);
        require(vars.mathErr == MathError.NO_ERROR, "calc tokens new ailed");

        /* 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 call the defense hook */

        return vars.actualMintAmount;
    }


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

    /// @notice User redeems lTokens in exchange for the underlying asset
    /// @dev Assumes interest has already been accrued up to the current block
    /// @param redeemer The address of the account which is redeeming the tokens
    /// @param redeemTokensIn The number of lTokens 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 lTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)
    function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal sameBlock {
        require(redeemTokensIn == 0 || redeemAmountIn == 0, "one be zero");

        RedeemLocalVars memory vars;

        /* exchangeRate = invoke Exchange Rate Stored() */
        (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
        require(vars.mathErr == MathError.NO_ERROR, 'calc exchangerate error');

        /* 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);
            require(vars.mathErr == MathError.NO_ERROR, 'calc redeem amount error');
        } 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}));
            require(vars.mathErr == MathError.NO_ERROR, 'calc redeem tokens error');
            vars.redeemAmount = redeemAmountIn;
        }

        (ControllerInterface(controller)).redeemAllowed(redeemer, vars.redeemTokens);

        /*
         * 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);
        require(vars.mathErr == MathError.NO_ERROR, 'calc supply new error');

        (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);
        require(vars.mathErr == MathError.NO_ERROR, 'calc token new error');
        require(getCashPrior() >= vars.redeemAmount, 'cash < redeem');

        /* We write previously calculated values into storage */
        totalSupply = vars.totalSupplyNew;
        accountTokens[redeemer] = vars.accountTokensNew;
        /*
         * 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, true);


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

        /* We call the defense hook */
    }

    struct BorrowLocalVars {
        MathError mathErr;
        uint accountBorrows;
        uint accountBorrowsNew;
        uint totalBorrowsNew;
    }

    /// @notice Users borrow assets from the protocol to their own address
    /// @param borrowAmount The amount of the underlying asset to borrow
    function borrowFresh(address payable borrower, address payable payee, uint borrowAmount) internal sameBlock {
        (ControllerInterface(controller)).borrowAllowed(borrower, payee, borrowAmount);

        /* Fail gracefully if protocol has insufficient underlying cash */
        require(getCashPrior() >= borrowAmount, 'cash<borrow');

        BorrowLocalVars memory vars;

        /*
         * We calculate the new borrower and total borrow balances, failing on overflow:
         *  accountBorrowsNew = accountBorrows + borrowAmount
         *  totalBorrowsNew = totalBorrows + borrowAmount
         */
        (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);
        require(vars.mathErr == MathError.NO_ERROR, 'calc acc borrows error');

        (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount);
        require(vars.mathErr == MathError.NO_ERROR, 'calc acc borrows error');

        (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount);
        require(vars.mathErr == MathError.NO_ERROR, 'calc total borrows error');

        /* We write the previously calculated values into storage */
        accountBorrows[borrower].principal = vars.accountBorrowsNew;
        accountBorrows[borrower].interestIndex = borrowIndex;
        totalBorrows = vars.totalBorrowsNew;

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

        /* We emit a Borrow event */
        emit Borrow(borrower, payee, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);

        /* We call the defense hook */
    }

    struct RepayBorrowLocalVars {
        MathError mathErr;
        uint repayAmount;
        uint borrowerIndex;
        uint accountBorrows;
        uint accountBorrowsNew;
        uint totalBorrowsNew;
        uint actualRepayAmount;
        uint badDebtsAmount;
    }

    /// @notice Borrows are repaid by another user (possibly the borrower).
    /// @param payer the account paying off the borrow
    /// @param borrower the account with the debt being payed off
    /// @param repayAmount the amount of undelrying tokens being returned
    /// @param isEnd if is true, the account with the debt change to 0
    function repayBorrowFresh(address payer, address borrower, uint repayAmount, bool isEnd) internal sameBlock returns (uint) {
        (ControllerInterface(controller)).repayBorrowAllowed(payer, borrower, repayAmount, isEnd);

        RepayBorrowLocalVars memory vars;

        /* We remember the original borrowerIndex for verification purposes */
        vars.borrowerIndex = accountBorrows[borrower].interestIndex;

        /* We fetch the amount the borrower owes, with accumulated interest */
        (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);
        require(vars.mathErr == MathError.NO_ERROR, 'calc acc borrow error');

        /* If repayAmount == -1, repayAmount = accountBorrows */
        if (repayAmount == uint(- 1)) {
            vars.repayAmount = vars.accountBorrows;
        } else {
            vars.repayAmount = repayAmount;
        }
        vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount, false);


        if (isEnd && vars.accountBorrows > vars.actualRepayAmount) {
            vars.badDebtsAmount = vars.accountBorrows - vars.actualRepayAmount;
        }

        /*
        *  We calculate the new borrower and total borrow balances, failing on underflow:
        *  accountBorrowsNew = accountBorrows - repayAmount
        *  totalBorrowsNew = totalBorrows - repayAmount
        */
        if (vars.accountBorrows < vars.actualRepayAmount) {
            require(vars.actualRepayAmount.mul(1e18).div(vars.accountBorrows) <= 105e16, 'repay more than 5%');
            vars.accountBorrowsNew = 0;
        } else {
            vars.accountBorrowsNew = vars.accountBorrows - vars.actualRepayAmount;
        }

        if (isEnd) {
            vars.accountBorrowsNew = 0;
        }
        //Avoid mantissa errors
        if (totalBorrows < vars.accountBorrows.sub(vars.accountBorrowsNew) || vars.actualRepayAmount > totalBorrows) {
            vars.totalBorrowsNew = 0;
        } else {
            vars.totalBorrowsNew = totalBorrows.sub(vars.accountBorrows.sub(vars.accountBorrowsNew));
        }

        /* We write the previously calculated values into storage */
        accountBorrows[borrower].principal = vars.accountBorrowsNew;
        accountBorrows[borrower].interestIndex = borrowIndex;
        totalBorrows = vars.totalBorrowsNew;

        /* We emit a RepayBorrow event */
        emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.badDebtsAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);

        /* We call the defense hook */

        return vars.actualRepayAmount;
    }

    /*** Admin Functions ***/

    /// @notice Sets a new CONTROLLER for the market
    /// @dev Admin function to set a new controller
    function setController(address newController) external override onlyAdmin {
        require(address(0) != newController, "0x");
        address oldController = controller;
        controller = newController;
        // Emit NewController(oldController, newController)
        emit NewController(oldController, newController);
    }

    function setBorrowCapFactorMantissa(uint newBorrowCapFactorMantissa) external override onlyAdmin {
        require(newBorrowCapFactorMantissa <= 1e18, 'Factor too large');
        uint oldBorrowCapFactorMantissa = borrowCapFactorMantissa;
        borrowCapFactorMantissa = newBorrowCapFactorMantissa;
        emit NewBorrowCapFactorMantissa(oldBorrowCapFactorMantissa, borrowCapFactorMantissa);
    }

    function setInterestParams(uint baseRatePerBlock_, uint multiplierPerBlock_, uint jumpMultiplierPerBlock_, uint kink_) external override {
        (ControllerInterface(controller)).updateInterestAllowed(msg.sender);
        //accrueInterest except first
        if (baseRatePerBlock != 0) {
            accrueInterest();
        }
        // total rate perYear < 2000%
        require(baseRatePerBlock_ < 1e13, 'Base rate too large');
        baseRatePerBlock = baseRatePerBlock_;
        require(multiplierPerBlock_ < 1e13, 'Mul rate too large');
        multiplierPerBlock = multiplierPerBlock_;
        require(jumpMultiplierPerBlock_ < 1e13, 'Jump rate too large');
        jumpMultiplierPerBlock = jumpMultiplierPerBlock_;
        require(kink_ <= 1e18, 'Kline too large');
        kink = kink_;
        emit NewInterestParam(baseRatePerBlock_, multiplierPerBlock_, jumpMultiplierPerBlock_, kink_);
    }

    function setReserveFactor(uint newReserveFactorMantissa) external override onlyAdmin {
        require(newReserveFactorMantissa <= 1e18, 'Factor too large');
        accrueInterest();
        uint oldReserveFactorMantissa = reserveFactorMantissa;
        reserveFactorMantissa = newReserveFactorMantissa;
        emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);
    }

    function addReserves(uint addAmount) external payable override nonReentrant {
        accrueInterest();
        uint totalReservesNew;
        uint actualAddAmount = doTransferIn(msg.sender, addAmount, true);
        totalReservesNew = totalReserves.add(actualAddAmount);
        totalReserves = totalReservesNew;
        emit ReservesAdded(msg.sender, actualAddAmount, totalReservesNew);
    }

    function reduceReserves(address payable to, uint reduceAmount) external override nonReentrant onlyAdmin {
        accrueInterest();
        uint totalReservesNew;
        totalReservesNew = totalReserves.sub(reduceAmount);
        totalReserves = totalReservesNew;
        doTransferOut(to, reduceAmount, true);
        emit ReservesReduced(to, reduceAmount, totalReservesNew);
    }

    modifier sameBlock() {
        require(accrualBlockNumber == getBlockNumber(), 'not same block');
        _;
    }
}

File 2 of 15 : LPoolInterface.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;


abstract contract LPoolStorage {

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

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

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

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

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


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

    //Approved token transfer amounts on behalf of others
    mapping(address => mapping(address => uint)) internal transferAllowances;


    //Maximum borrow rate that can ever be applied (.0005% / block)
    uint internal constant borrowRateMaxMantissa = 0.0005e16;

    /**
    * Maximum fraction of borrower cap(80%)
    */
    uint public  borrowCapFactorMantissa;
    /**
     * Contract which oversees inter-lToken operations
     */
    address public controller;


    // Initial exchange rate used when minting the first lTokens (used when totalSupply = 0)
    uint internal initialExchangeRateMantissa;

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

    /**
     * Accumulator of the total earned interest rate since the opening of the market
     */
    uint public borrowIndex;

    /**
     * Total amount of outstanding borrows of the underlying in this market
     */
    uint public totalBorrows;

    //useless
    uint internal totalCash;

    /**
    * @notice Fraction of interest currently set aside for reserves 20%
    */
    uint public reserveFactorMantissa;

    uint public totalReserves;

    address public underlying;

    bool public isWethPool;

    /**
     * Container for borrow balance information
     * principal Total balance (with accrued interest), after applying the most recent balance-changing action
     * interestIndex Global borrowIndex as of the most recent balance-changing action
     */
    struct BorrowSnapshot {
        uint principal;
        uint interestIndex;
    }

    uint256 public baseRatePerBlock;
    uint256 public multiplierPerBlock;
    uint256 public jumpMultiplierPerBlock;
    uint256 public kink;

    // Mapping of account addresses to outstanding borrow balances

    mapping(address => BorrowSnapshot) internal accountBorrows;


    /**
    * Block timestamp that interest was last accrued at
    */
    uint public accrualBlockTimestamp;



    /*** Token Events ***/

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

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

    /**
     * EIP20 Approval event
     */
    event Approval(address indexed owner, address indexed spender, uint amount);

    /*** Market Events ***/

    /**
     * Event emitted when interest is accrued
     */
    event AccrueInterest(uint cashPrior, uint interestAccumulated, uint borrowIndex, uint totalBorrows);

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

    /**
     * Event emitted when underlying is borrowed
     */
    event Borrow(address borrower, address payee, uint borrowAmount, uint accountBorrows, uint totalBorrows);

    /**
     * Event emitted when a borrow is repaid
     */
    event RepayBorrow(address payer, address borrower, uint repayAmount, uint badDebtsAmount, uint accountBorrows, uint totalBorrows);

    /*** Admin Events ***/

    /**
     * Event emitted when controller is changed
     */
    event NewController(address oldController, address newController);

    /**
     * Event emitted when interestParam is changed
     */
    event NewInterestParam(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);

    /**
    * @notice Event emitted when the reserve factor is changed
    */
    event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);

    /**
     * @notice Event emitted when the reserves are added
     */
    event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);

    /**
     * @notice Event emitted when the reserves are reduced
     */
    event ReservesReduced(address to, uint reduceAmount, uint newTotalReserves);

    event NewBorrowCapFactorMantissa(uint oldBorrowCapFactorMantissa, uint newBorrowCapFactorMantissa);

}

abstract contract LPoolInterface is LPoolStorage {


    /*** User Interface ***/

    function transfer(address dst, uint amount) external virtual returns (bool);

    function transferFrom(address src, address dst, uint amount) external virtual returns (bool);

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

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

    function balanceOf(address owner) external virtual view returns (uint);

    function balanceOfUnderlying(address owner) external virtual returns (uint);

    /*** Lender & Borrower Functions ***/

    function mint(uint mintAmount) external virtual;

    function mintTo(address to, uint amount) external payable virtual;

    function mintEth() external payable virtual;

    function redeem(uint redeemTokens) external virtual;

    function redeemUnderlying(uint redeemAmount) external virtual;

    function borrowBehalf(address borrower, uint borrowAmount) external virtual;

    function repayBorrowBehalf(address borrower, uint repayAmount) external virtual;

    function repayBorrowEndByOpenLev(address borrower, uint repayAmount) external virtual;

    function availableForBorrow() external view virtual returns (uint);

    function getAccountSnapshot(address account) external virtual view returns (uint, uint, uint);

    function borrowRatePerBlock() external virtual view returns (uint);

    function supplyRatePerBlock() external virtual view returns (uint);

    function totalBorrowsCurrent() external virtual view returns (uint);

    function borrowBalanceCurrent(address account) external virtual view returns (uint);

    function borrowBalanceStored(address account) external virtual view returns (uint);

    function exchangeRateCurrent() public virtual returns (uint);

    function exchangeRateStored() public virtual view returns (uint);

    function getCash() external view virtual returns (uint);

    function accrueInterest() public virtual;

    /*** Admin Functions ***/

    function setController(address newController) external virtual;

    function setBorrowCapFactorMantissa(uint newBorrowCapFactorMantissa) external virtual;

    function setInterestParams(uint baseRatePerBlock_, uint multiplierPerBlock_, uint jumpMultiplierPerBlock_, uint kink_) external virtual;

    function setReserveFactor(uint newReserveFactorMantissa) external virtual;

    function addReserves(uint addAmount) external payable virtual;

    function reduceReserves(address payable to, uint reduceAmount) external virtual;

}

File 3 of 15 : LPoolDepositor.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;

import "./LPoolInterface.sol";
import "../lib/Exponential.sol";
import "../lib/TransferHelper.sol";
import "../dex/DexAggregatorInterface.sol";
import "../IWETH.sol";
import "../Adminable.sol";
import "../DelegateInterface.sol";

/// @title User Deposit Contract
/// @author OpenLeverage
/// @notice Use this contract for supplying lending pool funds  
contract LPoolDepositor is DelegateInterface, Adminable {
    using TransferHelper for IERC20;

    mapping(address => mapping(address => uint)) allowedToTransfer;

    constructor() {
    }

    /// @notice Deposit ERC20 token
    function deposit(address pool, uint amount) external {
        allowedToTransfer[pool][msg.sender] = amount;
        LPoolInterface(pool).mintTo(msg.sender, amount);
    }

    /// @dev Callback function for lending pool 
    function transferToPool(address from, uint amount) external{
        require(allowedToTransfer[msg.sender][from] == amount, "for callback only");
        delete allowedToTransfer[msg.sender][from];
        IERC20(LPoolInterface(msg.sender).underlying()).safeTransferFrom(from, msg.sender, amount);
    }

    /// @notice Deposit native token
    function depositNative(address payable pool) external payable  {
        LPoolInterface(pool).mintTo{value : msg.value}(msg.sender, 0);
    }
}

File 4 of 15 : TransferHelper.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import "@openzeppelin/contracts/math/SafeMath.sol";

/**
 * @title TransferHelper
 * @dev Wrappers around ERC20 operations that returns the value received by recipent and the actual allowance of approval.
 * To use this library you can add a `using TransferHelper for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
 library TransferHelper{
    // using SafeMath for uint;

    function safeTransfer(IERC20 _token, address _to, uint _amount) internal returns (uint amountReceived){
        if (_amount > 0){
            uint balanceBefore = _token.balanceOf(_to);
            address(_token).call(abi.encodeWithSelector(_token.transfer.selector, _to, _amount));
            uint balanceAfter = _token.balanceOf(_to);
            require(balanceAfter > balanceBefore, "TF");
            amountReceived = balanceAfter - balanceBefore;
        }
    }

    function safeTransferFrom(IERC20 _token, address _from, address _to, uint _amount) internal returns (uint amountReceived){
        if (_amount > 0){
            uint balanceBefore = _token.balanceOf(_to);
            address(_token).call(abi.encodeWithSelector(_token.transferFrom.selector, _from, _to, _amount));
            // _token.transferFrom(_from, _to, _amount);
            uint balanceAfter = _token.balanceOf(_to);
            require(balanceAfter > balanceBefore, "TFF");
            amountReceived = balanceAfter - balanceBefore;
        }
    }

    function safeApprove(IERC20 _token, address _spender, uint256 _amount) internal returns (uint) {
        bool success;
        if (_token.allowance(address(this), _spender) != 0){
            (success, ) = address(_token).call(abi.encodeWithSelector(_token.approve.selector, _spender, 0));
            require(success, "AF");
        }
        (success, ) = address(_token).call(abi.encodeWithSelector(_token.approve.selector, _spender, _amount));
        require(success, "AF");

        return _token.allowance(address(this), _spender);
    }

    // function safeIncreaseAllowance(IERC20 _token, address _spender, uint256 _amount) internal returns (uint) {
    //     uint256 allowanceBefore = _token.allowance(address(this), _spender);
    //     uint256 allowanceNew = allowanceBefore.add(_amount);
    //     uint256 allowanceAfter = safeApprove(_token, _spender, allowanceNew);
    //     require(allowanceAfter == allowanceNew, "AF");
    //     return allowanceNew;
    // }

    // function safeDecreaseAllowance(IERC20 _token, address _spender, uint256 _amount) internal returns (uint) {
    //     uint256 allowanceBefore = _token.allowance(address(this), _spender);
    //     uint256 allowanceNew = allowanceBefore.sub(_amount);
    //     uint256 allowanceAfter = safeApprove(_token, _spender, allowanceNew);
    //     require(allowanceAfter == allowanceNew, "AF");
    //     return allowanceNew;
    // }
}

File 5 of 15 : Exponential.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity >=0.6.0 <0.8.0;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./CarefulMath.sol";

/**
 * @title Exponential module for storing fixed-precision decimals
 * @author Compound
 * 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 {
    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 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 fra) = divScalarByExp(scalar, divisor);
        if (err != MathError.NO_ERROR) {
            return (err, 0);
        }

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

    /**
     * @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.
        require(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);
    }

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

File 6 of 15 : CarefulMath.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.6.0 <0.8.0;

/**
  * @title Careful Math
  * @author Compound
  * 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 7 of 15 : DexAggregatorInterface.sol
// SPDX-License-Identifier: BUSL-1.1

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

interface DexAggregatorInterface {

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

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

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

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

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

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

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

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

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

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

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

File 8 of 15 : IWETH.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;

interface IWETH {
    function deposit() external payable;

    function withdraw(uint256) external;
}

File 9 of 15 : DelegateInterface.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;


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

}

File 10 of 15 : ControllerInterface.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;

pragma experimental ABIEncoderV2;

import "./liquidity/LPoolInterface.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./dex/DexAggregatorInterface.sol";

contract ControllerStorage {

    //lpool-pair
    struct LPoolPair {
        address lpool0;
        address lpool1;
    }
    //lpool-distribution
    struct LPoolDistribution {
        uint64 startTime;
        uint64 endTime;
        uint64 duration;
        uint64 lastUpdateTime;
        uint256 totalRewardAmount;
        uint256 rewardRate;
        uint256 rewardPerTokenStored;
        uint256 extraTotalToken;
    }
    //lpool-rewardByAccount
    struct LPoolRewardByAccount {
        uint rewardPerTokenStored;
        uint rewards;
        uint extraToken;
    }

    struct OLETokenDistribution {
        uint supplyBorrowBalance;
        uint extraBalance;
        uint128 updatePricePer;
        uint128 liquidatorMaxPer;
        uint16 liquidatorOLERatio;//300=>300%
        uint16 xoleRaiseRatio;//150=>150%
        uint128 xoleRaiseMinAmount;
    }

    IERC20 public oleToken;

    address public xoleToken;

    address public wETH;

    address public lpoolImplementation;

    //interest param
    uint256 public baseRatePerBlock;
    uint256 public multiplierPerBlock;
    uint256 public jumpMultiplierPerBlock;
    uint256 public kink;

    bytes public oleWethDexData;

    address public openLev;

    DexAggregatorInterface public dexAggregator;

    bool public suspend;

    //useless
    OLETokenDistribution public oleTokenDistribution;
    //token0=>token1=>pair
    mapping(address => mapping(address => LPoolPair)) public lpoolPairs;
    //useless
    //marketId=>isDistribution
    mapping(uint => bool) public marketExtraDistribution;
    //marketId=>isSuspend
    mapping(uint => bool) public marketSuspend;
    //useless
    //pool=>allowed
    mapping(address => bool) public lpoolUnAlloweds;
    //useless
    //pool=>bool=>distribution(true is borrow,false is supply)
    mapping(LPoolInterface => mapping(bool => LPoolDistribution)) public lpoolDistributions;
    //useless
    //pool=>bool=>distribution(true is borrow,false is supply)
    mapping(LPoolInterface => mapping(bool => mapping(address => LPoolRewardByAccount))) public lPoolRewardByAccounts;

    bool public suspendAll;

    event LPoolPairCreated(address token0, address pool0, address token1, address pool1, uint16 marketId, uint16 marginLimit, bytes dexData);

}
/**
  * @title Controller
  * @author OpenLeverage
  */
interface ControllerInterface {

    function createLPoolPair(address tokenA, address tokenB, uint16 marginLimit, bytes memory dexData) external;

    /*** Policy Hooks ***/

    function mintAllowed(address minter, uint lTokenAmount) external;

    function transferAllowed(address from, address to, uint lTokenAmount) external;

    function redeemAllowed(address redeemer, uint lTokenAmount) external;

    function borrowAllowed(address borrower, address payee, uint borrowAmount) external;

    function repayBorrowAllowed(address payer, address borrower, uint repayAmount, bool isEnd) external;

    function liquidateAllowed(uint marketId, address liquidator, uint liquidateAmount, bytes memory dexData) external;

    function marginTradeAllowed(uint marketId) external view returns (bool);

    function closeTradeAllowed(uint marketId) external view returns (bool);

    function updatePriceAllowed(uint marketId, address to) external;

    function updateInterestAllowed(address payable sender) external;

    /*** Admin Functions ***/

    function setLPoolImplementation(address _lpoolImplementation) external;

    function setOpenLev(address _openlev) external;

    function setDexAggregator(DexAggregatorInterface _dexAggregator) external;

    function setInterestParam(uint256 _baseRatePerBlock, uint256 _multiplierPerBlock, uint256 _jumpMultiplierPerBlock, uint256 _kink) external;

    function setLPoolUnAllowed(address lpool, bool unAllowed) external;

    function setSuspend(bool suspend) external;

    function setSuspendAll(bool suspend) external;

    function setMarketSuspend(uint marketId, bool suspend) external;

    function setOleWethDexData(bytes memory _oleWethDexData) external;


}

File 11 of 15 : Adminable.sol
// SPDX-License-Identifier: BUSL-1.1


pragma solidity 0.7.6;

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

    event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);

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

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

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

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

}

File 12 of 15 : IUniswapV2Factory.sol
pragma solidity >=0.5.0;

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

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

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

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

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

File 13 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 14 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 15 of 15 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

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

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

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

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

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

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

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

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

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cashPrior","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"Borrow","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":"uint256","name":"oldBorrowCapFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBorrowCapFactorMantissa","type":"uint256"}],"name":"NewBorrowCapFactorMantissa","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldController","type":"address"},{"indexed":false,"internalType":"address","name":"newController","type":"address"}],"name":"NewController","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"baseRatePerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplierPerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"jumpMultiplierPerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"kink","type":"uint256"}],"name":"NewInterestParam","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":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","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":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"badDebtsAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"benefactor","type":"address"},{"indexed":false,"internalType":"uint256","name":"addAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"reduceAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","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"},{"inputs":[],"name":"acceptAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accrualBlockTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accrueInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"addAmount","type":"uint256"}],"name":"addReserves","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableForBorrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"baseRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowBehalf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"borrowCapFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"developer","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"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"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"underlying_","type":"address"},{"internalType":"bool","name":"isWethPool_","type":"bool"},{"internalType":"address","name":"controller_","type":"address"},{"internalType":"uint256","name":"baseRatePerBlock_","type":"uint256"},{"internalType":"uint256","name":"multiplierPerBlock_","type":"uint256"},{"internalType":"uint256","name":"jumpMultiplierPerBlock_","type":"uint256"},{"internalType":"uint256","name":"kink_","type":"uint256"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isWethPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"jumpMultiplierPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kink","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintEth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintTo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"multiplierPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"reduceAmount","type":"uint256"}],"name":"reduceReserves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"repayBorrowBehalf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"repayBorrowEndByOpenLev","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newBorrowCapFactorMantissa","type":"uint256"}],"name":"setBorrowCapFactorMantissa","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newController","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"baseRatePerBlock_","type":"uint256"},{"internalType":"uint256","name":"multiplierPerBlock_","type":"uint256"},{"internalType":"uint256","name":"jumpMultiplierPerBlock_","type":"uint256"},{"internalType":"uint256","name":"kink_","type":"uint256"}],"name":"setInterestParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"setPendingAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"setReserveFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supplyRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50600380546001600160a01b031916331790556001601a55614eef806100376000396000f3fe60806040526004361061036b5760003560e01c8063856e5bb3116101c6578063c89a6368116100f7578063ebd0847f11610095578063f851a4401161006f578063f851a44014610cae578063f8f9da2814610cc3578063fb0fc2b614610cd8578063fd2da33914610ced5761036b565b8063ebd0847f14610c48578063f14039de14610c84578063f77c479114610c995761036b565b8063cfa99201116100d1578063cfa9920114610bc6578063d245445b14610bdb578063db006a7514610be3578063dd62ed3e14610c0d5761036b565b8063c89a636814610a1a578063ca4b208b14610b9c578063cc2c929e14610bb15761036b565b8063a6afed9511610164578063ae9d70b01161013e578063ae9d70b01461098a578063b9f9850a1461099f578063bd6d894d146109b4578063c37f68e2146109c95761036b565b8063a6afed9514610927578063a9059cbb1461093c578063aa5af0fd146109755761036b565b806392eefe9b116101a057806392eefe9b1461088257806395d89b41146108b557806395dd9193146108ca578063a0712d68146108fd5761036b565b8063856e5bb31461081f5780638726bb89146108585780638f840ddd1461086d5761036b565b80633b1d21a2116102a05780636c540baf1161023e57806370a082311161021857806370a082311461079057806373acee98146107c35780637821a514146107d8578063852a12e3146107f55761036b565b80636c540baf1461072d5780636e45a80f146107425780636f307dc31461077b5761036b565b806347bd37181161027a57806347bd3718146106a65780634dd18bf5146106bb5780635c60da1b146106ee5780636940caa0146107035761036b565b80633b1d21a21461065057806342af38d814610665578063449a52f81461067a5761036b565b8063182df0f51161030d5780632608f818116102e75780632608f8181461058857806326782247146105c1578063313ce567146105f25780633af9e6691461061d5761036b565b8063182df0f5146105065780631c4469831461051b57806323b872dd146105455761036b565b806310cc9d641161034957806310cc9d641461045e578063173b99041461049757806317bfdfbc146104be57806318160ddd146104f15761036b565b806306fdde0314610370578063095ea7b3146103fa5780630e18b68114610447575b600080fd5b34801561037c57600080fd5b50610385610d02565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103bf5781810151838201526020016103a7565b50505050905090810190601f1680156103ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561040657600080fd5b506104336004803603604081101561041d57600080fd5b506001600160a01b038135169060200135610d90565b604080519115158252519081900360200190f35b34801561045357600080fd5b5061045c610dfd565b005b34801561046a57600080fd5b5061045c6004803603604081101561048157600080fd5b506001600160a01b038135169060200135610efd565b3480156104a357600080fd5b506104ac610f67565b60408051918252519081900360200190f35b3480156104ca57600080fd5b506104ac600480360360208110156104e157600080fd5b50356001600160a01b0316610f6d565b3480156104fd57600080fd5b506104ac61103f565b34801561051257600080fd5b506104ac611045565b34801561052757600080fd5b5061045c6004803603602081101561053e57600080fd5b50356110aa565b34801561055157600080fd5b506104336004803603606081101561056857600080fd5b506001600160a01b0381358116916020810135909116906040013561119f565b34801561059457600080fd5b5061045c600480360360408110156105ab57600080fd5b506001600160a01b038135169060200135611205565b3480156105cd57600080fd5b506105d6611265565b604080516001600160a01b039092168252519081900360200190f35b3480156105fe57600080fd5b50610607611274565b6040805160ff9092168252519081900360200190f35b34801561062957600080fd5b506104ac6004803603602081101561064057600080fd5b50356001600160a01b031661127d565b34801561065c57600080fd5b506104ac61131a565b34801561067157600080fd5b506104ac611396565b61045c6004803603604081101561069057600080fd5b506001600160a01b03813516906020013561139c565b3480156106b257600080fd5b506104ac611428565b3480156106c757600080fd5b5061045c600480360360208110156106de57600080fd5b50356001600160a01b031661142e565b3480156106fa57600080fd5b506105d66114e7565b34801561070f57600080fd5b5061045c6004803603602081101561072657600080fd5b50356114f6565b34801561073957600080fd5b506104ac6115e3565b34801561074e57600080fd5b5061045c6004803603604081101561076557600080fd5b506001600160a01b0381351690602001356115e9565b34801561078757600080fd5b506105d6611708565b34801561079c57600080fd5b506104ac600480360360208110156107b357600080fd5b50356001600160a01b0316611717565b3480156107cf57600080fd5b506104ac611732565b61045c600480360360208110156107ee57600080fd5b50356119a0565b34801561080157600080fd5b5061045c6004803603602081101561081857600080fd5b5035611a65565b34801561082b57600080fd5b5061045c6004803603604081101561084257600080fd5b506001600160a01b038135169060200135611acc565b34801561086457600080fd5b506104ac611b2a565b34801561087957600080fd5b506104ac611b30565b34801561088e57600080fd5b5061045c600480360360208110156108a557600080fd5b50356001600160a01b0316611b36565b3480156108c157600080fd5b50610385611c2f565b3480156108d657600080fd5b506104ac600480360360208110156108ed57600080fd5b50356001600160a01b0316611c8a565b34801561090957600080fd5b5061045c6004803603602081101561092057600080fd5b5035611ca5565b34801561093357600080fd5b5061045c611d04565b34801561094857600080fd5b506104336004803603604081101561095f57600080fd5b506001600160a01b0381351690602001356120c0565b34801561098157600080fd5b506104ac612125565b34801561099657600080fd5b506104ac61212b565b3480156109ab57600080fd5b506104ac61214b565b3480156109c057600080fd5b506104ac612151565b3480156109d557600080fd5b506109fc600480360360208110156109ec57600080fd5b50356001600160a01b03166121b8565b60408051938452602084019290925282820152519081900360600190f35b348015610a2657600080fd5b5061045c6004803603610160811015610a3e57600080fd5b6001600160a01b038235811692602081013515159260408201359092169160608201359160808101359160a08201359160c08101359160e082013591908101906101208101610100820135640100000000811115610a9b57600080fd5b820183602082011115610aad57600080fd5b80359060200191846001830284011164010000000083111715610acf57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050640100000000811115610b2257600080fd5b820183602082011115610b3457600080fd5b80359060200191846001830284011164010000000083111715610b5657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050903560ff16915061224f9050565b348015610ba857600080fd5b506105d6612574565b348015610bbd57600080fd5b50610433612583565b348015610bd257600080fd5b506104ac612593565b61045c612599565b348015610bef57600080fd5b5061045c60048036036020811015610c0657600080fd5b5035612645565b348015610c1957600080fd5b506104ac60048036036040811015610c3057600080fd5b506001600160a01b03813581169160200135166126a4565b348015610c5457600080fd5b5061045c60048036036080811015610c6b57600080fd5b50803590602081013590604081013590606001356126cf565b348015610c9057600080fd5b506104ac6128e4565b348015610ca557600080fd5b506105d66128ea565b348015610cba57600080fd5b506105d66128f9565b348015610ccf57600080fd5b506104ac612908565b348015610ce457600080fd5b506104ac612920565b348015610cf957600080fd5b506104ac6129cc565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d885780601f10610d5d57610100808354040283529160200191610d88565b820191906000526020600020905b815481529060010190602001808311610d6b57829003601f168201915b505050505081565b3360008181526009602090815260408083206001600160a01b03871680855290835281842086905581518681529151939493909284927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a360019150505b92915050565b6002546001600160a01b03163314610e465760405162461bcd60e51b8152600401808060200182810382526022815260200180614e226022913960400191505060405180910390fd5b60018054600280546001600160a01b038082166001600160a01b031980861682179687905590921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600254604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a15050565b6002601a541415610f43576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55610f50611d04565b610f5d33838360016129d2565b50506001601a5550565b60115481565b6000806000610f7a612dc6565b90925090506000826003811115610f8d57fe5b14610fd8576040805162461bcd60e51b815260206004820152601660248201527518d85b18c8189bdc9c9bddc81a5b99195e0819985a5b60521b604482015290519081900360640190fd5b600080610fe58684612e7f565b90925090506000826003811115610ff857fe5b14611036576040805162461bcd60e51b815260206004820152600960248201526818d85b18c819985a5b60ba1b604482015290519081900360640190fd5b95945050505050565b60075481565b6000806000611052612f30565b9092509050600082600381111561106557fe5b146110a3576040805162461bcd60e51b815260206004820152600960248201526818d85b18c819985a5b60ba1b604482015290519081900360640190fd5b9150505b90565b6001546001600160a01b03163314611100576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b670de0b6b3a7640000811115611150576040805162461bcd60e51b815260206004820152601060248201526f466163746f7220746f6f206c6172676560801b604482015290519081900360640190fd5b611158611d04565b6011805490829055604080518281526020810184905281517faaa68312e2ea9d50e16af5068410ab56e1a1fd06037b1a35664812c30f821460929181900390910190a15050565b60006002601a5414156111e7576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556111f833858585612fdb565b6001601a55949350505050565b6002601a54141561124b576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55611258611d04565b610f5d33838360006129d2565b6002546001600160a01b031681565b60065460ff1681565b6000806040518060200160405280611293612151565b90526001600160a01b0384166000908152600860205260408120549192509081906112bf90849061333c565b909250905060008260038111156112d257fe5b14611312576040805162461bcd60e51b815260206004820152600b60248201526a18d85b18c819985a5b195960aa1b604482015290519081900360640190fd5b949350505050565b601354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561136557600080fd5b505afa158015611379573d6000803e3d6000fd5b505050506040513d602081101561138f57600080fd5b5051905090565b600a5481565b6002601a5414156113e2576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556113ef611d04565b601354600160a01b900460ff16156114135761140d82346000613388565b5061141f565b610f5d82826001613388565b50506001601a55565b600f5481565b6001546001600160a01b03163314611484576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a15050565b6000546001600160a01b031681565b6001546001600160a01b0316331461154c576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b670de0b6b3a764000081111561159c576040805162461bcd60e51b815260206004820152601060248201526f466163746f7220746f6f206c6172676560801b604482015290519081900360640190fd5b600a805490829055604080518281526020810184905281517f8d783a1777b97cb9cbf193604a8a1bc534234dbaaa16629ff7022f0d63a7322f929181900390910190a15050565b600d5481565b6002601a54141561162f576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556001546001600160a01b0316331461168a576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b611692611d04565b6012546000906116a29083613844565b601281905590506116b5838360016138a1565b604080516001600160a01b03851681526020810184905280820183905290517f3bad0c59cf2f06e7314077049f48a93578cd16f5ef92329f1dab1420a99c177e9181900360600190a150506001601a5550565b6013546001600160a01b031681565b6001600160a01b031660009081526008602052604090205490565b60008061173d6139a3565b600d549091508082141561175757600f54925050506110a7565b600061176161131a565b600f546012549192509060006117788484846139a7565b905065048c273950008111156117cc576040805162461bcd60e51b81526020600482015260146024820152733137b93937bbb2b9103930ba32903434b3b432b960611b604482015290519081900360640190fd5b6000806117d98888613a6a565b909250905060008260038111156117ec57fe5b14611836576040805162461bcd60e51b815260206004820152601560248201527463616c6320626c6f636b2064656c7461206572726f60581b604482015290519081900360640190fd5b61183e614ca7565b60008061185960405180602001604052808881525085613a8d565b9095509250600085600381111561186c57fe5b146118be576040805162461bcd60e51b815260206004820152601a60248201527f63616c6320696e74657265737420666163746f72206572726f72000000000000604482015290519081900360640190fd5b6118c8838961333c565b909550915060008560038111156118db57fe5b14611927576040805162461bcd60e51b815260206004820152601760248201527631b0b6319034b73a32b932b9ba1030b1b19032b93937b960491b604482015290519081900360640190fd5b6119318289613af5565b9095509050600085600381111561194457fe5b14611991576040805162461bcd60e51b815260206004820152601860248201527731b0b631903a37ba30b6103137b93937bbb99032b93937b960411b604482015290519081900360640190fd5b9a505050505050505050505090565b6002601a5414156119e6576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556119f3611d04565b600080611a0233846001613b1b565b601254909150611a129082613bb8565b6012819055604080513381526020810184905280820183905290519193507fa91e67c5ea634cd43a12c5a482724b03de01e85ca68702a53d0c2f45cb7c1dc5919081900360600190a150506001601a5550565b6002601a541415611aab576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55611ab8611d04565b611ac433600083613c12565b506001601a55565b6002601a541415611b12576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55611b1f611d04565b61141f823383614149565b60155481565b60125481565b6001546001600160a01b03163314611b8c576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b6001600160a01b038116611bcc576040805162461bcd60e51b8152602060048201526002602482015261060f60f31b604482015290519081900360640190fd5b600b80546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517ff9b6a28700579d5c8fab50f0ac2dcaa52109b85c369c4f511fcc873330ab6cbb929181900390910190a15050565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d885780601f10610d5d57610100808354040283529160200191610d88565b6001600160a01b031660009081526018602052604090205490565b6002601a541415611ceb576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55611cf8611d04565b61141f33826000613388565b6000611d0e6139a3565b600d5490915080821415611d235750506120be565b6000611d2d61131a565b600f54600e5460125492935090916000611d488585846139a7565b905065048c27395000811115611d9c576040805162461bcd60e51b81526020600482015260146024820152733137b93937bbb2b9103930ba32903434b3b432b960611b604482015290519081900360640190fd5b600080611da98989613a6a565b90925090506000826003811115611dbc57fe5b14611e06576040805162461bcd60e51b815260206004820152601560248201527463616c6320626c6f636b2064656c7461206572726f60581b604482015290519081900360640190fd5b611e0e614ca7565b600080600080611e2c60405180602001604052808a81525087613a8d565b90975094506000876003811115611e3f57fe5b14611e91576040805162461bcd60e51b815260206004820152601a60248201527f63616c6320696e74657265737420666163746f72206572726f72000000000000604482015290519081900360640190fd5b611e9b858c61333c565b90975093506000876003811115611eae57fe5b14611efa576040805162461bcd60e51b815260206004820152601760248201527631b0b6319034b73a32b932b9ba1030b1b19032b93937b960491b604482015290519081900360640190fd5b611f04848c613af5565b90975092506000876003811115611f1757fe5b14611f64576040805162461bcd60e51b815260206004820152601860248201527731b0b631903a37ba30b6103137b93937bbb99032b93937b960411b604482015290519081900360640190fd5b611f7f6040518060200160405280601154815250858b6144a4565b90975090506000876003811115611f9257fe5b14611fe4576040805162461bcd60e51b815260206004820152601960248201527f63616c6320746f74616c207265736572766573206572726f7200000000000000604482015290519081900360640190fd5b611fef858b8c6144a4565b9097509150600087600381111561200257fe5b14612054576040805162461bcd60e51b815260206004820152601860248201527f63616c6320626f72726f777320696e646578206572726f720000000000000000604482015290519081900360640190fd5b600d8e9055600e829055600f8390556012819055604080518d8152602081018690528082018490526060810185905290517f4dec04e750ca11537cabcd8a9eab06494de08da3735bc8871cd41250e190bc049181900360800190a150505050505050505050505050505b565b60006002601a541415612108576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a5561211933808585612fdb565b6001601a559392505050565b600e5481565b600061214661213861131a565b600f546012546011546144f9565b905090565b60165481565b60006002601a541415612199576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556121a6611d04565b6121ae611045565b90506001601a5590565b6001600160a01b038116600090815260086020526040812054819081908180806121e188614566565b9350905060008160038111156121f357fe5b1461220c57600080600096509650965050505050612248565b612214612f30565b92509050600081600381111561222657fe5b1461223f57600080600096509650965050505050612248565b50919450925090505b9193909250565b6001600160a01b038b166122aa576040805162461bcd60e51b815260206004820152601f60248201527f756e6465726c79696e675f20616464726573732063616e6e6f74206265203000604482015290519081900360640190fd5b6001600160a01b038916612305576040805162461bcd60e51b815260206004820152601f60248201527f636f6e74726f6c6c65725f20616464726573732063616e6e6f74206265203000604482015290519081900360640190fd5b6001546001600160a01b03163314612364576040805162461bcd60e51b815260206004820181905260248201527f4f6e6c7920616c6c6f7720746f2062652063616c6c65642062792061646d696e604482015290519081900360640190fd5b600d541580156123745750600e54155b6123b3576040805162461bcd60e51b815260206004820152600b60248201526a696e69746564206f6e636560a81b604482015290519081900360640190fd5b600c849055836123f45760405162461bcd60e51b8152600401808060200182810382526035815260200180614e856035913960400191505060405180910390fd5b600b80546001600160a01b0319166001600160a01b038b161790556013805460ff60a01b1916600160a01b8c15150217905560148890556015879055601686905560178590556124426139a3565b600d556a084595161401484a000000600e55670b1a2bc2ec500000600a5567016345785d8a0000601155825161247f906004906020860190614cba565b508151612493906005906020850190614cba565b506006805460ff191660ff831617905560038054600160a01b60ff60a01b19909116179055601380546001600160a01b0319166001600160a01b038d81169190911791829055604080516318160ddd60e01b8152905192909116916318160ddd91600480820192602092909190829003018186803b15801561251457600080fd5b505afa158015612528573d6000803e3d6000fd5b505050506040513d602081101561253e57600080fd5b50506040805160008082529151339291600080516020614e65833981519152919081900360200190a35050505050505050505050565b6003546001600160a01b031681565b601354600160a01b900460ff1681565b60195481565b6002601a5414156125df576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55601354600160a01b900460ff16612631576040805162461bcd60e51b815260206004820152600c60248201526b1b9bdd08195d1a081c1bdbdb60a21b604482015290519081900360640190fd5b612639611d04565b611ac433346000613388565b6002601a54141561268b576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55612698611d04565b611ac433826000613c12565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b600b54604080516335c8df1d60e11b815233600482015290516001600160a01b0390921691636b91be3a9160248082019260009290919082900301818387803b15801561271b57600080fd5b505af115801561272f573d6000803e3d6000fd5b5050505060145460001461274557612745611d04565b6509184e72a0008410612795576040805162461bcd60e51b815260206004820152601360248201527242617365207261746520746f6f206c6172676560681b604482015290519081900360640190fd5b60148490556509184e72a00083106127e9576040805162461bcd60e51b81526020600482015260126024820152714d756c207261746520746f6f206c6172676560701b604482015290519081900360640190fd5b60158390556509184e72a000821061283e576040805162461bcd60e51b81526020600482015260136024820152724a756d70207261746520746f6f206c6172676560681b604482015290519081900360640190fd5b6016829055670de0b6b3a7640000811115612892576040805162461bcd60e51b815260206004820152600f60248201526e4b6c696e6520746f6f206c6172676560881b604482015290519081900360640190fd5b601781905560408051858152602081018590528082018490526060810183905290517f1d6ada507d93788b3d2e6f68f2999ef7e05f2196ba5cde6db7d0a785745b3c249181900360800190a150505050565b60145481565b600b546001600160a01b031681565b6001546001600160a01b031681565b600061214661291561131a565b600f546012546139a7565b60008061292b61131a565b905060008061293f83600f5460125461457e565b9092509050600082600381111561295257fe5b1461296357600093505050506110a7565b600080612980604051806020016040528085815250600a5461333c565b9092509050600082600381111561299357fe5b146129a6576000955050505050506110a7565b80600f5411156129be576000955050505050506110a7565b600f54900394505050505090565b60175481565b60006129dc6139a3565b600d5414612a22576040805162461bcd60e51b815260206004820152600e60248201526d6e6f742073616d6520626c6f636b60901b604482015290519081900360640190fd5b600b546040805163012c89d360e31b81526001600160a01b0388811660048301528781166024830152604482018790528515156064830152915191909216916309644e9891608480830192600092919082900301818387803b158015612a8757600080fd5b505af1158015612a9b573d6000803e3d6000fd5b50505050612aa7614d46565b6001600160a01b038516600090815260186020526040908190206001015490820152612ad285614566565b6060830181905282826003811115612ae657fe5b6003811115612af157fe5b9052506000905081516003811115612b0557fe5b14612b4f576040805162461bcd60e51b815260206004820152601560248201527431b0b6319030b1b1903137b93937bb9032b93937b960591b604482015290519081900360640190fd5b600019841415612b685760608101516020820152612b70565b602081018490525b612b808682602001516000613b1b565b60c0820152828015612b9957508060c001518160600151115b15612baf5760c081015160608201510360e08201525b8060c0015181606001511015612c4957670e92596fd6290000612bf58260600151612bef670de0b6b3a76400008560c001516145bc90919063ffffffff16565b90614615565b1115612c3d576040805162461bcd60e51b81526020600482015260126024820152717265706179206d6f7265207468616e20352560701b604482015290519081900360640190fd5b60006080820152612c5a565b60c081015160608201510360808201525b8215612c6857600060808201525b60808101516060820151612c7b91613844565b600f541080612c8f5750600f548160c00151115b15612ca057600060a0820152612ccd565b612cc7612cbe8260800151836060015161384490919063ffffffff16565b600f5490613844565b60a08201525b806080015160186000876001600160a01b03166001600160a01b0316815260200190815260200160002060000181905550600e5460186000876001600160a01b03166001600160a01b03168152602001908152602001600020600101819055508060a00151600f819055507f6fadbf7329d21f278e724fa0d4511001a158f2a97ee35c5bc4cf8b64417399ef86868360c001518460e0015185608001518660a0015160405180876001600160a01b03168152602001866001600160a01b03168152602001858152602001848152602001838152602001828152602001965050505050505060405180910390a160c0015195945050505050565b6000806000612dd36139a3565b600d54909150600081831415612df4576000600e5494509450505050612e7b565b6000612e0161291561131a565b9050600080612e108686613a6a565b91509150612e1c614ca7565b612e3460405180602001604052808681525083613a8d565b90935090506000836003811115612e4757fe5b14612e5f578260009850985050505050505050612e7b565b612e6e81600e54600e546144a4565b9099509750505050505050505b9091565b6001600160a01b038216600090815260186020526040812080548291829182918291612eb5576000809550955050505050612f29565b8054612ec1908861467c565b90945092506000846003811115612ed457fe5b14612ee9578360009550955050505050612f29565b612ef78382600101546146bb565b90945091506000846003811115612f0a57fe5b14612f1f578360009550955050505050612f29565b5060009450925050505b9250929050565b600754600090819080612f4b575050600c5460009150612e7b565b6000612f5561131a565b90506000612f61614ca7565b6000612f7284600f5460125461457e565b935090506000816003811115612f8457fe5b14612f9957955060009450612e7b9350505050565b612fa383866146e6565b925090506000816003811115612fb557fe5b14612fca57955060009450612e7b9350505050565b5051600095509350612e7b92505050565b60006001600160a01b038316613038576040805162461bcd60e51b815260206004820152601760248201527f64737420616464726573732063616e6e6f742062652030000000000000000000604482015290519081900360640190fd5b826001600160a01b0316846001600160a01b0316141561308b576040805162461bcd60e51b81526020600482015260096024820152681cdc98c80f48191cdd60ba1b604482015290519081900360640190fd5b600b546040805160016276d1bb60e11b031981526001600160a01b0387811660048301528681166024830152604482018690529151919092169163ff125c8a91606480830192600092919082900301818387803b1580156130eb57600080fd5b505af11580156130ff573d6000803e3d6000fd5b505050506000846001600160a01b0316866001600160a01b031614156131285750600019613150565b506001600160a01b038085166000908152600960209081526040808320938916835292905220545b6000806000806131608588613a6a565b9094509250600084600381111561317357fe5b146131b3576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6001600160a01b0389166000908152600860205260409020546131d69088613a6a565b909450915060008460038111156131e957fe5b14613228576040805162461bcd60e51b815260206004820152600a6024820152690dcdee840cadcdeeaced60b31b604482015290519081900360640190fd5b6001600160a01b03881660009081526008602052604090205461324b9088613af5565b9094509050600084600381111561325e57fe5b1461329b576040805162461bcd60e51b81526020600482015260086024820152670e8dede40daeac6d60c31b604482015290519081900360640190fd5b6001600160a01b03808a16600090815260086020526040808220859055918a1681522081905560001985146132f3576001600160a01b03808a166000908152600960209081526040808320938e168352929052208390555b876001600160a01b0316896001600160a01b0316600080516020614e65833981519152896040518082815260200191505060405180910390a35060019998505050505050505050565b60008060008061334c8686613a8d565b9092509050600082600381111561335f57fe5b146133705750915060009050612f29565b600061337b82614797565b9350935050509250929050565b60006133926139a3565b600d54146133d8576040805162461bcd60e51b815260206004820152600e60248201526d6e6f742073616d6520626c6f636b60901b604482015290519081900360640190fd5b6133e0614d8c565b6133e8612f30565b60208301819052828260038111156133fc57fe5b600381111561340757fe5b905250600090508151600381111561341b57fe5b14613467576040805162461bcd60e51b815260206004820152601760248201527631b0b6319032bc31b430b733b2b930ba329032b93937b960491b604482015290519081900360640190fd5b821561353c57600061347761131a565b9050336001600160a01b031663d7efa12987876040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156134d057600080fd5b505af11580156134e4573d6000803e3d6000fd5b5050505060006134f261131a565b9050818111613531576040805162461bcd60e51b815260206004820152600660248201526506d696e7420360d41b604482015290519081900360640190fd5b0360a082015261354e565b61354885856001613b1b565b60a08201525b61356e8160a00151604051806020016040528084602001518152506147a6565b604083018190528282600381111561358257fe5b600381111561358d57fe5b90525060009050815160038111156135a157fe5b146135eb576040805162461bcd60e51b815260206004820152601560248201527431b0b6319036b4b73a103a37b5b2b71032b93937b960591b604482015290519081900360640190fd5b600b5460408083015181516357739dc560e01b81526001600160a01b038981166004830152602482019290925291519216916357739dc59160448082019260009290919082900301818387803b15801561364457600080fd5b505af1158015613658573d6000803e3d6000fd5b5050505061366c6007548260400151613af5565b606083018190528282600381111561368057fe5b600381111561368b57fe5b905250600090508151600381111561369f57fe5b146136ea576040805162461bcd60e51b815260206004820152601660248201527518d85b18c81cdd5c1c1b1e481b995dc819985a5b195960521b604482015290519081900360640190fd5b6001600160a01b0385166000908152600860205260409081902054908201516137139190613af5565b608083018190528282600381111561372757fe5b600381111561373257fe5b905250600090508151600381111561374657fe5b14613790576040805162461bcd60e51b815260206004820152601560248201527418d85b18c81d1bdad95b9cc81b995dc8185a5b1959605a1b604482015290519081900360640190fd5b60608082015160075560808201516001600160a01b0387166000818152600860209081526040918290209390935560a0850151818601518251938452938301528181019290925290517f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f929181900390910190a1604080820151815190815290516001600160a01b038716913091600080516020614e658339815191529181900360200190a360a0015190505b9392505050565b60008282111561389b576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b601354600160a01b900460ff1680156138b75750805b156139855760135460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b15801561390957600080fd5b505af115801561391d573d6000803e3d6000fd5b5050604051600092506001600160a01b038616915084908381818185875af1925050503d806000811461396c576040519150601f19603f3d011682016040523d82523d6000602084013e613971565b606091505b505090508061397f57600080fd5b5061399e565b60135461399c906001600160a01b031684846147b6565b505b505050565b4390565b6000806139b58585856149de565b905060175481116139f5576139ed6014546139e7670de0b6b3a7640000612bef601554866145bc90919063ffffffff16565b90613bb8565b91505061383d565b6000613a206014546139e7670de0b6b3a7640000612bef6015546017546145bc90919063ffffffff16565b90506000613a396017548461384490919063ffffffff16565b9050613a60826139e7670de0b6b3a7640000612bef601654866145bc90919063ffffffff16565b935050505061383d565b600080838311613a81575060009050818303612f29565b50600390506000612f29565b6000613a97614ca7565b600080613aa886600001518661467c565b90925090506000826003811115613abb57fe5b14613ada57506040805160208101909152600081529092509050612f29565b60408051602081019091529081526000969095509350505050565b600080838301848110613b0d57600092509050612f29565b600260009250925050612f29565b601354600090600160a01b900460ff168015613b345750815b15613ba0575060135460408051630d0e30db60e41b8152905134926001600160a01b03169163d0e30db091849160048082019260009290919082900301818588803b158015613b8257600080fd5b505af1158015613b96573d6000803e3d6000fd5b505050505061383d565b601354611312906001600160a01b0316853086614a16565b60008282018381101561383d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b613c1a6139a3565b600d5414613c60576040805162461bcd60e51b815260206004820152600e60248201526d6e6f742073616d6520626c6f636b60901b604482015290519081900360640190fd5b811580613c6b575080155b613caa576040805162461bcd60e51b815260206004820152600b60248201526a6f6e65206265207a65726f60a81b604482015290519081900360640190fd5b613cb2614d8c565b613cba612f30565b6020830181905282826003811115613cce57fe5b6003811115613cd957fe5b9052506000905081516003811115613ced57fe5b14613d39576040805162461bcd60e51b815260206004820152601760248201527631b0b6319032bc31b430b733b2b930ba329032b93937b960491b604482015290519081900360640190fd5b8215613deb57604080820184905280516020808201909252908201518152613d61908461333c565b6060830181905282826003811115613d7557fe5b6003811115613d8057fe5b9052506000905081516003811115613d9457fe5b14613de6576040805162461bcd60e51b815260206004820152601860248201527f63616c632072656465656d20616d6f756e74206572726f720000000000000000604482015290519081900360640190fd5b613e94565b613e0782604051806020016040528084602001518152506147a6565b6040830181905282826003811115613e1b57fe5b6003811115613e2657fe5b9052506000905081516003811115613e3a57fe5b14613e8c576040805162461bcd60e51b815260206004820152601860248201527f63616c632072656465656d20746f6b656e73206572726f720000000000000000604482015290519081900360640190fd5b606081018290525b600b54604080830151815163335dec6b60e21b81526001600160a01b0388811660048301526024820192909252915192169163cd77b1ac9160448082019260009290919082900301818387803b158015613eed57600080fd5b505af1158015613f01573d6000803e3d6000fd5b50505050613f156007548260400151613a6a565b6080830181905282826003811115613f2957fe5b6003811115613f3457fe5b9052506000905081516003811115613f4857fe5b14613f92576040805162461bcd60e51b815260206004820152601560248201527431b0b6319039bab838363c903732bb9032b93937b960591b604482015290519081900360640190fd5b6001600160a01b038416600090815260086020526040908190205490820151613fbb9190613a6a565b60a0830181905282826003811115613fcf57fe5b6003811115613fda57fe5b9052506000905081516003811115613fee57fe5b14614037576040805162461bcd60e51b815260206004820152601460248201527331b0b631903a37b5b2b7103732bb9032b93937b960611b604482015290519081900360640190fd5b806060015161404461131a565b1015614087576040805162461bcd60e51b815260206004820152600d60248201526c63617368203c2072656465656d60981b604482015290519081900360640190fd5b608081015160075560a08101516001600160a01b03851660009081526008602052604090205560608101516140bf90859060016138a1565b6040808201518151908152905130916001600160a01b03871691600080516020614e658339815191529181900360200190a360608082015160408084015181516001600160a01b0389168152602081019390935282820152517fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a929929181900390910190a150505050565b6141516139a3565b600d5414614197576040805162461bcd60e51b815260206004820152600e60248201526d6e6f742073616d6520626c6f636b60901b604482015290519081900360640190fd5b600b546040805163368f515360e21b81526001600160a01b0386811660048301528581166024830152604482018590529151919092169163da3d454c91606480830192600092919082900301818387803b1580156141f457600080fd5b505af1158015614208573d6000803e3d6000fd5b505050508061421561131a565b1015614256576040805162461bcd60e51b815260206004820152600b60248201526a636173683c626f72726f7760a81b604482015290519081900360640190fd5b61425e614dc3565b61426784614566565b602083018190528282600381111561427b57fe5b600381111561428657fe5b905250600090508151600381111561429a57fe5b146142e5576040805162461bcd60e51b815260206004820152601660248201527531b0b6319030b1b1903137b93937bbb99032b93937b960511b604482015290519081900360640190fd5b6142f3816020015183613af5565b604083018190528282600381111561430757fe5b600381111561431257fe5b905250600090508151600381111561432657fe5b14614371576040805162461bcd60e51b815260206004820152601660248201527531b0b6319030b1b1903137b93937bbb99032b93937b960511b604482015290519081900360640190fd5b61437d600f5483613af5565b606083018190528282600381111561439157fe5b600381111561439c57fe5b90525060009050815160038111156143b057fe5b146143fd576040805162461bcd60e51b815260206004820152601860248201527731b0b631903a37ba30b6103137b93937bbb99032b93937b960411b604482015290519081900360640190fd5b6040808201516001600160a01b03861660009081526018602052918220908155600e546001909101556060820151600f5561443b90849084906138a1565b60408082015160608084015183516001600160a01b03808a1682528816602082015280850187905291820192909252608081019190915290517f10a0132d3bf8c82a7fb93a86160f3074ca5c3e5706fa2bcdf0e2b5fd495af09b9181900360a00190a150505050565b6000806000806144b48787613a8d565b909250905060008260038111156144c757fe5b146144d857509150600090506144f1565b6144ea6144e482614797565b86613af5565b9350935050505b935093915050565b60008061450e670de0b6b3a764000084613844565b9050600061451d8787876139a7565b90506000614537670de0b6b3a7640000612bef84866145bc565b905061455a670de0b6b3a7640000612bef836145548c8c8c6149de565b906145bc565b98975050505050505050565b60008061457583600e54612e7f565b91509150915091565b60008060008061458e8787613af5565b909250905060008260038111156145a157fe5b146145b257509150600090506144f1565b6144ea8186613a6a565b6000826145cb57506000610df7565b828202828482816145d857fe5b041461383d5760405162461bcd60e51b8152600401808060200182810382526021815260200180614e446021913960400191505060405180910390fd5b600080821161466b576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161467457fe5b049392505050565b6000808361468f57506000905080612f29565b8383028385828161469c57fe5b04146146b057600260009250925050612f29565b600092509050612f29565b600080826146cf5750600190506000612f29565b60008385816146da57fe5b04915091509250929050565b60006146f0614ca7565b60008061470586670de0b6b3a764000061467c565b9092509050600082600381111561471857fe5b1461473757506040805160208101909152600081529092509050612f29565b60008061474483886146bb565b9092509050600082600381111561475757fe5b1461477a5781604051806020016040528060008152509550955050505050612f29565b604080516020810190915290815260009890975095505050505050565b51670de0b6b3a7640000900490565b60008060008061334c8686614c48565b6000811561383d576000846001600160a01b03166370a08231856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561480d57600080fd5b505afa158015614821573d6000803e3d6000fd5b505050506040513d602081101561483757600080fd5b5051604080516001600160a01b038781166024830152604480830188905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825194955090891693919290918291908083835b602083106148b55780518252601f199092019160209182019101614896565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614917576040519150601f19603f3d011682016040523d82523d6000602084013e61491c565b606091505b5050506000856001600160a01b03166370a08231866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561496e57600080fd5b505afa158015614982573d6000803e3d6000fd5b505050506040513d602081101561499857600080fd5b505190508181116149d5576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b03949350505050565b6000826149ed5750600061383d565b611312614a04836149fe8787613bb8565b90613844565b612bef85670de0b6b3a76400006145bc565b60008115611312576000856001600160a01b03166370a08231856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015614a6d57600080fd5b505afa158015614a81573d6000803e3d6000fd5b505050506040513d6020811015614a9757600080fd5b5051604080516001600160a01b0388811660248301528781166044830152606480830188905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251949550908a1693919290918291908083835b60208310614b1d5780518252601f199092019160209182019101614afe565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614b7f576040519150601f19603f3d011682016040523d82523d6000602084013e614b84565b606091505b5050506000866001600160a01b03166370a08231866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015614bd657600080fd5b505afa158015614bea573d6000803e3d6000fd5b505050506040513d6020811015614c0057600080fd5b50519050818111614c3e576040805162461bcd60e51b81526020600482015260036024820152622a232360e91b604482015290519081900360640190fd5b0395945050505050565b6000614c52614ca7565b600080614c67670de0b6b3a76400008761467c565b90925090506000826003811115614c7a57fe5b14614c9957506040805160208101909152600081529092509050612f29565b61337b8186600001516146e6565b6040518060200160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282614cf05760008555614d36565b82601f10614d0957805160ff1916838001178555614d36565b82800160010185558215614d36579182015b82811115614d36578251825591602001919060010190614d1b565b50614d42929150614dec565b5090565b6040805161010081019091528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805160c08101909152806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b604080516080810190915280600081526020016000815260200160008152602001600081525090565b5b80821115614d425760008155600101614ded56fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c006f6e6c792070656e64696e6741646d696e2063616e206163636570742061646d696e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef496e697469616c2045786368616e67652052617465204d616e74697373612073686f756c642062652067726561746572207a65726fa26469706673582212206105e5349d3dd72c8b485d9bcbebaf8bfc2d771de61d7a6aa61014bef060f0d264736f6c63430007060033

Deployed Bytecode

0x60806040526004361061036b5760003560e01c8063856e5bb3116101c6578063c89a6368116100f7578063ebd0847f11610095578063f851a4401161006f578063f851a44014610cae578063f8f9da2814610cc3578063fb0fc2b614610cd8578063fd2da33914610ced5761036b565b8063ebd0847f14610c48578063f14039de14610c84578063f77c479114610c995761036b565b8063cfa99201116100d1578063cfa9920114610bc6578063d245445b14610bdb578063db006a7514610be3578063dd62ed3e14610c0d5761036b565b8063c89a636814610a1a578063ca4b208b14610b9c578063cc2c929e14610bb15761036b565b8063a6afed9511610164578063ae9d70b01161013e578063ae9d70b01461098a578063b9f9850a1461099f578063bd6d894d146109b4578063c37f68e2146109c95761036b565b8063a6afed9514610927578063a9059cbb1461093c578063aa5af0fd146109755761036b565b806392eefe9b116101a057806392eefe9b1461088257806395d89b41146108b557806395dd9193146108ca578063a0712d68146108fd5761036b565b8063856e5bb31461081f5780638726bb89146108585780638f840ddd1461086d5761036b565b80633b1d21a2116102a05780636c540baf1161023e57806370a082311161021857806370a082311461079057806373acee98146107c35780637821a514146107d8578063852a12e3146107f55761036b565b80636c540baf1461072d5780636e45a80f146107425780636f307dc31461077b5761036b565b806347bd37181161027a57806347bd3718146106a65780634dd18bf5146106bb5780635c60da1b146106ee5780636940caa0146107035761036b565b80633b1d21a21461065057806342af38d814610665578063449a52f81461067a5761036b565b8063182df0f51161030d5780632608f818116102e75780632608f8181461058857806326782247146105c1578063313ce567146105f25780633af9e6691461061d5761036b565b8063182df0f5146105065780631c4469831461051b57806323b872dd146105455761036b565b806310cc9d641161034957806310cc9d641461045e578063173b99041461049757806317bfdfbc146104be57806318160ddd146104f15761036b565b806306fdde0314610370578063095ea7b3146103fa5780630e18b68114610447575b600080fd5b34801561037c57600080fd5b50610385610d02565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103bf5781810151838201526020016103a7565b50505050905090810190601f1680156103ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561040657600080fd5b506104336004803603604081101561041d57600080fd5b506001600160a01b038135169060200135610d90565b604080519115158252519081900360200190f35b34801561045357600080fd5b5061045c610dfd565b005b34801561046a57600080fd5b5061045c6004803603604081101561048157600080fd5b506001600160a01b038135169060200135610efd565b3480156104a357600080fd5b506104ac610f67565b60408051918252519081900360200190f35b3480156104ca57600080fd5b506104ac600480360360208110156104e157600080fd5b50356001600160a01b0316610f6d565b3480156104fd57600080fd5b506104ac61103f565b34801561051257600080fd5b506104ac611045565b34801561052757600080fd5b5061045c6004803603602081101561053e57600080fd5b50356110aa565b34801561055157600080fd5b506104336004803603606081101561056857600080fd5b506001600160a01b0381358116916020810135909116906040013561119f565b34801561059457600080fd5b5061045c600480360360408110156105ab57600080fd5b506001600160a01b038135169060200135611205565b3480156105cd57600080fd5b506105d6611265565b604080516001600160a01b039092168252519081900360200190f35b3480156105fe57600080fd5b50610607611274565b6040805160ff9092168252519081900360200190f35b34801561062957600080fd5b506104ac6004803603602081101561064057600080fd5b50356001600160a01b031661127d565b34801561065c57600080fd5b506104ac61131a565b34801561067157600080fd5b506104ac611396565b61045c6004803603604081101561069057600080fd5b506001600160a01b03813516906020013561139c565b3480156106b257600080fd5b506104ac611428565b3480156106c757600080fd5b5061045c600480360360208110156106de57600080fd5b50356001600160a01b031661142e565b3480156106fa57600080fd5b506105d66114e7565b34801561070f57600080fd5b5061045c6004803603602081101561072657600080fd5b50356114f6565b34801561073957600080fd5b506104ac6115e3565b34801561074e57600080fd5b5061045c6004803603604081101561076557600080fd5b506001600160a01b0381351690602001356115e9565b34801561078757600080fd5b506105d6611708565b34801561079c57600080fd5b506104ac600480360360208110156107b357600080fd5b50356001600160a01b0316611717565b3480156107cf57600080fd5b506104ac611732565b61045c600480360360208110156107ee57600080fd5b50356119a0565b34801561080157600080fd5b5061045c6004803603602081101561081857600080fd5b5035611a65565b34801561082b57600080fd5b5061045c6004803603604081101561084257600080fd5b506001600160a01b038135169060200135611acc565b34801561086457600080fd5b506104ac611b2a565b34801561087957600080fd5b506104ac611b30565b34801561088e57600080fd5b5061045c600480360360208110156108a557600080fd5b50356001600160a01b0316611b36565b3480156108c157600080fd5b50610385611c2f565b3480156108d657600080fd5b506104ac600480360360208110156108ed57600080fd5b50356001600160a01b0316611c8a565b34801561090957600080fd5b5061045c6004803603602081101561092057600080fd5b5035611ca5565b34801561093357600080fd5b5061045c611d04565b34801561094857600080fd5b506104336004803603604081101561095f57600080fd5b506001600160a01b0381351690602001356120c0565b34801561098157600080fd5b506104ac612125565b34801561099657600080fd5b506104ac61212b565b3480156109ab57600080fd5b506104ac61214b565b3480156109c057600080fd5b506104ac612151565b3480156109d557600080fd5b506109fc600480360360208110156109ec57600080fd5b50356001600160a01b03166121b8565b60408051938452602084019290925282820152519081900360600190f35b348015610a2657600080fd5b5061045c6004803603610160811015610a3e57600080fd5b6001600160a01b038235811692602081013515159260408201359092169160608201359160808101359160a08201359160c08101359160e082013591908101906101208101610100820135640100000000811115610a9b57600080fd5b820183602082011115610aad57600080fd5b80359060200191846001830284011164010000000083111715610acf57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050640100000000811115610b2257600080fd5b820183602082011115610b3457600080fd5b80359060200191846001830284011164010000000083111715610b5657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050903560ff16915061224f9050565b348015610ba857600080fd5b506105d6612574565b348015610bbd57600080fd5b50610433612583565b348015610bd257600080fd5b506104ac612593565b61045c612599565b348015610bef57600080fd5b5061045c60048036036020811015610c0657600080fd5b5035612645565b348015610c1957600080fd5b506104ac60048036036040811015610c3057600080fd5b506001600160a01b03813581169160200135166126a4565b348015610c5457600080fd5b5061045c60048036036080811015610c6b57600080fd5b50803590602081013590604081013590606001356126cf565b348015610c9057600080fd5b506104ac6128e4565b348015610ca557600080fd5b506105d66128ea565b348015610cba57600080fd5b506105d66128f9565b348015610ccf57600080fd5b506104ac612908565b348015610ce457600080fd5b506104ac612920565b348015610cf957600080fd5b506104ac6129cc565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d885780601f10610d5d57610100808354040283529160200191610d88565b820191906000526020600020905b815481529060010190602001808311610d6b57829003601f168201915b505050505081565b3360008181526009602090815260408083206001600160a01b03871680855290835281842086905581518681529151939493909284927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a360019150505b92915050565b6002546001600160a01b03163314610e465760405162461bcd60e51b8152600401808060200182810382526022815260200180614e226022913960400191505060405180910390fd5b60018054600280546001600160a01b038082166001600160a01b031980861682179687905590921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600254604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a15050565b6002601a541415610f43576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55610f50611d04565b610f5d33838360016129d2565b50506001601a5550565b60115481565b6000806000610f7a612dc6565b90925090506000826003811115610f8d57fe5b14610fd8576040805162461bcd60e51b815260206004820152601660248201527518d85b18c8189bdc9c9bddc81a5b99195e0819985a5b60521b604482015290519081900360640190fd5b600080610fe58684612e7f565b90925090506000826003811115610ff857fe5b14611036576040805162461bcd60e51b815260206004820152600960248201526818d85b18c819985a5b60ba1b604482015290519081900360640190fd5b95945050505050565b60075481565b6000806000611052612f30565b9092509050600082600381111561106557fe5b146110a3576040805162461bcd60e51b815260206004820152600960248201526818d85b18c819985a5b60ba1b604482015290519081900360640190fd5b9150505b90565b6001546001600160a01b03163314611100576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b670de0b6b3a7640000811115611150576040805162461bcd60e51b815260206004820152601060248201526f466163746f7220746f6f206c6172676560801b604482015290519081900360640190fd5b611158611d04565b6011805490829055604080518281526020810184905281517faaa68312e2ea9d50e16af5068410ab56e1a1fd06037b1a35664812c30f821460929181900390910190a15050565b60006002601a5414156111e7576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556111f833858585612fdb565b6001601a55949350505050565b6002601a54141561124b576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55611258611d04565b610f5d33838360006129d2565b6002546001600160a01b031681565b60065460ff1681565b6000806040518060200160405280611293612151565b90526001600160a01b0384166000908152600860205260408120549192509081906112bf90849061333c565b909250905060008260038111156112d257fe5b14611312576040805162461bcd60e51b815260206004820152600b60248201526a18d85b18c819985a5b195960aa1b604482015290519081900360640190fd5b949350505050565b601354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561136557600080fd5b505afa158015611379573d6000803e3d6000fd5b505050506040513d602081101561138f57600080fd5b5051905090565b600a5481565b6002601a5414156113e2576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556113ef611d04565b601354600160a01b900460ff16156114135761140d82346000613388565b5061141f565b610f5d82826001613388565b50506001601a55565b600f5481565b6001546001600160a01b03163314611484576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a15050565b6000546001600160a01b031681565b6001546001600160a01b0316331461154c576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b670de0b6b3a764000081111561159c576040805162461bcd60e51b815260206004820152601060248201526f466163746f7220746f6f206c6172676560801b604482015290519081900360640190fd5b600a805490829055604080518281526020810184905281517f8d783a1777b97cb9cbf193604a8a1bc534234dbaaa16629ff7022f0d63a7322f929181900390910190a15050565b600d5481565b6002601a54141561162f576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556001546001600160a01b0316331461168a576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b611692611d04565b6012546000906116a29083613844565b601281905590506116b5838360016138a1565b604080516001600160a01b03851681526020810184905280820183905290517f3bad0c59cf2f06e7314077049f48a93578cd16f5ef92329f1dab1420a99c177e9181900360600190a150506001601a5550565b6013546001600160a01b031681565b6001600160a01b031660009081526008602052604090205490565b60008061173d6139a3565b600d549091508082141561175757600f54925050506110a7565b600061176161131a565b600f546012549192509060006117788484846139a7565b905065048c273950008111156117cc576040805162461bcd60e51b81526020600482015260146024820152733137b93937bbb2b9103930ba32903434b3b432b960611b604482015290519081900360640190fd5b6000806117d98888613a6a565b909250905060008260038111156117ec57fe5b14611836576040805162461bcd60e51b815260206004820152601560248201527463616c6320626c6f636b2064656c7461206572726f60581b604482015290519081900360640190fd5b61183e614ca7565b60008061185960405180602001604052808881525085613a8d565b9095509250600085600381111561186c57fe5b146118be576040805162461bcd60e51b815260206004820152601a60248201527f63616c6320696e74657265737420666163746f72206572726f72000000000000604482015290519081900360640190fd5b6118c8838961333c565b909550915060008560038111156118db57fe5b14611927576040805162461bcd60e51b815260206004820152601760248201527631b0b6319034b73a32b932b9ba1030b1b19032b93937b960491b604482015290519081900360640190fd5b6119318289613af5565b9095509050600085600381111561194457fe5b14611991576040805162461bcd60e51b815260206004820152601860248201527731b0b631903a37ba30b6103137b93937bbb99032b93937b960411b604482015290519081900360640190fd5b9a505050505050505050505090565b6002601a5414156119e6576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556119f3611d04565b600080611a0233846001613b1b565b601254909150611a129082613bb8565b6012819055604080513381526020810184905280820183905290519193507fa91e67c5ea634cd43a12c5a482724b03de01e85ca68702a53d0c2f45cb7c1dc5919081900360600190a150506001601a5550565b6002601a541415611aab576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55611ab8611d04565b611ac433600083613c12565b506001601a55565b6002601a541415611b12576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55611b1f611d04565b61141f823383614149565b60155481565b60125481565b6001546001600160a01b03163314611b8c576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b6001600160a01b038116611bcc576040805162461bcd60e51b8152602060048201526002602482015261060f60f31b604482015290519081900360640190fd5b600b80546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517ff9b6a28700579d5c8fab50f0ac2dcaa52109b85c369c4f511fcc873330ab6cbb929181900390910190a15050565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d885780601f10610d5d57610100808354040283529160200191610d88565b6001600160a01b031660009081526018602052604090205490565b6002601a541415611ceb576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55611cf8611d04565b61141f33826000613388565b6000611d0e6139a3565b600d5490915080821415611d235750506120be565b6000611d2d61131a565b600f54600e5460125492935090916000611d488585846139a7565b905065048c27395000811115611d9c576040805162461bcd60e51b81526020600482015260146024820152733137b93937bbb2b9103930ba32903434b3b432b960611b604482015290519081900360640190fd5b600080611da98989613a6a565b90925090506000826003811115611dbc57fe5b14611e06576040805162461bcd60e51b815260206004820152601560248201527463616c6320626c6f636b2064656c7461206572726f60581b604482015290519081900360640190fd5b611e0e614ca7565b600080600080611e2c60405180602001604052808a81525087613a8d565b90975094506000876003811115611e3f57fe5b14611e91576040805162461bcd60e51b815260206004820152601a60248201527f63616c6320696e74657265737420666163746f72206572726f72000000000000604482015290519081900360640190fd5b611e9b858c61333c565b90975093506000876003811115611eae57fe5b14611efa576040805162461bcd60e51b815260206004820152601760248201527631b0b6319034b73a32b932b9ba1030b1b19032b93937b960491b604482015290519081900360640190fd5b611f04848c613af5565b90975092506000876003811115611f1757fe5b14611f64576040805162461bcd60e51b815260206004820152601860248201527731b0b631903a37ba30b6103137b93937bbb99032b93937b960411b604482015290519081900360640190fd5b611f7f6040518060200160405280601154815250858b6144a4565b90975090506000876003811115611f9257fe5b14611fe4576040805162461bcd60e51b815260206004820152601960248201527f63616c6320746f74616c207265736572766573206572726f7200000000000000604482015290519081900360640190fd5b611fef858b8c6144a4565b9097509150600087600381111561200257fe5b14612054576040805162461bcd60e51b815260206004820152601860248201527f63616c6320626f72726f777320696e646578206572726f720000000000000000604482015290519081900360640190fd5b600d8e9055600e829055600f8390556012819055604080518d8152602081018690528082018490526060810185905290517f4dec04e750ca11537cabcd8a9eab06494de08da3735bc8871cd41250e190bc049181900360800190a150505050505050505050505050505b565b60006002601a541415612108576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a5561211933808585612fdb565b6001601a559392505050565b600e5481565b600061214661213861131a565b600f546012546011546144f9565b905090565b60165481565b60006002601a541415612199576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a556121a6611d04565b6121ae611045565b90506001601a5590565b6001600160a01b038116600090815260086020526040812054819081908180806121e188614566565b9350905060008160038111156121f357fe5b1461220c57600080600096509650965050505050612248565b612214612f30565b92509050600081600381111561222657fe5b1461223f57600080600096509650965050505050612248565b50919450925090505b9193909250565b6001600160a01b038b166122aa576040805162461bcd60e51b815260206004820152601f60248201527f756e6465726c79696e675f20616464726573732063616e6e6f74206265203000604482015290519081900360640190fd5b6001600160a01b038916612305576040805162461bcd60e51b815260206004820152601f60248201527f636f6e74726f6c6c65725f20616464726573732063616e6e6f74206265203000604482015290519081900360640190fd5b6001546001600160a01b03163314612364576040805162461bcd60e51b815260206004820181905260248201527f4f6e6c7920616c6c6f7720746f2062652063616c6c65642062792061646d696e604482015290519081900360640190fd5b600d541580156123745750600e54155b6123b3576040805162461bcd60e51b815260206004820152600b60248201526a696e69746564206f6e636560a81b604482015290519081900360640190fd5b600c849055836123f45760405162461bcd60e51b8152600401808060200182810382526035815260200180614e856035913960400191505060405180910390fd5b600b80546001600160a01b0319166001600160a01b038b161790556013805460ff60a01b1916600160a01b8c15150217905560148890556015879055601686905560178590556124426139a3565b600d556a084595161401484a000000600e55670b1a2bc2ec500000600a5567016345785d8a0000601155825161247f906004906020860190614cba565b508151612493906005906020850190614cba565b506006805460ff191660ff831617905560038054600160a01b60ff60a01b19909116179055601380546001600160a01b0319166001600160a01b038d81169190911791829055604080516318160ddd60e01b8152905192909116916318160ddd91600480820192602092909190829003018186803b15801561251457600080fd5b505afa158015612528573d6000803e3d6000fd5b505050506040513d602081101561253e57600080fd5b50506040805160008082529151339291600080516020614e65833981519152919081900360200190a35050505050505050505050565b6003546001600160a01b031681565b601354600160a01b900460ff1681565b60195481565b6002601a5414156125df576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55601354600160a01b900460ff16612631576040805162461bcd60e51b815260206004820152600c60248201526b1b9bdd08195d1a081c1bdbdb60a21b604482015290519081900360640190fd5b612639611d04565b611ac433346000613388565b6002601a54141561268b576040805162461bcd60e51b815260206004820152601f6024820152600080516020614e02833981519152604482015290519081900360640190fd5b6002601a55612698611d04565b611ac433826000613c12565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b600b54604080516335c8df1d60e11b815233600482015290516001600160a01b0390921691636b91be3a9160248082019260009290919082900301818387803b15801561271b57600080fd5b505af115801561272f573d6000803e3d6000fd5b5050505060145460001461274557612745611d04565b6509184e72a0008410612795576040805162461bcd60e51b815260206004820152601360248201527242617365207261746520746f6f206c6172676560681b604482015290519081900360640190fd5b60148490556509184e72a00083106127e9576040805162461bcd60e51b81526020600482015260126024820152714d756c207261746520746f6f206c6172676560701b604482015290519081900360640190fd5b60158390556509184e72a000821061283e576040805162461bcd60e51b81526020600482015260136024820152724a756d70207261746520746f6f206c6172676560681b604482015290519081900360640190fd5b6016829055670de0b6b3a7640000811115612892576040805162461bcd60e51b815260206004820152600f60248201526e4b6c696e6520746f6f206c6172676560881b604482015290519081900360640190fd5b601781905560408051858152602081018590528082018490526060810183905290517f1d6ada507d93788b3d2e6f68f2999ef7e05f2196ba5cde6db7d0a785745b3c249181900360800190a150505050565b60145481565b600b546001600160a01b031681565b6001546001600160a01b031681565b600061214661291561131a565b600f546012546139a7565b60008061292b61131a565b905060008061293f83600f5460125461457e565b9092509050600082600381111561295257fe5b1461296357600093505050506110a7565b600080612980604051806020016040528085815250600a5461333c565b9092509050600082600381111561299357fe5b146129a6576000955050505050506110a7565b80600f5411156129be576000955050505050506110a7565b600f54900394505050505090565b60175481565b60006129dc6139a3565b600d5414612a22576040805162461bcd60e51b815260206004820152600e60248201526d6e6f742073616d6520626c6f636b60901b604482015290519081900360640190fd5b600b546040805163012c89d360e31b81526001600160a01b0388811660048301528781166024830152604482018790528515156064830152915191909216916309644e9891608480830192600092919082900301818387803b158015612a8757600080fd5b505af1158015612a9b573d6000803e3d6000fd5b50505050612aa7614d46565b6001600160a01b038516600090815260186020526040908190206001015490820152612ad285614566565b6060830181905282826003811115612ae657fe5b6003811115612af157fe5b9052506000905081516003811115612b0557fe5b14612b4f576040805162461bcd60e51b815260206004820152601560248201527431b0b6319030b1b1903137b93937bb9032b93937b960591b604482015290519081900360640190fd5b600019841415612b685760608101516020820152612b70565b602081018490525b612b808682602001516000613b1b565b60c0820152828015612b9957508060c001518160600151115b15612baf5760c081015160608201510360e08201525b8060c0015181606001511015612c4957670e92596fd6290000612bf58260600151612bef670de0b6b3a76400008560c001516145bc90919063ffffffff16565b90614615565b1115612c3d576040805162461bcd60e51b81526020600482015260126024820152717265706179206d6f7265207468616e20352560701b604482015290519081900360640190fd5b60006080820152612c5a565b60c081015160608201510360808201525b8215612c6857600060808201525b60808101516060820151612c7b91613844565b600f541080612c8f5750600f548160c00151115b15612ca057600060a0820152612ccd565b612cc7612cbe8260800151836060015161384490919063ffffffff16565b600f5490613844565b60a08201525b806080015160186000876001600160a01b03166001600160a01b0316815260200190815260200160002060000181905550600e5460186000876001600160a01b03166001600160a01b03168152602001908152602001600020600101819055508060a00151600f819055507f6fadbf7329d21f278e724fa0d4511001a158f2a97ee35c5bc4cf8b64417399ef86868360c001518460e0015185608001518660a0015160405180876001600160a01b03168152602001866001600160a01b03168152602001858152602001848152602001838152602001828152602001965050505050505060405180910390a160c0015195945050505050565b6000806000612dd36139a3565b600d54909150600081831415612df4576000600e5494509450505050612e7b565b6000612e0161291561131a565b9050600080612e108686613a6a565b91509150612e1c614ca7565b612e3460405180602001604052808681525083613a8d565b90935090506000836003811115612e4757fe5b14612e5f578260009850985050505050505050612e7b565b612e6e81600e54600e546144a4565b9099509750505050505050505b9091565b6001600160a01b038216600090815260186020526040812080548291829182918291612eb5576000809550955050505050612f29565b8054612ec1908861467c565b90945092506000846003811115612ed457fe5b14612ee9578360009550955050505050612f29565b612ef78382600101546146bb565b90945091506000846003811115612f0a57fe5b14612f1f578360009550955050505050612f29565b5060009450925050505b9250929050565b600754600090819080612f4b575050600c5460009150612e7b565b6000612f5561131a565b90506000612f61614ca7565b6000612f7284600f5460125461457e565b935090506000816003811115612f8457fe5b14612f9957955060009450612e7b9350505050565b612fa383866146e6565b925090506000816003811115612fb557fe5b14612fca57955060009450612e7b9350505050565b5051600095509350612e7b92505050565b60006001600160a01b038316613038576040805162461bcd60e51b815260206004820152601760248201527f64737420616464726573732063616e6e6f742062652030000000000000000000604482015290519081900360640190fd5b826001600160a01b0316846001600160a01b0316141561308b576040805162461bcd60e51b81526020600482015260096024820152681cdc98c80f48191cdd60ba1b604482015290519081900360640190fd5b600b546040805160016276d1bb60e11b031981526001600160a01b0387811660048301528681166024830152604482018690529151919092169163ff125c8a91606480830192600092919082900301818387803b1580156130eb57600080fd5b505af11580156130ff573d6000803e3d6000fd5b505050506000846001600160a01b0316866001600160a01b031614156131285750600019613150565b506001600160a01b038085166000908152600960209081526040808320938916835292905220545b6000806000806131608588613a6a565b9094509250600084600381111561317357fe5b146131b3576040805162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015290519081900360640190fd5b6001600160a01b0389166000908152600860205260409020546131d69088613a6a565b909450915060008460038111156131e957fe5b14613228576040805162461bcd60e51b815260206004820152600a6024820152690dcdee840cadcdeeaced60b31b604482015290519081900360640190fd5b6001600160a01b03881660009081526008602052604090205461324b9088613af5565b9094509050600084600381111561325e57fe5b1461329b576040805162461bcd60e51b81526020600482015260086024820152670e8dede40daeac6d60c31b604482015290519081900360640190fd5b6001600160a01b03808a16600090815260086020526040808220859055918a1681522081905560001985146132f3576001600160a01b03808a166000908152600960209081526040808320938e168352929052208390555b876001600160a01b0316896001600160a01b0316600080516020614e65833981519152896040518082815260200191505060405180910390a35060019998505050505050505050565b60008060008061334c8686613a8d565b9092509050600082600381111561335f57fe5b146133705750915060009050612f29565b600061337b82614797565b9350935050509250929050565b60006133926139a3565b600d54146133d8576040805162461bcd60e51b815260206004820152600e60248201526d6e6f742073616d6520626c6f636b60901b604482015290519081900360640190fd5b6133e0614d8c565b6133e8612f30565b60208301819052828260038111156133fc57fe5b600381111561340757fe5b905250600090508151600381111561341b57fe5b14613467576040805162461bcd60e51b815260206004820152601760248201527631b0b6319032bc31b430b733b2b930ba329032b93937b960491b604482015290519081900360640190fd5b821561353c57600061347761131a565b9050336001600160a01b031663d7efa12987876040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156134d057600080fd5b505af11580156134e4573d6000803e3d6000fd5b5050505060006134f261131a565b9050818111613531576040805162461bcd60e51b815260206004820152600660248201526506d696e7420360d41b604482015290519081900360640190fd5b0360a082015261354e565b61354885856001613b1b565b60a08201525b61356e8160a00151604051806020016040528084602001518152506147a6565b604083018190528282600381111561358257fe5b600381111561358d57fe5b90525060009050815160038111156135a157fe5b146135eb576040805162461bcd60e51b815260206004820152601560248201527431b0b6319036b4b73a103a37b5b2b71032b93937b960591b604482015290519081900360640190fd5b600b5460408083015181516357739dc560e01b81526001600160a01b038981166004830152602482019290925291519216916357739dc59160448082019260009290919082900301818387803b15801561364457600080fd5b505af1158015613658573d6000803e3d6000fd5b5050505061366c6007548260400151613af5565b606083018190528282600381111561368057fe5b600381111561368b57fe5b905250600090508151600381111561369f57fe5b146136ea576040805162461bcd60e51b815260206004820152601660248201527518d85b18c81cdd5c1c1b1e481b995dc819985a5b195960521b604482015290519081900360640190fd5b6001600160a01b0385166000908152600860205260409081902054908201516137139190613af5565b608083018190528282600381111561372757fe5b600381111561373257fe5b905250600090508151600381111561374657fe5b14613790576040805162461bcd60e51b815260206004820152601560248201527418d85b18c81d1bdad95b9cc81b995dc8185a5b1959605a1b604482015290519081900360640190fd5b60608082015160075560808201516001600160a01b0387166000818152600860209081526040918290209390935560a0850151818601518251938452938301528181019290925290517f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f929181900390910190a1604080820151815190815290516001600160a01b038716913091600080516020614e658339815191529181900360200190a360a0015190505b9392505050565b60008282111561389b576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b601354600160a01b900460ff1680156138b75750805b156139855760135460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b15801561390957600080fd5b505af115801561391d573d6000803e3d6000fd5b5050604051600092506001600160a01b038616915084908381818185875af1925050503d806000811461396c576040519150601f19603f3d011682016040523d82523d6000602084013e613971565b606091505b505090508061397f57600080fd5b5061399e565b60135461399c906001600160a01b031684846147b6565b505b505050565b4390565b6000806139b58585856149de565b905060175481116139f5576139ed6014546139e7670de0b6b3a7640000612bef601554866145bc90919063ffffffff16565b90613bb8565b91505061383d565b6000613a206014546139e7670de0b6b3a7640000612bef6015546017546145bc90919063ffffffff16565b90506000613a396017548461384490919063ffffffff16565b9050613a60826139e7670de0b6b3a7640000612bef601654866145bc90919063ffffffff16565b935050505061383d565b600080838311613a81575060009050818303612f29565b50600390506000612f29565b6000613a97614ca7565b600080613aa886600001518661467c565b90925090506000826003811115613abb57fe5b14613ada57506040805160208101909152600081529092509050612f29565b60408051602081019091529081526000969095509350505050565b600080838301848110613b0d57600092509050612f29565b600260009250925050612f29565b601354600090600160a01b900460ff168015613b345750815b15613ba0575060135460408051630d0e30db60e41b8152905134926001600160a01b03169163d0e30db091849160048082019260009290919082900301818588803b158015613b8257600080fd5b505af1158015613b96573d6000803e3d6000fd5b505050505061383d565b601354611312906001600160a01b0316853086614a16565b60008282018381101561383d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b613c1a6139a3565b600d5414613c60576040805162461bcd60e51b815260206004820152600e60248201526d6e6f742073616d6520626c6f636b60901b604482015290519081900360640190fd5b811580613c6b575080155b613caa576040805162461bcd60e51b815260206004820152600b60248201526a6f6e65206265207a65726f60a81b604482015290519081900360640190fd5b613cb2614d8c565b613cba612f30565b6020830181905282826003811115613cce57fe5b6003811115613cd957fe5b9052506000905081516003811115613ced57fe5b14613d39576040805162461bcd60e51b815260206004820152601760248201527631b0b6319032bc31b430b733b2b930ba329032b93937b960491b604482015290519081900360640190fd5b8215613deb57604080820184905280516020808201909252908201518152613d61908461333c565b6060830181905282826003811115613d7557fe5b6003811115613d8057fe5b9052506000905081516003811115613d9457fe5b14613de6576040805162461bcd60e51b815260206004820152601860248201527f63616c632072656465656d20616d6f756e74206572726f720000000000000000604482015290519081900360640190fd5b613e94565b613e0782604051806020016040528084602001518152506147a6565b6040830181905282826003811115613e1b57fe5b6003811115613e2657fe5b9052506000905081516003811115613e3a57fe5b14613e8c576040805162461bcd60e51b815260206004820152601860248201527f63616c632072656465656d20746f6b656e73206572726f720000000000000000604482015290519081900360640190fd5b606081018290525b600b54604080830151815163335dec6b60e21b81526001600160a01b0388811660048301526024820192909252915192169163cd77b1ac9160448082019260009290919082900301818387803b158015613eed57600080fd5b505af1158015613f01573d6000803e3d6000fd5b50505050613f156007548260400151613a6a565b6080830181905282826003811115613f2957fe5b6003811115613f3457fe5b9052506000905081516003811115613f4857fe5b14613f92576040805162461bcd60e51b815260206004820152601560248201527431b0b6319039bab838363c903732bb9032b93937b960591b604482015290519081900360640190fd5b6001600160a01b038416600090815260086020526040908190205490820151613fbb9190613a6a565b60a0830181905282826003811115613fcf57fe5b6003811115613fda57fe5b9052506000905081516003811115613fee57fe5b14614037576040805162461bcd60e51b815260206004820152601460248201527331b0b631903a37b5b2b7103732bb9032b93937b960611b604482015290519081900360640190fd5b806060015161404461131a565b1015614087576040805162461bcd60e51b815260206004820152600d60248201526c63617368203c2072656465656d60981b604482015290519081900360640190fd5b608081015160075560a08101516001600160a01b03851660009081526008602052604090205560608101516140bf90859060016138a1565b6040808201518151908152905130916001600160a01b03871691600080516020614e658339815191529181900360200190a360608082015160408084015181516001600160a01b0389168152602081019390935282820152517fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a929929181900390910190a150505050565b6141516139a3565b600d5414614197576040805162461bcd60e51b815260206004820152600e60248201526d6e6f742073616d6520626c6f636b60901b604482015290519081900360640190fd5b600b546040805163368f515360e21b81526001600160a01b0386811660048301528581166024830152604482018590529151919092169163da3d454c91606480830192600092919082900301818387803b1580156141f457600080fd5b505af1158015614208573d6000803e3d6000fd5b505050508061421561131a565b1015614256576040805162461bcd60e51b815260206004820152600b60248201526a636173683c626f72726f7760a81b604482015290519081900360640190fd5b61425e614dc3565b61426784614566565b602083018190528282600381111561427b57fe5b600381111561428657fe5b905250600090508151600381111561429a57fe5b146142e5576040805162461bcd60e51b815260206004820152601660248201527531b0b6319030b1b1903137b93937bbb99032b93937b960511b604482015290519081900360640190fd5b6142f3816020015183613af5565b604083018190528282600381111561430757fe5b600381111561431257fe5b905250600090508151600381111561432657fe5b14614371576040805162461bcd60e51b815260206004820152601660248201527531b0b6319030b1b1903137b93937bbb99032b93937b960511b604482015290519081900360640190fd5b61437d600f5483613af5565b606083018190528282600381111561439157fe5b600381111561439c57fe5b90525060009050815160038111156143b057fe5b146143fd576040805162461bcd60e51b815260206004820152601860248201527731b0b631903a37ba30b6103137b93937bbb99032b93937b960411b604482015290519081900360640190fd5b6040808201516001600160a01b03861660009081526018602052918220908155600e546001909101556060820151600f5561443b90849084906138a1565b60408082015160608084015183516001600160a01b03808a1682528816602082015280850187905291820192909252608081019190915290517f10a0132d3bf8c82a7fb93a86160f3074ca5c3e5706fa2bcdf0e2b5fd495af09b9181900360a00190a150505050565b6000806000806144b48787613a8d565b909250905060008260038111156144c757fe5b146144d857509150600090506144f1565b6144ea6144e482614797565b86613af5565b9350935050505b935093915050565b60008061450e670de0b6b3a764000084613844565b9050600061451d8787876139a7565b90506000614537670de0b6b3a7640000612bef84866145bc565b905061455a670de0b6b3a7640000612bef836145548c8c8c6149de565b906145bc565b98975050505050505050565b60008061457583600e54612e7f565b91509150915091565b60008060008061458e8787613af5565b909250905060008260038111156145a157fe5b146145b257509150600090506144f1565b6144ea8186613a6a565b6000826145cb57506000610df7565b828202828482816145d857fe5b041461383d5760405162461bcd60e51b8152600401808060200182810382526021815260200180614e446021913960400191505060405180910390fd5b600080821161466b576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161467457fe5b049392505050565b6000808361468f57506000905080612f29565b8383028385828161469c57fe5b04146146b057600260009250925050612f29565b600092509050612f29565b600080826146cf5750600190506000612f29565b60008385816146da57fe5b04915091509250929050565b60006146f0614ca7565b60008061470586670de0b6b3a764000061467c565b9092509050600082600381111561471857fe5b1461473757506040805160208101909152600081529092509050612f29565b60008061474483886146bb565b9092509050600082600381111561475757fe5b1461477a5781604051806020016040528060008152509550955050505050612f29565b604080516020810190915290815260009890975095505050505050565b51670de0b6b3a7640000900490565b60008060008061334c8686614c48565b6000811561383d576000846001600160a01b03166370a08231856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561480d57600080fd5b505afa158015614821573d6000803e3d6000fd5b505050506040513d602081101561483757600080fd5b5051604080516001600160a01b038781166024830152604480830188905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825194955090891693919290918291908083835b602083106148b55780518252601f199092019160209182019101614896565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614917576040519150601f19603f3d011682016040523d82523d6000602084013e61491c565b606091505b5050506000856001600160a01b03166370a08231866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561496e57600080fd5b505afa158015614982573d6000803e3d6000fd5b505050506040513d602081101561499857600080fd5b505190508181116149d5576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b03949350505050565b6000826149ed5750600061383d565b611312614a04836149fe8787613bb8565b90613844565b612bef85670de0b6b3a76400006145bc565b60008115611312576000856001600160a01b03166370a08231856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015614a6d57600080fd5b505afa158015614a81573d6000803e3d6000fd5b505050506040513d6020811015614a9757600080fd5b5051604080516001600160a01b0388811660248301528781166044830152606480830188905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251949550908a1693919290918291908083835b60208310614b1d5780518252601f199092019160209182019101614afe565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614b7f576040519150601f19603f3d011682016040523d82523d6000602084013e614b84565b606091505b5050506000866001600160a01b03166370a08231866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015614bd657600080fd5b505afa158015614bea573d6000803e3d6000fd5b505050506040513d6020811015614c0057600080fd5b50519050818111614c3e576040805162461bcd60e51b81526020600482015260036024820152622a232360e91b604482015290519081900360640190fd5b0395945050505050565b6000614c52614ca7565b600080614c67670de0b6b3a76400008761467c565b90925090506000826003811115614c7a57fe5b14614c9957506040805160208101909152600081529092509050612f29565b61337b8186600001516146e6565b6040518060200160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282614cf05760008555614d36565b82601f10614d0957805160ff1916838001178555614d36565b82800160010185558215614d36579182015b82811115614d36578251825591602001919060010190614d1b565b50614d42929150614dec565b5090565b6040805161010081019091528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805160c08101909152806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b604080516080810190915280600081526020016000815260200160008152602001600081525090565b5b80821115614d425760008155600101614ded56fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c006f6e6c792070656e64696e6741646d696e2063616e206163636570742061646d696e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef496e697469616c2045786368616e67652052617465204d616e74697373612073686f756c642062652067726561746572207a65726fa26469706673582212206105e5349d3dd72c8b485d9bcbebaf8bfc2d771de61d7a6aa61014bef060f0d264736f6c63430007060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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