CLVR
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
| Name | Type | Description |
|---|---|---|
<none> | string | The name of the algorithm as a string. |
version
Version of the algorithm.
function version() external pure override returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The version of the algorithm as a string. |
orderingRule
Executes the transaction ordering algorithm.
function orderingRule(bool zeroForOne, uint256 amount) external override onlyHook;
Parameters
| Name | Type | Description |
|---|---|---|
zeroForOne | bool | Indicates the direction of the trade (true for currency0 to currency1, false for currency1 to currency0). |
amount | uint256 | The amount of the order being processed. |
getVolatility
function getVolatility(AsyncOrder[] memory orders) external pure override returns (uint256);