FungibleTokenDO
DataObject with base functionality of a fungible token
_This contract exposes base functionality of a fungible token, allowing to mint, burn, transfer (single and batch), check balances and total supply It also implements the IDODataTransfer interface to handle the transfer of DataPoint data between diids (Transfering the balance of an diid to another diid)
InsufficientBalance
Error thrown when the balance is insufficient
Parameters
| Name | Type | Description |
|---|---|---|
| diid | bytes32 | The owner identifier |
| balance | uint256 | The current balance |
| amount | uint256 | The requested amount |
InsufficientTotalSupply
Error thrown when the total supply is insufficient
Parameters
| Name | Type | Description |
|---|---|---|
| totalSupply | uint256 | The current total supply |
| amount | uint256 | The requested amount NOTE: This should never happen because we've already checked "from" balance |
ArrayLengthMismatch
Error thrown when the params length mismatch
DpData
Data structure for Fungible Token data
Parameters
| Name | Type | Description |
|---|
DiidData
Data structure for Data Index id data
Parameters
| Name | Type | Description |
|---|
onDataPointTransfer
Transfers data from one id to another
Access to this function MUST be protected and allowed only for Data Index Implementation registered for this DataPoint NOTE: Transfers using this function will skip hook functions on the Data Manager, disable it if required
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
Function 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 |
_totalSupply
Function used to get the total supply of the token
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The total supply of the token |
_mint
Function used to mint new tokens
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| to | address | The account address to mint the tokens to |
| amount | uint256 | The amount of tokens to mint |
_burn
Function used to burn tokens
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| from | address | The account address to burn the tokens from |
| amount | uint256 | The amount of tokens to burn |
_transfer
Function used to transfer tokens
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 |
| amount | uint256 | The amount of tokens to transfer |
_transferBatch
Function used to transfer tokens to multiple targets
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| from | address | The account address to transfer the tokens from |
| to | address[] | The account addresses to transfer the tokens to |
| amount | uint256 | The amount of tokens to transfer to each target |
_transferBatch
Function used to transfer tokens to multiple targets with different amounts
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| from | address | The account address to transfer the tokens from |
| to | address[] | The account addresses to transfer the tokens to |
| amount | uint256[] | The amounts of tokens to transfer |
_transferBatch
Function used to transfer tokens to multiple targets independently
Parameters
| Name | Type | Description |
|---|---|---|
| dp | DataPoint | DataPoint identifier |
| from | address[] | The account addresses to transfer the tokens from |
| to | address[] | The account addresses to transfer the tokens to |
| amount | uint256[] | The amounts of tokens to transfer |
_onDataPointTransfer
This function transfers the token balance of the fromDiid to the toDiid

