Manage liquid staking

Stake uixo for stuixo and unstake it again with the IXO liquidstake module, and see which of its messages only governance can send. The code is illustrative.

The IXO liquidstake module lets you stake uixo and receive stuixo, a liquid form of the stake (stIXO). You can transfer stuixo and use it in bonds, AMMs and DeFi while the delegations behind it earn validator rewards. This guide shows how to stake and unstake with the IXO MultiClient SDK (@ixo/impactxclient-sdk), and which of the module's messages only governance can send.

The module routes stake to a whitelisted set of validators by weight, and distributes rewards through weighted_rewards_receivers. Governance can pause it as a circuit breaker, and the protocol can burn stuixo to unstake at once.

Before you start

You need:

Changes to the params, the whitelisted validators, the reward receivers and the pause are made by governance. Each needs a cosmos.gov.v1.MsgSubmitProposal that wraps the relevant MsgUpdate* message. You cannot call them directly.

npm install @ixo/impactxclient-sdk
import { ixo, createSigningClient } from "@ixo/impactxclient-sdk";

const signingClient = await createSigningClient(RPC_ENDPOINT, offlineSigner);

Stake uixo for stuixo

const stakeMsg = {
  typeUrl: "/ixo.liquidstake.v1beta1.MsgLiquidStake",
  value: ixo.liquidstake.v1beta1.MsgLiquidStake.fromPartial({
    delegatorAddress: signerAddress,
    amount: { denom: "uixo", amount: "1000000" },
  }),
};

await signingClient.signAndBroadcast(signerAddress, [stakeMsg], "auto");

The stake is spread across the active whitelisted validators in proportion to their target_weight. The amount of stuixo minted reflects the current nav (net asset value) of the staked pool.

Unstake stuixo for uixo

const unstakeMsg = {
  typeUrl: "/ixo.liquidstake.v1beta1.MsgLiquidUnstake",
  value: ixo.liquidstake.v1beta1.MsgLiquidUnstake.fromPartial({
    delegatorAddress: signerAddress,
    amount: { denom: "stuixo", amount: "1000000" },
  }),
};

await signingClient.signAndBroadcast(signerAddress, [unstakeMsg], "auto");

Unstaking adds an unbonding entry to the staking module's queue. The uixo behind it comes back after the chain's unbonding period.

Governance-controlled operations

An ordinary account cannot broadcast the messages below. Each must be wrapped in a cosmos.gov.v1.MsgSubmitProposal, with the liquidstake module's authority as the signer.

const updateParamsMsg = ixo.liquidstake.v1beta1.MsgUpdateParams.fromPartial({
  authority: govAuthority,
  params: ixo.liquidstake.v1beta1.Params.fromPartial({
    liquidBondDenom: "stuixo",
  }),
});

const updateValidatorsMsg = ixo.liquidstake.v1beta1.MsgUpdateWhitelistedValidators.fromPartial({
  authority: govAuthority,
  whitelistedValidators: [
    ixo.liquidstake.v1beta1.WhitelistedValidator.fromPartial({
      validatorAddress: "ixovaloper1...",
      targetWeight: "1",
    }),
  ],
});

const updateReceiversMsg = ixo.liquidstake.v1beta1.MsgUpdateWeightedRewardsReceivers.fromPartial({
  authority: govAuthority,
  weightedRewardsReceivers: [
    ixo.liquidstake.v1beta1.WeightedAddress.fromPartial({
      address: "ixo1treasury...",
      weight: "1",
    }),
  ],
});

const pauseMsg = ixo.liquidstake.v1beta1.MsgSetModulePaused.fromPartial({
  authority: govAuthority,
  paused: true,
});

To submit them, wrap each in cosmos.gov.v1.MsgSubmitProposal. See the Cosmos SDK gov module documentation.

Burn-to-unstake (admin)

const burnMsg = {
  typeUrl: "/ixo.liquidstake.v1beta1.MsgBurn",
  value: ixo.liquidstake.v1beta1.MsgBurn.fromPartial({
    address: signerAddress,
    amount: { denom: "stuixo", amount: "1000000" },
  }),
};

MsgBurn removes stuixo from circulation without queueing an unbonding. The protocol uses it to reconcile the supply.

Check the result

Query staked balances and the stuixo supply through the ixo.liquidstake.v1beta1 endpoints of the gRPC gateway API. The delegations and unbonding entries behind them appear in the standard cosmos.staking.v1beta1 queries.

When something goes wrong

What you seeWhat to do
no whitelisted validatorsMsgLiquidStake fails when the whitelist is empty. Wait for a governance proposal to fill whitelisted_validators, then stake.
module pausedWhile MsgSetModulePaused is true, every stake and unstake message from an account is refused. Check the params with the gov query.
invalid denomMsgLiquidStake.amount.denom must equal the chain's bond_denom (typically uixo). MsgLiquidUnstake.amount.denom must equal liquid_bond_denom (typically stuixo).
invalid governance authorityMsgUpdateParams, MsgUpdateWhitelistedValidators, MsgUpdateWeightedRewardsReceivers and MsgSetModulePaused accept only the gov authority address as authority.

Next steps