ERC-1155
ERC-1155 is a token standard that enables the creation of both fungible and non-fungible tokens on a blockchain network. In the context of Furtheon, ERC-1155 tokens can be used to represent multiple instances of a single fungible or non-fungible asset on an Furtheon-powered chain.
ChildERC1155
Developers can use the ChildERC1155
token standard to create ERC-1155 tokens on an Furtheon-powered chain. To create a new ChildERC1155 token, developers can use the ChildERC1155
contract as a template and deploy it on the Furtheon-powered chain. The contract requires a name and symbol to determine the unique identity of the token.
Once created, ChildERC1155
tokens can be minted and burned on the Furtheon-powered chain through the corresponding ERC1155Predicate contract. This ensures that the supply of tokens on the rootchain and the Furtheon-powered chain remains in sync. The ERC1155Predicate
contract also allows for the transfer of tokens between the two.
Predicates
The RootERC1155Predicate
contract serves as the root token contract, while the ChildERC1155Predicate
contract serves as the child token contract. When a user wants to deposit an ERC-1155 token on the rootchain into the Furtheon-powered chain, they call the deposit function on the RootERC1155Predicate
contract with the appropriate parameters, including the token ID, sender, and receiver addresses.
Once the child contract instance is created, the RootERC1155Predicate
contract maps the root token to the child token using a mapping, allowing users to deposit and withdraw tokens between the root and Furtheon-powered chain. The ChildERC1155Predicate contract includes functions for minting and burning child tokens, which are triggered when the deposit and withdrawal functions are called.
To withdraw a child token back to the rootchain, a user calls the appropriate function on the ChildERC1155Predicate contract with the necessary parameters, including the token ID, the amount to withdraw, and the receiver address. The ChildERC1155Predicate
contract then burns the child token and emits a withdrawal event. The RootERC1155Predicate
contract listens for these events and relays them to the rootchain using the L2StateSender
contract.
Deposits and Withdrawals
Depositing and withdrawing ERC-1155 tokens between the rootchain and Furtheon-powered chain can be done using the deposit
and withdraw
functions in the RootERC1155Predicate
and ChildERC1155Predicate
contracts, respectively. The ChildERC1155Predicate
contract includes functions for minting and burning child tokens, which are triggered when the deposit and withdrawal functions are called. To withdraw a child token back to the rootchain, a user calls the appropriate function on the ChildERC1155Predicate
contract with the necessary parameters, including the token ID, the amount to withdraw, and the receiver address. The ChildERC1155Predicate
contract then burns the child token and emits a withdrawal event.