This repo contains the codebase for the Smart contracts of our Mirai Shooter Game, the ERC20 token and the ERC721 NFTs, and the marketplace for the NFTs.
- We have four contracts that we have created in order to interact with the blockchain and apply DeFi to our project. We are using ERC20 token (MIRAI Token/MRI in our projcet) as in game currency. Also We are using ERC721 tokens to reward the winners of each day of our game.
- We are generating these ERC721 tokens/NFTs randomly using keccak algorithm. (At first we though about using Chainlink vrfCoordinator, but after several design meetings we decided not to use it as we didn't really need completely non deterministic random numbers to generate NFTs randomly).
- The NFT images are generated using OpenAI and then we have associated meta-data with the images and uploaded them to IPFS using Pinata and Filecoin.
- The Graph is being used to index the events emitted by the blockchain contracts into an off-chain database.
- Run command:
git clone https://github.com/Mirai-Research-Lab/mirai-contracts.git
- Run command:
cd mirai-contracts
- Run command:
yarn
- To run a local node run:
yarn hardhat node
- For running the tests:
yarn hardhat test --network localhost
- To mint a NFT run:
yarn hardhat run ./scripts/mint-nft.js --network localhost
- To mint a NFT and list it on the marketplace run:
yarn hardhat run ./scripts/mint-and-list-nft.js --network localhost
- Mirai (MRI) ERC20 Token with a total supply of 1,000,000 tokens.
- Total 32 unique NFTs with 7 attributes - rarity, grade, efficiency, fire_rate, mobility, capacity, strength.
- NFTs can be listed and bought on the marketplace.
- The game contract is responsible for the game logic and the game state.