0
0
Blockchain / Solidityprogramming~30 mins

ERC-1155 multi-token standard in Blockchain / Solidity - Mini Project: Build & Apply

Choose your learning style9 modes available
ERC-1155 Multi-Token Standard Basic Contract
📖 Scenario: You are creating a simple blockchain contract to manage multiple types of tokens in one place. This is useful for games or collectibles where you want to handle many items efficiently.
🎯 Goal: Build a basic ERC-1155 contract that can hold different token types and allow minting new tokens.
📋 What You'll Learn
Create a contract named MyMultiToken that inherits from ERC1155
Set the base URI to https://token-cdn-domain/{id}.json
Create a public function mint that allows minting a specific amount of a token ID to an address
Use the _mint function from ERC1155 inside mint
Print the token URI for a given token ID
💡 Why This Matters
🌍 Real World
ERC-1155 contracts are used in blockchain games and digital collectibles to manage many token types efficiently in one contract.
💼 Career
Understanding ERC-1155 is important for blockchain developers working on NFTs, gaming, and multi-token platforms.
Progress0 / 4 steps
1
Set up the ERC-1155 contract
Write a Solidity contract named MyMultiToken that inherits from ERC1155. Set the constructor to call ERC1155 with the URI "https://token-cdn-domain/{id}.json".
Blockchain / Solidity
Need a hint?

Use contract MyMultiToken is ERC1155 and call the parent constructor with the URI.

2
Add a mint function
Add a public function named mint that takes address to, uint256 id, and uint256 amount as parameters. Inside it, call _mint(to, id, amount, "").
Blockchain / Solidity
Need a hint?

Create a mint function that calls _mint with the given parameters and empty data.

3
Add a function to get token URI
Add a public view function named getTokenURI that takes uint256 id and returns a string memory. Inside, return the result of uri(id).
Blockchain / Solidity
Need a hint?

Use the inherited uri function to get the token URI for the given id.

4
Test minting and getting token URI
Write a comment showing how to call mint to mint 10 tokens of ID 1 to address 0x123.... Then write a comment showing how to call getTokenURI for token ID 1.
Blockchain / Solidity
Need a hint?

Show example calls as comments with the exact address and token ID.