ERC1155WithERC20FractionsWithCallbackDataManager
Contract for managing ERC1155 token with ERC20 fractions with Callback
This contract extends ERC1155DataManager and adds integration for ERC20 fractions with Callback, setting this contract as the callback handler for all the ids. The deployed ERC20FractionWithCallbackDataManagers are set as the callback handlers for they respective token IDs
IncorrectId
Error thrown when the ID is zero
WrongCaller
Error thrown when the caller is not the fungible fractions data object
BatchOperationNotSupported
Error thrown when the Batch mint is called
ERC20FractionDataManagerDeployed
Event emitted when an ERC20 Fraction Data Manager is deployed
AllIdFungibleFractionTransferCallbackRegistered
Event emitted when all ID fungible fraction transfer callback is registered
AllIdFungibleFractionTransferCallbackUnregistered
Event emitted when all ID fungible fraction transfer callback is unregistered
fractionManagersById
Mapping of ERC20 Fraction Data Managers by ID
onlyFFDO
Modifier to check if the caller is the fungible fractions data object
constructor
registerAllIdFungibleFractionTransferCallback
Register transfer callback for all IDs
This function must be called right after the constructor. Otherwise, afterFungibleFractionTransfer will not be called for any transfer. NOTE: If data manager is not approved, this function will revert
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 |
batchMint
Batch mint not supported
afterFungibleFractionTransfer
Function to be called after a fungible fraction transfer
afterFungibleFractionTransfer
Function to be called after a fungible fraction transfer batch
_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
to
refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. ids
andvalues
must 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
to
refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. ids
andvalues
must 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