Skip to content

IHook ​

Git Source

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

NameTypeDescription
id_uint256Identifier for the operation type: 1 for swap, 2 for internal arbitrage
swap0to1_boolDirection of the swap: true if swapping token0 for token1, false otherwise
token0_addressAddress of the first token in the pair
token1_addressAddress of the second token in the pair
price_uint256The price ratio of token1 to token0, expressed with 27 decimal places

Returns

NameTypeDescription
isOk_boolBoolean indicating whether the operation should proceed