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 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 type: read-only
This function can be used to check the amount of the Item that an approved operator
can spend.
approve
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
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 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 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 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 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 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 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 type: read-only
This function returns the MainInterface’s singleton address.
itemId
Function type: read-only
This function returns the itemId of the Item that corresponds to a specific Interoperable Interface.
emit Event
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