AsyncFiller
Author: Async Labs
This library provides functionality for filling async swap orders in the Uniswap V4 pool.
Functions
isExecutor
Checks if the given executor is valid for the async order.
function isExecutor(AsyncOrder calldata order, State storage self, address executor) internal view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
order | AsyncOrder | The async order to be filled. |
self | State | The storage slot that controls the state of orders. |
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. |
executeOrder
Fills async orders in batching mode, allowing multiple orders to be executed in a single transaction.
function executeOrder(AsyncOrder[] calldata orders, State storage self, bytes calldata userParams) external;
Parameters
| Name | Type | Description |
|---|---|---|
orders | AsyncOrder[] | An array of async orders to be executed. |
self | State | |
userParams | bytes | Additional data for the user, allowing user to specify an executor. |
_execute
Fill an async order in an Async Swap AMM.
function _execute(AsyncOrder calldata order, State storage self, bytes calldata) internal;
Parameters
| Name | Type | Description |
|---|---|---|
order | AsyncOrder | The async order to be filled. |
self | State | The state of the AsyncFiller library, containing async orders and executors. |
<none> | bytes |
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. |
Errors
InvalidOrder
Error thrown when an order is invalid.
error InvalidOrder();
ZeroFillOrder
Error thrown when an order is of zero amount.
error ZeroFillOrder();
Structs
State
Represents the state of the AsyncFiller library storage for async orders and executors.
struct State {
IPoolManager poolManager;
IAlgorithm algorithm;
mapping(address user => mapping(bool zeroForOne => uint256 claimable)) asyncOrderAmount;
mapping(address owner => mapping(address executor => bool)) isExecutor;
}
Properties
| Name | Type | Description |
|---|---|---|
poolManager | IPoolManager | The PoolManager contract that manages the pools. |
algorithm | IAlgorithm | |
asyncOrderAmount | mapping(address user => mapping(bool zeroForOne => uint256 claimable)) | |
isExecutor | mapping(address owner => mapping(address executor => bool)) |