IHook ​
Functions ​
dexPrice ​
Hook function to check for liquidation opportunities before external swaps
The primary use of this hook is to check if a particular pair vault has liquidation available. If liquidation is available, it gives priority to the liquidation process before allowing external swaps. In most cases, this hook will not be set.
solidity
function dexPrice(uint256 id_, bool swap0to1_, address token0_, address token1_, uint256 price_)
external
returns (bool isOk_);
Parameters
Name | Type | Description |
---|---|---|
id_ | uint256 | Identifier for the operation type: 1 for swap, 2 for internal arbitrage |
swap0to1_ | bool | Direction of the swap: true if swapping token0 for token1, false otherwise |
token0_ | address | Address of the first token in the pair |
token1_ | address | Address of the second token in the pair |
price_ | uint256 | The price ratio of token1 to token0, expressed with 27 decimal places |
Returns
Name | Type | Description |
---|---|---|
isOk_ | bool | Boolean indicating whether the operation should proceed |