RandomBase
contract RandomBase
is OwnedEternalStorage, IRandom
The base contract for the RandomAuRa and RandomHBBFT contracts.
Index
Reference
Modifiers
onlyInitialized
modifier onlyInitialized()
Ensures the `initialize` function was called before.
onlyValidatorSetContract
modifier onlyValidatorSetContract()
Ensures the caller is the ValidatorSet contract address (EternalStorageProxy proxy contract for ValidatorSet).
Functions
_getCurrentSeed
function _getCurrentSeed() internal view returns (uint256)
Reads the current random seed from the state.
- Returns:
- uint256
_initialize
function _initialize(address _validatorSet) internal
Initializes the network parameters. Used by the `initialize` function of a child contract.
- Parameters:
_validatorSet
- The address of the `ValidatorSet` contract.
_setCurrentSeed
function _setCurrentSeed(uint256 _seed) internal
Updates the current random seed.
- Parameters:
_seed
- A new random seed.
getCurrentSeed
function getCurrentSeed() external view returns (uint256)
Returns the current random seed accumulated during RANDAO or another process (depending on implementation). This getter can only be called by the `ValidatorSet` contract.
- Modifiers:
- onlyValidatorSetContract
- Returns:
- uint256
isInitialized
function isInitialized() public view returns (bool)
Returns a boolean flag indicating if the `initialize` function has been called.
- Returns:
- bool
validatorSetContract
function validatorSetContract() public view returns (IValidatorSet)
Returns the address of the `ValidatorSet` contract.
- Returns:
- IValidatorSet