Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
ChainlinkVRFConsumer
copy icon
DirtyCajunRice
• version 1.0.0
Utility
VRF
Chainlink
Upgradeable
Inheritable

ChainlinkVRFConsumer

Upgradeable Chainlink VRF consumer inheritable

*Visit desktop site to download or deploy

Version

1.0.0

Last Publish

12/12/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
__ChainlinkVRFConsumer_init(address,bytes32,uint64,uint16) :
This function is used to initialize the ChainlinkVRFConsumer contract. It sets the coordinator address, keyHash, subscriptionId, and confirmations. It also calls the __VRFConsumerBaseV2_init function to set the coordinator address. (autogenerated documentation)
__ChainlinkVRFConsumer_init_unchained(address,bytes32,uint64,uint16) :
This function is used to initialize the ChainlinkVRFConsumer contract. It sets the coordinator address, the keyHash, the subscriptionId, and the number of confirmations required for a request to be considered valid. The coordinator address is used to interact with the VRFCoordinatorV2Interface contract, which is responsible for managing the requests and responses for the VRF requests. The keyHash is used to identify the requestor and the subscriptionId is used to track the request. The confirmations parameter is used to set the number of confirmations required for a request to be considered valid. (autogenerated documentation)
requestRandomWords(uint32) :
This function requests a set of random words from the Coordinator contract. It takes in a count parameter which specifies the number of words to be requested. The function then calculates the gas limit required for the request, which is based on the number of words requested, and calls the Coordinator contract's requestRandomWords() function, passing in the keyHash, subscriptionId, confirmations, and gasLimit. The function then returns the requestId of the request. (autogenerated documentation)
fulfillRandomWords(uint256,uint256[]) :
This function takes in a requestId, an array of random words, and two additional parameters (modulus and chunkCount). It then splits each word in the array into chunks of size modulus and stores the chunks in a new array. The function returns the new array of chunks. (autogenerated documentation)
chunkWord(uint256,uint256,uint256) :
This function takes in a uint256 word, a uint256 modulus, and a uint256 chunkCount and returns an array of uint256 chunks. It works by taking the word and dividing it by the modulus, storing the remainder in the array, and then repeating the process with the quotient until the chunkCount is reached. The array of chunks is then returned. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i ChainlinkVRFConsumer
copy icon

Last Publish

12/12/2022

Version

1.0.0

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.