BaseAlgorithm
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
| Name | Type | Description |
|---|---|---|
_hookAddress | address | The 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
| Name | Type | Description |
|---|---|---|
<none> | string | The name of the algorithm as a string. |
version
Version of the algorithm.
function version() external pure virtual 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 virtual;
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 virtual override returns (uint256);