Marketplace: https://erc-1155-nft-marketplace.vercel.app/
Forging Contract: Link
ERC1155 Contract: Link
{ .env- Provide the following values:
ALCHEMY_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PRIVATE_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
POLYGON_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxx }
- npx hardhat compile
- npx hardhat run scripts/deploy.js --network polygon_mumbai
- npx hardhat run scripts/verify.js --network mumbai( Verify the Game Collection contract first using the verify script by providing 4. the game collection address, later verify the Forger contract: Place the forger contract address and update the constructor argument with the game collection address.
- cd client
- npm install
- add a .env file with "POLYGONSCAN_API_KEY"
- run "npm run dev"
- Go to your browser at http://localhost:3000
Based on the Deliverables, this ERC1155 contract will be implemented in the form of game items as it will be easier to visualize in this manner.
- Token 0-2 will be raw materials.
- Token 3-6 will be equipments.
Sample Images of the Output:
Integrating with metamask is fairly simple, much of the work this week will be on the front-end design. Here is what needs to be accomplished by the end:
There are three new concepts you must master:
- Creating that transactions that return instantly (such as from a view or pure function)
- Creating transactions that change the state of the blockchain and thus must be asynchronous. Dealing with an pending transactions is not trivial!
- Changing the network of metamask to the appropriate one
You will build an ERC1155 token with a front-end. Here are the requirements:
- You must have a total of 7 tokens within the collection id [0-6]
- There is no supply limit for each token
- Anyone can mint tokens [0-2], but there is a 1-minute cooldown between mints. These are free to mint except for the gas cost.
- Token 3 can be minted by burning token 0 and 1.
- Token 4 can be minted by burning token 1 and 2
- Token 5 can be minted by burning 0 and 2
- Token 6 can be minted by burning 0, 1, and 2
- Tokens [3-6] cannot be forged into other tokens
- Tokens [3-6] can be burned but you get nothing back
- You can trade any token for [0-2] by hitting the trade this button.
- The process of burning and minting is called forging in this context.
- The webapp must tell the user how much matic they have (we will use the polygon network for cost savings)
- The webapp must tell the user how much of each token they have
- Provide a link to the OpenSea page somewhere
- Important if the website detects someone is not on the polygon network, it must prompt them to change and autofill the feeds for changing the network (lesson on this later)
- Important please use some styling on this website to make it look nice (bootstrap, tailwind CSS, etc). This is something you can show to future employers or business partners.
- You must use 2 separate contracts. One for the ERC1155 token, and one for the forging logic. The forging logic will need mint privileges.