
backend/contracts ⏩ Smart Contract Code [Deployed @ Mumbai Test Network]frontend ⏩ Project's React frontend.backend/test ⏩ Tests for Smart Contracts.A standard for organizing and upgrading a modular smart contract system. Multi-Facet Proxies for full control over your upgrades.
Diamonds are a proxy pattern for Solidity development that allows a single gateway contract to proxy calls and storage to any number of other contracts. This provides a single interface for anyone to use your contracts, while allowing your feature set to grow into many contracts. The Diamond Standard also allows for replacing or extending functionality after your contracts are deployed.
git clone https://github.com/ShivaShanmuganathan/diamond-dapp
cd frontendyarn install Install Dependenciesyarn start Start the frontend in localhost http://localhost:3000 We can use the localhost frontend to interact with the smart contract on Mumbai Network
cd backendnpm install Install Dependenciesnpx hardhat --version Check if Hardhat is properly installed npx hardhat compile Compile the Smart Contractnpx hardhat test Test the Smart Contract Locallynpx hardhat run scripts/deploy.js Deploy the Smart Contract Locally.env.example to .envSTAGING_ALCHEMY_KEY in .envPRIVATE_KEY of your wallet from MetaMask, and assign it to PRIVATE_KEY in .envnpx hardhat run scripts/deploy.js --network mumbai to deploy Diamond Contract, DiamondCutFacet, DiamondInit, DiamondLoupeFacet, and OwnershipFacet to the Mumbai Network. npx hardhat run scripts/deploy2.js --network mumbai to deploy dynamicGameFacet Contract to the Mumbai Network, and add it to the Diamond Contract. npx hardhat run scripts/deploy3.js --network mumbai to deploy nftReceiverFacet Contract to the Mumbai Network, and add it to the Diamond Contract. npx hardhat run scripts/deploy4.js --network mumbai to deploy StakeNFTFacet Contract to the Mumbai Network, and add it to the Diamond Contract. npx hardhat run scripts/deploy5.js --network mumbai to deploy StakeNFTFacet Contract to the Mumbai Network, and add it to the Diamond Contract. scripts/deploy.js in backend folderlet functionCall = diamondInit.interface.encodeFunctionData('init', [["Jett", "Phoenix", "Neon", "Raze", "Reyna", "Yoru", "Breach", "KAY/O", "Skye", "Sova", "Astra", "Brimstone", "Omen", "Viper", "Cypher", "Sage"],
[
"https://gateway.pinata.cloud/ipfs/QmXDEW26MnmgkdijbQtTQSnQZ7DWfMFqJYzruU3mGnp64w",
"https://gateway.pinata.cloud/ipfs/QmWbkhC6AunE9ZZMwJbTbrHTPYFPCbY9uDFtLsSbr5zYt2",
"https://gateway.pinata.cloud/ipfs/Qmc659ijRouVQEycT5rEwCo73j1QuaFLH1FMSTbDpTPueX",
"https://gateway.pinata.cloud/ipfs/QmUpzvz2hC9gBYs5Tr1N3GqqiL9PstSkVR1cxmNKjC1FrU",
"https://gateway.pinata.cloud/ipfs/QmWuzkZo4JLBvTo14LLCY7nP5oViifJt4oU5rpcd5QhHFH",
"https://gateway.pinata.cloud/ipfs/QmUWYfyJDjMm65WGCNsrXqZdUGAA4Szt7A3wFaNZirfMqn",
"https://gateway.pinata.cloud/ipfs/QmNwfv6rUgW3PCKnNo3uxLuy8r3hU9sGEd5TgoyQDLitTf",
"https://gateway.pinata.cloud/ipfs/QmS6v2Gz22QSasUCmHg6gaMsUaWT2AvHVpKA4vefMf16u7",
"https://gateway.pinata.cloud/ipfs/QmZqr3hj8RPeFeP6DGKi25KBTzTW5h4VWD2f6q94pXrJiA",
"https://gateway.pinata.cloud/ipfs/QmPpbjrWbejguWRNP9qwgoPf6VYYfV4SUsZ51vvVMPbyTE",
"https://gateway.pinata.cloud/ipfs/QmXHk7GYn7bgLRCig6zTEXpDvA5T8jTKqhXnyiiHEL5G8b",
"https://gateway.pinata.cloud/ipfs/QmXrW7CdHC9UjJTAWuNU4vRAk7QdbjyHjewy3SGTD9DWms",
"https://gateway.pinata.cloud/ipfs/QmP1R6xYmm77KdT8ZxUyixdA8uwCEHpmgDRBYCVSHMGc36",
"https://gateway.pinata.cloud/ipfs/QmX3hV9q5k5B7mwsyj8g6q8qw8HPdkYTKuws6e73L997xQ",
"https://gateway.pinata.cloud/ipfs/QmPFbj4Ufx69zf241qJ5U4Qexqc8hx4PG5Uo5ucyuNW61X",
"https://gateway.pinata.cloud/ipfs/QmePF9pBnjdfajbT3i4peVoNqijaQCNYeLQXj76P7JoFXr"
],
[1000, 1250, 1100, 1400, 1500, 1450, 1700, 1800, 1950, 2000, 2100, 2500, 2400, 3000, 3500, 4000],
[45, 30, 35, 25, 15, 20, 60, 55, 50, 45, 80, 75, 70, 65, 100, 90],
["Duelists", "Duelists", "Duelists", "Duelists", "Duelists", "Duelists", "Initiators", "Initiators", "Initiators", "Initiators", "Controllers", "Controllers", "Controllers", "Controllers", "Sentinels", "Sentinels"],
"THANOS",
"https://raw.githubusercontent.com/ShivaShanmuganathan/diamond-nft-game/main/Thanos.webp",
100000,
150]);
- Change ["Jett", "Phoenix", "Neon", ...] to the character names you want
- Upload images you want to IPFS using Pinata and get the CID of the uploaded images
- Change
["https://gateway.pinata.cloud/ipfs/QmXDEW26MnmgkdijbQtTQSnQZ7DWfMFqJYzruU3mGnp64w",
"https://gateway.pinata.cloud/ipfs/QmWbkhC6AunE9ZZMwJbTbrHTPYFPCbY9uDFtLsSbr5zYt2",
"https://gateway.pinata.cloud/ipfs/Qmc659ijRouVQEycT5rEwCo73j1QuaFLH1FMSTbDpTPueX",
...] to the CID of the images uploaded to IPFS
- Change [1000, 1250, 1100, ...] to the maxHealth you want for the Heroes
- Change [45, 30, 35, ...] to the attackDamage you want for the Heroes
- Change THANOS to the name of your Boss
- Change https://raw.githubusercontent.com/ShivaShanmuganathan/diamond-nft-game/main/Thanos.webp" to the image url of your Boss
- Change 100000 to edit the Boss Health
- Change 150 to edit the Boss Attack Damage
🚀 0x791B0E7e61B094Eb6B7695d9ABc659F391071c43 🛸
backend/contracts
├── Diamond.sol
├── facets
│ ├── DiamondCutFacet.sol
│ ├── DiamondLoupeFacet.sol
│ ├── DynamicGameFacet.sol
│ ├── NFTReceiverFacet.sol
│ ├── OwnershipFacet.sol
│ ├── RentalNFTFacet.sol
│ └── StakeNFTFacet.sol
├── interfaces
│ ├── IDiamondCut.sol
│ ├── IDiamondLoupe.sol
│ ├── IERC165.sol
│ ├── IERC173.sol
│ └── IERC721.sol
├── libraries
│ ├── Base64.sol
│ ├── LibAppStorage.sol
│ ├── LibDiamond.sol
│ ├── LibERC721.sol
│ ├── LibMeta.sol
│ ├── LibRentalStorage.sol
│ └── LibStakeStorage.sol
├── tokens
│ └── ERC721Diamond.sol
└── upgradeInitializers
└── DiamondInit.sol
💎 DiamondCutFacet deployed 🎯 0xd76553C411ed3b0a4792cEB04b71aEa5bE99eC15 🎯
💎 DiamondInit deployed 🌠 0xd7842705839fF83570836705a4DDa434b821C944 🌠
💎 DiamondLoupeFacet deployed 🔍 0xA794afc756a9115D3f7896977BB7B6b1164B3273 🔍
💎 OwnershipFacet deployed 🏡 0xBB417f5335c149061cA18991eD51F0578c9cDB33 🏡
💎 dynamicGameFacet deployed 🎮 0xf1FeF4915c6D2a73144a6f95239B971197DEAD9e 🎮
💎 nftReceiverFacet deployed 🛄 0x44243fC912be0827FD9A3e532F65e3450d15E513 🛄
💎 stakeNFTFacet deployed 🥩 0xC16919F426f58dB947234Acb20C454C06053FB4B 🥩
💎 rentalNFTFacet deployed 🛍 0xf53eAcceC787f532f5f25b778bde3910D5B8DA92 🛍
$ claude mcp add Diamond-NFT-Mini-Game \
-- python -m otcore.mcp_server <graph>