Mystery Box Example
Last updated
function fulfillRandomWords(
uint256 requestId,
uint256[] memory randomWords
) internal override {
uint id = randomWords[0] % 10;
address player = requestIdToPlayer[requestId];
delete requestIdToPlayer[requestId];
NFT.mint(player, id, 1, "0x");
}function mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) public onlyRole(MINTER_ROLE) {
_mint(account, id, amount, data);
}function mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public onlyRole(MINTER_ROLE) {
_mintBatch(to, ids, amounts, data);
}