Skip to main content

ISwapModule

Git Source

Functions

getSwapperTargets

Returns approval and execution targets for a given swapper ID.

function getSwapperTargets(uint16 swapperId) external view returns (address approvalTarget, address executionTarget);

Parameters

NameTypeDescription
swapperIduint16The swapper ID.

Returns

NameTypeDescription
approvalTargetaddressThe approval target.
executionTargetaddressThe execution target.

swap

Swaps tokens using a given swapper.

function swap(SwapOrder calldata order) external returns (uint256);

Parameters

NameTypeDescription
orderSwapOrderThe swap order object.

setSwapperTargets

Sets approval and execution targets for a given swapper ID.

function setSwapperTargets(uint16 swapperId, address approvalTarget, address executionTarget) external;

Parameters

NameTypeDescription
swapperIduint16The swapper ID.
approvalTargetaddressThe approval target.
executionTargetaddress

Events

Swap

event Swap(
address indexed sender,
uint16 swapperId,
address indexed inputToken,
address indexed outputToken,
uint256 inputAmount,
uint256 outputAmount
);

SwapperTargetsSet

event SwapperTargetsSet(uint16 indexed swapper, address approvalTarget, address executionTarget);

Structs

SwapperTargets

struct SwapperTargets {
address approvalTarget;
address executionTarget;
}

SwapOrder

Swap order object.

struct SwapOrder {
uint16 swapperId;
bytes data;
address inputToken;
address outputToken;
uint256 inputAmount;
uint256 minOutputAmount;
}

Properties

NameTypeDescription
swapperIduint16The ID of the external swap protocol.
databytesThe swap calldata to pass to the swapper's execution target.
inputTokenaddressThe input token.
outputTokenaddressThe output token.
inputAmountuint256The input amount.
minOutputAmountuint256The minimum expected output amount.