Skip to main content

InstantiateMsg

Struct InstantiateMsg 

Source
pub struct InstantiateMsg {
Show 15 fields pub admin: Option<String>, pub membership: String, pub min_points: u64, pub max_validators: u32, pub epoch_length: u64, pub epoch_reward: Coin, pub initial_keys: Vec<OperatorInitInfo>, pub scaling: Option<u32>, pub fee_percentage: Decimal, pub auto_unjail: bool, pub double_sign_slash_ratio: Decimal, pub distribution_contracts: UnvalidatedDistributionContracts, pub validator_group_code_id: u64, pub verify_validators: bool, pub offline_jail_duration: Duration,
}

Fields§

§admin: Option<String>

Address allowed to jail, meant to be a OC voting contract. If None, then jailing is impossible in this contract.

§membership: String

Address of a cw4 contract with the raw membership used to feed the validator set

§min_points: u64

Minimum points needed by an address in membership to be considered for the validator set. 0-point members are always filtered out. (use points for cw4, power for Tendermint)

§max_validators: u32

The maximum number of validators that can be included in the Tendermint validator set. If there are more validators than slots, we select the top N by membership points descending. (In case of ties at the last slot, select by “first” Tendermint pubkey, lexicographically sorted).

§epoch_length: u64

Number of seconds in one epoch. We update the Tendermint validator set only once per epoch. Epoch # is env.block.time/epoch_length (round down). The first block with a new epoch number will trigger a new validator calculation.

§epoch_reward: Coin

Total reward paid out at each epoch. This will be split among all validators during the last epoch. (epoch_reward.amount * 86_400 * 30 / epoch_length) is the amount of reward tokens to mint each month. Ensure this is sensible in relation to the total token supply.

§initial_keys: Vec<OperatorInitInfo>

Initial operators and validator keys registered. If you do not set this, the validators need to register themselves before making this privileged/calling the EndBlockers, so that we have a non-empty validator set

§scaling: Option<u32>

A scaling factor to multiply cw4-group points to produce the Tendermint validator power

§fee_percentage: Decimal

Percentage of total accumulated fees that is subtracted from tokens minted as rewards. 50% by default. To disable this feature just set it to 0 (which effectively means that fees don’t affect the per-epoch reward).

§auto_unjail: bool

Flag determining if validators should be automatically unjailed after the jailing period; false by default.

§double_sign_slash_ratio: Decimal

Validators who are caught double signing are jailed forever and their bonded tokens are slashed based on this value.

§distribution_contracts: UnvalidatedDistributionContracts

Addresses where part of the reward for non-validators is sent for further distribution. These are required to handle the Distribute {} message (eg. tg4-engagement contract) which would distribute the funds sent with this message.

The sum of ratios here has to be in the [0, 1] range. The remainder is sent to validators via the rewards contract.

Note that the particular algorithm this contract uses calculates token rewards for distribution contracts by applying decimal division to the pool of reward tokens, and then passes the remainder to validators via the contract instantiated from rewards_code_is. This will cause edge cases where indivisible tokens end up with the validators. For example if the reward pool for an epoch is 1 token and there are two distribution contracts with 50% ratio each, that token will end up with the validators.

§validator_group_code_id: u64

Code id of the contract which would be used to distribute the rewards of this token, assuming tg4-engagement. The contract will be initialized with the message:

{
    "admin": "valset_addr",
    "denom": "reward_denom",
}

This contract has to support all the RewardsDistribution messages

§verify_validators: bool

When a validator joins the valset, verify they sign the first block since joining or jail them for a period otherwise.

The verification happens every time the validator becomes an active validator, including when they are unjailed or when they just gain enough power to participate.

§offline_jail_duration: Duration

The duration to jail a validator for in case they don’t sign their first epoch boundary block. After the period, they have to pass verification again, ad infinitum.

Implementations§

Trait Implementations§

Source§

impl Clone for InstantiateMsg

Source§

fn clone(&self) -> InstantiateMsg

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InstantiateMsg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for InstantiateMsg

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for InstantiateMsg

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for InstantiateMsg

Source§

fn eq(&self, other: &InstantiateMsg) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for InstantiateMsg

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for InstantiateMsg

Source§

impl StructuralPartialEq for InstantiateMsg

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,