Skip to main content

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.

Config#

KeyTypeDescription
ownerCanonicalAddrOwner of the contract
hub_contractCanonicalAddrContract address of Hub
{  "owner": "terra1...",  "hub_contract": "terra1..."}

Validator#

KeyTypeDescription
total_delegatedUint128Total amount of tokens delegated to this validator from the Hub address
addressStringOperator address
{  "total_delegated": "10000",  "address": "terravaloper1..."}

InitMsg#

pub struct InstantiateMsg {    pub registry: Vec<Validator>,    pub hub_contract: String,}
{  "registry": [    {      "address": "terravaloper1..."    },    {      "address": "terravaloper1..."    }  ],  "hub_contract": "terra1..."}
KeyTypeDescription
hub_contractCanonicalAddrContract address of Hub
registryVec<Validator>List of whitelisted validators

ExecuteMsg#

AddValidator#

Adds a validator to the registry.

Can only be executed by the owner.

pub enum ExecuteMsg {    AddValidator {        validator: Validator    },}
{  "add_validator": {    "validator": {      "address": "terravaloper1..."    }  }}
KeyTypeDescription
validatorValidatorValidator 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..."  }}
KeyTypeDescription
addressValidatorAddress 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..."}
KeyTypeDescription
owner*CanonicalAddrNew owner of the contract
hub_contract*CanonicalAddrNew contract address of Hub

* = optional

QueryMsg#

GetValidatorsForDelegation#

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.