ETH Price: $2,419.59 (+0.20%)

Contract

0xD7B0610dB501b15Bfb9B7DDad8b3869de262a327
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Add Derivatives141465312022-02-05 14:27:46973 days ago1644071266IN
Enzyme Finance: Value Interpreter 2
0 ETH0.1206011144.1963701
Remove Primitive...141461592022-02-05 12:59:54973 days ago1644065994IN
Enzyme Finance: Value Interpreter 2
0 ETH0.0019159458.01323862
Add Primitives141460292022-02-05 12:33:10973 days ago1644064390IN
Enzyme Finance: Value Interpreter 2
0 ETH0.1500777970.34670231
Add Primitives141459192022-02-05 12:06:37973 days ago1644062797IN
Enzyme Finance: Value Interpreter 2
0 ETH0.3939015253.42253142
Add Primitives141459092022-02-05 12:04:54973 days ago1644062694IN
Enzyme Finance: Value Interpreter 2
0 ETH0.010654753.29032676
Set Eth Usd Aggr...141328842022-02-03 12:00:14975 days ago1643889614IN
Enzyme Finance: Value Interpreter 2
0 ETH0.0054948476.91662128
0x60e06040141328832022-02-03 11:59:46975 days ago1643889586IN
 Create: ValueInterpreter
0 ETH0.1654231368.55141674

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ValueInterpreter

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 13 : ValueInterpreter.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../utils/FundDeployerOwnerMixin.sol";
import "../../utils/MathHelpers.sol";
import "../price-feeds/derivatives/AggregatedDerivativePriceFeedMixin.sol";
import "../price-feeds/derivatives/IDerivativePriceFeed.sol";
import "../price-feeds/primitives/ChainlinkPriceFeedMixin.sol";
import "./IValueInterpreter.sol";

/// @title ValueInterpreter Contract
/// @author Enzyme Council <[email protected]>
/// @notice Interprets price feeds to provide covert value between asset pairs
contract ValueInterpreter is
    IValueInterpreter,
    FundDeployerOwnerMixin,
    AggregatedDerivativePriceFeedMixin,
    ChainlinkPriceFeedMixin,
    MathHelpers
{
    using SafeMath for uint256;

    // Used to only tolerate a max rounding discrepancy of 0.01%
    // when converting values via an inverse rate
    uint256 private constant MIN_INVERSE_RATE_AMOUNT = 10000;

    constructor(
        address _fundDeployer,
        address _wethToken,
        uint256 _chainlinkStaleRateThreshold
    )
        public
        FundDeployerOwnerMixin(_fundDeployer)
        ChainlinkPriceFeedMixin(_wethToken, _chainlinkStaleRateThreshold)
    {}

    // EXTERNAL FUNCTIONS

    /// @notice Calculates the total value of given amounts of assets in a single quote asset
    /// @param _baseAssets The assets to convert
    /// @param _amounts The amounts of the _baseAssets to convert
    /// @param _quoteAsset The asset to which to convert
    /// @return value_ The sum value of _baseAssets, denominated in the _quoteAsset
    /// @dev Does not alter protocol state,
    /// but not a view because calls to price feeds can potentially update third party state.
    /// Does not handle a derivative quote asset.
    function calcCanonicalAssetsTotalValue(
        address[] memory _baseAssets,
        uint256[] memory _amounts,
        address _quoteAsset
    ) external override returns (uint256 value_) {
        require(
            _baseAssets.length == _amounts.length,
            "calcCanonicalAssetsTotalValue: Arrays unequal lengths"
        );
        require(
            isSupportedPrimitiveAsset(_quoteAsset),
            "calcCanonicalAssetsTotalValue: Unsupported _quoteAsset"
        );

        for (uint256 i; i < _baseAssets.length; i++) {
            uint256 assetValue = __calcAssetValue(_baseAssets[i], _amounts[i], _quoteAsset);
            value_ = value_.add(assetValue);
        }

        return value_;
    }

    // PUBLIC FUNCTIONS

    /// @notice Calculates the value of a given amount of one asset in terms of another asset
    /// @param _baseAsset The asset from which to convert
    /// @param _amount The amount of the _baseAsset to convert
    /// @param _quoteAsset The asset to which to convert
    /// @return value_ The equivalent quantity in the _quoteAsset
    /// @dev Does not alter protocol state,
    /// but not a view because calls to price feeds can potentially update third party state.
    /// See also __calcPrimitiveToDerivativeValue() for important notes regarding a derivative _quoteAsset.
    function calcCanonicalAssetValue(
        address _baseAsset,
        uint256 _amount,
        address _quoteAsset
    ) external override returns (uint256 value_) {
        if (_baseAsset == _quoteAsset || _amount == 0) {
            return _amount;
        }

        if (isSupportedPrimitiveAsset(_quoteAsset)) {
            return __calcAssetValue(_baseAsset, _amount, _quoteAsset);
        } else if (
            isSupportedDerivativeAsset(_quoteAsset) && isSupportedPrimitiveAsset(_baseAsset)
        ) {
            return __calcPrimitiveToDerivativeValue(_baseAsset, _amount, _quoteAsset);
        }

        revert("calcCanonicalAssetValue: Unsupported conversion");
    }

    /// @notice Checks whether an asset is a supported asset
    /// @param _asset The asset to check
    /// @return isSupported_ True if the asset is a supported asset
    function isSupportedAsset(address _asset) public view override returns (bool isSupported_) {
        return isSupportedPrimitiveAsset(_asset) || isSupportedDerivativeAsset(_asset);
    }

    // PRIVATE FUNCTIONS

    /// @dev Helper to differentially calculate an asset value
    /// based on if it is a primitive or derivative asset.
    function __calcAssetValue(
        address _baseAsset,
        uint256 _amount,
        address _quoteAsset
    ) private returns (uint256 value_) {
        if (_baseAsset == _quoteAsset || _amount == 0) {
            return _amount;
        }

        // Handle case that asset is a primitive
        if (isSupportedPrimitiveAsset(_baseAsset)) {
            return __calcCanonicalValue(_baseAsset, _amount, _quoteAsset);
        }

        // Handle case that asset is a derivative
        address derivativePriceFeed = getPriceFeedForDerivative(_baseAsset);
        if (derivativePriceFeed != address(0)) {
            return __calcDerivativeValue(derivativePriceFeed, _baseAsset, _amount, _quoteAsset);
        }

        revert("__calcAssetValue: Unsupported _baseAsset");
    }

    /// @dev Helper to calculate the value of a derivative in an arbitrary asset.
    /// Handles multiple underlying assets (e.g., Uniswap and Balancer pool tokens).
    /// Handles underlying assets that are also derivatives (e.g., a cDAI-ETH LP)
    function __calcDerivativeValue(
        address _derivativePriceFeed,
        address _derivative,
        uint256 _amount,
        address _quoteAsset
    ) private returns (uint256 value_) {
        (address[] memory underlyings, uint256[] memory underlyingAmounts) = IDerivativePriceFeed(
            _derivativePriceFeed
        )
            .calcUnderlyingValues(_derivative, _amount);

        require(underlyings.length > 0, "__calcDerivativeValue: No underlyings");
        require(
            underlyings.length == underlyingAmounts.length,
            "__calcDerivativeValue: Arrays unequal lengths"
        );

        for (uint256 i = 0; i < underlyings.length; i++) {
            uint256 underlyingValue = __calcAssetValue(
                underlyings[i],
                underlyingAmounts[i],
                _quoteAsset
            );

            value_ = value_.add(underlyingValue);
        }
    }

    /// @dev Helper to calculate the value of a primitive base asset in a derivative quote asset.
    /// Assumes that the _primitiveBaseAsset and _derivativeQuoteAsset have been validated as supported.
    /// Callers of this function should be aware of the following points, and take precautions as-needed,
    /// such as prohibiting a derivative quote asset:
    /// - The returned value will be slightly less the actual canonical value due to the conversion formula's
    /// handling of the intermediate inverse rate (see comments below).
    /// - If the assets involved have an extreme rate and/or have a low ERC20.decimals() value,
    /// the inverse rate might not be considered "sufficient", and will revert.
    function __calcPrimitiveToDerivativeValue(
        address _primitiveBaseAsset,
        uint256 _primitiveBaseAssetAmount,
        address _derivativeQuoteAsset
    ) private returns (uint256 value_) {
        uint256 derivativeUnit = 10**uint256(ERC20(_derivativeQuoteAsset).decimals());

        address derivativePriceFeed = getPriceFeedForDerivative(_derivativeQuoteAsset);
        uint256 primitiveAmountForDerivativeUnit = __calcDerivativeValue(
            derivativePriceFeed,
            _derivativeQuoteAsset,
            derivativeUnit,
            _primitiveBaseAsset
        );
        // Only tolerate a max rounding discrepancy
        require(
            primitiveAmountForDerivativeUnit > MIN_INVERSE_RATE_AMOUNT,
            "__calcPrimitiveToDerivativeValue: Insufficient rate"
        );

        // Adds `1` to primitiveAmountForDerivativeUnit so that the final return value is
        // slightly less than the actual value, which is congruent with how all other
        // asset conversions are floored in the protocol.
        return
            __calcRelativeQuantity(
                primitiveAmountForDerivativeUnit.add(1),
                derivativeUnit,
                _primitiveBaseAssetAmount
            );
    }

    ////////////////////////////
    // PRIMITIVES (CHAINLINK) //
    ////////////////////////////

    /// @notice Adds a list of primitives with the given aggregator and rateAsset values
    /// @param _primitives The primitives to add
    /// @param _aggregators The ordered aggregators corresponding to the list of _primitives
    /// @param _rateAssets The ordered rate assets corresponding to the list of _primitives
    function addPrimitives(
        address[] calldata _primitives,
        address[] calldata _aggregators,
        RateAsset[] calldata _rateAssets
    ) external onlyFundDeployerOwner {
        __addPrimitives(_primitives, _aggregators, _rateAssets);
    }

    /// @notice Removes a list of primitives from the feed
    /// @param _primitives The primitives to remove
    function removePrimitives(address[] calldata _primitives) external onlyFundDeployerOwner {
        __removePrimitives(_primitives);
    }

    /// @notice Sets the `ehUsdAggregator` variable value
    /// @param _nextEthUsdAggregator The `ehUsdAggregator` value to set
    function setEthUsdAggregator(address _nextEthUsdAggregator) external onlyFundDeployerOwner {
        __setEthUsdAggregator(_nextEthUsdAggregator);
    }

    /// @notice Updates a list of primitives with the given aggregator and rateAsset values
    /// @param _primitives The primitives to update
    /// @param _aggregators The ordered aggregators corresponding to the list of _primitives
    /// @param _rateAssets The ordered rate assets corresponding to the list of _primitives
    function updatePrimitives(
        address[] calldata _primitives,
        address[] calldata _aggregators,
        RateAsset[] calldata _rateAssets
    ) external onlyFundDeployerOwner {
        __removePrimitives(_primitives);
        __addPrimitives(_primitives, _aggregators, _rateAssets);
    }

    // PUBLIC FUNCTIONS

    /// @notice Checks whether an asset is a supported primitive
    /// @param _asset The asset to check
    /// @return isSupported_ True if the asset is a supported primitive
    function isSupportedPrimitiveAsset(address _asset)
        public
        view
        override
        returns (bool isSupported_)
    {
        return _asset == getWethToken() || getAggregatorForPrimitive(_asset) != address(0);
    }

    ////////////////////////////////////
    // DERIVATIVE PRICE FEED REGISTRY //
    ////////////////////////////////////

    /// @notice Adds a list of derivatives with the given price feed values
    /// @param _derivatives The derivatives to add
    /// @param _priceFeeds The ordered price feeds corresponding to the list of _derivatives
    function addDerivatives(address[] calldata _derivatives, address[] calldata _priceFeeds)
        external
        onlyFundDeployerOwner
    {
        __addDerivatives(_derivatives, _priceFeeds);
    }

    /// @notice Removes a list of derivatives
    /// @param _derivatives The derivatives to remove
    function removeDerivatives(address[] calldata _derivatives) external onlyFundDeployerOwner {
        __removeDerivatives(_derivatives);
    }

    /// @notice Updates a list of derivatives with the given price feed values
    /// @param _derivatives The derivatives to update
    /// @param _priceFeeds The ordered price feeds corresponding to the list of _derivatives
    function updateDerivatives(address[] calldata _derivatives, address[] calldata _priceFeeds)
        external
        onlyFundDeployerOwner
    {
        __removeDerivatives(_derivatives);
        __addDerivatives(_derivatives, _priceFeeds);
    }

    // PUBLIC FUNCTIONS

    /// @notice Checks whether an asset is a supported derivative
    /// @param _asset The asset to check
    /// @return isSupported_ True if the asset is a supported derivative
    function isSupportedDerivativeAsset(address _asset)
        public
        view
        override
        returns (bool isSupported_)
    {
        return getPriceFeedForDerivative(_asset) != address(0);
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 13 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.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;

    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 virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual 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 virtual returns (uint8) {
        return _decimals;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual 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 virtual {
        _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 { }
}

File 4 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 5 of 13 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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 6 of 13 : IFundDeployer.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;

/// @title IFundDeployer Interface
/// @author Enzyme Council <[email protected]>
interface IFundDeployer {
    function getOwner() external view returns (address);

    function hasReconfigurationRequest(address) external view returns (bool);

    function isAllowedBuySharesOnBehalfCaller(address) external view returns (bool);

    function isAllowedVaultCall(
        address,
        bytes4,
        bytes32
    ) external view returns (bool);
}

File 7 of 13 : AggregatedDerivativePriceFeedMixin.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;

import "./IDerivativePriceFeed.sol";

/// @title AggregatedDerivativePriceFeedMixin Contract
/// @author Enzyme Council <[email protected]>
/// @notice Aggregates multiple derivative price feeds (e.g., Compound, Chai) and dispatches
/// rate requests to the appropriate feed
abstract contract AggregatedDerivativePriceFeedMixin {
    event DerivativeAdded(address indexed derivative, address priceFeed);

    event DerivativeRemoved(address indexed derivative);

    mapping(address => address) private derivativeToPriceFeed;

    /// @notice Gets the rates for 1 unit of the derivative to its underlying assets
    /// @param _derivative The derivative for which to get the rates
    /// @return underlyings_ The underlying assets for the _derivative
    /// @return underlyingAmounts_ The rates for the _derivative to the underlyings_
    function __calcUnderlyingValues(address _derivative, uint256 _derivativeAmount)
        internal
        returns (address[] memory underlyings_, uint256[] memory underlyingAmounts_)
    {
        address derivativePriceFeed = getPriceFeedForDerivative(_derivative);
        require(
            derivativePriceFeed != address(0),
            "calcUnderlyingValues: _derivative is not supported"
        );

        return
            IDerivativePriceFeed(derivativePriceFeed).calcUnderlyingValues(
                _derivative,
                _derivativeAmount
            );
    }

    //////////////////////////
    // DERIVATIVES REGISTRY //
    //////////////////////////

    /// @notice Adds a list of derivatives with the given price feed values
    /// @param _derivatives The derivatives to add
    /// @param _priceFeeds The ordered price feeds corresponding to the list of _derivatives
    function __addDerivatives(address[] memory _derivatives, address[] memory _priceFeeds)
        internal
    {
        require(
            _derivatives.length == _priceFeeds.length,
            "__addDerivatives: Unequal _derivatives and _priceFeeds array lengths"
        );

        for (uint256 i = 0; i < _derivatives.length; i++) {
            require(
                getPriceFeedForDerivative(_derivatives[i]) == address(0),
                "__addDerivatives: Already added"
            );

            __validateDerivativePriceFeed(_derivatives[i], _priceFeeds[i]);

            derivativeToPriceFeed[_derivatives[i]] = _priceFeeds[i];

            emit DerivativeAdded(_derivatives[i], _priceFeeds[i]);
        }
    }

    /// @notice Removes a list of derivatives
    /// @param _derivatives The derivatives to remove
    function __removeDerivatives(address[] memory _derivatives) internal {
        for (uint256 i = 0; i < _derivatives.length; i++) {
            require(
                getPriceFeedForDerivative(_derivatives[i]) != address(0),
                "removeDerivatives: Derivative not yet added"
            );

            delete derivativeToPriceFeed[_derivatives[i]];

            emit DerivativeRemoved(_derivatives[i]);
        }
    }

    // PRIVATE FUNCTIONS

    /// @dev Helper to validate a derivative price feed
    function __validateDerivativePriceFeed(address _derivative, address _priceFeed) private view {
        require(
            IDerivativePriceFeed(_priceFeed).isSupportedAsset(_derivative),
            "__validateDerivativePriceFeed: Unsupported derivative"
        );
    }

    ///////////////////
    // STATE GETTERS //
    ///////////////////

    /// @notice Gets the registered price feed for a given derivative
    /// @return priceFeed_ The price feed contract address
    function getPriceFeedForDerivative(address _derivative)
        public
        view
        returns (address priceFeed_)
    {
        return derivativeToPriceFeed[_derivative];
    }
}

File 8 of 13 : IDerivativePriceFeed.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;

/// @title IDerivativePriceFeed Interface
/// @author Enzyme Council <[email protected]>
/// @notice Simple interface for derivative price source oracle implementations
interface IDerivativePriceFeed {
    function calcUnderlyingValues(address, uint256)
        external
        returns (address[] memory, uint256[] memory);

    function isSupportedAsset(address) external view returns (bool);
}

File 9 of 13 : ChainlinkPriceFeedMixin.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;

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

/// @title ChainlinkPriceFeedMixin Contract
/// @author Enzyme Council <[email protected]>
/// @notice A price feed that uses Chainlink oracles as price sources
abstract contract ChainlinkPriceFeedMixin {
    using SafeMath for uint256;

    event EthUsdAggregatorSet(address prevEthUsdAggregator, address nextEthUsdAggregator);

    event PrimitiveAdded(
        address indexed primitive,
        address aggregator,
        RateAsset rateAsset,
        uint256 unit
    );

    event PrimitiveRemoved(address indexed primitive);

    enum RateAsset {ETH, USD}

    struct AggregatorInfo {
        address aggregator;
        RateAsset rateAsset;
    }

    uint256 private constant ETH_UNIT = 10**18;

    uint256 private immutable STALE_RATE_THRESHOLD;
    address private immutable WETH_TOKEN;

    address private ethUsdAggregator;
    mapping(address => AggregatorInfo) private primitiveToAggregatorInfo;
    mapping(address => uint256) private primitiveToUnit;

    constructor(address _wethToken, uint256 _staleRateThreshold) public {
        STALE_RATE_THRESHOLD = _staleRateThreshold;
        WETH_TOKEN = _wethToken;
    }

    // INTERNAL FUNCTIONS

    /// @notice Calculates the value of a base asset in terms of a quote asset (using a canonical rate)
    /// @param _baseAsset The base asset
    /// @param _baseAssetAmount The base asset amount to convert
    /// @param _quoteAsset The quote asset
    /// @return quoteAssetAmount_ The equivalent quote asset amount
    function __calcCanonicalValue(
        address _baseAsset,
        uint256 _baseAssetAmount,
        address _quoteAsset
    ) internal view returns (uint256 quoteAssetAmount_) {
        // Case where _baseAsset == _quoteAsset is handled by ValueInterpreter

        int256 baseAssetRate = __getLatestRateData(_baseAsset);
        require(baseAssetRate > 0, "__calcCanonicalValue: Invalid base asset rate");

        int256 quoteAssetRate = __getLatestRateData(_quoteAsset);
        require(quoteAssetRate > 0, "__calcCanonicalValue: Invalid quote asset rate");

        return
            __calcConversionAmount(
                _baseAsset,
                _baseAssetAmount,
                uint256(baseAssetRate),
                _quoteAsset,
                uint256(quoteAssetRate)
            );
    }

    /// @dev Helper to set the `ethUsdAggregator` value
    function __setEthUsdAggregator(address _nextEthUsdAggregator) internal {
        address prevEthUsdAggregator = getEthUsdAggregator();
        require(
            _nextEthUsdAggregator != prevEthUsdAggregator,
            "__setEthUsdAggregator: Value already set"
        );

        __validateAggregator(_nextEthUsdAggregator);

        ethUsdAggregator = _nextEthUsdAggregator;

        emit EthUsdAggregatorSet(prevEthUsdAggregator, _nextEthUsdAggregator);
    }

    // PRIVATE FUNCTIONS

    /// @dev Helper to convert an amount from a _baseAsset to a _quoteAsset
    function __calcConversionAmount(
        address _baseAsset,
        uint256 _baseAssetAmount,
        uint256 _baseAssetRate,
        address _quoteAsset,
        uint256 _quoteAssetRate
    ) private view returns (uint256 quoteAssetAmount_) {
        RateAsset baseAssetRateAsset = getRateAssetForPrimitive(_baseAsset);
        RateAsset quoteAssetRateAsset = getRateAssetForPrimitive(_quoteAsset);
        uint256 baseAssetUnit = getUnitForPrimitive(_baseAsset);
        uint256 quoteAssetUnit = getUnitForPrimitive(_quoteAsset);

        // If rates are both in ETH or both in USD
        if (baseAssetRateAsset == quoteAssetRateAsset) {
            return
                __calcConversionAmountSameRateAsset(
                    _baseAssetAmount,
                    baseAssetUnit,
                    _baseAssetRate,
                    quoteAssetUnit,
                    _quoteAssetRate
                );
        }

        (, int256 ethPerUsdRate, , uint256 ethPerUsdRateLastUpdatedAt, ) = IChainlinkAggregator(
            getEthUsdAggregator()
        )
            .latestRoundData();
        require(ethPerUsdRate > 0, "__calcConversionAmount: Bad ethUsd rate");
        __validateRateIsNotStale(ethPerUsdRateLastUpdatedAt);

        // If _baseAsset's rate is in ETH and _quoteAsset's rate is in USD
        if (baseAssetRateAsset == RateAsset.ETH) {
            return
                __calcConversionAmountEthRateAssetToUsdRateAsset(
                    _baseAssetAmount,
                    baseAssetUnit,
                    _baseAssetRate,
                    quoteAssetUnit,
                    _quoteAssetRate,
                    uint256(ethPerUsdRate)
                );
        }

        // If _baseAsset's rate is in USD and _quoteAsset's rate is in ETH
        return
            __calcConversionAmountUsdRateAssetToEthRateAsset(
                _baseAssetAmount,
                baseAssetUnit,
                _baseAssetRate,
                quoteAssetUnit,
                _quoteAssetRate,
                uint256(ethPerUsdRate)
            );
    }

    /// @dev Helper to convert amounts where the base asset has an ETH rate and the quote asset has a USD rate
    function __calcConversionAmountEthRateAssetToUsdRateAsset(
        uint256 _baseAssetAmount,
        uint256 _baseAssetUnit,
        uint256 _baseAssetRate,
        uint256 _quoteAssetUnit,
        uint256 _quoteAssetRate,
        uint256 _ethPerUsdRate
    ) private pure returns (uint256 quoteAssetAmount_) {
        // Only allows two consecutive multiplication operations to avoid potential overflow.
        // Intermediate step needed to resolve stack-too-deep error.
        uint256 intermediateStep = _baseAssetAmount.mul(_baseAssetRate).mul(_ethPerUsdRate).div(
            ETH_UNIT
        );

        return intermediateStep.mul(_quoteAssetUnit).div(_baseAssetUnit).div(_quoteAssetRate);
    }

    /// @dev Helper to convert amounts where base and quote assets both have ETH rates or both have USD rates
    function __calcConversionAmountSameRateAsset(
        uint256 _baseAssetAmount,
        uint256 _baseAssetUnit,
        uint256 _baseAssetRate,
        uint256 _quoteAssetUnit,
        uint256 _quoteAssetRate
    ) private pure returns (uint256 quoteAssetAmount_) {
        // Only allows two consecutive multiplication operations to avoid potential overflow
        return
            _baseAssetAmount.mul(_baseAssetRate).mul(_quoteAssetUnit).div(
                _baseAssetUnit.mul(_quoteAssetRate)
            );
    }

    /// @dev Helper to convert amounts where the base asset has a USD rate and the quote asset has an ETH rate
    function __calcConversionAmountUsdRateAssetToEthRateAsset(
        uint256 _baseAssetAmount,
        uint256 _baseAssetUnit,
        uint256 _baseAssetRate,
        uint256 _quoteAssetUnit,
        uint256 _quoteAssetRate,
        uint256 _ethPerUsdRate
    ) private pure returns (uint256 quoteAssetAmount_) {
        // Only allows two consecutive multiplication operations to avoid potential overflow
        // Intermediate step needed to resolve stack-too-deep error.
        uint256 intermediateStep = _baseAssetAmount.mul(_baseAssetRate).mul(_quoteAssetUnit).div(
            _ethPerUsdRate
        );

        return intermediateStep.mul(ETH_UNIT).div(_baseAssetUnit).div(_quoteAssetRate);
    }

    /// @dev Helper to get the latest rate for a given primitive
    function __getLatestRateData(address _primitive) private view returns (int256 rate_) {
        if (_primitive == getWethToken()) {
            return int256(ETH_UNIT);
        }

        address aggregator = getAggregatorForPrimitive(_primitive);
        require(aggregator != address(0), "__getLatestRateData: Primitive does not exist");

        uint256 rateUpdatedAt;
        (, rate_, , rateUpdatedAt, ) = IChainlinkAggregator(aggregator).latestRoundData();
        __validateRateIsNotStale(rateUpdatedAt);

        return rate_;
    }

    /// @dev Helper to validate that a rate is not from a round considered to be stale
    function __validateRateIsNotStale(uint256 _latestUpdatedAt) private view {
        require(
            _latestUpdatedAt >= block.timestamp.sub(getStaleRateThreshold()),
            "__validateRateIsNotStale: Stale rate detected"
        );
    }

    /////////////////////////
    // PRIMITIVES REGISTRY //
    /////////////////////////

    /// @notice Adds a list of primitives with the given aggregator and rateAsset values
    /// @param _primitives The primitives to add
    /// @param _aggregators The ordered aggregators corresponding to the list of _primitives
    /// @param _rateAssets The ordered rate assets corresponding to the list of _primitives
    function __addPrimitives(
        address[] calldata _primitives,
        address[] calldata _aggregators,
        RateAsset[] calldata _rateAssets
    ) internal {
        require(
            _primitives.length == _aggregators.length,
            "__addPrimitives: Unequal _primitives and _aggregators array lengths"
        );
        require(
            _primitives.length == _rateAssets.length,
            "__addPrimitives: Unequal _primitives and _rateAssets array lengths"
        );

        for (uint256 i; i < _primitives.length; i++) {
            require(
                getAggregatorForPrimitive(_primitives[i]) == address(0),
                "__addPrimitives: Value already set"
            );

            __validateAggregator(_aggregators[i]);

            primitiveToAggregatorInfo[_primitives[i]] = AggregatorInfo({
                aggregator: _aggregators[i],
                rateAsset: _rateAssets[i]
            });

            // Store the amount that makes up 1 unit given the asset's decimals
            uint256 unit = 10**uint256(ERC20(_primitives[i]).decimals());
            primitiveToUnit[_primitives[i]] = unit;

            emit PrimitiveAdded(_primitives[i], _aggregators[i], _rateAssets[i], unit);
        }
    }

    /// @notice Removes a list of primitives from the feed
    /// @param _primitives The primitives to remove
    function __removePrimitives(address[] calldata _primitives) internal {
        for (uint256 i; i < _primitives.length; i++) {
            require(
                getAggregatorForPrimitive(_primitives[i]) != address(0),
                "__removePrimitives: Primitive not yet added"
            );

            delete primitiveToAggregatorInfo[_primitives[i]];
            delete primitiveToUnit[_primitives[i]];

            emit PrimitiveRemoved(_primitives[i]);
        }
    }

    // PRIVATE FUNCTIONS

    /// @dev Helper to validate an aggregator by checking its return values for the expected interface
    function __validateAggregator(address _aggregator) private view {
        (, int256 answer, , uint256 updatedAt, ) = IChainlinkAggregator(_aggregator)
            .latestRoundData();
        require(answer > 0, "__validateAggregator: No rate detected");
        __validateRateIsNotStale(updatedAt);
    }

    ///////////////////
    // STATE GETTERS //
    ///////////////////

    /// @notice Gets the aggregator for a primitive
    /// @param _primitive The primitive asset for which to get the aggregator value
    /// @return aggregator_ The aggregator address
    function getAggregatorForPrimitive(address _primitive)
        public
        view
        returns (address aggregator_)
    {
        return primitiveToAggregatorInfo[_primitive].aggregator;
    }

    /// @notice Gets the `ethUsdAggregator` variable value
    /// @return ethUsdAggregator_ The `ethUsdAggregator` variable value
    function getEthUsdAggregator() public view returns (address ethUsdAggregator_) {
        return ethUsdAggregator;
    }

    /// @notice Gets the rateAsset variable value for a primitive
    /// @return rateAsset_ The rateAsset variable value
    /// @dev This isn't strictly necessary as WETH_TOKEN will be undefined and thus
    /// the RateAsset will be the 0-position of the enum (i.e. ETH), but it makes the
    /// behavior more explicit
    function getRateAssetForPrimitive(address _primitive)
        public
        view
        returns (RateAsset rateAsset_)
    {
        if (_primitive == getWethToken()) {
            return RateAsset.ETH;
        }

        return primitiveToAggregatorInfo[_primitive].rateAsset;
    }

    /// @notice Gets the `STALE_RATE_THRESHOLD` variable value
    /// @return staleRateThreshold_ The `STALE_RATE_THRESHOLD` value
    function getStaleRateThreshold() public view returns (uint256 staleRateThreshold_) {
        return STALE_RATE_THRESHOLD;
    }

    /// @notice Gets the unit variable value for a primitive
    /// @return unit_ The unit variable value
    function getUnitForPrimitive(address _primitive) public view returns (uint256 unit_) {
        if (_primitive == getWethToken()) {
            return ETH_UNIT;
        }

        return primitiveToUnit[_primitive];
    }

    /// @notice Gets the `WETH_TOKEN` variable value
    /// @return wethToken_ The `WETH_TOKEN` variable value
    function getWethToken() public view returns (address wethToken_) {
        return WETH_TOKEN;
    }
}

File 10 of 13 : IValueInterpreter.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;

/// @title IValueInterpreter interface
/// @author Enzyme Council <[email protected]>
/// @notice Interface for ValueInterpreter
interface IValueInterpreter {
    function calcCanonicalAssetValue(
        address,
        uint256,
        address
    ) external returns (uint256);

    function calcCanonicalAssetsTotalValue(
        address[] calldata,
        uint256[] calldata,
        address
    ) external returns (uint256);

    function isSupportedAsset(address) external view returns (bool);

    function isSupportedDerivativeAsset(address) external view returns (bool);

    function isSupportedPrimitiveAsset(address) external view returns (bool);
}

File 11 of 13 : IChainlinkAggregator.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;

/// @title IChainlinkAggregator Interface
/// @author Enzyme Council <[email protected]>
interface IChainlinkAggregator {
    function latestRoundData()
        external
        view
        returns (
            uint80,
            int256,
            uint256,
            uint256,
            uint80
        );
}

File 12 of 13 : FundDeployerOwnerMixin.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;

import "../core/fund-deployer/IFundDeployer.sol";

/// @title FundDeployerOwnerMixin Contract
/// @author Enzyme Council <[email protected]>
/// @notice A mixin contract that defers ownership to the owner of FundDeployer
abstract contract FundDeployerOwnerMixin {
    address internal immutable FUND_DEPLOYER;

    modifier onlyFundDeployerOwner() {
        require(
            msg.sender == getOwner(),
            "onlyFundDeployerOwner: Only the FundDeployer owner can call this function"
        );
        _;
    }

    constructor(address _fundDeployer) public {
        FUND_DEPLOYER = _fundDeployer;
    }

    /// @notice Gets the owner of this contract
    /// @return owner_ The owner
    /// @dev Ownership is deferred to the owner of the FundDeployer contract
    function getOwner() public view returns (address owner_) {
        return IFundDeployer(FUND_DEPLOYER).getOwner();
    }

    ///////////////////
    // STATE GETTERS //
    ///////////////////

    /// @notice Gets the `FUND_DEPLOYER` variable
    /// @return fundDeployer_ The `FUND_DEPLOYER` variable value
    function getFundDeployer() public view returns (address fundDeployer_) {
        return FUND_DEPLOYER;
    }
}

File 13 of 13 : MathHelpers.sol
// SPDX-License-Identifier: GPL-3.0

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

    For the full license information, please view the LICENSE
    file that was distributed with this source code.
*/

pragma solidity 0.6.12;

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

/// @title MathHelpers Contract
/// @author Enzyme Council <[email protected]>
/// @notice Helper functions for common math operations
abstract contract MathHelpers {
    using SafeMath for uint256;

    /// @dev Calculates a proportional value relative to a known ratio.
    /// Caller is responsible as-necessary for:
    /// 1. validating _quantity1 to be non-zero
    /// 2. validating relativeQuantity2_ to be non-zero
    function __calcRelativeQuantity(
        uint256 _quantity1,
        uint256 _quantity2,
        uint256 _relativeQuantity1
    ) internal pure returns (uint256 relativeQuantity2_) {
        return _relativeQuantity1.mul(_quantity2).div(_quantity1);
    }
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "details": {
      "constantOptimizer": true,
      "cse": true,
      "deduplicate": true,
      "jumpdestRemover": true,
      "orderLiterals": true,
      "peephole": true,
      "yul": false
    },
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_fundDeployer","type":"address"},{"internalType":"address","name":"_wethToken","type":"address"},{"internalType":"uint256","name":"_chainlinkStaleRateThreshold","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"derivative","type":"address"},{"indexed":false,"internalType":"address","name":"priceFeed","type":"address"}],"name":"DerivativeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"derivative","type":"address"}],"name":"DerivativeRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"prevEthUsdAggregator","type":"address"},{"indexed":false,"internalType":"address","name":"nextEthUsdAggregator","type":"address"}],"name":"EthUsdAggregatorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"primitive","type":"address"},{"indexed":false,"internalType":"address","name":"aggregator","type":"address"},{"indexed":false,"internalType":"enum ChainlinkPriceFeedMixin.RateAsset","name":"rateAsset","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"unit","type":"uint256"}],"name":"PrimitiveAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"primitive","type":"address"}],"name":"PrimitiveRemoved","type":"event"},{"inputs":[{"internalType":"address[]","name":"_derivatives","type":"address[]"},{"internalType":"address[]","name":"_priceFeeds","type":"address[]"}],"name":"addDerivatives","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_primitives","type":"address[]"},{"internalType":"address[]","name":"_aggregators","type":"address[]"},{"internalType":"enum ChainlinkPriceFeedMixin.RateAsset[]","name":"_rateAssets","type":"uint8[]"}],"name":"addPrimitives","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_baseAsset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_quoteAsset","type":"address"}],"name":"calcCanonicalAssetValue","outputs":[{"internalType":"uint256","name":"value_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_baseAssets","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"address","name":"_quoteAsset","type":"address"}],"name":"calcCanonicalAssetsTotalValue","outputs":[{"internalType":"uint256","name":"value_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_primitive","type":"address"}],"name":"getAggregatorForPrimitive","outputs":[{"internalType":"address","name":"aggregator_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEthUsdAggregator","outputs":[{"internalType":"address","name":"ethUsdAggregator_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFundDeployer","outputs":[{"internalType":"address","name":"fundDeployer_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_derivative","type":"address"}],"name":"getPriceFeedForDerivative","outputs":[{"internalType":"address","name":"priceFeed_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_primitive","type":"address"}],"name":"getRateAssetForPrimitive","outputs":[{"internalType":"enum ChainlinkPriceFeedMixin.RateAsset","name":"rateAsset_","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStaleRateThreshold","outputs":[{"internalType":"uint256","name":"staleRateThreshold_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_primitive","type":"address"}],"name":"getUnitForPrimitive","outputs":[{"internalType":"uint256","name":"unit_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWethToken","outputs":[{"internalType":"address","name":"wethToken_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"isSupportedAsset","outputs":[{"internalType":"bool","name":"isSupported_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"isSupportedDerivativeAsset","outputs":[{"internalType":"bool","name":"isSupported_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"isSupportedPrimitiveAsset","outputs":[{"internalType":"bool","name":"isSupported_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_derivatives","type":"address[]"}],"name":"removeDerivatives","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_primitives","type":"address[]"}],"name":"removePrimitives","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nextEthUsdAggregator","type":"address"}],"name":"setEthUsdAggregator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_derivatives","type":"address[]"},{"internalType":"address[]","name":"_priceFeeds","type":"address[]"}],"name":"updateDerivatives","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_primitives","type":"address[]"},{"internalType":"address[]","name":"_aggregators","type":"address[]"},{"internalType":"enum ChainlinkPriceFeedMixin.RateAsset[]","name":"_rateAssets","type":"uint8[]"}],"name":"updatePrimitives","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e06040523480156200001157600080fd5b5060405162002bdb38038062002bdb833981016040819052620000349162000079565b6001600160601b0319606093841b811660805260a091909152911b1660c05262000107565b80516200006681620000e2565b92915050565b80516200006681620000fc565b6000806000606084860312156200008f57600080fd5b60006200009d868662000059565b9350506020620000b08682870162000059565b9250506040620000c3868287016200006c565b9150509250925092565b60006001600160a01b03821662000066565b90565b620000ed81620000cd565b8114620000f957600080fd5b50565b620000ed81620000df565b60805160601c60a05160c05160601c612a9c6200013f600039806103895250806107e552508061053552806106435250612a9c6000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c806397c0ac87116100b8578063b54fbdaa1161007c578063b54fbdaa1461025f578063c496f8e814610267578063cf0399c81461027a578063e106264f1461028d578063e2dd0978146102a0578063e35e318e146102b357610137565b806397c0ac871461020b5780639be918e614610213578063a98acadc14610226578063ae6f52ad14610239578063b3d3af3b1461024c57610137565b80636d3b9410116100ff5780636d3b9410146101c257806374626f87146101d5578063787f2568146101dd578063893d20e8146101f05780638f72b136146101f857610137565b806339cbb63c1461013c5780634c252f91146101515780634c67e1061461016f57806364b01dc11461018f57806368e81c6d146101af575b600080fd5b61014f61014a366004611c13565b6102d3565b005b610159610387565b6040516101669190612739565b60405180910390f35b61018261017d366004611b85565b6103ab565b6040516101669190612971565b6101a261019d366004611b49565b61043f565b60405161016691906127a5565b6101596101bd366004611b49565b61045e565b61014f6101d0366004611c81565b61047c565b6101596104d4565b6101826101eb366004611b49565b6104e3565b610159610531565b61014f610206366004611bd2565b6105c9565b610159610641565b6101a2610221366004611b49565b610665565b61014f610234366004611b49565b610685565b610182610247366004611d86565b6106c9565b61014f61025a366004611c13565b61076f565b6101826107e3565b6101a2610275366004611b49565b610807565b61014f610288366004611c81565b610836565b61014f61029b366004611bd2565b61086e565b6101596102ae366004611b49565b6108b0565b6102c66102c1366004611b49565b6108ce565b60405161016691906127b3565b6102db610531565b6001600160a01b0316336001600160a01b0316146103145760405162461bcd60e51b815260040161030b906127f1565b60405180910390fd5b6103818484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060408051602080880282810182019093528782529093508792508691829185019084908082843760009201919091525061091f92505050565b50505050565b7f000000000000000000000000000000000000000000000000000000000000000090565b6000816001600160a01b0316846001600160a01b031614806103cb575082155b156103d7575081610438565b6103e082610807565b156103f7576103f0848484610aac565b9050610438565b6104008261043f565b8015610410575061041084610807565b15610420576103f0848484610b39565b60405162461bcd60e51b815260040161030b90612811565b9392505050565b60008061044b8361045e565b6001600160a01b0316141590505b919050565b6001600160a01b039081166000908152602081905260409020541690565b610484610531565b6001600160a01b0316336001600160a01b0316146104b45760405162461bcd60e51b815260040161030b906127f1565b6104be8686610c13565b6104cc868686868686610d5f565b505050505050565b6001546001600160a01b031690565b60006104ed610387565b6001600160a01b0316826001600160a01b031614156105155750670de0b6b3a7640000610459565b506001600160a01b031660009081526003602052604090205490565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663893d20e86040518163ffffffff1660e01b815260040160206040518083038186803b15801561058c57600080fd5b505afa1580156105a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c49190611b67565b905090565b6105d1610531565b6001600160a01b0316336001600160a01b0316146106015760405162461bcd60e51b815260040161030b906127f1565b61063d82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061108492505050565b5050565b7f000000000000000000000000000000000000000000000000000000000000000090565b600061067082610807565b8061067f575061067f8261043f565b92915050565b61068d610531565b6001600160a01b0316336001600160a01b0316146106bd5760405162461bcd60e51b815260040161030b906127f1565b6106c68161116f565b50565b600082518451146106ec5760405162461bcd60e51b815260040161030b90612881565b6106f582610807565b6107115760405162461bcd60e51b815260040161030b906127d1565b60005b845181101561076757600061075086838151811061072e57fe5b602002602001015186848151811061074257fe5b602002602001015186610aac565b905061075c838261120f565b925050600101610714565b509392505050565b610777610531565b6001600160a01b0316336001600160a01b0316146107a75760405162461bcd60e51b815260040161030b906127f1565b61031484848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061108492505050565b7f000000000000000000000000000000000000000000000000000000000000000090565b6000610811610387565b6001600160a01b0316826001600160a01b0316148061067f5750600061044b836108b0565b61083e610531565b6001600160a01b0316336001600160a01b0316146104be5760405162461bcd60e51b815260040161030b906127f1565b610876610531565b6001600160a01b0316336001600160a01b0316146108a65760405162461bcd60e51b815260040161030b906127f1565b61063d8282610c13565b6001600160a01b039081166000908152600260205260409020541690565b60006108d8610387565b6001600160a01b0316826001600160a01b031614156108f957506000610459565b506001600160a01b0316600090815260026020526040902054600160a01b900460ff1690565b80518251146109405760405162461bcd60e51b815260040161030b90612941565b60005b8251811015610aa75760006001600160a01b031661097384838151811061096657fe5b602002602001015161045e565b6001600160a01b0316146109995760405162461bcd60e51b815260040161030b906128d1565b6109c98382815181106109a857fe5b60200260200101518383815181106109bc57fe5b6020026020010151611234565b8181815181106109d557fe5b60200260200101516000808584815181106109ec57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550828181518110610a4457fe5b60200260200101516001600160a01b03167faa4ae250fb435bb4b31ed0b95822bc179fc6c5dd0c727c3ffe08d444025efd98838381518110610a8257fe5b6020026020010151604051610a979190612739565b60405180910390a2600101610943565b505050565b6000816001600160a01b0316846001600160a01b03161480610acc575082155b15610ad8575081610438565b610ae184610807565b15610af1576103f08484846112cc565b6000610afc8561045e565b90506001600160a01b03811615610b2157610b198186868661133e565b915050610438565b60405162461bcd60e51b815260040161030b90612931565b600080826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7557600080fd5b505afa158015610b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bad9190611e96565b60ff16600a0a90506000610bc08461045e565b90506000610bd08286858a61133e565b90506127108111610bf35760405162461bcd60e51b815260040161030b90612951565b610c08610c0182600161120f565b848861146e565b979650505050505050565b60005b81811015610aa7576000610c44848484818110610c2f57fe5b90506020020160208101906102ae9190611b49565b6001600160a01b03161415610c6b5760405162461bcd60e51b815260040161030b906128f1565b60026000848484818110610c7b57fe5b9050602002016020810190610c909190611b49565b6001600160a01b031681526020810191909152604001600090812080546001600160a81b0319169055600390848484818110610cc857fe5b9050602002016020810190610cdd9190611b49565b6001600160a01b03166001600160a01b0316815260200190815260200160002060009055828282818110610d0d57fe5b9050602002016020810190610d229190611b49565b6001600160a01b03167fb100e8178a081ba9130260173ee2ebe0db3a6c3b6751a7801111ab3017df0e9760405160405180910390a2600101610c16565b848314610d7e5760405162461bcd60e51b815260040161030b90612921565b848114610d9d5760405162461bcd60e51b815260040161030b90612871565b60005b8581101561107b576000610db9888884818110610c2f57fe5b6001600160a01b031614610ddf5760405162461bcd60e51b815260040161030b90612961565b610e08858583818110610dee57fe5b9050602002016020810190610e039190611b49565b61148c565b6040518060400160405280868684818110610e1f57fe5b9050602002016020810190610e349190611b49565b6001600160a01b03168152602001848484818110610e4e57fe5b9050602002016020810190610e639190611e03565b6001811115610e6e57fe5b905260026000898985818110610e8057fe5b9050602002016020810190610e959190611b49565b6001600160a01b0390811682526020808301939093526040909101600020835181546001600160a01b031916921691909117808255918301519091829060ff60a01b1916600160a01b836001811115610eea57fe5b02179055509050506000878783818110610f0057fe5b9050602002016020810190610f159190611b49565b6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4d57600080fd5b505afa158015610f61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f859190611e96565b60ff16600a0a905080600360008a8a86818110610f9e57fe5b9050602002016020810190610fb39190611b49565b6001600160a01b03168152602081019190915260400160002055878783818110610fd957fe5b9050602002016020810190610fee9190611b49565b6001600160a01b03167f742bdf00da3d8f16c0fab93ce38eb6a536a019c9e283888dd44c3a08c0148c0287878581811061102457fe5b90506020020160208101906110399190611b49565b86868681811061104557fe5b905060200201602081019061105a9190611e03565b8460405161106a93929190612762565b60405180910390a250600101610da0565b50505050505050565b60005b815181101561063d5760006001600160a01b03166110aa83838151811061096657fe5b6001600160a01b031614156110d15760405162461bcd60e51b815260040161030b90612891565b6000808383815181106110e057fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154906001600160a01b03021916905581818151811061112a57fe5b60200260200101516001600160a01b03167fc15eb25d807b570f4567baf6e97c7b26d58a7d0512dc85e8db15375a056b860460405160405180910390a2600101611087565b60006111796104d4565b9050806001600160a01b0316826001600160a01b031614156111ad5760405162461bcd60e51b815260040161030b906127c1565b6111b68261148c565b600180546001600160a01b0319166001600160a01b0384161790556040517f98b60a60ba6130248e985ae4140dc3109d9c2980c7e435fed385e2756bc94461906112039083908590612747565b60405180910390a15050565b6000828201838110156104385760405162461bcd60e51b815260040161030b90612801565b604051634df48c7360e11b81526001600160a01b03821690639be918e690611260908590600401612739565b60206040518083038186803b15801561127857600080fd5b505afa15801561128c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b09190611de5565b61063d5760405162461bcd60e51b815260040161030b90612911565b6000806112d885611530565b9050600081136112fa5760405162461bcd60e51b815260040161030b906128b1565b600061130584611530565b9050600081136113275760405162461bcd60e51b815260040161030b906128e1565b6113348686848785611623565b9695505050505050565b6000606080866001600160a01b031663727212f687876040518363ffffffff1660e01b815260040161137192919061278a565b600060405180830381600087803b15801561138b57600080fd5b505af115801561139f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113c79190810190611d1f565b9150915060008251116113ec5760405162461bcd60e51b815260040161030b906128a1565b805182511461140d5760405162461bcd60e51b815260040161030b90612831565b60005b825181101561146357600061144c84838151811061142a57fe5b602002602001015184848151811061143e57fe5b602002602001015188610aac565b9050611458858261120f565b945050600101611410565b505050949350505050565b60006114848461147e8486611788565b906117c2565b949350505050565b600080826001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156114c857600080fd5b505afa1580156114dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115009190611e21565b50935050925050600082136115275760405162461bcd60e51b815260040161030b90612901565b610aa7816117f4565b600061153a610387565b6001600160a01b0316826001600160a01b031614156115625750670de0b6b3a7640000610459565b600061156d836108b0565b90506001600160a01b0381166115955760405162461bcd60e51b815260040161030b906127e1565b6000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156115d057600080fd5b505afa1580156115e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116089190611e21565b5091955090925061161c91508290506117f4565b5050919050565b60008061162f876108ce565b9050600061163c856108ce565b90506000611649896104e3565b90506000611656876104e3565b905082600181111561166457fe5b84600181111561167057fe5b141561168e5761168389838a848a611825565b94505050505061177f565b6000806116996104d4565b6001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156116d157600080fd5b505afa1580156116e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117099190611e21565b50935050925050600082136117305760405162461bcd60e51b815260040161030b90612851565b611739816117f4565b600086600181111561174757fe5b14156117685761175b8b858c868c87611848565b965050505050505061177f565b6117768b858c868c87611883565b96505050505050505b95945050505050565b6000826117975750600061067f565b828202828482816117a457fe5b04146104385760405162461bcd60e51b815260040161030b906128c1565b60008082116117e35760405162461bcd60e51b815260040161030b90612841565b8183816117ec57fe5b049392505050565b6118066117ff6107e3565b42906118b2565b8110156106c65760405162461bcd60e51b815260040161030b90612861565b60006113346118348684611788565b61147e856118428a89611788565b90611788565b600080611865670de0b6b3a764000061147e856118428c8b611788565b90506118778461147e8981858a611788565b98975050505050505050565b6000806118988361147e876118428c8b611788565b90506118778461147e898185670de0b6b3a7640000611788565b6000828211156118d45760405162461bcd60e51b815260040161030b90612821565b50900390565b803561067f81612a21565b805161067f81612a21565b60008083601f84011261190257600080fd5b5081356001600160401b0381111561191957600080fd5b60208301915083602082028301111561193157600080fd5b9250929050565b600082601f83011261194957600080fd5b813561195c611957826129a5565b61297f565b9150818183526020840193506020810190508385602084028201111561198157600080fd5b60005b838110156119ad578161199788826118da565b8452506020928301929190910190600101611984565b5050505092915050565b600082601f8301126119c857600080fd5b81516119d6611957826129a5565b915081818352602084019350602081019050838560208402820111156119fb57600080fd5b60005b838110156119ad5781611a1188826118e5565b84525060209283019291909101906001016119fe565b600082601f830112611a3857600080fd5b8135611a46611957826129a5565b91508181835260208401935060208101905083856020840282011115611a6b57600080fd5b60005b838110156119ad5781611a818882611b28565b8452506020928301929190910190600101611a6e565b600082601f830112611aa857600080fd5b8151611ab6611957826129a5565b91508181835260208401935060208101905083856020840282011115611adb57600080fd5b60005b838110156119ad5781611af18882611b1d565b8452506020928301929190910190600101611ade565b805161067f81612a35565b803561067f81612a3e565b805161067f81612a4b565b803561067f81612a4b565b805161067f81612a5d565b805161067f81612a54565b600060208284031215611b5b57600080fd5b600061148484846118da565b600060208284031215611b7957600080fd5b600061148484846118e5565b600080600060608486031215611b9a57600080fd5b6000611ba686866118da565b9350506020611bb786828701611b28565b9250506040611bc8868287016118da565b9150509250925092565b60008060208385031215611be557600080fd5b82356001600160401b03811115611bfb57600080fd5b611c07858286016118f0565b92509250509250929050565b60008060008060408587031215611c2957600080fd5b84356001600160401b03811115611c3f57600080fd5b611c4b878288016118f0565b945094505060208501356001600160401b03811115611c6957600080fd5b611c75878288016118f0565b95989497509550505050565b60008060008060008060608789031215611c9a57600080fd5b86356001600160401b03811115611cb057600080fd5b611cbc89828a016118f0565b965096505060208701356001600160401b03811115611cda57600080fd5b611ce689828a016118f0565b945094505060408701356001600160401b03811115611d0457600080fd5b611d1089828a016118f0565b92509250509295509295509295565b60008060408385031215611d3257600080fd5b82516001600160401b03811115611d4857600080fd5b611d54858286016119b7565b92505060208301516001600160401b03811115611d7057600080fd5b611d7c85828601611a97565b9150509250929050565b600080600060608486031215611d9b57600080fd5b83356001600160401b03811115611db157600080fd5b611dbd86828701611938565b93505060208401356001600160401b03811115611dd957600080fd5b611bb786828701611a27565b600060208284031215611df757600080fd5b60006114848484611b07565b600060208284031215611e1557600080fd5b60006114848484611b12565b600080600080600060a08688031215611e3957600080fd5b6000611e458888611b33565b9550506020611e5688828901611b1d565b9450506040611e6788828901611b1d565b9350506060611e7888828901611b1d565b9250506080611e8988828901611b33565b9150509295509295909350565b600060208284031215611ea857600080fd5b60006114848484611b3e565b611ebd816129ce565b82525050565b611ebd816129d9565b611ebd81612a0c565b6000611ee26028836129c5565b7f5f5f73657445746855736441676772656761746f723a2056616c756520616c728152671958591e481cd95d60c21b602082015260400192915050565b6000611f2c6036836129c5565b7f63616c6343616e6f6e6963616c417373657473546f74616c56616c75653a20558152751b9cdd5c1c1bdc9d19590817dc5d5bdd19505cdcd95d60521b602082015260400192915050565b6000611f84602d836129c5565b7f5f5f6765744c617465737452617465446174613a205072696d6974697665206481526c1bd95cc81b9bdd08195e1a5cdd609a1b602082015260400192915050565b6000611fd36049836129c5565b7f6f6e6c7946756e644465706c6f7965724f776e65723a204f6e6c79207468652081527f46756e644465706c6f796572206f776e65722063616e2063616c6c207468697360208201526810333ab731ba34b7b760b91b604082015260600192915050565b6000612044601b836129c5565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b600061207d602f836129c5565b7f63616c6343616e6f6e6963616c417373657456616c75653a20556e737570706f81526e393a32b21031b7b73b32b939b4b7b760891b602082015260400192915050565b60006120ce601e836129c5565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000612107602d836129c5565b7f5f5f63616c634465726976617469766556616c75653a2041727261797320756e81526c657175616c206c656e6774687360981b602082015260400192915050565b6000612156601a836129c5565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000815260200192915050565b600061218f6027836129c5565b7f5f5f63616c63436f6e76657273696f6e416d6f756e743a2042616420657468558152667364207261746560c81b602082015260400192915050565b60006121d8602d836129c5565b7f5f5f76616c69646174655261746549734e6f745374616c653a205374616c652081526c1c985d194819195d1958dd1959609a1b602082015260400192915050565b60006122276042836129c5565b7f5f5f6164645072696d6974697665733a20556e657175616c205f7072696d697481527f6976657320616e64205f72617465417373657473206172726179206c656e6774602082015261687360f01b604082015260600192915050565b60006122916035836129c5565b7f63616c6343616e6f6e6963616c417373657473546f74616c56616c75653a2041815274727261797320756e657175616c206c656e6774687360581b602082015260400192915050565b60006122e8602b836129c5565b7f72656d6f766544657269766174697665733a2044657269766174697665206e6f81526a1d081e595d08185919195960aa1b602082015260400192915050565b60006123356025836129c5565b7f5f5f63616c634465726976617469766556616c75653a204e6f20756e6465726c81526479696e677360d81b602082015260400192915050565b600061237c602d836129c5565b7f5f5f63616c6343616e6f6e6963616c56616c75653a20496e76616c696420626181526c7365206173736574207261746560981b602082015260400192915050565b60006123cb6021836129c5565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b600061240e601f836129c5565b7f5f5f61646444657269766174697665733a20416c726561647920616464656400815260200192915050565b6000612447602e836129c5565b7f5f5f63616c6343616e6f6e6963616c56616c75653a20496e76616c696420717581526d6f7465206173736574207261746560901b602082015260400192915050565b6000612497602b836129c5565b7f5f5f72656d6f76655072696d6974697665733a205072696d6974697665206e6f81526a1d081e595d08185919195960aa1b602082015260400192915050565b60006124e46026836129c5565b7f5f5f76616c696461746541676772656761746f723a204e6f20726174652064658152651d1958dd195960d21b602082015260400192915050565b600061252c6035836129c5565b7f5f5f76616c6964617465446572697661746976655072696365466565643a20558152746e737570706f72746564206465726976617469766560581b602082015260400192915050565b60006125836043836129c5565b7f5f5f6164645072696d6974697665733a20556e657175616c205f7072696d697481527f6976657320616e64205f61676772656761746f7273206172726179206c656e6760208201526274687360e81b604082015260600192915050565b60006125ee6028836129c5565b7f5f5f63616c63417373657456616c75653a20556e737570706f72746564205f62815267185cd9505cdcd95d60c21b602082015260400192915050565b60006126386044836129c5565b7f5f5f61646444657269766174697665733a20556e657175616c205f646572697681527f61746976657320616e64205f70726963654665656473206172726179206c656e6020820152636774687360e01b604082015260600192915050565b60006126a46033836129c5565b7f5f5f63616c635072696d6974697665546f4465726976617469766556616c75658152723a20496e73756666696369656e74207261746560681b602082015260400192915050565b60006126f96022836129c5565b7f5f5f6164645072696d6974697665733a2056616c756520616c72656164792073815261195d60f21b602082015260400192915050565b611ebd816129e8565b6020810161067f8284611eb4565b604081016127558285611eb4565b6104386020830184611eb4565b606081016127708286611eb4565b61277d6020830185611ecc565b6114846040830184612730565b604081016127988285611eb4565b6104386020830184612730565b6020810161067f8284611ec3565b6020810161067f8284611ecc565b6020808252810161067f81611ed5565b6020808252810161067f81611f1f565b6020808252810161067f81611f77565b6020808252810161067f81611fc6565b6020808252810161067f81612037565b6020808252810161067f81612070565b6020808252810161067f816120c1565b6020808252810161067f816120fa565b6020808252810161067f81612149565b6020808252810161067f81612182565b6020808252810161067f816121cb565b6020808252810161067f8161221a565b6020808252810161067f81612284565b6020808252810161067f816122db565b6020808252810161067f81612328565b6020808252810161067f8161236f565b6020808252810161067f816123be565b6020808252810161067f81612401565b6020808252810161067f8161243a565b6020808252810161067f8161248a565b6020808252810161067f816124d7565b6020808252810161067f8161251f565b6020808252810161067f81612576565b6020808252810161067f816125e1565b6020808252810161067f8161262b565b6020808252810161067f81612697565b6020808252810161067f816126ec565b6020810161067f8284612730565b6040518181016001600160401b038111828210171561299d57600080fd5b604052919050565b60006001600160401b038211156129bb57600080fd5b5060209081020190565b90815260200190565b600061067f826129eb565b151590565b8061045981612a17565b90565b6001600160a01b031690565b60ff1690565b69ffffffffffffffffffff1690565b600061067f826129de565b600281106106c657fe5b612a2a816129ce565b81146106c657600080fd5b612a2a816129d9565b600281106106c657600080fd5b612a2a816129e8565b612a2a816129f7565b612a2a816129fd56fea26469706673582212204c0523977e22949ded25b18f1d684838c3be624dedc685affc2447ed12136fd164736f6c634300060c00330000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000015f90

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101375760003560e01c806397c0ac87116100b8578063b54fbdaa1161007c578063b54fbdaa1461025f578063c496f8e814610267578063cf0399c81461027a578063e106264f1461028d578063e2dd0978146102a0578063e35e318e146102b357610137565b806397c0ac871461020b5780639be918e614610213578063a98acadc14610226578063ae6f52ad14610239578063b3d3af3b1461024c57610137565b80636d3b9410116100ff5780636d3b9410146101c257806374626f87146101d5578063787f2568146101dd578063893d20e8146101f05780638f72b136146101f857610137565b806339cbb63c1461013c5780634c252f91146101515780634c67e1061461016f57806364b01dc11461018f57806368e81c6d146101af575b600080fd5b61014f61014a366004611c13565b6102d3565b005b610159610387565b6040516101669190612739565b60405180910390f35b61018261017d366004611b85565b6103ab565b6040516101669190612971565b6101a261019d366004611b49565b61043f565b60405161016691906127a5565b6101596101bd366004611b49565b61045e565b61014f6101d0366004611c81565b61047c565b6101596104d4565b6101826101eb366004611b49565b6104e3565b610159610531565b61014f610206366004611bd2565b6105c9565b610159610641565b6101a2610221366004611b49565b610665565b61014f610234366004611b49565b610685565b610182610247366004611d86565b6106c9565b61014f61025a366004611c13565b61076f565b6101826107e3565b6101a2610275366004611b49565b610807565b61014f610288366004611c81565b610836565b61014f61029b366004611bd2565b61086e565b6101596102ae366004611b49565b6108b0565b6102c66102c1366004611b49565b6108ce565b60405161016691906127b3565b6102db610531565b6001600160a01b0316336001600160a01b0316146103145760405162461bcd60e51b815260040161030b906127f1565b60405180910390fd5b6103818484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060408051602080880282810182019093528782529093508792508691829185019084908082843760009201919091525061091f92505050565b50505050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290565b6000816001600160a01b0316846001600160a01b031614806103cb575082155b156103d7575081610438565b6103e082610807565b156103f7576103f0848484610aac565b9050610438565b6104008261043f565b8015610410575061041084610807565b15610420576103f0848484610b39565b60405162461bcd60e51b815260040161030b90612811565b9392505050565b60008061044b8361045e565b6001600160a01b0316141590505b919050565b6001600160a01b039081166000908152602081905260409020541690565b610484610531565b6001600160a01b0316336001600160a01b0316146104b45760405162461bcd60e51b815260040161030b906127f1565b6104be8686610c13565b6104cc868686868686610d5f565b505050505050565b6001546001600160a01b031690565b60006104ed610387565b6001600160a01b0316826001600160a01b031614156105155750670de0b6b3a7640000610459565b506001600160a01b031660009081526003602052604090205490565b60007f0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc63606001600160a01b031663893d20e86040518163ffffffff1660e01b815260040160206040518083038186803b15801561058c57600080fd5b505afa1580156105a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c49190611b67565b905090565b6105d1610531565b6001600160a01b0316336001600160a01b0316146106015760405162461bcd60e51b815260040161030b906127f1565b61063d82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061108492505050565b5050565b7f0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc636090565b600061067082610807565b8061067f575061067f8261043f565b92915050565b61068d610531565b6001600160a01b0316336001600160a01b0316146106bd5760405162461bcd60e51b815260040161030b906127f1565b6106c68161116f565b50565b600082518451146106ec5760405162461bcd60e51b815260040161030b90612881565b6106f582610807565b6107115760405162461bcd60e51b815260040161030b906127d1565b60005b845181101561076757600061075086838151811061072e57fe5b602002602001015186848151811061074257fe5b602002602001015186610aac565b905061075c838261120f565b925050600101610714565b509392505050565b610777610531565b6001600160a01b0316336001600160a01b0316146107a75760405162461bcd60e51b815260040161030b906127f1565b61031484848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061108492505050565b7f0000000000000000000000000000000000000000000000000000000000015f9090565b6000610811610387565b6001600160a01b0316826001600160a01b0316148061067f5750600061044b836108b0565b61083e610531565b6001600160a01b0316336001600160a01b0316146104be5760405162461bcd60e51b815260040161030b906127f1565b610876610531565b6001600160a01b0316336001600160a01b0316146108a65760405162461bcd60e51b815260040161030b906127f1565b61063d8282610c13565b6001600160a01b039081166000908152600260205260409020541690565b60006108d8610387565b6001600160a01b0316826001600160a01b031614156108f957506000610459565b506001600160a01b0316600090815260026020526040902054600160a01b900460ff1690565b80518251146109405760405162461bcd60e51b815260040161030b90612941565b60005b8251811015610aa75760006001600160a01b031661097384838151811061096657fe5b602002602001015161045e565b6001600160a01b0316146109995760405162461bcd60e51b815260040161030b906128d1565b6109c98382815181106109a857fe5b60200260200101518383815181106109bc57fe5b6020026020010151611234565b8181815181106109d557fe5b60200260200101516000808584815181106109ec57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550828181518110610a4457fe5b60200260200101516001600160a01b03167faa4ae250fb435bb4b31ed0b95822bc179fc6c5dd0c727c3ffe08d444025efd98838381518110610a8257fe5b6020026020010151604051610a979190612739565b60405180910390a2600101610943565b505050565b6000816001600160a01b0316846001600160a01b03161480610acc575082155b15610ad8575081610438565b610ae184610807565b15610af1576103f08484846112cc565b6000610afc8561045e565b90506001600160a01b03811615610b2157610b198186868661133e565b915050610438565b60405162461bcd60e51b815260040161030b90612931565b600080826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7557600080fd5b505afa158015610b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bad9190611e96565b60ff16600a0a90506000610bc08461045e565b90506000610bd08286858a61133e565b90506127108111610bf35760405162461bcd60e51b815260040161030b90612951565b610c08610c0182600161120f565b848861146e565b979650505050505050565b60005b81811015610aa7576000610c44848484818110610c2f57fe5b90506020020160208101906102ae9190611b49565b6001600160a01b03161415610c6b5760405162461bcd60e51b815260040161030b906128f1565b60026000848484818110610c7b57fe5b9050602002016020810190610c909190611b49565b6001600160a01b031681526020810191909152604001600090812080546001600160a81b0319169055600390848484818110610cc857fe5b9050602002016020810190610cdd9190611b49565b6001600160a01b03166001600160a01b0316815260200190815260200160002060009055828282818110610d0d57fe5b9050602002016020810190610d229190611b49565b6001600160a01b03167fb100e8178a081ba9130260173ee2ebe0db3a6c3b6751a7801111ab3017df0e9760405160405180910390a2600101610c16565b848314610d7e5760405162461bcd60e51b815260040161030b90612921565b848114610d9d5760405162461bcd60e51b815260040161030b90612871565b60005b8581101561107b576000610db9888884818110610c2f57fe5b6001600160a01b031614610ddf5760405162461bcd60e51b815260040161030b90612961565b610e08858583818110610dee57fe5b9050602002016020810190610e039190611b49565b61148c565b6040518060400160405280868684818110610e1f57fe5b9050602002016020810190610e349190611b49565b6001600160a01b03168152602001848484818110610e4e57fe5b9050602002016020810190610e639190611e03565b6001811115610e6e57fe5b905260026000898985818110610e8057fe5b9050602002016020810190610e959190611b49565b6001600160a01b0390811682526020808301939093526040909101600020835181546001600160a01b031916921691909117808255918301519091829060ff60a01b1916600160a01b836001811115610eea57fe5b02179055509050506000878783818110610f0057fe5b9050602002016020810190610f159190611b49565b6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4d57600080fd5b505afa158015610f61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f859190611e96565b60ff16600a0a905080600360008a8a86818110610f9e57fe5b9050602002016020810190610fb39190611b49565b6001600160a01b03168152602081019190915260400160002055878783818110610fd957fe5b9050602002016020810190610fee9190611b49565b6001600160a01b03167f742bdf00da3d8f16c0fab93ce38eb6a536a019c9e283888dd44c3a08c0148c0287878581811061102457fe5b90506020020160208101906110399190611b49565b86868681811061104557fe5b905060200201602081019061105a9190611e03565b8460405161106a93929190612762565b60405180910390a250600101610da0565b50505050505050565b60005b815181101561063d5760006001600160a01b03166110aa83838151811061096657fe5b6001600160a01b031614156110d15760405162461bcd60e51b815260040161030b90612891565b6000808383815181106110e057fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154906001600160a01b03021916905581818151811061112a57fe5b60200260200101516001600160a01b03167fc15eb25d807b570f4567baf6e97c7b26d58a7d0512dc85e8db15375a056b860460405160405180910390a2600101611087565b60006111796104d4565b9050806001600160a01b0316826001600160a01b031614156111ad5760405162461bcd60e51b815260040161030b906127c1565b6111b68261148c565b600180546001600160a01b0319166001600160a01b0384161790556040517f98b60a60ba6130248e985ae4140dc3109d9c2980c7e435fed385e2756bc94461906112039083908590612747565b60405180910390a15050565b6000828201838110156104385760405162461bcd60e51b815260040161030b90612801565b604051634df48c7360e11b81526001600160a01b03821690639be918e690611260908590600401612739565b60206040518083038186803b15801561127857600080fd5b505afa15801561128c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b09190611de5565b61063d5760405162461bcd60e51b815260040161030b90612911565b6000806112d885611530565b9050600081136112fa5760405162461bcd60e51b815260040161030b906128b1565b600061130584611530565b9050600081136113275760405162461bcd60e51b815260040161030b906128e1565b6113348686848785611623565b9695505050505050565b6000606080866001600160a01b031663727212f687876040518363ffffffff1660e01b815260040161137192919061278a565b600060405180830381600087803b15801561138b57600080fd5b505af115801561139f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113c79190810190611d1f565b9150915060008251116113ec5760405162461bcd60e51b815260040161030b906128a1565b805182511461140d5760405162461bcd60e51b815260040161030b90612831565b60005b825181101561146357600061144c84838151811061142a57fe5b602002602001015184848151811061143e57fe5b602002602001015188610aac565b9050611458858261120f565b945050600101611410565b505050949350505050565b60006114848461147e8486611788565b906117c2565b949350505050565b600080826001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156114c857600080fd5b505afa1580156114dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115009190611e21565b50935050925050600082136115275760405162461bcd60e51b815260040161030b90612901565b610aa7816117f4565b600061153a610387565b6001600160a01b0316826001600160a01b031614156115625750670de0b6b3a7640000610459565b600061156d836108b0565b90506001600160a01b0381166115955760405162461bcd60e51b815260040161030b906127e1565b6000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156115d057600080fd5b505afa1580156115e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116089190611e21565b5091955090925061161c91508290506117f4565b5050919050565b60008061162f876108ce565b9050600061163c856108ce565b90506000611649896104e3565b90506000611656876104e3565b905082600181111561166457fe5b84600181111561167057fe5b141561168e5761168389838a848a611825565b94505050505061177f565b6000806116996104d4565b6001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156116d157600080fd5b505afa1580156116e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117099190611e21565b50935050925050600082136117305760405162461bcd60e51b815260040161030b90612851565b611739816117f4565b600086600181111561174757fe5b14156117685761175b8b858c868c87611848565b965050505050505061177f565b6117768b858c868c87611883565b96505050505050505b95945050505050565b6000826117975750600061067f565b828202828482816117a457fe5b04146104385760405162461bcd60e51b815260040161030b906128c1565b60008082116117e35760405162461bcd60e51b815260040161030b90612841565b8183816117ec57fe5b049392505050565b6118066117ff6107e3565b42906118b2565b8110156106c65760405162461bcd60e51b815260040161030b90612861565b60006113346118348684611788565b61147e856118428a89611788565b90611788565b600080611865670de0b6b3a764000061147e856118428c8b611788565b90506118778461147e8981858a611788565b98975050505050505050565b6000806118988361147e876118428c8b611788565b90506118778461147e898185670de0b6b3a7640000611788565b6000828211156118d45760405162461bcd60e51b815260040161030b90612821565b50900390565b803561067f81612a21565b805161067f81612a21565b60008083601f84011261190257600080fd5b5081356001600160401b0381111561191957600080fd5b60208301915083602082028301111561193157600080fd5b9250929050565b600082601f83011261194957600080fd5b813561195c611957826129a5565b61297f565b9150818183526020840193506020810190508385602084028201111561198157600080fd5b60005b838110156119ad578161199788826118da565b8452506020928301929190910190600101611984565b5050505092915050565b600082601f8301126119c857600080fd5b81516119d6611957826129a5565b915081818352602084019350602081019050838560208402820111156119fb57600080fd5b60005b838110156119ad5781611a1188826118e5565b84525060209283019291909101906001016119fe565b600082601f830112611a3857600080fd5b8135611a46611957826129a5565b91508181835260208401935060208101905083856020840282011115611a6b57600080fd5b60005b838110156119ad5781611a818882611b28565b8452506020928301929190910190600101611a6e565b600082601f830112611aa857600080fd5b8151611ab6611957826129a5565b91508181835260208401935060208101905083856020840282011115611adb57600080fd5b60005b838110156119ad5781611af18882611b1d565b8452506020928301929190910190600101611ade565b805161067f81612a35565b803561067f81612a3e565b805161067f81612a4b565b803561067f81612a4b565b805161067f81612a5d565b805161067f81612a54565b600060208284031215611b5b57600080fd5b600061148484846118da565b600060208284031215611b7957600080fd5b600061148484846118e5565b600080600060608486031215611b9a57600080fd5b6000611ba686866118da565b9350506020611bb786828701611b28565b9250506040611bc8868287016118da565b9150509250925092565b60008060208385031215611be557600080fd5b82356001600160401b03811115611bfb57600080fd5b611c07858286016118f0565b92509250509250929050565b60008060008060408587031215611c2957600080fd5b84356001600160401b03811115611c3f57600080fd5b611c4b878288016118f0565b945094505060208501356001600160401b03811115611c6957600080fd5b611c75878288016118f0565b95989497509550505050565b60008060008060008060608789031215611c9a57600080fd5b86356001600160401b03811115611cb057600080fd5b611cbc89828a016118f0565b965096505060208701356001600160401b03811115611cda57600080fd5b611ce689828a016118f0565b945094505060408701356001600160401b03811115611d0457600080fd5b611d1089828a016118f0565b92509250509295509295509295565b60008060408385031215611d3257600080fd5b82516001600160401b03811115611d4857600080fd5b611d54858286016119b7565b92505060208301516001600160401b03811115611d7057600080fd5b611d7c85828601611a97565b9150509250929050565b600080600060608486031215611d9b57600080fd5b83356001600160401b03811115611db157600080fd5b611dbd86828701611938565b93505060208401356001600160401b03811115611dd957600080fd5b611bb786828701611a27565b600060208284031215611df757600080fd5b60006114848484611b07565b600060208284031215611e1557600080fd5b60006114848484611b12565b600080600080600060a08688031215611e3957600080fd5b6000611e458888611b33565b9550506020611e5688828901611b1d565b9450506040611e6788828901611b1d565b9350506060611e7888828901611b1d565b9250506080611e8988828901611b33565b9150509295509295909350565b600060208284031215611ea857600080fd5b60006114848484611b3e565b611ebd816129ce565b82525050565b611ebd816129d9565b611ebd81612a0c565b6000611ee26028836129c5565b7f5f5f73657445746855736441676772656761746f723a2056616c756520616c728152671958591e481cd95d60c21b602082015260400192915050565b6000611f2c6036836129c5565b7f63616c6343616e6f6e6963616c417373657473546f74616c56616c75653a20558152751b9cdd5c1c1bdc9d19590817dc5d5bdd19505cdcd95d60521b602082015260400192915050565b6000611f84602d836129c5565b7f5f5f6765744c617465737452617465446174613a205072696d6974697665206481526c1bd95cc81b9bdd08195e1a5cdd609a1b602082015260400192915050565b6000611fd36049836129c5565b7f6f6e6c7946756e644465706c6f7965724f776e65723a204f6e6c79207468652081527f46756e644465706c6f796572206f776e65722063616e2063616c6c207468697360208201526810333ab731ba34b7b760b91b604082015260600192915050565b6000612044601b836129c5565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b600061207d602f836129c5565b7f63616c6343616e6f6e6963616c417373657456616c75653a20556e737570706f81526e393a32b21031b7b73b32b939b4b7b760891b602082015260400192915050565b60006120ce601e836129c5565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000612107602d836129c5565b7f5f5f63616c634465726976617469766556616c75653a2041727261797320756e81526c657175616c206c656e6774687360981b602082015260400192915050565b6000612156601a836129c5565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000815260200192915050565b600061218f6027836129c5565b7f5f5f63616c63436f6e76657273696f6e416d6f756e743a2042616420657468558152667364207261746560c81b602082015260400192915050565b60006121d8602d836129c5565b7f5f5f76616c69646174655261746549734e6f745374616c653a205374616c652081526c1c985d194819195d1958dd1959609a1b602082015260400192915050565b60006122276042836129c5565b7f5f5f6164645072696d6974697665733a20556e657175616c205f7072696d697481527f6976657320616e64205f72617465417373657473206172726179206c656e6774602082015261687360f01b604082015260600192915050565b60006122916035836129c5565b7f63616c6343616e6f6e6963616c417373657473546f74616c56616c75653a2041815274727261797320756e657175616c206c656e6774687360581b602082015260400192915050565b60006122e8602b836129c5565b7f72656d6f766544657269766174697665733a2044657269766174697665206e6f81526a1d081e595d08185919195960aa1b602082015260400192915050565b60006123356025836129c5565b7f5f5f63616c634465726976617469766556616c75653a204e6f20756e6465726c81526479696e677360d81b602082015260400192915050565b600061237c602d836129c5565b7f5f5f63616c6343616e6f6e6963616c56616c75653a20496e76616c696420626181526c7365206173736574207261746560981b602082015260400192915050565b60006123cb6021836129c5565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b600061240e601f836129c5565b7f5f5f61646444657269766174697665733a20416c726561647920616464656400815260200192915050565b6000612447602e836129c5565b7f5f5f63616c6343616e6f6e6963616c56616c75653a20496e76616c696420717581526d6f7465206173736574207261746560901b602082015260400192915050565b6000612497602b836129c5565b7f5f5f72656d6f76655072696d6974697665733a205072696d6974697665206e6f81526a1d081e595d08185919195960aa1b602082015260400192915050565b60006124e46026836129c5565b7f5f5f76616c696461746541676772656761746f723a204e6f20726174652064658152651d1958dd195960d21b602082015260400192915050565b600061252c6035836129c5565b7f5f5f76616c6964617465446572697661746976655072696365466565643a20558152746e737570706f72746564206465726976617469766560581b602082015260400192915050565b60006125836043836129c5565b7f5f5f6164645072696d6974697665733a20556e657175616c205f7072696d697481527f6976657320616e64205f61676772656761746f7273206172726179206c656e6760208201526274687360e81b604082015260600192915050565b60006125ee6028836129c5565b7f5f5f63616c63417373657456616c75653a20556e737570706f72746564205f62815267185cd9505cdcd95d60c21b602082015260400192915050565b60006126386044836129c5565b7f5f5f61646444657269766174697665733a20556e657175616c205f646572697681527f61746976657320616e64205f70726963654665656473206172726179206c656e6020820152636774687360e01b604082015260600192915050565b60006126a46033836129c5565b7f5f5f63616c635072696d6974697665546f4465726976617469766556616c75658152723a20496e73756666696369656e74207261746560681b602082015260400192915050565b60006126f96022836129c5565b7f5f5f6164645072696d6974697665733a2056616c756520616c72656164792073815261195d60f21b602082015260400192915050565b611ebd816129e8565b6020810161067f8284611eb4565b604081016127558285611eb4565b6104386020830184611eb4565b606081016127708286611eb4565b61277d6020830185611ecc565b6114846040830184612730565b604081016127988285611eb4565b6104386020830184612730565b6020810161067f8284611ec3565b6020810161067f8284611ecc565b6020808252810161067f81611ed5565b6020808252810161067f81611f1f565b6020808252810161067f81611f77565b6020808252810161067f81611fc6565b6020808252810161067f81612037565b6020808252810161067f81612070565b6020808252810161067f816120c1565b6020808252810161067f816120fa565b6020808252810161067f81612149565b6020808252810161067f81612182565b6020808252810161067f816121cb565b6020808252810161067f8161221a565b6020808252810161067f81612284565b6020808252810161067f816122db565b6020808252810161067f81612328565b6020808252810161067f8161236f565b6020808252810161067f816123be565b6020808252810161067f81612401565b6020808252810161067f8161243a565b6020808252810161067f8161248a565b6020808252810161067f816124d7565b6020808252810161067f8161251f565b6020808252810161067f81612576565b6020808252810161067f816125e1565b6020808252810161067f8161262b565b6020808252810161067f81612697565b6020808252810161067f816126ec565b6020810161067f8284612730565b6040518181016001600160401b038111828210171561299d57600080fd5b604052919050565b60006001600160401b038211156129bb57600080fd5b5060209081020190565b90815260200190565b600061067f826129eb565b151590565b8061045981612a17565b90565b6001600160a01b031690565b60ff1690565b69ffffffffffffffffffff1690565b600061067f826129de565b600281106106c657fe5b612a2a816129ce565b81146106c657600080fd5b612a2a816129d9565b600281106106c657600080fd5b612a2a816129e8565b612a2a816129f7565b612a2a816129fd56fea26469706673582212204c0523977e22949ded25b18f1d684838c3be624dedc685affc2447ed12136fd164736f6c634300060c0033

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

0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000015f90

-----Decoded View---------------
Arg [0] : _fundDeployer (address): 0x4f1C53F096533C04d8157EFB6Bca3eb22ddC6360
Arg [1] : _wethToken (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : _chainlinkStaleRateThreshold (uint256): 90000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 0000000000000000000000000000000000000000000000000000000000015f90


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.