Curve.fi 101 — How it works and its meteoric rise

David Zhang
8 min readJul 27, 2020

--

This opinion piece was written on July 27th, 2020. All content is based on my own research and is my own opinion. I do not represent any of the projects listed and information gets outdated very quickly in this space so DYOR.

Curve (https://www.curve.fi/) previously known as StableSwap presented itself as an “efficient mechanism for Stablecoin liquidity” with a whitepaper dated November 10th, 2019 (https://www.curve.fi/stableswap-paper.pdf)

What problem does Curve solve?

Stablecoins have proliferated and grown as DeFi has grown. The issue is that often times when you want to swap from one stablecoin to another you will have to rely on an expensive fee-bearing method such as an exchange orderbook, an OTC trade, or going through the stablecoins’ respective issuance and redemption mechanisms.

Curve solves this problem by providing an Uniswap-like exchange system that takes into account the nature of stablecoins being value pegged.

How does Curve work?

Curve has two main components, a buy-side and a sell-side if you will.

On the buy-side you can take stablecoins to Curve and swap for any other supported stablecoin, this makes it like a stablecoin Uniswap. On the sell-side you can take stablecoins to Curve and contribute it to a pool to earn yield.

A pool in Curve’s terminology is simply a portfolio of stablecoins. It will have some parameters associated with it such as which stablecoins are in it, their respective target proportions, the fee for transacting, and how “fungible” the stablecoins are thought to be with each other. More on the “fungibility” aspect in “the maths” section in the appendix below.

If you want to swap stablecoins you will pay a small transaction fee and a “rebalancing” fee. The rebalancing fee is based on how far the pool has departed from its configured proportions. For example if a pool is supposed to be 50% DAI and 50% USDT and the current balances are 50% DAI and 50% USDT there will be no rebalancing fee (beyond the quantity you buy) whereas if the current balances are 25% DAI and 75% USDT you will pay a rebalancing fee if you buy DAI with USDT but you will get a refund (negative fee) if you buy USDT with DAI. The magnitude of this rebalancing fee depends on the “fungibility” factor I mentioned above.

If you contribute stablecoins to a Curve pool you can earn yield from two main sources. The first source is transaction fees, which you earn pro-rata based on your percentage share of the pool. The second source is crypto lending interest. There are some pools which deposit the stablecoins onto DeFi lending protocols to earn additional yield.

You may have first heard about Curve due to its insane earning potentials. Those potentials are almost entirely dependent on volume in a pool and therefore highly subject to change. The biggest factors for prospective yield at the time of this writing are your proportion of the pool and the transaction volume of that pool. The higher the transaction volume and the more of the pool you own the more yield you will generate. Crypto lending can supplement the yield as well but if you’ve been seeing crazy numbers like 100–200% returns it’s almost entirely based on transaction fees.

Why did Curve succeed where other stablecoin swaps have failed?

One problem with providing liquidity for stablecoins is that it’s capital intensive and usually low-reward. Previous attempts at this have tried to compensate liquidity providers with proportional transaction fees but none have been able to attract enough liquidity to reach critical mass to make the endeavor worthwhile for liquidity providers.

Curve solved this problem by combining a few different incentives:

  • Directly integrating with yield generating DeFi protocols to provide a base level of yield
  • Sharing all of the transaction fees with liquidity providers
  • Having its own token which it pays out as a reward in addition to fees
  • Partnering with other projects to give out bonus tokens

Combined with the fact that it’s all on-chain and does not rely on any off-chain service providers means that anyone can interact with the protocol without going through an extensive verification process which is often a friction point for these types of platforms.

Considerations and looking forward

Curve has succeeded quite spectacularly and rose in the ranks of DeFi projects faster than any other project before it. Some would say it’s 10% luck, 20% skill, 15% concentrated power of will… ok joking aside there are quite a few factors that played into Curve’s success.

Timing — Curve has benefited from spectacular timing, releasing at a time when stablecoin reserves are rising meteorically, with USDT hitting the $10B mark, USDC at $1B, and DAI at $250M. The demand for swapping between stablecoins at low percentage fees has never been greater. Another factor is that DeFi has been taking off around this time as well, with many successful projects paving the way for users to start utilizing their funds on-chain.

Execution — Curve for all its financial wizardry is fairly easy to use and understand from an end user perspective. They provide a simple UI and some programatic tools for interacting with the application. They also release curated guides on how to do certain actions like providing liquidity.

Incentives — Curve modeled its financial incentives well, resulting in mouth watering yields which resulted in massive waves of deposits onto the platform. Combined with partnerships and the promise of its own token distributed to liquidity providers, it looked like a great opportunity to deploy side capital that was sitting in stablecoins anyways.

With all that said what will the future of Curve look like? It seems like they’ve found a niche of being a stablecoin swap, but whether they can find success branching out from there only time will tell. The massive growth that Curve has experienced is unlikely to continue for long as yields have already sharply fallen as deposits flooded onto the platform.

Here are the yields at the time of this writing (subject to massive daily changes so do your own research).

Risks

There are many risk factors at play here. Curve is a new DeFi project, written by a no-name team, running on an immature financial platform (Ethereum), operating on single-point-of-failure (centralized) stablecoins and a relatively young DeFi stablecoin, integrated with a up and coming but still immature DeFi crypto lending ecosystem.

Here are some examples of the types of risk you may be exposed to (this is non-exhaustive):

Software vulnerabilities

  • In Curve or the tools you use to interact with it
  • In collateral assets used on Curve
  • In the DeFi projects that Curve integrates
  • In the EVM
  • In the implementation language (Vyper)
  • In the wallet you are using to interact with Curve
  • In the device you are using to host your wallet
  • In the network you are communicating over

Counterparty risk

  • The Curve team may render the protocol unusable and result in stuck funds (Parity multisig anyone?)
  • Any of the DeFi protocols Curve integrates with may abscond with the funds
  • Any stablecoins used in the pool may collapse in value
  • Ethereum itself may be subject to network attacks

Unknown unknowns (here lies the black swans)

  • Any number of things not listed here that no one has ever thought about

Disclaimer

This opinion piece is not intended as investment advice, legal advice, a security audit, or anything of that sort. I was learning how Curve worked and decided to turn my notes into this opinion piece. If you intend to use Curve or make any investments please do your own research and never deposit more money than you can afford to lose into experimental DeFi projects. I do not represent or hold stake in any of the projects listed at the time of writing. Information gets outdated very quickly in this space so do not rely on anything here to make real decisions.

Appendix

The Maths

The way that Curve determines how much of a “rebalancing” fee to charge is a large part of its success. It is extremely low compared to using something like Uniswap or Kyber because it relies on the fact that stablecoins tend to be, well, stable.

To keep the system in check the Curve team has created an invariant that must be maintained during any swap. Here I will try to break down their approach in a simplified way.

Let n be the number of different coins in the pool.

If all we cared about was maintaining the same total pool balance (in USD terms) we could have a constant sum invariant like this:

$$\sum_{i=1}^{n} x_i = P$$

Where x_i is the quantity of a stablecoin in the system and therefore P is the size of the stablecoin pool. If we hold P constant during a swap we will have the property that the total pool value stays the same.

However we don’t want a pool that ends up being all of one stablecoin, so we must make it expensive at some point to continue swapping one stablecoin for another. Let’s consider this constant product invariant:

$$\prod_{i=1}^{n} x_i^{w_i} = C$$

Where x_i is the quantity of a stablecoin in the system and w_i is the normalized weight so:

\sum_{i=1}^{n} w_i = 1

If we hold C constant we have an invariant that results in “price changes” when quantities change.

This invariant was taken from the Balancer protocol (https://balancer.finance/whitepaper) which itself drew inspiration from Uniswap (https://uniswap.org/). If you want to deep dive into the properties of these invariants and some useful derivations take a look at the project whitepapers.

The constant sum invariant is not idea because it implies perfect fungibility between each x_i and the constant product invariant is not idea because it implies the price of each x_i is perfectly independent of each other. The innovation of Curve is that they combined both invariants with a scalar s to get an invariant that takes the stable property of stablecoins into account:

$$s\times\sum_{i=1}^{n} x_i + \prod_{i=1}^{n} x_i^{w_i} = C$$

If we hold C constant we get a function that is equivalent to the constant product invariant when s=0 and approaches the constant sum invariant as s approaches infinity.

A nice analogy that comes into play here is financial leverage. When s gets bigger we are saying that the stablecoins are more interchangeable and that falling out of balance doesn’t matter as much (with s approaching infinity meaning that they are basically perfectly fungible). Another way to look at it is that as s increases it costs less to drive the pool out of balance (the “rebalancing” fee is reduced).

For a full derivation of the real Curve invariant see their whitepaper (https://www.curve.fi/stableswap-paper.pdf).

Sources

https://www.curve.fi/stableswap-paper.pdf

https://balancer.finance/whitepaper/

--

--