ODCdataManagersERC1155linked-with-erc20-dm

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.

 Deployment process:
 1. Allocate DataPoint via IDataPointRegistry.allocate()
 2. Deploy ERC1155WithERC20FractionsDataManager (or an extending contract)
 3. Grant Admin role on the DataPoint to the deployed contract_

IncorrectId

error IncorrectId(uint256 id)

Error thrown when the ERC1155 token ID is zero

BatchOperationNotSupported

error BatchOperationNotSupported()

Error thrown when the Batch mint or burn is called

ERC20FractionDataManagerDeployed

event ERC20FractionDataManagerDeployed(uint256 id, address dm)

Event emitted when a ERC20FractionDataManager contract is deployed

fractionManagersById

mapping(uint256 => address) fractionManagersById

Mapping of ERC20FractionDataManager contract address by token ID

fractionManagersByAddress

mapping(address => uint256) fractionManagersByAddress

Mapping of token ID by ERC20FractionDataManager contract address

constructor

constructor(bytes32 _dp, address _dataIndex, address _fungibleFractionsDO, address erc20FractionsDMFactory_, string name_, string symbol_) public

Set up the ERC1155 Data Manager

mint

function mint(address to, uint256 id, uint256 value, bytes data) public virtual

Mint new tokens

Parameters

NameTypeDescription
toaddressThe address to mint tokens to
iduint256The token ID
valueuint256The amount of tokens to mint
databytesAdditional data with no specified format

burn

function burn(address from, uint256 id, uint256 value) public virtual

Burn tokens

Parameters

NameTypeDescription
fromaddressThe address to burn tokens from
iduint256The token ID
valueuint256The amount of tokens to burn

batchMint

function batchMint(address, uint256[], uint256[], bytes) public pure

Batch mint not supported

batchBurn

function batchBurn(address, uint256[], uint256[]) public pure

Batch burn not supported

fractionTransferredNotify

function fractionTransferredNotify(address from, address to, uint256 value) external

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

NameTypeDescription
fromaddressThe address to transfer tokens from
toaddressThe address to transfer tokens to
valueuint256The amount of tokens to transfer

_mint

function _mint(address to, uint256 id, uint256 value, bytes data) internal virtual

_burn

function _burn(address from, uint256 id, uint256 value) internal virtual

_update

function _update(address from, address to, uint256 id, uint256 value) internal

_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 and values must have the same length.

NOTE: The ERC-1155 acceptance check is not performed in this function. See {updateWithAcceptanceCheck} instead.

_update

function _update(address from, address to, uint256[] ids, uint256[] values) internal

_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 and values 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

_deployERC20DMIfNotDeployed

function _deployERC20DMIfNotDeployed(uint256 id) internal

_afterDeployERC20DM

function _afterDeployERC20DM(address deployedDM) internal virtual

On this page