ETH Price: $3,303.79 (-3.56%)
Gas: 7 Gwei

Contract

0x6C62b8F7b2fd1c60fFD3Afc1A2B15d4318745677
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60c06040172780912023-05-17 8:11:11413 days ago1684311071IN
 Create: OneInchV5Adapter
0 ETH0.0862302343.56606773

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OneInchV5Adapter

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
No with 200 runs

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

/*
    This file is part of the Enzyme Protocol.

    (c) Enzyme Council <[email protected]>

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

pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "../../../../utils/AddressArrayLib.sol";
import "../utils/actions/OneInchV5ActionsMixin.sol";
import "../utils/AdapterBase.sol";

/// @title OneInchV5Adapter Contract
/// @author Enzyme Council <[email protected]>
/// @notice Adapter for interacting with OneInch V5
contract OneInchV5Adapter is AdapterBase, OneInchV5ActionsMixin {
    using AddressArrayLib for address[];

    event MultipleOrdersItemFailed(uint256 index, bytes reason);

    constructor(address _integrationManager, address _oneInchV5Exchange)
        public
        AdapterBase(_integrationManager)
        OneInchV5ActionsMixin(_oneInchV5Exchange)
    {}

    /////////////
    // ACTIONS //
    /////////////

    /// @notice Executes multiple trades on OneInch
    /// @param _vaultProxy The VaultProxy of the calling fund
    /// @param _actionData Data specific to this action
    /// @param _assetData Parsed spend assets and incoming assets data for this action
    function takeMultipleOrders(
        address _vaultProxy,
        bytes calldata _actionData,
        bytes calldata _assetData
    ) external postActionSpendAssetsTransferHandler(_vaultProxy, _assetData) {
        (bytes[] memory ordersData, bool allowOrdersToFail) = __decodeTakeMultipleOrdersCallArgs(
            _actionData
        );

        if (allowOrdersToFail) {
            for (uint256 i; i < ordersData.length; i++) {
                try this.takeOrderAndValidateIncoming(_vaultProxy, ordersData[i]) {} catch (
                    bytes memory reason
                ) {
                    emit MultipleOrdersItemFailed(i, reason);
                }
            }
        } else {
            for (uint256 i; i < ordersData.length; i++) {
                __takeOrderAndValidateIncoming(_vaultProxy, ordersData[i]);
            }
        }
    }

    /// @notice Trades assets on OneInch
    /// @param _vaultProxy The VaultProxy of the calling fund
    /// @param _actionData Data specific to this action
    /// @param _assetData Parsed spend assets and incoming assets data for this action
    function takeOrder(
        address _vaultProxy,
        bytes calldata _actionData,
        bytes calldata _assetData
    ) external postActionSpendAssetsTransferHandler(_vaultProxy, _assetData) {
        __takeOrder({_orderData: _actionData});
    }

    /// @notice External implementation of __takeOrderAndValidateIncoming(), only intended for internal usage
    /// @dev Necessary for try/catch
    function takeOrderAndValidateIncoming(address _vaultProxy, bytes calldata _orderData)
        external
    {
        __takeOrderAndValidateIncoming(_vaultProxy, _orderData);
    }

    /// @dev Helper to route an order according to its swap type
    function __takeOrder(bytes memory _orderData) private {
        (
            address executor,
            IOneInchV5AggregationRouter.SwapDescription memory swapDescription,
            bytes memory data
        ) = __decodeTakeOrderCallArgs(_orderData);

        __oneInchV5Swap({_executor: executor, _description: swapDescription, _data: data});
    }

    /// @dev Helper to trade assets on OneInch and then validate the received asset amount.
    /// The validation is probably unnecessary since OneInch validates the min amount,
    /// but it is consistent with the practice of doing all validations internally also,
    /// which is bypassed during the actions that call this function.
    function __takeOrderAndValidateIncoming(address _vaultProxy, bytes memory _orderData) private {
        (
            ,
            IOneInchV5AggregationRouter.SwapDescription memory swapDescription,

        ) = __decodeTakeOrderCallArgs(_orderData);

        uint256 preIncomingAssetBal = ERC20(swapDescription.dstToken).balanceOf(_vaultProxy);

        __takeOrder({_orderData: _orderData});

        require(
            ERC20(swapDescription.dstToken).balanceOf(_vaultProxy).sub(preIncomingAssetBal) >=
                swapDescription.minReturnAmount,
            "__takeOrderAndValidateIncoming: Received incoming asset less than expected"
        );
    }

    /////////////////////////////
    // PARSE ASSETS FOR ACTION //
    /////////////////////////////

    /// @notice Parses the expected assets in a particular action
    /// @param _vaultProxy The VaultProxy of the calling fund
    /// @param _selector The function selector for the callOnIntegration
    /// @param _actionData Data specific to this action
    /// @return spendAssetsHandleType_ A type that dictates how to handle granting
    /// the adapter access to spend assets (`None` by default)
    /// @return spendAssets_ The assets to spend in the call
    /// @return spendAssetAmounts_ The max asset amounts to spend in the call
    /// @return incomingAssets_ The assets to receive in the call
    /// @return minIncomingAssetAmounts_ The min asset amounts to receive in the call
    function parseAssetsForAction(
        address _vaultProxy,
        bytes4 _selector,
        bytes calldata _actionData
    )
        external
        view
        override
        returns (
            IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_,
            address[] memory spendAssets_,
            uint256[] memory spendAssetAmounts_,
            address[] memory incomingAssets_,
            uint256[] memory minIncomingAssetAmounts_
        )
    {
        if (_selector == TAKE_ORDER_SELECTOR) {
            spendAssets_ = new address[](1);
            spendAssetAmounts_ = new uint256[](1);
            incomingAssets_ = new address[](1);
            minIncomingAssetAmounts_ = new uint256[](1);

            (
                ,
                IOneInchV5AggregationRouter.SwapDescription memory swapDescription,

            ) = __decodeTakeOrderCallArgs(_actionData);

            require(
                _vaultProxy == swapDescription.dstReceiver,
                "parseAssetsForAction: invalid dstReceiver"
            );

            spendAssets_[0] = swapDescription.srcToken;
            spendAssetAmounts_[0] = swapDescription.amount;
            incomingAssets_[0] = swapDescription.dstToken;
            minIncomingAssetAmounts_[0] = swapDescription.minReturnAmount;
        } else if (_selector == TAKE_MULTIPLE_ORDERS_SELECTOR) {
            (bytes[] memory ordersData, ) = __decodeTakeMultipleOrdersCallArgs(_actionData);

            spendAssets_ = new address[](ordersData.length);
            spendAssetAmounts_ = new uint256[](ordersData.length);
            for (uint256 i; i < ordersData.length; i++) {
                (
                    ,
                    IOneInchV5AggregationRouter.SwapDescription memory swapDescription,

                ) = __decodeTakeOrderCallArgs(ordersData[i]);

                require(
                    _vaultProxy == swapDescription.dstReceiver,
                    "parseAssetsForAction: invalid dstReceiver"
                );

                spendAssets_[i] = swapDescription.srcToken;
                spendAssetAmounts_[i] = swapDescription.amount;
                incomingAssets_ = incomingAssets_.addUniqueItem(swapDescription.dstToken);
            }

            (spendAssets_, spendAssetAmounts_) = __aggregateAssetAmounts(
                spendAssets_,
                spendAssetAmounts_
            );

            // Ignores the IntegrationManager's incoming asset amount validations in order
            // to support optional order failure bypass,
            // and also due to min amounts being more of a per-order validation
            // (see __takeOrderAndValidateIncoming() for inline validation)
            minIncomingAssetAmounts_ = new uint256[](incomingAssets_.length);
        } else {
            revert("parseAssetsForAction: _selector invalid");
        }

        return (
            IIntegrationManager.SpendAssetsHandleType.Transfer,
            spendAssets_,
            spendAssetAmounts_,
            incomingAssets_,
            minIncomingAssetAmounts_
        );
    }

    //////////////
    // DECODERS //
    //////////////

    /// @dev Helper to decode the encoded callOnIntegration call arguments for takeOrder()
    function __decodeTakeOrderCallArgs(bytes memory _actionData)
        private
        pure
        returns (
            address executor_,
            IOneInchV5AggregationRouter.SwapDescription memory swapDescription_,
            bytes memory data_
        )
    {
        return
            abi.decode(_actionData, (address, IOneInchV5AggregationRouter.SwapDescription, bytes));
    }

    /// @dev Helper to decode the encoded callOnIntegration call arguments for takeMultipleOrders()
    function __decodeTakeMultipleOrdersCallArgs(bytes calldata _actionData)
        private
        pure
        returns (bytes[] memory ordersData, bool allowOrdersToFail)
    {
        return abi.decode(_actionData, (bytes[], bool));
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 15 : 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 15 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 5 of 15 : 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 15 : 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 15 : 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 15 : 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 9 of 15 : 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 10 of 15 : AdapterBase.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/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../../../../utils/AssetHelpers.sol";
import "../IIntegrationAdapter.sol";
import "./IntegrationSelectors.sol";

/// @title AdapterBase Contract
/// @author Enzyme Council <[email protected]>
/// @notice A base contract for integration adapters
abstract contract AdapterBase is IIntegrationAdapter, IntegrationSelectors, AssetHelpers {
    using SafeERC20 for ERC20;

    address internal immutable INTEGRATION_MANAGER;

    /// @dev Provides a standard implementation for transferring incoming assets
    /// from an adapter to a VaultProxy at the end of an adapter action
    modifier postActionIncomingAssetsTransferHandler(
        address _vaultProxy,
        bytes memory _assetData
    ) {
        _;

        (, , address[] memory incomingAssets) = __decodeAssetData(_assetData);

        __pushFullAssetBalances(_vaultProxy, incomingAssets);
    }

    /// @dev Provides a standard implementation for transferring unspent spend assets
    /// from an adapter to a VaultProxy at the end of an adapter action
    modifier postActionSpendAssetsTransferHandler(address _vaultProxy, bytes memory _assetData) {
        _;

        (address[] memory spendAssets, , ) = __decodeAssetData(_assetData);

        __pushFullAssetBalances(_vaultProxy, spendAssets);
    }

    modifier onlyIntegrationManager() {
        require(
            msg.sender == INTEGRATION_MANAGER,
            "Only the IntegrationManager can call this function"
        );
        _;
    }

    constructor(address _integrationManager) public {
        INTEGRATION_MANAGER = _integrationManager;
    }

    // INTERNAL FUNCTIONS

    /// @dev Helper to decode the _assetData param passed to adapter call
    function __decodeAssetData(bytes memory _assetData)
        internal
        pure
        returns (
            address[] memory spendAssets_,
            uint256[] memory spendAssetAmounts_,
            address[] memory incomingAssets_
        )
    {
        return abi.decode(_assetData, (address[], uint256[], address[]));
    }

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

    /// @notice Gets the `INTEGRATION_MANAGER` variable
    /// @return integrationManager_ The `INTEGRATION_MANAGER` variable value
    function getIntegrationManager() external view returns (address integrationManager_) {
        return INTEGRATION_MANAGER;
    }
}

File 11 of 15 : IntegrationSelectors.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 IntegrationSelectors Contract
/// @author Enzyme Council <[email protected]>
/// @notice Selectors for integration actions
/// @dev Selectors are created from their signatures rather than hardcoded for easy verification
abstract contract IntegrationSelectors {
    // Trading
    bytes4 public constant TAKE_MULTIPLE_ORDERS_SELECTOR =
        bytes4(keccak256("takeMultipleOrders(address,bytes,bytes)"));
    bytes4 public constant TAKE_ORDER_SELECTOR =
        bytes4(keccak256("takeOrder(address,bytes,bytes)"));

    // Lending
    bytes4 public constant LEND_SELECTOR = bytes4(keccak256("lend(address,bytes,bytes)"));
    bytes4 public constant REDEEM_SELECTOR = bytes4(keccak256("redeem(address,bytes,bytes)"));

    // Staking
    bytes4 public constant STAKE_SELECTOR = bytes4(keccak256("stake(address,bytes,bytes)"));
    bytes4 public constant UNSTAKE_SELECTOR = bytes4(keccak256("unstake(address,bytes,bytes)"));

    // Rewards
    bytes4 public constant CLAIM_REWARDS_SELECTOR =
        bytes4(keccak256("claimRewards(address,bytes,bytes)"));

    // Combined
    bytes4 public constant LEND_AND_STAKE_SELECTOR =
        bytes4(keccak256("lendAndStake(address,bytes,bytes)"));
    bytes4 public constant UNSTAKE_AND_REDEEM_SELECTOR =
        bytes4(keccak256("unstakeAndRedeem(address,bytes,bytes)"));
}

File 12 of 15 : OneInchV5ActionsMixin.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 "../../../../../interfaces/IOneInchV5AggregationRouter.sol";
import "../../../../../utils/AssetHelpers.sol";

/// @title OneInchV5ActionsMixin Contract
/// @author Enzyme Council <[email protected]>
/// @notice Mixin contract for interacting with OneInch Exchange (v5)
abstract contract OneInchV5ActionsMixin is AssetHelpers {
    IOneInchV5AggregationRouter public immutable ONE_INCH_V5_AGGREGATION_ROUTER_CONTRACT;

    constructor(address _oneInchV5AggregationRouter) public {
        ONE_INCH_V5_AGGREGATION_ROUTER_CONTRACT = IOneInchV5AggregationRouter(
            _oneInchV5AggregationRouter
        );
    }

    /// @dev Helper to execute a swap() order.
    function __oneInchV5Swap(
        address _executor,
        IOneInchV5AggregationRouter.SwapDescription memory _description,
        bytes memory _data
    ) internal {
        __approveAssetMaxAsNeeded({
            _asset: _description.srcToken,
            _target: address(ONE_INCH_V5_AGGREGATION_ROUTER_CONTRACT),
            _neededAmount: _description.amount
        });

        ONE_INCH_V5_AGGREGATION_ROUTER_CONTRACT.swap({
            _executor: _executor,
            _desc: _description,
            _permit: "",
            _data: _data
        });
    }
}

File 13 of 15 : IOneInchV5AggregationRouter.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 IOneInchV5AggregationRouter Interface
/// @author Enzyme Council <[email protected]>
interface IOneInchV5AggregationRouter {
    struct SwapDescription {
        address srcToken;
        address dstToken;
        address payable srcReceiver;
        address payable dstReceiver;
        uint256 amount;
        uint256 minReturnAmount;
        uint256 flags;
    }

    function swap(
        address _executor,
        SwapDescription calldata _desc,
        bytes calldata _permit,
        bytes calldata _data
    ) external payable returns (uint256 returnAmount_, uint256 spentAmount_);
}

File 14 of 15 : 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_;
    }

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

    ////////////
    // 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 15 of 15 : 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 aggregate amounts of the same assets
    function __aggregateAssetAmounts(address[] memory _rawAssets, uint256[] memory _rawAmounts)
        internal
        pure
        returns (address[] memory aggregatedAssets_, uint256[] memory aggregatedAmounts_)
    {
        if (_rawAssets.length == 0) {
            return (aggregatedAssets_, aggregatedAmounts_);
        }

        uint256 aggregatedAssetCount = 1;
        for (uint256 i = 1; i < _rawAssets.length; i++) {
            bool contains;
            for (uint256 j; j < i; j++) {
                if (_rawAssets[i] == _rawAssets[j]) {
                    contains = true;
                    break;
                }
            }
            if (!contains) {
                aggregatedAssetCount++;
            }
        }

        aggregatedAssets_ = new address[](aggregatedAssetCount);
        aggregatedAmounts_ = new uint256[](aggregatedAssetCount);
        uint256 aggregatedAssetIndex;
        for (uint256 i; i < _rawAssets.length; i++) {
            bool contains;
            for (uint256 j; j < aggregatedAssetIndex; j++) {
                if (_rawAssets[i] == aggregatedAssets_[j]) {
                    contains = true;

                    aggregatedAmounts_[j] += _rawAmounts[i];

                    break;
                }
            }
            if (!contains) {
                aggregatedAssets_[aggregatedAssetIndex] = _rawAssets[i];
                aggregatedAmounts_[aggregatedAssetIndex] = _rawAmounts[i];
                aggregatedAssetIndex++;
            }
        }

        return (aggregatedAssets_, aggregatedAmounts_);
    }

    /// @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 balance from the current contract to a target
    function __pushFullAssetBalance(address _target, address _asset)
        internal
        returns (uint256 amountTransferred_)
    {
        amountTransferred_ = ERC20(_asset).balanceOf(address(this));
        if (amountTransferred_ > 0) {
            ERC20(_asset).safeTransfer(_target, amountTransferred_);
        }

        return amountTransferred_;
    }

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

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":"_integrationManager","type":"address"},{"internalType":"address","name":"_oneInchV5Exchange","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"reason","type":"bytes"}],"name":"MultipleOrdersItemFailed","type":"event"},{"inputs":[],"name":"CLAIM_REWARDS_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LEND_AND_STAKE_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LEND_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONE_INCH_V5_AGGREGATION_ROUTER_CONTRACT","outputs":[{"internalType":"contract IOneInchV5AggregationRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REDEEM_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKE_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAKE_MULTIPLE_ORDERS_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAKE_ORDER_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNSTAKE_AND_REDEEM_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNSTAKE_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getIntegrationManager","outputs":[{"internalType":"address","name":"integrationManager_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"bytes4","name":"_selector","type":"bytes4"},{"internalType":"bytes","name":"_actionData","type":"bytes"}],"name":"parseAssetsForAction","outputs":[{"internalType":"enum IIntegrationManager.SpendAssetsHandleType","name":"spendAssetsHandleType_","type":"uint8"},{"internalType":"address[]","name":"spendAssets_","type":"address[]"},{"internalType":"uint256[]","name":"spendAssetAmounts_","type":"uint256[]"},{"internalType":"address[]","name":"incomingAssets_","type":"address[]"},{"internalType":"uint256[]","name":"minIncomingAssetAmounts_","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"bytes","name":"_actionData","type":"bytes"},{"internalType":"bytes","name":"_assetData","type":"bytes"}],"name":"takeMultipleOrders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"bytes","name":"_actionData","type":"bytes"},{"internalType":"bytes","name":"_assetData","type":"bytes"}],"name":"takeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"bytes","name":"_orderData","type":"bytes"}],"name":"takeOrderAndValidateIncoming","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b50604051620023ca380380620023ca833981016040819052620000349162000066565b6001600160601b0319606092831b8116608052911b1660a052620000d1565b80516200006081620000b7565b92915050565b600080604083850312156200007a57600080fd5b600062000088858562000053565b92505060206200009b8582860162000053565b9150509250929050565b60006001600160a01b03821662000060565b620000c281620000a5565b8114620000ce57600080fd5b50565b60805160601c60a05160601c6122c562000105600039806104f95280610f545280610f9452508061096252506122c56000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806340da225d11610097578063c32990a211610066578063c32990a214610198578063c54efee5146101a0578063e7c45690146101c4578063f7d882b5146101d9576100f5565b806340da225d1461016b57806381e0cc6514610173578063863e5ad014610188578063b23228cf14610190576100f5565b8063131461c0116100d3578063131461c014610140578063257cb1a3146101485780632d979b8c146101505780633ffc159114610163576100f5565b806303e38a2b146100fa578063080456c11461010f5780630e7f692d1461012d575b600080fd5b61010d610108366004611959565b6101e1565b005b61011761027a565b604051610124919061202e565b60405180910390f35b61010d61013b366004611959565b61029e565b610117610422565b610117610446565b61010d61015e366004611904565b61046a565b6101176104af565b6101176104d3565b61017b6104f7565b604051610124919061203c565b61011761051b565b61011761053f565b610117610563565b6101b36101ae36600461189d565b610587565b60405161012495949392919061204a565b6101cc610960565b6040516101249190611f7e565b610117610984565b8482828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881526102569350915088908890819084018382808284376000920191909152506109a892505050565b6060610261826109d4565b5050905061026f83826109fa565b505050505050505050565b7f8334eb99be0145865eba9889fca2ee920288090caefff4cc776038e20ad9259a81565b8482828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506060935091506102e390508888610b56565b9150915080156103e25760005b82518110156103dc57306001600160a01b0316632d979b8c8b85848151811061031557fe5b60200260200101516040518363ffffffff1660e01b815260040161033a929190611fa7565b600060405180830381600087803b15801561035457600080fd5b505af1925050508015610365575060015b6103d4573d808015610393576040519150601f19603f3d011682016040523d82523d6000602084013e610398565b606091505b507f3a14c92f155e1c07fef79933a3b56bd101ab83092702170ae1a4c53712c5099b82826040516103ca929190612137565b60405180910390a1505b6001016102f0565b50610415565b60005b82518110156104135761040b8a8483815181106103fe57fe5b6020026020010151610b72565b6001016103e5565b505b50506060610261826109d4565b7f29fa046e79524c3c5ac4c01df692c35e217802b2b13b21121b76cf0ef02b138c81565b7f099f75155f0e997bf83a7993a71d5e7e7540bd386fe1e84643a09ce6b412521981565b6104aa8383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b7292505050565b505050565b7ffa7dd04da627f433da73c4355ead9c75682a67a8fc84d3f6170ef0922f402d2481565b7fb9dfbaccbe5cd2a84fdcf1d15f23ef25d23086f5afbaa99516065ed4a5bbc7a381565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f03e38a2bd7063d45c897edeafc330e71657502dd86434d3c37a489caf116af6981565b7f68e30677f607df46e87da13e15b637784cfa62374b653f35ab43d10361a2f83081565b7f0e7f692dad5b88fdee426250d6eae91207e56a2e8112b7364579bed1790e5bf481565b600060608080806001600160e01b031988166303e38a2b60e01b141561075657604080516001808252818301909252906020808301908036833750506040805160018082528183019092529296509050602080830190803683375050604080516001808252818301909252929550905060208083019080368337505060408051600180825281830190925292945090506020808301908036833701905050905061062f6114ec565b61066e88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610cc192505050565b5091505080606001516001600160a01b03168a6001600160a01b0316146106b05760405162461bcd60e51b81526004016106a7906120e7565b60405180910390fd5b8060000151856000815181106106c257fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508060800151846000815181106106f457fe5b60200260200101818152505080602001518360008151811061071257fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508060a001518260008151811061074457fe5b60200260200101818152505050610951565b6001600160e01b03198816630e7f692d60e01b141561093957606061077b8888610b56565b50905080516001600160401b038111801561079557600080fd5b506040519080825280602002602001820160405280156107bf578160200160208202803683370190505b50945080516001600160401b03811180156107d957600080fd5b50604051908082528060200260200182016040528015610803578160200160208202803683370190505b50935060005b81518110156108df5761081a6114ec565b61083683838151811061082957fe5b6020026020010151610cc1565b5091505080606001516001600160a01b03168c6001600160a01b03161461086f5760405162461bcd60e51b81526004016106a7906120e7565b806000015187838151811061088057fe5b60200260200101906001600160a01b031690816001600160a01b03168152505080608001518683815181106108b157fe5b6020026020010181815250506108d4816020015186610ce190919063ffffffff16565b945050600101610809565b506108ea8585610d0a565b845191965094506001600160401b038111801561090657600080fd5b50604051908082528060200260200182016040528015610930578160200160208202803683370190505b50915050610951565b60405162461bcd60e51b81526004016106a790612127565b60029450945094509450945094565b7f000000000000000000000000000000000000000000000000000000000000000090565b7fc29fa9dde84204c2908778afd0613d802d31cf046179b88f6d2b4a4e507ea2d581565b60006109b26114ec565b60606109bd84610cc1565b9250925092506109ce838383610f4a565b50505050565b6060806060838060200190518101906109ed91906119de565b9250925092509193909250565b606081516001600160401b0381118015610a1357600080fd5b50604051908082528060200260200182016040528015610a3d578160200160208202803683370190505b50905060005b8251811015610b4e576000838281518110610a5a57fe5b60200260200101519050806001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610a909190611f7e565b60206040518083038186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae09190611ad3565b838381518110610aec57fe5b6020026020010181815250506000838381518110610b0657fe5b60200260200101511115610b4557610b4585848481518110610b2457fe5b6020026020010151836001600160a01b03166110259092919063ffffffff16565b50600101610a43565b505b92915050565b60606000610b6683850185611a65565b915091505b9250929050565b610b7a6114ec565b610b8382610cc1565b50915050600081602001516001600160a01b03166370a08231856040518263ffffffff1660e01b8152600401610bb99190611f7e565b60206040518083038186803b158015610bd157600080fd5b505afa158015610be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c099190611ad3565b9050610c14836109a8565b8160a00151610ca38284602001516001600160a01b03166370a08231886040518263ffffffff1660e01b8152600401610c4d9190611f7e565b60206040518083038186803b158015610c6557600080fd5b505afa158015610c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9d9190611ad3565b9061107b565b10156109ce5760405162461bcd60e51b81526004016106a7906120b7565b6000610ccb6114ec565b6060838060200190518101906109ed9190611837565b6060610ced83836110a3565b15610cf9575081610b50565b610d0383836110f9565b9392505050565b606080835160001415610d1c57610b6b565b6001805b8551811015610d9c576000805b82811015610d8657878181518110610d4157fe5b60200260200101516001600160a01b0316888481518110610d5e57fe5b60200260200101516001600160a01b03161415610d7e5760019150610d86565b600101610d2d565b5080610d93576001909201915b50600101610d20565b50806001600160401b0381118015610db357600080fd5b50604051908082528060200260200182016040528015610ddd578160200160208202803683370190505b509250806001600160401b0381118015610df657600080fd5b50604051908082528060200260200182016040528015610e20578160200160208202803683370190505b5091506000805b8651811015610f40576000805b83811015610ebf57868181518110610e4857fe5b60200260200101516001600160a01b0316898481518110610e6557fe5b60200260200101516001600160a01b03161415610eb75760019150878381518110610e8c57fe5b6020026020010151868281518110610ea057fe5b602002602001018181510191508181525050610ebf565b600101610e34565b5080610f3757878281518110610ed157fe5b6020026020010151868481518110610ee557fe5b60200260200101906001600160a01b031690816001600160a01b031681525050868281518110610f1157fe5b6020026020010151858481518110610f2557fe5b60209081029190910101526001909201915b50600101610e27565b5050509250929050565b610f7d82600001517f000000000000000000000000000000000000000000000000000000000000000084608001516111c3565b6040516312aa3caf60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906312aa3caf90610fcd90869086908690600401611fc7565b6040805180830381600087803b158015610fe657600080fd5b505af1158015610ffa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101e9190611af1565b5050505050565b6104aa8363a9059cbb60e01b8484604051602401611044929190612013565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261127f565b60008282111561109d5760405162461bcd60e51b81526004016106a7906120c7565b50900390565b6000805b83518110156110ef578381815181106110bc57fe5b60200260200101516001600160a01b0316836001600160a01b031614156110e7576001915050610b50565b6001016110a7565b5060009392505050565b606082516001016001600160401b038111801561111557600080fd5b5060405190808252806020026020018201604052801561113f578160200160208202803683370190505b50905060005b835181101561118e5783818151811061115a57fe5b602002602001015182828151811061116e57fe5b6001600160a01b0390921660209283029190910190910152600101611145565b50818184518151811061119d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505092915050565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e906111f49030908790600401611f8c565b60206040518083038186803b15801561120c57600080fd5b505afa158015611220573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112449190611ad3565b9050818110156109ce578015611269576112696001600160a01b03851684600061130e565b6109ce6001600160a01b0385168460001961130e565b60606112d4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113d19092919063ffffffff16565b8051909150156104aa57808060200190518101906112f29190611ab5565b6104aa5760405162461bcd60e51b81526004016106a790612107565b8015806113965750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906113449030908690600401611f8c565b60206040518083038186803b15801561135c57600080fd5b505afa158015611370573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113949190611ad3565b155b6113b25760405162461bcd60e51b81526004016106a790612117565b6104aa8363095ea7b360e01b8484604051602401611044929190612013565b60606113e084846000856113e8565b949350505050565b60608247101561140a5760405162461bcd60e51b81526004016106a7906120d7565b611413856114a9565b61142f5760405162461bcd60e51b81526004016106a7906120f7565b60006060866001600160a01b0316858760405161144c9190611f72565b60006040518083038185875af1925050503d8060008114611489576040519150601f19603f3d011682016040523d82523d6000602084013e61148e565b606091505b509150915061149e8282866114b3565b979650505050505050565b803b15155b919050565b606083156114c2575081610d03565b8251156114d25782518084602001fd5b8160405162461bcd60e51b81526004016106a791906120a6565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b8035610b5081612260565b8051610b5081612260565b600082601f83011261154f57600080fd5b815161156261155d8261216b565b612145565b9150818183526020840193506020810190508385602084028201111561158757600080fd5b60005b838110156115b3578161159d8882611533565b845250602092830192919091019060010161158a565b5050505092915050565b600082601f8301126115ce57600080fd5b81356115dc61155d8261216b565b81815260209384019390925082018360005b838110156115b3578135860161160488826116ec565b84525060209283019291909101906001016115ee565b600082601f83011261162b57600080fd5b815161163961155d8261216b565b9150818183526020840193506020810190508385602084028201111561165e57600080fd5b60005b838110156115b35781611674888261182c565b8452506020928301929190910190600101611661565b8035610b5081612274565b8051610b5081612274565b8035610b508161227d565b60008083601f8401126116bd57600080fd5b5081356001600160401b038111156116d457600080fd5b602083019150836001820283011115610b6b57600080fd5b600082601f8301126116fd57600080fd5b813561170b61155d8261218b565b9150808252602083016020830185838301111561172757600080fd5b611732838284612211565b50505092915050565b600082601f83011261174c57600080fd5b815161175a61155d8261218b565b9150808252602083016020830185838301111561177657600080fd5b61173283828461221d565b600060e0828403121561179357600080fd5b61179d60e0612145565b905060006117ab8484611533565b82525060206117bc84848301611533565b60208301525060406117d084828501611533565b60408301525060606117e484828501611533565b60608301525060806117f88482850161182c565b60808301525060a061180c8482850161182c565b60a08301525060c06118208482850161182c565b60c08301525092915050565b8051610b5081612286565b6000806000610120848603121561184d57600080fd5b60006118598686611533565b935050602061186a86828701611781565b9250506101008401516001600160401b0381111561188757600080fd5b6118938682870161173b565b9150509250925092565b600080600080606085870312156118b357600080fd5b60006118bf8787611528565b94505060206118d0878288016116a0565b93505060408501356001600160401b038111156118ec57600080fd5b6118f8878288016116ab565b95989497509550505050565b60008060006040848603121561191957600080fd5b60006119258686611528565b93505060208401356001600160401b0381111561194157600080fd5b61194d868287016116ab565b92509250509250925092565b60008060008060006060868803121561197157600080fd5b600061197d8888611528565b95505060208601356001600160401b0381111561199957600080fd5b6119a5888289016116ab565b945094505060408601356001600160401b038111156119c357600080fd5b6119cf888289016116ab565b92509250509295509295909350565b6000806000606084860312156119f357600080fd5b83516001600160401b03811115611a0957600080fd5b611a158682870161153e565b93505060208401516001600160401b03811115611a3157600080fd5b611a3d8682870161161a565b92505060408401516001600160401b03811115611a5957600080fd5b6118938682870161153e565b60008060408385031215611a7857600080fd5b82356001600160401b03811115611a8e57600080fd5b611a9a858286016115bd565b9250506020611aab8582860161168a565b9150509250929050565b600060208284031215611ac757600080fd5b60006113e08484611695565b600060208284031215611ae557600080fd5b60006113e0848461182c565b60008060408385031215611b0457600080fd5b6000611b10858561182c565b9250506020611aab8582860161182c565b6000611b2d8383611b41565b505060200190565b6000611b2d8383611f69565b611b4a816121c5565b82525050565b6000611b5b826121b8565b611b6581856121bc565b9350611b70836121b2565b8060005b83811015611b9e578151611b888882611b21565b9750611b93836121b2565b925050600101611b74565b509495945050505050565b6000611bb4826121b8565b611bbe81856121bc565b9350611bc9836121b2565b8060005b83811015611b9e578151611be18882611b35565b9750611bec836121b2565b925050600101611bcd565b611b4a816121d5565b6000611c0b826121b8565b611c1581856121bc565b9350611c2581856020860161221d565b611c2e81612249565b9093019392505050565b6000611c43826121b8565b611c4d81856114ae565b9350611c5d81856020860161221d565b9290920192915050565b611b4a816121fb565b611b4a81612206565b6000611c86604a836121bc565b7f5f5f74616b654f72646572416e6456616c6964617465496e636f6d696e673a2081527f526563656976656420696e636f6d696e67206173736574206c657373207468616020820152691b88195e1c1958dd195960b21b604082015260600192915050565b6000611cf8601e836121bc565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000611d316026836121bc565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b602082015260400192915050565b6000611d796029836121bc565b7f7061727365417373657473466f72416374696f6e3a20696e76616c69642064738152683a2932b1b2b4bb32b960b91b602082015260400192915050565b6000610b506000836121bc565b6000611dd1601d836121bc565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815260200192915050565b6000611e0a602a836121bc565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015260400192915050565b6000611e566036836121bc565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b602082015260400192915050565b6000611eae6027836121bc565b7f7061727365417373657473466f72416374696f6e3a205f73656c6563746f72208152661a5b9d985b1a5960ca1b602082015260400192915050565b805160e0830190611efb8482611b41565b506020820151611f0e6020850182611b41565b506040820151611f216040850182611b41565b506060820151611f346060850182611b41565b506080820151611f476080850182611f69565b5060a0820151611f5a60a0850182611f69565b5060c08201516109ce60c08501825b611b4a816121f8565b6000610d038284611c38565b60208101610b508284611b41565b60408101611f9a8285611b41565b610d036020830184611b41565b60408101611fb58285611b41565b81810360208301526113e08184611c00565b6101408101611fd68286611b41565b611fe36020830185611eea565b818103610100830152611ff581611db7565b905081810361012083015261200a8184611c00565b95945050505050565b604081016120218285611b41565b610d036020830184611f69565b60208101610b508284611bf7565b60208101610b508284611c67565b60a081016120588288611c70565b818103602083015261206a8187611b50565b9050818103604083015261207e8186611ba9565b905081810360608301526120928185611b50565b9050818103608083015261149e8184611ba9565b60208082528101610d038184611c00565b60208082528101610b5081611c79565b60208082528101610b5081611ceb565b60208082528101610b5081611d24565b60208082528101610b5081611d6c565b60208082528101610b5081611dc4565b60208082528101610b5081611dfd565b60208082528101610b5081611e49565b60208082528101610b5081611ea1565b60408101611fb58285611f69565b6040518181016001600160401b038111828210171561216357600080fd5b604052919050565b60006001600160401b0382111561218157600080fd5b5060209081020190565b60006001600160401b038211156121a157600080fd5b506020601f91909101601f19160190565b60200190565b5190565b90815260200190565b6000610b50826121ec565b151590565b6001600160e01b03191690565b806114ae81612253565b6001600160a01b031690565b90565b6000610b50826121c5565b6000610b50826121e2565b82818337506000910152565b60005b83811015612238578181015183820152602001612220565b838111156109ce5750506000910152565b601f01601f191690565b6003811061225d57fe5b50565b612269816121c5565b811461225d57600080fd5b612269816121d0565b612269816121d5565b612269816121f856fea2646970667358221220bc38357e030ce3445ebd25d5c8a4a2c74dc81a848762ac88eaebab15bca2ffc164736f6c634300060c003300000000000000000000000031329024f1a3e4a4b3336e0b1dfa74cc3fec633e0000000000000000000000001111111254eeb25477b68fb85ed929f73a960582

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806340da225d11610097578063c32990a211610066578063c32990a214610198578063c54efee5146101a0578063e7c45690146101c4578063f7d882b5146101d9576100f5565b806340da225d1461016b57806381e0cc6514610173578063863e5ad014610188578063b23228cf14610190576100f5565b8063131461c0116100d3578063131461c014610140578063257cb1a3146101485780632d979b8c146101505780633ffc159114610163576100f5565b806303e38a2b146100fa578063080456c11461010f5780630e7f692d1461012d575b600080fd5b61010d610108366004611959565b6101e1565b005b61011761027a565b604051610124919061202e565b60405180910390f35b61010d61013b366004611959565b61029e565b610117610422565b610117610446565b61010d61015e366004611904565b61046a565b6101176104af565b6101176104d3565b61017b6104f7565b604051610124919061203c565b61011761051b565b61011761053f565b610117610563565b6101b36101ae36600461189d565b610587565b60405161012495949392919061204a565b6101cc610960565b6040516101249190611f7e565b610117610984565b8482828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881526102569350915088908890819084018382808284376000920191909152506109a892505050565b6060610261826109d4565b5050905061026f83826109fa565b505050505050505050565b7f8334eb99be0145865eba9889fca2ee920288090caefff4cc776038e20ad9259a81565b8482828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506060935091506102e390508888610b56565b9150915080156103e25760005b82518110156103dc57306001600160a01b0316632d979b8c8b85848151811061031557fe5b60200260200101516040518363ffffffff1660e01b815260040161033a929190611fa7565b600060405180830381600087803b15801561035457600080fd5b505af1925050508015610365575060015b6103d4573d808015610393576040519150601f19603f3d011682016040523d82523d6000602084013e610398565b606091505b507f3a14c92f155e1c07fef79933a3b56bd101ab83092702170ae1a4c53712c5099b82826040516103ca929190612137565b60405180910390a1505b6001016102f0565b50610415565b60005b82518110156104135761040b8a8483815181106103fe57fe5b6020026020010151610b72565b6001016103e5565b505b50506060610261826109d4565b7f29fa046e79524c3c5ac4c01df692c35e217802b2b13b21121b76cf0ef02b138c81565b7f099f75155f0e997bf83a7993a71d5e7e7540bd386fe1e84643a09ce6b412521981565b6104aa8383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b7292505050565b505050565b7ffa7dd04da627f433da73c4355ead9c75682a67a8fc84d3f6170ef0922f402d2481565b7fb9dfbaccbe5cd2a84fdcf1d15f23ef25d23086f5afbaa99516065ed4a5bbc7a381565b7f0000000000000000000000001111111254eeb25477b68fb85ed929f73a96058281565b7f03e38a2bd7063d45c897edeafc330e71657502dd86434d3c37a489caf116af6981565b7f68e30677f607df46e87da13e15b637784cfa62374b653f35ab43d10361a2f83081565b7f0e7f692dad5b88fdee426250d6eae91207e56a2e8112b7364579bed1790e5bf481565b600060608080806001600160e01b031988166303e38a2b60e01b141561075657604080516001808252818301909252906020808301908036833750506040805160018082528183019092529296509050602080830190803683375050604080516001808252818301909252929550905060208083019080368337505060408051600180825281830190925292945090506020808301908036833701905050905061062f6114ec565b61066e88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610cc192505050565b5091505080606001516001600160a01b03168a6001600160a01b0316146106b05760405162461bcd60e51b81526004016106a7906120e7565b60405180910390fd5b8060000151856000815181106106c257fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508060800151846000815181106106f457fe5b60200260200101818152505080602001518360008151811061071257fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508060a001518260008151811061074457fe5b60200260200101818152505050610951565b6001600160e01b03198816630e7f692d60e01b141561093957606061077b8888610b56565b50905080516001600160401b038111801561079557600080fd5b506040519080825280602002602001820160405280156107bf578160200160208202803683370190505b50945080516001600160401b03811180156107d957600080fd5b50604051908082528060200260200182016040528015610803578160200160208202803683370190505b50935060005b81518110156108df5761081a6114ec565b61083683838151811061082957fe5b6020026020010151610cc1565b5091505080606001516001600160a01b03168c6001600160a01b03161461086f5760405162461bcd60e51b81526004016106a7906120e7565b806000015187838151811061088057fe5b60200260200101906001600160a01b031690816001600160a01b03168152505080608001518683815181106108b157fe5b6020026020010181815250506108d4816020015186610ce190919063ffffffff16565b945050600101610809565b506108ea8585610d0a565b845191965094506001600160401b038111801561090657600080fd5b50604051908082528060200260200182016040528015610930578160200160208202803683370190505b50915050610951565b60405162461bcd60e51b81526004016106a790612127565b60029450945094509450945094565b7f00000000000000000000000031329024f1a3e4a4b3336e0b1dfa74cc3fec633e90565b7fc29fa9dde84204c2908778afd0613d802d31cf046179b88f6d2b4a4e507ea2d581565b60006109b26114ec565b60606109bd84610cc1565b9250925092506109ce838383610f4a565b50505050565b6060806060838060200190518101906109ed91906119de565b9250925092509193909250565b606081516001600160401b0381118015610a1357600080fd5b50604051908082528060200260200182016040528015610a3d578160200160208202803683370190505b50905060005b8251811015610b4e576000838281518110610a5a57fe5b60200260200101519050806001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610a909190611f7e565b60206040518083038186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae09190611ad3565b838381518110610aec57fe5b6020026020010181815250506000838381518110610b0657fe5b60200260200101511115610b4557610b4585848481518110610b2457fe5b6020026020010151836001600160a01b03166110259092919063ffffffff16565b50600101610a43565b505b92915050565b60606000610b6683850185611a65565b915091505b9250929050565b610b7a6114ec565b610b8382610cc1565b50915050600081602001516001600160a01b03166370a08231856040518263ffffffff1660e01b8152600401610bb99190611f7e565b60206040518083038186803b158015610bd157600080fd5b505afa158015610be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c099190611ad3565b9050610c14836109a8565b8160a00151610ca38284602001516001600160a01b03166370a08231886040518263ffffffff1660e01b8152600401610c4d9190611f7e565b60206040518083038186803b158015610c6557600080fd5b505afa158015610c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9d9190611ad3565b9061107b565b10156109ce5760405162461bcd60e51b81526004016106a7906120b7565b6000610ccb6114ec565b6060838060200190518101906109ed9190611837565b6060610ced83836110a3565b15610cf9575081610b50565b610d0383836110f9565b9392505050565b606080835160001415610d1c57610b6b565b6001805b8551811015610d9c576000805b82811015610d8657878181518110610d4157fe5b60200260200101516001600160a01b0316888481518110610d5e57fe5b60200260200101516001600160a01b03161415610d7e5760019150610d86565b600101610d2d565b5080610d93576001909201915b50600101610d20565b50806001600160401b0381118015610db357600080fd5b50604051908082528060200260200182016040528015610ddd578160200160208202803683370190505b509250806001600160401b0381118015610df657600080fd5b50604051908082528060200260200182016040528015610e20578160200160208202803683370190505b5091506000805b8651811015610f40576000805b83811015610ebf57868181518110610e4857fe5b60200260200101516001600160a01b0316898481518110610e6557fe5b60200260200101516001600160a01b03161415610eb75760019150878381518110610e8c57fe5b6020026020010151868281518110610ea057fe5b602002602001018181510191508181525050610ebf565b600101610e34565b5080610f3757878281518110610ed157fe5b6020026020010151868481518110610ee557fe5b60200260200101906001600160a01b031690816001600160a01b031681525050868281518110610f1157fe5b6020026020010151858481518110610f2557fe5b60209081029190910101526001909201915b50600101610e27565b5050509250929050565b610f7d82600001517f0000000000000000000000001111111254eeb25477b68fb85ed929f73a96058284608001516111c3565b6040516312aa3caf60e01b81526001600160a01b037f0000000000000000000000001111111254eeb25477b68fb85ed929f73a96058216906312aa3caf90610fcd90869086908690600401611fc7565b6040805180830381600087803b158015610fe657600080fd5b505af1158015610ffa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101e9190611af1565b5050505050565b6104aa8363a9059cbb60e01b8484604051602401611044929190612013565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261127f565b60008282111561109d5760405162461bcd60e51b81526004016106a7906120c7565b50900390565b6000805b83518110156110ef578381815181106110bc57fe5b60200260200101516001600160a01b0316836001600160a01b031614156110e7576001915050610b50565b6001016110a7565b5060009392505050565b606082516001016001600160401b038111801561111557600080fd5b5060405190808252806020026020018201604052801561113f578160200160208202803683370190505b50905060005b835181101561118e5783818151811061115a57fe5b602002602001015182828151811061116e57fe5b6001600160a01b0390921660209283029190910190910152600101611145565b50818184518151811061119d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505092915050565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e906111f49030908790600401611f8c565b60206040518083038186803b15801561120c57600080fd5b505afa158015611220573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112449190611ad3565b9050818110156109ce578015611269576112696001600160a01b03851684600061130e565b6109ce6001600160a01b0385168460001961130e565b60606112d4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113d19092919063ffffffff16565b8051909150156104aa57808060200190518101906112f29190611ab5565b6104aa5760405162461bcd60e51b81526004016106a790612107565b8015806113965750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906113449030908690600401611f8c565b60206040518083038186803b15801561135c57600080fd5b505afa158015611370573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113949190611ad3565b155b6113b25760405162461bcd60e51b81526004016106a790612117565b6104aa8363095ea7b360e01b8484604051602401611044929190612013565b60606113e084846000856113e8565b949350505050565b60608247101561140a5760405162461bcd60e51b81526004016106a7906120d7565b611413856114a9565b61142f5760405162461bcd60e51b81526004016106a7906120f7565b60006060866001600160a01b0316858760405161144c9190611f72565b60006040518083038185875af1925050503d8060008114611489576040519150601f19603f3d011682016040523d82523d6000602084013e61148e565b606091505b509150915061149e8282866114b3565b979650505050505050565b803b15155b919050565b606083156114c2575081610d03565b8251156114d25782518084602001fd5b8160405162461bcd60e51b81526004016106a791906120a6565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b8035610b5081612260565b8051610b5081612260565b600082601f83011261154f57600080fd5b815161156261155d8261216b565b612145565b9150818183526020840193506020810190508385602084028201111561158757600080fd5b60005b838110156115b3578161159d8882611533565b845250602092830192919091019060010161158a565b5050505092915050565b600082601f8301126115ce57600080fd5b81356115dc61155d8261216b565b81815260209384019390925082018360005b838110156115b3578135860161160488826116ec565b84525060209283019291909101906001016115ee565b600082601f83011261162b57600080fd5b815161163961155d8261216b565b9150818183526020840193506020810190508385602084028201111561165e57600080fd5b60005b838110156115b35781611674888261182c565b8452506020928301929190910190600101611661565b8035610b5081612274565b8051610b5081612274565b8035610b508161227d565b60008083601f8401126116bd57600080fd5b5081356001600160401b038111156116d457600080fd5b602083019150836001820283011115610b6b57600080fd5b600082601f8301126116fd57600080fd5b813561170b61155d8261218b565b9150808252602083016020830185838301111561172757600080fd5b611732838284612211565b50505092915050565b600082601f83011261174c57600080fd5b815161175a61155d8261218b565b9150808252602083016020830185838301111561177657600080fd5b61173283828461221d565b600060e0828403121561179357600080fd5b61179d60e0612145565b905060006117ab8484611533565b82525060206117bc84848301611533565b60208301525060406117d084828501611533565b60408301525060606117e484828501611533565b60608301525060806117f88482850161182c565b60808301525060a061180c8482850161182c565b60a08301525060c06118208482850161182c565b60c08301525092915050565b8051610b5081612286565b6000806000610120848603121561184d57600080fd5b60006118598686611533565b935050602061186a86828701611781565b9250506101008401516001600160401b0381111561188757600080fd5b6118938682870161173b565b9150509250925092565b600080600080606085870312156118b357600080fd5b60006118bf8787611528565b94505060206118d0878288016116a0565b93505060408501356001600160401b038111156118ec57600080fd5b6118f8878288016116ab565b95989497509550505050565b60008060006040848603121561191957600080fd5b60006119258686611528565b93505060208401356001600160401b0381111561194157600080fd5b61194d868287016116ab565b92509250509250925092565b60008060008060006060868803121561197157600080fd5b600061197d8888611528565b95505060208601356001600160401b0381111561199957600080fd5b6119a5888289016116ab565b945094505060408601356001600160401b038111156119c357600080fd5b6119cf888289016116ab565b92509250509295509295909350565b6000806000606084860312156119f357600080fd5b83516001600160401b03811115611a0957600080fd5b611a158682870161153e565b93505060208401516001600160401b03811115611a3157600080fd5b611a3d8682870161161a565b92505060408401516001600160401b03811115611a5957600080fd5b6118938682870161153e565b60008060408385031215611a7857600080fd5b82356001600160401b03811115611a8e57600080fd5b611a9a858286016115bd565b9250506020611aab8582860161168a565b9150509250929050565b600060208284031215611ac757600080fd5b60006113e08484611695565b600060208284031215611ae557600080fd5b60006113e0848461182c565b60008060408385031215611b0457600080fd5b6000611b10858561182c565b9250506020611aab8582860161182c565b6000611b2d8383611b41565b505060200190565b6000611b2d8383611f69565b611b4a816121c5565b82525050565b6000611b5b826121b8565b611b6581856121bc565b9350611b70836121b2565b8060005b83811015611b9e578151611b888882611b21565b9750611b93836121b2565b925050600101611b74565b509495945050505050565b6000611bb4826121b8565b611bbe81856121bc565b9350611bc9836121b2565b8060005b83811015611b9e578151611be18882611b35565b9750611bec836121b2565b925050600101611bcd565b611b4a816121d5565b6000611c0b826121b8565b611c1581856121bc565b9350611c2581856020860161221d565b611c2e81612249565b9093019392505050565b6000611c43826121b8565b611c4d81856114ae565b9350611c5d81856020860161221d565b9290920192915050565b611b4a816121fb565b611b4a81612206565b6000611c86604a836121bc565b7f5f5f74616b654f72646572416e6456616c6964617465496e636f6d696e673a2081527f526563656976656420696e636f6d696e67206173736574206c657373207468616020820152691b88195e1c1958dd195960b21b604082015260600192915050565b6000611cf8601e836121bc565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000611d316026836121bc565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b602082015260400192915050565b6000611d796029836121bc565b7f7061727365417373657473466f72416374696f6e3a20696e76616c69642064738152683a2932b1b2b4bb32b960b91b602082015260400192915050565b6000610b506000836121bc565b6000611dd1601d836121bc565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815260200192915050565b6000611e0a602a836121bc565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015260400192915050565b6000611e566036836121bc565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b602082015260400192915050565b6000611eae6027836121bc565b7f7061727365417373657473466f72416374696f6e3a205f73656c6563746f72208152661a5b9d985b1a5960ca1b602082015260400192915050565b805160e0830190611efb8482611b41565b506020820151611f0e6020850182611b41565b506040820151611f216040850182611b41565b506060820151611f346060850182611b41565b506080820151611f476080850182611f69565b5060a0820151611f5a60a0850182611f69565b5060c08201516109ce60c08501825b611b4a816121f8565b6000610d038284611c38565b60208101610b508284611b41565b60408101611f9a8285611b41565b610d036020830184611b41565b60408101611fb58285611b41565b81810360208301526113e08184611c00565b6101408101611fd68286611b41565b611fe36020830185611eea565b818103610100830152611ff581611db7565b905081810361012083015261200a8184611c00565b95945050505050565b604081016120218285611b41565b610d036020830184611f69565b60208101610b508284611bf7565b60208101610b508284611c67565b60a081016120588288611c70565b818103602083015261206a8187611b50565b9050818103604083015261207e8186611ba9565b905081810360608301526120928185611b50565b9050818103608083015261149e8184611ba9565b60208082528101610d038184611c00565b60208082528101610b5081611c79565b60208082528101610b5081611ceb565b60208082528101610b5081611d24565b60208082528101610b5081611d6c565b60208082528101610b5081611dc4565b60208082528101610b5081611dfd565b60208082528101610b5081611e49565b60208082528101610b5081611ea1565b60408101611fb58285611f69565b6040518181016001600160401b038111828210171561216357600080fd5b604052919050565b60006001600160401b0382111561218157600080fd5b5060209081020190565b60006001600160401b038211156121a157600080fd5b506020601f91909101601f19160190565b60200190565b5190565b90815260200190565b6000610b50826121ec565b151590565b6001600160e01b03191690565b806114ae81612253565b6001600160a01b031690565b90565b6000610b50826121c5565b6000610b50826121e2565b82818337506000910152565b60005b83811015612238578181015183820152602001612220565b838111156109ce5750506000910152565b601f01601f191690565b6003811061225d57fe5b50565b612269816121c5565b811461225d57600080fd5b612269816121d0565b612269816121d5565b612269816121f856fea2646970667358221220bc38357e030ce3445ebd25d5c8a4a2c74dc81a848762ac88eaebab15bca2ffc164736f6c634300060c0033

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

00000000000000000000000031329024f1a3e4a4b3336e0b1dfa74cc3fec633e0000000000000000000000001111111254eeb25477b68fb85ed929f73a960582

-----Decoded View---------------
Arg [0] : _integrationManager (address): 0x31329024f1a3E4a4B3336E0b1DfA74CC3FEc633e
Arg [1] : _oneInchV5Exchange (address): 0x1111111254EEB25477B68fb85Ed929f73A960582

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000031329024f1a3e4a4b3336e0b1dfa74cc3fec633e
Arg [1] : 0000000000000000000000001111111254eeb25477b68fb85ed929f73a960582


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.