Primitive Replicating Market Maker ("RMM") is a supply source for tokens and option derivatives*. Existing as a free, unchangeable, and unowned protocol, RMM is the purest form of decentralized infrastructure.
Anyone has the freedom to provide capital to the RMM pools and earn fees, providing a service of filling the other side of token trades, and eventually option trades. There are no gatekeepers, no pausing (i.e. circuit breakers), and markets run 24/7.
By the end of this primer, you will have a better understanding of using the protocol to hedge risk or take advantage of time-based strategies as a market participant. There are concrete example scenarios to help you grasp the different nuances present in the protocol.
Read more to learn about the primitive behind the magic.
*Replicated option derivative payoffs, not option contracts. "In layman’s terms, replication is four fives for a twenty: they behave exactly the same (they’re each worth twenty dollars), but they look completely different (one is four pieces of paper, the other is one piece of paper)". There are no promises the payoffs will be received.
This primer assumes a basic knowledge about decentralized exchanges, token trading, and popular protocols like Uniswap, Curve, and Balancer. Token trading is the most fundamental backbone to decentralized finance - enabling more markets like lending and derivatives.
Without knowing anything about these protocols in the chart, it goes far to know that the majority of them rely on the same "idea", and together they make up almost all of the token trading activity on Ethereum.
This section is a brief overview on how these dexes work and how they can be used for token and option trading.
Constant Function Market Maker ("CFMM") based decentralized exchanges (e.g. Uniswap, Curve, Balancer) facilitate the lion's share of on-chain token trading volumes. The success of CFMMs as spot markets can be attributed to several crucial properties that they all share: ability to support any token pairs, high degree of capital efficiency, predictable behavior, and a relatively straightforward user experience. At a high level, CFMMs facilitate trades between two counterparties, "traders" (users that swap one token for another) and "liquidity providers" (users that make their tokens available for trades to earn fees).
Traders are users that own one token (e.g. ETH) and demand another (e.g. USDC). Traders swap assets on a CFMM by sending transactions specifying some amount of tokens for other tokens, less a small fee. The average price a trader pays is dependent on both the ratio and amount of tokens in the pool prior to the swap (e.g. 100ETH/100,000USDC), the trade size (smaller swaps beget a better average price), and the trading function (we'll get to this later).
On the other side of this trade are the liquidity providers. Liquidity providers add two tokens to a liquidity pool contract. This liquidity contract accepts transactions swapping from token A to token B and token B to token A. Whenever traders execute swaps from either direction, liquidity providers collect fees proportionally based on their provided tokens compared to the total tokens in the pool.
From a high level, tokens are made available by market participants to be the other side of trades for users who want to swap their tokens. The tokens available are implictly priced by a rule, called the trading function, which comes from basic math. This technology works exceptionally well on networks like Ethereum because it automates the process of supplying tokens to the other side of trades; a reason they are often called Automated Market Makers ("AMMs").
In this section we will dig a bit deeper into what it means to provide liquidity to a CFMM, as well as how/when you might want to do so.
The final payoff of a liquidity position on a CFMM is determined by the trading function and the asset's price path. Price path is taking into account the prices that the asset has reached over a time period. There are unique price paths along which providing liquidity to a CFMM can be advantageous or disadvantageous. Say, for example, your portfolio (a liquidity position) has 1 ETH and 0 USDC. If the price of ETH doubles, your portfolio value will also double.
In the case of the ETH 2x price path, if you had provided liquidity to a CFMM that demands an equal weighted (50% ETH, 50% USDC) portfolio, you would have suffered what's known colloquially as "Impermanent Loss" (opportunity cost) by not capturing the full increase in ETH's price because the portfolio was not 100% exposed to it. This phenomenon occurs because as the price of one asset in a CFMM pool increases, LPs are effectively buying the cheaper asset (in this case USDC) on the way up. You would've profited in the end, but you would've missed out on that sweet sweet 2x.
So when does providing liquidity to a CFMM work to your advantage? The strategy name for adding liquidity to a CFMM which maintains a constant portfolio weight of an amount of assets is "mean reversion". A mean reversion strategy wants the prices of the token pair in a liquidity pool to be correlated in the medium run. In the ETH 2x case described earlier, in order to obtain the optimal terminal payoff the price of ETH would have to drop 50% to that at which you had initially added liquidity (hence the name, impermanent loss).
Providing liquidity to a CFMM creates a portfolio that is implicitly long a mean reversion strategy where price variation works in your favor so long as the prices of the assets revert to that which it was originally.
Before getting back to CFMMs, let's walk through a brief primer on call options. A call option gives the right to purchase an asset for a pre-determined price up until an expiration date. These properties of an agreed upon price and expiration date give the call option itself its own value, beyond the underlying asset. To own a call option in traditional markets, it is purchased from another party on an options exchange.
The party selling (shorting) a call option is liable to sell their assets if the option buyer chooses to exercise, (buy the asset for the strike price). In traditional exchanges, most of these assets do not need to be put up as collateral because the terms of the option contract are legally enforceable. However, in DeFi, there is no way to enforce the delivery of the underlying assets, unless they are already deposited. It's for this reason that call options in DeFi are collateralized, and this combined position of selling a call option + depositing the collateral is a covered call option.
Earlier in this article we discussed how CFMM liquidity maps onto a unique payoff structure (mean reversion). Likewise, covered call options offer their own distinct payoff structure.
Covered call strategies and mean reversion are similar in that they both offer what's called a "concave payoff". To summarize, a concave payoff is a payoff that has a discrete central barrier at which returns are maximized (see above graph).
In the case of a call option, that barrier is located at the strike price (K). That is to say, the max payoff for a party selling a call option is obtained if the price of the underlying is equal to exactly K at expiry. Similarly, the max payoff of a CFMM liquidity provider is obtained if the price of the underlying token reverts to its initial price.
The important difference between these two strategies is rooted in the fact that covered calls allow you to take a directional view on future price. Choosing a strike price greater than the market price of an asset implies a directionally bullish opinion on the asset price.
RMM curves value pool assets based on price, volatility, and time. It is these properties which make RMM a new primitive.
RMM curves with different implied volatilities will have different costs when swapping. Trading in a higher IV curve will lead to a higher price of the asset being purchased, while trading in a lower IV curve is the opposite. This will affect the external arbitrageurs who only rebalance pools when it is profitable to do so - there must be a larger profit opportunity in higher IV pools to warrant a rebalance. This has the consequence of affecting the fees that will be generating, as less rebalancing means less fees.
If only time changed, the curve also experiences "Liquidity Compression" until trades can be executed at a fixed cost equal to the strike price. This compression is sometimes described as "concentration around the strike price", as the price of the asset is constant and equal to the strike price as expiration.
The distance between the curves with a lot of time until expiry and zero time until expiry is equal to the total fees expected to be earned by the liquidity provider. This does depend on the implied volatility and swap fee of the curve, as these parameters impact the probability of capturing the expected fees.
Primitive RMMs benefit from the same properties present in other CFMMs, but with the distinct advantage of being able to express more nuanced opinions about future price.
These are some of the additonal benefits you can see from using RMM in lieu of other CFMMs:
With RMM you're not limited to mean reversion strategies. Instead, you can deploy a position that expresses a directional view on the future price of a token. Doing so requires thoughtful strike price (K) and expiry (τ) selection. For example, if the price of ETH is 3000 USDC, but you believe that one month from now that price will be 4000 USDC, you can express that view by providing liquidity to an RMM that expires in one month (τ = 1 month) with a strike price of 4000 USDC/ETH (K = 4000 USDC). This position has the highest expected return if the price of ETH reaches a terminal value of 4000 USDC at expiry. The caveat to this is that if you're incorrect about the price path, for example if ETH goes to 2000 USDC in that same timespan, you are exposed to greater impermanent loss and will likely make less fees relative to a comparable xy=k position (how about hedging with another RMM?).
How about that volatility (σ) thing? In general, a volatility near the market IV (just check the chain) for a given pair should serve as a good proxy for volatility selection. Volatility in an RMM prescribes the degree of liquidity concentration around the strike price. If the strike price of the curve is set to 4000 USDC, a 100% position will have less concentrated liquidity at 4000 USDC versus a 90% one. That means the 100% position would likely earn less fees than the 90% one, should the terminal price at expiry land at 4000 USDC. The tradeoff here comes in the form of greater impermanent loss for lower volatility positions.
Every liquidity token minted from depositing into a CFMM has a payoff. For RMM, the liquidity token payoff is a covered call.
The method to convert this payoff into the trading function is explained in the Replicating Market Makers paper. Primitive's RMM protocol is an implementation of this.
Covered calls are inherently directional bets which are best to take advantage of in high volatility environments. It is ideal to provide liquidity when the underlying asset's volatility is high, and the expected price of the asset will not exceed the strike price by expiration.
Each RMM Pool is a "theta curve" with the following set of parameters:
gammawill be 99%. Each swap must pay the trading fee to the liquidity providers, which gets automatically re-invested into the pool.
On January 10, 2022, Alice notices the volatility of YFI has increased sharply since announcing their new tokenomics plan. The coin trades at $32,000 right now, and Alice believes it won't exceed $100,000 by March. Alice also believes it can double in value to $64,000 by then. She wants to take advantage of the volatility and price movement, so she provides liquidity to an RMM that expires March 11, 2022, with a strike price of $100,000 and implied volatility of 150%.
The amount of value in stable units (e.g. $) of liquidity that Alice must provide is calculated using the Portfolio Value formula:
Notice how the value of the covered call is just the current price less the premium. E.g. S - C = V(S), $32,000 - $1,132 = $30,868.
Therefore, liquidity is being efficiently used to "back" these tokens that have the payoff of a covered call. When compared to covered calls issued on other option protocols, full collateralization is required, sometimes even locked, to mint the call tokens. Going further, these LP tokens are instantly redeemable for their underlying assets at any time, which makes it a strong collateral asset. Using the LP token as a collateral asset to leverage a position is capital efficiency increase that RMM is capable of supporting - but that is left to a future primer.
Let's say assumptions proved right for Alice, and three months later YFI is trading at $77,000 with implied volatility over the period being effectively realized. The most important assumption here is the choice of implied volatility (IV). If the realized volatility of the underlying asset diverges from the choice of IV, its possible the replication is not as precise. In that scenario, Alice would have been better off moving their liquidity a lower IV curve. But, because RV was close to IV, the replication was very precise and Alice got the expected payoff. This is a critical choice that is being made when liquidity is provided.
The pool has eclipsed its expiration timestamp, and Alice decides to exit her position. Assuming the pool had sufficient liquidity to attract traders and arbitrageurs, the trading fees and final swaps should cause the pool to be 100% composed of YFI.
This is because the underlying assets in an expired RMM pool can be bought or sold for the strike price. This will incentivize traders/arbitrageurs to purchase all the underlying assets from the pool if the price of asset (e.g. on another dex) is more than the strike price. In the opposite scenario, traders/arbitrageurs will sell as much underlying assets to the pool until the pool only has underlying assets in the if there exists a reference price of the asset that is less than the strike price.
Alice took the risk of redeeming $100,000 if YFI's price was above that by expiration date. In exchange, she is rewarded with the 3.73% gain in YFI. This extra return denominated in the asset also led to an overall higher return when denominated in a stable coin. Notice that YFI's price increased by 240% and Alice's position increased by 250%, 10% more.
Alice loves using RMMs, she made a strong risk-adjusted return and felt confident in the security of the protocol.
She continues to believe that in 3 months YFI will not be above $100,000, so she decides to enter in a new position.
Unfortunately, this time Alice was wrong. Its June 21, 2022 and YFI is trading at $135,000. What happened to her deposit?
While Alice did get a good return in $, if she wanted to earn a return denominated in YFI she would have been better off to hold all of her deposit in YFI. The actual price of YFI was more than the strike price of the pool, $35,000 more, which incentivized arbitrageurs to buy all the YFI from the pool at a price of $100,000. The pool is then 100% composed of $, which liquidity providers like Alice eventually withdraw.
In the opposite scenario, If YFI's price was below $100,000 at the maturity:
And what was the belief/purpose of providing liquidity to RMM?
In short term bearish environments, like a prospective FOMC meeting, prices are dampened and volatility is heightened. This is an optimal time period to take advantage of RMM. By providing liquidity, the exposure to the underlying asset will be maintained assuming the strike price is high enough, and higher volatility will warrant higher fees (if the liquidity is there).
In comparison to a CFMM like Uniswap, any price change in the underlying asset which does not revert to the initial entry price will miss out on potential gains (opportunity cost) from the asset, while RMM pools will only miss gains on the asset if the pool expires "in the money"; when the market price of the asset is above the strike price of the pool.
On the other hand, this opportunity cost in Uniswap would be in the LPs benefit in the scenario the underlying price fell off a cliff. In that scenario, the RMM LPs will be left holding 100% the underlying asset, which could potentially go to zero.
This directionality is not available in any AMM curves because those curves are not aware of time or strike prices.
Hedging options is called a dynamic hedge because it is a position which counters another position's greek exposures. Greeks are planned to be explained in a future option primer, but for now they can be thought of as symbols to represent the change in the option's value depending on price, volatility, or time. For example, if an option changes value because of time (theta), the dynamic hedge will also change by the same magnitude from the same change in time.
An option's value is derived in part from the underlying asset's price. The greek symbol
delta is used as a quantitative metric for how much value the option's value changes when the underlying asset's price changes. Going further, the greek symbol
gamma is the metric for how much the
delta changes when the underlying asset price changes. Gamma exists for options because if the underlying asset price gets closer or further away from the strike price, there is more/less probability the asset price will be above the strike. If the option is not above the strike by its maturity date, then it's worthless. Therefore,
delta is sometimes used as a proxy for the probability of being in the money. Gamma is one of the primary reasons options are such a popular instrument, because purchasing gamma (buying the call option) is cheaper (but has the same returns) as purchasing delta (buying the asset).
Call options have a positive gamma, which means a hedge cannot only be in the underlying asset (which has no gamma), it must be a negative gamma position. Uniswap liquidity tokens have negative gamma, but it's not a straightforward hedge for a call option because it does not match its gamma.
RMM liquidity tokens replicate a covered call payoff, which means its close to a perfect hedge (almost) for calls. Along with that, it's negative gamma so it can be used to hedge other gamma positive positions.
Why hedge a call option with a short call option? A rough example of an opportunity is if call options on another protocol are underpriced, they can be purchased and then hedged with an RMM liquidity position, capturing the difference in premiums.
While these are the expected results of providing liquidity to RMM, its entirely possible that no fees are generated at all. However, in that case it would mean the pool's liquidity is not rebalanced. This might end up in the LP's favor anyway. For example, if no trading occurred in the pool Alice deposited to, and thus no fees were generated, the initial deposit would be the same. At that point, she'd be withdrawing some YFI along with the $, rather than only $.
A no trading fees scenario occur for several reasons:
Yes. RMM protocol contracts have been audited by five security firms, making it one of the most audited set of smart contracts in DeFi (if not the most):
While these audits give high confidence in the protocol's security, the smart contracts still have the possibility of containing bugs. Along with the audits, Primitive has a $1,000,000 bug bounty on Immunefi, and $10,000,000 of coverage by Sherlock.
Primitive RMM is a highly composable primitive for DeFi that will bring more liquidity to on-chain options. Liquidity tokens can be used as a collateral asset in lending and derivative protocols, increasing the capital efficiency and usage of the underlying tokens.
RMM protocol fixes the poor liquidity environment for on-chain options and it's going live in a couple of weeks. You in?
Visit the website here: primitive.finance
Follow Primitive on twitter.
Frequently answered questions: FAQ.
Community Discord: Discord.