NonFungibleTokenDO
DataObject to interact with non-fungible tokens
This contract is used to manage non-fungible tokens where a Data Object contract is used to store the token data
InsufficientBalance
Error thrown when the balance is insufficient
Parameters
| Name | Type | Description |
|---|---|---|
| diid | bytes32 | The owner identifier |
| currentBalance | uint256 | The current balance of the owner |
| balance | uint256 | The balance to decrease |
| tokenId | uint256 | The token id |
ArrayLengthMismatch
Error thrown when the params length mismatch
InvalidBatchOrder
Error thrown when tokens are sent out of order
TokenAlreadyExists
Error thrown when the token to mint already exists
Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The token id |
TokenNotOwned
Error thrown when the token to burn is not owned by the account
Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The token id |
DpData
Data structure for Non Fungible Token data
Parameters
| Name | Type | Description |
|---|
DiidData
Data structure for Non Fungible Token owner data
Parameters
| Name | Type | Description |
|---|
constructor
onDataPointTransfer
Transfers data from one id to another
onDataPointTransfer in this implementation does nothing
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | Identifier of the DataPoint |
| fromDiid | bytes32 | ID to transfer from |
| toDiid | bytes32 | ID to transfer to |
_dispatchRead
_dispatchWrite
_balanceOf
Operation used to get the balance of an account
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| account | address | The account address |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The balance of the account |
_ownerOf
Operation used to get the owner of a token
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| tokenId | uint256 | The token id |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | address | The owner of the token |
_mint
Operation used to mint new token
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| to | address | The account address to mint the token to |
| tokenId | uint256 | The tokenId of token to mint |
_burn
Operation used to burn a token
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| from | address | The account address to burn the token from |
| tokenId | uint256 | The tokenId of token to burn |
_transferFrom
Operation used to transfer token
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| from | address | The account address to transfer the token from |
| to | address | The account address to transfer the token to |
| tokenId | uint256 | The tokenId of token to transfer |
_batchTransferFrom
Operation used to transfer batch of tokens
If the balance is insufficient, the operation will revert with tokenId 0 and not the actual tokenId that caused the error, to save gas
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| from | address | The account address to transfer the tokens from |
| to | address | The account address to transfer the tokens to |
| tokenIds | uint256[] | The tokenIds of tokens to transfer |
_batchTransferFrom
Operation used to transfer batch of tokens
If the balance is insufficient, the operation will revert with tokenId 0 and not the actual tokenId that caused the error, to save gas NOTE: The token ids array MUST have at least 2 elements and all elements MUST be in ASCENDING order
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| from | address | The account address to transfer the tokens from |
| to | address[] | The accounts addresses to transfer the tokens to |
| tokenIds | uint256[] | The tokenIds of tokens to transfer |

