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,
}
Key
Type
Description

owner

CanonicalAddr

Owner of the contract

hub_contract

CanonicalAddr

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,
}
Key
Type
Description

registry

Vec<Validator>

List of whitelisted validators

hub_contract

String

Key
Type
Description

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,
}
Key
Type
Description

validator

Validator

validator struct

Key
Type
Description

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},
}
Key
Type
Description

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>,
    },
}
Key
Type
Description

hub_contract*

String

* = 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 }, 
}
Key
Type
Description

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,
    },
}
Key
Type
Description

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,
}
Key
Type
Description

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,
}
Key
Type
Description

new_owner

String

The address of new owner

Last updated