AndromedaHookenum as shown below.
OnExecuteis called at the root
OnFundsTransferis called before CW20 tokens are transferred or sent, and before a transfer gets executed for a CW721.
OnTransferis called when performing a transfer for a CW721.
OnExecutehooks are called using the general function
OnExecutethe return type is
Result<Vec<Response>,ContractError>so we expect a module that implements this hook to return a binary encoded
payloadin this case is the
ExecuteMsgthat was called.
OnFundsTransferis handled differently than the
on_funds_transferfunction as shown below:
Ratesmodule which generates sub-messages that send royalties/taxes to the correct recipient and deduct any taxes from the sent funds which is why we need
leftover_funds. This hook is also used to generate the events needed mint receipts by the receipt module.
OnTransferhook is called using the general
OnTransferhook currently is the
Bidsmodule. Transferring an NFT will trigger the
OnTransferhook which will be sent to the
Bidsmodule if found. If the receiver of the NFT had a bid placed on it, then we consider that the bid has been accepted by the seller and the
AcceptBidis automatically executed by the contract.
AndromedaHook) variant in its
OnTransfer, the query should return a binary encoded
OnFundsTransferthe query should return a binary encoded
ContractError::UnsupportedOperation. Any other error that is returned will be bubbled up and cause the transaction to fail.
OnExecutehook which it uses to determine if the sender is authorized based on the whitelist or blacklist. If not authorized, it returns a
ContractError::InvalidAddressand otherwise a
Response::default(). Here is the specific code for it:
OnFundsTransferhook which it uses to generate sub-messages to send any royalties/taxes to the designated recipients, create events to record the transactions, and deduct any taxes from the sent funds.
OnFundsTransferhook which it uses to generate a sub message which will create a Receipt with the given events. In this case it assumes that the
payloadis a binary encoding of
Vec<Event>which it decodes and uses to generate the Receipt message.
OnTransferhook which it uses to check if the
recipientof the transfer has a bid placed on the Nft with the
code_id. If so, it will execute an AcceptBid to send the funds of the bid to the seller.