ISwapModule
Functions
getSwapperTargets
Returns approval and execution targets for a given swapper ID.
function getSwapperTargets(uint16 swapperId) external view returns (address approvalTarget, address executionTarget);Parameters
| Name | Type | Description |
|---|---|---|
| swapperId | uint16 | The swapper ID. |
Returns
| Name | Type | Description |
|---|---|---|
| approvalTarget | address | The approval target. |
| executionTarget | address | The execution target. |
swap
Swaps tokens using a given swapper.
function swap(SwapOrder calldata order) external returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| order | SwapOrder | The swap order object. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
setSwapperTargets
Sets approval and execution targets for a given swapper ID.
function setSwapperTargets(uint16 swapperId, address approvalTarget, address executionTarget) external;Parameters
| Name | Type | Description |
|---|---|---|
| swapperId | uint16 | The swapper ID. |
| approvalTarget | address | The approval target. |
| executionTarget | address | The execution target. |
Events
Swap
event Swap(
address indexed sender,
uint16 swapperId,
address indexed inputToken,
address indexed outputToken,
uint256 inputAmount,
uint256 outputAmount
);Parameters
| Name | Type | Description |
|---|---|---|
| sender | address | |
| swapperId | uint16 | |
| inputToken | address | |
| outputToken | address | |
| inputAmount | uint256 | |
| outputAmount | uint256 |
SwapperTargetsSet
event SwapperTargetsSet(uint16 indexed swapper, address approvalTarget, address executionTarget);Parameters
| Name | Type | Description |
|---|---|---|
| swapper | uint16 | |
| approvalTarget | address | |
| executionTarget | address |
Structs
SwapperTargets
struct SwapperTargets {
address approvalTarget;
address executionTarget;
}Properties
| Name | Type | Description |
|---|---|---|
| approvalTarget | address | |
| executionTarget | address |
SwapOrder
Swap order object.
struct SwapOrder {
uint16 swapperId;
bytes data;
address inputToken;
address outputToken;
uint256 inputAmount;
uint256 minOutputAmount;
}Properties
| Name | Type | Description |
|---|---|---|
| swapperId | uint16 | The ID of the external swap protocol. |
| data | bytes | The swap calldata to pass to the swapper's execution target. |
| inputToken | address | The input token. |
| outputToken | address | The output token. |
| inputAmount | uint256 | The input amount. |
| minOutputAmount | uint256 | The minimum expected output amount. |