Skip to content

IOneInchAggregationRouterLike

Git Source

Interface for interacting with 1inch Aggregation Router contracts

This interface defines the essential functions and data structures needed to interact with 1inch protocol for token swapping operations

Functions

swap

Executes a token swap through the 1inch aggregation protocol

This function performs the actual token swap using the provided parameters and swap data. It supports complex multi-hop swaps and various DEX protocols.

function swap(
    address executor,
    SwapDescription calldata desc,
    bytes calldata data
)
    external
    payable
    returns (uint256 returnAmount, uint256 spentAmount);
Parameters
NameTypeDescription
executoraddressThe address authorized to execute the swap operation
descSwapDescriptionThe swap description containing all swap parameters
databytesAdditional swap execution data required by the specific swap route
Returns
NameTypeDescription
returnAmountuint256The actual amount of destination tokens received
spentAmountuint256The actual amount of source tokens consumed in the swap

Structs

SwapDescription

Parameters that describe a token swap operation

struct SwapDescription {
    address srcToken;
    address dstToken;
    address payable srcReceiver;
    address payable dstReceiver;
    uint256 amount;
    uint256 minReturnAmount;
    uint256 flags;
}
Properties
NameTypeDescription
srcTokenaddressThe address of the source token to be swapped
dstTokenaddressThe address of the destination token to receive
srcReceiveraddress payableThe address that will receive any leftover source tokens
dstReceiveraddress payableThe address that will receive the swapped destination tokens
amountuint256The amount of source tokens to swap
minReturnAmountuint256The minimum amount of destination tokens expected
flagsuint256Configuration flags that control various swap options and behaviors