ETH Price: $3,300.48 (-3.66%)
Gas: 7 Gwei

Contract

0x31329024f1a3E4a4B3336E0b1DfA74CC3FEc633e
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60e06040141328852022-02-03 12:00:49881 days ago1643889649IN
 Create: IntegrationManager
0 ETH0.1897878686.84329987

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
IntegrationManager

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 23 : IntegrationManager.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 "../../core/fund/vault/IVault.sol";
import "../../infrastructure/value-interpreter/IValueInterpreter.sol";
import "../../utils/AddressArrayLib.sol";
import "../../utils/AssetHelpers.sol";
import "../policy-manager/IPolicyManager.sol";
import "../utils/ExtensionBase.sol";
import "../utils/PermissionedVaultActionMixin.sol";
import "./integrations/IIntegrationAdapter.sol";
import "./IIntegrationManager.sol";

/// @title IntegrationManager
/// @author Enzyme Council <[email protected]>
/// @notice Extension to handle DeFi integration actions for funds
/// @dev Any arbitrary adapter is allowed by default, so all participants must be aware of
/// their fund's configuration, especially whether they use a policy that only allows
/// official adapters. Owners and asset managers must also establish trust for any
/// arbitrary adapters that they interact with.
contract IntegrationManager is
    IIntegrationManager,
    ExtensionBase,
    PermissionedVaultActionMixin,
    AssetHelpers
{
    using AddressArrayLib for address[];
    using SafeMath for uint256;

    event CallOnIntegrationExecutedForFund(
        address indexed comptrollerProxy,
        address caller,
        address indexed adapter,
        bytes4 indexed selector,
        bytes integrationData,
        address[] incomingAssets,
        uint256[] incomingAssetAmounts,
        address[] spendAssets,
        uint256[] spendAssetAmounts
    );

    address private immutable POLICY_MANAGER;
    address private immutable VALUE_INTERPRETER;

    constructor(
        address _fundDeployer,
        address _policyManager,
        address _valueInterpreter
    ) public ExtensionBase(_fundDeployer) {
        POLICY_MANAGER = _policyManager;
        VALUE_INTERPRETER = _valueInterpreter;
    }

    /////////////
    // GENERAL //
    /////////////

    /// @notice Enables the IntegrationManager to be used by a fund
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _vaultProxy The VaultProxy of the fund
    function setConfigForFund(
        address _comptrollerProxy,
        address _vaultProxy,
        bytes calldata
    ) external override onlyFundDeployer {
        __setValidatedVaultProxy(_comptrollerProxy, _vaultProxy);
    }

    ///////////////////////////////
    // CALL-ON-EXTENSION ACTIONS //
    ///////////////////////////////

    /// @notice Receives a dispatched `callOnExtension` from a fund's ComptrollerProxy
    /// @param _caller The user who called for this action
    /// @param _actionId An ID representing the desired action
    /// @param _callArgs The encoded args for the action
    function receiveCallFromComptroller(
        address _caller,
        uint256 _actionId,
        bytes calldata _callArgs
    ) external override {
        address comptrollerProxy = msg.sender;

        // This validation comes at negligible cost but is not strictly necessary,
        // as all actions below call permissioned actions on the VaultProxy,
        // which will fail for an invalid ComptrollerProxy
        address vaultProxy = getVaultProxyForFund(comptrollerProxy);
        require(vaultProxy != address(0), "receiveCallFromComptroller: Fund is not valid");

        require(
            IVault(vaultProxy).canManageAssets(_caller),
            "receiveCallFromComptroller: Unauthorized"
        );

        // Dispatch the action
        if (_actionId == 0) {
            __callOnIntegration(_caller, comptrollerProxy, vaultProxy, _callArgs);
        } else if (_actionId == 1) {
            __addTrackedAssetsToVault(_caller, comptrollerProxy, _callArgs);
        } else if (_actionId == 2) {
            __removeTrackedAssetsFromVault(_caller, comptrollerProxy, _callArgs);
        } else {
            revert("receiveCallFromComptroller: Invalid _actionId");
        }
    }

    /// @dev Adds assets as tracked assets of the vault.
    /// Does not validate that assets are not already tracked.
    function __addTrackedAssetsToVault(
        address _caller,
        address _comptrollerProxy,
        bytes memory _callArgs
    ) private {
        address[] memory assets = abi.decode(_callArgs, (address[]));

        IPolicyManager(getPolicyManager()).validatePolicies(
            _comptrollerProxy,
            IPolicyManager.PolicyHook.AddTrackedAssets,
            abi.encode(_caller, assets)
        );

        for (uint256 i; i < assets.length; i++) {
            require(
                IValueInterpreter(getValueInterpreter()).isSupportedAsset(assets[i]),
                "__addTrackedAssetsToVault: Unsupported asset"
            );

            __addTrackedAsset(_comptrollerProxy, assets[i]);
        }
    }

    /// @dev Removes assets from the tracked assets of the vault.
    /// Does not validate that assets are not already tracked.
    function __removeTrackedAssetsFromVault(
        address _caller,
        address _comptrollerProxy,
        bytes memory _callArgs
    ) private {
        address[] memory assets = abi.decode(_callArgs, (address[]));

        IPolicyManager(getPolicyManager()).validatePolicies(
            _comptrollerProxy,
            IPolicyManager.PolicyHook.RemoveTrackedAssets,
            abi.encode(_caller, assets)
        );

        for (uint256 i; i < assets.length; i++) {
            __removeTrackedAsset(_comptrollerProxy, assets[i]);
        }
    }

    /////////////////////////
    // CALL ON INTEGRATION //
    /////////////////////////

    /// @notice Universal method for calling third party contract functions through adapters
    /// @param _caller The caller of this function via the ComptrollerProxy
    /// @param _comptrollerProxy The ComptrollerProxy
    /// @param _vaultProxy The VaultProxy
    /// @param _callArgs The encoded args for this function
    /// - _adapter Adapter of the integration on which to execute a call
    /// - _selector Method selector of the adapter method to execute
    /// - _integrationData Encoded arguments specific to the adapter
    /// @dev Refer to specific adapter to see how to encode its arguments.
    function __callOnIntegration(
        address _caller,
        address _comptrollerProxy,
        address _vaultProxy,
        bytes memory _callArgs
    ) private {
        // Validating the ComptrollerProxy is the active VaultProxy.accessor()
        // protects against corner cases of lingering permissions on adapters issued
        // via VaultLib.callOnContract() that could otherwise be called from an
        // undestructed ComptrollerProxy
        require(
            _comptrollerProxy == IVault(_vaultProxy).getAccessor(),
            "receiveCallFromComptroller: Fund is not active"
        );

        (
            address adapter,
            bytes4 selector,
            bytes memory integrationData
        ) = __decodeCallOnIntegrationArgs(_callArgs);

        (
            address[] memory incomingAssets,
            uint256[] memory incomingAssetAmounts,
            address[] memory spendAssets,
            uint256[] memory spendAssetAmounts
        ) = __callOnIntegrationInner(
            _comptrollerProxy,
            _vaultProxy,
            adapter,
            selector,
            integrationData
        );

        IPolicyManager(getPolicyManager()).validatePolicies(
            _comptrollerProxy,
            IPolicyManager.PolicyHook.PostCallOnIntegration,
            abi.encode(
                _caller,
                adapter,
                selector,
                incomingAssets,
                incomingAssetAmounts,
                spendAssets,
                spendAssetAmounts
            )
        );

        emit CallOnIntegrationExecutedForFund(
            _comptrollerProxy,
            _caller,
            adapter,
            selector,
            integrationData,
            incomingAssets,
            incomingAssetAmounts,
            spendAssets,
            spendAssetAmounts
        );
    }

    /// @dev Helper to execute the bulk of logic of callOnIntegration.
    /// Avoids the stack-too-deep-error.
    function __callOnIntegrationInner(
        address _comptrollerProxy,
        address _vaultProxy,
        address _adapter,
        bytes4 _selector,
        bytes memory _integrationData
    )
        private
        returns (
            address[] memory incomingAssets_,
            uint256[] memory incomingAssetAmounts_,
            address[] memory spendAssets_,
            uint256[] memory spendAssetAmounts_
        )
    {
        uint256[] memory preCallIncomingAssetBalances;
        uint256[] memory minIncomingAssetAmounts;
        SpendAssetsHandleType spendAssetsHandleType;
        uint256[] memory maxSpendAssetAmounts;
        uint256[] memory preCallSpendAssetBalances;

        (
            incomingAssets_,
            preCallIncomingAssetBalances,
            minIncomingAssetAmounts,
            spendAssetsHandleType,
            spendAssets_,
            maxSpendAssetAmounts,
            preCallSpendAssetBalances
        ) = __preProcessCoI(_comptrollerProxy, _vaultProxy, _adapter, _selector, _integrationData);

        __executeCoI(
            _vaultProxy,
            _adapter,
            _selector,
            _integrationData,
            abi.encode(spendAssets_, maxSpendAssetAmounts, incomingAssets_)
        );

        (incomingAssetAmounts_, spendAssetAmounts_) = __postProcessCoI(
            _comptrollerProxy,
            _vaultProxy,
            _adapter,
            incomingAssets_,
            preCallIncomingAssetBalances,
            minIncomingAssetAmounts,
            spendAssetsHandleType,
            spendAssets_,
            maxSpendAssetAmounts,
            preCallSpendAssetBalances
        );

        return (incomingAssets_, incomingAssetAmounts_, spendAssets_, spendAssetAmounts_);
    }

    /// @dev Helper to decode CoI args
    function __decodeCallOnIntegrationArgs(bytes memory _callArgs)
        private
        pure
        returns (
            address adapter_,
            bytes4 selector_,
            bytes memory integrationData_
        )
    {
        return abi.decode(_callArgs, (address, bytes4, bytes));
    }

    /// @dev Helper to execute a call to an integration
    /// @dev Avoids stack-too-deep error
    function __executeCoI(
        address _vaultProxy,
        address _adapter,
        bytes4 _selector,
        bytes memory _integrationData,
        bytes memory _assetData
    ) private {
        (bool success, bytes memory returnData) = _adapter.call(
            abi.encodeWithSelector(_selector, _vaultProxy, _integrationData, _assetData)
        );
        require(success, string(returnData));
    }

    /// @dev Helper to get the vault's balance of a particular asset
    function __getVaultAssetBalance(address _vaultProxy, address _asset)
        private
        view
        returns (uint256)
    {
        return ERC20(_asset).balanceOf(_vaultProxy);
    }

    /// @dev Helper for the internal actions to take prior to executing CoI
    function __preProcessCoI(
        address _comptrollerProxy,
        address _vaultProxy,
        address _adapter,
        bytes4 _selector,
        bytes memory _integrationData
    )
        private
        returns (
            address[] memory incomingAssets_,
            uint256[] memory preCallIncomingAssetBalances_,
            uint256[] memory minIncomingAssetAmounts_,
            SpendAssetsHandleType spendAssetsHandleType_,
            address[] memory spendAssets_,
            uint256[] memory maxSpendAssetAmounts_,
            uint256[] memory preCallSpendAssetBalances_
        )
    {
        // Note that incoming and spend assets are allowed to overlap
        // (e.g., a fee for the incomingAsset charged in a spend asset)
        (
            spendAssetsHandleType_,
            spendAssets_,
            maxSpendAssetAmounts_,
            incomingAssets_,
            minIncomingAssetAmounts_
        ) = IIntegrationAdapter(_adapter).parseAssetsForAction(
            _vaultProxy,
            _selector,
            _integrationData
        );
        require(
            spendAssets_.length == maxSpendAssetAmounts_.length,
            "__preProcessCoI: Spend assets arrays unequal"
        );
        require(
            incomingAssets_.length == minIncomingAssetAmounts_.length,
            "__preProcessCoI: Incoming assets arrays unequal"
        );
        require(spendAssets_.isUniqueSet(), "__preProcessCoI: Duplicate spend asset");
        require(incomingAssets_.isUniqueSet(), "__preProcessCoI: Duplicate incoming asset");

        // INCOMING ASSETS

        // Incoming asset balances must be recorded prior to spend asset balances in case there
        // is an overlap (an asset that is both a spend asset and an incoming asset),
        // as a spend asset can be immediately transferred after recording its balance
        preCallIncomingAssetBalances_ = new uint256[](incomingAssets_.length);
        for (uint256 i; i < incomingAssets_.length; i++) {
            require(
                IValueInterpreter(getValueInterpreter()).isSupportedAsset(incomingAssets_[i]),
                "__preProcessCoI: Non-receivable incoming asset"
            );

            preCallIncomingAssetBalances_[i] = ERC20(incomingAssets_[i]).balanceOf(_vaultProxy);
        }

        // SPEND ASSETS

        preCallSpendAssetBalances_ = new uint256[](spendAssets_.length);
        for (uint256 i; i < spendAssets_.length; i++) {
            preCallSpendAssetBalances_[i] = ERC20(spendAssets_[i]).balanceOf(_vaultProxy);

            // Grant adapter access to the spend assets.
            // spendAssets_ is already asserted to be a unique set.
            if (spendAssetsHandleType_ == SpendAssetsHandleType.Approve) {
                // Use exact approve amount, and reset afterwards
                __approveAssetSpender(
                    _comptrollerProxy,
                    spendAssets_[i],
                    _adapter,
                    maxSpendAssetAmounts_[i]
                );
            } else if (spendAssetsHandleType_ == SpendAssetsHandleType.Transfer) {
                __withdrawAssetTo(
                    _comptrollerProxy,
                    spendAssets_[i],
                    _adapter,
                    maxSpendAssetAmounts_[i]
                );
            }
        }
    }

    /// @dev Helper to reconcile incoming and spend assets after executing CoI
    function __postProcessCoI(
        address _comptrollerProxy,
        address _vaultProxy,
        address _adapter,
        address[] memory _incomingAssets,
        uint256[] memory _preCallIncomingAssetBalances,
        uint256[] memory _minIncomingAssetAmounts,
        SpendAssetsHandleType _spendAssetsHandleType,
        address[] memory _spendAssets,
        uint256[] memory _maxSpendAssetAmounts,
        uint256[] memory _preCallSpendAssetBalances
    )
        private
        returns (uint256[] memory incomingAssetAmounts_, uint256[] memory spendAssetAmounts_)
    {
        // INCOMING ASSETS

        incomingAssetAmounts_ = new uint256[](_incomingAssets.length);
        for (uint256 i; i < _incomingAssets.length; i++) {
            incomingAssetAmounts_[i] = __getVaultAssetBalance(_vaultProxy, _incomingAssets[i]).sub(
                _preCallIncomingAssetBalances[i]
            );
            require(
                incomingAssetAmounts_[i] >= _minIncomingAssetAmounts[i],
                "__postProcessCoI: Received incoming asset less than expected"
            );

            // Even if the asset's previous balance was >0, it might not have been tracked
            __addTrackedAsset(_comptrollerProxy, _incomingAssets[i]);
        }

        // SPEND ASSETS

        spendAssetAmounts_ = new uint256[](_spendAssets.length);
        for (uint256 i; i < _spendAssets.length; i++) {
            // Calculate the balance change of spend assets. Ignore if balance increased.
            uint256 postCallSpendAssetBalance = __getVaultAssetBalance(
                _vaultProxy,
                _spendAssets[i]
            );
            if (postCallSpendAssetBalance < _preCallSpendAssetBalances[i]) {
                spendAssetAmounts_[i] = _preCallSpendAssetBalances[i].sub(
                    postCallSpendAssetBalance
                );
            }

            // Reset any unused approvals
            if (
                _spendAssetsHandleType == SpendAssetsHandleType.Approve &&
                ERC20(_spendAssets[i]).allowance(_vaultProxy, _adapter) > 0
            ) {
                __approveAssetSpender(_comptrollerProxy, _spendAssets[i], _adapter, 0);
            } else if (_spendAssetsHandleType == SpendAssetsHandleType.None) {
                // Only need to validate _maxSpendAssetAmounts if not SpendAssetsHandleType.Approve
                // or SpendAssetsHandleType.Transfer, as each of those implicitly validate the max
                require(
                    spendAssetAmounts_[i] <= _maxSpendAssetAmounts[i],
                    "__postProcessCoI: Spent amount greater than expected"
                );
            }
        }

        return (incomingAssetAmounts_, spendAssetAmounts_);
    }

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

    /// @notice Gets the `POLICY_MANAGER` variable
    /// @return policyManager_ The `POLICY_MANAGER` variable value
    function getPolicyManager() public view returns (address policyManager_) {
        return POLICY_MANAGER;
    }

    /// @notice Gets the `VALUE_INTERPRETER` variable
    /// @return valueInterpreter_ The `VALUE_INTERPRETER` variable value
    function getValueInterpreter() public view returns (address valueInterpreter_) {
        return VALUE_INTERPRETER;
    }
}

File 2 of 23 : 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 23 : 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 23 : 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 23 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

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

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

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

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

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

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

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

File 6 of 23 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 7 of 23 : 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 8 of 23 : IExternalPositionVault.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 IExternalPositionVault interface
/// @author Enzyme Council <[email protected]>
/// Provides an interface to get the externalPositionLib for a given type from the Vault
interface IExternalPositionVault {
    function getExternalPositionLibForType(uint256) external view returns (address);
}

File 9 of 23 : IFreelyTransferableSharesVault.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 IFreelyTransferableSharesVault Interface
/// @author Enzyme Council <[email protected]>
/// @notice Provides the interface for determining whether a vault's shares
/// are guaranteed to be freely transferable.
/// @dev DO NOT EDIT CONTRACT
interface IFreelyTransferableSharesVault {
    function sharesAreFreelyTransferable()
        external
        view
        returns (bool sharesAreFreelyTransferable_);
}

File 10 of 23 : IMigratableVault.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 IMigratableVault Interface
/// @author Enzyme Council <[email protected]>
/// @dev DO NOT EDIT CONTRACT
interface IMigratableVault {
    function canMigrate(address _who) external view returns (bool canMigrate_);

    function init(
        address _owner,
        address _accessor,
        string calldata _fundName
    ) external;

    function setAccessor(address _nextAccessor) external;

    function setVaultLib(address _nextVaultLib) external;
}

File 11 of 23 : 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 12 of 23 : IComptroller.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 "../vault/IVault.sol";

/// @title IComptroller Interface
/// @author Enzyme Council <[email protected]>
interface IComptroller {
    function activate(bool) external;

    function calcGav() external returns (uint256);

    function calcGrossShareValue() external returns (uint256);

    function callOnExtension(
        address,
        uint256,
        bytes calldata
    ) external;

    function destructActivated(uint256, uint256) external;

    function destructUnactivated() external;

    function getDenominationAsset() external view returns (address);

    function getExternalPositionManager() external view returns (address);

    function getFeeManager() external view returns (address);

    function getFundDeployer() external view returns (address);

    function getGasRelayPaymaster() external view returns (address);

    function getIntegrationManager() external view returns (address);

    function getPolicyManager() external view returns (address);

    function getVaultProxy() external view returns (address);

    function init(address, uint256) external;

    function permissionedVaultAction(IVault.VaultAction, bytes calldata) external;

    function preTransferSharesHook(
        address,
        address,
        uint256
    ) external;

    function preTransferSharesHookFreelyTransferable(address) external view;

    function setGasRelayPaymaster(address) external;

    function setVaultProxy(address) external;
}

File 13 of 23 : IVault.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 "../../../../persistent/vault/interfaces/IExternalPositionVault.sol";
import "../../../../persistent/vault/interfaces/IFreelyTransferableSharesVault.sol";
import "../../../../persistent/vault/interfaces/IMigratableVault.sol";

/// @title IVault Interface
/// @author Enzyme Council <[email protected]>
interface IVault is IMigratableVault, IFreelyTransferableSharesVault, IExternalPositionVault {
    enum VaultAction {
        None,
        // Shares management
        BurnShares,
        MintShares,
        TransferShares,
        // Asset management
        AddTrackedAsset,
        ApproveAssetSpender,
        RemoveTrackedAsset,
        WithdrawAssetTo,
        // External position management
        AddExternalPosition,
        CallOnExternalPosition,
        RemoveExternalPosition
    }

    function addTrackedAsset(address) external;

    function burnShares(address, uint256) external;

    function buyBackProtocolFeeShares(
        uint256,
        uint256,
        uint256
    ) external;

    function callOnContract(address, bytes calldata) external returns (bytes memory);

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

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

    function getAccessor() external view returns (address);

    function getOwner() external view returns (address);

    function getActiveExternalPositions() external view returns (address[] memory);

    function getTrackedAssets() external view returns (address[] memory);

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

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

    function mintShares(address, uint256) external;

    function payProtocolFee() external;

    function receiveValidatedVaultAction(VaultAction, bytes calldata) external;

    function setAccessorForFundReconfiguration(address) external;

    function setSymbol(string calldata) external;

    function transferShares(
        address,
        address,
        uint256
    ) external;

    function withdrawAssetTo(
        address,
        address,
        uint256
    ) external;
}

File 14 of 23 : IExtension.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 IExtension Interface
/// @author Enzyme Council <[email protected]>
/// @notice Interface for all extensions
interface IExtension {
    function activateForFund(bool _isMigration) external;

    function deactivateForFund() external;

    function receiveCallFromComptroller(
        address _caller,
        uint256 _actionId,
        bytes calldata _callArgs
    ) external;

    function setConfigForFund(
        address _comptrollerProxy,
        address _vaultProxy,
        bytes calldata _configData
    ) external;
}

File 15 of 23 : IIntegrationManager.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 IIntegrationManager interface
/// @author Enzyme Council <[email protected]>
/// @notice Interface for the IntegrationManager
interface IIntegrationManager {
    enum SpendAssetsHandleType {None, Approve, Transfer}
}

File 16 of 23 : IIntegrationAdapter.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 "../IIntegrationManager.sol";

/// @title Integration Adapter interface
/// @author Enzyme Council <[email protected]>
/// @notice Interface for all integration adapters
interface IIntegrationAdapter {
    function parseAssetsForAction(
        address _vaultProxy,
        bytes4 _selector,
        bytes calldata _encodedCallArgs
    )
        external
        view
        returns (
            IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_,
            address[] memory spendAssets_,
            uint256[] memory spendAssetAmounts_,
            address[] memory incomingAssets_,
            uint256[] memory minIncomingAssetAmounts_
        );
}

File 17 of 23 : IPolicyManager.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;

/// @title PolicyManager Interface
/// @author Enzyme Council <[email protected]>
/// @notice Interface for the PolicyManager
interface IPolicyManager {
    // When updating PolicyHook, also update these functions in PolicyManager:
    // 1. __getAllPolicyHooks()
    // 2. __policyHookRestrictsCurrentInvestorActions()
    enum PolicyHook {
        PostBuyShares,
        PostCallOnIntegration,
        PreTransferShares,
        RedeemSharesForSpecificAssets,
        AddTrackedAssets,
        RemoveTrackedAssets,
        CreateExternalPosition,
        PostCallOnExternalPosition,
        RemoveExternalPosition,
        ReactivateExternalPosition
    }

    function validatePolicies(
        address,
        PolicyHook,
        bytes calldata
    ) external;
}

File 18 of 23 : ExtensionBase.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 "../../utils/FundDeployerOwnerMixin.sol";
import "../IExtension.sol";

/// @title ExtensionBase Contract
/// @author Enzyme Council <[email protected]>
/// @notice Base class for an extension
abstract contract ExtensionBase is IExtension, FundDeployerOwnerMixin {
    event ValidatedVaultProxySetForFund(
        address indexed comptrollerProxy,
        address indexed vaultProxy
    );

    mapping(address => address) internal comptrollerProxyToVaultProxy;

    modifier onlyFundDeployer() {
        require(msg.sender == getFundDeployer(), "Only the FundDeployer can make this call");
        _;
    }

    constructor(address _fundDeployer) public FundDeployerOwnerMixin(_fundDeployer) {}

    /// @notice Allows extension to run logic during fund activation
    /// @dev Unimplemented by default, may be overridden.
    function activateForFund(bool) external virtual override {
        return;
    }

    /// @notice Allows extension to run logic during fund deactivation (destruct)
    /// @dev Unimplemented by default, may be overridden.
    function deactivateForFund() external virtual override {
        return;
    }

    /// @notice Receives calls from ComptrollerLib.callOnExtension()
    /// and dispatches the appropriate action
    /// @dev Unimplemented by default, may be overridden.
    function receiveCallFromComptroller(
        address,
        uint256,
        bytes calldata
    ) external virtual override {
        revert("receiveCallFromComptroller: Unimplemented for Extension");
    }

    /// @notice Allows extension to run logic during fund configuration
    /// @dev Unimplemented by default, may be overridden.
    function setConfigForFund(
        address,
        address,
        bytes calldata
    ) external virtual override {
        return;
    }

    /// @dev Helper to store the validated ComptrollerProxy-VaultProxy relation
    function __setValidatedVaultProxy(address _comptrollerProxy, address _vaultProxy) internal {
        comptrollerProxyToVaultProxy[_comptrollerProxy] = _vaultProxy;

        emit ValidatedVaultProxySetForFund(_comptrollerProxy, _vaultProxy);
    }

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

    /// @notice Gets the verified VaultProxy for a given ComptrollerProxy
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @return vaultProxy_ The VaultProxy of the fund
    function getVaultProxyForFund(address _comptrollerProxy)
        public
        view
        returns (address vaultProxy_)
    {
        return comptrollerProxyToVaultProxy[_comptrollerProxy];
    }
}

File 19 of 23 : PermissionedVaultActionMixin.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/comptroller/IComptroller.sol";
import "../../core/fund/vault/IVault.sol";

/// @title PermissionedVaultActionMixin Contract
/// @author Enzyme Council <[email protected]>
/// @notice A mixin contract for extensions that can make permissioned vault calls
abstract contract PermissionedVaultActionMixin {
    /// @notice Adds an external position to active external positions
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _externalPosition The external position to be added
    function __addExternalPosition(address _comptrollerProxy, address _externalPosition) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.AddExternalPosition,
            abi.encode(_externalPosition)
        );
    }

    /// @notice Adds a tracked asset
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _asset The asset to add
    function __addTrackedAsset(address _comptrollerProxy, address _asset) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.AddTrackedAsset,
            abi.encode(_asset)
        );
    }

    /// @notice Grants an allowance to a spender to use a fund's asset
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _asset The asset for which to grant an allowance
    /// @param _target The spender of the allowance
    /// @param _amount The amount of the allowance
    function __approveAssetSpender(
        address _comptrollerProxy,
        address _asset,
        address _target,
        uint256 _amount
    ) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.ApproveAssetSpender,
            abi.encode(_asset, _target, _amount)
        );
    }

    /// @notice Burns fund shares for a particular account
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _target The account for which to burn shares
    /// @param _amount The amount of shares to burn
    function __burnShares(
        address _comptrollerProxy,
        address _target,
        uint256 _amount
    ) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.BurnShares,
            abi.encode(_target, _amount)
        );
    }

    /// @notice Executes a callOnExternalPosition
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _data The encoded data for the call
    function __callOnExternalPosition(address _comptrollerProxy, bytes memory _data) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.CallOnExternalPosition,
            _data
        );
    }

    /// @notice Mints fund shares to a particular account
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _target The account to which to mint shares
    /// @param _amount The amount of shares to mint
    function __mintShares(
        address _comptrollerProxy,
        address _target,
        uint256 _amount
    ) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.MintShares,
            abi.encode(_target, _amount)
        );
    }

    /// @notice Removes an external position from the vaultProxy
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _externalPosition The ExternalPosition to remove
    function __removeExternalPosition(address _comptrollerProxy, address _externalPosition)
        internal
    {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.RemoveExternalPosition,
            abi.encode(_externalPosition)
        );
    }

    /// @notice Removes a tracked asset
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _asset The asset to remove
    function __removeTrackedAsset(address _comptrollerProxy, address _asset) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.RemoveTrackedAsset,
            abi.encode(_asset)
        );
    }

    /// @notice Transfers fund shares from one account to another
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _from The account from which to transfer shares
    /// @param _to The account to which to transfer shares
    /// @param _amount The amount of shares to transfer
    function __transferShares(
        address _comptrollerProxy,
        address _from,
        address _to,
        uint256 _amount
    ) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.TransferShares,
            abi.encode(_from, _to, _amount)
        );
    }

    /// @notice Withdraws an asset from the VaultProxy to a given account
    /// @param _comptrollerProxy The ComptrollerProxy of the fund
    /// @param _asset The asset to withdraw
    /// @param _target The account to which to withdraw the asset
    /// @param _amount The amount of asset to withdraw
    function __withdrawAssetTo(
        address _comptrollerProxy,
        address _asset,
        address _target,
        uint256 _amount
    ) internal {
        IComptroller(_comptrollerProxy).permissionedVaultAction(
            IVault.VaultAction.WithdrawAssetTo,
            abi.encode(_asset, _target, _amount)
        );
    }
}

File 20 of 23 : 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 21 of 23 : AddressArrayLib.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 AddressArray Library
/// @author Enzyme Council <[email protected]>
/// @notice A library to extend the address array data type
library AddressArrayLib {
    /////////////
    // STORAGE //
    /////////////

    /// @dev Helper to remove an item from a storage array
    function removeStorageItem(address[] storage _self, address _itemToRemove)
        internal
        returns (bool removed_)
    {
        uint256 itemCount = _self.length;
        for (uint256 i; i < itemCount; i++) {
            if (_self[i] == _itemToRemove) {
                if (i < itemCount - 1) {
                    _self[i] = _self[itemCount - 1];
                }
                _self.pop();
                removed_ = true;
                break;
            }
        }

        return removed_;
    }

    ////////////
    // MEMORY //
    ////////////

    /// @dev Helper to add an item to an array. Does not assert uniqueness of the new item.
    function addItem(address[] memory _self, address _itemToAdd)
        internal
        pure
        returns (address[] memory nextArray_)
    {
        nextArray_ = new address[](_self.length + 1);
        for (uint256 i; i < _self.length; i++) {
            nextArray_[i] = _self[i];
        }
        nextArray_[_self.length] = _itemToAdd;

        return nextArray_;
    }

    /// @dev Helper to add an item to an array, only if it is not already in the array.
    function addUniqueItem(address[] memory _self, address _itemToAdd)
        internal
        pure
        returns (address[] memory nextArray_)
    {
        if (contains(_self, _itemToAdd)) {
            return _self;
        }

        return addItem(_self, _itemToAdd);
    }

    /// @dev Helper to verify if an array contains a particular value
    function contains(address[] memory _self, address _target)
        internal
        pure
        returns (bool doesContain_)
    {
        for (uint256 i; i < _self.length; i++) {
            if (_target == _self[i]) {
                return true;
            }
        }
        return false;
    }

    /// @dev Helper to merge the unique items of a second array.
    /// Does not consider uniqueness of either array, only relative uniqueness.
    /// Preserves ordering.
    function mergeArray(address[] memory _self, address[] memory _arrayToMerge)
        internal
        pure
        returns (address[] memory nextArray_)
    {
        uint256 newUniqueItemCount;
        for (uint256 i; i < _arrayToMerge.length; i++) {
            if (!contains(_self, _arrayToMerge[i])) {
                newUniqueItemCount++;
            }
        }

        if (newUniqueItemCount == 0) {
            return _self;
        }

        nextArray_ = new address[](_self.length + newUniqueItemCount);
        for (uint256 i; i < _self.length; i++) {
            nextArray_[i] = _self[i];
        }
        uint256 nextArrayIndex = _self.length;
        for (uint256 i; i < _arrayToMerge.length; i++) {
            if (!contains(_self, _arrayToMerge[i])) {
                nextArray_[nextArrayIndex] = _arrayToMerge[i];
                nextArrayIndex++;
            }
        }

        return nextArray_;
    }

    /// @dev Helper to verify if array is a set of unique values.
    /// Does not assert length > 0.
    function isUniqueSet(address[] memory _self) internal pure returns (bool isUnique_) {
        if (_self.length <= 1) {
            return true;
        }

        uint256 arrayLength = _self.length;
        for (uint256 i; i < arrayLength; i++) {
            for (uint256 j = i + 1; j < arrayLength; j++) {
                if (_self[i] == _self[j]) {
                    return false;
                }
            }
        }

        return true;
    }

    /// @dev Helper to remove items from an array. Removes all matching occurrences of each item.
    /// Does not assert uniqueness of either array.
    function removeItems(address[] memory _self, address[] memory _itemsToRemove)
        internal
        pure
        returns (address[] memory nextArray_)
    {
        if (_itemsToRemove.length == 0) {
            return _self;
        }

        bool[] memory indexesToRemove = new bool[](_self.length);
        uint256 remainingItemsCount = _self.length;
        for (uint256 i; i < _self.length; i++) {
            if (contains(_itemsToRemove, _self[i])) {
                indexesToRemove[i] = true;
                remainingItemsCount--;
            }
        }

        if (remainingItemsCount == _self.length) {
            nextArray_ = _self;
        } else if (remainingItemsCount > 0) {
            nextArray_ = new address[](remainingItemsCount);
            uint256 nextArrayIndex;
            for (uint256 i; i < _self.length; i++) {
                if (!indexesToRemove[i]) {
                    nextArray_[nextArrayIndex] = _self[i];
                    nextArrayIndex++;
                }
            }
        }

        return nextArray_;
    }
}

File 22 of 23 : AssetHelpers.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 "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

/// @title AssetHelpers Contract
/// @author Enzyme Council <[email protected]>
/// @notice A util contract for common token actions
abstract contract AssetHelpers {
    using SafeERC20 for ERC20;
    using SafeMath for uint256;

    /// @dev Helper to approve a target account with the max amount of an asset.
    /// This is helpful for fully trusted contracts, such as adapters that
    /// interact with external protocol like Uniswap, Compound, etc.
    function __approveAssetMaxAsNeeded(
        address _asset,
        address _target,
        uint256 _neededAmount
    ) internal {
        uint256 allowance = ERC20(_asset).allowance(address(this), _target);
        if (allowance < _neededAmount) {
            if (allowance > 0) {
                ERC20(_asset).safeApprove(_target, 0);
            }
            ERC20(_asset).safeApprove(_target, type(uint256).max);
        }
    }

    /// @dev Helper to transfer full asset balances from the current contract to a target
    function __pushFullAssetBalances(address _target, address[] memory _assets)
        internal
        returns (uint256[] memory amountsTransferred_)
    {
        amountsTransferred_ = new uint256[](_assets.length);
        for (uint256 i; i < _assets.length; i++) {
            ERC20 assetContract = ERC20(_assets[i]);
            amountsTransferred_[i] = assetContract.balanceOf(address(this));
            if (amountsTransferred_[i] > 0) {
                assetContract.safeTransfer(_target, amountsTransferred_[i]);
            }
        }

        return amountsTransferred_;
    }
}

File 23 of 23 : 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;
    }
}

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":"_policyManager","type":"address"},{"internalType":"address","name":"_valueInterpreter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"comptrollerProxy","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"adapter","type":"address"},{"indexed":true,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"bytes","name":"integrationData","type":"bytes"},{"indexed":false,"internalType":"address[]","name":"incomingAssets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"incomingAssetAmounts","type":"uint256[]"},{"indexed":false,"internalType":"address[]","name":"spendAssets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"spendAssetAmounts","type":"uint256[]"}],"name":"CallOnIntegrationExecutedForFund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"comptrollerProxy","type":"address"},{"indexed":true,"internalType":"address","name":"vaultProxy","type":"address"}],"name":"ValidatedVaultProxySetForFund","type":"event"},{"inputs":[{"internalType":"bool","name":"","type":"bool"}],"name":"activateForFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deactivateForFund","outputs":[],"stateMutability":"nonpayable","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":[],"name":"getPolicyManager","outputs":[{"internalType":"address","name":"policyManager_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getValueInterpreter","outputs":[{"internalType":"address","name":"valueInterpreter_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_comptrollerProxy","type":"address"}],"name":"getVaultProxyForFund","outputs":[{"internalType":"address","name":"vaultProxy_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"uint256","name":"_actionId","type":"uint256"},{"internalType":"bytes","name":"_callArgs","type":"bytes"}],"name":"receiveCallFromComptroller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_comptrollerProxy","type":"address"},{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"setConfigForFund","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e060405234801561001057600080fd5b506040516127233803806127238339818101604052606081101561003357600080fd5b50805160208201516040909201516001600160601b0319606092831b811660805292821b831660a052901b1660c05260805160601c60a05160601c60c05160601c61268761009c6000398061047952508061054f52508061049f528061052952506126876000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063893d20e811610066578063893d20e81461018657806397c0ac871461018e578063bd8e959a14610196578063d44ad6cb1461019e578063f067cc11146101a657610093565b80631bee801e14610098578063467903461461011d57806380d570631461015f578063875fb4b31461017e575b600080fd5b61011b600480360360608110156100ae57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156100dd57600080fd5b8201836020820111156100ef57600080fd5b803590602001918460018302840111600160201b8311171561011057600080fd5b50909250905061022d565b005b6101436004803603602081101561013357600080fd5b50356001600160a01b0316610453565b604080516001600160a01b039092168252519081900360200190f35b61011b6004803603602081101561017557600080fd5b50351515610474565b610143610477565b61014361049b565b610143610527565b61011b61054b565b61014361054d565b61011b600480360360608110156101bc57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156101ef57600080fd5b82018360208201111561020157600080fd5b803590602001918460018302840111600160201b8311171561022257600080fd5b509092509050610571565b33600061023982610453565b90506001600160a01b0381166102805760405162461bcd60e51b815260040180806020018281038252602d8152602001806125c2602d913960400191505060405180910390fd5b806001600160a01b031663714ca2d1876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156102cd57600080fd5b505afa1580156102e1573d6000803e3d6000fd5b505050506040513d60208110156102f757600080fd5b50516103345760405162461bcd60e51b81526004018080602001828103825260288152602001806125106028913960400191505060405180910390fd5b846103805761037b86838387878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105d892505050565b61044b565b84600114156103ca5761037b868386868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610aee92505050565b84600214156104145761037b868386868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610df192505050565b60405162461bcd60e51b815260040180806020018281038252602d8152602001806124b7602d913960400191505060405180910390fd5b505050505050565b6001600160a01b03808216600090815260208190526040902054165b919050565b50565b7f000000000000000000000000000000000000000000000000000000000000000090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663893d20e86040518163ffffffff1660e01b815260040160206040518083038186803b1580156104f657600080fd5b505afa15801561050a573d6000803e3d6000fd5b505050506040513d602081101561052057600080fd5b5051905090565b7f000000000000000000000000000000000000000000000000000000000000000090565b565b7f000000000000000000000000000000000000000000000000000000000000000090565b610579610527565b6001600160a01b0316336001600160a01b0316146105c85760405162461bcd60e51b815260040180806020018281038252602881526020018061259a6028913960400191505060405180910390fd5b6105d2848461101f565b50505050565b816001600160a01b0316635a53e3486040518163ffffffff1660e01b815260040160206040518083038186803b15801561061157600080fd5b505afa158015610625573d6000803e3d6000fd5b505050506040513d602081101561063b57600080fd5b50516001600160a01b038481169116146106865760405162461bcd60e51b815260040180806020018281038252602e815260200180612434602e913960400191505060405180910390fd5b600080606061069484611076565b9250925092506060806060806106ad8a8a898989611156565b93509350935093506106bd61054d565b6001600160a01b0316630442bad58b60018e8b8b8a8a8a8a60405160200180886001600160a01b03168152602001876001600160a01b03168152602001866001600160e01b031916815260200180602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561075257818101518382015260200161073a565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015610791578181015183820152602001610779565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156107d05781810151838201526020016107b8565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561080f5781810151838201526020016107f7565b505050509050019b5050505050505050505050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b0316815260200183600981111561086057fe5b815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561089e578181015183820152602001610886565b50505050905090810190601f1680156108cb5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156108ec57600080fd5b505af1158015610900573d6000803e3d6000fd5b50505050856001600160e01b031916876001600160a01b03168b6001600160a01b03167ff9a77e6aa0d5e80e8c932c9586e789fc0f4efe610f844fc982129c6f385bfffa8e898989898960405180876001600160a01b03168152602001806020018060200180602001806020018060200186810386528b818151815260200191508051906020019080838360005b838110156109a657818101518382015260200161098e565b50505050905090810190601f1680156109d35780820380516001836020036101000a031916815260200191505b5086810385528a5181528a51602091820191808d01910280838360005b83811015610a085781810151838201526020016109f0565b50505050905001868103845289818151815260200191508051906020019060200280838360005b83811015610a47578181015183820152602001610a2f565b50505050905001868103835288818151815260200191508051906020019060200280838360005b83811015610a86578181015183820152602001610a6e565b50505050905001868103825287818151815260200191508051906020019060200280838360005b83811015610ac5578181015183820152602001610aad565b505050509050019b50505050505050505050505060405180910390a45050505050505050505050565b6060818060200190516020811015610b0557600080fd5b8101908080516040519392919084600160201b821115610b2457600080fd5b908301906020820185811115610b3957600080fd5b82518660208202830111600160201b82111715610b5557600080fd5b82525081516020918201928201910280838360005b83811015610b82578181015183820152602001610b6a565b505050509050016040525050509050610b9961054d565b6001600160a01b0316630442bad5846004878560405160200180836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610bfe578181015183820152602001610be6565b5050505090500193505050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836009811115610c4757fe5b815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c85578181015183820152602001610c6d565b50505050905090810190601f168015610cb25780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610cd357600080fd5b505af1158015610ce7573d6000803e3d6000fd5b5050505060005b8151811015610dea57610cff610477565b6001600160a01b0316639be918e6838381518110610d1957fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610d5e57600080fd5b505afa158015610d72573d6000803e3d6000fd5b505050506040513d6020811015610d8857600080fd5b5051610dc55760405162461bcd60e51b815260040180806020018281038252602c81526020018061248b602c913960400191505060405180910390fd5b610de284838381518110610dd557fe5b60200260200101516112ab565b600101610cee565b5050505050565b6060818060200190516020811015610e0857600080fd5b8101908080516040519392919084600160201b821115610e2757600080fd5b908301906020820185811115610e3c57600080fd5b82518660208202830111600160201b82111715610e5857600080fd5b82525081516020918201928201910280838360005b83811015610e85578181015183820152602001610e6d565b505050509050016040525050509050610e9c61054d565b6001600160a01b0316630442bad5846005878560405160200180836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610f01578181015183820152602001610ee9565b5050505090500193505050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836009811115610f4a57fe5b815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610f88578181015183820152602001610f70565b50505050905090810190601f168015610fb55780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610fd657600080fd5b505af1158015610fea573d6000803e3d6000fd5b5050505060005b8151811015610dea576110178483838151811061100a57fe5b6020026020010151611391565b600101610ff1565b6001600160a01b0382811660008181526020819052604080822080546001600160a01b0319169486169485179055517f8852dcaa71340ea616a65ffac013450dfb238607481fb9d78346c667fe256c139190a35050565b600080606083806020019051606081101561109057600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156110ba57600080fd5b9083019060208201858111156110cf57600080fd5b8251600160201b8111828201881017156110e857600080fd5b82525081516020918201929091019080838360005b838110156111155781810151838201526020016110fd565b50505050905090810190601f1680156111425780820380516001836020036101000a031916815260200191505b506040525050509250925092509193909250565b60608060608060608060006060806111718e8e8e8e8e6113dc565b809750819850829d50839950849a50859b50869f50505050505050506112838d8d8d8d8b878f60405160200180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156111e25781810151838201526020016111ca565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015611221578181015183820152602001611209565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015611260578181015183820152602001611248565b505050509050019650505050505050604051602081830303815290604052611b98565b6112958e8e8e8c8989898e8a8a611df3565b9098509550505050505095509550955095915050565b604080516001600160a01b0383811660208084019190915283518084039091018152828401938490526310acd06d60e01b9093528416916310acd06d916004919060440180835b815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611330578181015183820152602001611318565b50505050905090810190601f16801561135d5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561137d57600080fd5b505af115801561044b573d6000803e3d6000fd5b604080516001600160a01b0383811660208084019190915283518084039091018152828401938490526310acd06d60e01b9093528416916310acd06d916006919060440180836112f2565b606080606060006060806060896001600160a01b031663c54efee58c8b8b6040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160e01b031916815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561146557818101518382015260200161144d565b50505050905090810190601f1680156114925780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038186803b1580156114b157600080fd5b505afa1580156114c5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a08110156114ee57600080fd5b815160208301805160405192949293830192919084600160201b82111561151457600080fd5b90830190602082018581111561152957600080fd5b82518660208202830111600160201b8211171561154557600080fd5b82525081516020918201928201910280838360005b8381101561157257818101518382015260200161155a565b5050505090500160405260200180516040519392919084600160201b82111561159a57600080fd5b9083019060208201858111156115af57600080fd5b82518660208202830111600160201b821117156115cb57600080fd5b82525081516020918201928201910280838360005b838110156115f85781810151838201526020016115e0565b5050505090500160405260200180516040519392919084600160201b82111561162057600080fd5b90830190602082018581111561163557600080fd5b82518660208202830111600160201b8211171561165157600080fd5b82525081516020918201928201910280838360005b8381101561167e578181015183820152602001611666565b5050505090500160405260200180516040519392919084600160201b8211156116a657600080fd5b9083019060208201858111156116bb57600080fd5b82518660208202830111600160201b821117156116d757600080fd5b82525081516020918201928201910280838360005b838110156117045781810151838201526020016116ec565b5050505091909101604052505084518651949e50929b5095995093975091955014915061176490505760405162461bcd60e51b815260040180806020018281038252602c8152602001806124e4602c913960400191505060405180910390fd5b84518751146117a45760405162461bcd60e51b815260040180806020018281038252602f8152602001806125ef602f913960400191505060405180910390fd5b6117ad83612149565b6117e85760405162461bcd60e51b81526004018080602001828103825260268152602001806125386026913960400191505060405180910390fd5b6117f187612149565b61182c5760405162461bcd60e51b81526004018080602001828103825260298152602001806124626029913960400191505060405180910390fd5b865167ffffffffffffffff8111801561184457600080fd5b5060405190808252806020026020018201604052801561186e578160200160208202803683370190505b50955060005b87518110156119f857611885610477565b6001600160a01b0316639be918e689838151811061189f57fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156118e457600080fd5b505afa1580156118f8573d6000803e3d6000fd5b505050506040513d602081101561190e57600080fd5b505161194b5760405162461bcd60e51b815260040180806020018281038252602e815260200180612406602e913960400191505060405180910390fd5b87818151811061195757fe5b60200260200101516001600160a01b03166370a082318d6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156119ab57600080fd5b505afa1580156119bf573d6000803e3d6000fd5b505050506040513d60208110156119d557600080fd5b505187518890839081106119e557fe5b6020908102919091010152600101611874565b50825167ffffffffffffffff81118015611a1157600080fd5b50604051908082528060200260200182016040528015611a3b578160200160208202803683370190505b50905060005b8351811015611b8857838181518110611a5657fe5b60200260200101516001600160a01b03166370a082318d6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611aaa57600080fd5b505afa158015611abe573d6000803e3d6000fd5b505050506040513d6020811015611ad457600080fd5b50518251839083908110611ae457fe5b60209081029190910101526001856002811115611afd57fe5b1415611b3a57611b358d858381518110611b1357fe5b60200260200101518d868581518110611b2857fe5b60200260200101516121dd565b611b80565b6002856002811115611b4857fe5b1415611b8057611b808d858381518110611b5e57fe5b60200260200101518d868581518110611b7357fe5b60200260200101516122cf565b600101611a41565b50959b949a509550955095509550565b60006060856001600160a01b03168588868660405160240180846001600160a01b031681526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015611bfd578181015183820152602001611be5565b50505050905090810190601f168015611c2a5780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b83811015611c5d578181015183820152602001611c45565b50505050905090810190601f168015611c8a5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909a16999099178952518151919890975087965094509250829150849050835b60208310611cf25780518252601f199092019160209182019101611cd3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611d54576040519150601f19603f3d011682016040523d82523d6000602084013e611d59565b606091505b5091509150818190611de95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611dae578181015183820152602001611d96565b50505050905090810190601f168015611ddb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5050505050505050565b606080885167ffffffffffffffff81118015611e0e57600080fd5b50604051908082528060200260200182016040528015611e38578160200160208202803683370190505b50915060005b8951811015611f1657611e81898281518110611e5657fe5b6020026020010151611e7b8e8d8581518110611e6e57fe5b6020026020010151612326565b906123a8565b838281518110611e8d57fe5b602002602001018181525050878181518110611ea557fe5b6020026020010151838281518110611eb957fe5b60200260200101511015611efe5760405162461bcd60e51b815260040180806020018281038252603c81526020018061255e603c913960400191505060405180910390fd5b611f0e8d8b8381518110610dd557fe5b600101611e3e565b50845167ffffffffffffffff81118015611f2f57600080fd5b50604051908082528060200260200182016040528015611f59578160200160208202803683370190505b50905060005b8551811015612139576000611f7a8d888481518110611e6e57fe5b9050848281518110611f8857fe5b6020026020010151811015611fd657611fbd81868481518110611fa757fe5b60200260200101516123a890919063ffffffff16565b838381518110611fc957fe5b6020026020010181815250505b6001886002811115611fe457fe5b14801561208d57506000878381518110611ffa57fe5b60200260200101516001600160a01b031663dd62ed3e8f8f6040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561205f57600080fd5b505afa158015612073573d6000803e3d6000fd5b505050506040513d602081101561208957600080fd5b5051115b156120b7576120b28e8884815181106120a257fe5b60200260200101518e60006121dd565b612130565b60008860028111156120c557fe5b1415612130578582815181106120d757fe5b60200260200101518383815181106120eb57fe5b602002602001015111156121305760405162461bcd60e51b815260040180806020018281038252603481526020018061261e6034913960400191505060405180910390fd5b50600101611f5f565b509a509a98505050505050505050565b6000600182511161215c5750600161046f565b815160005b818110156121d357600181015b828110156121ca5784818151811061218257fe5b60200260200101516001600160a01b031685838151811061219f57fe5b60200260200101516001600160a01b031614156121c2576000935050505061046f565b60010161216e565b50600101612161565b5060019392505050565b604080516001600160a01b0385811660208301528481168284015260608083018590528351808403909101815260808301938490526310acd06d60e01b9093528616916310acd06d916005919060840180835b815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561226e578181015183820152602001612256565b50505050905090810190601f16801561229b5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156122bb57600080fd5b505af1158015611de9573d6000803e3d6000fd5b604080516001600160a01b0385811660208301528481168284015260608083018590528351808403909101815260808301938490526310acd06d60e01b9093528616916310acd06d91600791906084018083612230565b6000816001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561237557600080fd5b505afa158015612389573d6000803e3d6000fd5b505050506040513d602081101561239f57600080fd5b50519392505050565b6000828211156123ff576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe5f5f70726550726f63657373436f493a204e6f6e2d72656365697661626c6520696e636f6d696e672061737365747265636569766543616c6c46726f6d436f6d7074726f6c6c65723a2046756e64206973206e6f74206163746976655f5f70726550726f63657373436f493a204475706c696361746520696e636f6d696e672061737365745f5f616464547261636b6564417373657473546f5661756c743a20556e737570706f727465642061737365747265636569766543616c6c46726f6d436f6d7074726f6c6c65723a20496e76616c6964205f616374696f6e49645f5f70726550726f63657373436f493a205370656e64206173736574732061727261797320756e657175616c7265636569766543616c6c46726f6d436f6d7074726f6c6c65723a20556e617574686f72697a65645f5f70726550726f63657373436f493a204475706c6963617465207370656e642061737365745f5f706f737450726f63657373436f493a20526563656976656420696e636f6d696e67206173736574206c657373207468616e2065787065637465644f6e6c79207468652046756e644465706c6f7965722063616e206d616b6520746869732063616c6c7265636569766543616c6c46726f6d436f6d7074726f6c6c65723a2046756e64206973206e6f742076616c69645f5f70726550726f63657373436f493a20496e636f6d696e67206173736574732061727261797320756e657175616c5f5f706f737450726f63657373436f493a205370656e7420616d6f756e742067726561746572207468616e206578706563746564a2646970667358221220a9e3e82f894316236e28e9041cb9fa991275171ae45a7a6328db9d6b7760ba5764736f6c634300060c00330000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360000000000000000000000000adf5a8db090627b153ef0c5726ccfdc1c7aed7bd000000000000000000000000d7b0610db501b15bfb9b7ddad8b3869de262a327

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063893d20e811610066578063893d20e81461018657806397c0ac871461018e578063bd8e959a14610196578063d44ad6cb1461019e578063f067cc11146101a657610093565b80631bee801e14610098578063467903461461011d57806380d570631461015f578063875fb4b31461017e575b600080fd5b61011b600480360360608110156100ae57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156100dd57600080fd5b8201836020820111156100ef57600080fd5b803590602001918460018302840111600160201b8311171561011057600080fd5b50909250905061022d565b005b6101436004803603602081101561013357600080fd5b50356001600160a01b0316610453565b604080516001600160a01b039092168252519081900360200190f35b61011b6004803603602081101561017557600080fd5b50351515610474565b610143610477565b61014361049b565b610143610527565b61011b61054b565b61014361054d565b61011b600480360360608110156101bc57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156101ef57600080fd5b82018360208201111561020157600080fd5b803590602001918460018302840111600160201b8311171561022257600080fd5b509092509050610571565b33600061023982610453565b90506001600160a01b0381166102805760405162461bcd60e51b815260040180806020018281038252602d8152602001806125c2602d913960400191505060405180910390fd5b806001600160a01b031663714ca2d1876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156102cd57600080fd5b505afa1580156102e1573d6000803e3d6000fd5b505050506040513d60208110156102f757600080fd5b50516103345760405162461bcd60e51b81526004018080602001828103825260288152602001806125106028913960400191505060405180910390fd5b846103805761037b86838387878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105d892505050565b61044b565b84600114156103ca5761037b868386868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610aee92505050565b84600214156104145761037b868386868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610df192505050565b60405162461bcd60e51b815260040180806020018281038252602d8152602001806124b7602d913960400191505060405180910390fd5b505050505050565b6001600160a01b03808216600090815260208190526040902054165b919050565b50565b7f000000000000000000000000d7b0610db501b15bfb9b7ddad8b3869de262a32790565b60007f0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc63606001600160a01b031663893d20e86040518163ffffffff1660e01b815260040160206040518083038186803b1580156104f657600080fd5b505afa15801561050a573d6000803e3d6000fd5b505050506040513d602081101561052057600080fd5b5051905090565b7f0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc636090565b565b7f000000000000000000000000adf5a8db090627b153ef0c5726ccfdc1c7aed7bd90565b610579610527565b6001600160a01b0316336001600160a01b0316146105c85760405162461bcd60e51b815260040180806020018281038252602881526020018061259a6028913960400191505060405180910390fd5b6105d2848461101f565b50505050565b816001600160a01b0316635a53e3486040518163ffffffff1660e01b815260040160206040518083038186803b15801561061157600080fd5b505afa158015610625573d6000803e3d6000fd5b505050506040513d602081101561063b57600080fd5b50516001600160a01b038481169116146106865760405162461bcd60e51b815260040180806020018281038252602e815260200180612434602e913960400191505060405180910390fd5b600080606061069484611076565b9250925092506060806060806106ad8a8a898989611156565b93509350935093506106bd61054d565b6001600160a01b0316630442bad58b60018e8b8b8a8a8a8a60405160200180886001600160a01b03168152602001876001600160a01b03168152602001866001600160e01b031916815260200180602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561075257818101518382015260200161073a565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015610791578181015183820152602001610779565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156107d05781810151838201526020016107b8565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561080f5781810151838201526020016107f7565b505050509050019b5050505050505050505050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b0316815260200183600981111561086057fe5b815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561089e578181015183820152602001610886565b50505050905090810190601f1680156108cb5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156108ec57600080fd5b505af1158015610900573d6000803e3d6000fd5b50505050856001600160e01b031916876001600160a01b03168b6001600160a01b03167ff9a77e6aa0d5e80e8c932c9586e789fc0f4efe610f844fc982129c6f385bfffa8e898989898960405180876001600160a01b03168152602001806020018060200180602001806020018060200186810386528b818151815260200191508051906020019080838360005b838110156109a657818101518382015260200161098e565b50505050905090810190601f1680156109d35780820380516001836020036101000a031916815260200191505b5086810385528a5181528a51602091820191808d01910280838360005b83811015610a085781810151838201526020016109f0565b50505050905001868103845289818151815260200191508051906020019060200280838360005b83811015610a47578181015183820152602001610a2f565b50505050905001868103835288818151815260200191508051906020019060200280838360005b83811015610a86578181015183820152602001610a6e565b50505050905001868103825287818151815260200191508051906020019060200280838360005b83811015610ac5578181015183820152602001610aad565b505050509050019b50505050505050505050505060405180910390a45050505050505050505050565b6060818060200190516020811015610b0557600080fd5b8101908080516040519392919084600160201b821115610b2457600080fd5b908301906020820185811115610b3957600080fd5b82518660208202830111600160201b82111715610b5557600080fd5b82525081516020918201928201910280838360005b83811015610b82578181015183820152602001610b6a565b505050509050016040525050509050610b9961054d565b6001600160a01b0316630442bad5846004878560405160200180836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610bfe578181015183820152602001610be6565b5050505090500193505050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836009811115610c4757fe5b815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c85578181015183820152602001610c6d565b50505050905090810190601f168015610cb25780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610cd357600080fd5b505af1158015610ce7573d6000803e3d6000fd5b5050505060005b8151811015610dea57610cff610477565b6001600160a01b0316639be918e6838381518110610d1957fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610d5e57600080fd5b505afa158015610d72573d6000803e3d6000fd5b505050506040513d6020811015610d8857600080fd5b5051610dc55760405162461bcd60e51b815260040180806020018281038252602c81526020018061248b602c913960400191505060405180910390fd5b610de284838381518110610dd557fe5b60200260200101516112ab565b600101610cee565b5050505050565b6060818060200190516020811015610e0857600080fd5b8101908080516040519392919084600160201b821115610e2757600080fd5b908301906020820185811115610e3c57600080fd5b82518660208202830111600160201b82111715610e5857600080fd5b82525081516020918201928201910280838360005b83811015610e85578181015183820152602001610e6d565b505050509050016040525050509050610e9c61054d565b6001600160a01b0316630442bad5846005878560405160200180836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610f01578181015183820152602001610ee9565b5050505090500193505050506040516020818303038152906040526040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836009811115610f4a57fe5b815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610f88578181015183820152602001610f70565b50505050905090810190601f168015610fb55780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610fd657600080fd5b505af1158015610fea573d6000803e3d6000fd5b5050505060005b8151811015610dea576110178483838151811061100a57fe5b6020026020010151611391565b600101610ff1565b6001600160a01b0382811660008181526020819052604080822080546001600160a01b0319169486169485179055517f8852dcaa71340ea616a65ffac013450dfb238607481fb9d78346c667fe256c139190a35050565b600080606083806020019051606081101561109057600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156110ba57600080fd5b9083019060208201858111156110cf57600080fd5b8251600160201b8111828201881017156110e857600080fd5b82525081516020918201929091019080838360005b838110156111155781810151838201526020016110fd565b50505050905090810190601f1680156111425780820380516001836020036101000a031916815260200191505b506040525050509250925092509193909250565b60608060608060608060006060806111718e8e8e8e8e6113dc565b809750819850829d50839950849a50859b50869f50505050505050506112838d8d8d8d8b878f60405160200180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156111e25781810151838201526020016111ca565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015611221578181015183820152602001611209565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015611260578181015183820152602001611248565b505050509050019650505050505050604051602081830303815290604052611b98565b6112958e8e8e8c8989898e8a8a611df3565b9098509550505050505095509550955095915050565b604080516001600160a01b0383811660208084019190915283518084039091018152828401938490526310acd06d60e01b9093528416916310acd06d916004919060440180835b815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611330578181015183820152602001611318565b50505050905090810190601f16801561135d5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561137d57600080fd5b505af115801561044b573d6000803e3d6000fd5b604080516001600160a01b0383811660208084019190915283518084039091018152828401938490526310acd06d60e01b9093528416916310acd06d916006919060440180836112f2565b606080606060006060806060896001600160a01b031663c54efee58c8b8b6040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160e01b031916815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561146557818101518382015260200161144d565b50505050905090810190601f1680156114925780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038186803b1580156114b157600080fd5b505afa1580156114c5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a08110156114ee57600080fd5b815160208301805160405192949293830192919084600160201b82111561151457600080fd5b90830190602082018581111561152957600080fd5b82518660208202830111600160201b8211171561154557600080fd5b82525081516020918201928201910280838360005b8381101561157257818101518382015260200161155a565b5050505090500160405260200180516040519392919084600160201b82111561159a57600080fd5b9083019060208201858111156115af57600080fd5b82518660208202830111600160201b821117156115cb57600080fd5b82525081516020918201928201910280838360005b838110156115f85781810151838201526020016115e0565b5050505090500160405260200180516040519392919084600160201b82111561162057600080fd5b90830190602082018581111561163557600080fd5b82518660208202830111600160201b8211171561165157600080fd5b82525081516020918201928201910280838360005b8381101561167e578181015183820152602001611666565b5050505090500160405260200180516040519392919084600160201b8211156116a657600080fd5b9083019060208201858111156116bb57600080fd5b82518660208202830111600160201b821117156116d757600080fd5b82525081516020918201928201910280838360005b838110156117045781810151838201526020016116ec565b5050505091909101604052505084518651949e50929b5095995093975091955014915061176490505760405162461bcd60e51b815260040180806020018281038252602c8152602001806124e4602c913960400191505060405180910390fd5b84518751146117a45760405162461bcd60e51b815260040180806020018281038252602f8152602001806125ef602f913960400191505060405180910390fd5b6117ad83612149565b6117e85760405162461bcd60e51b81526004018080602001828103825260268152602001806125386026913960400191505060405180910390fd5b6117f187612149565b61182c5760405162461bcd60e51b81526004018080602001828103825260298152602001806124626029913960400191505060405180910390fd5b865167ffffffffffffffff8111801561184457600080fd5b5060405190808252806020026020018201604052801561186e578160200160208202803683370190505b50955060005b87518110156119f857611885610477565b6001600160a01b0316639be918e689838151811061189f57fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156118e457600080fd5b505afa1580156118f8573d6000803e3d6000fd5b505050506040513d602081101561190e57600080fd5b505161194b5760405162461bcd60e51b815260040180806020018281038252602e815260200180612406602e913960400191505060405180910390fd5b87818151811061195757fe5b60200260200101516001600160a01b03166370a082318d6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156119ab57600080fd5b505afa1580156119bf573d6000803e3d6000fd5b505050506040513d60208110156119d557600080fd5b505187518890839081106119e557fe5b6020908102919091010152600101611874565b50825167ffffffffffffffff81118015611a1157600080fd5b50604051908082528060200260200182016040528015611a3b578160200160208202803683370190505b50905060005b8351811015611b8857838181518110611a5657fe5b60200260200101516001600160a01b03166370a082318d6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611aaa57600080fd5b505afa158015611abe573d6000803e3d6000fd5b505050506040513d6020811015611ad457600080fd5b50518251839083908110611ae457fe5b60209081029190910101526001856002811115611afd57fe5b1415611b3a57611b358d858381518110611b1357fe5b60200260200101518d868581518110611b2857fe5b60200260200101516121dd565b611b80565b6002856002811115611b4857fe5b1415611b8057611b808d858381518110611b5e57fe5b60200260200101518d868581518110611b7357fe5b60200260200101516122cf565b600101611a41565b50959b949a509550955095509550565b60006060856001600160a01b03168588868660405160240180846001600160a01b031681526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015611bfd578181015183820152602001611be5565b50505050905090810190601f168015611c2a5780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b83811015611c5d578181015183820152602001611c45565b50505050905090810190601f168015611c8a5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909a16999099178952518151919890975087965094509250829150849050835b60208310611cf25780518252601f199092019160209182019101611cd3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611d54576040519150601f19603f3d011682016040523d82523d6000602084013e611d59565b606091505b5091509150818190611de95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611dae578181015183820152602001611d96565b50505050905090810190601f168015611ddb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5050505050505050565b606080885167ffffffffffffffff81118015611e0e57600080fd5b50604051908082528060200260200182016040528015611e38578160200160208202803683370190505b50915060005b8951811015611f1657611e81898281518110611e5657fe5b6020026020010151611e7b8e8d8581518110611e6e57fe5b6020026020010151612326565b906123a8565b838281518110611e8d57fe5b602002602001018181525050878181518110611ea557fe5b6020026020010151838281518110611eb957fe5b60200260200101511015611efe5760405162461bcd60e51b815260040180806020018281038252603c81526020018061255e603c913960400191505060405180910390fd5b611f0e8d8b8381518110610dd557fe5b600101611e3e565b50845167ffffffffffffffff81118015611f2f57600080fd5b50604051908082528060200260200182016040528015611f59578160200160208202803683370190505b50905060005b8551811015612139576000611f7a8d888481518110611e6e57fe5b9050848281518110611f8857fe5b6020026020010151811015611fd657611fbd81868481518110611fa757fe5b60200260200101516123a890919063ffffffff16565b838381518110611fc957fe5b6020026020010181815250505b6001886002811115611fe457fe5b14801561208d57506000878381518110611ffa57fe5b60200260200101516001600160a01b031663dd62ed3e8f8f6040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561205f57600080fd5b505afa158015612073573d6000803e3d6000fd5b505050506040513d602081101561208957600080fd5b5051115b156120b7576120b28e8884815181106120a257fe5b60200260200101518e60006121dd565b612130565b60008860028111156120c557fe5b1415612130578582815181106120d757fe5b60200260200101518383815181106120eb57fe5b602002602001015111156121305760405162461bcd60e51b815260040180806020018281038252603481526020018061261e6034913960400191505060405180910390fd5b50600101611f5f565b509a509a98505050505050505050565b6000600182511161215c5750600161046f565b815160005b818110156121d357600181015b828110156121ca5784818151811061218257fe5b60200260200101516001600160a01b031685838151811061219f57fe5b60200260200101516001600160a01b031614156121c2576000935050505061046f565b60010161216e565b50600101612161565b5060019392505050565b604080516001600160a01b0385811660208301528481168284015260608083018590528351808403909101815260808301938490526310acd06d60e01b9093528616916310acd06d916005919060840180835b815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561226e578181015183820152602001612256565b50505050905090810190601f16801561229b5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156122bb57600080fd5b505af1158015611de9573d6000803e3d6000fd5b604080516001600160a01b0385811660208301528481168284015260608083018590528351808403909101815260808301938490526310acd06d60e01b9093528616916310acd06d91600791906084018083612230565b6000816001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561237557600080fd5b505afa158015612389573d6000803e3d6000fd5b505050506040513d602081101561239f57600080fd5b50519392505050565b6000828211156123ff576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe5f5f70726550726f63657373436f493a204e6f6e2d72656365697661626c6520696e636f6d696e672061737365747265636569766543616c6c46726f6d436f6d7074726f6c6c65723a2046756e64206973206e6f74206163746976655f5f70726550726f63657373436f493a204475706c696361746520696e636f6d696e672061737365745f5f616464547261636b6564417373657473546f5661756c743a20556e737570706f727465642061737365747265636569766543616c6c46726f6d436f6d7074726f6c6c65723a20496e76616c6964205f616374696f6e49645f5f70726550726f63657373436f493a205370656e64206173736574732061727261797320756e657175616c7265636569766543616c6c46726f6d436f6d7074726f6c6c65723a20556e617574686f72697a65645f5f70726550726f63657373436f493a204475706c6963617465207370656e642061737365745f5f706f737450726f63657373436f493a20526563656976656420696e636f6d696e67206173736574206c657373207468616e2065787065637465644f6e6c79207468652046756e644465706c6f7965722063616e206d616b6520746869732063616c6c7265636569766543616c6c46726f6d436f6d7074726f6c6c65723a2046756e64206973206e6f742076616c69645f5f70726550726f63657373436f493a20496e636f6d696e67206173736574732061727261797320756e657175616c5f5f706f737450726f63657373436f493a205370656e7420616d6f756e742067726561746572207468616e206578706563746564a2646970667358221220a9e3e82f894316236e28e9041cb9fa991275171ae45a7a6328db9d6b7760ba5764736f6c634300060c0033

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

0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360000000000000000000000000adf5a8db090627b153ef0c5726ccfdc1c7aed7bd000000000000000000000000d7b0610db501b15bfb9b7ddad8b3869de262a327

-----Decoded View---------------
Arg [0] : _fundDeployer (address): 0x4f1C53F096533C04d8157EFB6Bca3eb22ddC6360
Arg [1] : _policyManager (address): 0xADF5A8DB090627b153Ef0c5726ccfdc1c7aED7bd
Arg [2] : _valueInterpreter (address): 0xD7B0610dB501b15Bfb9B7DDad8b3869de262a327

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000004f1c53f096533c04d8157efb6bca3eb22ddc6360
Arg [1] : 000000000000000000000000adf5a8db090627b153ef0c5726ccfdc1c7aed7bd
Arg [2] : 000000000000000000000000d7b0610db501b15bfb9b7ddad8b3869de262a327


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.