Sommelier Finance, What is it All About?
A Guide to Liquidity Pools, AMM and Portfolio Rebalancing
Just as the Sommelier website puts it: "Sommelier is a bet that Ethereum will be a dominant player in the global economy". What problem will Sommelier solve and would anyone think that Ethereum will be a dominant player in the global economy? In this article I'll explore Liquidity pools, why it is necessary, it's problems and Sommelier's solution to Liquidity pools problems.
How Liquidity Pools Work
Liquidity pools in layman terms can be said to be a basket of digital funds. It is a collection of tokens, locked in a smart contract. To understand the purpose of liquidity pools in DEX (Decentralized Exchange), let's understand the concept of market makers and market takers.
In traditional market, for exchange to occur there has to be a buyer and a seller. What happens is that an order book is used to match buyers with sellers, so that when the conditions of a buying or selling order are met, the buyers are connected to the seller. However, people can do more than HODL to their tokens without selling them. For instance, people can get more crypto with their crypto by engaging in yield farming , staking etc. To do this, a liquidity pool is required. Liquidity pools use AMM, to understand AMM (Automated Market Maker) and liquidity better, let's understand the concept of market makers and market takers.
The market makers make buying or selling orders that are not carried out immediately. For instance, a market maker can place an order to buy ETH
when the price hits $10k. while market takers are interested in trading instantly, so they make orders that are executed instantly. However, the problem with the market maker and taker system is that makers who make the market are charged to put up their buying or selling order in the order book or via p2p.
In liquidity pools, there's no order book or peer-to-peer exchange. If there's no order or peer-to-peer exchange, how does exchange occur in the liquidity pool? Liquidity pool makes use of the Automated Market Maker (AMM) system. Liquidity pools tend to solve the incurring cost for market maker. Market makers don't have to incur costs for putting liquidity into the market. Market makers can now earn more crypto by putting up two pairs of tokens into the liquidity pools. Since liquidity in the liquidity pool are not sold users, they don't incur fees, rather they get paid for contributing a pair of their digital coin to the liquidity pool.
Since there's no seller at the other end of the exchange, how are transactions completed? Who's in charge of making the selling price of liquidity? This is where AMM comes into place. AMM is a decentralized DEX protocol that relies on a mathematical formula to price assets. Instead of communicating directly with a seller via peer-to-peer or with an order book, the buyer communicates with a smart contract which is the protocol that executes AMM.
Although the concept of liquidity pool is to allow market makers earn while keeping liquidity in circulation, this is not always the case as market makers may loose funds instead of gaining funds by keeping their assets in the liquidity pool. Let's look at some of the problems with liquidity pool and how market makers can loose funds.
The Problem with Liquidity Pool
One very common loss in the liquidity pool is known as impermanent loss. This loss occurs because of fluctuation in the price of tokens put into the liquidity pool. Let's look at how the AMM works and how portfolio rebalancing works in the liquidity pool.
Most AMM uses the x * y = k pricing algorithm where x is the amount of one token in the liquidity pool, and y is the amount of the other token in the liquidity pool. For instance, if we have 10 ETH
which costs 100 USD
each and 1000 DAI
each costing 1 USD
, with the *x y = k* algorithm, we have 10,000 liquidity in our pool. If a user A
puts 1 ETH
and 100 DAI
into the liquidity pool, they automatically own 10% of the pool. However, if the price of ETH
goes from 100 USD
to 400 USD
, arbitrage traders will swap DAI
for Ethereum to balance the portfolio. As this goes on, the percentage of ETH
reduces while DAI
increases until the ratio reflects the current price and there's an even pair of ETH
and DAI
. If the amount of ETH
and DAI
in the pool are now 5 and 2000 respectively, user A
can decide to take back their funds from the liquidity.
Since user A
is still entitled to 10% liquidity in the pool, user A
goes home with 400 USD
. However, if user A
had held on-to their liquidity without putting it into the liquidity pool, she could have had 500 USD
with the current market price. This, is a type of impermanent loss. If the price of ETH
or DAI
falls, user A
could've lost more.
Sommelier's Solution to Problem
Instead of relying on arbitrage traders who will buy off assets at low prices for portfolio rebalancing, Sommelier allows Liquidity providers to rebalance portfolio, limit orders, batched orders and monitor their assets so that they don't incur impermanent loss. It does this by automatically rebalancing your portfolio whenever there's a change in the market.
Sommelier uses the oracle nodes to detect when a liquidity pool is at risk of impermanent loss. Then, it can automatically rebalance portfolio by pulling those excess tokens out of the liquidity pool and into custody provided by a Cosmos validator set.
Conclusion
Impermanent loss as the name implies can be revoked. For instance, if the price of liquidity goes back to the price it was when the liquidity provider put them into the liquidity pool, there's no loss.
The liquidity pool system is a more appreciated system compared to the order book system or p2p system. This is because not only can you trust the AMM to execute transactions, you also get paid for putting your assets into the liquidity pool.
Not only does sommelier provide portfolio rebalancing and monitoring, it's built on the cosmos-sdk , giving it a more secure and flexible engine.