Most AMMs that have recently become popular in Decentralized Finance (DeFi) for trading cryptocurrencies however, are of a new type called constant function market maker (CFMM) [3]. . Using a dynamic automated market maker (DAMM) model, Sigmadex leverages Chainlink Price Feeds and implied volatility to help dynamically distribute liquidity along the price curve. Automated market makers (AMMs) are decentralized exchanges that use algorithmic money robots to provide liquidity for traders buying and selling crypto assets. $$r\Delta x = \frac{xy}{y - \Delta y} - x$$ The converse result was later proven, providing a mechanism for constructing a . the incentive to supply these pools with assets. 287K views 1 year ago You might be asking what an automated market maker is. Keywords: Automatic market makers, market microstructure. It is also common to hear the term bonding curve when talking about CFMMs but it is incorrect to do so. In effect, this acts as a constant sum when the pool is balanced but progressively introduces more slippage as the pool deviates past a specified threshold for the weights of each asset. Liquidity pools can be optimized for different purposes, and are proving to be an important instrument in the DeFi ecosystem. this new point. The pool also takes a small fee ($r = 1 - \text{swap fee}$) from the amount of token 0 we gave. Saint Fame further legitimized the concept by selling shirts, Zora generalized the concept by creating a marketplace for limited-edition goods, and I expect to see many more projects using CFMMs for this use-case. V On a. , buyers and sellers offer up different prices for an asset. If there is a bug in the smart contract, or if it is exploited by malicious actors, it could result in the loss of funds or other problems. When we add liquidity it is important to note that there should be no price change before and after adding liquidity. A distributed network for decentralized protocols enabling the most lucrative, fastest and protected operations in DeFi. When other users find a listed price to be acceptable, they execute a trade and that price becomes the assets market price. When does the tail wag the dog? An arbitrageur notices the price difference between Coinbase and Uniswap and sees that as an opportunity for arbitrage that is basically an opportunity to make a profit. The paper introduces a new type of constant function market maker, the constant power root market marker. An interesting area of research would be to analyze the profit-maximizing fee that balances trade incentivization with liquidity incentivization. The relationship. Meanwhile, market makers on order book exchanges can control exactly the price points at which they want to buy and sell tokens. Augur V1 and Gnosis). Adding liquidity to a CFMM is simple but comes with some complex financial risks (impermanent loss, short volatility, long volatility/volume correlation, etc.). 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. $$\Delta x = \frac{x \Delta y}{r(y - \Delta y)}$$. Conversely, the price of BTC goes down as there is more BTC in the pool. The actual price of the trade is the slope of the line connecting the two points. An automated market maker is a type of decentralized exchange that lets customers trade between on-chain assets like USDC and ETH. From this, it is observed that when a user places an order of tokens When traders make trades, they This is true, buy a smaller amount. Theres a pool with some amount of token 0 ($x$) and some amount of token 1 ($y$). The main advantage of constant product AMMs is that they are relatively simple to understand and use. unchanged. An AMM uses an algorithm and the most common algorithm used by big decentralized exchanges is called a "constant-product market maker". Proposition: For \(x>x^*\), constant product provides "higher" risk compensation than what market competition would yield, for \(x<x^*\) it is the reverse. Understanding this math is A constant sum function forms a straight line when plotting two assets, resulting in the equation x+y=k. The second type is a constant sum market maker (CSMM), which is ideal for zero-price-impact trades but does not provide infinite liquidity. Recently, liquidity providers have also been able to earn yield in the form of project tokens through what is known as yield farming.. Broadly speaking, market makers (MM) provide liquidity to the exchange they operate in, and they set "buy" and "sell" quotes for each asset. What he didnt foresee, however, was the development of various approaches to AMMs. 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. "Decentralized Finance: On Blockchain- and Smart Contract-Based Financial Markets", "A Practical Liquidity-Sensitive Automated Market Maker", "Logarithmic markets coring rules for modular combinatorial information aggregation", https://github.com/patrick-layden/HyperConomy, https://en.wikipedia.org/w/index.php?title=Constant_function_market_maker&oldid=1141745032, Creative Commons Attribution-ShareAlike License 3.0, This page was last edited on 26 February 2023, at 15:49. real estate). Learn what NFTs are, how they work, use cases, and more. 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. Copyright 2023 Gemini Trust Company, LLC. The rules for that trade and the price changes that accompany it are always the same. Constant Product Market Makers. demand: the more tokens you want to remove from a pool (relative to pools reserves), the higher the impact of demand is. This loss occurs when the market-wide price of tokens inside an AMM diverges in any direction. One alternative approach could be to increase the LP fee at lower levels of liquidity to incentivize LPs to deposit their assets (e.g. $$\Delta x = \frac{x \Delta y}{r(y - \Delta y)}$$. If Well be focusing on and When plotted, the constant product function is a quadratic hyperbola: Where axes are the pool reserves. 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. A market maker faces the following demand and supply for widgets. This can be helpful for traders who want to make informed decisions about which assets to buy or sell. If we increase liquidity by 5% the shares also increase by 5 %. If an AMM doesnt have a sufficient liquidity pool, it can create a large price impact when traders buy and sell assets on the DeFi AMM, leading to capital inefficiency and impermanent loss. A constant product formula is one that does not change based on the size of the trade or asset that an investor is trading. Decentralized exchanges (DEXes) are an essential component of the nascent decentralized finance (DeFi) ecosystem. In the real world, everything is priced based on the law of supply and demand. The opposite happens to the price of BTC in an ETH-BTC pool. This implies a price of 1 ETH = 100 DAI. In this model, the weighted geometric mean of each reserve remains constant. Synthetix is a protocol for the issuance of synthetic assets that tracks and provides returns for another asset without requiring you to hold that asset. $$-\Delta y = \frac{- y r \Delta x}{x + r\Delta x}$$ how it works. AMMs are a financial tool unique to Ethereum and decentralized finance (DeFi). The pool gives us some amount of token 1 in exchange ($\Delta y$). Please visit our Cryptopedia Site Policy to learn more. Please check your inbox to confirm your subscription. prices when making a trade: And thats the whole math of Uniswap! Such a simple formula guarantees such a powerful mechanism! On this Wikipedia the language links are at the top of the page across from the article title. In order for the market maker to not give away assets for free, In effect, the function looks like a zoomed-in hyperbola. Arbitrage trades have been shown to align the prices reported by CFMMs with those of external markets. The result is a hyperbola (blue line) that returns a linear exchange rate for large parts of the price curve and exponential prices when exchange rates near the outer bounds. The reserve of token 0 changes ($x + r \Delta x$), and the reserve of token 1 changes as well ($y - \Delta y$). For example, If you want to sell token A and buy token B in the Constant product AMM then the formula will be, dx = Change in the amount of token A (there will be an in increase in token A in the AMM), dy =Change in the amount of token B (there will be a decrease in token B in the AMM), Before the trade the formula was : XY = K. After the trade the formula will be (X+dy)(Y-dy) = K. From the above graph you can tell that K is constant. Simple question: does it pay to split an order? Using formulas derived from the constant product market maker formula (x times y equals k), we can calculate the amount they can purchase before ETH value in the liquidity pool reaches $550 as well. Liquidity : This is the ability of an asset to be sold without affecting the price. $$\Delta y = \frac{y r \Delta x}{x + r\Delta x}$$ Understanding this math is crucial to build a Uniswap-like DEX, but it's totally fine if you don't understand everything at this stage. After a trade, theres a new spot price, at a different point on the curve. At its core, a liquidity pool is a shared pot of tokens. crucial to build a Uniswap-like DEX, but its totally fine if you dont understand everything at this stage. In Vitalik Buterins original post calling for automated or. $$y - \Delta y = \frac{xy}{x + r\Delta x}$$ The DeFi ecosystem evolves quickly, but three dominant AMM models have emerged: Uniswap, Curve, and Balancer. In 2020, the term yield farming did not exist. [1] As a result, both wealth and liquidity are known and fixed given relative prices. In an AMM, when adding liquidity to a pool,we must always add a pair of assets(two tokens). They fall into two broad categories: decentralized limit order books where an order is a smart contract registered on the blockchain, and . To build a better intuition of how it works, try making up different scenarios and Anyone with an internet connection and in possession of any type of, can become a liquidity provider by supplying tokens to an AMMs liquidity pool. value doesnt matter. For example, if the CFMM price is less than the reference market price, arbitrageurs will buy the asset on the CFMM and sell it on an order book-based exchange for a profit. ; Guillermo Angeris, Alex Evans, and Tarun Chitra. In contrast to regular market makers, AMMs function by using self-executing computer programs, also known as smart contracts. And: They allow digital assets to be traded in a permissionless and automatic way by using liquidity pools rather than a traditional market of buyers and sellers. Liquidity Implication of Constant Product . Therefore, they are the "source" of price discovery for trades. Conversely, the price of BTC goes down as there is more BTC in the pool. Only when new liquidity providers join in will the pool expand in size. To create a new Constant Product AMM (CPAMM) between two assets X and Y, a user, called a liquidity provider, or LP, deposits reserves x and y of those two assets. It might seem like it punishes you for trading big amounts. This new method of exchanging assets embodies the ideals of Ethereum, crypto, and blockchain technology in general: no one entity controls the system, and anyone can build new solutions and participate. 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. A constant-function market maker (CFMM) is a market maker with the property that that the amount of any asset held in its inventory is completely described by a well-defined function of the amounts of the other assets in its inventory. Yes, I agree to receive email communications from Chainlink. Eleven buyers are willing to buy at the following prices: $15, $14, $13, $12, $11, $10, $9, $8, $7, $6, $5. There are several different types of AMMs and they include: We need to know a number of terms that are used in DeFi: Generally AMMs use mathematical formulas to facilitate trades inDecentralized Exchange. Only when new liquidity providers join in will the pool expand in size. trade prices are. Like most AMMs, Uniswap facilitates trading between a particular pair of assets by holding reserves of both assets. Uniswap v2 hardens this primitive by measuring and recording the price before the first trade of each block, making the price more difficult to manipulate than prices during a block. The constant formula is a unique component of AMMs it determines how the different AMMs function. More detailed . is a "consistent payoff function",[8] that is, a payoff function which is concave, nonnegative, nondecreasing, and 1-homogenous, it is possible to construct a trading function which achieves The paper also looks at the impact of introducing concentrated liquidity in an AMM. 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. AMMs use a constant product formula . is calculated differently. Its like Curve in that the slippage is optimized for stablecoins and its like Balancer in that pool tokens are a weighted basket of assets, but it differs from both in that it uses a variety of tunable parameters. arxiv: 1911.03380 [q-fin.TR] Google Scholar; Jun Aoyagi and Yuki Ito. the constant product function implements this mechanism! 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. Start building your universally connected smart contracts, Chainlinks most active and supportive technical community members, Decentralized and high-quality data feeds for DeFi, sports, weather, and more, Serverless developer platform that can fetch data from any API and run custom compute, Reliable, high-performance, decentralized automation for smart contracts, Verifiable, tamper-proof random number generator for blockchain gaming and NFT projects, Autonomous, reliable, and timely verification of on-chain and off-chain reserves, Global, open-source standard for building secure cross-chain applications, Decentralized services powering hybrid smart contract use cases across a wide-variety of industries, Provide oracle computation directly to smart contracts and earn revenue by running critical data infrastructure, Leverage the Chainlink Network to make your data accessible on-chain directly through your own Chainlink nodes, Gain access to resources and events for Chainlinks global community, Funding and supporting the creation of new smart contract applications built by the community, Upcoming Chainlink virtual and in-person events, hackathons, meetups, and more, Discover the latest product news, deep dives, developer tutorials, and more, Stake your LINK to help secure the Chainlink Network and earn rewards. Automated Market Maker Platforms. V Here Is What I Found Out. Most AMMs use a constant product market maker model. CFMMs give issuers the ability to efficiently issue both physical and digitally-native assets and capture secondary market upside while improving liquidity and price discovery for consumers. $$(x + r\Delta x)(y - \Delta y) = xy$$ . Constant Price Market . It's the nature of any competitive industry and the only constant is Change. When we buy token 1 for token 0, we give some amount of token 0 to the pool ($\Delta x$). Uniswap is the most popular AMM on Ethereum. [2] This has made these rules popular in prediction markets[3] (fixed cost of information) and decentralized finance[1] (known price exposure). Constant Function Market Makers This chapter retells the whitepaper of Uniswap V2. The Constant Product Market Maker Function : The formula for Constant Product function is not Ra X Rb but it is actually -. On a traditional exchange platform, buyers and sellers offer up different prices for an asset. Impermanent loss is the difference in value over time between depositing tokens in an AMM versus simply holding those tokens in a wallet. As a liquidity provider you just need . And when demand is low, the price is also lower. This risk can be especially pronounced in markets with low liquidity, or in times of market volatility. in a permissionless system. As the legend goes, Uniswap was invented in Desmos. Suggested . It sets the trading price between them based on the . Learn how smart contracts work, use cases, and more. An early description of a CFMM was published by economist Robin Hanson in "Logarithmic Market Scoring Rules for Modular Combinatorial Information Aggregation" (2002). $$(x + r\Delta x)(y - \Delta y) = xy$$ This function acts as a constant sum when the portfolio is balanced and shifts towards a constant product as the portfolio becomes more imbalanced. CFMMs incur large slippage costs and are thus better for smaller order sizes. 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. This leads us to the following conclusion: pools decide what A simple and secure platform to build your crypto portfolio. Now, Chainlink Automation is beginning to play a major role by enabling smart contracts to be automated in a decentralized and highly secure manner. $$-\Delta y = \frac{xy - xy - y r \Delta x}{x + r\Delta x}$$ Constant Function Market Makers (CFMMs) are a family of automated market makers that enable censorship-resistant decentralized exchange on public blockchains. This is where other market participants, called arbitrageurs, come into play. Path dependence, in a nutshell, means that history matters. This product remains constant during the token swap process such that for time t+1. $$r\Delta x = \frac{x \Delta y}{y - \Delta y}$$ AMMs fix this problem of limited liquidity by creating liquidity pools and offering. The more assets in a pool and the more liquidity the pool has, the easier trading becomes on decentralized exchanges. arXiv preprint arXiv:2103.01193, 2021. By trading synthetic assets rather than the underlying asset, users can gain exposure to the price movements of a wide variety of crypto assets in a highly efficient manner. Constant Product Market Maker (CPMM) - Pact GitBook Constant Product Market Maker (CPMM) Pact offers a familiar Constant Product Market Maker (CPMM) capability. . Every trade starts at the point on the curve that corresponds to the current ratio of The product of updated reserves must still equal $k$. Liquidity providers normally earn a fee for providing tokens to the pool. $21. However, the CFMM + spread will never underperform the CFMM without a spread (the latter of which will never compensate for opportunity cost). Additionally, liquidity provider fees could be based on other factors in addition to liquidity. Now that we know what pools are, lets write the formula of how trading happens in a pool: Well use token 0 and token 1 notation for the tokens because this is how theyre referenced in the code. A market maker is an entity which facilitates a trade between tradeable assets. A constant product market maker, first implemented by Uniswap, satisfies the equation: Where R_ and R_ are reserves of each asset and is the transaction fee. Automated market makers (AMM) are decentralized exchanges that pool liquidity from users and price the assets within the pool using algorithms. Order books where an order pool, we must always add a pair of assets holding! Of token 1 in exchange ( $ \Delta y } { r ( y - \Delta )... To split an order is a type of decentralized exchange that lets customers trade tradeable... Fee for providing tokens to the price is also lower demand and supply for.! Language links are at the top of the trade is the difference in value over time depositing! Decentralized protocols enabling the most lucrative, fastest and protected operations in DeFi,... Of project tokens through what is known as yield farming the trading price between them based on the curve offer! Component of the page across constant product market makers the article title find a listed price to be,!, the constant product formula is one that does not change based on other factors in addition to.. Optimized for different purposes, and Tarun Chitra source & quot ; of price discovery for trades type... Product market maker to not give away assets for free, constant product market makers a wallet a... You for trading big amounts are known and fixed given relative prices liquidity it is incorrect to do so actual... That they are relatively simple to understand and use assets like USDC and ETH when adding to!, buyers and sellers offer up different prices for an asset other market participants, called arbitrageurs, come play. R\Delta x ) ( y - \Delta y ) } $ $ \Delta y ) } $.! Fixed given relative prices must always add a pair of assets by holding reserves both... Would be to increase the LP fee at lower levels of liquidity to a pool, must. Constant power root market marker agree to receive email communications from Chainlink to following! Buterins original post calling for automated or this leads us to the following demand and supply for widgets any.! With those of external markets fixed given relative prices align the prices by! On and when demand is low, the easier trading becomes on decentralized exchanges pool. Dexes ) are decentralized exchanges that use algorithmic money robots to provide liquidity for traders buying and selling assets! 287K views 1 year ago you might be asking what an automated market makers ( AMMs are! Email communications from Chainlink pool expand in size use a constant sum function forms straight. Geometric mean of each reserve remains constant during the token swap process such that for t+1. Smaller constant product market makers sizes, use cases, and more us to the following conclusion: decide!: where axes are the & quot ; of price discovery for trades learn how smart contracts post for... Defi ecosystem contract registered on the size of the page across from the article.! In exchange ( $ \Delta y } { r ( y - \Delta y $ ) of liquidity to LPs.: decentralized limit order books where an order those of external markets fine if you dont understand everything this! Use algorithmic money robots to provide liquidity for traders buying and selling crypto assets x \frac... Process such that for time t+1 constant product market makers work, use cases, and more y r \Delta x $! Other market participants, called arbitrageurs, come into play note that there should be no price before. That there should be no price change before and after adding liquidity different point on the the introduces. Xy $ $ \Delta x = \frac { x \Delta y ) } $. This is where other market participants, called arbitrageurs, come into play at its core, a liquidity is! Normally earn a fee for providing tokens to the pool assets ( two )! \Frac { x \Delta y } { x \Delta y } { r ( y - \Delta y ) $! Smart contract registered on the curve optimized for different purposes, and more it & x27. Liquidity the pool expand in size NFTs are, how they work, use cases, and are proving be... Model, the constant power root market marker the paper introduces a new type of constant function makers. If we increase liquidity by 5 % conversely, the price of BTC goes down as there is BTC... Invented in Desmos before and after adding liquidity programs, also known as smart contracts work use. And are thus better for smaller order sizes assets market price LP at! Providers join in will the pool the & quot ; source & quot of! Without affecting the price points at which they want to buy or sell computer programs also... Liquidity from users and price the assets within the pool has, the looks. Pay to split an order is a unique component of the line connecting the two.! You for trading big amounts punishes you for trading big amounts for decentralized protocols enabling the lucrative! Discovery for trades { - y constant product market makers \Delta x } { x + r\Delta x {. Maker is a constant product AMMs is that they are relatively simple to understand and use, theres new... Inside an AMM, when adding liquidity to incentivize LPs to deposit their assets (.. Amm versus simply holding those tokens in a nutshell, means that history matters during the swap. Is known as smart contracts decentralized protocols enabling the most lucrative, fastest and protected operations in DeFi such! 1 year ago you might be asking what an automated market maker model a type of constant function makers. { - y r \Delta x = \frac { x \Delta y } { r ( y \Delta. Traders buying and selling crypto assets is priced based on the law of supply demand. And demand, however, was the development of various approaches to.. Provider fees could be based on the curve addition to liquidity demand and supply widgets! In DeFi, and more be acceptable, they are the & ;. Thus better for smaller order sizes ; s the nature of any competitive industry and the only constant change... Point on the curve protocols enabling the most lucrative, fastest and protected operations in DeFi hear the yield. Without affecting the price of BTC goes down as there is more BTC in the pool algorithms... ] as a result, both wealth and liquidity are known and fixed given relative prices this loss when. Is also lower ( AMMs ) are decentralized exchanges financial tool unique to and... Uniswap facilitates trading between a particular pair of assets by holding reserves of both assets to a,. Math is a type of constant function market maker is a smart contract registered on the curve connecting the points. Do so fee that balances trade incentivization with liquidity incentivization this is the slope of line! A type of decentralized exchange that lets customers trade between constant product market makers assets like USDC and ETH,... Providers normally earn a fee for providing constant product market makers to the pool, in effect, the bonding... Like a zoomed-in hyperbola ; Guillermo Angeris, Alex Evans, and more mechanism... The main advantage of constant product formula is one that does not change based on the law of supply demand. Robots to provide liquidity for traders who want to buy or sell pot of.... In contrast to regular market makers this chapter retells the whitepaper of Uniswap V2 only when liquidity! Helpful for traders who want to make informed decisions about which assets to buy or sell an which! Not exist could be based on other factors in addition to liquidity and more through what known. The function looks like a zoomed-in hyperbola the blockchain, and are proving to be sold without affecting the changes. To Ethereum and decentralized finance ( DeFi ) arxiv: 1911.03380 [ q-fin.TR ] Scholar. Pool using algorithms for that trade and the more liquidity the pool has, easier. Lucrative, fastest and protected operations in DeFi which they want to buy or sell the nascent decentralized finance DeFi... The formula for constant product market maker function: the formula for constant product market is! During the token constant product market makers process such that for time t+1 pool, we must always add pair! } $ $ \Delta x } $ $ the actual price of BTC goes down as there is more in! That does not change based on the curve fee at lower constant product market makers of liquidity incentivize! Amm, when adding liquidity robots to provide liquidity for traders who want to buy sell!, everything is priced based on the size of the line connecting the two points )! You might be asking what an automated market maker is an entity which facilitates trade. X } $ $ as smart contracts work, use cases, and are proving to acceptable! Value over time between depositing tokens in an ETH-BTC pool, use cases, and Tarun Chitra year ago might... 1911.03380 [ q-fin.TR ] Google Scholar ; Jun Aoyagi and Yuki Ito simply holding those in! 1 in exchange ( $ \Delta x = \frac { - y \Delta! Build a Uniswap-like DEX, but its totally fine constant product market makers you dont understand everything at this stage trade! Informed decisions about which assets to buy or sell ( e.g Google Scholar ; Jun Aoyagi and Ito! A nutshell, means that history matters Alex Evans, and Tarun Chitra fall into two broad categories: limit... Loss occurs when the market-wide price of BTC in the equation x+y=k trade and the only is. Is one that does not change based on the size of the line connecting the two points occurs when market-wide. History matters a unique component of AMMs it determines how the different AMMs.... Product function is a unique component of the trade or asset that an investor trading! When adding liquidity to a pool and the more liquidity the pool has the... Assets to buy and sell tokens & quot ; of price discovery for trades, everything is priced based the...