Skip to content

Conversation

@gregdhill
Copy link
Member

@gregdhill gregdhill commented May 19, 2023

This was very finicky to build and I have low confidence in its production readiness (hence why I'm opening this PR in draft). I will need to review the architecture again with @philippb90 as the system doesn't seem to make sense for LPs - I think they would be economically worse-off.

Closes #1036

Architecture

Concepts:

  • Liquid token: target currency (e.g. KSM)
  • Staking token: derivative (e.g. LKSM)

Requirement: prices always increase (e.g. LKSM is always 1:1 with KSM or can be redeemed for more)

The main idea is that rebasing (staked) tokens in a stable pool are continuously re-pegged to the price of their liquid token otherwise redeeming after a price increase will result in less tokens. When removing or adding liquidity the staking token amount is converted to the target liquid currency and vice versa.

The reason this is required is because we need all assets in a pool to be of equal value.

  1. Staking currency is 1:1 with liquid currency
  2. User adds equal liquidity of both assets
  3. Staking currency is now 2:1 with liquid currency
  4. Liquid currency is now worth twice as much
  5. Pool automatically collects "yield" on income by depositing new liquid tokens into the pool

Problem: some staking tokens are worth more than the liquid currency?

gregdhill added 2 commits May 19, 2023 13:37
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
type WeightInfo: WeightInfo;

/// Convert supported currencies to target asset.
/// NOTE: the price should only ever increase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a hard requirement?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think theoretically the price can also decrease if a slashing event happens (LSD) or a default without sufficient collateral to cover the debt (qToken).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dynamically rebasing tokens in StableAmm

4 participants