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

BaseAlgorithm

Git Source

Inherits: IAlgorithm

State Variables

HOOKADDRESS

The address of the hook that will call this algorithm.

address public immutable HOOKADDRESS

Functions

constructor

Constructor to set the hook address.

constructor(address _hookAddress) ;

Parameters

NameTypeDescription
_hookAddressaddressThe address of the hook that will call this algorithm.

onlyHook

Modifier to restrict access to the hook address.

only hook contract can call

modifier onlyHook() ;

_checkCallerIsHookContract

function _checkCallerIsHookContract() internal view;

name

Returns the name of the ordering algorithm.

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

Returns

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

version

Version of the algorithm.

function version() external pure virtual 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 virtual;

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 virtual override returns (uint256);