Liquid Staking
Karura’s Liquid Staking protocol is to solve the illiquidity challenge of staked assets.The protocol establishes a staking pool, where users can stake KSM and mint LKSM, which is Kusama staking yield-bearing, while fungible, tradable and usable in other protocols and parachains. Read more here
Follow the roll-out plan of the Liquid Staking protocol here
To interact with Karura from Javascript you can use @polkadot/api along with @acala-network/api. You can learn more about @polkadot/api [here]. (https://polkadot.js.org/docs/api).
The Liquid Staking SDK provides more convenient methods around Liquid staking protocol.

Source Code

Read-Only Functions (State queries)

These functions only read information from the chain, and thus don't require signing transactions with a private key. Read more about state queries here: State queries docs

Get the maximum amount of tokens that can be staked

The protocol has an arbitrary staking cap to control how much KSM is accepted into the staking pool.
You can check it with method:
1
homaLite.stakingCurrencyMintCap(): Promise<Balance>
Copied!
Example:
1
const result = await api.query.homaLite.stakingCurrencyMintCap();
2
console.log(result.toHuman());
Copied!

Get total staked in protocol amount

Returns Balance type with total currency in the staking pool.
1
homaLite.totalStakingCurrency(): Promise<Balance>
Copied!
Example:
1
const result = await api.query.homaLite.totalStakingCurrency();
2
console.log(result.toHuman());
Copied!

Get Minimum Mint Threshold

Minimum amount of staking asset that is required, has type Balance which has 12 decimals.
1
minimumMintThreshold(): Promise<Balance>
Copied!
Example:
1
const result = await api.const.homaLite.minimumMintThreshold();
2
console.log(result.toHuman());
Copied!

Get Minting fee per one operation

Returns the amount of fee that users pay per one staking operation, no matter how big is the stake.
1
mintFee(): Promise<Balance>
Copied!
Example:
1
const result = await api.const.homaLite.mintFee();
2
console.log(result.toHuman());
Copied!

Get Staking Pool Account in Kusama

Karura's parachain account on Kusama that is used for managing staking assets. This account has no private key and is trustlessly controlled by the parachain.
1
sovereignSubAccountLocation(): Promise<Balance>
Copied!
Example:
1
const result = await api.const.homaLite.sovereignSubAccountLocation();
2
console.log(result.toHuman());
Copied!

State-Changing Functions

These transactions updates on-chain data and require sending transactions to the blockchain.
To perform run test code snippets ensure that you have SEED_PHRASE environment variable defined in your .env file.

Mint LKSM

To mint LKSM you need to provide the amount of KSM.
Fees include minting fee and inter-chain transaction fee.
LKSM is a share representation of the staking pool which entitles the owner to a likely increasing quantity of underlying assets.
1
mint(amount: balance): Extrinsic
Copied!
Arguments
Name
Type
amount
Balance
amount of currency to stake
Example
1
const amount = <DESIRED_AMOUNT>
2
3
const extrinsic = api.tx.homaLite.mint(
4
amount,
5
);
6
const hash = await extrinsic.signAndSend(signer);
7
console.log('hash', hash.toHuman());
Copied!

Redeem Staking currency

Soon to come...
Last modified 17d ago