IAsyncSwapOrder
Author: Async Labs
This interface defines the functions for the Async Swap orders.
Functions
asyncOrderAmount
Returns the claimable amount for an async order.
function asyncOrderAmount(PoolId poolId, address user, bool zeroForOne) external view returns (uint256 claimable);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | PoolId | The poolId of the pool where the order is placed. |
user | address | The user who placed the order. |
zeroForOne | bool | Whether the order is for a swap from currency0 to currency1 (true) or currency1 to currency0 (false). |
Returns
| Name | Type | Description |
|---|---|---|
claimable | uint256 | The amount that can be claimed by the user. |
isExecutor
Checks if the given executor is valid for the async order.
function isExecutor(PoolId poolId, address owner, address executor) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | PoolId | The poolId the executor is interacting with. |
owner | address | The async order owner be checked against. |
executor | address | The address of the executor to be checked. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | isExecutor True if the executor is valid for the async order, false otherwise. |
Events
AsyncOrderFilled
Emitted when an async order is filled.
event AsyncOrderFilled(PoolId poolId, address owner, bool zeroForOne, uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | PoolId | The poolId of the pool where the order is placed. |
owner | address | The owner of the order, who can claim the order. |
zeroForOne | bool | Whether the order is for a swap from currency0 to currency1 (true) or currency1 to currency0 (false). |
amount | uint256 | The amount of the order. |
AsyncSwapOrder
Emitted when an async swap order is created.
event AsyncSwapOrder(PoolId poolId, address owner, bool indexed zeroForOne, int256 indexed amountIn);
Parameters
| Name | Type | Description |
|---|---|---|
poolId | PoolId | The poolId of the pool where the order is placed. |
owner | address | The owner of the order, who can claim the order. |
zeroForOne | bool | Whether the order is for a swap from currency0 to currency1 (true) or currency1 to currency0 (false). |
amountIn | int256 | The amount of the order that is being filled. |
Errors
InvalidOrder
Error thrown when an order is invalid.
error InvalidOrder();
ZeroFillOrder
Error thrown when an order is of zero amount.
error ZeroFillOrder();