IValidator
This is the interface for the validator contract. You'll find all the events and external functions.
Functions
addValidators
Adds new validators. This function can only be called by the owner of validator contract. Note that this reverts if new validators to add are already validators.
function addValidators(address[] calldata validators) external;
Parameters
Name | Type | Description |
---|---|---|
validators | address[] | New validator addresses to add |
removeValidators
Removes exist validators. This function can only be called by the owner of validator contract. Note that this reverts if validators to remove are not validators.
function removeValidators(address[] calldata validators) external;
Parameters
Name | Type | Description |
---|---|---|
validators | address[] | Validator addresses to remove |
changeRequiredNumber
Change the required number of validators. Requirements::
- the caller is owner of validator contract.
- new required number > validators length.
- new required number is zero.
function changeRequiredNumber(uint256 newRequiredNumber) external;
Parameters
Name | Type | Description |
---|---|---|
newRequiredNumber | uint256 | New required number to set. |
isValidator
Returns whether an address is validator or not.
function isValidator(address addr) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
addr | address | Address to query. |
getValidators
Returns all the validators.
function getValidators() external view returns (address[] memory validators);
getRequiredNumber
Returns current required number.
function getRequiredNumber() external view returns (uint256);
checkThreshold
Checks whether the voteCount
passes the threshold.
function checkThreshold(uint256 voteCount) external view returns (bool);
Events
ValidatorAdded
Emitted when a new validator is added.
event ValidatorAdded(address indexed validator);
Parameters
Name | Type | Description |
---|---|---|
validator | address | The validator address to add. |
ValidatorRemoved
Emitted when a validator is removed.
event ValidatorRemoved(address indexed validator);
Parameters
Name | Type | Description |
---|---|---|
validator | address | The validator address to remove. |
RequirementChanged
Emitted when a new required number is set.
event RequirementChanged(uint256 indexed requirement, uint256 indexed previousRequired);
Parameters
Name | Type | Description |
---|---|---|
requirement | uint256 | The new required number to set. |
previousRequired | uint256 | The previous required number. |