Transfer function Interface

The Transfer Interface defines a function interface that can execute a Transfer operation.

Input

There are no strict requirements for the input, but it is recommended to use the input format defined in the Transfer operation.

You can also write a function that only takes the tick, amt and recipient parameters, then calculate the hash of all operations in your contract and inscribe it into the message, although this will consume more gas.

Output

The output of this function should be a message payload, which conform to the following format:

ParamtertypeDescription
Transfer_hashFelt252Hash of Transfer operation
SenderContractAddressSender's address
RecipientContractAddressRecipient's address
AmountFelt252(u128)Amount of this transfer operation

These data contain the key elements to restore the complete Transfer inscription.

Here is an example of an message payload(in Hex):

IndexValue
00x70B420BAF038B3D467D80FD313B0D2AEDBEB46B7157CED682649D4507292E6A
10x111111111111111111111111111111111111111111111111111111111111111
20x0
30x22658

Event

After a Transfer function is successfully executed, it should emit an event. This will facilitate the indexer to include this transaction.

The format of the events is as follows:

event Trasfer(sender, hash, recipient, amount)

The parameters are:

InputTypeDescription
senderContractAddressSender's address
hashFelt252Mint_hash
recipientContractAddressRecipient's address
amountFelt252(u128)Amount of this mint operation