Abstract
The rise of Ethereum and other blockchains that support smart contracts has led to the creation of decentralized exchanges (DEXs), such as Uniswap, Balancer, Curve, mStable, and SushiSwap, which enable agents to trade cryptocurrencies without trusting a centralized authority. While traditional exchanges use order books to match and execute trades, DEXs are typically organized as constant function market makers (CFMMs). CFMMs accept and reject proposed trades based on the evaluation of a function that depends on the proposed trade and the current reserves of the DEX. For trades that involve only two assets, CFMMs are easy to understand, via two functions that give the quantity of one asset that must be tendered to receive a given quantity of the other, and vice versa. When more than two assets are being exchanged, it is harder to understand the landscape of possible trades. We observe that various problems of choosing a multi-asset trade can be formulated as convex optimization problems and can therefore be reliably and efficiently solved.
This is a preview of subscription content, access via your institution.
Buying options




References
Aave. https://aave.com, 2021
Akshay Agrawal, Stephen Boyd, Deepak Narayanan, Fiodar Kazhamiaka, and Matei Zaharia. Allocation of fungible resources via a fast, scalable price discovery method. arXiv preprintarXiv:2104.00282, 2021
Guillermo Angeris and Tarun Chitra. Improved price oracles: Constant function market makers. In Proceedings of the 2nd ACM Conference on Advances in Financial Technologies, pages 80–91, New York NY USA, October 2020. ACM
Guillermo Angeris, Alex Evans, and Tarun Chitra. When does the tail wag the dog? Curvature and market making. arXiv preprint arXiv:2012.08040, 2020
Guillermo Angeris, Alex Evans, and Tarun Chitra. A note on privacy in constant function market makers. arXiv preprint arXiv:2103.01193, 2021
Guillermo Angeris, Alex Evans, and Tarun Chitra. Replicating market makers. arXiv preprint arXiv:2103.14769, 2021
Jun Aoyagi and Yuki Ito. Liquidity implications of constant product market makers. Available at SSRN 3808755, 2021
Guillermo Angeris, Hsien-Tang Kao, Rei Chiang, Charlie Noyes, and Tarun Chitra. An analysis of Uniswap markets. Cryptoeconomic Systems, November 2020
Jun Aoyagi. Liquidity provision by automated market makers. Available at SSRN 3674178, 2020
MOSEK ApS. MOSEK Optimizer API for Python 9.1.5. https://docs.mosek.com/9.1/pythonapi/index.html, 2019
Angeris, G., Vučković, J., Boyd, S.: Heuristic methods and performance bounds for photonic design. Optics Express 29(2), 2827 (2021)
Agrawal, A., Verschueren, R., Diamond, S., Boyd, S.: A rewriting system for convex optimization problems. Journal of Control and Decision 5(1), 42–60 (2018)
Hayden Adams, Noah Zinsmeister, Moody Salem, River Keefer, and Dan Robinson. Uniswap v3 core. Technical report, 2021
Boyd, S., Busseti, E., Diamond, S., Kahn, R., Koh, K., Nystrup, P., Speth, J.: Multi-period trading via convex optimization. Foundations and Trends in Optimization 3(1), 1–76 (2017)
Stephen Boyd, Seung-Jean Kim, Dinesh Patil, and Mark Horowitz. Digital circuit optimization via geometric programming. Operations Research, 53(6), 2005
Lars Blackmore. Autonomous precision landing of space rockets. The BRIDGE, 26(4), 2016
Stephen Boyd, Neal Parikh, Eric Chu, Borja Peleato, and Jonathan Eckstein. Distributed optimization and statistical learning via the alternating direction method of multipliers. Foundations and Trends® in Machine learning, 3(1):1–122, 2011
Goran Banjac, Bartolomeo Stellato, Nicholas Moehle, Paul Goulart, Alberto Bemporad, and Stephen Boyd. Embedded code generation using the OSQP solver. In IEEE Conference on Decision and Control, 2017
Vitalik Buterin. Ethereum: A next-generation smart contract and decentralized application platform, 2013
Vitalik Buterin. On path independence (2017). https://vitalik.ca/general/2017/06/22/marketmakers.html
Boyd, S., Vandenberghe, L.: Convex Optimization. Cambridge University Press, Cambridge, UK; New York (2004)
Tarun Chitra, Guillermo Angeris, Alex Evans, and Hsien-Tang Kao. A note on borrowing constant function market maker shares. 2021
Yiling Chen, Lance Fortnow, Nicolas Lambert, David Pennock, and Jennifer Wortman. Complexity of combinatorial market makers. In Proceedings of the 9th ACM Conference on Electronic Commerce, pages 190–199, 2008
Compound. https://compound.finance, 2021
Eric Chu, Neal Parikh, Alexander Domahidi, and Stephen Boyd. Code generation for embedded second-order cone programming. In European Control Conference, pages 1547–1552. IEEE, 2013
Gerard Cornuejols and Reha Tütüncü. Optimization Methods in Finance. Cambridge University Press, 2006
Diamond, S., Boyd, S.: CVXPY: A Python-embedded modeling language for convex optimization. Journal of Machine Learning Research 17(83), 1–5 (2016)
Alexander Domahidi, Eric Chu, and Stephen Boyd. ECOS: An SOCP solver for embedded systems. In 2013 European Control Conference (ECC), pages 3071–3076, Zurich, July 2013. IEEE
Dunning, I., Huchette, J., Lubin, M.: JuMP: A modeling language for mathematical optimization. SIAM review 59(2), 295–320 (2017)
dydx. https://dydx.exchange, 2021
Alex Evans, Guillermo Angeris, and Tarun Chitra. Optimal fees for geometric mean market makers. arXiv preprint arXiv:2104.00446, 2021
Michael Egorov. StableSwap - efficient mechanism for Stablecoin liquidity. page 6, 2019
Alex Evans. Liquidity provider returns in geometric mean markets. arXiv preprint arXiv:2006.08806, 2020
Jerome Friedman, Trevor Hastie, and Robert Tibshirani. The Elements of Statistical Learning, volume 1. Springer Series in Statistics, 2001
Michael Garstka, Mark Cannon, and Paul Goulart. COSMO: A conic operator splitting method for large convex problems. In 2019 18th European Control Conference (ECC), pages 1951–1956, Naples, Italy, June 2019. IEEE
Hanson, R.: Combinatorial information market design. Information Systems Frontiers 5(1), 107–119 (2003)
Hershenson, M., Boyd, S., Lee, T.: Optimal design of a CMOS op-amp via geometric programming. IEEE Transactions on Computer-aided design of integrated circuits and systems 20(1), 1–21 (2001)
Lipp, T., Boyd, S.: Minimum-time speed optimisation over a fixed path. International Journal of Control 87(6), 1297–1311 (2014)
Alan Lu. Building a decentralized exchange in Ethereum. https://blog.gnosis.pm/building-a-decentralized-exchange-in-ethereum-eea4e7452d6e, 2017
Markowitz, H.: Portfolio selection. The. Journal of Finance 7(1), 77–91 (1952)
Mattingley, J., Boyd, S.: CVXGEN: A code generator for embedded convex optimization. Optimization and Engineering 13(1), 1–27 (2012)
Nicholas Moehle, Enzo Busseti, Stephen Boyd, and Matt Wytock. Dynamic energy management. arXiv preprint arXiv:1903.06230, 2019
Fernando Martinelli and Nikolai Mushegian. Balancer: A non-custodial portfolio manager, liquidity provider, and price sensor. 2019
Satoshi Nakamoto. Bitcoin: A peer-to-peer electronic cash system, 2008
O’Donoghue, B., Chu, E., Parikh, N., Boyd, S.: Conic optimization via operator splitting and homogeneous self-dual embedding. Journal of Optimization Theory and Applications 169(3), 1042–1068 (2016)
Press, W., Teukolsky, S., Flannery, B.: and William Vetterling. The Art of Scientific Computing. Cambridge University Press, Numerical Recipes (1992)
Ernest Ryu and Stephen Boyd. A primer on monotone operator methods. Applied Computational Math, 2016
Gregory Stewart and Francesco Borrelli. A predictive control framework for industrial turbodiesel engine control. In IEEE Conference on Decision and Control (CDC), pages 5704–5711, 2008
Bartolomeo Stellato, Goran Banjac, Paul Goulart, Alberto Bemporad, and Stephen Boyd. OSQP: An operator splitting solver for quadratic programs. Mathematical Programming Computation, February 2020
Sushi. The SushiSwap project, 2020
Nick Szabo. Smart contracts. Extropy: Journal of Transhumanist Thought, 16, 1995
Martin Tassy and David White. Growth rate of a liquidity provider’s wealth in \(xy= c\) automated market makers, 2020
UMA project. https://umaproject.org, 2021
Wang, Y., Boyd, S.: Fast evaluation of quadratic control-Lyapunov policy. IEEE Transactions on Control Systems Technology 19(4), 939–946 (2010)
Ye Wang, Yan Chen, Shuiguang Deng, and Roger Wattenhofer. Cyclic arbitrage in decentralized exchange markets. Available at SSRN 3834535, 2021
Winkler, R.: Scoring rules and the evaluation of probability assessors. Journal of the American Statistical Association 64(327), 1073–1078 (1969)
Gavin Wood. Ethereum: A secure decentralised generalised transaction ledger, 2014
Gavin Wood. Polkadot: Vision for a heterogeneous multi-chain framework, 2016
Anatoly Yakovenko. Solana: A new architecture for a high performance blockchain, 2018
Yi Zhang, Xiaohong Chen, and Daejun Park. Formal specification of constant product (\(xy=k\)) market maker model and implementation. 2018
Acknowledgements
The authors would like to acknowledge Shane Barratt for useful discussions. Guillermo Angeris is supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-1656518. Akshay Agrawal is supported by a Stanford Graduate Fellowship.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this chapter
Cite this chapter
Angeris, G., Agrawal, A., Evans, A., Chitra, T., Boyd, S. (2022). Constant Function Market Makers: Multi-asset Trades via Convex Optimization. In: Tran, D.A., Thai, M.T., Krishnamachari, B. (eds) Handbook on Blockchain. Springer Optimization and Its Applications, vol 194. Springer, Cham. https://doi.org/10.1007/978-3-031-07535-3_13
Download citation
DOI: https://doi.org/10.1007/978-3-031-07535-3_13
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-07534-6
Online ISBN: 978-3-031-07535-3
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)