- Player can connect to the mini game using Metamask on Rinkeby Network
- Players can choose Valorant Heroes and mint them as an NFT
- Use the minted Hero NFT to battle against Thanos in the dapp
- Battling against Thanos changes the HP (On-Chain Metadata) of Hero NFT
backend/contracts
⏩ Smart Contract Code [Deployed @ Rinkeby Test Network]frontend
⏩ Project's React frontend.backend/test
⏩ Tests for Smart Contracts.
git clone https://github.com/ShivaShanmuganathan/diamond-nft-game.git
cd frontend
npm install
Install Dependenciesnpm start
Start the frontend in localhost- Open
http://localhost:3000
We can use the localhost frontend to interact with the smart contract on rinkeby
cd backend
npm install
Install Dependenciesnpx hardhat --version
Check if Hardhat is properly installednpx hardhat compile
Compile the Smart Contractnpx hardhat test
Test the Smart Contract Locallynpx hardhat run scripts/deploy.js
Deploy the Smart Contract Locally
- open
hardhat.config.js
file and uncomment the below lines
// rinkeby: {
// url: process.env.STAGING_ALCHEMY_KEY,
// accounts: [process.env.PRIVATE_KEY],
// }, - change filename
.env.example
to.env
- Get Alchemy Key for Rinkeby Network from Alchemy, and assign it to
STAGING_ALCHEMY_KEY
in.env
- Get
PRIVATE_KEY
from MetaMask, and assign it toPRIVATE_KEY
in.env
- RUN
npx hardhat run scripts/deploy.js --network rinkeby
to deploy your contract to the Rinkeby Network.
STAGING_ALCHEMY_KEY=
PRIVATE_KEY=
- Open
scripts/deploy.js
inbackend
folder - This is the code you need to edit to make your own heroes
const gameContract = await gameContractFactory.deploy( ["Raze", "Phoenix", "Sage"], ["QmYGgUYWA8pNrjYopSD5yf4cVGNUibWSvg3hgC3RitF2qB", "QmPWXBPUEoPkMX3fQtQY1Jwjkmn4p9qVdcMQvhy42wkqMD", "QmbsoshH2rPYgEdSJZWHQBkHn9YSDSZVsKALgmVHSDK7LM"], [100, 200, 400], [100, 50, 25], "Thanos: The Mad Titan", "https://i.pinimg.com/564x/8a/b9/0e/8ab90eff3e1830f20dfa7990fa905afb.jpg", 10000, 50 );
- Change
["Raze", "Phoenix", "Sage"]
to the character names you want - Upload images you want to IPFS using Pinata and get the CID of the uploaded images
- Change
["QmYGgUYWA8pNrjYopSD5yf4cVGNUibWSvg3hgC3RitF2qB", "QmPWXBPUEoPkMX3fQtQY1Jwjkmn4p9qVdcMQvhy42wkqMD", "QmbsoshH2rPYgEdSJZWHQBkHn9YSDSZVsKALgmVHSDK7LM"]
to the CID of the images uploaded to IPFS - Change
[100, 200, 400]
to the maxHealth you want for the Heroes - Change
[100, 50, 25]
to the attackDamage you want for the Heroes - Change
Thanos: The Mad Titan
to the name of your Boss - Change
https://i.pinimg.com/564x/8a/b9/0e/8ab90eff3e1830f20dfa7990fa905afb.jpg
to the image url of your Boss - Change
10000
to edit the Boss Health - Change
50
to edit the Boss Attack Damage
0x9989fEc3F6aa8D9Bf7d215FB50F67812BBfb80dd
0xadf2228d5bb78f8257d2480af7bff70d0cb9e6a0