ItemInteroperableInterface

Every Item—native or wrapped/Decks—has its own unique Interoperable Interface, which gives the Item all ERC20 features and functionalities, by implementing the IERC20, IERC20Metadata and IERC20Permit interfaces. This allows each Item to use all of the standard ERC20 functions, such as transfer, transferFrom, totalSupply, balanceOf, etc.

All Interoperable Interfaces are linked to their corresponding itemIds in the Main Interface. So, all Items share the Main Interface, but each is distinguished in the Main interface by its unique itemId, through which it is linked to its Interoperable Interface.

Functions:

init

function init() external;
  • Function type: write

  • Callable by:

    • the Main Interface

This function is used to link an Interoperable Interface address with its itemId, stored in the Main Interface; initialization of the Interoperable Interface is called directly by the MainInterface when the Item is created.

Approval operations

allowance

function allowance(address owner, address spender) override external view returns (uint256)
  • Function type: read-only

This function can be used to check the amount of the Item that an approved operator can spend.

approve

function approve(address spender, uint256 amount) override external returns(bool)
  • Function type: write.

  • Callable by:

    • Item holder

This function can be used to grant to or revoke permission from a spender address to act on the holder’s item amount.

Permit operations

Domain separator and name

EIP712_PERMIT_DOMAINSEPARATOR_NAME_AND_VERSION()
  • Function type: read-only

This function returns the name and version of the domainSeparator, used to identify its specific domainSeparator in the Main Interface contract.

The name is “Item” and the version is “1”.

nonces

function nonces(address owner) external override view returns(uint256)
  • Function type: read-only

This function returns the specific nonce for a specific owner of the item. The nonce is used to perform an off-chain transaction signature.

permit

function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) override external
  • Function type: write

  • Callable by: any address

This permit function can be used to perform the permit approval on the Item's Interoperable Interface side (ERC20).

Look at the Main Interface Permit section lo learn more.

Transfer Operation

Transfer

function transfer(address recipient, uint256 amount) override external returns(bool)
  • Function type: write.

  • Callable by:

    • Item holder

This is the classic ERC20 transfer function. It can be used to transfer an amount of the Item to a recipient address.

TransferFrom

function transferFrom(address sender, address recipient, uint256 amount) override external returns(bool)
  • Function type: write.

  • Callable by:

    • Any address that holds >= the amount of the Item being transferred

    • Any approved operator address that holds >= the amount of the Item being transferred

This is the classic ERC1155 safeTransferFrom function. It can be used to transfer an amount of a the Item from the sender to the recipient address.

Burn operations

Burn

function burn(uint256 amount) external;
  • Function type: write

  • Callable by:

    • any Item holder address

This function only requires that the holder holds the desired amount of the token to burn. It internally calls the mintTransferOrBurn function of the ItemMainInterface, passing address(0) as the recipient address.

To learn more, read about the mintTransferOrBurn function.

Burn From

function burnFrom(address account, uint256 amount) external;
  • Function type: write.

  • Callable by:

    • any approved address that has at least >= of the approved amount to burn.

This function requires that the address account holds enough of the Item to burn. It can be used by any approved address.

Utility functions

main Interface

function mainInterface() external view returns(address);
  • Function type: read-only

This function returns the MainInterface’s singleton address.

itemId

function itemId() external view returns(uint256);
  • Function type: read-only

This function returns the itemId of the Item that corresponds to a specific Interoperable Interface.

emit Event

function emitEvent(bool forApprove, bool isMulti, bytes calldata data) external;
  • Function type: write

  • Callable by:

    • the Main Interface

This is a utility function. The Main Interface can call it to launch one of two events for an Item at the Interoperable level. These are the Approval event and the Transfer event.

Approval Event

If the forApprove bool parameter is passed as true, the Approval event (the standard ERC20 approval event) will launch.

Transfer

If the forApprove bool parameter is passed is false, the Transfer event (the standard ERC20 transfer event) will launch.

Regarding Both Approval & Transfer

If the isMulti bool parameter is passed as false, the event launches for a single from, to and amount. The bytes data parameter must contain the encoded from, to and amount parameters.

If it is passed as true, the event launches for multiple froms[i], tos[i] & amounts[i]. This occurs when the event is launched via a batch operation execution via the Main Interface. The bytes data parameter must contain the encoded froms[i], tos[i], and amounts[i] parameters.

These parameters are encoded when the emitEvent is called by a Main Interface function, and are then decoded by the emitEvent function itself.

The name is “Item” and the version is “1”.

Other functions

In addition to the above functions, it is also possible to execute the following ones, through the InteroperableInterface:

  • name()

  • symbol()

  • decimals()

  • nonces(address)

  • totalSupply()

  • balanceOf(address account)

Last updated