Hooks
Last updated
Last updated
This library contains functions that should be used to interact with hooks
Helper function to encode the hooks parameters to a single bytes32 value
Parameters
parameters
Parameters
The hooks parameters
Returns
hooksParameters
bytes32
The encoded hooks parameters
Helper function to decode the hooks parameters from a single bytes32 value
Parameters
hooksParameters
bytes32
The encoded hooks parameters
Returns
parameters
Parameters
The hooks parameters
Helper function to get the hooks address from the encoded hooks parameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
Returns
hooks
address
The hooks address
Helper function to set the hooks address in the encoded hooks parameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
newHooks
address
The new hooks address
Returns
<none>
bytes32
hooksParameters The updated hooks parameters
Helper function to get the flags from the encoded hooks parameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
Returns
flags
bytes12
The flags
Helper function call the onHooksSet function on the hooks contract, only if the hooksParameters is not 0
Parameters
hooksParameters
bytes32
The encoded hooks parameters
onHooksSetData
bytes
The data to pass to the onHooksSet function
Helper function to call the beforeSwap function on the hooks contract, only if the BEFORE_SWAP_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
to
address
The recipient
swapForY
bool
Whether the swap is for Y
amountsIn
bytes32
The amounts in
Helper function to call the afterSwap function on the hooks contract, only if the AFTER_SWAP_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
to
address
The recipient
swapForY
bool
Whether the swap is for Y
amountsOut
bytes32
The amounts out
Helper function to call the beforeFlashLoan function on the hooks contract, only if the BEFORE_FLASH_LOAN_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
to
address
The recipient
amounts
bytes32
The amounts
Helper function to call the afterFlashLoan function on the hooks contract, only if the AFTER_FLASH_LOAN_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
to
address
The recipient
fees
bytes32
The fees
feesReceived
bytes32
The fees received
Helper function to call the beforeMint function on the hooks contract, only if the BEFORE_MINT_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
to
address
The recipient
liquidityConfigs
bytes32[]
The liquidity configs
amountsReceived
bytes32
The amounts received
Helper function to call the afterMint function on the hooks contract, only if the AFTER_MINT_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
to
address
The recipient
liquidityConfigs
bytes32[]
The liquidity configs
amountsIn
bytes32
The amounts in
Helper function to call the beforeBurn function on the hooks contract, only if the BEFORE_BURN_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
from
address
The sender
to
address
The recipient
ids
uint256[]
The ids
amountsToBurn
uint256[]
The amounts to burn
Helper function to call the afterBurn function on the hooks contract, only if the AFTER_BURN_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
from
address
The sender
to
address
The recipient
ids
uint256[]
The ids
amountsToBurn
uint256[]
The amounts to burn
Helper function to call the beforeTransferFrom function on the hooks contract, only if the BEFORE_TRANSFER_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
from
address
The sender
to
address
The recipient
ids
uint256[]
The list of ids
amounts
uint256[]
The list of amounts
Helper function to call the afterTransferFrom function on the hooks contract, only if the AFTER_TRANSFER_FLAG is set in the hooksParameters
Parameters
hooksParameters
bytes32
The encoded hooks parameters
sender
address
The sender
from
address
The sender
to
address
The recipient
ids
uint256[]
The list of ids
amounts
uint256[]
The list of amounts
Helper function to call the hooks contract and verify the call was successful by matching the expected selector with the returned data
Parameters
hooksParameters
bytes32
The encoded hooks parameters
data
bytes
The data to pass to the hooks contract