Contract 0xC198E8d7ad811F8C5Ed9b96210cDEc8f48e97C8c

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x642553e3817dccfa602188dcaef68cb550a38e6d27aae228a0671d4a227807340x7c5b4a29106065582022-02-07 12:41:40140 days 11 hrs ago0xbd999d42922eb55d6647e9f23d402ac073d1b7b1 IN  Dopex: Native SSOV Router0 AVAX0.02190968627 25.144587777
0xa8ad8d80e55c772e901baed7469bd35a5c86636e86a89b7afb9ea80fb8fc11cc0x60806040106032342022-02-07 10:53:47140 days 12 hrs ago0xde485812e28824e542b9c2270b6b8ed9232b7d0b IN  Create: NativeSSOV1inchRouter0 AVAX0.0264845525
[ Download CSV Export 
Latest 4 internal transactions
Parent Txn Hash Block From To Value
0x642553e3817dccfa602188dcaef68cb550a38e6d27aae228a0671d4a22780734106065582022-02-07 12:41:40140 days 11 hrs ago Dopex: Native SSOV Router0xbd999d42922eb55d6647e9f23d402ac073d1b7b10.000340906727698891 AVAX
0x642553e3817dccfa602188dcaef68cb550a38e6d27aae228a0671d4a22780734106065582022-02-07 12:41:40140 days 11 hrs ago Dopex: AVAX SSOV Dopex: Native SSOV Router0.000340906727698891 AVAX
0x642553e3817dccfa602188dcaef68cb550a38e6d27aae228a0671d4a22780734106065582022-02-07 12:41:40140 days 11 hrs ago Dopex: Native SSOV Router Dopex: AVAX SSOV0.01950343062538464 AVAX
0x642553e3817dccfa602188dcaef68cb550a38e6d27aae228a0671d4a22780734106065582022-02-07 12:41:40140 days 11 hrs ago 1inch v4: Router Dopex: Native SSOV Router0.01950343062538464 AVAX
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NativeSSOV1inchRouter

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 8 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^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;
        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");

        (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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 2 of 8 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
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) {
        unchecked {
            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) {
        unchecked {
            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) {
        unchecked {
            // 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) {
        unchecked {
            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) {
        unchecked {
            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) {
        return a + b;
    }

    /**
     * @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) {
        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) {
        return a * b;
    }

    /**
     * @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.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        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) {
        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) {
        unchecked {
            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.
     *
     * 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) {
        unchecked {
            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) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 3 of 8 : IERC20.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 * NOTE: Modified to include symbols and decimals.
 */
interface IERC20 {
  function totalSupply() external view returns (uint256);

  function symbol() external view returns (string memory);

  function decimals() external view returns (uint8);

  function balanceOf(address account) external view returns (uint256);

  function transfer(address recipient, uint256 amount) external returns (bool);

  function allowance(address owner, address spender)
    external
    view
    returns (uint256);

  function approve(address spender, uint256 amount) external returns (bool);

  function transferFrom(
    address sender,
    address recipient,
    uint256 amount
  ) external returns (bool);

  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 4 of 8 : SafeERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IERC20} from '../interfaces/IERC20.sol';
import {SafeMath} from '@openzeppelin/contracts/utils/math/SafeMath.sol';
import {Address} from '@openzeppelin/contracts/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 5 of 8 : I1inchAggregationRouterV4.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;

interface I1inchAggregationRouterV4 {
  struct SwapDescription {
    address srcToken;
    address dstToken;
    address srcReceiver;
    address dstReceiver;
    uint256 amount;
    uint256 minReturnAmount;
    uint256 flags;
    bytes permit;
  }

  event OrderFilledRFQ(bytes32 orderHash,uint256 makingAmount) ;

  event OwnershipTransferred(address indexed previousOwner,address indexed newOwner) ;

  event Swapped(address sender,address srcToken,address dstToken,address dstReceiver,uint256 spentAmount,uint256 returnAmount) ;

  function DOMAIN_SEPARATOR() external view returns (bytes32) ;

  function LIMIT_ORDER_RFQ_TYPEHASH() external view returns (bytes32) ;

  function cancelOrderRFQ(uint256 orderInfo) external;

  function destroy() external;

  function fillOrderRFQ(LimitOrderProtocolRFQ.OrderRFQ memory order,bytes memory signature,uint256 makingAmount,uint256 takingAmount) external payable returns (uint256 , uint256) ;

  function fillOrderRFQTo(LimitOrderProtocolRFQ.OrderRFQ memory order,bytes memory signature,uint256 makingAmount,uint256 takingAmount,address target) external payable returns (uint256 , uint256) ;

  function fillOrderRFQToWithPermit(LimitOrderProtocolRFQ.OrderRFQ memory order,bytes memory signature,uint256 makingAmount,uint256 takingAmount,address target,bytes memory permit) external  returns (uint256 , uint256) ;

  function invalidatorForOrderRFQ(address maker,uint256 slot) external view returns (uint256) ;

  function owner() external view returns (address) ;

  function renounceOwnership() external;

  function rescueFunds(address token,uint256 amount) external;

  function swap(address caller,SwapDescription memory desc,bytes memory data) external payable returns (uint256 returnAmount, uint256 gasLeft);

  function transferOwnership(address newOwner) external;

  function uniswapV3Swap(uint256 amount,uint256 minReturn,uint256[] memory pools) external payable returns (uint256 returnAmount) ;

  function uniswapV3SwapCallback(int256 amount0Delta,int256 amount1Delta,bytes memory ) external;

  function uniswapV3SwapTo(address recipient,uint256 amount,uint256 minReturn,uint256[] memory pools) external payable returns (uint256 returnAmount) ;

  function uniswapV3SwapToWithPermit(address recipient,address srcToken,uint256 amount,uint256 minReturn,uint256[] memory pools,bytes memory permit) external  returns (uint256 returnAmount) ;

  function unoswap(address srcToken,uint256 amount,uint256 minReturn,bytes32[] memory pools) external payable returns (uint256 returnAmount) ;

  function unoswapWithPermit(address srcToken,uint256 amount,uint256 minReturn,bytes32[] memory pools,bytes memory permit) external  returns (uint256 returnAmount) ;

  receive () external payable;
}

interface LimitOrderProtocolRFQ {
  struct OrderRFQ {
    uint256 info;
    address makerAsset;
    address takerAsset;
    address maker;
    address allowedSender;
    uint256 makingAmount;
    uint256 takingAmount;
  }
}

File 6 of 8 : INativeSSOV.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {ISSOV} from './ISSOV.sol';

interface INativeSSOV is ISSOV {
    function purchase(
        uint256 strikeIndex,
        uint256 amount,
        address user
    ) external payable returns (uint256, uint256);

    function deposit(uint256 strikeIndex, address user)
        external
        payable
        returns (bool);

    function depositMultiple(
        uint256[] memory strikeIndices,
        uint256[] memory amounts,
        address user
    ) external payable returns (bool);
}

File 7 of 8 : ISSOV.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface ISSOV {
    function epochStrikeTokens(uint256 epoch, uint256 strike)
        external
        view
        returns (address);

    function getAddress(bytes32 name) external view returns (address);

    function currentEpoch() external view returns (uint256);

    function epochStrikes(uint256 epoch, uint256 strikeIndex)
        external
        view
        returns (uint256);

    function settle(
        uint256 strikeIndex,
        uint256 amount,
        uint256 epoch
    ) external returns (uint256);
}

File 8 of 8 : NativeSSOV1inchRouter.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

// Libraries
import {SafeERC20} from '../external/libraries/SafeERC20.sol';

// Interfaces
import {IERC20} from '../external/interfaces/IERC20.sol';
import {I1inchAggregationRouterV4} from '../interfaces/I1inchAggregationRouterV4.sol';
import {INativeSSOV} from '../interfaces/INativeSSOV.sol';

contract NativeSSOV1inchRouter {
    using SafeERC20 for IERC20;

    I1inchAggregationRouterV4 public aggregationRouterV4;
    INativeSSOV public ssov;

    struct PurchaseOption {
        uint256 strikeIndex;
        uint256 amount;
        address to;
    }

    /// @notice Constructor
    /// @param _ssov address of SSOV
    /// @param _aggregationRouterV4 address of 1inch V4 Aggregation Router
    constructor(address _ssov, address payable _aggregationRouterV4) {
        ssov = INativeSSOV(_ssov);
        aggregationRouterV4 = I1inchAggregationRouterV4(_aggregationRouterV4);
    }

    receive() external payable {}

    /// @notice Swap any token to the quote asset, then purchase option
    /// @param _caller aggregation executor that executes calls described in data
    /// @param _desc struct composed by srcToken, dstToken, srcReceiver, dstReceiver, amount, minReturnAmount, flags, permit
    /// @param _data encoded calls that caller should execute in between of swaps
    /// @param _params PurchaseOption struct parameters to purchase option
    function swapAndPurchase(
        address _caller,
        I1inchAggregationRouterV4.SwapDescription memory _desc,
        bytes calldata _data,
        PurchaseOption calldata _params
    ) external payable returns (bool) {
        IERC20 tokenFrom = IERC20(_desc.srcToken);
        tokenFrom.safeTransferFrom(msg.sender, address(this), _desc.amount);
        tokenFrom.safeApprove(address(aggregationRouterV4), _desc.amount);

        (uint256 returnAmount, ) = aggregationRouterV4.swap(
            _caller,
            _desc,
            _data
        );

        ssov.purchase{value: returnAmount}(
            _params.strikeIndex,
            _params.amount,
            _params.to
        );

        if (address(this).balance > 0) {
            payable(msg.sender).transfer(address(this).balance);
        }

        return true;
    }

    /// @notice Swap any token to quote asset, then deposit quote
    /// @param _caller aggregation executor that executes calls described in data
    /// @param _desc struct composed by srcToken, dstToken, srcReceiver, dstReceiver, amount, minReturnAmount, flags, permit
    /// @param _data encoded calls that caller should execute in between of swaps
    /// @param _strikeIndex strike index to deposit to
    /// @param _to address to deposit on behalf of
    function swapAndDeposit(
        address _caller,
        I1inchAggregationRouterV4.SwapDescription memory _desc,
        bytes calldata _data,
        uint256 _strikeIndex,
        address _to
    ) external payable returns (bool) {
        IERC20 tokenFrom = IERC20(_desc.srcToken);

        tokenFrom.safeTransferFrom(msg.sender, address(this), _desc.amount);
        tokenFrom.safeApprove(address(aggregationRouterV4), _desc.amount);

        (uint256 returnAmount, ) = aggregationRouterV4.swap(
            _caller,
            _desc,
            _data
        );

        ssov.deposit{value: returnAmount}(_strikeIndex, _to);

        return true;
    }

    /// @notice Swap any token to quote asset, then deposit quote
    /// @param _caller aggregation executor that executes calls described in data
    /// @param _desc struct composed by srcToken, dstToken, srcReceiver, dstReceiver, amount, minReturnAmount, flags, permit
    /// @param _data encoded calls that caller should execute in between of swaps
    /// @param _strikeIndices indices of strikes to deposit into
    /// @param _amounts amount of native token to deposit into each strike index
    /// @param _to address to deposit on behalf of
    function swapAndDepositMultiple(
        address _caller,
        I1inchAggregationRouterV4.SwapDescription memory _desc,
        bytes calldata _data,
        uint256[] memory _strikeIndices,
        uint256[] memory _amounts,
        address _to
    ) external payable returns (bool) {
        IERC20 tokenFrom = IERC20(_desc.srcToken);

        tokenFrom.safeTransferFrom(msg.sender, address(this), _desc.amount);
        tokenFrom.safeApprove(address(aggregationRouterV4), _desc.amount);

        (uint256 returnAmount, ) = aggregationRouterV4.swap(
            _caller,
            _desc,
            _data
        );

        uint256 totalAmount = 0;
        for (uint256 i = 0; i < _amounts.length; i++)
            totalAmount = totalAmount + _amounts[i];

        ssov.depositMultiple{value: totalAmount}(_strikeIndices, _amounts, _to);

        payable(msg.sender).transfer(returnAmount - totalAmount);

        return true;
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"address payable","name":"_aggregationRouterV4","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"aggregationRouterV4","outputs":[{"internalType":"contract I1inchAggregationRouterV4","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ssov","outputs":[{"internalType":"contract INativeSSOV","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"address","name":"srcReceiver","type":"address"},{"internalType":"address","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct I1inchAggregationRouterV4.SwapDescription","name":"_desc","type":"tuple"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"uint256","name":"_strikeIndex","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"swapAndDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"address","name":"srcReceiver","type":"address"},{"internalType":"address","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct I1inchAggregationRouterV4.SwapDescription","name":"_desc","type":"tuple"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"uint256[]","name":"_strikeIndices","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"address","name":"_to","type":"address"}],"name":"swapAndDepositMultiple","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"address","name":"srcReceiver","type":"address"},{"internalType":"address","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct I1inchAggregationRouterV4.SwapDescription","name":"_desc","type":"tuple"},{"internalType":"bytes","name":"_data","type":"bytes"},{"components":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"internalType":"struct NativeSSOV1inchRouter.PurchaseOption","name":"_params","type":"tuple"}],"name":"swapAndPurchase","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b5060405161121938038061121983398101604081905261002f91610078565b600180546001600160a01b039384166001600160a01b031991821617909155600080549290931691161790556100b2565b6001600160a01b038116811461007557600080fd5b50565b6000806040838503121561008b57600080fd5b825161009681610060565b60208401519092506100a781610060565b809150509250929050565b611158806100c16000396000f3fe60806040526004361061004e5760003560e01c80633401e1681461005a5780637c5b4a29146100975780637d8e3e0f146100ba5780638355fc54146100cd578063ad4cfcbb146100ed57600080fd5b3661005557005b600080fd5b34801561006657600080fd5b5060005461007a906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100aa6100a5366004610be7565b610100565b604051901515815260200161008e565b6100aa6100c8366004610cf3565b6102c1565b3480156100d957600080fd5b5060015461007a906001600160a01b031681565b6100aa6100fb366004610dc7565b6104a6565b8351608085015160009190610123906001600160a01b038316903390309061060b565b6000546080870151610143916001600160a01b038481169291169061067c565b60008054604051623e012960e91b81526001600160a01b0390911690637c02520090610179908b908b908b908b90600401610edb565b6040805180830381600087803b15801561019257600080fd5b505af11580156101a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ca9190610f8a565b506001549091506001600160a01b031663ea3bd5df82863560208801356101f760608a0160408b01610fae565b6040516001600160e01b031960e087901b168152600481019390935260248301919091526001600160a01b0316604482015260640160408051808303818588803b15801561024457600080fd5b505af1158015610258573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061027d9190610f8a565b505047156102b35760405133904780156108fc02916000818181858888f193505050501580156102b1573d6000803e3d6000fd5b505b506001979650505050505050565b85516080870151600091906102e4906001600160a01b038316903390309061060b565b6000546080890151610304916001600160a01b038481169291169061067c565b60008054604051623e012960e91b81526001600160a01b0390911690637c0252009061033a908d908d908d908d90600401610edb565b6040805180830381600087803b15801561035357600080fd5b505af1158015610367573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038b9190610f8a565b5090506000805b86518110156103d4578681815181106103ad576103ad610fc9565b6020026020010151826103c09190610ff5565b9150806103cc8161100d565b915050610392565b506001546040516340a2775d60e11b81526001600160a01b0390911690638144eeba90839061040b908b908b908b90600401611063565b6020604051808303818588803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061045d91906110a1565b50336108fc61046c83856110c3565b6040518115909202916000818181858888f19350505050158015610494573d6000803e3d6000fd5b5060019b9a5050505050505050505050565b84516080860151600091906104c9906001600160a01b038316903390309061060b565b60005460808801516104e9916001600160a01b038481169291169061067c565b60008054604051623e012960e91b81526001600160a01b0390911690637c0252009061051f908c908c908c908c90600401610edb565b6040805180830381600087803b15801561053857600080fd5b505af115801561054c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105709190610f8a565b50600154604051636e553f6560e01b8152600481018890526001600160a01b038781166024830152929350911690636e553f659083906044016020604051808303818588803b1580156105c257600080fd5b505af11580156105d6573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906105fb91906110a1565b5060019998505050505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526106769085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526107aa565b50505050565b8015806107055750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156106cb57600080fd5b505afa1580156106df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070391906110da565b155b6107755760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084015b60405180910390fd5b6040516001600160a01b0383166024820152604481018290526107a590849063095ea7b360e01b9060640161063f565b505050565b60006107ff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661087c9092919063ffffffff16565b8051909150156107a5578080602001905181019061081d91906110a1565b6107a55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161076c565b606061088b8484600085610895565b90505b9392505050565b6060824710156108f65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161076c565b843b6109445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161076c565b600080866001600160a01b0316858760405161096091906110f3565b60006040518083038185875af1925050503d806000811461099d576040519150601f19603f3d011682016040523d82523d6000602084013e6109a2565b606091505b50915091506109b28282866109bd565b979650505050505050565b606083156109cc57508161088e565b8251156109dc5782518084602001fd5b8160405162461bcd60e51b815260040161076c919061110f565b80356001600160a01b0381168114610a0d57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715610a4c57610a4c610a12565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610a7b57610a7b610a12565b604052919050565b600082601f830112610a9457600080fd5b813567ffffffffffffffff811115610aae57610aae610a12565b610ac1601f8201601f1916602001610a52565b818152846020838601011115610ad657600080fd5b816020850160208301376000918101602001919091529392505050565b60006101008284031215610b0657600080fd5b610b0e610a28565b9050610b19826109f6565b8152610b27602083016109f6565b6020820152610b38604083016109f6565b6040820152610b49606083016109f6565b60608201526080820135608082015260a082013560a082015260c082013560c082015260e082013567ffffffffffffffff811115610b8657600080fd5b610b9284828501610a83565b60e08301525092915050565b60008083601f840112610bb057600080fd5b50813567ffffffffffffffff811115610bc857600080fd5b602083019150836020828501011115610be057600080fd5b9250929050565b600080600080600085870360c0811215610c0057600080fd5b610c09876109f6565b9550602087013567ffffffffffffffff80821115610c2657600080fd5b610c328a838b01610af3565b96506040890135915080821115610c4857600080fd5b50610c5589828a01610b9e565b9095509350506060605f1982011215610c6d57600080fd5b506060860190509295509295909350565b600082601f830112610c8f57600080fd5b8135602067ffffffffffffffff821115610cab57610cab610a12565b8160051b610cba828201610a52565b9283528481018201928281019087851115610cd457600080fd5b83870192505b848310156109b257823582529183019190830190610cda565b600080600080600080600060c0888a031215610d0e57600080fd5b610d17886109f6565b9650602088013567ffffffffffffffff80821115610d3457600080fd5b610d408b838c01610af3565b975060408a0135915080821115610d5657600080fd5b610d628b838c01610b9e565b909750955060608a0135915080821115610d7b57600080fd5b610d878b838c01610c7e565b945060808a0135915080821115610d9d57600080fd5b50610daa8a828b01610c7e565b925050610db960a089016109f6565b905092959891949750929550565b60008060008060008060a08789031215610de057600080fd5b610de9876109f6565b9550602087013567ffffffffffffffff80821115610e0657600080fd5b610e128a838b01610af3565b96506040890135915080821115610e2857600080fd5b50610e3589828a01610b9e565b90955093505060608701359150610e4e608088016109f6565b90509295509295509295565b60005b83811015610e75578181015183820152602001610e5d565b838111156106765750506000910152565b60008151808452610e9e816020860160208601610e5a565b601f01601f19169290920160200192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b600060018060a01b03808716835260606020840152808651166060840152806020870151166080840152506040850151610f2060a08401826001600160a01b03169052565b5060608501516001600160a01b03811660c084015250608085015160e083015260a0850151610100818185015260c087015161012085015260e087015191508061014085015250610f75610160840182610e86565b905082810360408401526109b2818587610eb2565b60008060408385031215610f9d57600080fd5b505080516020909101519092909150565b600060208284031215610fc057600080fd5b61088e826109f6565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561100857611008610fdf565b500190565b600060001982141561102157611021610fdf565b5060010190565b600081518084526020808501945080840160005b838110156110585781518752958201959082019060010161103c565b509495945050505050565b6060815260006110766060830186611028565b82810360208401526110888186611028565b91505060018060a01b0383166040830152949350505050565b6000602082840312156110b357600080fd5b8151801515811461088e57600080fd5b6000828210156110d5576110d5610fdf565b500390565b6000602082840312156110ec57600080fd5b5051919050565b60008251611105818460208701610e5a565b9190910192915050565b60208152600061088e6020830184610e8656fea264697066735822122055a49a43225b8ee33371c60add6fa7c9104df18554f6783f7118b48ea390360564736f6c634300080900330000000000000000000000005540fea353df6302611da1d57988104e43a4b6b60000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d

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

0000000000000000000000005540fea353df6302611da1d57988104e43a4b6b60000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d

-----Decoded View---------------
Arg [0] : _ssov (address): 0x5540fea353df6302611da1d57988104e43a4b6b6
Arg [1] : _aggregationRouterV4 (address): 0x1111111254fb6c44bac0bed2854e76f90643097d

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000005540fea353df6302611da1d57988104e43a4b6b6
Arg [1] : 0000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.