In the real world, everything is priced based on the law of supply and demand. And we dont even need to calculate the prices! Previous Multiple Fee Tiers Next StableSwap Invariant Market Maker (SIMM) Last modified 3mo ago . Instead of trading directly with other people as with a traditional order book, users trade directly through the AMM.. When expanded it provides a list of search options that will switch the search inputs to match the current selection. {\displaystyle \varphi } How does the Constant Product Market Maker (CPMM) work? This means its solution is predominantly designed for stablecoins. Constant Function Market Makers (CFMMs) are a family of automated market makers that enable censorship-resistant decentralized exchange on public blockchains. [2] This has made these rules popular in prediction markets[3] (fixed cost of information) and decentralized finance[1] (known price exposure). In effect, the function looks like a zoomed-in hyperbola. If we increase liquidity by 5% the shares also increase by 5 %. AMM systems allow users to mint new assets by providing liquidity to the AMM in the form of other assets. based on the input amount and vice versa: $$\Delta y = \frac{yr\Delta x}{x + r\Delta x}$$ Since the intrinsic value exceeds the fair value of an equivalent derivative contract with a positive tenor, the CFMM bears an opportunity cost which must be compensated by volume across the bid-ask spread. We focus particularly on separability and on different invariance properties under scaling. The change in $y$ is the amount of token 1 well get. The point at which ETH value in the liquidity pool reaches $550 is when it has: 10,488.09 DAI 19.07 ETH For example, the Uniswap payoff curve is concave, meaning that liquidity providers are profitable within a certain price bound and will lose money in large price movements: Ideally, we want convexity when taking risk, which means having upside on both sides of the risk spectrum. So in the next part, well see how the mathematics a - Number of Tokens of A the trader has . A market maker is an entity which facilitates a trade between tradeable assets. When they have a larger variation of the two assets they are more likely to experience that impermanent loss. ; Guillermo Angeris, Alex Evans, and Tarun Chitra. Try different reserves, see how output amount changes when $\Delta x$ is small relative to $x$. How do we calculate the prices of tokens in a pool? 287K views 1 year ago You might be asking what an automated market maker is. The formula is: When you trade in an AMM X and Y can vary but the result is always a constant. Uniswap V2 / constant-product AMM implemented in Solana's Anchor -- add and remove liquidity, swap tokens, earn fees! Still neglecting fees, let's imagine that after some trading, the price has changed; 1 ETH is now worth 120 DAI. The proposed cost functions are computationally efficient (only requires multiplication and square root calculation) and have certain advantages over widely deployed constant product cost functions. The Formula used to get to know the number of tokens to return in a trade in case we swap token A to token B is: As mentioned above liquidity addition is the process of providing assets to the AMM in order to increase the liquidity of a particular market and earn a small fee. We are still very early in the evolution of constant function market makers and I am looking forward to seeing the emergence of new designs and applications over the next several years. Curve specializes in creating liquidity pools of similar assets such as stablecoins, and as a result, offers some of the lowest rates and most efficient trades in the industry while solving the problem of limited liquidity. From this, it is observed that when a user places an order of tokens Product-market fit is a moving target. On AMM platforms, instead of trading between buyers and sellers, users trade against a pool of tokens a liquidity pool. Price-time priority market makers: These market makers prioritize orders based on the price and the time at which they are placed, with the highest price and earliest orders getting priority. When assets are burned in this way, they are effectively removed from the liquidity pool and can no longer be traded. arXiv preprint arXiv:2103.01193, 2021. This formula has the desirable property that larger trades (relative to reserves) execute at exponentially worse rates than smaller ones. Cryptopedia does not guarantee the reliability of the Site content and shall not be held liable for any errors, omissions, or inaccuracies. Your trusted source for all things crypto. [1] As a result, both wealth and liquidity are known and fixed given relative prices. In this situation, AMM liquidity providers have no control over which price points are being offered to traders, leading some people to refer to AMMs as lazy liquidity thats underutilized and poorly provisioned. Constant product automated market makers (CPMM): These market makers use a fixed product formula to ensure that the value of a particular market remains constant. Balancer stretches the limits of Uniswap by allowing users to create dynamic liquidity pools of up to eight different assets in any ratio, thus expanding AMMs flexibility. The price of tokens in the AMM before adding the liquidity = X/Y. The main advantage of constant product AMMs is that they are relatively simple to understand and use. Constant product AMMs use a formula based on the "constant product" concept to set the prices of assets. Token prices are simply relations of reserves: $$P_x = \frac{y}{x}, \quad P_y=\frac{x}{y}$$. The constant product formula is a simple rule that allows anybody to spin up both a new market and a new AMM for a new pair of assets instantaneously. The second type is a constant sum market maker (CSMM), which is ideal for zero-price-impact trades but does not provide infinite liquidity. The actual price of the trade is the slope of the line connecting the two points. In order to understand a constant product AMM, we first need to understand what is a market maker. Learn how smart contracts work, use cases, and more. Agents who interact with CFMMs are incentivized to correctly report the price of an asset and thus the decentralized exchange becomes a good on-chain price oracle that other smart contracts can query as a source of truth. Automated Market Maker Platforms. Liquidity : This is the ability of an asset to be sold without affecting the price. . Under this option, liquidity providers need to supply each token in the pair with an equal or 50:50 value. More detailed . For illustration, imagine there are 2 kinds of assets in the pool, A and B, with reserve amounts RA and RB , respectively. And its the slope of the tangent line at Rb - Number of Tokens of B present in the Liquidity Pool. simple mathematical formula: $x$ and $y$ are pool contract reservesthe amounts of tokens it currently holds. The most commonly used AMM is constant product AMM, but other AMM models are also deployed in decentralized finance (DeFi). Lets visualize the constant product function to better understand Bonding curves define a relationship between price and token supply, while CFMMs define a relationship between two or more tokens. $$x + r\Delta x = \frac{xy}{y - \Delta y}$$ The most popular AMM is the Logarithmic Market Scoring Rule, which was developed in 2002 and is used for most prediction markets (e.g. buy a smaller amount. pool reserves. This example is from the Desmos chart made by Dan Robinson, These trades impose costs on Liquidity Providers (LPs) who supply reserves to CFMMs. Trading any amount of either asset must change the reserves in such a way that, when the fee is zero, the product R_*R_ remains equal to the constant k. This is often simplified in the form of x*y=k, where x and y are the reserves of each asset. $$\Delta y = \frac{y r \Delta x}{x + r\Delta x}$$ We show that the constant sum (used by mStable), constant product (used by Uniswap and Balancer), constant reserve (HOLD-ing), and constant harmonic mean trading functions are special cases of the constant power root trading function. An automated market maker facilitates trades and allows digital assets to be traded on a decentralized exchange (DEX). It uses a hybrid of a constant sum and constant product, and arrives at quite a complex function below: Where x is the reserves for each asset, n is the number of assets, D is an invariant that represents the value in the reserve, and A is the amplification coefficient, which is a tunable constant that provides an effect similar to leverage and influences the range of asset prices that will be profitable for liquidity providers (i.e. I bet youre wondering why using such a curve? This can be helpful for traders who want to make informed decisions about which assets to buy or sell. In a traditional exchange workflow, market makers need to create orders, orders need to be published on exchanges, market takers need to browse orders, and market makers need to wait for the orders to get filled. put some amount of one token into a pool (the token they want to sell) and remove some amount of the other token from the pool Uniswap is the most popular AMM on Ethereum. An analysis of Uniswap markets. It doesnt matter how volatile the price gets, there will eventually be a return to a state of balance that reflects a relatively accurate market price. In this model, the weighted geometric mean of each reserve remains constant. For example, if an AMM has ether (ETH) and bitcoin (BTC), two volatile assets, every time ETH is bought, the price of ETH goes up as there is less ETH in the pool than before the purchase. Constant Sum Market Maker (CSMM): These market makers ensure the sum of the assets in a particular market is constant.This is achieved by adjusting the prices of assets in the market based on the supply and demand of those assets. $12 b. What he didnt foresee, however, was the development of various approaches to AMMs. In many markets, there may not be enough organic liquidity to support active trade. reserves. For example, Synthetix was able to use Uniswap to bootstrap liquidity for its sETH liquidity pool, giving users an easier way to begin trading on the exchange. The more assets in a pool and the more liquidity the pool has, the easier trading becomes on decentralized exchanges. in-game items that are hard to market make because of low liquidity). Before AMMs came into play, liquidity was a challenge for, (DEXs) on Ethereum. Alternatively, the founders often hack together a python script to offer liquidity with their own assets and simultaneously hedge their risk on other exchanges. 0.5% fee below a certain liquidity threshold, 0.3% thereafter). As a new technology with a complicated interface, the number of buyers and sellers was small, which meant it was difficult to find enough people willing to trade on a regular basis. And, magically, Since the technology is still pretty new, am looking forward to seeing advancement in the technology and in the entire DeFi ecosystem. Ultimately, this facilitates more efficient trading and reduces the impairment loss for liquidity providers., Virtual automated market makers (vAMMs) such as Perpetual Protocol minimize price impact, mitigate impermanent loss, and enable single token exposure for synthetic assets. The pool stays in constant balance, where the total value of ETH in the pool will always equal the total value of BTC in the pool. Liquidity sensitivity is desirable because it aligns intuitively with the way one would want markets to function: a fixed-size investment moves prices less in liquid markets than in illiquid markets. Path dependence, in a nutshell, means that history matters. In order for the market maker to not give away assets for free, The portfolio value is concave in the relative price of pool assets, short volatility, and can be effectively hedged in the same manner as a vanilla option. In this paper, we focus on the analysis of a very large class of automated market makers, called constant function market makers (or CFMMs) which includes existing popular market makers such as Uniswap, Balancer, and Curve, whose yearly transaction volume totals to billions of dollars. Burning: This refers to the process of removing or destroyingan asset from circulation, After adding liquidity: (X +dx ) (Y + dy) = K, Since we are adding both tokens to the AMM as liquidity that means that K should be less than K, L0 = total liquidity before adding liquidity, L1 = total liquidity after adding liquidity. Before AMMs came into play, liquidity was a challenge for decentralized exchanges (DEXs) on Ethereum. [5] First be seen in production on a Minecraft server in 2012,[6] CFMMs are a popular DEX architecture. This design ensures that the pool remains balanced according to its pre-set weights for each asset. This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. This AMM enables the creation of AMMs that can have more than two tokens and be weighted outside of the standard 50/50 distribution. We derive the replicating portfolio and greeks for a constant product market with bounded liquidity such as Uniswap v3. The opposite happens to the price of BTC in an ETH-BTC pool. Typically, the exchange has to find market makers, have them write custom code for pricing and posting orders, and often directly provide accounts and funds on which to trade. Were selling 200 of token 0. Recently, liquidity providers have also been able to earn yield in the form of project tokens through what is known as yield farming.. Chainlink Price Feeds already underpin much of the DeFi economy and play a key role in helping AMMs accurately set asset prices and increase the liquidity available to traders. the price is also high. If we use only the start price, we expect to get 200 of token 1. Market makers are agents that alleviate this problem by facilitating trade that would otherwise not occur in those markets. The product k would actually be constant, if the swap fee was 0%. AMMs fix this problem of limited liquidity by creating liquidity pools and offering. The third type is a constant mean market maker (CMMM), which enables the creation of AMMs that can have more than two tokens and be weighted outside of the standard 50/50 distribution. While automated market makers have been studied in both theory and practice, constant function market makers (CFMMs) are a zero to one innovation for both academic literature and financial markets. prices when making a trade: And thats the whole math of Uniswap! The pool also takes a small fee ($r = 1 - \text{swap fee}$) from the amount of token 0 we gave. refers to how easily one asset can be converted into another asset, often a fiat currency, without affecting its market price. Because of this matching process, there is the possibility that some orders may take a while to get filled, if ever. These AMMs set the prices of assets on a DEX. This fee is paid by traders who interact with the liquidity pool. The product of updated reserves must still equal $k$. CSMMs follow the formula x+y=k, which creates a straight line when plotted. to the pool, which is added to the reserves. and states that trades must not change the product (. The pool gives us some amount of token 1 in exchange ($\Delta y$). From Bancor to Sigmadex to DODO and beyond, innovative AMMs powered by Chainlink trust-minimized services are providing new models for accessing immediate liquidity for any digital asset. With the Constant Product Market Maker (CPMM) capability, pairs act as automated market makers, ready to accept one token for the other as long as the constant product formula is preserved. For example, if an AMM has ether (ETH) and bitcoin (BTC), two volatile assets, every time ETH is bought, the price of ETH goes up as there is less ETH in the pool than before the purchase. This is where other market participants, called arbitrageurs, come into play. collateralized options) and security tokens (e.g. Visually, the prices of tokens in an AMM pool follow a curve determined by the formula. The constant function formula says: after each trade, k must remain unchanged. However, AMMs have a different approach to trading assets. This chapter retells the whitepaper of Uniswap V2. At its core, a liquidity pool is a shared pot of tokens. Constant function market makers (CFMMs), such as constant product market makers, constant sum market makers, and constant mean market makers, are a class of first-generation AMMs made popular by protocols like Bancor, Curve, and Uniswap. Curvature and market making. On a traditional exchange platform, buyers and sellers offer up different prices for an asset. After a trade, theres a new spot price, at a different point on the curve. Concluding from the law of supply and demand, high demand increases the priceand this is a property we need to have XY=K.The best example of a DEX that uses this is Uniswap and Bancor. An automated market maker is a type of decentralized exchange that lets customers trade between on-chain assets like USDC and ETH. Liquidity Implication of Constant Product . Uniswap uses a constant product market maker to maintain a correct ratio of tokens in the pool. Simple question: does it pay to split an order? In practice, because Uniswap charges a 0.3% trading fee that is added to reserves, each trade actually increases k. A constant product function forms a hyperbola when plotting two assets, which has a desirable property of always having liquidity as prices approach infinity on both sides of the spectrum. What worked in the past is a thing of the past and doesn't work anymore. Instead of matching buyers and sellers in an orderbook, these liquidity pools act as an automated market maker. Anyone with an internet connection and in possession of any type of ERC-20 tokens can become a liquidity provider by supplying tokens to an AMMs liquidity pool. The profit extracted by arbitrageurs is siphoned from the pockets of liquidity providers, creating a loss. We derive the value function for liquidity providers . of the first token and y is the reserve of the other token, and the order doesnt matter. This leads to very high capital efficiency, but with the trade-off of requiring active participation and oversight of liquidity provisioning. Demand is defined by the amount you want to buy, and supply is the Liquidity implications of constant product market makers.