ERC1155WithERC20FractionsDataManager
Contract for managing ERC1155 tokens with ERC20 fractions
_This contract is used to manage ERC1155 tokens where each token ID can be treated as an ERC20 token by deploying a ERC20FractionDataManager contract for each token ID.
IncorrectId
Error thrown when the ERC1155 token ID is zero
BatchOperationNotSupported
Error thrown when the Batch mint or burn is called
ERC20FractionDataManagerDeployed
Event emitted when a ERC20FractionDataManager contract is deployed
fractionManagersById
Mapping of ERC20FractionDataManager contract address by token ID
fractionManagersByAddress
Mapping of token ID by ERC20FractionDataManager contract address
constructor
Set up the ERC1155 Data Manager
mint
Mint new tokens
Parameters
| Name | Type | Description |
|---|---|---|
| to | address | The address to mint tokens to |
| id | uint256 | The token ID |
| value | uint256 | The amount of tokens to mint |
| data | bytes | Additional data with no specified format |
burn
Burn tokens
Parameters
| Name | Type | Description |
|---|---|---|
| from | address | The address to burn tokens from |
| id | uint256 | The token ID |
| value | uint256 | The amount of tokens to burn |
batchMint
Batch mint not supported
batchBurn
Batch burn not supported
fractionTransferredNotify
Function to emit a TransferSingle event
This function is used to emit a TransferSingle event when a transfer operation is performed in the ERC20FractionDataManager contract
Parameters
| Name | Type | Description |
|---|---|---|
| from | address | The address to transfer tokens from |
| to | address | The address to transfer tokens to |
| value | uint256 | The amount of tokens to transfer |
_mint
_burn
_update
_Transfers a value amount of tokens of type id from from to to. Will mint (or burn) if from
(or to) is the zero address.
Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
Requirements:
- If
torefers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. idsandvaluesmust have the same length.
NOTE: The ERC-1155 acceptance check is not performed in this function. See {updateWithAcceptanceCheck} instead.
_update
_Transfers a value amount of tokens of type id from from to to. Will mint (or burn) if from
(or to) is the zero address.
Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
Requirements:
- If
torefers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. idsandvaluesmust have the same length.
NOTE: The ERC-1155 acceptance check is not performed in this function. See {updateWithAcceptanceCheck} instead. NOTE: Array length check is not performed in this function and must be performed in the caller

