ETH Price: $2,346.72 (-0.45%)

Contract

0x79FbF3b010Dd3a93D1412da7A42F5FbfD0A07c2a
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Col Factor S...112997172020-11-21 6:02:341391 days ago1605938554IN
0x79FbF3b0...fD0A07c2a
0 ETH0.0012675645
0x60806040112993512020-11-21 4:44:451391 days ago1605933885IN
 Create: StrategyCmpdDaiV3
0 ETH0.199877654.5

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StrategyCmpdDaiV3

Compiler Version
v0.6.7+commit.b8d736ae

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : strategy-cmpd-dai-v3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;

import "../../lib/erc20.sol";
import "../../lib/safe-math.sol";
import "../../lib/exponential.sol";

import "../strategy-base.sol";

import "../../interfaces/jar.sol";
import "../../interfaces/uniswapv2.sol";
import "../../interfaces/controller.sol";
import "../../interfaces/compound.sol";

contract StrategyCmpdDaiV3 is StrategyBase, Exponential {
    address
        public constant comptroller = 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B;
    address public constant lens = 0xd513d22422a3062Bd342Ae374b4b9c20E0a9a074;
    address public constant dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
    address public constant comp = 0xc00e94Cb662C3520282E6f5717214004A7f26888;
    address public constant cdai = 0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643;
    address public constant cether = 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5;

    // Require a 0.04 buffer between
    // market collateral factor and strategy's collateral factor
    // when leveraging
    uint256 colFactorLeverageBuffer = 40;
    uint256 colFactorLeverageBufferMax = 1000;

    // Allow a 0.05 buffer
    // between market collateral factor and strategy's collateral factor
    // until we have to deleverage
    // This is so we can hit max leverage and keep accruing interest
    uint256 colFactorSyncBuffer = 50;
    uint256 colFactorSyncBufferMax = 1000;

    // Keeper bots
    // Maintain leverage within buffer
    mapping(address => bool) keepers;

    constructor(
        address _governance,
        address _strategist,
        address _controller,
        address _timelock
    )
        public
        StrategyBase(dai, _governance, _strategist, _controller, _timelock)
    {
        // Enter cDAI Market
        address[] memory ctokens = new address[](1);
        ctokens[0] = cdai;
        IComptroller(comptroller).enterMarkets(ctokens);
    }

    // **** Modifiers **** //

    modifier onlyKeepers {
        require(
            keepers[msg.sender] ||
                msg.sender == address(this) ||
                msg.sender == strategist ||
                msg.sender == governance,
            "!keepers"
        );
        _;
    }

    // **** Views **** //

    function getName() external override pure returns (string memory) {
        return "StrategyCmpdDaiV3";
    }

    function getSuppliedView() public view returns (uint256) {
        (, uint256 cTokenBal, , uint256 exchangeRate) = ICToken(cdai)
            .getAccountSnapshot(address(this));

        (, uint256 bal) = mulScalarTruncate(
            Exp({mantissa: exchangeRate}),
            cTokenBal
        );

        return bal;
    }

    function getBorrowedView() public view returns (uint256) {
        return ICToken(cdai).borrowBalanceStored(address(this));
    }

    function balanceOfPool() public override view returns (uint256) {
        uint256 supplied = getSuppliedView();
        uint256 borrowed = getBorrowedView();
        return supplied.sub(borrowed);
    }

    // Given an unleveraged supply balance, return the target
    // leveraged supply balance which is still within the safety buffer
    function getLeveragedSupplyTarget(uint256 supplyBalance)
        public
        view
        returns (uint256)
    {
        uint256 leverage = getMaxLeverage();
        return supplyBalance.mul(leverage).div(1e18);
    }

    function getSafeLeverageColFactor() public view returns (uint256) {
        uint256 colFactor = getMarketColFactor();

        // Collateral factor within the buffer
        uint256 safeColFactor = colFactor.sub(
            colFactorLeverageBuffer.mul(1e18).div(colFactorLeverageBufferMax)
        );

        return safeColFactor;
    }

    function getSafeSyncColFactor() public view returns (uint256) {
        uint256 colFactor = getMarketColFactor();

        // Collateral factor within the buffer
        uint256 safeColFactor = colFactor.sub(
            colFactorSyncBuffer.mul(1e18).div(colFactorSyncBufferMax)
        );

        return safeColFactor;
    }

    function getMarketColFactor() public view returns (uint256) {
        (, uint256 colFactor) = IComptroller(comptroller).markets(cdai);

        return colFactor;
    }

    // Max leverage we can go up to, w.r.t safe buffer
    function getMaxLeverage() public view returns (uint256) {
        uint256 safeLeverageColFactor = getSafeLeverageColFactor();

        // Infinite geometric series
        uint256 leverage = uint256(1e36).div(1e18 - safeLeverageColFactor);
        return leverage;
    }

    // **** Pseudo-view functions (use `callStatic` on these) **** //
    /* The reason why these exists is because of the nature of the
       interest accruing supply + borrow balance. The "view" methods
       are technically snapshots and don't represent the real value.
       As such there are pseudo view methods where you can retrieve the
       results by calling `callStatic`.
    */

    function getCompAccrued() public returns (uint256) {
        (, , , uint256 accrued) = ICompoundLens(lens).getCompBalanceMetadataExt(
            comp,
            comptroller,
            address(this)
        );

        return accrued;
    }

    function getColFactor() public returns (uint256) {
        uint256 supplied = getSupplied();
        uint256 borrowed = getBorrowed();

        return borrowed.mul(1e18).div(supplied);
    }

    function getSuppliedUnleveraged() public returns (uint256) {
        uint256 supplied = getSupplied();
        uint256 borrowed = getBorrowed();

        return supplied.sub(borrowed);
    }

    function getSupplied() public returns (uint256) {
        return ICToken(cdai).balanceOfUnderlying(address(this));
    }

    function getBorrowed() public returns (uint256) {
        return ICToken(cdai).borrowBalanceCurrent(address(this));
    }

    function getBorrowable() public returns (uint256) {
        uint256 supplied = getSupplied();
        uint256 borrowed = getBorrowed();

        (, uint256 colFactor) = IComptroller(comptroller).markets(cdai);

        // 99.99% just in case some dust accumulates
        return
            supplied.mul(colFactor).div(1e18).sub(borrowed).mul(9999).div(
                10000
            );
    }

    function getRedeemable() public returns (uint256) {
        uint256 supplied = getSupplied();
        uint256 borrowed = getBorrowed();

        (, uint256 colFactor) = IComptroller(comptroller).markets(cdai);

        // Return 99.99% of the time just incase
        return
            supplied.sub(borrowed.mul(1e18).div(colFactor)).mul(9999).div(
                10000
            );
    }

    function getCurrentLeverage() public returns (uint256) {
        uint256 supplied = getSupplied();
        uint256 borrowed = getBorrowed();

        return supplied.mul(1e18).div(supplied.sub(borrowed));
    }

    // **** Setters **** //

    function addKeeper(address _keeper) public {
        require(
            msg.sender == governance || msg.sender == strategist,
            "!governance"
        );
        keepers[_keeper] = true;
    }

    function removeKeeper(address _keeper) public {
        require(
            msg.sender == governance || msg.sender == strategist,
            "!governance"
        );
        keepers[_keeper] = false;
    }

    function setColFactorLeverageBuffer(uint256 _colFactorLeverageBuffer)
        public
    {
        require(
            msg.sender == governance || msg.sender == strategist,
            "!governance"
        );
        colFactorLeverageBuffer = _colFactorLeverageBuffer;
    }

    function setColFactorSyncBuffer(uint256 _colFactorSyncBuffer) public {
        require(
            msg.sender == governance || msg.sender == strategist,
            "!governance"
        );
        colFactorSyncBuffer = _colFactorSyncBuffer;
    }

    // **** State mutations **** //

    // Do a `callStatic` on this.
    // If it returns true then run it for realz. (i.e. eth_signedTx, not eth_call)
    function sync() public returns (bool) {
        uint256 colFactor = getColFactor();
        uint256 safeSyncColFactor = getSafeSyncColFactor();

        // If we're not safe
        if (colFactor > safeSyncColFactor) {
            uint256 unleveragedSupply = getSuppliedUnleveraged();
            uint256 idealSupply = getLeveragedSupplyTarget(unleveragedSupply);

            deleverageUntil(idealSupply);

            return true;
        }

        return false;
    }

    function leverageToMax() public {
        uint256 unleveragedSupply = getSuppliedUnleveraged();
        uint256 idealSupply = getLeveragedSupplyTarget(unleveragedSupply);
        leverageUntil(idealSupply);
    }

    // Leverages until we're supplying <x> amount
    // 1. Redeem <x> DAI
    // 2. Repay <x> DAI
    function leverageUntil(uint256 _supplyAmount) public onlyKeepers {
        // 1. Borrow out <X> DAI
        // 2. Supply <X> DAI

        uint256 leverage = getMaxLeverage();
        uint256 unleveragedSupply = getSuppliedUnleveraged();
        require(
            _supplyAmount >= unleveragedSupply &&
                _supplyAmount <= unleveragedSupply.mul(leverage).div(1e18),
            "!leverage"
        );

        // Since we're only leveraging one asset
        // Supplied = borrowed
        uint256 _borrowAndSupply;
        uint256 supplied = getSupplied();
        while (supplied < _supplyAmount) {
            _borrowAndSupply = getBorrowable();

            if (supplied.add(_borrowAndSupply) > _supplyAmount) {
                _borrowAndSupply = _supplyAmount.sub(supplied);
            }

            ICToken(cdai).borrow(_borrowAndSupply);
            deposit();

            supplied = supplied.add(_borrowAndSupply);
        }
    }

    function deleverageToMin() public {
        uint256 unleveragedSupply = getSuppliedUnleveraged();
        deleverageUntil(unleveragedSupply);
    }

    // Deleverages until we're supplying <x> amount
    // 1. Redeem <x> DAI
    // 2. Repay <x> DAI
    function deleverageUntil(uint256 _supplyAmount) public onlyKeepers {
        uint256 unleveragedSupply = getSuppliedUnleveraged();
        uint256 supplied = getSupplied();
        require(
            _supplyAmount >= unleveragedSupply && _supplyAmount <= supplied,
            "!deleverage"
        );

        // Market collateral factor
        uint256 marketColFactor = getMarketColFactor();

        // How much can we redeem
        uint256 _redeemAndRepay = getRedeemable();
        do {
            // If the amount we're redeeming is exceeding the
            // target supplyAmount, adjust accordingly
            if (supplied.sub(_redeemAndRepay) < _supplyAmount) {
                _redeemAndRepay = supplied.sub(_supplyAmount);
            }

            require(
                ICToken(cdai).redeemUnderlying(_redeemAndRepay) == 0,
                "!redeem"
            );
            IERC20(dai).safeApprove(cdai, 0);
            IERC20(dai).safeApprove(cdai, _redeemAndRepay);
            require(ICToken(cdai).repayBorrow(_redeemAndRepay) == 0, "!repay");

            supplied = supplied.sub(_redeemAndRepay);

            // After each deleverage we can redeem more (the colFactor)
            _redeemAndRepay = _redeemAndRepay.mul(1e18).div(marketColFactor);
        } while (supplied > _supplyAmount);
    }

    function harvest() public override onlyBenevolent {
        address[] memory ctokens = new address[](1);
        ctokens[0] = cdai;

        IComptroller(comptroller).claimComp(address(this), ctokens);
        uint256 _comp = IERC20(comp).balanceOf(address(this));
        if (_comp > 0) {
            _swapUniswap(comp, want, _comp);
        }

        _distributePerformanceFeesAndDeposit();
    }

    function deposit() public override {
        uint256 _want = IERC20(want).balanceOf(address(this));
        if (_want > 0) {
            IERC20(want).safeApprove(cdai, 0);
            IERC20(want).safeApprove(cdai, _want);
            require(ICToken(cdai).mint(_want) == 0, "!deposit");
        }
    }

    function _withdrawSome(uint256 _amount)
        internal
        override
        returns (uint256)
    {
        uint256 _want = balanceOfWant();
        if (_want < _amount) {
            uint256 _redeem = _amount.sub(_want);

            // Make sure market can cover liquidity
            require(ICToken(cdai).getCash() >= _redeem, "!cash-liquidity");

            // How much borrowed amount do we need to free?
            uint256 borrowed = getBorrowed();
            uint256 supplied = getSupplied();
            uint256 curLeverage = getCurrentLeverage();
            uint256 borrowedToBeFree = _redeem.mul(curLeverage).div(1e18);

            // If the amount we need to free is > borrowed
            // Just free up all the borrowed amount
            if (borrowedToBeFree > borrowed) {
                this.deleverageToMin();
            } else {
                // Otherwise just keep freeing up borrowed amounts until
                // we hit a safe number to redeem our underlying
                this.deleverageUntil(supplied.sub(borrowedToBeFree));
            }

            // Redeems underlying
            require(ICToken(cdai).redeemUnderlying(_redeem) == 0, "!redeem");
        }

        return _amount;
    }
}

File 2 of 12 : erc20.sol
// File: contracts/GSN/Context.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./safe-math.sol";
import "./context.sol";

// File: contracts/token/ERC20/IERC20.sol


/**
 * @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: contracts/utils/Address.sol


/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// File: contracts/token/ERC20/ERC20.sol

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;
    using Address for address;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name, string memory symbol) public {
        _name = name;
        _symbol = symbol;
        _decimals = 18;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20};
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

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

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

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

pragma solidity ^0.6.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, 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) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * 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);
        uint256 c = a - b;

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

File 4 of 12 : context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

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

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

File 5 of 12 : exponential.sol
pragma solidity ^0.6.0;

import "./careful-math.sol";

/**
 * @title Exponential module for storing fixed-precision decimals
 * @author Compound
 * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.
 *         Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:
 *         `Exp({mantissa: 5100000000000000000})`.
 */
contract 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 fraction) = divScalarByExp(scalar, divisor);
        if (err != MathError.NO_ERROR) {
            return (err, 0);
        }

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

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

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

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

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

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

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

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

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

    /**
     * @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 12 : careful-math.sol
pragma solidity ^0.6.0;

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

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

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

        uint c = a * b;

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

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

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

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

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

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

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

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

        return subUInt(sum, c);
    }
}

File 7 of 12 : strategy-base.sol
pragma solidity ^0.6.7;

import "../lib/erc20.sol";
import "../lib/safe-math.sol";

import "../interfaces/jar.sol";
import "../interfaces/staking-rewards.sol";
import "../interfaces/uniswapv2.sol";
import "../interfaces/controller.sol";

// Strategy Contract Basics

abstract contract StrategyBase {
    using SafeERC20 for IERC20;
    using Address for address;
    using SafeMath for uint256;

    // Perfomance fees - start with 4.5%
    uint256 public performanceTreasuryFee = 450;
    uint256 public constant performanceTreasuryMax = 10000;

    uint256 public performanceDevFee = 0;
    uint256 public constant performanceDevMax = 10000;

    // Withdrawal fee 0.5%
    // - 0.325% to treasury
    // - 0.175% to dev fund
    uint256 public withdrawalTreasuryFee = 325;
    uint256 public constant withdrawalTreasuryMax = 100000;

    uint256 public withdrawalDevFundFee = 175;
    uint256 public constant withdrawalDevFundMax = 100000;

    // Tokens
    address public want;
    address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

    // User accounts
    address public governance;
    address public controller;
    address public strategist;
    address public timelock;

    // Dex
    address public univ2Router2 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;

    constructor(
        address _want,
        address _governance,
        address _strategist,
        address _controller,
        address _timelock
    ) public {
        require(_want != address(0));
        require(_governance != address(0));
        require(_strategist != address(0));
        require(_controller != address(0));
        require(_timelock != address(0));

        want = _want;
        governance = _governance;
        strategist = _strategist;
        controller = _controller;
        timelock = _timelock;
    }

    // **** Modifiers **** //

    modifier onlyBenevolent {
        require(
            msg.sender == tx.origin ||
                msg.sender == governance ||
                msg.sender == strategist
        );
        _;
    }

    // **** Views **** //

    function balanceOfWant() public view returns (uint256) {
        return IERC20(want).balanceOf(address(this));
    }

    function balanceOfPool() public virtual view returns (uint256);

    function balanceOf() public view returns (uint256) {
        return balanceOfWant().add(balanceOfPool());
    }

    function getName() external virtual pure returns (string memory);

    // **** Setters **** //

    function setWithdrawalDevFundFee(uint256 _withdrawalDevFundFee) external {
        require(msg.sender == timelock, "!timelock");
        withdrawalDevFundFee = _withdrawalDevFundFee;
    }

    function setWithdrawalTreasuryFee(uint256 _withdrawalTreasuryFee) external {
        require(msg.sender == timelock, "!timelock");
        withdrawalTreasuryFee = _withdrawalTreasuryFee;
    }

    function setPerformanceDevFee(uint256 _performanceDevFee) external {
        require(msg.sender == timelock, "!timelock");
        performanceDevFee = _performanceDevFee;
    }

    function setPerformanceTreasuryFee(uint256 _performanceTreasuryFee)
        external
    {
        require(msg.sender == timelock, "!timelock");
        performanceTreasuryFee = _performanceTreasuryFee;
    }

    function setStrategist(address _strategist) external {
        require(msg.sender == governance, "!governance");
        strategist = _strategist;
    }

    function setGovernance(address _governance) external {
        require(msg.sender == governance, "!governance");
        governance = _governance;
    }

    function setTimelock(address _timelock) external {
        require(msg.sender == timelock, "!timelock");
        timelock = _timelock;
    }

    function setController(address _controller) external {
        require(msg.sender == timelock, "!timelock");
        controller = _controller;
    }

    // **** State mutations **** //
    function deposit() public virtual;

    // Controller only function for creating additional rewards from dust
    function withdraw(IERC20 _asset) external returns (uint256 balance) {
        require(msg.sender == controller, "!controller");
        require(want != address(_asset), "want");
        balance = _asset.balanceOf(address(this));
        _asset.safeTransfer(controller, balance);
    }

    // Withdraw partial funds, normally used with a jar withdrawal
    function withdraw(uint256 _amount) external {
        require(msg.sender == controller, "!controller");
        uint256 _balance = IERC20(want).balanceOf(address(this));
        if (_balance < _amount) {
            _amount = _withdrawSome(_amount.sub(_balance));
            _amount = _amount.add(_balance);
        }

        uint256 _feeDev = _amount.mul(withdrawalDevFundFee).div(
            withdrawalDevFundMax
        );
        IERC20(want).safeTransfer(IController(controller).devfund(), _feeDev);

        uint256 _feeTreasury = _amount.mul(withdrawalTreasuryFee).div(
            withdrawalTreasuryMax
        );
        IERC20(want).safeTransfer(
            IController(controller).treasury(),
            _feeTreasury
        );

        address _jar = IController(controller).jars(address(want));
        require(_jar != address(0), "!jar"); // additional protection so we don't burn the funds

        IERC20(want).safeTransfer(_jar, _amount.sub(_feeDev).sub(_feeTreasury));
    }

    // Withdraw funds, used to swap between strategies
    function withdrawForSwap(uint256 _amount)
        external
        returns (uint256 balance)
    {
        require(msg.sender == controller, "!controller");
        _withdrawSome(_amount);

        balance = IERC20(want).balanceOf(address(this));

        address _jar = IController(controller).jars(address(want));
        require(_jar != address(0), "!jar");
        IERC20(want).safeTransfer(_jar, balance);
    }

    // Withdraw all funds, normally used when migrating strategies
    function withdrawAll() external returns (uint256 balance) {
        require(msg.sender == controller, "!controller");
        _withdrawAll();

        balance = IERC20(want).balanceOf(address(this));

        address _jar = IController(controller).jars(address(want));
        require(_jar != address(0), "!jar"); // additional protection so we don't burn the funds
        IERC20(want).safeTransfer(_jar, balance);
    }

    function _withdrawAll() internal {
        _withdrawSome(balanceOfPool());
    }

    function _withdrawSome(uint256 _amount) internal virtual returns (uint256);

    function harvest() public virtual;

    // **** Emergency functions ****

    function execute(address _target, bytes memory _data)
        public
        payable
        returns (bytes memory response)
    {
        require(msg.sender == timelock, "!timelock");
        require(_target != address(0), "!target");

        // call contract in current context
        assembly {
            let succeeded := delegatecall(
                sub(gas(), 5000),
                _target,
                add(_data, 0x20),
                mload(_data),
                0,
                0
            )
            let size := returndatasize()

            response := mload(0x40)
            mstore(
                0x40,
                add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))
            )
            mstore(response, size)
            returndatacopy(add(response, 0x20), 0, size)

            switch iszero(succeeded)
                case 1 {
                    // throw if delegatecall failed
                    revert(add(response, 0x20), size)
                }
        }
    }

    // **** Internal functions ****
    function _swapUniswap(
        address _from,
        address _to,
        uint256 _amount
    ) internal {
        require(_to != address(0));

        // Swap with uniswap
        IERC20(_from).safeApprove(univ2Router2, 0);
        IERC20(_from).safeApprove(univ2Router2, _amount);

        address[] memory path;

        if (_from == weth || _to == weth) {
            path = new address[](2);
            path[0] = _from;
            path[1] = _to;
        } else {
            path = new address[](3);
            path[0] = _from;
            path[1] = weth;
            path[2] = _to;
        }

        UniswapRouterV2(univ2Router2).swapExactTokensForTokens(
            _amount,
            0,
            path,
            address(this),
            now.add(60)
        );
    }

    function _distributePerformanceFeesAndDeposit() internal {
        uint256 _want = IERC20(want).balanceOf(address(this));

        if (_want > 0) {
            // Treasury fees
            IERC20(want).safeTransfer(
                IController(controller).treasury(),
                _want.mul(performanceTreasuryFee).div(performanceTreasuryMax)
            );

            // Performance fee
            IERC20(want).safeTransfer(
                IController(controller).devfund(),
                _want.mul(performanceDevFee).div(performanceDevMax)
            );

            deposit();
        }
    }
}

File 8 of 12 : jar.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;

import "../lib/erc20.sol";

interface IJar is IERC20 {
    function token() external view returns (address);

    function claimInsurance() external; // NOTE: Only yDelegatedVault implements this

    function getRatio() external view returns (uint256);

    function depositAll() external;

    function deposit(uint256) external;

    function withdrawAll() external;

    function withdraw(uint256) external;

    function earn() external;

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

File 9 of 12 : staking-rewards.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;

interface IStakingRewards {
    function balanceOf(address account) external view returns (uint256);

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

    function exit() external;

    function getReward() external;

    function getRewardForDuration() external view returns (uint256);

    function lastTimeRewardApplicable() external view returns (uint256);

    function lastUpdateTime() external view returns (uint256);

    function notifyRewardAmount(uint256 reward) external;

    function periodFinish() external view returns (uint256);

    function rewardPerToken() external view returns (uint256);

    function rewardPerTokenStored() external view returns (uint256);

    function rewardRate() external view returns (uint256);

    function rewards(address) external view returns (uint256);

    function rewardsDistribution() external view returns (address);

    function rewardsDuration() external view returns (uint256);

    function rewardsToken() external view returns (address);

    function stake(uint256 amount) external;

    function stakeWithPermit(
        uint256 amount,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    function stakingToken() external view returns (address);

    function totalSupply() external view returns (uint256);

    function userRewardPerTokenPaid(address) external view returns (uint256);

    function withdraw(uint256 amount) external;
}

interface IStakingRewardsFactory {
    function deploy(address stakingToken, uint256 rewardAmount) external;

    function isOwner() external view returns (bool);

    function notifyRewardAmount(address stakingToken) external;

    function notifyRewardAmounts() external;

    function owner() external view returns (address);

    function renounceOwnership() external;

    function rewardsToken() external view returns (address);

    function stakingRewardsGenesis() external view returns (uint256);

    function stakingRewardsInfoByStakingToken(address)
        external
        view
        returns (address stakingRewards, uint256 rewardAmount);

    function stakingTokens(uint256) external view returns (address);

    function transferOwnership(address newOwner) external;
}

File 10 of 12 : uniswapv2.sol
// SPDX-License-Identifier: MIT

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;

interface UniswapRouterV2 {
    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        );

    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        );

    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountA, uint256 amountB);

    function getAmountsOut(uint256 amountIn, address[] calldata path)
        external
        view
        returns (uint256[] memory amounts);

    function getAmountsIn(uint256 amountOut, address[] calldata path)
        external
        view
        returns (uint256[] memory amounts);

    function swapETHForExactTokens(
        uint256 amountOut,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable returns (uint256[] memory amounts);

    function swapExactETHForTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable returns (uint256[] memory amounts);
}

interface IUniswapV2Pair {
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

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

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

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

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    event Mint(address indexed sender, uint256 amount0, uint256 amount1);
    event Burn(
        address indexed sender,
        uint256 amount0,
        uint256 amount1,
        address indexed to
    );
    event Swap(
        address indexed sender,
        uint256 amount0In,
        uint256 amount1In,
        uint256 amount0Out,
        uint256 amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function factory() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        );

    function price0CumulativeLast() external view returns (uint256);

    function price1CumulativeLast() external view returns (uint256);

    function kLast() external view returns (uint256);

    function mint(address to) external returns (uint256 liquidity);

    function burn(address to)
        external
        returns (uint256 amount0, uint256 amount1);

    function swap(
        uint256 amount0Out,
        uint256 amount1Out,
        address to,
        bytes calldata data
    ) external;

    function skim(address to) external;

    function sync() external;
}

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

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

    function allPairs(uint256) external view returns (address pair);

    function allPairsLength() external view returns (uint256);

    function feeTo() external view returns (address);

    function feeToSetter() external view returns (address);

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

File 11 of 12 : controller.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

interface IController {
    function jars(address) external view returns (address);

    function rewards() external view returns (address);

    function devfund() external view returns (address);

    function treasury() external view returns (address);

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

    function withdraw(address, uint256) external;

    function earn(address, uint256) external;
}

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

pragma solidity ^0.6.0;

interface ICToken {
    function totalSupply() external view returns (uint256);

    function totalBorrows() external returns (uint256);

    function borrowIndex() external returns (uint256);

    function repayBorrow(uint256 repayAmount) external returns (uint256);

    function redeemUnderlying(uint256 redeemAmount) external returns (uint256);

    function borrow(uint256 borrowAmount) external returns (uint256);

    function mint(uint256 mintAmount) external returns (uint256);

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

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

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

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

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

    function balanceOfUnderlying(address owner) external returns (uint256);

    function getAccountSnapshot(address account)
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            uint256
        );

    function borrowRatePerBlock() external view returns (uint256);

    function supplyRatePerBlock() external view returns (uint256);

    function totalBorrowsCurrent() external returns (uint256);

    function borrowBalanceCurrent(address account) external returns (uint256);

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

    function exchangeRateCurrent() external returns (uint256);

    function exchangeRateStored() external view returns (uint256);

    function getCash() external view returns (uint256);

    function accrueInterest() external returns (uint256);

    function seize(
        address liquidator,
        address borrower,
        uint256 seizeTokens
    ) external returns (uint256);
}

interface ICEther {
    function mint() external payable;

    /**
     * @notice Sender redeems cTokens in exchange for the underlying asset
     * @dev Accrues interest whether or not the operation succeeds, unless reverted
     * @param redeemTokens The number of cTokens to redeem into underlying
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function redeem(uint256 redeemTokens) external returns (uint256);

    /**
     * @notice Sender redeems cTokens 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
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function redeemUnderlying(uint256 redeemAmount) external returns (uint256);

    /**
     * @notice Sender borrows assets from the protocol to their own address
     * @param borrowAmount The amount of the underlying asset to borrow
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function borrow(uint256 borrowAmount) external returns (uint256);

    /**
     * @notice Sender repays their own borrow
     * @dev Reverts upon any failure
     */
    function repayBorrow() external payable;

    /**
     * @notice Sender repays a borrow belonging to borrower
     * @dev Reverts upon any failure
     * @param borrower the account with the debt being payed off
     */
    function repayBorrowBehalf(address borrower) external payable;

    /**
     * @notice The sender liquidates the borrowers collateral.
     *  The collateral seized is transferred to the liquidator.
     * @dev Reverts upon any failure
     * @param borrower The borrower of this cToken to be liquidated
     * @param cTokenCollateral The market in which to seize collateral from the borrower
     */
    function liquidateBorrow(address borrower, address cTokenCollateral)
        external
        payable;
}

interface IComptroller {
    function compAccrued(address) external view returns (uint256);

    function compSupplierIndex(address, address)
        external
        view
        returns (uint256);

    function compBorrowerIndex(address, address)
        external
        view
        returns (uint256);

    function compSpeeds(address) external view returns (uint256);

    function compBorrowState(address) external view returns (uint224, uint32);

    function compSupplyState(address) external view returns (uint224, uint32);

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

    function enterMarkets(address[] calldata cTokens)
        external
        returns (uint256[] memory);

    function exitMarket(address cToken) external returns (uint256);

    /*** Policy Hooks ***/

    function mintAllowed(
        address cToken,
        address minter,
        uint256 mintAmount
    ) external returns (uint256);

    function mintVerify(
        address cToken,
        address minter,
        uint256 mintAmount,
        uint256 mintTokens
    ) external;

    function redeemAllowed(
        address cToken,
        address redeemer,
        uint256 redeemTokens
    ) external returns (uint256);

    function redeemVerify(
        address cToken,
        address redeemer,
        uint256 redeemAmount,
        uint256 redeemTokens
    ) external;

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

    function borrowVerify(
        address cToken,
        address borrower,
        uint256 borrowAmount
    ) external;

    function repayBorrowAllowed(
        address cToken,
        address payer,
        address borrower,
        uint256 repayAmount
    ) external returns (uint256);

    function repayBorrowVerify(
        address cToken,
        address payer,
        address borrower,
        uint256 repayAmount,
        uint256 borrowerIndex
    ) external;

    function liquidateBorrowAllowed(
        address cTokenBorrowed,
        address cTokenCollateral,
        address liquidator,
        address borrower,
        uint256 repayAmount
    ) external returns (uint256);

    function liquidateBorrowVerify(
        address cTokenBorrowed,
        address cTokenCollateral,
        address liquidator,
        address borrower,
        uint256 repayAmount,
        uint256 seizeTokens
    ) external;

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

    function seizeVerify(
        address cTokenCollateral,
        address cTokenBorrowed,
        address liquidator,
        address borrower,
        uint256 seizeTokens
    ) external;

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

    function transferVerify(
        address cToken,
        address src,
        address dst,
        uint256 transferTokens
    ) external;

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

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

    // Claim all the COMP accrued by holder in all markets
    function claimComp(address holder) external;

    // Claim all the COMP accrued by holder in specific markets
    function claimComp(address holder, address[] calldata cTokens) external;

    // Claim all the COMP accrued by specific holders in specific markets for their supplies and/or borrows
    function claimComp(
        address[] calldata holders,
        address[] calldata cTokens,
        bool borrowers,
        bool suppliers
    ) external;

    function markets(address cTokenAddress)
        external
        view
        returns (bool, uint256);
}

interface ICompoundLens {
    function getCompBalanceMetadataExt(
        address comp,
        address comptroller,
        address account
    )
        external
        returns (
            uint256 balance,
            uint256 votes,
            address delegate,
            uint256 allocated
        );
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_governance","type":"address"},{"internalType":"address","name":"_strategist","type":"address"},{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_timelock","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"_keeper","type":"address"}],"name":"addKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balanceOfPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balanceOfWant","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cdai","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cether","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"comp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"comptroller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dai","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deleverageToMin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_supplyAmount","type":"uint256"}],"name":"deleverageUntil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"execute","outputs":[{"internalType":"bytes","name":"response","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getBorrowable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getBorrowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getBorrowedView","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getColFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCompAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentLeverage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"supplyBalance","type":"uint256"}],"name":"getLeveragedSupplyTarget","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMarketColFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxLeverage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getRedeemable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getSafeLeverageColFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSafeSyncColFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSupplied","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getSuppliedUnleveraged","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getSuppliedView","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"leverageToMax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_supplyAmount","type":"uint256"}],"name":"leverageUntil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"performanceDevFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceDevMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceTreasuryFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceTreasuryMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_keeper","type":"address"}],"name":"removeKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_colFactorLeverageBuffer","type":"uint256"}],"name":"setColFactorLeverageBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_colFactorSyncBuffer","type":"uint256"}],"name":"setColFactorSyncBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_performanceDevFee","type":"uint256"}],"name":"setPerformanceDevFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_performanceTreasuryFee","type":"uint256"}],"name":"setPerformanceTreasuryFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategist","type":"address"}],"name":"setStrategist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_timelock","type":"address"}],"name":"setTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawalDevFundFee","type":"uint256"}],"name":"setWithdrawalDevFundFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawalTreasuryFee","type":"uint256"}],"name":"setWithdrawalTreasuryFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sync","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"univ2Router2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"want","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_asset","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawForSwap","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalDevFundFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalDevFundMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalTreasuryFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalTreasuryMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040526101c2600090815560015561014560025560af600355600980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d1790556028600a556103e8600b8190556032600c55600d553480156200006257600080fd5b5060405162003e3938038062003e39833981810160405260808110156200008857600080fd5b5080516020820151604083015160609093015191929091736b175474e89094c44da98b954eedeac495271d0f848484846001600160a01b038416620000cc57600080fd5b6001600160a01b038316620000e057600080fd5b6001600160a01b038216620000f457600080fd5b6001600160a01b0381166200010857600080fd5b600480546001600160a01b03199081166001600160a01b0397881617909155600580548216958716959095179094556007805485169386169390931790925560068054841691851691909117905560088054909216921691909117905560408051600180825281830190925260609160208083019080368337019050509050735d3a536e4d6dbd6114cc1ead35777bab948e364381600081518110620001aa57fe5b6001600160a01b03909216602092830291909101820152604051631853304760e31b815260048101828152835160248301528351733d9819210a31b4961b30ef54be2aed79b9c9cd3b9363c2998238938693928392604490920191858101910280838360005b838110156200022a57818101518382015260200162000210565b5050505090500192505050600060405180830381600087803b1580156200025057600080fd5b505af115801562000265573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156200028f57600080fd5b8101908080516040519392919084640100000000821115620002b057600080fd5b908301906020820185811115620002c657600080fd5b8251866020820283011164010000000082111715620002e457600080fd5b82525081516020918201928201910280838360005b8381101562000313578181015183820152602001620002f9565b50505050905001604052505050505050505050613b0380620003366000396000f3fe6080604052600436106103c35760003560e01c80637396a626116101f2578063b9e374891161010d578063d33219b4116100a0578063f53f13501161006f578063f53f135014610b9e578063f77c479114610bb3578063fe1f8f7a1461072d578063fff6cae914610bc8576103c3565b8063d33219b414610b20578063eb514af914610b35578063f4aa3a8d14610b5f578063f4b9fa7514610b89576103c3565b8063c65e3242116100dc578063c65e324214610a99578063c7b9d53014610ac3578063cec2064014610af6578063d0e30db014610b0b576103c3565b8063b9e3748914610a12578063bdacb30314610a27578063c1a3d44c14610a5a578063c6223e2614610a6f576103c3565b806392eefe9b11610185578063ab033ea911610154578063ab033ea91461098b578063ab73e433146109be578063ac41ceb3146109e8578063b01db4ec146109fd576103c3565b806392eefe9b146109045780639c4b8163146109375780639eb52f611461094c578063a1e003e414610961576103c3565b8063853828b6116101c1578063853828b6146108b0578063875cb38c146108c557806388993f22146108da5780638ccdbb70146108ef576103c3565b80637396a6261461084757806377da835a1461085c5780638081e1cf146108715780638237859414610886576103c3565b80633fc8cef3116102e257806359739ec4116102755780635c208490116102445780635c208490146107f35780635eefb092146108085780635fe3b5671461081d578063722713f714610832576103c3565b806359739ec41461078a57806359bca6791461079f5780635aa6e675146107c95780635bfb92ce146107de576103c3565b8063479119be116102b1578063479119be1461072d5780634fe809cc1461062857806351cff8d91461074257806351f3d0b814610775576103c3565b80633fc8cef3146106bb5780634032b72b146106d0578063463289ed146107035780634641257d14610718576103c3565b80631f1fcd511161035a5780632a99417d116103295780632a99417d1461063d5780632e1a7d4d14610652578063302ab80d1461067c5780633c5dae94146106a6576103c3565b80631f1fcd51146105d45780631fe4a686146105e9578063249fb9b4146105fe57806326e886c614610628576103c3565b806314ae9f2e1161039657806314ae9f2e1461044a57806315ac03fd1461047f57806317d7de7c146104945780631cff79cd1461051e576103c3565b80630ea8b3bf146103c8578063109d0af8146103ef578063112666b7146104205780631158808614610435575b600080fd5b3480156103d457600080fd5b506103dd610bf1565b60408051918252519081900360200190f35b3480156103fb57600080fd5b50610404610c32565b604080516001600160a01b039092168252519081900360200190f35b34801561042c57600080fd5b50610404610c4a565b34801561044157600080fd5b506103dd610c62565b34801561045657600080fd5b5061047d6004803603602081101561046d57600080fd5b50356001600160a01b0316610c8b565b005b34801561048b57600080fd5b50610404610d0e565b3480156104a057600080fd5b506104a9610d26565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104e35781810151838201526020016104cb565b50505050905090810190601f1680156105105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104a96004803603604081101561053457600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561055f57600080fd5b82018360208201111561057157600080fd5b8035906020019184600183028401116401000000008311171561059357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610d51945050505050565b3480156105e057600080fd5b50610404610e34565b3480156105f557600080fd5b50610404610e43565b34801561060a57600080fd5b5061047d6004803603602081101561062157600080fd5b5035610e52565b34801561063457600080fd5b506103dd610ea2565b34801561064957600080fd5b506103dd610ea8565b34801561065e57600080fd5b5061047d6004803603602081101561067557600080fd5b5035610ee9565b34801561068857600080fd5b5061047d6004803603602081101561069f57600080fd5b503561121a565b3480156106b257600080fd5b506103dd611281565b3480156106c757600080fd5b506104046112c3565b3480156106dc57600080fd5b5061047d600480360360208110156106f357600080fd5b50356001600160a01b03166112db565b34801561070f57600080fd5b506103dd611361565b34801561072457600080fd5b5061047d6113f8565b34801561073957600080fd5b506103dd6115f1565b34801561074e57600080fd5b506103dd6004803603602081101561076557600080fd5b50356001600160a01b03166115f8565b34801561078157600080fd5b506103dd61172e565b34801561079657600080fd5b506103dd611734565b3480156107ab57600080fd5b5061047d600480360360208110156107c257600080fd5b503561173a565b3480156107d557600080fd5b506104046117a1565b3480156107ea57600080fd5b506103dd6117b0565b3480156107ff57600080fd5b506103dd6117f4565b34801561081457600080fd5b506103dd611875565b34801561082957600080fd5b506104046118d8565b34801561083e57600080fd5b506103dd6118f0565b34801561085357600080fd5b506103dd611916565b34801561086857600080fd5b506103dd61194b565b34801561087d57600080fd5b506103dd6119fd565b34801561089257600080fd5b5061047d600480360360208110156108a957600080fd5b5035611a4d565b3480156108bc57600080fd5b506103dd611a9d565b3480156108d157600080fd5b506103dd611c57565b3480156108e657600080fd5b506103dd611d4a565b3480156108fb57600080fd5b506103dd611d50565b34801561091057600080fd5b5061047d6004803603602081101561092757600080fd5b50356001600160a01b0316611d56565b34801561094357600080fd5b506103dd611dc3565b34801561095857600080fd5b506103dd611dda565b34801561096d57600080fd5b506103dd6004803603602081101561098457600080fd5b5035611ead565b34801561099757600080fd5b5061047d600480360360208110156109ae57600080fd5b50356001600160a01b0316611edd565b3480156109ca57600080fd5b5061047d600480360360208110156109e157600080fd5b5035611f4c565b3480156109f457600080fd5b5061047d611f9c565b348015610a0957600080fd5b506103dd611fbe565b348015610a1e57600080fd5b5061040461207e565b348015610a3357600080fd5b5061047d60048036036020811015610a4a57600080fd5b50356001600160a01b031661208d565b348015610a6657600080fd5b506103dd6120fa565b348015610a7b57600080fd5b506103dd60048036036020811015610a9257600080fd5b5035612149565b348015610aa557600080fd5b5061047d60048036036020811015610abc57600080fd5b5035612307565b348015610acf57600080fd5b5061047d60048036036020811015610ae657600080fd5b50356001600160a01b0316612357565b348015610b0257600080fd5b506104046123c6565b348015610b1757600080fd5b5061047d6123d8565b348015610b2c57600080fd5b50610404612572565b348015610b4157600080fd5b5061047d60048036036020811015610b5857600080fd5b5035612581565b348015610b6b57600080fd5b5061047d60048036036020811015610b8257600080fd5b50356128ca565b348015610b9557600080fd5b50610404612ab7565b348015610baa57600080fd5b5061047d612acf565b348015610bbf57600080fd5b50610404612ae4565b348015610bd457600080fd5b50610bdd612af3565b604080519115158252519081900360200190f35b600080610bfc611281565b90506000610c2a6ec097ce7bc90715b34b9f1000000000670de0b6b3a764000084900363ffffffff612b4c16565b925050505b90565b73c00e94cb662c3520282e6f5717214004a7f2688881565b73d513d22422a3062bd342ae374b4b9c20e0a9a07481565b600080610c6d61194b565b90506000610c79611875565b9050610c2a828263ffffffff612b9716565b6005546001600160a01b0316331480610cae57506007546001600160a01b031633145b610ced576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600e60205260409020805460ff19169055565b734ddc2d193948926d02f9b1fe9e1daa0718270ed581565b6040805180820190915260118152705374726174656779436d7064446169563360781b602082015290565b6008546060906001600160a01b03163314610d9f576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b6001600160a01b038316610de4576040805162461bcd60e51b8152602060048201526007602482015266085d185c99d95d60ca1b604482015290519081900360640190fd5b600080835160208501866113885a03f43d6040519250601f19601f6020830101168301604052808352806000602085013e811560018114610e2457610e2b565b8160208501fd5b50505092915050565b6004546001600160a01b031681565b6007546001600160a01b031681565b6008546001600160a01b03163314610e9d576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600055565b61271081565b600080610eb36117f4565b90506000610ebf6119fd565b9050610c2a82610edd83670de0b6b3a764000063ffffffff612bd916565b9063ffffffff612b4c16565b6006546001600160a01b03163314610f36576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b158015610f8557600080fd5b505afa158015610f99573d6000803e3d6000fd5b505050506040513d6020811015610faf57600080fd5b5051905081811015610fe857610fd3610fce838363ffffffff612b9716565b612c32565b9150610fe5828263ffffffff612ee616565b91505b6000611006620186a0610edd60035486612bd990919063ffffffff16565b905061109e600660009054906101000a90046001600160a01b03166001600160a01b0316638d8f1e676040518163ffffffff1660e01b815260040160206040518083038186803b15801561105957600080fd5b505afa15801561106d573d6000803e3d6000fd5b505050506040513d602081101561108357600080fd5b50516004546001600160a01b0316908363ffffffff612f4016565b60006110bc620186a0610edd60025487612bd990919063ffffffff16565b905061110f600660009054906101000a90046001600160a01b03166001600160a01b03166361d027b36040518163ffffffff1660e01b815260040160206040518083038186803b15801561105957600080fd5b6006546004805460408051636535246160e11b81526001600160a01b039283169381019390935251600093919091169163ca6a48c2916024808301926020929190829003018186803b15801561116457600080fd5b505afa158015611178573d6000803e3d6000fd5b505050506040513d602081101561118e57600080fd5b505190506001600160a01b0381166111d6576040805162461bcd60e51b8152602060048083019190915260248201526310b530b960e11b604482015290519081900360640190fd5b611213816111fa846111ee898863ffffffff612b9716565b9063ffffffff612b9716565b6004546001600160a01b0316919063ffffffff612f4016565b5050505050565b6005546001600160a01b031633148061123d57506007546001600160a01b031633145b61127c576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600a55565b60008061128c611361565b90506000610c2a6112b6600b54610edd670de0b6b3a7640000600a54612bd990919063ffffffff16565b839063ffffffff612b9716565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6005546001600160a01b03163314806112fe57506007546001600160a01b031633145b61133d576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600e60205260409020805460ff19166001179055565b60408051638e8f294b60e01b8152600080516020613a2d833981519152600482015281516000928392733d9819210a31b4961b30ef54be2aed79b9c9cd3b92638e8f294b92602480840193919291829003018186803b1580156113c357600080fd5b505afa1580156113d7573d6000803e3d6000fd5b505050506040513d60408110156113ed57600080fd5b506020015191505090565b3332148061141057506005546001600160a01b031633145b8061142557506007546001600160a01b031633145b61142e57600080fd5b60408051600180825281830190925260609160208083019080368337019050509050600080516020613a2d8339815191528160008151811061146c57fe5b6001600160a01b039092166020928302919091018201526040805162e1ed9760e51b8152306004820181815260248301938452855160448401528551733d9819210a31b4961b30ef54be2aed79b9c9cd3b95631c3db2e0959394889492606490910191858101910280838360005b838110156114f25781810151838201526020016114da565b505050509050019350505050600060405180830381600087803b15801561151857600080fd5b505af115801561152c573d6000803e3d6000fd5b5050604080516370a0823160e01b815230600482015290516000935073c00e94cb662c3520282e6f5717214004a7f2688892506370a0823191602480820192602092909190829003018186803b15801561158557600080fd5b505afa158015611599573d6000803e3d6000fd5b505050506040513d60208110156115af57600080fd5b5051905080156115e5576004546115e59073c00e94cb662c3520282e6f5717214004a7f26888906001600160a01b031683612f97565b6115ed613313565b5050565b620186a081565b6006546000906001600160a01b03163314611648576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b6004546001600160a01b0383811691161415611694576040805162461bcd60e51b815260206004808301919091526024820152631dd85b9d60e21b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156116da57600080fd5b505afa1580156116ee573d6000803e3d6000fd5b505050506040513d602081101561170457600080fd5b5051600654909150611729906001600160a01b0384811691168363ffffffff612f4016565b919050565b60035481565b60005481565b6005546001600160a01b031633148061175d57506007546001600160a01b031633145b61179c576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600c55565b6005546001600160a01b031681565b6000806117bb6117f4565b905060006117c76119fd565b9050610c2a6117dc838363ffffffff612b9716565b610edd84670de0b6b3a764000063ffffffff612bd916565b60408051633af9e66960e01b81523060048201529051600091600080516020613a2d83398151915291633af9e6699160248082019260209290919082900301818787803b15801561184457600080fd5b505af1158015611858573d6000803e3d6000fd5b505050506040513d602081101561186e57600080fd5b5051905090565b604080516395dd919360e01b81523060048201529051600091600080516020613a2d833981519152916395dd919391602480820192602092909190829003018186803b1580156118c457600080fd5b505afa158015611858573d6000803e3d6000fd5b733d9819210a31b4961b30ef54be2aed79b9c9cd3b81565b60006119116118fd610c62565b6119056120fa565b9063ffffffff612ee616565b905090565b600080611921611361565b90506000610c2a6112b6600d54610edd670de0b6b3a7640000600c54612bd990919063ffffffff16565b604080516361bfb47160e11b8152306004820152905160009182918291600080516020613a2d8339815191529163c37f68e291602480820192608092909190829003018186803b15801561199e57600080fd5b505afa1580156119b2573d6000803e3d6000fd5b505050506040513d60808110156119c857600080fd5b506020808201516060909201516040805192830190528082529193509091506000906119f490846134ba565b94505050505090565b604080516305eff7ef60e21b81523060048201529051600091600080516020613a2d833981519152916317bfdfbc9160248082019260209290919082900301818787803b15801561184457600080fd5b6008546001600160a01b03163314611a98576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600255565b6006546000906001600160a01b03163314611aed576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b611af561350e565b60048054604080516370a0823160e01b81523093810193909352516001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015611b4157600080fd5b505afa158015611b55573d6000803e3d6000fd5b505050506040513d6020811015611b6b57600080fd5b50516006546004805460408051636535246160e11b81526001600160a01b03928316938101939093525193945060009392169163ca6a48c291602480820192602092909190829003018186803b158015611bc457600080fd5b505afa158015611bd8573d6000803e3d6000fd5b505050506040513d6020811015611bee57600080fd5b505190506001600160a01b038116611c36576040805162461bcd60e51b8152602060048083019190915260248201526310b530b960e11b604482015290519081900360640190fd5b600454611c53906001600160a01b0316828463ffffffff612f4016565b5090565b600080611c626117f4565b90506000611c6e6119fd565b60408051638e8f294b60e01b8152600080516020613a2d83398151915260048201528151929350600092733d9819210a31b4961b30ef54be2aed79b9c9cd3b92638e8f294b9260248082019391829003018186803b158015611ccf57600080fd5b505afa158015611ce3573d6000803e3d6000fd5b505050506040513d6040811015611cf957600080fd5b50602001519050611d42612710610edd61270f611d36611d29868489670de0b6b3a764000063ffffffff612bd916565b889063ffffffff612b9716565b9063ffffffff612bd916565b935050505090565b60015481565b60025481565b6008546001600160a01b03163314611da1576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600080611dce6117f4565b90506000610c796119fd565b600080611de56117f4565b90506000611df16119fd565b60408051638e8f294b60e01b8152600080516020613a2d83398151915260048201528151929350600092733d9819210a31b4961b30ef54be2aed79b9c9cd3b92638e8f294b9260248082019391829003018186803b158015611e5257600080fd5b505afa158015611e66573d6000803e3d6000fd5b505050506040513d6040811015611e7c57600080fd5b50602001519050611d42612710610edd61270f611d36866111ee670de0b6b3a7640000858b8a63ffffffff612bd916565b600080611eb8610bf1565b9050611ed6670de0b6b3a7640000610edd858463ffffffff612bd916565b9392505050565b6005546001600160a01b03163314611f2a576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b03163314611f97576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600355565b6000611fa6611dc3565b90506000611fb382611ead565b90506115ed816128ca565b60408051631ea6374160e01b815273c00e94cb662c3520282e6f5717214004a7f268886004820152733d9819210a31b4961b30ef54be2aed79b9c9cd3b60248201523060448201529051600091829173d513d22422a3062bd342ae374b4b9c20e0a9a07491631ea6374191606480830192608092919082900301818787803b15801561204957600080fd5b505af115801561205d573d6000803e3d6000fd5b505050506040513d608081101561207357600080fd5b506060015191505090565b6009546001600160a01b031681565b6008546001600160a01b031633146120d8576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b1580156118c457600080fd5b6006546000906001600160a01b03163314612199576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b6121a282612c32565b5060048054604080516370a0823160e01b81523093810193909352516001600160a01b03909116916370a08231916024808301926020929190829003018186803b1580156121ef57600080fd5b505afa158015612203573d6000803e3d6000fd5b505050506040513d602081101561221957600080fd5b50516006546004805460408051636535246160e11b81526001600160a01b03928316938101939093525193945060009392169163ca6a48c291602480820192602092909190829003018186803b15801561227257600080fd5b505afa158015612286573d6000803e3d6000fd5b505050506040513d602081101561229c57600080fd5b505190506001600160a01b0381166122e4576040805162461bcd60e51b8152602060048083019190915260248201526310b530b960e11b604482015290519081900360640190fd5b600454612301906001600160a01b0316828463ffffffff612f4016565b50919050565b6008546001600160a01b03163314612352576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600155565b6005546001600160a01b031633146123a4576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020613a2d83398151915281565b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b15801561242757600080fd5b505afa15801561243b573d6000803e3d6000fd5b505050506040513d602081101561245157600080fd5b50519050801561256f57600454612487906001600160a01b0316600080516020613a2d833981519152600063ffffffff61351916565b6004546124b2906001600160a01b0316600080516020613a2d8339815191528363ffffffff61351916565b600080516020613a2d8339815191526001600160a01b031663a0712d68826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561250657600080fd5b505af115801561251a573d6000803e3d6000fd5b505050506040513d602081101561253057600080fd5b50511561256f576040805162461bcd60e51b81526020600482015260086024820152670859195c1bdcda5d60c21b604482015290519081900360640190fd5b50565b6008546001600160a01b031681565b336000908152600e602052604090205460ff168061259e57503330145b806125b357506007546001600160a01b031633145b806125c857506005546001600160a01b031633145b612604576040805162461bcd60e51b8152602060048201526008602482015267216b65657065727360c01b604482015290519081900360640190fd5b600061260e611dc3565b9050600061261a6117f4565b905081831015801561262c5750808311155b61266b576040805162461bcd60e51b815260206004820152600b60248201526a2164656c6576657261676560a81b604482015290519081900360640190fd5b6000612675611361565b90506000612681611c57565b90505b84612695848363ffffffff612b9716565b10156126ae576126ab838663ffffffff612b9716565b90505b600080516020613a2d8339815191526001600160a01b031663852a12e3826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561270257600080fd5b505af1158015612716573d6000803e3d6000fd5b505050506040513d602081101561272c57600080fd5b50511561276a576040805162461bcd60e51b81526020600482015260076024820152662172656465656d60c81b604482015290519081900360640190fd5b61279e736b175474e89094c44da98b954eedeac495271d0f600080516020613a2d833981519152600063ffffffff61351916565b6127d1736b175474e89094c44da98b954eedeac495271d0f600080516020613a2d8339815191528363ffffffff61351916565b600080516020613a2d8339815191526001600160a01b0316630e752702826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561282557600080fd5b505af1158015612839573d6000803e3d6000fd5b505050506040513d602081101561284f57600080fd5b50511561288c576040805162461bcd60e51b815260206004820152600660248201526521726570617960d01b604482015290519081900360640190fd5b61289c838263ffffffff612b9716565b92506128ba82610edd83670de0b6b3a764000063ffffffff612bd916565b9050848311612684575050505050565b336000908152600e602052604090205460ff16806128e757503330145b806128fc57506007546001600160a01b031633145b8061291157506005546001600160a01b031633145b61294d576040805162461bcd60e51b8152602060048201526008602482015267216b65657065727360c01b604482015290519081900360640190fd5b6000612957610bf1565b90506000612963611dc3565b9050808310158015612990575061298c670de0b6b3a7640000610edd838563ffffffff612bd916565b8311155b6129cd576040805162461bcd60e51b8152602060048201526009602482015268216c6576657261676560b81b604482015290519081900360640190fd5b6000806129d86117f4565b90505b84811015611213576129eb611dda565b9150846129fe828463ffffffff612ee616565b1115612a1757612a14858263ffffffff612b9716565b91505b600080516020613a2d8339815191526001600160a01b031663c5ebeaec836040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015612a6b57600080fd5b505af1158015612a7f573d6000803e3d6000fd5b505050506040513d6020811015612a9557600080fd5b50612aa090506123d8565b612ab0818363ffffffff612ee616565b90506129db565b736b175474e89094c44da98b954eedeac495271d0f81565b6000612ad9611dc3565b905061256f81612581565b6006546001600160a01b031681565b600080612afe610ea8565b90506000612b0a611916565b905080821115612b43576000612b1e611dc3565b90506000612b2b82611ead565b9050612b3681612581565b6001945050505050610c2f565b60009250505090565b6000612b8e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061362c565b90505b92915050565b6000612b8e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506136ce565b600082612be857506000612b91565b82820282848281612bf557fe5b0414612b8e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613a4d6021913960400191505060405180910390fd5b600080612c3d6120fa565b905082811015612edf576000612c59848363ffffffff612b9716565b905080600080516020613a2d8339815191526001600160a01b0316633b1d21a26040518163ffffffff1660e01b815260040160206040518083038186803b158015612ca357600080fd5b505afa158015612cb7573d6000803e3d6000fd5b505050506040513d6020811015612ccd57600080fd5b50511015612d14576040805162461bcd60e51b815260206004820152600f60248201526e21636173682d6c697175696469747960881b604482015290519081900360640190fd5b6000612d1e6119fd565b90506000612d2a6117f4565b90506000612d366117b0565b90506000612d56670de0b6b3a7640000610edd878563ffffffff612bd916565b905083811115612db857306001600160a01b031663f53f13506040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612d9b57600080fd5b505af1158015612daf573d6000803e3d6000fd5b50505050612e1d565b3063eb514af9612dce858463ffffffff612b9716565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612e0457600080fd5b505af1158015612e18573d6000803e3d6000fd5b505050505b600080516020613a2d8339815191526001600160a01b031663852a12e3866040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015612e7157600080fd5b505af1158015612e85573d6000803e3d6000fd5b505050506040513d6020811015612e9b57600080fd5b505115612ed9576040805162461bcd60e51b81526020600482015260076024820152662172656465656d60c81b604482015290519081900360640190fd5b50505050505b5090919050565b600082820183811015612b8e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612f92908490613728565b505050565b6001600160a01b038216612faa57600080fd5b600954612fcb906001600160a01b038581169116600063ffffffff61351916565b600954612feb906001600160a01b0385811691168363ffffffff61351916565b60606001600160a01b03841673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2148061303457506001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b156130ba576040805160028082526060820183529091602083019080368337019050509050838160008151811061306757fe5b60200260200101906001600160a01b031690816001600160a01b031681525050828160018151811061309557fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061317a565b60408051600380825260808201909252906020820160608036833701905050905083816000815181106130e957fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28160018151811061312b57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050828160028151811061315957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b6009546001600160a01b03166338ed173983600084306131a142603c63ffffffff612ee616565b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03166001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561321a578181015183820152602001613202565b505050509050019650505050505050600060405180830381600087803b15801561324357600080fd5b505af1158015613257573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561328057600080fd5b81019080805160405193929190846401000000008211156132a057600080fd5b9083019060208201858111156132b557600080fd5b82518660208202830111640100000000821117156132d257600080fd5b82525081516020918201928201910280838360005b838110156132ff5781810151838201526020016132e7565b505050509050016040525050505050505050565b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b15801561336257600080fd5b505afa158015613376573d6000803e3d6000fd5b505050506040513d602081101561338c57600080fd5b50519050801561256f57600654604080516361d027b360e01b81529051613424926001600160a01b0316916361d027b3916004808301926020929190829003018186803b1580156133dc57600080fd5b505afa1580156133f0573d6000803e3d6000fd5b505050506040513d602081101561340657600080fd5b50516000546111fa9061271090610edd90869063ffffffff612bd916565b60065460408051638d8f1e6760e01b815290516134b2926001600160a01b031691638d8f1e67916004808301926020929190829003018186803b15801561346a57600080fd5b505afa15801561347e573d6000803e3d6000fd5b505050506040513d602081101561349457600080fd5b50516001546111fa9061271090610edd90869063ffffffff612bd916565b61256f6123d8565b60008060006134c7613a19565b6134d186866137d9565b909250905060008260038111156134e457fe5b146134f55750915060009050613507565b600061350082613841565b9350935050505b9250929050565b61256f610fce610c62565b80158061359f575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561357157600080fd5b505afa158015613585573d6000803e3d6000fd5b505050506040513d602081101561359b57600080fd5b5051155b6135da5760405162461bcd60e51b8152600401808060200182810382526036815260200180613a986036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612f92908490613728565b600081836136b85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561367d578181015183820152602001613665565b50505050905090810190601f1680156136aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816136c457fe5b0495945050505050565b600081848411156137205760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561367d578181015183820152602001613665565b505050900390565b606061377d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166138509092919063ffffffff16565b805190915015612f925780806020019051602081101561379c57600080fd5b5051612f925760405162461bcd60e51b815260040180806020018281038252602a815260200180613a6e602a913960400191505060405180910390fd5b60006137e3613a19565b6000806137f4866000015186613867565b9092509050600082600381111561380757fe5b1461382657506040805160208101909152600081529092509050613507565b60408051602081019091529081526000969095509350505050565b51670de0b6b3a7640000900490565b606061385f84846000856138a6565b949350505050565b6000808361387a57506000905080613507565b8383028385828161388757fe5b041461389b57506002915060009050613507565b600092509050613507565b60606138b185613a13565b613902576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106139415780518252601f199092019160209182019101613922565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146139a3576040519150601f19603f3d011682016040523d82523d6000602084013e6139a8565b606091505b509150915081156139bc57915061385f9050565b8051156139cc5780518082602001fd5b60405162461bcd60e51b815260206004820181815286516024840152865187939192839260440191908501908083836000831561367d578181015183820152602001613665565b3b151590565b604051806020016040528060008152509056fe0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e3643536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a264697066735822122007be67e61612449fab421eb06f13b56787d8422128196decdf5ebbed4ebbd88d64736f6c634300060700330000000000000000000000009d074e37d408542fd38be78848e8814afb38db17000000000000000000000000907d9b32654b8d43e8737e0291ad9bfcce01dad60000000000000000000000006847259b2b3a4c17e7c43c54409810af48ba5210000000000000000000000000d92c7faa0ca0e6ae4918f3a83d9832d9caeaa0d3

Deployed Bytecode

0x6080604052600436106103c35760003560e01c80637396a626116101f2578063b9e374891161010d578063d33219b4116100a0578063f53f13501161006f578063f53f135014610b9e578063f77c479114610bb3578063fe1f8f7a1461072d578063fff6cae914610bc8576103c3565b8063d33219b414610b20578063eb514af914610b35578063f4aa3a8d14610b5f578063f4b9fa7514610b89576103c3565b8063c65e3242116100dc578063c65e324214610a99578063c7b9d53014610ac3578063cec2064014610af6578063d0e30db014610b0b576103c3565b8063b9e3748914610a12578063bdacb30314610a27578063c1a3d44c14610a5a578063c6223e2614610a6f576103c3565b806392eefe9b11610185578063ab033ea911610154578063ab033ea91461098b578063ab73e433146109be578063ac41ceb3146109e8578063b01db4ec146109fd576103c3565b806392eefe9b146109045780639c4b8163146109375780639eb52f611461094c578063a1e003e414610961576103c3565b8063853828b6116101c1578063853828b6146108b0578063875cb38c146108c557806388993f22146108da5780638ccdbb70146108ef576103c3565b80637396a6261461084757806377da835a1461085c5780638081e1cf146108715780638237859414610886576103c3565b80633fc8cef3116102e257806359739ec4116102755780635c208490116102445780635c208490146107f35780635eefb092146108085780635fe3b5671461081d578063722713f714610832576103c3565b806359739ec41461078a57806359bca6791461079f5780635aa6e675146107c95780635bfb92ce146107de576103c3565b8063479119be116102b1578063479119be1461072d5780634fe809cc1461062857806351cff8d91461074257806351f3d0b814610775576103c3565b80633fc8cef3146106bb5780634032b72b146106d0578063463289ed146107035780634641257d14610718576103c3565b80631f1fcd511161035a5780632a99417d116103295780632a99417d1461063d5780632e1a7d4d14610652578063302ab80d1461067c5780633c5dae94146106a6576103c3565b80631f1fcd51146105d45780631fe4a686146105e9578063249fb9b4146105fe57806326e886c614610628576103c3565b806314ae9f2e1161039657806314ae9f2e1461044a57806315ac03fd1461047f57806317d7de7c146104945780631cff79cd1461051e576103c3565b80630ea8b3bf146103c8578063109d0af8146103ef578063112666b7146104205780631158808614610435575b600080fd5b3480156103d457600080fd5b506103dd610bf1565b60408051918252519081900360200190f35b3480156103fb57600080fd5b50610404610c32565b604080516001600160a01b039092168252519081900360200190f35b34801561042c57600080fd5b50610404610c4a565b34801561044157600080fd5b506103dd610c62565b34801561045657600080fd5b5061047d6004803603602081101561046d57600080fd5b50356001600160a01b0316610c8b565b005b34801561048b57600080fd5b50610404610d0e565b3480156104a057600080fd5b506104a9610d26565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104e35781810151838201526020016104cb565b50505050905090810190601f1680156105105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104a96004803603604081101561053457600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561055f57600080fd5b82018360208201111561057157600080fd5b8035906020019184600183028401116401000000008311171561059357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610d51945050505050565b3480156105e057600080fd5b50610404610e34565b3480156105f557600080fd5b50610404610e43565b34801561060a57600080fd5b5061047d6004803603602081101561062157600080fd5b5035610e52565b34801561063457600080fd5b506103dd610ea2565b34801561064957600080fd5b506103dd610ea8565b34801561065e57600080fd5b5061047d6004803603602081101561067557600080fd5b5035610ee9565b34801561068857600080fd5b5061047d6004803603602081101561069f57600080fd5b503561121a565b3480156106b257600080fd5b506103dd611281565b3480156106c757600080fd5b506104046112c3565b3480156106dc57600080fd5b5061047d600480360360208110156106f357600080fd5b50356001600160a01b03166112db565b34801561070f57600080fd5b506103dd611361565b34801561072457600080fd5b5061047d6113f8565b34801561073957600080fd5b506103dd6115f1565b34801561074e57600080fd5b506103dd6004803603602081101561076557600080fd5b50356001600160a01b03166115f8565b34801561078157600080fd5b506103dd61172e565b34801561079657600080fd5b506103dd611734565b3480156107ab57600080fd5b5061047d600480360360208110156107c257600080fd5b503561173a565b3480156107d557600080fd5b506104046117a1565b3480156107ea57600080fd5b506103dd6117b0565b3480156107ff57600080fd5b506103dd6117f4565b34801561081457600080fd5b506103dd611875565b34801561082957600080fd5b506104046118d8565b34801561083e57600080fd5b506103dd6118f0565b34801561085357600080fd5b506103dd611916565b34801561086857600080fd5b506103dd61194b565b34801561087d57600080fd5b506103dd6119fd565b34801561089257600080fd5b5061047d600480360360208110156108a957600080fd5b5035611a4d565b3480156108bc57600080fd5b506103dd611a9d565b3480156108d157600080fd5b506103dd611c57565b3480156108e657600080fd5b506103dd611d4a565b3480156108fb57600080fd5b506103dd611d50565b34801561091057600080fd5b5061047d6004803603602081101561092757600080fd5b50356001600160a01b0316611d56565b34801561094357600080fd5b506103dd611dc3565b34801561095857600080fd5b506103dd611dda565b34801561096d57600080fd5b506103dd6004803603602081101561098457600080fd5b5035611ead565b34801561099757600080fd5b5061047d600480360360208110156109ae57600080fd5b50356001600160a01b0316611edd565b3480156109ca57600080fd5b5061047d600480360360208110156109e157600080fd5b5035611f4c565b3480156109f457600080fd5b5061047d611f9c565b348015610a0957600080fd5b506103dd611fbe565b348015610a1e57600080fd5b5061040461207e565b348015610a3357600080fd5b5061047d60048036036020811015610a4a57600080fd5b50356001600160a01b031661208d565b348015610a6657600080fd5b506103dd6120fa565b348015610a7b57600080fd5b506103dd60048036036020811015610a9257600080fd5b5035612149565b348015610aa557600080fd5b5061047d60048036036020811015610abc57600080fd5b5035612307565b348015610acf57600080fd5b5061047d60048036036020811015610ae657600080fd5b50356001600160a01b0316612357565b348015610b0257600080fd5b506104046123c6565b348015610b1757600080fd5b5061047d6123d8565b348015610b2c57600080fd5b50610404612572565b348015610b4157600080fd5b5061047d60048036036020811015610b5857600080fd5b5035612581565b348015610b6b57600080fd5b5061047d60048036036020811015610b8257600080fd5b50356128ca565b348015610b9557600080fd5b50610404612ab7565b348015610baa57600080fd5b5061047d612acf565b348015610bbf57600080fd5b50610404612ae4565b348015610bd457600080fd5b50610bdd612af3565b604080519115158252519081900360200190f35b600080610bfc611281565b90506000610c2a6ec097ce7bc90715b34b9f1000000000670de0b6b3a764000084900363ffffffff612b4c16565b925050505b90565b73c00e94cb662c3520282e6f5717214004a7f2688881565b73d513d22422a3062bd342ae374b4b9c20e0a9a07481565b600080610c6d61194b565b90506000610c79611875565b9050610c2a828263ffffffff612b9716565b6005546001600160a01b0316331480610cae57506007546001600160a01b031633145b610ced576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600e60205260409020805460ff19169055565b734ddc2d193948926d02f9b1fe9e1daa0718270ed581565b6040805180820190915260118152705374726174656779436d7064446169563360781b602082015290565b6008546060906001600160a01b03163314610d9f576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b6001600160a01b038316610de4576040805162461bcd60e51b8152602060048201526007602482015266085d185c99d95d60ca1b604482015290519081900360640190fd5b600080835160208501866113885a03f43d6040519250601f19601f6020830101168301604052808352806000602085013e811560018114610e2457610e2b565b8160208501fd5b50505092915050565b6004546001600160a01b031681565b6007546001600160a01b031681565b6008546001600160a01b03163314610e9d576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600055565b61271081565b600080610eb36117f4565b90506000610ebf6119fd565b9050610c2a82610edd83670de0b6b3a764000063ffffffff612bd916565b9063ffffffff612b4c16565b6006546001600160a01b03163314610f36576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b158015610f8557600080fd5b505afa158015610f99573d6000803e3d6000fd5b505050506040513d6020811015610faf57600080fd5b5051905081811015610fe857610fd3610fce838363ffffffff612b9716565b612c32565b9150610fe5828263ffffffff612ee616565b91505b6000611006620186a0610edd60035486612bd990919063ffffffff16565b905061109e600660009054906101000a90046001600160a01b03166001600160a01b0316638d8f1e676040518163ffffffff1660e01b815260040160206040518083038186803b15801561105957600080fd5b505afa15801561106d573d6000803e3d6000fd5b505050506040513d602081101561108357600080fd5b50516004546001600160a01b0316908363ffffffff612f4016565b60006110bc620186a0610edd60025487612bd990919063ffffffff16565b905061110f600660009054906101000a90046001600160a01b03166001600160a01b03166361d027b36040518163ffffffff1660e01b815260040160206040518083038186803b15801561105957600080fd5b6006546004805460408051636535246160e11b81526001600160a01b039283169381019390935251600093919091169163ca6a48c2916024808301926020929190829003018186803b15801561116457600080fd5b505afa158015611178573d6000803e3d6000fd5b505050506040513d602081101561118e57600080fd5b505190506001600160a01b0381166111d6576040805162461bcd60e51b8152602060048083019190915260248201526310b530b960e11b604482015290519081900360640190fd5b611213816111fa846111ee898863ffffffff612b9716565b9063ffffffff612b9716565b6004546001600160a01b0316919063ffffffff612f4016565b5050505050565b6005546001600160a01b031633148061123d57506007546001600160a01b031633145b61127c576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600a55565b60008061128c611361565b90506000610c2a6112b6600b54610edd670de0b6b3a7640000600a54612bd990919063ffffffff16565b839063ffffffff612b9716565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6005546001600160a01b03163314806112fe57506007546001600160a01b031633145b61133d576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600e60205260409020805460ff19166001179055565b60408051638e8f294b60e01b8152600080516020613a2d833981519152600482015281516000928392733d9819210a31b4961b30ef54be2aed79b9c9cd3b92638e8f294b92602480840193919291829003018186803b1580156113c357600080fd5b505afa1580156113d7573d6000803e3d6000fd5b505050506040513d60408110156113ed57600080fd5b506020015191505090565b3332148061141057506005546001600160a01b031633145b8061142557506007546001600160a01b031633145b61142e57600080fd5b60408051600180825281830190925260609160208083019080368337019050509050600080516020613a2d8339815191528160008151811061146c57fe5b6001600160a01b039092166020928302919091018201526040805162e1ed9760e51b8152306004820181815260248301938452855160448401528551733d9819210a31b4961b30ef54be2aed79b9c9cd3b95631c3db2e0959394889492606490910191858101910280838360005b838110156114f25781810151838201526020016114da565b505050509050019350505050600060405180830381600087803b15801561151857600080fd5b505af115801561152c573d6000803e3d6000fd5b5050604080516370a0823160e01b815230600482015290516000935073c00e94cb662c3520282e6f5717214004a7f2688892506370a0823191602480820192602092909190829003018186803b15801561158557600080fd5b505afa158015611599573d6000803e3d6000fd5b505050506040513d60208110156115af57600080fd5b5051905080156115e5576004546115e59073c00e94cb662c3520282e6f5717214004a7f26888906001600160a01b031683612f97565b6115ed613313565b5050565b620186a081565b6006546000906001600160a01b03163314611648576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b6004546001600160a01b0383811691161415611694576040805162461bcd60e51b815260206004808301919091526024820152631dd85b9d60e21b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156116da57600080fd5b505afa1580156116ee573d6000803e3d6000fd5b505050506040513d602081101561170457600080fd5b5051600654909150611729906001600160a01b0384811691168363ffffffff612f4016565b919050565b60035481565b60005481565b6005546001600160a01b031633148061175d57506007546001600160a01b031633145b61179c576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600c55565b6005546001600160a01b031681565b6000806117bb6117f4565b905060006117c76119fd565b9050610c2a6117dc838363ffffffff612b9716565b610edd84670de0b6b3a764000063ffffffff612bd916565b60408051633af9e66960e01b81523060048201529051600091600080516020613a2d83398151915291633af9e6699160248082019260209290919082900301818787803b15801561184457600080fd5b505af1158015611858573d6000803e3d6000fd5b505050506040513d602081101561186e57600080fd5b5051905090565b604080516395dd919360e01b81523060048201529051600091600080516020613a2d833981519152916395dd919391602480820192602092909190829003018186803b1580156118c457600080fd5b505afa158015611858573d6000803e3d6000fd5b733d9819210a31b4961b30ef54be2aed79b9c9cd3b81565b60006119116118fd610c62565b6119056120fa565b9063ffffffff612ee616565b905090565b600080611921611361565b90506000610c2a6112b6600d54610edd670de0b6b3a7640000600c54612bd990919063ffffffff16565b604080516361bfb47160e11b8152306004820152905160009182918291600080516020613a2d8339815191529163c37f68e291602480820192608092909190829003018186803b15801561199e57600080fd5b505afa1580156119b2573d6000803e3d6000fd5b505050506040513d60808110156119c857600080fd5b506020808201516060909201516040805192830190528082529193509091506000906119f490846134ba565b94505050505090565b604080516305eff7ef60e21b81523060048201529051600091600080516020613a2d833981519152916317bfdfbc9160248082019260209290919082900301818787803b15801561184457600080fd5b6008546001600160a01b03163314611a98576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600255565b6006546000906001600160a01b03163314611aed576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b611af561350e565b60048054604080516370a0823160e01b81523093810193909352516001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015611b4157600080fd5b505afa158015611b55573d6000803e3d6000fd5b505050506040513d6020811015611b6b57600080fd5b50516006546004805460408051636535246160e11b81526001600160a01b03928316938101939093525193945060009392169163ca6a48c291602480820192602092909190829003018186803b158015611bc457600080fd5b505afa158015611bd8573d6000803e3d6000fd5b505050506040513d6020811015611bee57600080fd5b505190506001600160a01b038116611c36576040805162461bcd60e51b8152602060048083019190915260248201526310b530b960e11b604482015290519081900360640190fd5b600454611c53906001600160a01b0316828463ffffffff612f4016565b5090565b600080611c626117f4565b90506000611c6e6119fd565b60408051638e8f294b60e01b8152600080516020613a2d83398151915260048201528151929350600092733d9819210a31b4961b30ef54be2aed79b9c9cd3b92638e8f294b9260248082019391829003018186803b158015611ccf57600080fd5b505afa158015611ce3573d6000803e3d6000fd5b505050506040513d6040811015611cf957600080fd5b50602001519050611d42612710610edd61270f611d36611d29868489670de0b6b3a764000063ffffffff612bd916565b889063ffffffff612b9716565b9063ffffffff612bd916565b935050505090565b60015481565b60025481565b6008546001600160a01b03163314611da1576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600080611dce6117f4565b90506000610c796119fd565b600080611de56117f4565b90506000611df16119fd565b60408051638e8f294b60e01b8152600080516020613a2d83398151915260048201528151929350600092733d9819210a31b4961b30ef54be2aed79b9c9cd3b92638e8f294b9260248082019391829003018186803b158015611e5257600080fd5b505afa158015611e66573d6000803e3d6000fd5b505050506040513d6040811015611e7c57600080fd5b50602001519050611d42612710610edd61270f611d36866111ee670de0b6b3a7640000858b8a63ffffffff612bd916565b600080611eb8610bf1565b9050611ed6670de0b6b3a7640000610edd858463ffffffff612bd916565b9392505050565b6005546001600160a01b03163314611f2a576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b03163314611f97576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600355565b6000611fa6611dc3565b90506000611fb382611ead565b90506115ed816128ca565b60408051631ea6374160e01b815273c00e94cb662c3520282e6f5717214004a7f268886004820152733d9819210a31b4961b30ef54be2aed79b9c9cd3b60248201523060448201529051600091829173d513d22422a3062bd342ae374b4b9c20e0a9a07491631ea6374191606480830192608092919082900301818787803b15801561204957600080fd5b505af115801561205d573d6000803e3d6000fd5b505050506040513d608081101561207357600080fd5b506060015191505090565b6009546001600160a01b031681565b6008546001600160a01b031633146120d8576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b1580156118c457600080fd5b6006546000906001600160a01b03163314612199576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b6121a282612c32565b5060048054604080516370a0823160e01b81523093810193909352516001600160a01b03909116916370a08231916024808301926020929190829003018186803b1580156121ef57600080fd5b505afa158015612203573d6000803e3d6000fd5b505050506040513d602081101561221957600080fd5b50516006546004805460408051636535246160e11b81526001600160a01b03928316938101939093525193945060009392169163ca6a48c291602480820192602092909190829003018186803b15801561227257600080fd5b505afa158015612286573d6000803e3d6000fd5b505050506040513d602081101561229c57600080fd5b505190506001600160a01b0381166122e4576040805162461bcd60e51b8152602060048083019190915260248201526310b530b960e11b604482015290519081900360640190fd5b600454612301906001600160a01b0316828463ffffffff612f4016565b50919050565b6008546001600160a01b03163314612352576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600155565b6005546001600160a01b031633146123a4576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020613a2d83398151915281565b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b15801561242757600080fd5b505afa15801561243b573d6000803e3d6000fd5b505050506040513d602081101561245157600080fd5b50519050801561256f57600454612487906001600160a01b0316600080516020613a2d833981519152600063ffffffff61351916565b6004546124b2906001600160a01b0316600080516020613a2d8339815191528363ffffffff61351916565b600080516020613a2d8339815191526001600160a01b031663a0712d68826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561250657600080fd5b505af115801561251a573d6000803e3d6000fd5b505050506040513d602081101561253057600080fd5b50511561256f576040805162461bcd60e51b81526020600482015260086024820152670859195c1bdcda5d60c21b604482015290519081900360640190fd5b50565b6008546001600160a01b031681565b336000908152600e602052604090205460ff168061259e57503330145b806125b357506007546001600160a01b031633145b806125c857506005546001600160a01b031633145b612604576040805162461bcd60e51b8152602060048201526008602482015267216b65657065727360c01b604482015290519081900360640190fd5b600061260e611dc3565b9050600061261a6117f4565b905081831015801561262c5750808311155b61266b576040805162461bcd60e51b815260206004820152600b60248201526a2164656c6576657261676560a81b604482015290519081900360640190fd5b6000612675611361565b90506000612681611c57565b90505b84612695848363ffffffff612b9716565b10156126ae576126ab838663ffffffff612b9716565b90505b600080516020613a2d8339815191526001600160a01b031663852a12e3826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561270257600080fd5b505af1158015612716573d6000803e3d6000fd5b505050506040513d602081101561272c57600080fd5b50511561276a576040805162461bcd60e51b81526020600482015260076024820152662172656465656d60c81b604482015290519081900360640190fd5b61279e736b175474e89094c44da98b954eedeac495271d0f600080516020613a2d833981519152600063ffffffff61351916565b6127d1736b175474e89094c44da98b954eedeac495271d0f600080516020613a2d8339815191528363ffffffff61351916565b600080516020613a2d8339815191526001600160a01b0316630e752702826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561282557600080fd5b505af1158015612839573d6000803e3d6000fd5b505050506040513d602081101561284f57600080fd5b50511561288c576040805162461bcd60e51b815260206004820152600660248201526521726570617960d01b604482015290519081900360640190fd5b61289c838263ffffffff612b9716565b92506128ba82610edd83670de0b6b3a764000063ffffffff612bd916565b9050848311612684575050505050565b336000908152600e602052604090205460ff16806128e757503330145b806128fc57506007546001600160a01b031633145b8061291157506005546001600160a01b031633145b61294d576040805162461bcd60e51b8152602060048201526008602482015267216b65657065727360c01b604482015290519081900360640190fd5b6000612957610bf1565b90506000612963611dc3565b9050808310158015612990575061298c670de0b6b3a7640000610edd838563ffffffff612bd916565b8311155b6129cd576040805162461bcd60e51b8152602060048201526009602482015268216c6576657261676560b81b604482015290519081900360640190fd5b6000806129d86117f4565b90505b84811015611213576129eb611dda565b9150846129fe828463ffffffff612ee616565b1115612a1757612a14858263ffffffff612b9716565b91505b600080516020613a2d8339815191526001600160a01b031663c5ebeaec836040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015612a6b57600080fd5b505af1158015612a7f573d6000803e3d6000fd5b505050506040513d6020811015612a9557600080fd5b50612aa090506123d8565b612ab0818363ffffffff612ee616565b90506129db565b736b175474e89094c44da98b954eedeac495271d0f81565b6000612ad9611dc3565b905061256f81612581565b6006546001600160a01b031681565b600080612afe610ea8565b90506000612b0a611916565b905080821115612b43576000612b1e611dc3565b90506000612b2b82611ead565b9050612b3681612581565b6001945050505050610c2f565b60009250505090565b6000612b8e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061362c565b90505b92915050565b6000612b8e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506136ce565b600082612be857506000612b91565b82820282848281612bf557fe5b0414612b8e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613a4d6021913960400191505060405180910390fd5b600080612c3d6120fa565b905082811015612edf576000612c59848363ffffffff612b9716565b905080600080516020613a2d8339815191526001600160a01b0316633b1d21a26040518163ffffffff1660e01b815260040160206040518083038186803b158015612ca357600080fd5b505afa158015612cb7573d6000803e3d6000fd5b505050506040513d6020811015612ccd57600080fd5b50511015612d14576040805162461bcd60e51b815260206004820152600f60248201526e21636173682d6c697175696469747960881b604482015290519081900360640190fd5b6000612d1e6119fd565b90506000612d2a6117f4565b90506000612d366117b0565b90506000612d56670de0b6b3a7640000610edd878563ffffffff612bd916565b905083811115612db857306001600160a01b031663f53f13506040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612d9b57600080fd5b505af1158015612daf573d6000803e3d6000fd5b50505050612e1d565b3063eb514af9612dce858463ffffffff612b9716565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612e0457600080fd5b505af1158015612e18573d6000803e3d6000fd5b505050505b600080516020613a2d8339815191526001600160a01b031663852a12e3866040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015612e7157600080fd5b505af1158015612e85573d6000803e3d6000fd5b505050506040513d6020811015612e9b57600080fd5b505115612ed9576040805162461bcd60e51b81526020600482015260076024820152662172656465656d60c81b604482015290519081900360640190fd5b50505050505b5090919050565b600082820183811015612b8e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612f92908490613728565b505050565b6001600160a01b038216612faa57600080fd5b600954612fcb906001600160a01b038581169116600063ffffffff61351916565b600954612feb906001600160a01b0385811691168363ffffffff61351916565b60606001600160a01b03841673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2148061303457506001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b156130ba576040805160028082526060820183529091602083019080368337019050509050838160008151811061306757fe5b60200260200101906001600160a01b031690816001600160a01b031681525050828160018151811061309557fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061317a565b60408051600380825260808201909252906020820160608036833701905050905083816000815181106130e957fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28160018151811061312b57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050828160028151811061315957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b6009546001600160a01b03166338ed173983600084306131a142603c63ffffffff612ee616565b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03166001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561321a578181015183820152602001613202565b505050509050019650505050505050600060405180830381600087803b15801561324357600080fd5b505af1158015613257573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561328057600080fd5b81019080805160405193929190846401000000008211156132a057600080fd5b9083019060208201858111156132b557600080fd5b82518660208202830111640100000000821117156132d257600080fd5b82525081516020918201928201910280838360005b838110156132ff5781810151838201526020016132e7565b505050509050016040525050505050505050565b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b15801561336257600080fd5b505afa158015613376573d6000803e3d6000fd5b505050506040513d602081101561338c57600080fd5b50519050801561256f57600654604080516361d027b360e01b81529051613424926001600160a01b0316916361d027b3916004808301926020929190829003018186803b1580156133dc57600080fd5b505afa1580156133f0573d6000803e3d6000fd5b505050506040513d602081101561340657600080fd5b50516000546111fa9061271090610edd90869063ffffffff612bd916565b60065460408051638d8f1e6760e01b815290516134b2926001600160a01b031691638d8f1e67916004808301926020929190829003018186803b15801561346a57600080fd5b505afa15801561347e573d6000803e3d6000fd5b505050506040513d602081101561349457600080fd5b50516001546111fa9061271090610edd90869063ffffffff612bd916565b61256f6123d8565b60008060006134c7613a19565b6134d186866137d9565b909250905060008260038111156134e457fe5b146134f55750915060009050613507565b600061350082613841565b9350935050505b9250929050565b61256f610fce610c62565b80158061359f575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561357157600080fd5b505afa158015613585573d6000803e3d6000fd5b505050506040513d602081101561359b57600080fd5b5051155b6135da5760405162461bcd60e51b8152600401808060200182810382526036815260200180613a986036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052612f92908490613728565b600081836136b85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561367d578181015183820152602001613665565b50505050905090810190601f1680156136aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816136c457fe5b0495945050505050565b600081848411156137205760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561367d578181015183820152602001613665565b505050900390565b606061377d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166138509092919063ffffffff16565b805190915015612f925780806020019051602081101561379c57600080fd5b5051612f925760405162461bcd60e51b815260040180806020018281038252602a815260200180613a6e602a913960400191505060405180910390fd5b60006137e3613a19565b6000806137f4866000015186613867565b9092509050600082600381111561380757fe5b1461382657506040805160208101909152600081529092509050613507565b60408051602081019091529081526000969095509350505050565b51670de0b6b3a7640000900490565b606061385f84846000856138a6565b949350505050565b6000808361387a57506000905080613507565b8383028385828161388757fe5b041461389b57506002915060009050613507565b600092509050613507565b60606138b185613a13565b613902576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106139415780518252601f199092019160209182019101613922565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146139a3576040519150601f19603f3d011682016040523d82523d6000602084013e6139a8565b606091505b509150915081156139bc57915061385f9050565b8051156139cc5780518082602001fd5b60405162461bcd60e51b815260206004820181815286516024840152865187939192839260440191908501908083836000831561367d578181015183820152602001613665565b3b151590565b604051806020016040528060008152509056fe0000000000000000000000005d3a536e4d6dbd6114cc1ead35777bab948e3643536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a264697066735822122007be67e61612449fab421eb06f13b56787d8422128196decdf5ebbed4ebbd88d64736f6c63430006070033

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

0000000000000000000000009d074e37d408542fd38be78848e8814afb38db17000000000000000000000000907d9b32654b8d43e8737e0291ad9bfcce01dad60000000000000000000000006847259b2b3a4c17e7c43c54409810af48ba5210000000000000000000000000d92c7faa0ca0e6ae4918f3a83d9832d9caeaa0d3

-----Decoded View---------------
Arg [0] : _governance (address): 0x9d074E37d408542FD38be78848e8814AFB38db17
Arg [1] : _strategist (address): 0x907D9B32654B8D43e8737E0291Ad9bfcce01DAD6
Arg [2] : _controller (address): 0x6847259b2B3A4c17e7c43C54409810aF48bA5210
Arg [3] : _timelock (address): 0xD92c7fAa0Ca0e6AE4918f3a83d9832d9CAEAA0d3

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000009d074e37d408542fd38be78848e8814afb38db17
Arg [1] : 000000000000000000000000907d9b32654b8d43e8737e0291ad9bfcce01dad6
Arg [2] : 0000000000000000000000006847259b2b3a4c17e7c43c54409810af48ba5210
Arg [3] : 000000000000000000000000d92c7faa0ca0e6ae4918f3a83d9832d9caeaa0d3


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.