Mystery Box Example
Last updated
Last updated
This project showcases a common scenario in GameFi projects where users purchase NFT (Non-Fungible Token) boxes with the chance to claim a random NFT. In this DApp demo, users can claim the NFT box for free.
The NFT contract utilizes the Orakl VRF (Verifiable Random Function) service to generate a random number between 1 and 10, corresponding to the ID of the rewarded NFT.
The code for this project is available in . Refer to the readme.md file for detailed instructions on forking the game.
This contract complies with the ERC-721 standard for NFTs and includes additional features.
The openBox function requests a random number from the Orakl VRF service, burns the NFT, and rewards the user with the corresponding NFT.
The fulfillRandomWords function receives the random number from the Orakl VRF service and mints the corresponding NFT.
This contract follows the ERC-1155 standard for NFTs and includes access control for the mint function.
Grant the minter role to the box contract to enable it to mint the rewarded NFT.
This project demonstrates how Orakl VRF can introduce randomness into NFT rewards within GameFi ecosystems, enhancing user gaming experiences.