Others Events

Main Interface events

URI Event

event URI(string value, uint256 indexed id);

The URI event is emitted in two cases by the Main Interface singleton contract:

  1. When an Item is created within the Collection through thecreateCollection function or directly using the mintItems function. If multiple Items are created at once in a single transaction, multiple URI event will be emitted.

  2. When the uri of an Item is changed by the setItemsMetadata function. If multiple Items uri are changed at once in a single transaction, multiple URI event will be emitted.

The uint256 id represents the itemId of the created Item (point 1) or the item on which the uri is changed (point 2).

emit URI(itemData.header.uri, itemIds[i]);

ApprovalForAll event

event ApprovalForAll(address indexed account, address indexed operator, bool approved);

The ApprovalForAll event is emitted by the Main Interface singleton contract when the setApprovalForAll function is called. The msg.sender grants or revokes permission to the operator address to act on all the account’s Items.

emit ApprovalForAll(msg.sender, operator, approved);

TransferSingle event

event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

The TransferSingle event is emitted by the Main Interface singleton contract in 4 situations:

  • When the burn (both the version with or without data) functions is called. The operator address is equal to from address if the msg.sender is the from address otherwise it is the operator address calling the function. The from address is the one who owns the tokens to burn. recipient address is equal to address(0). Id represents the tokenId to burn. value represents the amount to burn.

  • When the safeTransferFrom functions is called. The operator address is equal to from address if the msg.sender is the from address otherwise it is the operator address calling the function. The from address is the one who owns the tokens to transfer. recipient address is equal to the address receiving the token. Id represents the tokenId to transfer. value represents the amount to transfer.

  • When the mintTransferOrBurn function is called in single mode (isMulti is false) minting an Item. The operator address is equal to address(0). The from is the Collection host addres. The recipient address is equal to address receiving the created/minted token. Id represents the tokenId created/minted. value represents the amount created/minted.

  • When the mintTransferOrBurn function is called in single mode (isMulti is false) transferring an Item. The operator address is equal tofrom address if the msg.sender is the from address otherwise it is the operator address calling the function. The from address is the one who owns the tokens to transfer. The recipient address is equal to the address receiving the token. Id represents the tokenId to transfer. value represents the amount to transfer.

  • When the mintTransferOrBurn function is called in single mode (isMulti is false) burning an Item. The operator address is equal tofrom address if the msg.sender is the from address otherwise it is the operator address calling the function. The from address is the one who owns the tokens to burn. The recipient address is address(0).Id represents the tokenId to burn. value represents the amount to burn.

TransferBatch event

event TransferBatch(
    address indexed operator,
    address indexed from,
    address indexed to,
    uint256[] ids,
    uint256[] values
);

The TransferBatch event is emitted in four situations:

  • When one or multiple Items are created within the Collection through thecreateCollection function or directly using the mintItems function. In this case, operator is address(0), from is address(0), to is the receiver address of the created/minted Items, ids represents the itemIds created/minted and values represents the itemIds amounts created/minted.

  • When the burnBatch functions is called. The operator address is equal to from address if the msg.sender is the from address otherwise it is the operator address calling the function. The recipient address is equal to address(0). ids represents the itemIds burned and values represents the itemIds amounts burned.

  • When the safeBatchTransferFrom functionis called. The operator address is equal to from address if the msg.sender is the from address otherwise it is the operator address calling the function. The recipient address is equal to the address receiving the tokens. ids represents the itemIds transferred and values represents the itemIds amounts transferred.

  • When the mintTransferOrBurn function is called with isMulti as true. So when the mintTransferOrBurn function is called to perform a multi-single or a multi-batch mint, transfer or burn operation. In case of a transfer the sender and the recipient address are populated differently from address(0). In case of a burn the sender address is populated differently from address(0) and the recipient address is equal to address(0). In case of a mint the sender address is equal to address (0).Look at here for more information about the mintTransferOrBurn operation.

Interoperable Interface events

Approval

event Approval(address indexed owner, address indexed spender, uint256 value);

The approval event is emitted by the Interoperable Interface contract in two cases:

  • When the approve function on the Interoperable Interface is called. Remember that the Interoperable approve function can be called only by the Items holder.

emit Approval(msg.sender, spender, amount);
  • When the permit function on the Interoperable Interface is called. Remember that the Interoperable permit function can be called by any address.

emit Approval(owner, spender, value);

Transfer

event Transfer(address indexed from, address indexed to, uint256 value);

The Transfer event is emitted by the Interoperable Interface contract in two cases:

  • When the burn function of the Interoperable Interface is called. The address to is equal to address(0).

emit Transfer(msg.sender, address(0), amount);
  • When the transfer or transferFrom function of the Interoperable Interface is called. In the first case the sender address is equal to msg.sender.

emit Transfer(sender, recipient, amount

EmitEvent function

The emitEvent function of the Interoperable Interface is called by the Main Interface to emit events is some operations at the Interoperable level. Look here for more information about the emitEvent operation.

Approval

In particular, the emitEvent is called by the Main interface to launch the approval event on the Interoperable Interface in two cases:

  • When the approve function (of the Main Interface) is called by an address different from the Interoperable Interface address, so when

    msg.sender != address(uint160(itemId)).

Remember that, as explained here, the approve function can be called by:

  • Item holder,

  • Item InteroperableInterface.

IItemInteroperableInterface(address(uint160(itemId))).emitEvent(true, false, abi.encode(account, spender, amount));
  • When the permit function (of the Main Interface) is called by an address different from the Interoperable Interface address, so when msg.sender != address(uint160(itemId). Remember that, as explained here, the permit function can be called by any address.

IItemInteroperableInterface(address(uint160(itemId))).emitEvent(true, false, abi.encode(owner, spender, value));

Transfer

The emitEvent is called by the Main interface to launch the Transfer event on the Interoperable Interface in some different cases:

  • When the burn (both the version with or without data) or the safeTransferFrom functions are called on the Main Interface. In case of a burn, the to address is equal to address(0).

IItemInteroperableInterface(address(uint160(itemId))).emitEvent(false, false, abi.encode(sender, recipient, amount));
  • When one or multiple Items are created within the Collection through thecreateCollection function or directly using the mintItems function. If multiple Items are created, multiple Transfer events are emitted.

  • When the burnBatch or the safeBatchTransferFrom functions are called. In both cases, the operator address is equal to msg.sender. The recipient address is equal to address(0) in case of the burnBatch, otherwise in case of the safeTransferFrom it is populated different from address(0). If multiple Items are burned/transferred, multiple Transfer events are emitted.

  • When the mintTransferOrBurn function is called with isMulti as true. So when the mintTransferOrBurn function is called to perform a multi-single or a multi-batch mint, transfer or burn operation. In case of a transfer the sender and the recipient address are populated differently from address(0). In case of a burn the sender address is populated differently from address(0) and the recipient address is equal to address(0). In case of a mint the sender address is equal to address (0).Look at here for more information about the mintTransferOrBurn operation. If multiple Items are minted/burned/transferred, multiple Transfer events are emitted.

IItemInteroperableInterface(address(uint160(itemId))).emitEvent(false, true, abi.encode(senders, receivers, amounts));

Last updated