5 Lessons Learned in Liquidity Mining

Alchemist
Alchemist
Published in
6 min readJul 21, 2021

--

This article was first posted on thegostep medium. View the original post here.

Today, the Ampleforth project is releasing version 2 of its Geyser liquidity mining program. This release builds on the lessons learned over the past year of liquidity mining.

The first version of Geyser marked a turning point for the Ampleforth project and placed it at the top of the uniswap liquidity charts throughout defi summer 2020. V1’s innovation above existing liquidity mining programs included the introduction of reward multipliers and support for rebasing tokens.

I joined the Ampleforth community around the time Geyser V1 was released. The idea of having a unit of account which acts independently of the underlying ownership distribution is what got me hooked. I got to know the team and was impressed with the technical depth with which they understood defi and the foresight they showed in predicting how the ecosystem would evolve.

I decided I wanted to help out, and the lowest hanging fruit was to improve upon the Geyser program. Luckily for me, defi summer provided a plethora of lessons to learn from.

Lesson 1: not your contract, not your crypto

With defi summer came the concept of the rug pull. While you could probably come up with a rug taxonomy, many of the rugs we saw were rooted in a single fact: liquidity mining programs require users to transfer their tokens into third party smart contracts.

This is a security nightmare. Depositing non-trivial percentages of ones net worth into a smart contract written by a couple anon in a few became the norm for the so called degens looking to farm some vegetable coins.

“There must be a better way” — thought thegostep as he deposited his life savings to farm some yams

In theory, liquidity mining programs don’t need you to deposit LP tokens into a contract. All they want to know is that the LP tokens remained in your wallet throughout the period of the reward program. This implies rug pulls are really a wallet bug. That is, if wallets provided a way to prove that certain tokens were in the wallet over a given period of time, rug pulls would not be possible.

Luckily for us, there is exists such a thing as a smart contract wallet which enables implementing such arbitrary logic. Geyser V2 introduces a “Universal Vault” standard which provides a standard interface for locking and unlocking tokens in the wallet. This means tokens never leave the custody of the user. Say hello to the first non-custodial liquidity mining platform.

interface IUniversalVault {
function lock(address token, uint256 amount, bytes calldata permission) external;
function unlock(address token, uint256 amount, bytes calldata permission) external;
function rageQuit(address delegate, address token) external returns (bool notified, string memory error);
}

Lesson 2: liquidity is not mutually exclusive

The second lesson I learned in defi summer is that of capital efficiency. For some reason, defi developers seem to dismiss it outright. In my opinion, capital efficiency is one of the major challenges defi has to overcome in order to compete with tradfi.

If I am holding ETH/AMPL sushiswap LP tokens, there is no reason I should be forced to pick only one of the sushi or ampleforth or pickle or any other reward program which targets this pair. I should be able to collect the liquidity mining rewards for all these programs at once! Unfortunately, since reward programs usually require the users to deposit the tokens, it’s impossible to deposit into multiple programs at once, thus bad capital efficiency.

Universal Vaults make this capital efficiency possible. Since reward programs no longer require the user to transfer tokens out from their wallets, the tokens can be locked in multiple reward programs simultaneously.

A small win for capital efficient yield farming.

Lesson 3: liquidity mining is great for token distribution

Many think of liquidity mining as a cost of business: I need to distribute X tokens to offset Y impremanent loss. In my opinion, this underutilizes the power of liquidity mining. To me, liquidity mining is a highly effective way to distribute any cashflow to token holders who are passively providing value to the project through liquidity provision.

The challenge is cashflows can come from multiple sources and take the shape of multiple different tokens. A few important examples are the Uniswap, Balancer, and Sushi airdrops. If the liquidity mining program is not architected correctly, these airdrops could be permanently locked in the reward program at the expense of the user.

Ideally, we would want these token distributions to be able to piggy back on an existing reward distribution and automatically be distributed to users.

With Geyser V2, tokens are only ever held in two places: 1) the user’s universal vault, 2) the geyser’s reward pool. Any tokens airdropped to the universal vault can immediately be withdrawn by the user and any tokens sent to the geyser’s reward pool can be distributed through the geyser alongside the base reward token!

Lesson 4: NFTs + defi is under-explored

People generally associate NFTs with artwork or rare collectibles. However, people don’t realize NFTs are pervasive in tradfi. They form the basic building blocks of what is called structured financial products. At it’s core, finance is all about the bundling and unbundling of risks and cashflows to create investment opportunities that meet the objectives of the buyers. Defi is no different. If we want to automate the financial system, we need to build composable primitives which can easily be bundled and unbundled.

Lets take uniswap v2 and v3 as simple examples. In uniswap v2, all liquidity positions on a given pair are homogeneous. This means all the liquidity is bundled into a single pool (an NFT), which is then fractionalized into fungible components (an ERC20). In the case of uniswap v3, liquidity position target specific price ranges, and are thus heterogeneous. The liquidity is bundled into a single pool (an NFT), which is then configured to target a specific subset of the price curve (an NFT). Any such financial position can be bundled to form an NFT and then fractionalized as an ERC20.

Geyser v2 brings this bundling to liquidity mining. Since all LP tokens are held in universal vaults and the vaults themselves are subscribed to the reward probrams, the ownership of the universal vaults can be modelled as an NFT. Specifically, an NFT which holds ERC20s that represent fractions of NFTs that represent a pool of ERC20s which are collecting ERC20 cashflows.

Now I wonder what happens if we were to fractionalize universal vaults…

Lesson 5: test in test != test in prod

Smart contract security is what got me into ethereum. The history of smart contract security has been a rollercoaster ride with very very very expensive lessons learned. The discussions around smart contract security usually circle around: security audits are not worth the digital paper they are written on, or state richness makes it impossible to unit test effectively, or real economic incentives are required to effectively model agent behavior. A lesson that I see the community has not yet embraced is that test in test and test in prod are meant to work hand in hand.

I think more teams should consider doing beta mainnet deployments which enable the full functionality of the system, but where the stakes are lower than with a full release.

The Ampleforth project worked with the Alchemist project to test the Geyser V2 smart contracts in prod which allowed the identification and mitigation of two critical bugs which could lead to user funds being locked / stolen. I see this kind of partnership between projects as a natural step towards more secure open source defi ecosystem and would advise other projects to take a similar approach to security.

Wrapping it all up

We all know by now, it’s the open source, permissionless, and composable nature of defi that sets it apart from tradfi. The nauseating speed of iteration allows for these crazy experiments to keep getting better and better. The innovation in liquidity mining is far from being done.

If you are interested in joining a growing ecosystem of interoperable, capital efficient, and secure liquidity mining programs, consider joining Ampleforth and Alchemist in using the Universal Vaults architecture and benefit from pooling liquidity across projects.

Ampleforth Geyser
geyser.ampleforth.org

Alchemist Crucible
crucible.alchemist.wtf

--

--