Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERC-1155 example #18

Draft
wants to merge 5 commits into
base: complete
Choose a base branch
from
Draft

Conversation

kaihirota
Copy link

@kaihirota kaihirota commented Oct 17, 2024

The sample game in this branch uses three collections / contracts:

  1. ERC-721 Immutable Runner Fox collection: Fox NFT minted to players when they log in. Assuming this has no intrinsic value, this collection can be moved to ERC-1155.
  2. ERC-20 Immutable Runner Token contract: Coins collected in-game are minted to the player. When a player has 3 or more coins, they can invoke craftSkin() contract function, which burns 3 of the caller's coins, and then mint a new skin in return from the collection below.
  3. ERC-721 Immutable Runner Fox Skin: The above ERC-20 contract is the minterRole of this contract. When craftSkin() is called on the ERC-20 contract above, that contract will call the mint function on this contract.

In this branch, 1 and 2 above have been replaced by a single ERC-1155 contract. TokenID=1 in this collection is equivalent to "ERC-721 Immutable Runner Fox collection", and tokenID=2 is equivalent to "ERC-20 Immutable Runner Token". The RunnerToken1155 Solidity contract has two constants (FOXTOKENID, COINTOKENID) which are used in the mintNFT and mintCoins functions.

@kaihirota kaihirota self-assigned this Oct 17, 2024
@kaihirota kaihirota force-pushed the CORE-2329-zkevm-migration-ERC-1155 branch from 7980fa8 to 9bf944c Compare October 20, 2024 23:21
@kaihirota kaihirota changed the base branch from CORE-2329-zkevm-migration to complete October 20, 2024 23:24
@kaihirota kaihirota changed the base branch from complete to CORE-2329-zkevm-migration October 20, 2024 23:24
@kaihirota kaihirota changed the base branch from CORE-2329-zkevm-migration to complete October 21, 2024 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant