Hooks
Table of contents
Constructors
Methods
- _safeCall
- afterBatchTransferFrom
- afterBurn
- afterFlashLoan
- afterMint
- afterSwap
- beforeBatchTransferFrom
- beforeBurn
- beforeFlashLoan
- beforeMint
- beforeSwap
- getFlags
- onHooksSet
- setHooks
Constructors
constructor
• new Hooks(): Hooks
Returns
Methods
_safeCall
▸ _safeCall(encoded
, method
, args
): void
Helper function call the hook contract.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
method | string |
args | Args |
Returns
void
Defined in
assembly/libraries/Hooks.ts:63
afterBatchTransferFrom
▸ afterBatchTransferFrom(encoded
, sender
, from
, to
, ids
, amounts
): void
Calls afterBatchTransferFrom on the hooks contract if the AFTER_TRANSFER_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
from | Address |
to | Address |
ids | u64 [] |
amounts | u256 [] |
Returns
void
Defined in
assembly/libraries/Hooks.ts:275
afterBurn
▸ afterBurn(encoded
, sender
, to
, ids
, amountsToBurn
): void
Calls afterBurn on the hooks contract if the AFTER_BURN_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
to | Address |
ids | u64 [] |
amountsToBurn | u256 [] |
Returns
void
Defined in
assembly/libraries/Hooks.ts:236
afterFlashLoan
▸ afterFlashLoan(encoded
, sender
, to
, fees
, feesReceived
): void
Calls afterFlashLoan on the hooks contract if the AFTER_FLASH_LOAN_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
to | Address |
fees | u256 |
feesReceived | u256 |
Returns
void
Defined in
assembly/libraries/Hooks.ts:144
afterMint
▸ afterMint(encoded
, sender
, to
, ids
, distributionX
, distributionY
, amountsIn
): void
Calls afterMint on the hooks contract if the AFTER_MINT_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
to | Address |
ids | u64 [] |
distributionX | u256 [] |
distributionY | u256 [] |
amountsIn | u256 [] |
Returns
void
Defined in
assembly/libraries/Hooks.ts:190
afterSwap
▸ afterSwap(encoded
, sender
, to
, swapForY
, amountOut
): void
Calls afterSwap on the hooks contract if the AFTER_SWAP_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
to | Address |
swapForY | bool |
amountOut | u256 |
Returns
void
Defined in
assembly/libraries/Hooks.ts:107
beforeBatchTransferFrom
▸ beforeBatchTransferFrom(encoded
, sender
, from
, to
, ids
, amounts
): void
Calls beforeBatchTransferFrom on the hooks contract if the BEFORE_TRANSFER_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
from | Address |
to | Address |
ids | u64 [] |
amounts | u256 [] |
Returns
void
Defined in
assembly/libraries/Hooks.ts:255
beforeBurn
▸ beforeBurn(encoded
, sender
, to
, ids
, amountsToBurn
): void
Calls beforeBurn on the hooks contract if the BEFORE_BURN_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
to | Address |
ids | u64 [] |
amountsToBurn | u256 [] |
Returns
void
Defined in
assembly/libraries/Hooks.ts:217
beforeFlashLoan
▸ beforeFlashLoan(encoded
, sender
, to
, amount
): void
Calls beforeFlashLoan on the hooks contract if the BEFORE_FLASH_LOAN_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
to | Address |
amount | u256 |
Returns
void
Defined in
assembly/libraries/Hooks.ts:126
beforeMint
▸ beforeMint(encoded
, sender
, to
, ids
, distributionX
, distributionY
, amountsReceived
): void
Calls beforeMint on the hooks contract if the BEFORE_MINT_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
to | Address |
ids | u64 [] |
distributionX | u256 [] |
distributionY | u256 [] |
amountsReceived | u256 [] |
Returns
void
Defined in
assembly/libraries/Hooks.ts:163
beforeSwap
▸ beforeSwap(encoded
, sender
, to
, swapForY
, amountIn
): void
Calls beforeSwap on the hooks contract if the BEFORE_SWAP_FLAG is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
sender | Address |
to | Address |
swapForY | bool |
amountIn | u256 |
Returns
void
Defined in
assembly/libraries/Hooks.ts:88
getFlags
▸ getFlags(encoded
): u32
Returns the flags stored in the encoded parameters.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
Returns
u32
Defined in
assembly/libraries/Hooks.ts:56
onHooksSet
▸ onHooksSet(encoded
, onHooksSetData
): void
Calls the onHooksSet hook on the hooks contract if the hooks address is set.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
onHooksSetData | StaticArray <u8 > |
Returns
void
Defined in
assembly/libraries/Hooks.ts:72
setHooks
▸ setHooks(encoded
, newHooks
): HooksParameters
Returns a new encoded parameter with the hooks address replaced.
Parameters
Name | Type |
---|---|
encoded | HooksParameters |
newHooks | Address |