Hub

The Hub contract acts as the central hub for all minted nINJ. Native INJ tokens received from users are delegated from here. And undelegations from nINJ unbond requests are also handled from this contract. Rewards generated from delegations are withdrawn to the Reward contract.

Config

KeyTypeDescription

creator

CanonicalAddr

Address of contract creator

update_reward_index_addr

CanonicalAddr

The address allowed to call UpdateGlobalIndex

reward_dispatcher_contract*

CanonicalAddr

Contract address of Rewards Dispatcher

validators_registry_contract*

CanonicalAddr

Contract address of Validators Registry

binj_token_contract*

CanonicalAddr

Contract address of nINJ's Cw20 token contract

stinj_token_contract*

CanonicalAddr

Contract address of stINJ's Cw20 token contract

rewards_contract*

CanonicalAddr

Contract address of Reward

* = optional

Parameters

KeyTypeDescription

epoch_period

u64

Minimum time delay between undelegation batches [seconds]

underlying_coin_denom

String

Underlying asset denomination of stAsset (INJ)

unbonding_period

u64

Time required for the Hub contract to consider an undelegation batch to be fully undelegated (past the unbonding period) [seconds]

peg_recovery_fee

Decimal

Fee applied to stINJ generation and redemption

er_threshold

Decimal

Minimum stINJ exchange rate before peg recovery fee is applied

reward_denom

String

Native token denomination for distributed nINJ rewards (nUSD)

update_reward_index_addr

String

The address allowed to call UpdateGlobalIndex

InitMsg

Instantiates the stINJ Hub contract. Adds a specified validator to whitelist and bonds the creator's initial INJ deposit. The creator's initial INJ deposit ensures the stINJ supply always be a high enough value to prevent rounding errors in the stINJ exchange rate calculation.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
    pub epoch_period: u64,
    pub underlying_coin_denom: String,
    pub unbonding_period: u64,
    pub peg_recovery_fee: Decimal,
    pub er_threshold: Decimal,
    pub reward_denom: String,
    pub update_reward_index_addr: String,
}
KeyTypeDescription

epoch_period

u64

Minimum time delay between undelegation batches [seconds]

underlying_coin_denom

String

Underlying asset denomination of stAsset (INJ)

unbonding_period

u64

Time required for the Hub contract to consider an undelegation batch to be fully undelegated (past the unbonding period) [seconds]

peg_recovery_fee

Decimal

Fee applied to stINJ generation and redemption

er_threshold

Decimal

Minimum stINJ exchange rate before peg recovery fee is applied

reward_denom

String

Native token denomination for distributed bINJ rewards (nUSD)

update_reward_index_addr

String

The address allowed to call UpdateGlobalIndex

ExecuteMsg

Receive

Can be called during a CW20 token transfer when the Hub contract is the recipient. Allows the token transfer to execute a Receive Hook as a subsequent action within the same transaction.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    Receive {
        sender: String,
        amount: Uint128,
        msg: Binary,
    },
}
KeyTypeDescription

sender

String

Sender of token transfer

amount

Uint128

Amount of tokens received

msg

Binary

Base64-encoded string of JSON of Receive Hook

Bond

Bonds inj by delegating the inj amount equally between validators from the registry and mints nInj tokens to the message sender. Requires native Inj tokens to be sent to Hub.

Gryphon tries to distribute the stake evenly across all validators. Given a single delegation, the exact number of validators that will receive delegations and the amount that they will receive depends on the current distribution of stake. We take a sorted (ASC) list of validators, calculate the desired amount that each validator should have target_stake = (total delegated + delegation_amount) / num_validators and begin adding stake up to the desired amount, starting from the validator with the least stake. The exact amount of a single delegation is calculated as target_stake - validator_stake, and you'll have as many delegations as it takes to "drain" the delegation_amount.

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

BondForStINJ

Bonds INJ by delegating the INJ amount equally between validators from the registry and mints stINJ tokens to the message sender. Requires native INJ tokens to be sent to Hub.

The platform tries to distribute the stake evenly across all validators. Given a single delegation, the exact number of validators that will receive delegations and the amount that they will receive depends on the current distribution of stake. We take a sorted (ASC) list of validators, calculate the desired amount that each validator should have target_stake = (total delegated + delegation_amount) / num_validators and begin adding stake up to the desired amount, starting from the validator with the least stake. The exact amount of a single delegation is calculated as target_stake - validator_stake, and you'll have as many delegations as it takes to "drain" the delegation_amount.

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

UpdateGlobalIndex

Distributes INJ delegation rewards to stINJ holders. Withdraws all accrued delegation rewards to the Reward Dispatcher contract and requests the Reward contract to update the global reward index value. Can be issued by the specific address .

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

airdrop_hooks

Vec<Binary>

Not currently enabled

WithdrawUnbonded

Withdraws unbonded INJ. Requires an unbonding entry to have been made before the unbonding period.

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

CheckSlashing

Checks whether a slashing event occurred and updates state accordingly.

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

UpdateParams

Updates parameter values of the Hub contract. Can only be issued by the creator.


#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    UpdateParams {
        epoch_period: Option<u64>,
        unbonding_period: Option<u64>,
        peg_recovery_fee: Option<Decimal>,
        er_threshold: Option<Decimal>,
        paused: Option<bool>,
        reward_denom: Option<String>,
    },
}
KeyTypeDescription

epoch_period

u64

Minimum time delay between undelegation batches [seconds]

unbonding_period

u64

Time required for the Hub contract to consider an undelegation batch to be fully undelegated (past the unbonding period) [seconds]

peg_recovery_fee

Decimal

Fee applied to stINJ generation and redemption

et_threshold

Decimal

Minimum stINJ exchange rate before peg recovery fee is applied

paused

bool

The pause system operation switch to facilitate smooth contract upgrades and data migration

reward_denom

String

Native token denomination for distributed bINJ rewards (nUSD)

UpdateConfig

Updates the Hub contract configuration. Can only be issued by the creator.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
  UpdateConfig {
        rewards_dispatcher_contract: Option<String>,
        validators_registry_contract: Option<String>,
        binj_token_contract: Option<String>,
        stinj_token_contract: Option<String>,
        airdrop_registry_contract: Option<String>,
        rewards_contract: Option<String>,
        update_reward_index_addr: Option<String>,
    },
}
KeyTypeDescription

rewards_dispatcher_contract

String

Contract address of Rewards Dispatcher

validators_registry_contract

String

Contract address of Validators Registry

binj_token_contract

String

Contract address of bINJ's Cw20 token contract

stinj_token_contract

String

Contract address of stINJ's Cw20 token contract

airdrop_registry_contract

String

Not currently enabled

rewards_contract

String

Contract address of Reward

update_reward_index_addr

String

The address allowed to call UpdateGlobalIndex

[Internal] RedelegateProxy

A proxy handler to execute redelegations from Hub address.

Can only be executed by Validators Registry or by the owner of the Hub.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
 RedelegateProxy {
        // delegator is automatically set to address of the calling contract
        src_validator: String,
        redelegations: Vec<(String, Coin)>, //(dst_validator, amount)
    },

}
KeyTypeDescription

src_validator

String

Address of source vaildator in redelegation pair

redelegations

Vec<(String, Coin)>

List of(destination validator, redelegation amount)

[Internal] BondRewards

Bonds INJ by delegating the INJ amount equally between validators from the registry.

No stINJ tokens have been minted.

Can only be executed by Rewards Dispatcher.

Requires native INJ tokens to be sent to Hub.

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

Receive Hooks

Unbond

Burns received stINJ and equally unbonds a corresponding amount of INJ from a validator from the registry.

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

QueryMsg

Config

Gets the Hub contract's configuration.

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

ConfigResponse


#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ConfigResponse {
    pub owner: String,
    pub update_reward_index_addr: String,
    pub reward_dispatcher_contract: Option<String>,
    pub validators_registry_contract: Option<String>,
    pub binj_token_contract: Option<String>,
    pub stinj_token_contract: Option<String>,
    pub airdrop_registry_contract: Option<String>,

    // #[deprecated]
    pub token_contract: Option<String>,
}
KeyTypeDescription

owner

String

Address of the owner

update_reward_index_addr

String

The address allowed to call UpdateGlobalIndex

reward_dispatcher_contract

String

Contract address of Rewards Dispatcher

validators_registry_contract

String

Contract address of Validators Registry

binj_token_contract

String

Contract address of bINJ's Cw20 token contract

stinj_token_contract

String

Contract address of stINJ's Cw20 token contract

airdrop_registry_contract

String

Not currently enabled

token_contract

String

Not currently enabled

State


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

StateResponse

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct StateResponse {
    pub binj_exchange_rate: Decimal,
    pub stinj_exchange_rate: Decimal,
    pub total_bond_binj_amount: Uint128,
    pub total_bond_stinj_amount: Uint128,
    pub last_index_modification: u64,
    pub prev_hub_balance: Uint128,
    pub last_unbonded_time: u64,
    pub last_processed_batch: u64,

    // #[deprecated]
    pub total_bond_amount: Uint128,
    // #[deprecated]
    pub exchange_rate: Decimal,
}
KeyTypeDescription

binj_exchange_rate

Decimal

Current bINJ <> INJ exchange rate

stset_exchange_rate

Decimal

Current stINJ <> INJ exchange rate

total_bond_binj_amount

Uint128

Total amount of INJ currently bonded by Hub via bINJ logic

total_bond_stinj_amount

Uint128

Total amount of INJ currently bonded by Hub via stINJ logic

last_index_modification

u64

Unix block timestamp when the global reward index was last updated

prev_hub_balance

Uint128

Hub's INJ balance when WithdrawUnbonded was lasted executed. Used to calcutate the actual amount of unbonded INJ

last_unbonded_time

u64

Unix block timestamp when a batch was last undelegated

last_processed_batch

u64

Batch ID of the most recently released batch

CurrentBatch

Gets information about the current undelegation batch.

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

CurrentBatchResponse

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct CurrentBatchResponse {
    pub id: u64,
    pub requested_binj_with_fee: Uint128,
    pub requested_stinj: Uint128,

    // #[deprecated]
    pub requested_with_fee: Uint128,
}
KeyTypeDescription

id

u64

Batch ID of the current undelegation batch

requested_binj_with_fee

Uint128

Amount of (fee-applied)bINJ requested for undelegation in this batch

requested_stinj

Uint128

Amount of stINJ requested for undelegation in this batch

WithdrawableUnbonded

Gets the amount of undelegated INJ that will be available for withdrawal (unbonding requests past the unbonding period) for the specified user.

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

address

String

Address of user that previously unbonded INJ via redeeming bINJ

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct WithdrawableUnbondedResponse {
    pub withdrawable: Uint128,
}
KeyTypeDescription

withdrawable

Uint128

Amount of undelegated INJ availabe for withdrawal

Parameters

Gets parameter information.

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

ParametersResponse

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Parameters {
    pub epoch_period: u64,
    pub underlying_coin_denom: String,
    pub unbonding_period: u64,
    pub peg_recovery_fee: Decimal,
    pub er_threshold: Decimal,
    pub reward_denom: String,
    pub paused: Option<bool>,
}
KeyTypeDescription

epoch_period

u64

Minimum time delay between undelegation batches [seconds]

underlying_coin_denom

String

Underlying asset denomination of stAsset (INJ)

unbonding_period

u64

Time required for the Hub contract to consider an undelegation batch to be fully undelegated (past the unbonding period) [seconds]

peg_recovery_fee

Decimal

Fee applied to stINJ generation and redemption

er_threshold

Decimal

Minimum stINJ exchange rate before peg recovery fee is applied

reward_denom

String

Native token denomination for distributed bINJ rewards (nUSD)

paused

Option<bool>

The pause system operation switch to facilitate smooth contract upgrades and data migration

UnbondRequests

Gets the list of INJ unbonding amounts being unbonded for the specified user.

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

address

String

Address of user that previously unbonded INJ by redeeming stINJ

UnbondRequestsResponse

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


pub type UnbondRequest = Vec<(u64, Uint128, Uint128)>;
KeyTypeDescription

address

String

Address of user that requested to unbond stINJ

requests

UnbondRequest

List of unbonding requests made by user

KeyTypeDescription

UnbondRequest

Vec<(u64, Uint128, Uint128)>

List of (batch ID, bINJ unbond amount, stINJ unbond amount)

AllHistory

Gets the historical list of undelegation batch entries.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    AllHistory {
        start_from: Option<u64>,
        limit: Option<u32>,
    },
}
KeyTypeDescription

start_from*

u64

Batch Id to start query

limit*

u32

Maximum number of query entries

* = optional

AllHistoryResponse

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct AllHistoryResponse {
    pub history: Vec<UnbondHistoryResponse>,
}


#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct UnbondHistoryResponse {
    pub batch_id: u64,
    pub time: u64,
    pub binj_amount: Uint128,
    pub binj_applied_exchange_rate: Decimal,
    pub binj_withdraw_rate: Decimal,

    pub stinj_amount: Uint128,
    pub stinj_applied_exchange_rate: Decimal,
    pub stinj_withdraw_rate: Decimal,

    pub released: bool,

    // #[deprecated]
    pub amount: Uint128,
    // #[deprecated]
    pub applied_exchange_rate: Decimal,
    // #[deprecated]
    pub withdraw_rate: Decimal,
}
KeyTypeDescription

history

Vec<UnbondHistoryResponse>

List of batch information

KeyTypeDescription

batch_id

u64

Batch ID

time

u64

Unix block timestamp when this batch was undelegated

binj_amount

Uint128

(Fee-applied)amount of bINJ unbonded in this batch

binj_applied_exchange_rate

Decimal

bINJ exchange rate at the time of batch undelegation

binj_withdraw_rate

Decimal

Conversion rate applied when users later withdraw from this batch

stinj_amount

Uint128

(Fee-applied)amount of stINJ unbonded in this batch

stinj_applied_exchange_rate

Decimal

stINJ exchange rate at the time of batch undelegation

stinj_withdraw_rate

Decimal

Convertion rate applied when users later withdraw from this batch

released

bool

Indication on whether is batch is released(processed as fully undelegated by the contract)

Last updated