OneInchV6Evaluator

Description:

Multi-signature wallet contract requiring multiple confirmations for transaction execution.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}
"
    },
    "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165Upgradeable is Initializable, IERC165 {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
"
    },
    "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
"
    },
    "@openzeppelin/contracts/utils/Address.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}
"
    },
    "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
"
    },
    "contracts/compiler/libraries/Path.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

library Path {
    using Path for bytes;

    uint256 internal constant ADDRESS_LEN = 20;
    uint256 internal constant POOL_ID_LEN = 4;
    uint256 internal constant NEXT_OFFSET = ADDRESS_LEN + POOL_ID_LEN;

    error InvalidPathLength(uint256);

    function extractTokenIn(bytes calldata _path) internal pure returns (address tokenIn_) {
        _path.ensureValid();
        tokenIn_ = _path.extractTokenInUnsafe();
    }

    function extractTokenInUnsafe(bytes calldata _path) internal pure returns (address tokenIn_) {
        tokenIn_ = address(bytes20(_path[0:ADDRESS_LEN]));
    }

    function extractTokenOut(bytes calldata _path) internal pure returns (address tokenOut_) {
        _path.ensureValid();
        tokenOut_ = _path.extractTokenOutUnsafe();
    }

    function extractTokenOutUnsafe(bytes calldata _path) internal pure returns (address tokenOut_) {
        uint256 len = _path.length;
        tokenOut_ = address(bytes20(_path[len - ADDRESS_LEN:len]));
    }

    /* solhint-disable var-name-mixedcase */
    function extractPool(
        bytes calldata _path,
        uint256 _poolNumber
    ) internal pure returns (address tokenIn__, address tokenOut_, uint32 poolId_____) {
        /* solhint-enable var-name-mixedcase */
        _path.ensureValid();
        uint256 ptr = _poolNumber * NEXT_OFFSET;

        tokenIn__ = address(bytes20(_path[ptr:(ptr = ptr + ADDRESS_LEN)]));
        poolId_____ = uint32(bytes4(_path[ptr:(ptr = ptr + POOL_ID_LEN)]));
        tokenOut_ = address(bytes20(_path[ptr:(ptr = ptr + ADDRESS_LEN)]));
    }

    function getNumberOfPools(bytes calldata _path) internal pure returns (uint256) {
        _path.ensureValid();
        return (_path.length - ADDRESS_LEN) / NEXT_OFFSET;
    }

    function ensureValid(bytes calldata _path) internal pure {
        if (!isValid(_path)) revert InvalidPathLength(_path.length);
    }

    function isValid(bytes calldata _path) private pure returns (bool) {
        if (_path.length < ADDRESS_LEN) return false;
        return (_path.length - ADDRESS_LEN) % NEXT_OFFSET == 0;
    }
}
"
    },
    "contracts/compiler/oneInchV5/libraries/UniswapTokens.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

import {IUniswapPool} from "contracts/interfaces/compliance/internal/oneInchV5/IUniswapPool.sol";

library UniswapTokens {
    uint256 private constant REVERSE_MASK =
        0x8000000000000000000000000000000000000000000000000000000000000000;

    function getUniswapDstToken(uint256 poolUint) internal view returns (address) {
        IUniswapPool pool = IUniswapPool(address(uint160(poolUint)));
        return poolUint & REVERSE_MASK == 0 ? pool.token1() : pool.token0();
    }

    function getUniswapSrcToken(uint256 poolUint) internal view returns (address) {
        IUniswapPool pool = IUniswapPool(address(uint160(poolUint)));
        return poolUint & REVERSE_MASK == 0 ? pool.token0() : pool.token1();
    }
}
"
    },
    "contracts/compiler/oneInchV6/base/OneInchV6Hub.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {IClipperRouter, OneInchV6HubClipper} from "./OneInchV6HubClipper.sol";
import {IGenericRouter, OneInchV6HubGeneric} from "./OneInchV6HubGeneric.sol";
import {IOrderMixin, OneInchV6HubOrderMixin} from "./OneInchV6HubOrderMixin.sol";
import {IUnoswapRouter, OneInchV6HubUnoswap} from "./OneInchV6HubUnoswap.sol";

struct SwitchResult {
    bool isEth;
    address tokenIn;
    bytes data;
}

abstract contract OneInchV6Hub is
    OneInchV6HubClipper,
    OneInchV6HubGeneric,
    OneInchV6HubOrderMixin,
    OneInchV6HubUnoswap
{
    error UnsupportedOneInchRouterV6Function(bytes4 selector);

    function switchBySelector(
        bytes calldata extraData,
        uint256 amountIn,
        uint256 minAmountOut,
        address payable recipient
    ) internal view returns (SwitchResult memory result) {
        bytes4 selector = bytes4(extraData[:4]);
        bytes calldata payload = extraData[4:];

        if (selector == IGenericRouter.swap.selector) {
            result = swap(payload, amountIn, minAmountOut, recipient);
        } else if (selector == IClipperRouter.clipperSwap.selector) {
            result = clipperSwap(payload, amountIn, minAmountOut);
        } else if (selector == IClipperRouter.clipperSwapTo.selector) {
            result = clipperSwapTo(payload, amountIn, minAmountOut, recipient);
        } else if (selector == IUnoswapRouter.unoswap.selector) {
            result = unoswap(payload, amountIn, minAmountOut);
        } else if (selector == IUnoswapRouter.unoswapTo.selector) {
            result = unoswapTo(payload, amountIn, minAmountOut, recipient);
        } else if (selector == IUnoswapRouter.ethUnoswap.selector) {
            result = ethUnoswap(payload, minAmountOut);
        } else if (selector == IUnoswapRouter.ethUnoswapTo.selector) {
            result = ethUnoswapTo(payload, minAmountOut, recipient);
        } else if (selector == IUnoswapRouter.unoswap2.selector) {
            result = unoswap2(payload, amountIn, minAmountOut);
        } else if (selector == IUnoswapRouter.unoswapTo2.selector) {
            result = unoswapTo2(payload, amountIn, minAmountOut, recipient);
        } else if (selector == IUnoswapRouter.ethUnoswap2.selector) {
            result = ethUnoswap2(payload, minAmountOut);
        } else if (selector == IUnoswapRouter.ethUnoswapTo2.selector) {
            result = ethUnoswapTo2(payload, minAmountOut, recipient);
        } else if (selector == IUnoswapRouter.unoswap3.selector) {
            result = unoswap3(payload, amountIn, minAmountOut);
        } else if (selector == IUnoswapRouter.unoswapTo3.selector) {
            result = unoswapTo3(payload, amountIn, minAmountOut, recipient);
        } else if (selector == IUnoswapRouter.ethUnoswap3.selector) {
            result = ethUnoswap3(payload, minAmountOut);
        } else if (selector == IUnoswapRouter.ethUnoswapTo3.selector) {
            result = ethUnoswapTo3(payload, minAmountOut, recipient);
        } else if (selector == IOrderMixin.fillOrder.selector) {
            result = fillOrder(payload, amountIn, minAmountOut);
        } else if (selector == IOrderMixin.fillOrderArgs.selector) {
            result = fillOrderArgs(payload, amountIn, minAmountOut, recipient);
        } else {
            revert UnsupportedOneInchRouterV6Function(selector);
        }
    }
}
"
    },
    "contracts/compiler/oneInchV6/base/OneInchV6HubClipper.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {
    Address,
    IClipperExchange,
    IClipperRouter,
    IERC20
} from "contracts/interfaces/compliance/internal/oneInchV6/IClipperRouter.sol";

import {Address as AddressLibrary} from "contracts/libraries/Address.sol";

import {Address, AddressLib} from "../libraries/AddressLib.sol";
import {SwitchResult} from "./OneInchV6Hub.sol";

abstract contract OneInchV6HubClipper {
    using AddressLibrary for address;
    using AddressLib for Address;

    function clipperSwap(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut
    ) internal pure virtual returns (SwitchResult memory result) {
        (
            IClipperExchange clipperExchange,
            Address srcToken,
            IERC20 dstToken,
            ,
            ,
            uint256 goodUntil,
            ,

        ) = abi.decode(
                payload,
                (IClipperExchange, Address, IERC20, uint256, uint256, uint256, bytes32, bytes32)
            );
        result.tokenIn = srcToken.get();
        result.isEth = result.tokenIn.isEth();
        result.data = abi.encodeCall(
            IClipperRouter.clipperSwap,
            (
                clipperExchange,
                srcToken,
                dstToken,
                amountIn,
                minAmountOut,
                goodUntil,
                bytes32(0),
                bytes32(0)
            )
        );
    }

    function clipperSwapTo(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut,
        address payable recipient
    ) internal pure virtual returns (SwitchResult memory result) {
        (
            IClipperExchange clipperExchange,
            ,
            Address srcToken,
            IERC20 dstToken,
            ,
            ,
            uint256 goodUntil,
            ,

        ) = abi.decode(
                payload,
                (
                    IClipperExchange,
                    address,
                    Address,
                    IERC20,
                    uint256,
                    uint256,
                    uint256,
                    bytes32,
                    bytes32
                )
            );
        result.tokenIn = srcToken.get();
        result.isEth = result.tokenIn.isEth();
        result.data = abi.encodeCall(
            IClipperRouter.clipperSwapTo,
            (
                clipperExchange,
                recipient,
                srcToken,
                dstToken,
                amountIn,
                minAmountOut,
                goodUntil,
                bytes32(0),
                bytes32(0)
            )
        );
    }
}
"
    },
    "contracts/compiler/oneInchV6/base/OneInchV6HubGeneric.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {
    IAggregationExecutor,
    IGenericRouter
} from "contracts/interfaces/compliance/internal/oneInchV6/IGenericRouter.sol";
import {Address as AddressLibrary} from "contracts/libraries/Address.sol";
import {SwitchResult} from "./OneInchV6Hub.sol";

/* solhint-disable ordering */
abstract contract OneInchV6HubGeneric {
    using AddressLibrary for address;

    function swap(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut,
        address payable recipient
    ) internal pure virtual returns (SwitchResult memory result) {
        (
            IAggregationExecutor executor,
            IGenericRouter.SwapDescription memory desc,
            bytes memory data
        ) = abi.decode(payload, (IAggregationExecutor, IGenericRouter.SwapDescription, bytes));
        desc.amount = amountIn;
        desc.minReturnAmount = minAmountOut;
        desc.dstReceiver = recipient;
        result.tokenIn = address(desc.srcToken);
        result.isEth = result.tokenIn.isEth();
        result.data = abi.encodeCall(IGenericRouter.swap, (executor, desc, data));
    }
}
/* solhint-enable ordering */
"
    },
    "contracts/compiler/oneInchV6/base/OneInchV6HubOrderMixin.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {
    IOrderMixin,
    Order
} from "contracts/interfaces/compliance/internal/oneInchV6/IOrderMixin.sol";

import {Address, AddressLib} from "../libraries/AddressLib.sol";
import {BytesLib} from "../libraries/BytesLib.sol";
import {TakerTraits, TakerTraitsLib} from "../libraries/TakerTraitsLib.sol";
import {SwitchResult} from "./OneInchV6Hub.sol";

abstract contract OneInchV6HubOrderMixin {
    using AddressLib for Address;
    using BytesLib for bytes;
    using TakerTraitsLib for TakerTraits;

    function fillOrder(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut
    ) internal pure virtual returns (SwitchResult memory result) {
        (Order memory order, bytes32 r, bytes32 vs, , TakerTraits takerTraits) = abi.decode(
            payload,
            (Order, bytes32, bytes32, uint256, TakerTraits)
        );
        result.tokenIn = order.makerAsset.get();
        (uint256 amount, TakerTraits updatedTakerTraits) = _processAmountAndThreshold(
            takerTraits,
            amountIn,
            minAmountOut
        );
        result.data = abi.encodeCall(
            IOrderMixin.fillOrder,
            (order, r, vs, amount, updatedTakerTraits)
        );
    }

    function fillOrderArgs(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut,
        address payable recipient
    ) internal pure virtual returns (SwitchResult memory result) {
        (
            Order memory order,
            bytes32 r,
            bytes32 vs,
            ,
            TakerTraits takerTraits,
            bytes memory args
        ) = abi.decode(payload, (Order, bytes32, bytes32, uint256, TakerTraits, bytes));
        result.tokenIn = order.makerAsset.get();
        (uint256 amount, TakerTraits updatedTakerTraits) = _processAmountAndThreshold(
            takerTraits,
            amountIn,
            minAmountOut
        );
        result.data = abi.encodeCall(
            IOrderMixin.fillOrderArgs,
            (
                order,
                r,
                vs,
                amount,
                updatedTakerTraits,
                takerTraits.argsHasTarget()
                    ? abi.encodePacked(bytes20(address(recipient)), args.skipAddressAndTrim())
                    : args
            )
        );
    }

    function _processAmountAndThreshold(
        TakerTraits takerTraits,
        uint256 amountIn,
        uint256 minAmountOut
    ) private pure returns (uint256 amount, TakerTraits updatedTakerTraits) {
        if (takerTraits.isMakingAmount()) {
            amount = amountIn;
            updatedTakerTraits = takerTraits.setThreshold(minAmountOut);
        } else {
            amount = minAmountOut;
            updatedTakerTraits = takerTraits.setThreshold(amountIn);
        }
    }
}
"
    },
    "contracts/compiler/oneInchV6/base/OneInchV6HubUnoswap.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {
    Address,
    IUnoswapRouter
} from "contracts/interfaces/compliance/internal/oneInchV6/IUnoswapRouter.sol";

import {UniswapTokens} from "contracts/compiler/oneInchV5/libraries/UniswapTokens.sol";
import {Address, AddressLib} from "contracts/compiler/oneInchV6/libraries/AddressLib.sol";

import {SwitchResult} from "./OneInchV6Hub.sol";

abstract contract OneInchV6HubUnoswap {
    using AddressLib for Address;
    using UniswapTokens for uint256;

    function unoswap(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut
    ) internal view virtual returns (SwitchResult memory result) {
        (Address token, , , Address dex) = abi.decode(
            payload,
            (Address, uint256, uint256, Address)
        );
        result.tokenIn = token.get();
        result.data = abi.encodeCall(IUnoswapRouter.unoswap, (token, amountIn, minAmountOut, dex));
    }

    function unoswapTo(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut,
        address recipient
    ) internal view virtual returns (SwitchResult memory result) {
        (, Address token, , , Address dex) = abi.decode(
            payload,
            (Address, Address, uint256, uint256, Address)
        );
        result.tokenIn = token.get();
        result.data = abi.encodeCall(
            IUnoswapRouter.unoswapTo,
            (Address.wrap(uint160(recipient)), token, amountIn, minAmountOut, dex)
        );
    }

    function ethUnoswap(
        bytes calldata payload,
        uint256 minAmountOut
    ) internal view virtual returns (SwitchResult memory result) {
        (, Address dex) = abi.decode(payload, (uint256, Address));
        result.isEth = true;
        result.data = abi.encodeCall(IUnoswapRouter.ethUnoswap, (minAmountOut, dex));
    }

    function ethUnoswapTo(
        bytes calldata payload,
        uint256 minAmountOut,
        address recipient
    ) internal view virtual returns (SwitchResult memory result) {
        (, , Address dex) = abi.decode(payload, (Address, uint256, Address));
        result.isEth = true;
        result.data = abi.encodeCall(
            IUnoswapRouter.ethUnoswapTo,
            (Address.wrap(uint160(recipient)), minAmountOut, dex)
        );
    }

    function unoswap2(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut
    ) internal view virtual returns (SwitchResult memory result) {
        (Address token, , , Address dex, Address dex2) = abi.decode(
            payload,
            (Address, uint256, uint256, Address, Address)
        );
        result.tokenIn = token.get();
        result.data = abi.encodeCall(
            IUnoswapRouter.unoswap2,
            (token, amountIn, minAmountOut, dex, dex2)
        );
    }

    function unoswapTo2(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut,
        address recipient
    ) internal view virtual returns (SwitchResult memory result) {
        (, Address token, , , Address dex, Address dex2) = abi.decode(
            payload,
            (Address, Address, uint256, uint256, Address, Address)
        );
        result.tokenIn = token.get();
        result.data = abi.encodeCall(
            IUnoswapRouter.unoswapTo2,
            (Address.wrap(uint160(recipient)), token, amountIn, minAmountOut, dex, dex2)
        );
    }

    function ethUnoswap2(
        bytes calldata payload,
        uint256 minAmountOut
    ) internal view virtual returns (SwitchResult memory result) {
        (, Address dex, Address dex2) = abi.decode(payload, (uint256, Address, Address));
        result.isEth = true;
        result.data = abi.encodeCall(IUnoswapRouter.ethUnoswap2, (minAmountOut, dex, dex2));
    }

    function ethUnoswapTo2(
        bytes calldata payload,
        uint256 minAmountOut,
        address recipient
    ) internal view virtual returns (SwitchResult memory result) {
        (, , Address dex, Address dex2) = abi.decode(payload, (Address, uint256, Address, Address));
        result.isEth = true;
        result.data = abi.encodeCall(
            IUnoswapRouter.ethUnoswapTo2,
            (Address.wrap(uint160(recipient)), minAmountOut, dex, dex2)
        );
    }

    function unoswap3(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut
    ) internal view virtual returns (SwitchResult memory result) {
        (Address token, , , Address dex, Address dex2, Address dex3) = abi.decode(
            payload,
            (Address, uint256, uint256, Address, Address, Address)
        );
        result.tokenIn = token.get();
        result.data = abi.encodeCall(
            IUnoswapRouter.unoswap3,
            (token, amountIn, minAmountOut, dex, dex2, dex3)
        );
    }

    function unoswapTo3(
        bytes calldata payload,
        uint256 amountIn,
        uint256 minAmountOut,
        address recipient
    ) internal view virtual returns (SwitchResult memory result) {
        (, Address token, , , Address dex, Address dex2, Address dex3) = abi.decode(
            payload,
            (Address, Address, uint256, uint256, Address, Address, Address)
        );
        result.tokenIn = token.get();
        result.data = abi.encodeCall(
            IUnoswapRouter.unoswapTo3,
            (Address.wrap(uint160(recipient)), token, amountIn, minAmountOut, dex, dex2, dex3)
        );
    }

    function ethUnoswap3(
        bytes calldata payload,
        uint256 minAmountOut
    ) internal view virtual returns (SwitchResult memory result) {
        (, Address dex, Address dex2, Address dex3) = abi.decode(
            payload,
            (uint256, Address, Address, Address)
        );
        result.isEth = true;
        result.data = abi.encodeCall(IUnoswapRouter.ethUnoswap3, (minAmountOut, dex, dex2, dex3));
    }

    function ethUnoswapTo3(
        bytes calldata payload,
        uint256 minAmountOut,
        address recipient
    ) internal view virtual returns (SwitchResult memory result) {
        (, , Address dex, Address dex2, Address dex3) = abi.decode(
            payload,
            (Address, uint256, Address, Address, Address)
        );
        result.isEth = true;
        result.data = abi.encodeCall(
            IUnoswapRouter.ethUnoswapTo3,
            (Address.wrap(uint160(recipient)), minAmountOut, dex, dex2, dex3)
        );
    }
}
"
    },
    "contracts/compiler/oneInchV6/libraries/AddressLib.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

type Address is uint256;

/**
 * @dev Library for working with addresses encoded as uint256 values, which can include flags in the highest bits.
 */
library AddressLib {
    uint256 private constant _LOW_160_BIT_MASK = (1 << 160) - 1;

    /**
     * @notice Returns the address representation of a uint256.
     * @param a The uint256 value to convert to an address.
     * @return The address representation of the provided uint256 value.
     */
    function get(Address a) internal pure returns (address) {
        return address(uint160(Address.unwrap(a) & _LOW_160_BIT_MASK));
    }
}
"
    },
    "contracts/compiler/oneInchV6/libraries/BytesLib.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

library BytesLib {
    uint256 internal constant ADDRESS_LENGTH = 20;

    error InsufficientBytesLength(uint256 provided, uint256 minRequired);

    /**
     * @notice Skips the first 20 bytes of a `bytes` array and returns the remaining bytes.
     * @param data The original `bytes` array.
     * @return remainingBytes The remaining `bytes` after removing the first 20 bytes.
     */
    function skipAddressAndTrim(
        bytes memory data
    ) internal pure returns (bytes memory remainingBytes) {
        if (data.length < ADDRESS_LENGTH) {
            revert InsufficientBytesLength(data.length, ADDRESS_LENGTH);
        }

        uint256 remainingLength = data.length - ADDRESS_LENGTH;
        remainingBytes = new bytes(remainingLength);

        for (uint256 i = 0; i < remainingLength; i++) {
            remainingBytes[i] = data[i + ADDRESS_LENGTH];
        }
    }
}
"
    },
    "contracts/compiler/oneInchV6/libraries/TakerTraitsLib.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

type TakerTraits is uint256;

/**
 * @title TakerTraitsLib
 * @notice This library to manage and check TakerTraits, which are used to encode the taker's preferences for an order in a single uint256.
 * @dev The TakerTraits are structured as follows:
 * High bits are used for flags
 * 255 bit `_MAKER_AMOUNT_FLAG`           - If set, the taking amount is calculated based on making amount, otherwise making amount is calculated based on taking amount.
 * 254 bit `_UNWRAP_WETH_FLAG`            - If set, the WETH will be unwrapped into ETH before sending to taker.
 * 253 bit `_SKIP_ORDER_PERMIT_FLAG`      - If set, the order skips maker's permit execution.
 * 252 bit `_USE_PERMIT2_FLAG`            - If set, the order uses the permit2 function for authorization.
 * 251 bit `_ARGS_HAS_TARGET`             - If set, then first 20 bytes of args are treated as target address for maker’s funds transfer.
 * 224-247 bits `ARGS_EXTENSION_LENGTH`   - The length of the extension calldata in the args.
 * 200-223 bits `ARGS_INTERACTION_LENGTH` - The length of the interaction calldata in the args.
 * 0-184 bits                             - The threshold amount (the maximum amount a taker agrees to give in exchange for a making amount).
 */
library TakerTraitsLib {
    uint256 private constant _MAKER_AMOUNT_FLAG = 1 << 255;
    uint256 private constant _ARGS_HAS_TARGET = 1 << 251;

    uint256 private constant _AMOUNT_MASK =
        0x000000000000000000ffffffffffffffffffffffffffffffffffffffffffffff;

    error ThresholdExceedsMaximum(uint256 threshold);

    /**
     * @notice Checks if the args should contain target address.
     * @param takerTraits The traits of the taker.
     * @return result A boolean indicating whether the args should contain target address.
     */
    function argsHasTarget(TakerTraits takerTraits) internal pure returns (bool) {
        return (TakerTraits.unwrap(takerTraits) & _ARGS_HAS_TARGET) != 0;
    }

    /**
     * @notice Checks if the taking amount should be calculated based on making amount.
     * @param takerTraits The traits of the taker.
     * @return result A boolean indicating whether the taking amount should be calculated based on making amount.
     */
    function isMakingAmount(TakerTraits takerTraits) internal pure returns (bool) {
        return (TakerTraits.unwrap(takerTraits) & _MAKER_AMOUNT_FLAG) != 0;
    }

    /**
     * @notice Sets the threshold amount in the takerTraits.
     * @param takerTraits The current taker traits.
     * @param newThreshold The new threshold amount to set.
     * @return updatedTakerTraits The updated taker traits with the new threshold.
     */
    function setThreshold(
        TakerTraits takerTraits,
        uint256 newThreshold
    ) internal pure returns (TakerTraits) {
        if (newThreshold > _AMOUNT_MASK) revert ThresholdExceedsMaximum(newThreshold);
        uint256 traits = TakerTraits.unwrap(takerTraits);
        traits = (traits & ~_AMOUNT_MASK) | (newThreshold & _AMOUNT_MASK);
        return TakerTraits.wrap(traits);
    }
}
"
    },
    "contracts/compiler/oneInchV6/OneInchV6Evaluator.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {IExchangeEvaluator} from "contracts/interfaces/compiler/adapters/index.sol";

import {Command} from "contracts/libraries/CommandLibrary.sol";

import {Path} from "../libraries/Path.sol";
import {OneInchV6Hub, SwitchResult} from "./base/OneInchV6Hub.sol";

contract OneInchV6Evaluator is IExchangeEvaluator, OneInchV6Hub {
    using Path for bytes;

    address internal constant SWAP_ROUTER = 0x111111125421cA6dc452d289314280a0f8842A65;

    function evaluate(
        address,
        ExchangeRequest calldata request
    ) external view override returns (Command[] memory cmds) {
        SwitchResult memory result = switchBySelector(
            request.extraData,
            request.amountIn,
            request.minAmountOut,
            payable(request.recipient)
        );

        if (result.isEth) {
            cmds = Command({target: SWAP_ROUTER, value: request.amountIn, payload: result.data})
                .asArray();
        } else {
            cmds = Command({target: SWAP_ROUTER, value: 0, payload: result.data})
                .populateWithApprove(result.tokenIn, request.amountIn);
        }
    }
}
"
    },
    "contracts/interfaces/base/CommonErrors.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

/**
 * @notice An error indicating that the amount for the specified token is zero.
 * @param token The address of the token with a zero amount.
 */
error AmountMustNotBeZero(address token);

/**
 * @notice An error indicating that an address must not be zero.
 */
error AddressMustNotBeZero();

/**
 * @notice An error indicating that an array must not be empty.
 */
error ArrayMustNotBeEmpty();

/**
 * @notice An error indicating that an string must not be empty.
 */
error StringMustNotBeEmpty();

/**
 * @notice An error indicating storage is already up to date and doesn't need further processing.
 * @dev This error is thrown when attempting to update an entity(s) that is(are) already up to date.
 */
error AlreadyUpToDate();

/**
 * @notice An error indicating that an action is unauthorized for the specified account.
 * @param account The address of the unauthorized account.
 */
error UnauthorizedAccount(address account);

/**
 * @notice An error indicating that the min amount out must not be zero.
 */
error MinAmountOutMustNotBeZero();
"
    },
    "contracts/interfaces/base/IERC165Extended.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

/* solhint-disable no-unused-import */
import {
    IERC165
} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
/* solhint-enable no-unused-import */

/**
 * @notice An error indicating that an address does not support the expected interface
 * @param implementation The address that does not implement the required interface
 */
error UnsupportedInterface(address implementation);

/**
 * @dev Extended interface of the ERC165 standard to ensure compatibility
 * with Diamond facets as defined in EIP-2535.
 *
 * This interface extends the basic ERC165 mechanism to provide additional
 * flexibility for querying supported interfaces, which can then be
 * dynamically resolved by one of facets in a Diamond.
 */
interface IERC165Extended {
    /**
     * @notice Checks if the given interface ID is supported by the contract.
     * @param interfaceId The ID of the interface to query.
     * @return isSupported Boolean value indicating whether the interface is supported.
     */
    function supportsInterfaceExtended(bytes4 interfaceId) external pure returns (bool isSupported);
}
"
    },
    "contracts/interfaces/compiler/adapters/IDecreasePositionEvaluator.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {Asset} from "contracts/libraries/AssetLibrary.sol";
import {Command} from "../Command.sol";
import {PositionDescriptor} from "./PositionDescriptor.sol";

interface IDecreasePositionEvaluator {
    /**
     * @notice Request structure for decreasing a position.
     * @dev `descriptor`: The [`PositionDescriptor`](/interfaces/compiler/adapters/PositionDescriptor.sol/struct.PositionDescriptor.html)
     *  struct.
     * @dev `liquidity`: Abstract amount that can be interpreted differently in different protocols (e.g., amount of LP tokens to burn).
     * @dev `minOutput`: [`Asset`](/interfaces/compliance/Asset.sol/struct.Asset.html) array with minimum amounts that must be retrieved from the position.
     */
    struct DecreasePositionRequest {
        PositionDescriptor descriptor;
        uint256 liquidity;
        Asset[] minOutput;
    }

    /**
     * @notice Evaluate a decrease position request.
     * @param _operator Address which initiated the request
     * @param _request The [`DecreasePositionRequest`](#decreasepositionrequest) struct containing decrease position details.
     * @return cmds_ An array of [`Command`](../../Command.sol/struct.Command.html) to execute the request.
     */
    function evaluate(
        address _operator,
        DecreasePositionRequest calldata _request
    ) external returns (Command[] memory cmds_);
}
"
    },
    "contracts/interfaces/compiler/adapters/IExchangeEvaluator.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {Command} from "../Command.sol";

/**
 * @title IExchangeEvaluator
 * @notice Interface for compiling commands for token exchanges for different protocols.
 */
interface IExchangeEvaluator {
    /**
     * @notice Structure for an exchange token request.
     * @dev `path`: Encoded path of tokens to follow in the exchange, including pool identifiers.
     * 20 bytes(tokenA) + 4 byte(poolId_A_B) + 20 bytes(tokenB) + ...
     * ... + 4 byte(poolId_N-1_N) + 20 bytes(tokenN).
     * @dev `extraData`: Additional data specific to a particular protocol, such as the response from a 1Inch Exchange API.
     * @dev `amountIn`: The amount of tokenA to spend.
     * @dev `minAmountOut`: The minimum amount of tokenN to receive.
     * @dev `recipient`: The recipient of tokenN.
     */
    struct ExchangeRequest {
        bytes path;
        bytes extraData;
        uint256 amountIn;
        uint256 minAmountOut;
        address recipient;
    }

    /**
     * @notice Constructs an exchange token request.
     * @param _operator Address which initiated the request
     * @param _request The [`ExchangeRequest`](#exchangerequest) struct containing exchange token details.
     * @return cmds_ An array of [`Command`](../../Command.sol/struct.Command.html) to execute the request.
     */
    function evaluate(
        address _operator,
        ExchangeRequest calldata _request
    ) external view returns (Command[] memory cmds_);
}
"
    },
    "contracts/interfaces/compiler/adapters/IIncreasePositionEvaluator.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {Asset} from "contracts/libraries/AssetLibrary.sol";
import {Command} from "../Command.sol";
import {PositionDescriptor} from "./PositionDescriptor.sol";

interface IIncreasePositionEvaluator {
    /**
     * @notice Structure for an increase position request.
     * @dev `descriptor`: The [`PositionDescriptor`](/interfaces/compiler/adapters/PositionDescriptor.sol/struct.PositionDescriptor.html)
     *  struct.
     * @dev `input`: An array of [`Asset`](/interfaces/compliance/Asset.sol/struct.Asset.html) representing the token-amounts that will be added to the position.
     * @dev `minLiquidityOut`: An abstract amount that can be interpreted differently in different protocols (e.g., minimum amount of LP tokens to receive).
     */
    struct IncreasePositionRequest {
        PositionDescriptor descriptor;
        Asset[] input;
        uint256 minLiquidityOut;
    }

    /**
     * @notice Evaluate a increase position request.
     * @param _operator Address which initiated the request
     * @param _request The [`IncreasePositionRequest`](#increasepositionrequest) struct containing increase position details.
     * @return cmds_ An array of [`Command`](../../Command.sol/struct.Command.html) to execute the request.
     */
    function evaluate(
        address _operator,
        IncreasePositionRequest calldata _request
    ) external returns (Command[] memory cmds_);
}
"
    },
    "contracts/interfaces/compiler/adapters/ILiquidityPoolsRepository.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

/* solhint-disable no-unused-import */
import {AlreadyUpToDate} from "contracts/interfaces/base/CommonErrors.sol";
import {
    Status,
    TokenIsNotSupported
} from "contracts/interfaces/compliance/IWhitelistingController.sol";
/* solhint-enable no-unused-import */

/**
 * @notice Error indicating that the pool ID was not found.
 * @param encodedPool The encoded pool data that was searched for.
 */
error PoolIdNotFound(bytes encodedPool);

/**
 * @notice Error indicating that the pool does not exist.
 * @param poolId The unique identifier of the pool that was searched for.
 */
error PoolIsNotSupported(uint256 poolId);

/**
 * @notice Error indicating that the pool is suspended.
 * @param poolId The unique identifier of the pool that is suspended.
 */
error PoolIsSuspended(uint256 poolId);

/**
 * @title ILiquidityPoolsRepository
 * @notice Interface for managing liquidity pools and their support status.
 */
interface ILiquidityPoolsRepository {
    /**
     * @notice Update the support status of a liquidity pool.
     * @param _encodedPool The encoded pool data.
     * @param _supported Whether the pool is supported or not.
     * @return poolId_ The unique identifier of the pool.
     * @dev Reverts with a [`PoolIdNotFound()`](/interfaces/compiler/adapters/ILiquidityPoolsRepository.sol/error.PoolIdNotFound.html)
     *  error if the pool does not exist.
     */
    function updatePoolSupport(
        bytes calldata _encodedPool,
        bool _supported
    ) external returns (uint256 poolId_);

    /**
     * @notice Get the status of a specific pool.
     * @param _poolId The unique identifier of the pool.
     * @return status The status of the pool.
     * @dev Reverts with a [`PoolIsNotSupported()`](/interfaces/compiler/adapters/ILiquidityPoolsRepository.sol/error.PoolIsNotSupported.html)
     *  error if the pool does not exist.
     */
    function getPoolStatus(uint256 _poolId) external returns (Status status);

    /**
     * @notice Get the unique identifier (pool ID) of a specific pool.
     * @param _encodedPool The encoded pool data.
     * @return poolId_ The unique identifier of the pool.
     * @dev Reverts with a [`PoolIsNotSupported()`](/interfaces/compiler/adapters/ILiquidityPoolsRepository.sol/error.PoolIsNotSupported.html)
     *  error if the pool does not exist.
     */
    function getPoolId(bytes calldata _encodedPool) external view returns (uint256 poolId_);
}
"
    },
    "contracts/interfaces/compiler/adapters/index.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {
    IDecreasePositionEvaluator
} from "contracts/interfaces/compiler/adapters/IDecreasePositionEvaluator.sol";
import {IExchangeEvaluator} from "contracts/interfaces/compiler/adapters/IExchangeEvaluator.sol";
import {
    IIncreasePositionEvaluator
} from "contracts/interfaces/compiler/adapters/IIncreasePositionEvaluator.sol";
import {
    AlreadyUpToDate,
    ILiquidityPoolsRepository,
    PoolIdNotFound,
    PoolIsNotSupported,
    PoolIsSuspended,
    Status,
    TokenIsNotSupported
} from "contracts/interfaces/compiler/adapters/ILiquidityPoolsRepository.sol";
import {PositionDescriptor} from "contracts/interfaces/compiler/adapters/PositionDescriptor.sol";
"
    },
    "contracts/interfaces/compiler/adapters/PositionDescriptor.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

// TODO CRYPTO-145: Possibly move into appropriate interface?
/**
 * @notice Used to determine the required position for an operation.
 * @dev `poolId`: An identifier that is unique within a single protocol.
 * @dev `extraData`: Additional data used to specify the position, for example
 * this is used in OneInchV5Evaluator to pass swap tx generated via 1inch API.
 */
struct PositionDescriptor {
    uint256 poolId;
    bytes extraData;
}
"
    },
    "contracts/interfaces/compiler/Command.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {CommandLibrary} from "contracts/libraries/CommandLibrary.sol";

/**
 * @title Command
 * @notice Contains arguments for a low-level call.
 * @dev This struct allows deferring the call's execution, suspending it by passing it to another function or contract.
 * @dev `target` The address to be called.
 * @dev `value` Value to send in the call.
 * @dev `payload` Encoded call with function selector and arguments.
 */
struct Command {
    address target;
    uint256 value;
    bytes payload;
}

using CommandLibrary for Command global;
"
    },
    "contracts/interfaces/compliance/Asset.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {AssetLibrary} from "contracts/libraries/AssetLibrary.sol";

/**
 * @title Asset
 * @dev Represents an asset with its token address and the amount.
 * @param token The address of the asset's token.
 * @param amount The amount of the asset.
 */
struct Asset {
    address token;
    uint256 amount;
}

using AssetLibrary for Asset global;
"
    },
    "contracts/interfaces/compliance/internal/oneInchV5/IUniswapPool.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

interface IUniswapPool {
    function token0() external view returns (address);

    function token1() external view returns (address);
}
"
    },
    "contracts/interfaces/compliance/internal/oneInchV6/IClipperRouter.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Address} from "contracts/compiler/oneInchV6/libraries/AddressLib.sol";

/// @title Clipper interface subset used in swaps
interface IClipperExchange {
    struct Signature {
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

    function sellEthForToken(
        address outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 goodUntil,
        address destinationAddress,
        Signature calldata theSignature,
        bytes calldata auxiliaryData
    ) external payable;

    function sellTokenForEth(
        address inputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 goodUntil,
        address destinationAddress,
        Signature calldata theSignature,
        bytes calldata auxiliaryData
    ) external;

    function swap(
        address inputToken,
        address outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 goodUntil,
        address destinationAddress,
        Signature calldata theSignature,
        bytes calldata auxiliaryData
    ) external;
}

interface IClipperRouter {
    /**
     * @notice Same as `clipperSwapTo` but uses `msg.sender` as recipient.
     * @param clipperExchange Clipper pool address.
     * @param srcToken Source token and flags.
     * @param dstToken Destination token.
     * @param inputAmount Amount of source tokens to swap.
     * @param outputAmount Amount of destination tokens to receive.
     * @param goodUntil Clipper parameter.
     * @param r Clipper order signature (r part).
     * @param vs Clipper order signature (vs part).
     * @return returnAmount Amount of destination tokens received.
     */
    function clipperSwap(
        IClipperExchange clipperExchange,
        Address srcToken,
        IERC20 dstToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 goodUntil,
        bytes32 r,
        bytes32 vs
    ) external payable returns (uint256 returnAmount);

    /**
     * @notice Performs swap using Clipper exchange. Wraps and unwraps ETH if required.
     *         Sending non-zero `msg.value` for anything but ETH swaps is prohibited.
     * @param clipperExchange Clipper pool address.
     * @param recipient Address that will receive swap funds.
     * @param srcToken Source token and flags.
     * @param dstToken Destination token.
     * @param inputAmount Amount of source tokens to swap.
     * @param outputAmount Amount of destination tokens to receive.
     * @param goodUntil Clipper parameter.
     * @param r Clipper order signature (r part).
     * @param vs Clipper order signature (vs part).
     * @return returnAmount Amount of destination tokens received.
     */
    function clipperSwapTo(
        IClipperExchange clipperExchange,
        address payable recipient,
        Address srcToken,
        IERC20 dstToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 goodUntil,
        bytes32 r,
        bytes32 vs
    ) external payable returns (uint256 returnAmount);
}
"
    },
    "contracts/interfaces/compliance/internal/oneInchV6/IGenericRouter.sol": {
      "content": "// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/// @title Interface for making arbitrary calls during swap
interface IAggregationExecutor {
    /// @notice propagates information about original msg.sender and executes arbitrary data
    function execute(address msgSender) external payable returns (uint256); // 0x4b64e492
}

interface IGenericRouter {
    struct SwapDescription {
        IERC20 srcToken;
        IERC20 dstToken;
        address payable srcReceiver

Tags:
ERC20, ERC165, Multisig, Swap, Liquidity, Upgradeable, Multi-Signature, Factory|addr:0x8378bb0ba7742d310a738ea4b7e94ea56eac5538|verified:true|block:23575300|tx:0xdf2fb0d41f3b6eafd30427b835a1878285413766e32d0a3c1c7f54708afae534|first_check:1760437268

Submitted on: 2025-10-14 12:21:08

Comments

Log in to comment.

No comments yet.