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

IAlgorithm

Git Source

Author: Async Labs

This interface defines the functions for transaction ordering algorithms used in the Async Swap AMM hook.

Functions

orderingRule

Executes the transaction ordering algorithm.

function orderingRule(bool zeroForOne, uint256 amount) external;

Parameters

NameTypeDescription
zeroForOneboolIndicates the direction of the trade (true for currency0 to currency1, false for currency1 to currency0).
amountuint256The amount of the order being processed.

name

Returns the name of the ordering algorithm.

function name() external view returns (string memory);

Returns

NameTypeDescription
<none>stringThe name of the algorithm as a string.

version

Version of the algorithm.

function version() external view returns (string memory);

Returns

NameTypeDescription
<none>stringThe version of the algorithm as a string.

getVolatility

function getVolatility(AsyncOrder[] memory orders) external pure returns (uint256);