RandomizerRNG
Inherits: RNG
State Variables
CALLBACK_GAS_LIMIT
uint256 public constant CALLBACK_GAS_LIMIT = 50000;
governor
address public governor;
randomizer
IRandomizer public randomizer;
randomNumbers
mapping(uint128 => uint256) public randomNumbers;
requesterToID
mapping(address => uint128) 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. |
requestRandomness
Request a random number. The id of the request is tied to the sender.
function requestRandomness(uint256) external override;
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. |
randomizerCallback
Callback function called by the randomizer contract when the random value is generated.
function randomizerCallback(uint128 _id, bytes32 _value) external;
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. |