Validators Registry
The Validator Registry contract stores an approved validators whitelist.
The main query of the contract - GetValidatorsForDelegation
returns a list of approved validators sorted by total_delegated amount.
The Hub uses this query to equally distribute delegations between validators.
#
ConfigKey | Type | Description |
---|---|---|
owner | CanonicalAddr | Owner of the contract |
hub_contract | CanonicalAddr | Contract address of Hub |
{ "owner": "terra1...", "hub_contract": "terra1..."}
#
ValidatorKey | Type | Description |
---|---|---|
total_delegated | Uint128 | Total amount of tokens delegated to this validator from the Hub address |
address | String | Operator address |
{ "total_delegated": "10000", "address": "terravaloper1..."}
#
InitMsgpub struct InstantiateMsg { pub registry: Vec<Validator>, pub hub_contract: String,}
{ "registry": [ { "address": "terravaloper1..." }, { "address": "terravaloper1..." } ], "hub_contract": "terra1..."}
Key | Type | Description |
---|---|---|
hub_contract | CanonicalAddr | Contract address of Hub |
registry | Vec<Validator> | List of whitelisted validators |
#
ExecuteMsgAddValidator
#
Adds a validator to the registry.
Can only be executed by the owner.
pub enum ExecuteMsg { AddValidator { validator: Validator },}
{ "add_validator": { "validator": { "address": "terravaloper1..." } }}
Key | Type | Description |
---|---|---|
validator | Validator | Validator to add to the registry |
RemoveValidator
#
Removes a validator from the registry.
Can only be executed by the owner.
pub enum ExecuteMsg { RemoveValidator { address: String },}
{ "remove_validator": { "address": "terravaloper1..." }}
Key | Type | Description |
---|---|---|
address | Validator | Address of a to remove from the registry |
UpdateConfig
#
Updates a registry's configuration.
Can only be issued by the owner.
pub enum ExecuteMsg { UpdateConfig { owner: Option<String>, hub_contract: Option<String>, },}
{ "owner": "terra1...", "hub_contract": "terra1..."}
Key | Type | Description |
---|---|---|
owner * | CanonicalAddr | New owner of the contract |
hub_contract * | CanonicalAddr | New contract address of Hub |
* = optional
#
QueryMsgGetValidatorsForDelegation
#
Returns validators sorted by total_delegated amount.
pub enum QueryMsg { GetValidatorsForDelegation {},}
{ "get_validators_for_delegation": {}}
Returns a list of Validator
:
[ { "total_delegated": "30000", "address": "terravaloper1..." }, { "total_delegated": "20000", "address": "terravaloper1..." }, { "total_delegated": "10000", "address": "terravaloper1..." }]
Config
#
Returns the current configuration of the registry.
pub enum QueryMsg { Config {},}
{ "config": {}}
Returns a Config
struct.