Itos Finance

The 2sAMM

Our next generation AMM offering dual curve positions.
What is Automated Market Making?
Automated Market Making is an on-chain strategy some people use to earn income on their tokens. They deposit a pair of tokens into a smart contract and the smart contract uses them to make a market so other users can trade back and forth against the deposits. In return, the traders pay trading fees which goes to the token depositors. We call these token depositors liquidity providers.
The more trading activity there is, the more fees are paid to the liquidity providers (LPers). These fees are distributed pro-rata to the LPers so that everyone earns the same percentage returns. These returns are quoted as an APR and referred to as yield.
Generation 1: Constant Product AMMs (Full-Range)
Exactly how AMM smart contract decides the price traders get to trade is depends on the algorithm it employs. The most popular algorithm is the constant product. It defines the formula
xy=L2x * y = L^2
are the two token amounts. When someone trades against the pool, they give and receive tokens that keep
the same.
For example, if you have 100 of token Y and 1 of tokenX, then the constant they always multiply to is 100. If someone wants to sell 0.1 of token X to the pool, the pool would have 1.1 X afterwards. Since we always multiple to 100,
y1.1=100y * 1.1 = 100
y=1001.1=90.9y = \frac{100}{1.1} = 90.9
. So they get 9.1 of token Y in return for their 0.1 X.
It's a very convenient and simple algorithm for making a market and it also captures the idea of price impact. The more of X there is in the pool, the cheaper X is. If the pool holds more Y than X, then Y becomes cheaper.
This is often termed V2 LPing, as in Uniswap V2 which popularized this type of automated market making.
In our example, if someone traded an really small amount of X, they would have traded at a price close to 100 which is
. But the more X they sell the further the price gets pushes down. For our 0.1 X, we sold at a price of 91 and got 9.1. If someone tried to sell 1 whole X, they would have executed at an effective price of 50. We call this slippage. The more tokens there are in the pool, the smaller slippage becomes.
There is risk that comes with this. Let's say token X is Ethereum and token Y is USDC, and we care about growing our portfolio in terms of USDC.
Then as the price of Ethereum drops the value of our positions also drops, but if the price of Ethereum goes up, we don't actually get as much profits as we would have, had we just held ETH. This is because we're the ones being traded against, as the price is moving up, people are buying ETH away from our deposit. This is the basis of what people term Impermanent Loss.
Here is the payoff graph displayed explicitly:
Compared to holding the ETH and USDC you had at the start, all that red region is the profits you would miss out on. However in return, you get to earn trading fees. So V2 LPing is a balancing act of getting enough trading fees to compensate for your missed profits, a.k.a. Impermanent Loss.
Some people don't care about the profits they missed out on and just see LPing as a way to earn passive income. In that case they just care about profits and losses compared to the value of their position at the start which is called Real PnL. If we compare that way, the payoff graph looks like this:
Here the payoff is more palatable. The profits are a little more muted than losses, but that's okay if the yield is high enough.
Generation 2: Concentrated Liquidity AMMs
The standard concentrated liquidity curve also follows this
xy=L2x * y = L^2
curve, but instead of supporting the pool no matter what the ratio of X to Y there is, you can choose to just provide liquidity between two specific ratios, this is the price range you're added concentrated liquidity to. This let's you earn fees in a very specific region and deposit much fewer tokens.
The beauty of concentrated liquidity is the capital efficiency. With Generation 1's V2 full-range liquidity, you're only earning fees from the tokens you have that participate in the trade. Relative to the entire deposit, very little of your tokens are participating in the trade and thus your APR is relatively low. By concentrating, a much higher precent of your tokens participate in the trading activity and the deposit earns a much higher return.
However, this also poses more risk to the user. More of the users tokens are traded away. The equation for calculating what is traded away is design such that by the time you right one edge of the price range you have traded away all of the more valuable token and are left holding the less valuable token. This exposes you to more losses than un-concentrated liquidity provision.
Below is the equation for concentrated liquidity where
is the lower price and
is the upper price bound. Knowing the exact details of this equation is not required to use it. It's simply designed so that within the price bounds you've chosen, the AMM uses your position as if you had deposited in an
xy=L2x*y = L^2
pool. Outside of the price bounds your position is not used at all, and thus earn no fees.
Here is an example payoff from concentrating liquidity from 1600 to 2500.
And the Impermanent Loss graph looks like this:
And the Real Loss payoff graph is as follows.
Hence you expect more losses regardless of the method of accounting you prefer, but in return you earn much higher fees. This was the previous state of the art design. You can often earn more than ten-fold the APR of un-concentrated liquidity by concentrating but it required frequent management to use profitable.
The usual advise was to rebalance when the position goes past your price range. Rebalancing meant withdrawing your position and re-centering it around the new active price. In reality this was not always a good idea and the best way to profitable provide concentrated liquidity is still a hotly debated topic. Results indicate that more than 50% of positions were better off just holding their tokens, meaning they lost to IL.

Generation 3: The Two-Sided AMM (2sAMM)

What follows are the details of our AMM's improvement upon Generation 2. But also know that the full capability of the platform is what happens when you combine the 2sAMM with the Portfolio Manager.
At a high level, the 2sAMM is composed of two sides, the liquidity providing side and the liquidity taking side. The liquidity providing side is identical to a Generation 2 AMM except for the additional time premium it earns its depositors. The liquidity taking side introduces the concept of Automated Market Taking. The liquidity taking side can be thought of as an opposing curve, that always trades against liquidity providers. On this page we will focus on the liquidity providers, more details for liquidity takers are found on Automated Market Taking.
Liquidity Depositing: Automated Market Making
Liquidity depositing is how users earn yield on Itos's 2sAMM. They earn yield from two sources, trading fees and lending fees.
Besides the fees, all other details are identical to Uniswap V3's AMM. Both generation 1 and generation 2, full-range and concentrated liquidity positions can be opened. Users deploy liquidity in the way they like and earn fees in return. They are exposed to the same risk profiles (see the previous sections for those payoff graphs) as before.
Once we discuss the portfolio manager, we can create safer ways to liquidity deposit by making hybrid positions that are a combination of market making with LPs and market taking with Takers.
In summary, liquidity depositing has not changed, however the fees it earns does. We'll discuss those in their own section.
Liquidity Taking: Automated Market Taking
Liquidity Taking is how users buy convexity on the Itos platform. This allows them to achieve options-like payoffs with high leverage in a perpetual manner by paying a funding rate.
We'll go into more details about liquidity taking in the Automated Market Taking page. For now, the only important detail to understand is that market taking reserves liquidity away from a certain price range. Liquidity Taking also specifies its own price bounds
along with how much liquidity it wants to reserve.
That amount of liquidity is removed from the trading pool and cannot be used to market make. But when there is a swap that would have used the reserved liquidity, the Taker position pays the fees the reserved liquidity missed out on. This guarantees the reserved liquidity still earns the same APR as it would have by staying in the pool. If the liquidity would have earned no trading fees, then the Taker does not pay any as well.
Additionally, the Taker position also always pays a borrow rate on the liquidity it has reserved. The token amounts underlying the borrowed liquidity is calculated, and up-to-date borrow rates are queried from a money market. Those rates are charged towards the Taker and the rates are updated every time the pool is used.
Afterwards the reserved tokens are simply left unused. They are held so the taker can utilize them at a later date. Because of this, the Taker actually offsets some of their cost by depositing those unused tokens in the aforementioned money market to earn the lending rate.
These are all the details needed to get a basic understanding of how the Takers contribute to the fees earned by liquidity providers.
Trading Fees
Similar to Uniswap V3's design, every time there is a trade the trader pays a fee. A small percent (currently 5%) of trading fee is deposited into the protocol to help fund its operation and growth. The rest is split pro-rata amongst all in-range liquidity providing positions (colloquially called Makers).
Unlike UniswapV3 however, the fee rate is dynamic (look forward to a technical deep dive on the economics of this on our blog). The fee rate scales according to the ratio of liquidity reserved by Takers to the liquidity provided at a given price. For example, if there is no liquidity reserved away at the current price then the lowest possible fee rate is paid (currently 0.01%). If half of the liquidity provided is reserved away then a higher fee is charged (currently 0.5%), and if all liquidity is reserved then the fee caps out at 5%. In practice we never want all the liquidity to get reserved, so we cap the amount that can be reserved to something like 70% depending on the volatility of the pool.
Here is an example fee rate curve:
This has the nice property of automatically raising fee rates when the market becomes volatile, thus compensating liquidity providers more for their potential losses; and lowering fee rates when the market is calm with little price action to encourage more trading. Sometimes lower fee rates with more volume can earn more total fees than higher fee rates, it all simply depends on market volatility.
This means there is no need to fragment liquidity in multiple pools with different fee tiers for a single token pair like Uniswap does.
The short reason why this fee design works is because the Takers tell us about implied volatility. If the fee rate is too low, then it is profitable to open a Taker which then raises the fee to something more fare. If the fee rate is too high, then Takers will close to positions thus dropping it back down. This lets the market naturally find a fee equilibrium.
Time Premiums
Time premiums are what Makers (liquidity providers) earn from having their liquidity borrowed. Liquidity positions are not matched one-to-one with Takers who want to borrow liquidity. Instead the borrow is split pro-rata amongst all liquidity positions who share the Taker's range. For example, if 50% of a range's liquidity is borrowed, and the current money market borrow rate is 5%, then all same-range liquidity provisioning positions earn 2.5% on the liquidity in the Taker's range.
When doing this accounting, we try our best to ignore a position's out-of-range liquidity to ensure proper compensation to just the utilized liquidity. However, calculating this exactly is extremely gas intensive so instead we do an approximation. The approximation is still very advanced but much less gas intensive. In fact, the approximation is accurate in most real world scenarios and only breaks down when there is a significant disparity in Taker borrow utilization for two neighboring prices. This is incredibly unlikely as such a scenario will be arbitraged away. Thus we expect our accounting to be accurate in practice. We'll be closely monitoring to see if this is not the case.