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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Config {
    pub owner: CanonicalAddr,
    pub hub_contract: CanonicalAddr,
}
KeyTypeDescription

owner

CanonicalAddr

Owner of the contract

hub_contract

CanonicalAddr

Contract address of Hub

InitMsg

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
    pub registry: Vec<Validator>,
    pub hub_contract: String,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Validator {
    pub address: String,
}
KeyTypeDescription

registry

Vec<Validator>

List of whitelisted validators

hub_contract

String

Contract address of Hub

KeyTypeDescription

address

String

Operator address

ExecuteMsg

AddValidator

Adds a validator to the registry. Can only be executed by the owner.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    AddValidator { validator: Validator },
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Validator {
    pub address: String,
}
KeyTypeDescription

validator

Validator

validator struct

KeyTypeDescription

address

String

Operator address

RemoveValidator

Removes a validator from the registry. Can only be executed by the owner.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    RemoveValidator { address: String},
}
KeyTypeDescription

address

String

Operator address

UpdateConfig

Updates a registry's configuration. Can only be issued by the owner.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    UpdateConfig {
        hub_contract: Option<String>,
    },
}
KeyTypeDescription

hub_contract*

String

New contract address of Hub

* = optional

Redelegations

Re-delegate the delegation from the validator which removed to other whitelisted validator nodes.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    Redelegations { address: String }, 
}
KeyTypeDescription

address

String

Operator address

SetOwner

Transfer ownership permissions to a new owner address.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
 SetOwner {
        new_owner_addr: String,
    },
}
KeyTypeDescription

new_owner_addr

String

The address of new owner

AcceptOwnership

The new owner accepts ownership permissions.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    AcceptOwnership {},
}

QueryMsg

GetValidatorsForDelegation

Returns validators sorted by total_delegated amount.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    GetValidatorsForDelegation {},
}

ValidatorResponse

returns list validatorResponse

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ValidatorResponse {
    #[serde(default)]
    pub total_delegated: Uint128,
    pub address: String,
}
KeyTypeDescription

total_delegated

Uint128

total INJ delegated to validator

address

String

Operator address

Config

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    Config {},
}

Returns a Config struct.

NewOwner

Query the address of the new owner.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
  NewOwner {},
}

NewOwnerResponse

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct NewOwnerResponse {
    pub new_owner: String,
}
KeyTypeDescription

new_owner

String

The address of new owner

Last updated