Introducing Sauce, StableSwap Feature on Ref

Ref Finance
4 min readDec 13, 2021

--

Introduction

Stablecoins are defined as:

A stablecoin is a digital currency that is pegged to a “stable” reserve asset like the U.S. dollar or gold. Stablecoins are designed to reduce volatility relative to unpegged cryptocurrencies like Bitcoin. — [1]

The total stablecoin supply has increased by more than 450% year-over-year, from $26b to $150b [2].

Not only stablecoins are used to facilitate trading in other cryptocurrencies, but also to make transfer between the legos of crypto-finance (exchanges, staking, lending, asset management, prediction markets, etc.).

As the native portal to the NEAR ecosystem, Ref Finance aims to empower NEARians by facilitating what they can do with stablecoins, such as:

  • Minimise volatility
  • Trade and save
  • Earn interest

Above all, Ref Finance aims to provide an automated market making solution for stablecoins, allowing users to swap one stable for another in an efficient way.

Problem and solution

The invariant ‘xy = k’ is not suitable for something which is meant to be stable. In his StableSwap paper, published in 2019, Michael Egorov (Curve Finance) explained why.

[…] The problem is that the price slippage is enormous, and one should provide enormous funds to keep a meaningful liquidity. On the flip side, if one for example loads DAI and USDC into Uniswap’s liquidity pool, the returns will be tiny (perhaps, several percent per year). — [3]

Then introducing the StableSwap as a solution to the problem.

For StableSwap, there was a middle-ground invariant found (Fig. 1). As expected, the price (equal to derivative) only slightly deviates from 1 when number of coins is closed to balance. — [4]

Figure 1: Comparison of StableSwap invariant with Uniswap (constant-product) and constant price invariants. The portfolio consists of coins X and Y which have the “ideal” price of 1.0. There are x = 5 and y = 5 coins loaded up initially. As x decreases, y increases, and the price is the derivative dy/dx. — [5]

Thus, the new invariant provides a better tool for DeFi users to swap stablecoins, while reducing market friction by improving DeFi arbitrage.

The equation for StableSwap pool is:

Where:

  • D is the invariant
  • A is a coherent factor, which is set to 240 (can be adjusted by the DAO)
  • n is the number of stable tokens

In the ideal situation (no fee), no action (add / remove liquidity and swap) will change the invariant D. In reality (with fee), the invariant D will slightly increase as a result of every action.

Sauce and fee protocol upgrade

As the 3pool on Curve [6], the Sauce pool on Ref will have USDT, USDC and DAI as token reserves.

Figure 2: Ref Finance StableSwap User Interface Mockup

The Sauce pool fee will be set at 0.05%. Moreover, the new solution will introduce a fee protocol upgrade. Today, Ref Finance has a fixed protocol fee, whatever the pool fee.

  • 0.04% goes to the protocol
  • 0.01% goes to potential referrals

The new protocol fee will be set as a percentage of the total pool fee.

  • 16% of the total fee goes to the protocol
  • 4% of the total fee goes to potential referrals

For example, the Sauce pool fee (0.05%) will be distributed as followed:

  • LP fee: 0.04%
  • Protocol fee: 0.008%
  • Referral fee: 0.002%

Unlike the common pool, the Sauce pool may incur a small fee resulting from liquidity actions. As the protocol encourages balanced token reserves, any user willing to remove their liquidity in different proportion will be charged accordingly.

Conclusion

The team is now in the last phase of the StableSwap feature deployment, expected to be live on mainnet for beta testing on the 16th of December, and fully launched on the 20th of December.

Once the testing phase is fully completed, the team will communicate more details relating to:

  • Swap and liquidity user guide
  • Sauce pool liquidity incentives

Stay tunned!

By Didier, Product Manager

References

[1] https://www.coinbase.com/learn/crypto-basics/what-is-a-stablecoin

[2] https://www.theblockcrypto.com/data/decentralized-finance/stablecoins

[3] https://curve.fi/files/stableswap-paper.pdf — page 2

[4] https://curve.fi/files/stableswap-paper.pdf — page 2

[5] https://curve.fi/files/stableswap-paper.pdf — page 3

[6] https://curve.fi/3pool

About Ref Finance

Ref Finance is a community-led, multi-purpose Decentralized Finance (DeFi) platform built on NEAR Protocol.

Ref takes full advantage of NEAR’s low fees ($0.005 per swap), one-to-two second finality, and WebAssembly-based runtime (hello, Rust smart contracts!).

Using the Rainbow Bridge (NEAR <> ETH), traders can utilize the billions of dollars in ERC-20-compliant assets from Ethereum, and eventually, from any chain (BSC, Polygon/Matic, Cosmos/IBC, and others) on NEAR.

Ref Finance’s first product is an automated market maker (AMM). It is similar to Uniswap, with a few changes (not limited to):

  • Multiple pools in a single contract
  • Ability to trade across pools atomically in a single transaction
  • Customizable swap fee per pool, giving to LPs the possibility to charge higher fees for volatile tokens

Make sure you are following us on Twitter for the latest news and announcements, and do make sure you join our Discord or Telegram for deeper levels of engagement with our Team and Community!

Disclaimer

Ref Finance does not endorse or promote any of the projects, platforms or cryptocurrencies mentioned in this blogpost. Any descriptions of functionality and services provided are for information only. Ref Finance is not responsible for any loss of funds or other damages caused as a result of using the projects, platforms or cryptocurrencies described above.

--

--

Ref Finance
Ref Finance

Written by Ref Finance

The gateway of #NEAR DeFi - Top 1 DEX on Near

Responses (1)