FungibleFractionsDO
DataObject with base funtionality of Fungible Fractions (Can be used for ERC1155-Compatible DataManagers)
_This contract exposes base functionality of Fungible Fraction tokens, including balanceOf, totalSupply, exists, transferFrom, mint, burn and their batch variants. It also implements the IDODataTransfer interface to handle the transfer of DataPoint data between diids (transfering the balances of the tokens to a different diid if target is empty)
InsufficientBalance
Error thrown when the balance is insufficient
Parameters
Name | Type | Description |
---|---|---|
diid | bytes32 | The Data index id of the user |
id | uint256 | The id of the token |
balance | uint256 | The current balance |
value | uint256 | The requested amount |
InsufficientTotalSupply
Error thrown when the total supply is insufficient
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | The id of the token |
totalSupply | uint256 | The current total supply |
value | uint256 | The requested amount NOTE: This should never happen because we've already checked "from" balance |
ArrayLengthMismatch
Error thrown when the params length mismatch
TransferConflict
Error thrown when there is a conflict in the transfer
DpData
Data structure for storing Fungible Fractions data
Parameters
Name | Type | Description |
---|
DiidData
Data structure for storing Fungible Fractions data of a user
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 | The DataPoint identifier |
account | address | The account address |
id | uint256 | The id of the token |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The balance of the account |
_balanceOfBatch
Function used to get the balance of an account
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
account | address | The account address |
ids | uint256[] | The ids of the tokens |
Return Values
Name | Type | Description |
---|---|---|
balances | uint256[] | The balance of the account |
_balanceOfBatchAccounts
Function used to get the balance of multiple accounts
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
accounts | address[] | The account addresses |
ids | uint256[] | The ids of the tokens |
Return Values
Name | Type | Description |
---|---|---|
balances | uint256[] | The balance of the accounts |
_totalSupply
Function used to get the total supply of a token
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
id | uint256 | The id of the token |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The total supply of the token |
_totalSupplyAll
Function used to get the total supply of all ids tokens
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The total supply of all ids tokens |
_exists
Function used to check if an id exists
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
id | uint256 | The id of the token |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | True if the id exists, false otherwise |
_transferFrom
Function used to transfer tokens from one account to another
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
from | address | The account to transfer from |
to | address | The account to transfer to |
id | uint256 | The id of the token |
value | uint256 | The amount of tokens to transfer |
_mint
Function used to mint tokens
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
to | address | The account to mint to |
id | uint256 | The id of the token |
value | uint256 | The amount of tokens to mint |
_burn
Function used to burn tokens
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
from | address | The account to burn from |
id | uint256 | The id of the token |
value | uint256 | The amount of tokens to burn |
_batchTransferFrom
Function used to transfer multiple tokens from one account to another at once
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
from | address | The account to transfer from |
to | address | The account to transfer to |
ids | uint256[] | The ids of the tokens |
values | uint256[] | The amounts of tokens to transfer |
_batchMint
Function used to mint multiple tokens at once
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
to | address | The account to mint to |
ids | uint256[] | The ids of the tokens |
values | uint256[] | The amounts of tokens to mint |
_batchBurn
Operation used to burn multiple tokens at once
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
from | address | The account to burn from |
ids | uint256[] | The ids of the tokens |
values | uint256[] | The amounts of tokens to burn |