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

CLVR

Git Source

Inherits: BaseAlgorithm

Author: Meek Msaki @ Async Labs

This contract implements the CLVR algorithm for ordering transactions.

CLVR selects the next trade that minimizes price volatility (ln p0 - ln P(d, t))^2. The rule picks at each step t as the next trade that causes minimal local one-step price volatility from the status quo price p0.

Note: reference: https://arxiv.org/abs/2408.02634

Functions

constructor

constructor(address _hookAddress) BaseAlgorithm(_hookAddress);

name

Returns the name of the ordering algorithm.

function name() external pure override returns (string memory);

Returns

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

version

Version of the algorithm.

function version() external pure override returns (string memory);

Returns

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

orderingRule

Executes the transaction ordering algorithm.

function orderingRule(bool zeroForOne, uint256 amount) external override onlyHook;

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.

getVolatility

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