sora-xor / sora2-network

SORA is a new economic system aimed at creating a supranational, world economic system with built-in tools for decentralized finance (DeFi). The SORA network implements a new way of parachain architecture on Polkadot and Kusama network, with the capability to bridge external blockchains (like Ethereum) to the Polkadot ecosystem.
Other
51 stars 23 forks source link

[Research]: Peg Stability Module (PSM) implementation #1103

Open ra9mls opened 3 months ago

ra9mls commented 3 months ago

Problem statement

Now we have a fees during the swap DAI <-> KUSD, we need to have 0 fees to swap DAI <-> KUSD. Discuss what can help to peg KUSD to DAI.

Description

https://manual.makerdao.com/module-index/module-psm

Definition of Done

Requirements

No response

ra9mls commented 3 months ago

Phase 3?

ra9mls commented 3 months ago
  1. Create public vault (pool) for stability of protocol. DAI-KUSD with 0% fees and 100% LTV. User can exchange DAI<->KUSD for free.
AndreyKortosov commented 2 months ago

2. Bonding Curves Mechanism

Core Concept:

A bonding curve is a mathematical curve that defines the relationship between the price of a token and its supply. It is used to determine the price at which tokens can be bought or sold, ensuring that the token's price dynamically adjusts based on its demand.

How It Works:

  1. Bonding Curve Formula:
    • The bonding curve is defined by a mathematical formula, often a polynomial or exponential function, which dictates how the price changes as the supply increases or decreases.
    • For example, a simple bonding curve might be defined by P=k×S^n, where P is the price, S is the supply, k is a constant, and n is an exponent.
  2. Token Issuance (Buying):
    • When users want to buy the stablecoin, they pay a price determined by the current position on the bonding curve. The cost increases as more tokens are issued.
    • The funds paid by the user are added to a reserve pool that backs the stablecoin.
    • Example: If the current supply is low, the price per token might be low. As more tokens are bought and the supply increases, the price per token rises.
  3. Token Redemption (Selling):
    • When users want to sell the stablecoin, they are paid according to the price determined by the bonding curve at that time.
    • The tokens are burned (removed from circulation), and the equivalent value in reserve assets is returned to the user.
    • Example: If the supply is high, the price per token might be high. As tokens are sold and the supply decreases, the price per token falls.
  4. Price Stability:
    • The bonding curve mechanism inherently encourages price stability by making it more expensive to buy tokens when demand is high (thereby dampening demand) and cheaper when demand is low (thereby encouraging demand).
    • Arbitrage opportunities arise when the market price deviates from the bonding curve price, helping to bring the price back in line.

Key Characteristics:

Examples of Bonding Curves in Practice:

Advantages and Challenges:

Advantages:

Challenges:

Summary:

The bonding curve mechanism provides a dynamic and transparent way to manage the supply and demand of a stablecoin. Using a mathematical formula to determine the price based on the token supply ensures that the stablecoin's price adjusts automatically, encouraging price stability. While it offers significant advantages in terms of predictability and liquidity, it also comes with challenges related to complexity and market perception.

Notes:

The potential formula can be 𝑄^𝐷 (𝑃)=𝑄^𝑆 (𝑃) where Q - quantity of tokens, D - demand, S - supply, and P = Price equilibrium should be equal to 1 because P should be close to 1. (Source)

AndreyKortosov commented 2 months ago

3. Redemption Mechanism

Core Concept:

The redemption mechanism ensures that the value of the stablecoin remains stable and pegged to a target value (usually $1 for USD-pegged stablecoins) by allowing users to exchange stablecoins for an equivalent value of collateral assets. This creates a floor price for the stablecoin, as users can always redeem their stablecoins for the underlying assets.

How It Works:

  1. Collateralization:
    • The stablecoin is backed by a reserve of collateral assets, which can be fiat currencies, other stablecoins, or a basket of cryptocurrencies.
    • The value of the collateral is managed to always be at least equal to the value of the outstanding stablecoins, ensuring that each stablecoin can be redeemed for its target value.
  2. Redemption Process:
    • User Redeems Stablecoins: A user holding stablecoins can initiate a redemption by sending their stablecoins to a smart contract or the issuing entity.
    • Collateral Transfer: The smart contract or issuing entity transfers the equivalent value of collateral assets to the user, effectively removing the redeemed stablecoins from circulation (burning them).
    • Example: If a user holds 100 stablecoins pegged to $1 each, they can redeem these stablecoins for $100 worth of collateral assets.
  3. Price Stability:
    • Above Peg: If the stablecoin trades above its peg (e.g., $1.05), users are incentivized to mint new stablecoins by depositing collateral (if the system allows this) and sell them in the open market, pushing the price back down toward the peg.
    • Below Peg: If the stablecoin trades below its peg (e.g., $0.95), users are incentivized to buy the stablecoins from the market and redeem them for $1 worth of collateral, pushing the price back up toward the peg.

Key Characteristics:

Examples of Stablecoins Using Redemption Mechanisms:

Advantages and Challenges:

Advantages:

Challenges:

Summary:

The redemption mechanism is a robust approach to maintaining the peg of a stablecoin by allowing users to redeem their stablecoins for a guaranteed amount of collateral. This mechanism ensures price stability by creating a floor price for the stablecoin, backed by a reserve of collateral assets. While it offers significant advantages in terms of price stability and user confidence, it also requires effective collateral management, regulatory compliance, and sufficient liquidity to handle redemptions.

AndreyKortosov commented 2 months ago

In my opinion:

  1. To start with the public vault DAI - KUSD
  2. If there is not enough liquidity, start to think about the Bonding Curves Mechanism.
  3. Redemption Mechanism we implemented in the current solution.
MishoKanaria commented 2 months ago

Implementing 0% trading fees is likely to disincentivize liquidity between stablecoins. Reducing the fees for all stable pools to 0.1% (eg. USDC<>KUSD, USDT<>KUSD, DAI<>KUSD) through governance would likely produce more favourable outcomes, as it maintains incentives for liquidity providers while allowing arbitrageurs to stabilize the stablecoins more effectively.

AndreyKortosov commented 2 months ago

We have 2 options for vault DAI - KUSD:

  1. Private vault DAI - KUSD for each user
  2. Public vault DAI - KUSD

Private vault

Each user will have the opportunity to lock their DAI and borrow KUSD through their account in Polkaswap, without any fees and stability fees.

Pros

Public vault

The public vault will be available for every Polkaswap user, without any fees and stability fees. The major mechanic will be as XYK pool where the user has the opportunity to swap DAI to KUSD 1:1 or vice versa KUSD to DAI 1:1.

Pros

AndreyKortosov commented 2 months ago

The suggestion is to implement private vaults of DAI - KUSD.

Steps:

  1. Implement setting up borrow tax for each vault (https://github.com/sora-xor/sora2-network/issues/1129).
  2. Update taxes for the current vault DAI - KUSD and set up 0%. (Current user debt will remain and will not increase)