IRouter
Title: Router Interface
Author: Async Labs
This interface defines the functions for the Router contract, which allows users to swap tokens and fill orders using async orders.
Functions
swap
Swaps tokens using an async order.
function swap(AsyncOrder calldata order, bytes calldata userData) external payable;
Parameters
| Name | Type | Description |
|---|---|---|
order | AsyncOrder | The async order to be placed. |
userData | bytes | Additional data for the user, allowing user to specify an executor. |
fillOrder
Fills an async order.
function fillOrder(AsyncOrder calldata order, bytes calldata userData) external payable;
Parameters
| Name | Type | Description |
|---|---|---|
order | AsyncOrder | The async order to be filled. |
userData | bytes | Additional data for the user, allowing user to specify an executor. |
withdraw
function withdraw(PoolKey memory key, bool zeroForOne, uint256 amount) external;
Structs
SwapCallback
Callback structure for the swap function.
struct SwapCallback {
ActionType action;
AsyncOrder order;
}
Properties
| Name | Type | Description |
|---|---|---|
action | ActionType | The action type, either Swap or FillOrder. |
order | AsyncOrder | The async order that is in context for the swap or fill operation. |
WithdrawCallback
struct WithdrawCallback {
ActionType action;
PoolKey key;
bool zeroForOne;
uint256 amount;
address user;
}
Enums
ActionType
Enum representing the action type for the swap callback.
- Swap - If the action is a swap, this will specify the async swap order intent.
- FillOrder - If the action is a fill order, this will specify fill order intent.
enum ActionType {
Swap,
FillOrder,
Withdrawal
}