Mystery Box Example
Code repository
NFT Box Contract
Opening a Box
function openBox(uint256 _tokenId) public {
_requireOwned(_tokenId);
uint256 requestId = requestRandomWords();
requestIdToPlayer[requestId] = msg.sender;
_burn(_tokenId);
}Handling Random Number
NFT Contract
Single Mint
Batch Mint
Note
Last updated