RandomizerRNG
Inherits: RNG
State Variables
governor
address public governor;
callbackGasLimit
uint256 public callbackGasLimit = 50000;
randomizer
IRandomizer public randomizer;
randomNumbers
mapping(uint256 => uint256) public randomNumbers;
requesterToID
mapping(address => uint256) public requesterToID;
Functions
onlyByGovernor
modifier onlyByGovernor();
constructor
Constructor.
constructor(IRandomizer _randomizer, address _governor);
Parameters
| Name | Type | Description | 
|---|---|---|
| _randomizer | IRandomizer | Randomizer contract. | 
| _governor | address | Governor of the contract. | 
changeGovernor
Changes the governor of the contract.
function changeGovernor(address _governor) external onlyByGovernor;
Parameters
| Name | Type | Description | 
|---|---|---|
| _governor | address | The new governor. | 
setCallbackGasLimit
Change the Randomizer callback gas limit.
function setCallbackGasLimit(uint256 _callbackGasLimit) external onlyByGovernor;
Parameters
| Name | Type | Description | 
|---|---|---|
| _callbackGasLimit | uint256 | the new limit. | 
setRandomizer
Change the Randomizer address.
function setRandomizer(address _randomizer) external onlyByGovernor;
Parameters
| Name | Type | Description | 
|---|---|---|
| _randomizer | address | the new Randomizer address. | 
randomizerWithdraw
Allows the governor to withdraw randomizer funds.
function randomizerWithdraw(uint256 _amount) external onlyByGovernor;
Parameters
| Name | Type | Description | 
|---|---|---|
| _amount | uint256 | Amount to withdraw in wei. | 
requestRandomness
Request a random number. The id of the request is tied to the sender.
function requestRandomness(uint256) external override;
randomizerCallback
Callback function called by the randomizer contract when the random value is generated.
function randomizerCallback(uint256 _id, bytes32 _value) external;
receiveRandomness
Return the random number.
function receiveRandomness(uint256) external view override returns (uint256 randomNumber);
Returns
| Name | Type | Description | 
|---|---|---|
| randomNumber | uint256 | The random number or 0 if it is not ready or has not been requested. |