BasicRandcastConsumerBase
BasicRandcastConsumerBase contract provides:
A set of virtual callback functions that the consumer contract can override. These functions are called by the Adapter contract when the randomness request is fulfilled. The consumer contract can override the below functions to implement the subsequent logic on how to utilize the randomness results in their DApp or Web3 game, specifically:
override
_fulfillRandomnessfor requestingRandomnessoverride
_fulfillRandomWordsfor requestingRandomWordsoverride
_fulfillShuffledArrayfor requestingShuffling
A nonce recorder keeps track of the number of random requests that the consumer contract has initiated through a specific subscription. This can be useful for debugging. Please do not try to control the nonce as it will not affect the behavior of the Adapter, i.e., randomness result.
A _rawRequestRandomnessfunction to call the Adapter contract to request randomness. The consumer contract can define its own interface to request randomness, where this function should be called. The user can set:subIdto specify which subscription to use.seedto specify the seed of the randomness (this won't decide the randomness result but will help prevent other parties from maliciously predicting it).requestConfirmationsto specify the number of blocks required between the randomness request and the randomness fulfillment.callbackGasLimitto specify the gas limit you want for the callback function.callbackMaxGasPriceto specify the maximum amount of gas you are willing to spend on the callback request.
Note: To learn more about the implementation, please refer to the complete source code of the smart contract.
Last updated