/interest-lst

The best way to stake Sui

Primary LanguageMove

Quick start

Make sure you have the latest version of the Sui binaries installed on your machine

Instructions here

Run tests

To run the tests

cd lst
sui move test --skip-fetch-latest-git-deps

Publish

sui  client  publish  --gas-budget  500000000 --skip-fetch-latest-git-deps

Dependencies

Interest LST depends on the following packages

Functionality

Interest Liquid Staking Tokens allows users to stake and unstake Sui in their validator of choice. Users have two Mint options:

First Option

graph LR
A((10 Sui)) --> B((iSui))
B -- Principal + Yield --> C((12 Sui))
Loading
  • iSui (Interest Sui): It tracks the pool's principal and rewards. Therefore, its value is always higher than Sui.

Second Option

graph LR
A((10 Sui)) -- Principal --> B((iSUIP))
A -- Yield --> C[iSUIY]
B --> D((10 Sui))
C --> E((2 Sui))
Loading
  • iSUIP (Interest Sui Principal): It tracks the principal of a Native Staked Sui Object. This coin is always equal to Sui.
  • iSUIY (Interest Sui Yield): It is a fungible yield bearing asset that tracks the yield portion of a Native Staked Sui Object.

Selling any of these assets, means selling the entire position. They do not require any other object to mint/burn and the module does not keep track of addresses. Therefore, they are composable with DeFi.

Core Values

  • Decentralized: Users can deposit/withdraw from any validator
  • Non-custodial: The admin does not have any access to the funds. It uses a Coin + SFT accounting system to keep track of deposits/rewards
  • Fair: The deposit fee increases as a validator gets a higher stake compared to others. It incentivizes users to deposit in other validators.
  • Flexible: Users have granular control over their deposit via the 3 Asset options.

Repo Structure

This module is structured to be easily upgraded to support Sui's latest Staking modules.

  • lst: The Interest LST modules
    • assets Assets minted by the protocol
      • isui.move: The Interest Sui Module
      • isui_principal.move: The Interest Principal Module
      • isui_yield.move: The Interest Yield Module
    • core: The core LST modules
      • events.move: It emits the LST events
      • lst.move: The public functions to interact with LST
      • lst_inner_state.move: It handles LST state and mutations
      • validator.move: It manages the Validator State
    • lib: Set of utility modules
      • assets_utils.move: Utility to transfer assets
      • fee_utils.move: Handles fee calculations
      • staking_pool_utils.move: Calculates the rewards in a StakingPool
      • unstake_algorithms.move: Handles the logic to unstake Sui
    • test: Handles test files
      • lst_tests.move: Tests for lst.move
      • test_utils.move: Testing utility functions
    • admin.move: Creates the LstAdmin struct
    • constant.move: Stores protocol constants
      • entry.move: entry functions for lst.move
      • errors.move: Store errors constants
      • query.move: Utility functions to query data from Interest LST
  • yield: The Interest LST modules
    • yield.move: SFT wrapper to track of the yield of Interest Bearing Tokens

Portfolio Logic

The Interest LST portfolio is managed by the Fund struct. It is stored in the StateV1 shared object under pool.

  • shares It represents the shares of the portfolio (iSui)
  • underlying It represents the assets held by the portfolio (Sui)

Interest LST Portfolio:

Shares: 1000

Underlying: 1200

10 iSui is worth 12 Sui - 10 * 1200 / 1000

10 Sui is worth ~8.3 iSui - 10 * 1000 / 1200

SFT (Semi Fungible Tokens)

struct SftBalance<phantom T> has store {
  slot: u256, // Provides fungibility between the NFTs
  value: u64
}

struct SemiFungibleToken<phantom T> has key, store {
  id: UID, 
  balance: SftBalance<T>
}

Semi-fungible tokens can exchange value if they have the same slot as a coin. SFTs with the same slot can be joined together or split apart. iSUIP and iSUIY are SFTs. Their maturity is saved in the slot attribute.

Fungible with the same slot

Join

graph LR
A[SFT - Value: 10 & Slot: 1] --> C
B[SFT - Value: 2 & Slot: 1] --> C
C[SFT - Value: 12 & Slot: 1]
Loading

Split

graph LR
A[SFT - Value: 10 & Slot: 1]
A --> B[SFT - Value: 8 & Slot: 1]
A --> C[SFT - Value: 2 & Slot: 1]
Loading

Non-Fungible different slots

Join

graph LR
A[SFT - Value: 10 & Slot: 1] --> C
B[SFT - Value: 2 & Slot: 2] --> C
C[NOT ALLOWED]
Loading

Authors

Contact Us