StarkWare
Published in

StarkWare

DeFi Pooling

Bringing Scalability to Existing L1 Projects

TL;DR

  • DeFi’s original values were about financial inclusion and open access. As gas price rises, DeFi is turning into a whale game.
  • L1 Pools (such as Vaults in YFI) effectively scale DeFi, as they are cheaper and simpler.
  • Nevertheless, joining, leaving, and rebalancing a Pool on L1 is still expensive
  • StarkEx fixes this. The proposed solution is called DeFi Pooling, a new way to split the L1 bill and make position rebalancing available on L2.
  • StarkEx 3.0 (Coming in May 2021) will support the new primitive required to enable it: L1 Limit Order.

Background

DeFi aims to improve financial inclusion thanks to its composability and permissionless nature. Nevertheless, when gas is too expensive, only whales can participate.

If we want DeFi to remain inclusive and reach the next 10M users, we need to address the scalability problem, in order to allow transaction costs to remain low.

We’ve already seen a movement toward scalability in the context of Yield Optimizer. Projects like YFI and Harvest enable smaller traders to participate in advanced and more expensive trading strategies. Let’s consider the YFI USDt Curve Strategy for example.

As a regular trader, optimizing the yield of lending on Curve is rather complex. One needs to deposit into a specific pool, stake their LP tokens into the Curve gauge, define its lockup to increase its CRV rewards, and vote on-chain to select the reward proportion allocated to their pool.

With YFI, all the above is abstracted away. One simple deposit into the YFI USDt yVault, and the protocol takes care of the rest. In exchange, the protocol charges a 20% management fee on profits.

For most traders, this 20% fee is cheaper than the hassle and transaction cost of implementing this strategy independently.

In addition, by pooling YFI customers’ voting rights, YFI behaves like an investment fund and influences Curve to benefit all YFI stakeholders: traders and token holders alike.

Nevertheless, YFI is not optimal gas-wise as depositing and withdrawing from the pool, as well as rebalancing funds, remain L1 operations. As such, these operations are often prohibitively expensive.

Defi Pooling fixes this by bringing these operations — depositing, withdrawing, and rebalancing, into a scalable and low-cost L2!

What is DeFi Pooling?

This new mechanism enables users to trade from the comfort of their L2 account, gas-free: they can lend money on Aave and Compound, invest in YFI or Harvest, or become an LP on Uniswap, Balancer, or Curve.

A Stepwise Flow

Let’s take one simple DeFi operation: Investing in the USDt yVault.

The participants are:

Traders/Users/End Users
Alice, Bob, and Carol are traders with funds on L2

Off-chain
An Operator, and the StarkEx System that powers their service

On-chain

  • The DeFi destination (E.g. yUSDt Vault)
  • The StarkEx smart contract
  • The Broker Pool: a new on-chain smart contract that coordinates demand from the StarkEx contract, manages ownership in the pool, and transacts with DeFi on its behalf.

In the example above, Alice and Bob want to deposit to YFI and Carole wants to withdraw from YFI. Alice and Bob can be matched against Carole, and only the difference is transacted on-chain.

From Alice and Bob’s perspective, DeFi Pooling is a two-step operation. They:

  1. Swap their USDt against shares (e.g syUSDt) that the StarkEx Operator minted from the Broker Pool.
  2. Swap back syUSDt for yUSDt.

Step I: Demand Aggregation

  1. Broker mints Pool shares (e.g syUSDt)
  2. Broker sells them to traders, using an L1 Limit Order (see description below)
  3. StarkEx settles the share purchases on-chain

Step II: Pool Activation

  1. Broker withdraws the pool’s funds from the StarkEx smart contract.
  2. Broker deposits the funds to DeFi Vault (e.g. yVault)
  3. Broker receives LP tokens (e.g. yUSDt) in return.
  4. Broker creates an L1 Limit Order, offering LP tokens for Pool shares (e.g. syUSDt).

Step III: L2 Traders Receive Their LP Tokens

  1. L2 Traders swap shares (e.g. syUSDt) for LP tokens (e.g. yUSDt).
  2. Broker burns shares.

Step IV: Rebalancing — The Cherry on Top

As one may have noticed, a strategy is represented off-chain as a token. Rebalancing, for example from yUSDt to yETH, is as simple as finding another trader to swap with, all conducted in a gas-free environment.

What’s Missing? L1 Limit Orders

What is missing to support DeFi Pooling on StarkEx? Limit orders on L1. StarkEx has three native operations: Transfer, Conditional Transfer, and (L2) Limit Order. In the upcoming StarkEx V3, we will support L1 Limit Order, enabling smart contracts on L1 to submit a trade on L2. This is the missing piece to support DeFi Pooling.

Conclusion

To bring back DeFi’s primary goal of financial inclusion, we need to offer massive scale and lower gas costs. DeFi Pooling is such a solution. It is the DeFi equivalent of taking a commercial flight instead of a private jet. If DeFi wants to scale to the next 10M traders, this is the way to go.

Louis Guthmann

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store