ETH Price: $2,611.70 (+2.65%)

Contract

0x8eA6Ca02274E1b05b70c11058213ADC667258C3D
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60e06040123881462021-05-07 16:10:351233 days ago1620403835IN
 Create: ParaSwapV4Adapter
0 ETH0.16132568115

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ParaSwapV4Adapter

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 15 : ParaSwapV4Adapter.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/actions/ParaSwapV4ActionsMixin.sol";
import "../utils/AdapterBase2.sol";

/// @title ParaSwapV4Adapter Contract
/// @author Enzyme Council <[email protected]>
/// @notice Adapter for interacting with ParaSwap (v4)
/// @dev Does not allow any protocol that collects protocol fees in ETH, e.g., 0x v3
contract ParaSwapV4Adapter is AdapterBase2, ParaSwapV4ActionsMixin {
    using SafeMath for uint256;

    constructor(
        address _integrationManager,
        address _augustusSwapper,
        address _tokenTransferProxy
    )
        public
        AdapterBase2(_integrationManager)
        ParaSwapV4ActionsMixin(_augustusSwapper, _tokenTransferProxy)
    {}

    // EXTERNAL FUNCTIONS

    /// @notice Provides a constant string identifier for an adapter
    /// @return identifier_ An identifier string
    function identifier() external pure override returns (string memory identifier_) {
        return "PARA_SWAP_V4";
    }

    /// @notice Parses the expected assets to receive from a call on integration
    /// @param _selector The function selector for the callOnIntegration
    /// @param _encodedCallArgs The encoded parameters for the callOnIntegration
    /// @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 parseAssetsForMethod(bytes4 _selector, bytes calldata _encodedCallArgs)
        external
        view
        override
        returns (
            IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_,
            address[] memory spendAssets_,
            uint256[] memory spendAssetAmounts_,
            address[] memory incomingAssets_,
            uint256[] memory minIncomingAssetAmounts_
        )
    {
        require(_selector == TAKE_ORDER_SELECTOR, "parseAssetsForMethod: _selector invalid");

        (
            uint256 minIncomingAssetAmount,
            ,
            address outgoingAsset,
            uint256 outgoingAssetAmount,
            IParaSwapV4AugustusSwapper.Path[] memory paths
        ) = __decodeCallArgs(_encodedCallArgs);

        spendAssets_ = new address[](1);
        spendAssets_[0] = outgoingAsset;

        spendAssetAmounts_ = new uint256[](1);
        spendAssetAmounts_[0] = outgoingAssetAmount;

        incomingAssets_ = new address[](1);
        incomingAssets_[0] = paths[paths.length - 1].to;

        minIncomingAssetAmounts_ = new uint256[](1);
        minIncomingAssetAmounts_[0] = minIncomingAssetAmount;

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

    /// @notice Trades assets on ParaSwap
    /// @param _vaultProxy The VaultProxy of the calling fund
    /// @param _encodedCallArgs Encoded order parameters
    /// @dev ParaSwap v4 completely uses entire outgoing asset balance and incoming asset
    /// is sent directly to the beneficiary (the _vaultProxy)
    function takeOrder(
        address _vaultProxy,
        bytes calldata _encodedCallArgs,
        bytes calldata
    ) external onlyIntegrationManager {
        (
            uint256 minIncomingAssetAmount,
            uint256 expectedIncomingAssetAmount,
            address outgoingAsset,
            uint256 outgoingAssetAmount,
            IParaSwapV4AugustusSwapper.Path[] memory paths
        ) = __decodeCallArgs(_encodedCallArgs);

        __paraSwapV4MultiSwap(
            outgoingAsset,
            outgoingAssetAmount,
            minIncomingAssetAmount,
            expectedIncomingAssetAmount,
            payable(_vaultProxy),
            paths
        );
    }

    /// @dev Helper to decode the encoded callOnIntegration call arguments
    function __decodeCallArgs(bytes memory _encodedCallArgs)
        private
        pure
        returns (
            uint256 minIncomingAssetAmount_,
            uint256 expectedIncomingAssetAmount_, // Passed as a courtesy to ParaSwap for analytics
            address outgoingAsset_,
            uint256 outgoingAssetAmount_,
            IParaSwapV4AugustusSwapper.Path[] memory paths_
        )
    {
        return
            abi.decode(
                _encodedCallArgs,
                (uint256, uint256, address, uint256, IParaSwapV4AugustusSwapper.Path[])
            );
    }
}

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, Remove}
}

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 identifier() external pure returns (string memory identifier_);

    function parseAssetsForMethod(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/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.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 {
    using SafeERC20 for ERC20;

    address internal immutable INTEGRATION_MANAGER;

    /// @dev Provides a standard implementation for transferring assets between
    /// the fund's VaultProxy and the adapter, by wrapping the adapter action.
    /// This modifier should be implemented in almost all adapter actions, unless they
    /// do not move assets or can spend and receive assets directly with the VaultProxy
    modifier fundAssetsTransferHandler(
        address _vaultProxy,
        bytes memory _encodedAssetTransferArgs
    ) {
        (
            IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType,
            address[] memory spendAssets,
            uint256[] memory spendAssetAmounts,
            address[] memory incomingAssets
        ) = __decodeEncodedAssetTransferArgs(_encodedAssetTransferArgs);

        // Take custody of spend assets (if necessary)
        if (spendAssetsHandleType == IIntegrationManager.SpendAssetsHandleType.Approve) {
            for (uint256 i = 0; i < spendAssets.length; i++) {
                ERC20(spendAssets[i]).safeTransferFrom(
                    _vaultProxy,
                    address(this),
                    spendAssetAmounts[i]
                );
            }
        }

        // Execute call
        _;

        // Transfer remaining assets back to the fund's VaultProxy
        __transferContractAssetBalancesToFund(_vaultProxy, incomingAssets);
        __transferContractAssetBalancesToFund(_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 for adapters to approve their integratees with the max amount of an asset.
    /// Since everything is done atomically, and only the balances to-be-used are sent to adapters,
    /// there is no need to approve exact amounts on every call.
    function __approveMaxAsNeeded(
        address _asset,
        address _target,
        uint256 _neededAmount
    ) internal {
        if (ERC20(_asset).allowance(address(this), _target) < _neededAmount) {
            ERC20(_asset).safeApprove(_target, type(uint256).max);
        }
    }

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

    /// @dev Helper to transfer full contract balances of assets to the specified VaultProxy
    function __transferContractAssetBalancesToFund(address _vaultProxy, address[] memory _assets)
        private
    {
        for (uint256 i = 0; i < _assets.length; i++) {
            uint256 postCallAmount = ERC20(_assets[i]).balanceOf(address(this));
            if (postCallAmount > 0) {
                ERC20(_assets[i]).safeTransfer(_vaultProxy, postCallAmount);
            }
        }
    }

    ///////////////////
    // 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 : AdapterBase2.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 "./AdapterBase.sol";

/// @title AdapterBase2 Contract
/// @author Enzyme Council <[email protected]>
/// @notice A base contract for integration adapters that extends AdapterBase
/// @dev This is a temporary contract that will be merged into AdapterBase with the next release
abstract contract AdapterBase2 is AdapterBase {
    /// @dev Provides a standard implementation for transferring incoming assets and
    /// unspent spend assets from an adapter to a VaultProxy at the end of an adapter action
    modifier postActionAssetsTransferHandler(
        address _vaultProxy,
        bytes memory _encodedAssetTransferArgs
    ) {
        _;

        (
            ,
            address[] memory spendAssets,
            ,
            address[] memory incomingAssets
        ) = __decodeEncodedAssetTransferArgs(_encodedAssetTransferArgs);

        __transferFullAssetBalances(_vaultProxy, incomingAssets);
        __transferFullAssetBalances(_vaultProxy, spendAssets);
    }

    /// @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 _encodedAssetTransferArgs
    ) {
        _;

        (, , , address[] memory incomingAssets) = __decodeEncodedAssetTransferArgs(
            _encodedAssetTransferArgs
        );

        __transferFullAssetBalances(_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 _encodedAssetTransferArgs
    ) {
        _;

        (, address[] memory spendAssets, , ) = __decodeEncodedAssetTransferArgs(
            _encodedAssetTransferArgs
        );

        __transferFullAssetBalances(_vaultProxy, spendAssets);
    }

    constructor(address _integrationManager) public AdapterBase(_integrationManager) {}

    /// @dev Helper to transfer full asset balances of current contract to the specified target
    function __transferFullAssetBalances(address _target, address[] memory _assets) internal {
        for (uint256 i = 0; i < _assets.length; i++) {
            uint256 balance = ERC20(_assets[i]).balanceOf(address(this));
            if (balance > 0) {
                ERC20(_assets[i]).safeTransfer(_target, balance);
            }
        }
    }
}

File 12 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 {
    bytes4 public constant ADD_TRACKED_ASSETS_SELECTOR = bytes4(
        keccak256("addTrackedAssets(address,bytes,bytes)")
    );

    // Asset approval
    bytes4 public constant APPROVE_ASSETS_SELECTOR = bytes4(
        keccak256("approveAssets(address,bytes,bytes)")
    );

    // Trading
    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 CLAIM_REWARDS_AND_REINVEST_SELECTOR = bytes4(
        keccak256("claimRewardsAndReinvest(address,bytes,bytes)")
    );
    bytes4 public constant CLAIM_REWARDS_AND_SWAP_SELECTOR = bytes4(
        keccak256("claimRewardsAndSwap(address,bytes,bytes)")
    );
    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 13 of 15 : ParaSwapV4ActionsMixin.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/IParaSwapV4AugustusSwapper.sol";
import "../../../../../utils/AssetHelpers.sol";

/// @title ParaSwapV4ActionsMixin Contract
/// @author Enzyme Council <[email protected]>
/// @notice Mixin contract for interacting with ParaSwap (v4)
abstract contract ParaSwapV4ActionsMixin is AssetHelpers {
    string private constant REFERRER = "enzyme";

    address private immutable PARA_SWAP_V4_AUGUSTUS_SWAPPER;
    address private immutable PARA_SWAP_V4_TOKEN_TRANSFER_PROXY;

    constructor(address _augustusSwapper, address _tokenTransferProxy) public {
        PARA_SWAP_V4_AUGUSTUS_SWAPPER = _augustusSwapper;
        PARA_SWAP_V4_TOKEN_TRANSFER_PROXY = _tokenTransferProxy;
    }

    /// @dev Helper to execute a multiSwap() order
    function __paraSwapV4MultiSwap(
        address _fromToken,
        uint256 _fromAmount,
        uint256 _toAmount,
        uint256 _expectedAmount,
        address payable _beneficiary,
        IParaSwapV4AugustusSwapper.Path[] memory _path
    ) internal {
        __approveAssetMaxAsNeeded(_fromToken, PARA_SWAP_V4_TOKEN_TRANSFER_PROXY, _fromAmount);

        IParaSwapV4AugustusSwapper.SellData memory sellData = IParaSwapV4AugustusSwapper.SellData({
            fromToken: _fromToken,
            fromAmount: _fromAmount,
            toAmount: _toAmount,
            expectedAmount: _expectedAmount,
            beneficiary: _beneficiary,
            referrer: REFERRER,
            useReduxToken: false,
            path: _path
        });

        IParaSwapV4AugustusSwapper(PARA_SWAP_V4_AUGUSTUS_SWAPPER).multiSwap(sellData);
    }

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

    /// @notice Gets the `PARA_SWAP_V4_AUGUSTUS_SWAPPER` variable
    /// @return augustusSwapper_ The `PARA_SWAP_V4_AUGUSTUS_SWAPPER` variable value
    function getParaSwapV4AugustusSwapper() public view returns (address augustusSwapper_) {
        return PARA_SWAP_V4_AUGUSTUS_SWAPPER;
    }

    /// @notice Gets the `PARA_SWAP_V4_TOKEN_TRANSFER_PROXY` variable
    /// @return tokenTransferProxy_ The `PARA_SWAP_V4_TOKEN_TRANSFER_PROXY` variable value
    function getParaSwapV4TokenTransferProxy() public view returns (address tokenTransferProxy_) {
        return PARA_SWAP_V4_TOKEN_TRANSFER_PROXY;
    }
}

File 14 of 15 : IParaSwapV4AugustusSwapper.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 ParaSwap V4 IAugustusSwapper interface
interface IParaSwapV4AugustusSwapper {
    struct Route {
        address payable exchange;
        address targetExchange;
        uint256 percent;
        bytes payload;
        uint256 networkFee;
    }

    struct Path {
        address to;
        uint256 totalNetworkFee;
        Route[] routes;
    }

    struct SellData {
        address fromToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        string referrer;
        bool useReduxToken;
        Path[] path;
    }

    function multiSwap(SellData calldata) external payable returns (uint256);
}

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 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 {
        if (ERC20(_asset).allowance(address(this), _target) < _neededAmount) {
            ERC20(_asset).safeApprove(_target, type(uint256).max);
        }
    }

    /// @dev Helper to get the balances of specified assets for a target
    function __getAssetBalances(address _target, address[] memory _assets)
        internal
        view
        returns (uint256[] memory balances_)
    {
        balances_ = new uint256[](_assets.length);
        for (uint256 i; i < _assets.length; i++) {
            balances_[i] = ERC20(_assets[i]).balanceOf(_target);
        }

        return balances_;
    }

    /// @dev Helper to transfer full asset balances from a target to the current contract.
    /// Requires an adequate allowance for each asset granted to the current contract for the target.
    function __pullFullAssetBalances(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(_target);
            if (amountsTransferred_[i] > 0) {
                assetContract.safeTransferFrom(_target, address(this), amountsTransferred_[i]);
            }
        }

        return amountsTransferred_;
    }

    /// @dev Helper to transfer partial asset balances from a target to the current contract.
    /// Requires an adequate allowance for each asset granted to the current contract for the target.
    function __pullPartialAssetBalances(
        address _target,
        address[] memory _assets,
        uint256[] memory _amountsToExclude
    ) 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(_target).sub(_amountsToExclude[i]);
            if (amountsTransferred_[i] > 0) {
                assetContract.safeTransferFrom(_target, address(this), amountsTransferred_[i]);
            }
        }

        return amountsTransferred_;
    }

    /// @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",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_integrationManager","type":"address"},{"internalType":"address","name":"_augustusSwapper","type":"address"},{"internalType":"address","name":"_tokenTransferProxy","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ADD_TRACKED_ASSETS_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"APPROVE_ASSETS_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CLAIM_REWARDS_AND_REINVEST_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CLAIM_REWARDS_AND_SWAP_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"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":"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_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":[],"name":"getParaSwapV4AugustusSwapper","outputs":[{"internalType":"address","name":"augustusSwapper_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getParaSwapV4TokenTransferProxy","outputs":[{"internalType":"address","name":"tokenTransferProxy_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"identifier","outputs":[{"internalType":"string","name":"identifier_","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_selector","type":"bytes4"},{"internalType":"bytes","name":"_encodedCallArgs","type":"bytes"}],"name":"parseAssetsForMethod","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":"_encodedCallArgs","type":"bytes"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"takeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e06040523480156200001157600080fd5b506040516200198c3803806200198c83398101604081905262000034916200006f565b6001600160601b0319606093841b811660805291831b821660a05290911b1660c052620000ef565b80516200006981620000d5565b92915050565b6000806000606084860312156200008557600080fd5b60006200009386866200005c565b9350506020620000a6868287016200005c565b9250506040620000b9868287016200005c565b9150509250925092565b60006001600160a01b03821662000069565b620000e081620000c3565b8114620000ec57600080fd5b50565b60805160601c60a05160601c60c05160601c6118586200013460003980610602528061070c52508061039a52806107aa52508061020f528061066e52506118586000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80637998a1c4116100a2578063e27a06b511610071578063e27a06b5146101dc578063e4d90478146101e4578063e7c45690146101ec578063f0753994146101f4578063f7d882b5146101fc57610116565b80637998a1c4146101af578063863e5ad0146101c4578063b23228cf146101cc578063c7308c03146101d457610116565b80633ffc1591116100e95780633ffc15911461015e57806340da225d146101665780635ca62b3c1461016e5780635e21197a1461017657806376cc7ac61461018b57610116565b806303e38a2b1461011b578063080456c114610130578063131461c01461014e578063257cb1a314610156575b600080fd5b61012e610129366004610e97565b610204565b005b6101386102c0565b60405161014591906115fc565b60405180910390f35b6101386102e4565b610138610308565b61013861032c565b610138610350565b610138610374565b61017e610398565b60405161014591906115b8565b61019e610199366004610f44565b6103bc565b60405161014595949392919061160a565b6101b7610592565b6040516101459190611666565b6101386105b8565b6101386105dc565b61017e610600565b610138610624565b610138610648565b61017e61066c565b610138610690565b6101386106b4565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146102555760405162461bcd60e51b815260040161024c90611697565b60405180910390fd5b600080600080606061029c89898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506106d892505050565b945094509450945094506102b4838387878e86610706565b50505050505050505050565b7f8334eb99be0145865eba9889fca2ee920288090caefff4cc776038e20ad9259a81565b7f29fa046e79524c3c5ac4c01df692c35e217802b2b13b21121b76cf0ef02b138c81565b7f099f75155f0e997bf83a7993a71d5e7e7540bd386fe1e84643a09ce6b412521981565b7ffa7dd04da627f433da73c4355ead9c75682a67a8fc84d3f6170ef0922f402d2481565b7fb9dfbaccbe5cd2a84fdcf1d15f23ef25d23086f5afbaa99516065ed4a5bbc7a381565b7fdfd5ee0f6067928bf85a7c4430811282840bc99332dda3dab462c02bf95b67cc81565b7f000000000000000000000000000000000000000000000000000000000000000090565b600060608080806001600160e01b031988166303e38a2b60e01b146103f35760405162461bcd60e51b815260040161024c90611677565b600080600060606104398b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506106d892505050565b945094509450509350600167ffffffffffffffff8111801561045a57600080fd5b50604051908082528060200260200182016040528015610484578160200160208202803683370190505b509750828860008151811061049557fe5b6001600160a01b039290921660209283029190910182015260408051600180825281830190925291828101908036833701905050965081876000815181106104d957fe5b6020908102919091010152604080516001808252818301909252908160200160208202803683370190505095508060018251038151811061051657fe5b6020026020010151600001518660008151811061052f57fe5b6001600160a01b0392909216602092830291909101820152604080516001808252818301909252918281019080368337019050509450838560008151811061057357fe5b6020026020010181815250506002985050505050939792965093509350565b60408051808201909152600c81526b1410549057d4d5d05417d58d60a21b602082015290565b7f03e38a2bd7063d45c897edeafc330e71657502dd86434d3c37a489caf116af6981565b7f68e30677f607df46e87da13e15b637784cfa62374b653f35ab43d10361a2f83081565b7f000000000000000000000000000000000000000000000000000000000000000090565b7f848f3a590fb2f9795d1a275009c54c26c53833277c96b90e0ddd01753a1d590681565b7f3377e18acf9e83665eacd6af109261424fca32a298e2fc2e6095ba563fb8390e81565b7f000000000000000000000000000000000000000000000000000000000000000090565b7f1d51f49b5273d9ddbb643dc349fab8d36dbb470209c2ea71033bea49dd311c2781565b7fc29fa9dde84204c2908778afd0613d802d31cf046179b88f6d2b4a4e507ea2d581565b6000806000806060858060200190518101906106f49190610fb8565b939a9299509097509550909350915050565b610731867f000000000000000000000000000000000000000000000000000000000000000087610850565b610739610b92565b604051806101000160405280886001600160a01b03168152602001878152602001868152602001858152602001846001600160a01b0316815260200160405180604001604052806006815260200165656e7a796d6560d01b81525081526020016000151581526020018381525090507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638f00eccb826040518263ffffffff1660e01b81526004016107f491906116d7565b602060405180830381600087803b15801561080e57600080fd5b505af1158015610822573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108469190610f9a565b5050505050505050565b604051636eb1769f60e11b815281906001600160a01b0385169063dd62ed3e9061088090309087906004016115c6565b60206040518083038186803b15801561089857600080fd5b505afa1580156108ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d09190610f9a565b10156108ec576108ec6001600160a01b038416836000196108f1565b505050565b8015806109795750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e9061092790309086906004016115c6565b60206040518083038186803b15801561093f57600080fd5b505afa158015610953573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109779190610f9a565b155b6109955760405162461bcd60e51b815260040161024c906116c7565b6108ec8363095ea7b360e01b84846040516024016109b49291906115e1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526060610a3b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a759092919063ffffffff16565b8051909150156108ec5780806020019051810190610a599190610f1e565b6108ec5760405162461bcd60e51b815260040161024c906116b7565b6060610a848484600085610a8e565b90505b9392505050565b606082471015610ab05760405162461bcd60e51b815260040161024c90611687565b610ab985610b4f565b610ad55760405162461bcd60e51b815260040161024c906116a7565b60006060866001600160a01b03168587604051610af291906115ac565b60006040518083038185875af1925050503d8060008114610b2f576040519150601f19603f3d011682016040523d82523d6000602084013e610b34565b606091505b5091509150610b44828286610b59565b979650505050505050565b803b15155b919050565b60608315610b68575081610a87565b825115610b785782518084602001fd5b8160405162461bcd60e51b815260040161024c9190611666565b60405180610100016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160608152602001600015158152602001606081525090565b8035610bf6816117f3565b92915050565b8051610bf6816117f3565b600082601f830112610c1857600080fd5b8151610c2b610c268261170f565b6116e8565b81815260209384019390925082018360005b83811015610c695781518601610c538882610d7e565b8452506020928301929190910190600101610c3d565b5050505092915050565b600082601f830112610c8457600080fd5b8151610c92610c268261170f565b81815260209384019390925082018360005b83811015610c695781518601610cba8882610df1565b8452506020928301929190910190600101610ca4565b8051610bf681611807565b8035610bf681611810565b60008083601f840112610cf857600080fd5b50813567ffffffffffffffff811115610d1057600080fd5b602083019150836001820283011115610d2857600080fd5b9250929050565b600082601f830112610d4057600080fd5b8151610d4e610c2682611730565b91508082526020830160208301858383011115610d6a57600080fd5b610d758382846117ac565b50505092915050565b600060608284031215610d9057600080fd5b610d9a60606116e8565b90506000610da88484610bfc565b8252506020610db984848301610e8c565b602083015250604082015167ffffffffffffffff811115610dd957600080fd5b610de584828501610c73565b60408301525092915050565b600060a08284031215610e0357600080fd5b610e0d60a06116e8565b90506000610e1b8484610bfc565b8252506020610e2c84848301610bfc565b6020830152506040610e4084828501610e8c565b604083015250606082015167ffffffffffffffff811115610e6057600080fd5b610e6c84828501610d2f565b6060830152506080610e8084828501610e8c565b60808301525092915050565b8051610bf681611819565b600080600080600060608688031215610eaf57600080fd5b6000610ebb8888610beb565b955050602086013567ffffffffffffffff811115610ed857600080fd5b610ee488828901610ce6565b9450945050604086013567ffffffffffffffff811115610f0357600080fd5b610f0f88828901610ce6565b92509250509295509295909350565b600060208284031215610f3057600080fd5b6000610f3c8484610cd0565b949350505050565b600080600060408486031215610f5957600080fd5b6000610f658686610cdb565b935050602084013567ffffffffffffffff811115610f8257600080fd5b610f8e86828701610ce6565b92509250509250925092565b600060208284031215610fac57600080fd5b6000610f3c8484610e8c565b600080600080600060a08688031215610fd057600080fd5b6000610fdc8888610e8c565b9550506020610fed88828901610e8c565b9450506040610ffe88828901610bfc565b935050606061100f88828901610e8c565b925050608086015167ffffffffffffffff81111561102c57600080fd5b61103888828901610c07565b9150509295509295909350565b6000611051838361107d565b505060200190565b6000610a878383611446565b6000610a87838361148e565b600061105183836115a3565b6110868161176b565b82525050565b60006110978261175e565b6110a18185611762565b93506110ac83611758565b8060005b838110156110da5781516110c48882611045565b97506110cf83611758565b9250506001016110b0565b509495945050505050565b60006110f08261175e565b6110fa8185611762565b93508360208202850161110c85611758565b8060005b8581101561114657848403895281516111298582611059565b945061113483611758565b60209a909a0199925050600101611110565b5091979650505050505050565b600061115e8261175e565b6111688185611762565b93508360208202850161117a85611758565b8060005b8581101561114657848403895281516111978582611065565b94506111a283611758565b60209a909a019992505060010161117e565b60006111bf8261175e565b6111c98185611762565b93506111d483611758565b8060005b838110156110da5781516111ec8882611071565b97506111f783611758565b9250506001016111d8565b61108681611776565b6110868161177b565b600061121f8261175e565b6112298185611762565b93506112398185602086016117ac565b611242816117dc565b9093019392505050565b60006112578261175e565b6112618185610b54565b93506112718185602086016117ac565b9290920192915050565b611086816117a1565b6000611291602783611762565b7f7061727365417373657473466f724d6574686f643a205f73656c6563746f72208152661a5b9d985b1a5960ca1b602082015260400192915050565b60006112da602683611762565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b602082015260400192915050565b6000611322603283611762565b7f4f6e6c792074686520496e746567726174696f6e4d616e616765722063616e2081527131b0b636103a3434b990333ab731ba34b7b760711b602082015260400192915050565b6000611376601d83611762565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815260200192915050565b60006113af602a83611762565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015260400192915050565b60006113fb603683611762565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b602082015260400192915050565b8051600090606084019061145a858261107d565b50602083015161146d60208601826115a3565b50604083015184820360408601526114858282611153565b95945050505050565b805160009060a08401906114a2858261107d565b5060208301516114b5602086018261107d565b5060408301516114c860408601826115a3565b50606083015184820360608601526114e08282611214565b91505060808301516114f560808601826115a3565b509392505050565b8051600090610100840190611512858261107d565b50602083015161152560208601826115a3565b50604083015161153860408601826115a3565b50606083015161154b60608601826115a3565b50608083015161155e608086018261107d565b5060a083015184820360a08601526115768282611214565b91505060c083015161158b60c0860182611202565b5060e083015184820360e086015261148582826110e5565b6110868161179e565b6000610a87828461124c565b60208101610bf6828461107d565b604081016115d4828561107d565b610a87602083018461107d565b604081016115ef828561107d565b610a8760208301846115a3565b60208101610bf6828461120b565b60a08101611618828861127b565b818103602083015261162a818761108c565b9050818103604083015261163e81866111b4565b90508181036060830152611652818561108c565b90508181036080830152610b4481846111b4565b60208082528101610a878184611214565b60208082528101610bf681611284565b60208082528101610bf6816112cd565b60208082528101610bf681611315565b60208082528101610bf681611369565b60208082528101610bf6816113a2565b60208082528101610bf6816113ee565b60208082528101610a8781846114fd565b60405181810167ffffffffffffffff8111828210171561170757600080fd5b604052919050565b600067ffffffffffffffff82111561172657600080fd5b5060209081020190565b600067ffffffffffffffff82111561174757600080fd5b506020601f91909101601f19160190565b60200190565b5190565b90815260200190565b6000610bf682611792565b151590565b6001600160e01b03191690565b80610b54816117e6565b6001600160a01b031690565b90565b6000610bf682611788565b60005b838110156117c75781810151838201526020016117af565b838111156117d6576000848401525b50505050565b601f01601f191690565b600481106117f057fe5b50565b6117fc8161176b565b81146117f057600080fd5b6117fc81611776565b6117fc8161177b565b6117fc8161179e56fea26469706673582212200b320beb50a0713a7b56a68fb05e797b1a1a7fe8fa79ab077b2d5d0ea0a8b99c64736f6c634300060c0033000000000000000000000000965ca477106476b4600562a2ebe13536581883a60000000000000000000000001bd435f3c054b6e901b7b108a0ab7617c808677b000000000000000000000000b70bc06d2c9bf03b3373799606dc7d39346c06b3

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c80637998a1c4116100a2578063e27a06b511610071578063e27a06b5146101dc578063e4d90478146101e4578063e7c45690146101ec578063f0753994146101f4578063f7d882b5146101fc57610116565b80637998a1c4146101af578063863e5ad0146101c4578063b23228cf146101cc578063c7308c03146101d457610116565b80633ffc1591116100e95780633ffc15911461015e57806340da225d146101665780635ca62b3c1461016e5780635e21197a1461017657806376cc7ac61461018b57610116565b806303e38a2b1461011b578063080456c114610130578063131461c01461014e578063257cb1a314610156575b600080fd5b61012e610129366004610e97565b610204565b005b6101386102c0565b60405161014591906115fc565b60405180910390f35b6101386102e4565b610138610308565b61013861032c565b610138610350565b610138610374565b61017e610398565b60405161014591906115b8565b61019e610199366004610f44565b6103bc565b60405161014595949392919061160a565b6101b7610592565b6040516101459190611666565b6101386105b8565b6101386105dc565b61017e610600565b610138610624565b610138610648565b61017e61066c565b610138610690565b6101386106b4565b336001600160a01b037f000000000000000000000000965ca477106476b4600562a2ebe13536581883a616146102555760405162461bcd60e51b815260040161024c90611697565b60405180910390fd5b600080600080606061029c89898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506106d892505050565b945094509450945094506102b4838387878e86610706565b50505050505050505050565b7f8334eb99be0145865eba9889fca2ee920288090caefff4cc776038e20ad9259a81565b7f29fa046e79524c3c5ac4c01df692c35e217802b2b13b21121b76cf0ef02b138c81565b7f099f75155f0e997bf83a7993a71d5e7e7540bd386fe1e84643a09ce6b412521981565b7ffa7dd04da627f433da73c4355ead9c75682a67a8fc84d3f6170ef0922f402d2481565b7fb9dfbaccbe5cd2a84fdcf1d15f23ef25d23086f5afbaa99516065ed4a5bbc7a381565b7fdfd5ee0f6067928bf85a7c4430811282840bc99332dda3dab462c02bf95b67cc81565b7f0000000000000000000000001bd435f3c054b6e901b7b108a0ab7617c808677b90565b600060608080806001600160e01b031988166303e38a2b60e01b146103f35760405162461bcd60e51b815260040161024c90611677565b600080600060606104398b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506106d892505050565b945094509450509350600167ffffffffffffffff8111801561045a57600080fd5b50604051908082528060200260200182016040528015610484578160200160208202803683370190505b509750828860008151811061049557fe5b6001600160a01b039290921660209283029190910182015260408051600180825281830190925291828101908036833701905050965081876000815181106104d957fe5b6020908102919091010152604080516001808252818301909252908160200160208202803683370190505095508060018251038151811061051657fe5b6020026020010151600001518660008151811061052f57fe5b6001600160a01b0392909216602092830291909101820152604080516001808252818301909252918281019080368337019050509450838560008151811061057357fe5b6020026020010181815250506002985050505050939792965093509350565b60408051808201909152600c81526b1410549057d4d5d05417d58d60a21b602082015290565b7f03e38a2bd7063d45c897edeafc330e71657502dd86434d3c37a489caf116af6981565b7f68e30677f607df46e87da13e15b637784cfa62374b653f35ab43d10361a2f83081565b7f000000000000000000000000b70bc06d2c9bf03b3373799606dc7d39346c06b390565b7f848f3a590fb2f9795d1a275009c54c26c53833277c96b90e0ddd01753a1d590681565b7f3377e18acf9e83665eacd6af109261424fca32a298e2fc2e6095ba563fb8390e81565b7f000000000000000000000000965ca477106476b4600562a2ebe13536581883a690565b7f1d51f49b5273d9ddbb643dc349fab8d36dbb470209c2ea71033bea49dd311c2781565b7fc29fa9dde84204c2908778afd0613d802d31cf046179b88f6d2b4a4e507ea2d581565b6000806000806060858060200190518101906106f49190610fb8565b939a9299509097509550909350915050565b610731867f000000000000000000000000b70bc06d2c9bf03b3373799606dc7d39346c06b387610850565b610739610b92565b604051806101000160405280886001600160a01b03168152602001878152602001868152602001858152602001846001600160a01b0316815260200160405180604001604052806006815260200165656e7a796d6560d01b81525081526020016000151581526020018381525090507f0000000000000000000000001bd435f3c054b6e901b7b108a0ab7617c808677b6001600160a01b0316638f00eccb826040518263ffffffff1660e01b81526004016107f491906116d7565b602060405180830381600087803b15801561080e57600080fd5b505af1158015610822573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108469190610f9a565b5050505050505050565b604051636eb1769f60e11b815281906001600160a01b0385169063dd62ed3e9061088090309087906004016115c6565b60206040518083038186803b15801561089857600080fd5b505afa1580156108ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d09190610f9a565b10156108ec576108ec6001600160a01b038416836000196108f1565b505050565b8015806109795750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e9061092790309086906004016115c6565b60206040518083038186803b15801561093f57600080fd5b505afa158015610953573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109779190610f9a565b155b6109955760405162461bcd60e51b815260040161024c906116c7565b6108ec8363095ea7b360e01b84846040516024016109b49291906115e1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526060610a3b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a759092919063ffffffff16565b8051909150156108ec5780806020019051810190610a599190610f1e565b6108ec5760405162461bcd60e51b815260040161024c906116b7565b6060610a848484600085610a8e565b90505b9392505050565b606082471015610ab05760405162461bcd60e51b815260040161024c90611687565b610ab985610b4f565b610ad55760405162461bcd60e51b815260040161024c906116a7565b60006060866001600160a01b03168587604051610af291906115ac565b60006040518083038185875af1925050503d8060008114610b2f576040519150601f19603f3d011682016040523d82523d6000602084013e610b34565b606091505b5091509150610b44828286610b59565b979650505050505050565b803b15155b919050565b60608315610b68575081610a87565b825115610b785782518084602001fd5b8160405162461bcd60e51b815260040161024c9190611666565b60405180610100016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160608152602001600015158152602001606081525090565b8035610bf6816117f3565b92915050565b8051610bf6816117f3565b600082601f830112610c1857600080fd5b8151610c2b610c268261170f565b6116e8565b81815260209384019390925082018360005b83811015610c695781518601610c538882610d7e565b8452506020928301929190910190600101610c3d565b5050505092915050565b600082601f830112610c8457600080fd5b8151610c92610c268261170f565b81815260209384019390925082018360005b83811015610c695781518601610cba8882610df1565b8452506020928301929190910190600101610ca4565b8051610bf681611807565b8035610bf681611810565b60008083601f840112610cf857600080fd5b50813567ffffffffffffffff811115610d1057600080fd5b602083019150836001820283011115610d2857600080fd5b9250929050565b600082601f830112610d4057600080fd5b8151610d4e610c2682611730565b91508082526020830160208301858383011115610d6a57600080fd5b610d758382846117ac565b50505092915050565b600060608284031215610d9057600080fd5b610d9a60606116e8565b90506000610da88484610bfc565b8252506020610db984848301610e8c565b602083015250604082015167ffffffffffffffff811115610dd957600080fd5b610de584828501610c73565b60408301525092915050565b600060a08284031215610e0357600080fd5b610e0d60a06116e8565b90506000610e1b8484610bfc565b8252506020610e2c84848301610bfc565b6020830152506040610e4084828501610e8c565b604083015250606082015167ffffffffffffffff811115610e6057600080fd5b610e6c84828501610d2f565b6060830152506080610e8084828501610e8c565b60808301525092915050565b8051610bf681611819565b600080600080600060608688031215610eaf57600080fd5b6000610ebb8888610beb565b955050602086013567ffffffffffffffff811115610ed857600080fd5b610ee488828901610ce6565b9450945050604086013567ffffffffffffffff811115610f0357600080fd5b610f0f88828901610ce6565b92509250509295509295909350565b600060208284031215610f3057600080fd5b6000610f3c8484610cd0565b949350505050565b600080600060408486031215610f5957600080fd5b6000610f658686610cdb565b935050602084013567ffffffffffffffff811115610f8257600080fd5b610f8e86828701610ce6565b92509250509250925092565b600060208284031215610fac57600080fd5b6000610f3c8484610e8c565b600080600080600060a08688031215610fd057600080fd5b6000610fdc8888610e8c565b9550506020610fed88828901610e8c565b9450506040610ffe88828901610bfc565b935050606061100f88828901610e8c565b925050608086015167ffffffffffffffff81111561102c57600080fd5b61103888828901610c07565b9150509295509295909350565b6000611051838361107d565b505060200190565b6000610a878383611446565b6000610a87838361148e565b600061105183836115a3565b6110868161176b565b82525050565b60006110978261175e565b6110a18185611762565b93506110ac83611758565b8060005b838110156110da5781516110c48882611045565b97506110cf83611758565b9250506001016110b0565b509495945050505050565b60006110f08261175e565b6110fa8185611762565b93508360208202850161110c85611758565b8060005b8581101561114657848403895281516111298582611059565b945061113483611758565b60209a909a0199925050600101611110565b5091979650505050505050565b600061115e8261175e565b6111688185611762565b93508360208202850161117a85611758565b8060005b8581101561114657848403895281516111978582611065565b94506111a283611758565b60209a909a019992505060010161117e565b60006111bf8261175e565b6111c98185611762565b93506111d483611758565b8060005b838110156110da5781516111ec8882611071565b97506111f783611758565b9250506001016111d8565b61108681611776565b6110868161177b565b600061121f8261175e565b6112298185611762565b93506112398185602086016117ac565b611242816117dc565b9093019392505050565b60006112578261175e565b6112618185610b54565b93506112718185602086016117ac565b9290920192915050565b611086816117a1565b6000611291602783611762565b7f7061727365417373657473466f724d6574686f643a205f73656c6563746f72208152661a5b9d985b1a5960ca1b602082015260400192915050565b60006112da602683611762565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b602082015260400192915050565b6000611322603283611762565b7f4f6e6c792074686520496e746567726174696f6e4d616e616765722063616e2081527131b0b636103a3434b990333ab731ba34b7b760711b602082015260400192915050565b6000611376601d83611762565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815260200192915050565b60006113af602a83611762565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015260400192915050565b60006113fb603683611762565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b602082015260400192915050565b8051600090606084019061145a858261107d565b50602083015161146d60208601826115a3565b50604083015184820360408601526114858282611153565b95945050505050565b805160009060a08401906114a2858261107d565b5060208301516114b5602086018261107d565b5060408301516114c860408601826115a3565b50606083015184820360608601526114e08282611214565b91505060808301516114f560808601826115a3565b509392505050565b8051600090610100840190611512858261107d565b50602083015161152560208601826115a3565b50604083015161153860408601826115a3565b50606083015161154b60608601826115a3565b50608083015161155e608086018261107d565b5060a083015184820360a08601526115768282611214565b91505060c083015161158b60c0860182611202565b5060e083015184820360e086015261148582826110e5565b6110868161179e565b6000610a87828461124c565b60208101610bf6828461107d565b604081016115d4828561107d565b610a87602083018461107d565b604081016115ef828561107d565b610a8760208301846115a3565b60208101610bf6828461120b565b60a08101611618828861127b565b818103602083015261162a818761108c565b9050818103604083015261163e81866111b4565b90508181036060830152611652818561108c565b90508181036080830152610b4481846111b4565b60208082528101610a878184611214565b60208082528101610bf681611284565b60208082528101610bf6816112cd565b60208082528101610bf681611315565b60208082528101610bf681611369565b60208082528101610bf6816113a2565b60208082528101610bf6816113ee565b60208082528101610a8781846114fd565b60405181810167ffffffffffffffff8111828210171561170757600080fd5b604052919050565b600067ffffffffffffffff82111561172657600080fd5b5060209081020190565b600067ffffffffffffffff82111561174757600080fd5b506020601f91909101601f19160190565b60200190565b5190565b90815260200190565b6000610bf682611792565b151590565b6001600160e01b03191690565b80610b54816117e6565b6001600160a01b031690565b90565b6000610bf682611788565b60005b838110156117c75781810151838201526020016117af565b838111156117d6576000848401525b50505050565b601f01601f191690565b600481106117f057fe5b50565b6117fc8161176b565b81146117f057600080fd5b6117fc81611776565b6117fc8161177b565b6117fc8161179e56fea26469706673582212200b320beb50a0713a7b56a68fb05e797b1a1a7fe8fa79ab077b2d5d0ea0a8b99c64736f6c634300060c0033

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

000000000000000000000000965ca477106476b4600562a2ebe13536581883a60000000000000000000000001bd435f3c054b6e901b7b108a0ab7617c808677b000000000000000000000000b70bc06d2c9bf03b3373799606dc7d39346c06b3

-----Decoded View---------------
Arg [0] : _integrationManager (address): 0x965ca477106476B4600562a2eBe13536581883A6
Arg [1] : _augustusSwapper (address): 0x1bD435F3C054b6e901B7b108a0ab7617C808677b
Arg [2] : _tokenTransferProxy (address): 0xb70Bc06D2c9Bf03b3373799606dc7d39346c06B3

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000965ca477106476b4600562a2ebe13536581883a6
Arg [1] : 0000000000000000000000001bd435f3c054b6e901b7b108a0ab7617c808677b
Arg [2] : 000000000000000000000000b70bc06d2c9bf03b3373799606dc7d39346c06b3


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.