ValidatorService
This contract handles all validator operations including registration, node management, validator-specific delegation parameters, and more.
For more information see our main instructions SKALE MainNet Launch FAQ. |
Validators register an address, and use this address to accept delegations and register nodes.
onlyValidatorManager onlyValidatorManager()
modifier
checkValidatorExists checkValidatorExists(uint256 validatorId)
modifier
registerValidator registerValidator(string name, string description, uint256 feeRate, uint256 minimumDelegationAmount) → uint256 validatorId
external
Creates a new validator ID that includes a validator name, description, commission or fee rate, and a minimum delegation amount accepted by the validator.
Emits a ValidatorRegistered
event.
Requirements:
-
Sender must not already have registered a validator ID.
-
Fee rate must be between 0 - 1000‰. Note: in per mille.
enableValidator enableValidator(uint256 validatorId)
external
Allows Admin to enable a validator by adding their ID to the trusted list.
Emits a ValidatorWasEnabled
event.
Requirements:
-
Validator must not already be enabled.
disableValidator disableValidator(uint256 validatorId)
external
Allows Admin to disable a validator by removing their ID from the trusted list.
Emits a ValidatorWasDisabled
event.
Requirements:
-
Validator must not already be disabled.
disableWhitelist disableWhitelist()
external
Owner can disable the trusted validator list. Once turned off, the trusted list cannot be re-enabled.
requestForNewAddress requestForNewAddress(address newValidatorAddress)
external
Allows msg.sender
to request a new address.
Requirements:
-
msg.sender
must already be a validator. -
New address must not be null.
-
New address must not be already registered as a validator.
confirmNewAddress confirmNewAddress(uint256 validatorId)
external
Allows msg.sender to confirm an address change.
Emits a ValidatorAddressChanged
event.
Requirements:
-
Must be owner of new address.
linkNodeAddress linkNodeAddress(address nodeAddress, bytes sig)
external
Links a node address to validator ID. Validator must present the node signature of the validator ID.
Requirements:
-
Signature must be valid.
-
Address must not be assigned to a validator.
unlinkNodeAddress unlinkNodeAddress(address nodeAddress)
external
Unlinks a node address from a validator.
Emits a NodeAddressWasRemoved
event.
setValidatorMDA setValidatorMDA(uint256 minimumDelegationAmount)
external
Allows a validator to set a minimum delegation amount.
setValidatorName setValidatorName(string newName)
external
Allows a validator to set a new validator name.
setValidatorDescription setValidatorDescription(string newDescription)
external
Allows a validator to set a new validator description.
startAcceptingNewRequests startAcceptingNewRequests()
external
Allows a validator to start accepting new delegation requests.
Requirements:
-
Must not have already enabled accepting new requests.
stopAcceptingNewRequests stopAcceptingNewRequests()
external
Allows a validator to stop accepting new delegation requests.
Requirements:
-
Must not have already stopped accepting new requests.
removeNodeAddress removeNodeAddress(uint256 validatorId, address nodeAddress)
external
getAndUpdateBondAmount getAndUpdateBondAmount(uint256 validatorId) → uint256
external
Returns the amount of validator bond (self-delegation).
getMyNodesAddresses getMyNodesAddresses() → address[]
external
Returns node addresses linked to the msg.sender.
getTrustedValidators getTrustedValidators() → uint256[]
external
Returns the list of trusted validators.
checkValidatorAddressToId checkValidatorAddressToId(address validatorAddress, uint256 validatorId) → bool
external
Checks whether the validator ID is linked to the validator address.
getValidatorIdByNodeAddress getValidatorIdByNodeAddress(address nodeAddress) → uint256 validatorId
external
Returns the validator ID linked to a node address.
Requirements:
-
Node address must be linked to a validator.
checkValidatorCanReceiveDelegation checkValidatorCanReceiveDelegation(uint256 validatorId, uint256 amount)
external
initialize initialize(address contractManagerAddress)
public
getNodeAddresses getNodeAddresses(uint256 validatorId) → address[]
public
Returns a validator’s node addresses.
validatorExists validatorExists(uint256 validatorId) → bool
public
Checks whether validator ID exists.
validatorAddressExists validatorAddressExists(address validatorAddress) → bool
public
Checks whether validator address exists.
checkIfValidatorAddressExists checkIfValidatorAddressExists(address validatorAddress)
public
Checks whether validator address exists.
getValidator getValidator(uint256 validatorId) → struct ValidatorService.Validator
public
Returns the Validator struct.
getValidatorId getValidatorId(address validatorAddress) → uint256
public
Returns the validator ID for the given validator address.
isAcceptingNewRequests isAcceptingNewRequests(uint256 validatorId) → bool
public
Checks whether the validator is currently accepting new delegation requests.
isAuthorizedValidator isAuthorizedValidator(uint256 validatorId) → bool
public
ValidatorRegistered ValidatorRegistered(uint256 validatorId)
event
Emitted when a validator registers.
ValidatorAddressChanged ValidatorAddressChanged(uint256 validatorId, address newAddress)
event
Emitted when a validator address changes.
ValidatorWasEnabled ValidatorWasEnabled(uint256 validatorId)
event
Emitted when a validator is enabled.
ValidatorWasDisabled ValidatorWasDisabled(uint256 validatorId)
event
Emitted when a validator is disabled.
NodeAddressWasAdded NodeAddressWasAdded(uint256 validatorId, address nodeAddress)
event
Emitted when a node address is linked to a validator.
NodeAddressWasRemoved NodeAddressWasRemoved(uint256 validatorId, address nodeAddress)
event
Emitted when a node address is unlinked from a validator.