Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IAsyncSwapOrder

Git Source

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

NameTypeDescription
poolIdPoolIdThe poolId of the pool where the order is placed.
useraddressThe user who placed the order.
zeroForOneboolWhether the order is for a swap from currency0 to currency1 (true) or currency1 to currency0 (false).

Returns

NameTypeDescription
claimableuint256The 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

NameTypeDescription
poolIdPoolIdThe poolId the executor is interacting with.
owneraddressThe async order owner be checked against.
executoraddressThe address of the executor to be checked.

Returns

NameTypeDescription
<none>boolisExecutor 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

NameTypeDescription
poolIdPoolIdThe poolId of the pool where the order is placed.
owneraddressThe owner of the order, who can claim the order.
zeroForOneboolWhether the order is for a swap from currency0 to currency1 (true) or currency1 to currency0 (false).
amountuint256The 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

NameTypeDescription
poolIdPoolIdThe poolId of the pool where the order is placed.
owneraddressThe owner of the order, who can claim the order.
zeroForOneboolWhether the order is for a swap from currency0 to currency1 (true) or currency1 to currency0 (false).
amountInint256The 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();