Abstract
Automated market makers (AMMs) are one of the most prominent decentralized finance (DeFi) applications. They allow users to exchange units of different types of crypto-assets, without the need to find a counter-party. There are several implementations and models for AMMs, featuring a variety of sophisticated economic mechanisms. We present a theory of AMMs. The core of our theory is an abstract operational model of the interactions between users and AMMs, which can be concretised by instantiating the economic mechanisms. We exploit our theory to formally prove a set of fundamental properties of AMMs, characterizing both structural and economic aspects. We do this by abstracting from the actual economic mechanisms used in implementations and identifying sufficient conditions which ensure the relevant properties. Notably, we devise a general solution to the arbitrage problem, the main game-theoretic foundation behind the economic mechanisms of AMMs.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Formal specification of constant product market maker model & implementation (2018). https://github.com/runtimeverification/verified-smart-contracts/blob/uniswap/uniswap/x-y-k.pdf
Improving frontrunning resistance of x*y=k market makers (2018). https://ethresear.ch/t/improving-front-running-resistance-of-x-y-k-market-makers/1281
Balancer whitepaper (2019). https://balancer.finance/whitepaper/
Curve statistics (2020). https://www.curve.fi/dailystats
Curve (2020). https://www.curve.fi
Makerdao (2020). https://makerdao.com
Mooniswap implementation (2020). https://github.com/1inch-exchange/mooniswap/blob/02dccfab2ddbb8a409400288cb13441763370350/contracts/Mooniswap.sol
Mooniswap whitepaper (2020). https://mooniswap.exchange/docs/MooniswapWhitePaper-v1.0.pdf
Uniswap Documentation: Understanding Returns (2020). https://uniswap.org/docs/v2/advanced-topics/understanding-returns/
Uniswap flash loan implementation (2020). https://github.com/Uniswap/uniswap-v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/contracts/UniswapV2Pair.sol#L172
Uniswap oracle template (2020). https://github.com/Uniswap/uniswap-v2-periphery/blob/dda62473e2da448bc9cb8f4514dadda4aeede5f4/contracts/examples/ExampleOracleSimple.sol
Uniswap statistics (2020). https://info.uniswap.org
Uniswap token pair implementation (2020). https://github.com/Uniswap/uniswap-v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/contracts/UniswapV2Pair.sol
Uniswap (2020). https://www.uniswap.org
Curve computation of invariant constant (2021). https://github.com/curvefi/curve-contract/blob/a1b5a797790d3f5ef12b0e358892a0ce47c12f85/contracts/pool-templates/base/SwapTemplateBase.vy#L206
Curve token pair implementation (2021). https://github.com/curvefi/curve-contract/blob/a1b5a797790d3f5ef12b0e358892a0ce47c12f85/contracts/pool-templates/base/SwapTemplateBase.vy
Angeris, G., Chitra, T.: Improved price oracles: constant function market makers. In: ACM Conference on Advances in Financial Technologies (AFT), pp. 80–91. ACM (2020). https://doi.org/10.1145/3419614.3423251. https://arxiv.org/abs/2003.10001
Angeris, G., Evans, A., Chitra, T.: When does the tail wag the dog? Curvature and market making. arXiv preprint arXiv:2012.08040 (2020)
Angeris, G., Kao, H.T., Chiang, R., Noyes, C., Chitra, T.: An analysis of Uniswap markets. Cryptoeconomic Syst. J. (2019). https://ssrn.com/abstract=3602203
Bartoletti, M., Chiang, J.H., Lluch-Lafuente, A.: SoK: lending pools in decentralized finance. In: Workshop on Trusted Smart Contracts. LNCS. Springer (2021, to appear)
Daian, P., et al.: Flash boys 2.0: frontrunning in decentralized exchanges, miner extractable value, and consensus instability. In: IEEE Symposium on Security and Privacy, pp. 910–927. IEEE (2020). https://doi.org/10.1109/SP40000.2020.00040
Egorov, M.: Stableswap - efficient mechanism for stablecoin (2019). https://www.curve.fi/stableswap-paper.pdf
Eskandari, S., Moosavi, S., Clark, J.: SoK: transparent dishonesty: front-running attacks on blockchain. In: Bracciali, A., Clark, J., Pintore, F., Rønne, P.B., Sala, M. (eds.) FC 2019. LNCS, vol. 11599, pp. 170–189. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-43725-1_13
Evans, A., Angeris, G., Chitra, T.: Optimal fees for geometric mean market makers (2021). https://web.stanford.edu/~guillean/papers/g3m-optimal-fee.pdf
Krishnamachari, B., Feng, Q., Grippo, E.: Dynamic curves for decentralized autonomous cryptocurrency exchanges. arXiv preprint arXiv:2101.02778 (2021)
Bartoletti, M., Chiang, J.H., Lluch-Lafuente, A.: A theory of Automated Market Makers in DeFi. arXiv preprint arXiv:2102.11350 (2021)
Mazurkiewicz, A.: Basic notions of trace theory. In: de Bakker, J.W., de Roever, W.-P., Rozenberg, G. (eds.) REX 1988. LNCS, vol. 354, pp. 285–363. Springer, Heidelberg (1989). https://doi.org/10.1007/BFb0013025
Qin, K., Zhou, L., Gervais, A.: Quantifying blockchain extractable value: how dark is the forest? (2021). https://arxiv.org/abs/2101.05511
Qin, K., Zhou, L., Livshits, B., Gervais, A.: Attacking the DeFi ecosystem with flash loans for fun and profit. In: Financial Cryptography (2021, to appear). https://arxiv.org/abs/2003.03810
Wang, D., et al.: Towards understanding flash loan and its applications in DeFi ecosystem. arXiv preprint arXiv:2010.12252 (2020)
Zhou, L., Qin, K., Torres, C.F., Le, D.V., Gervais, A.: High-frequency trading on decentralized on-chain exchanges. arXiv preprint arXiv:2009.14021 (2020)
Acknowledgements
Massimo Bartoletti is partially supported by Conv. Fondazione di Sardegna & Atenei Sardi project F74I19000900007 ADAM. James Hsin-yu Chiang is supported by the PhD School of DTU Compute. Alberto Lluch Lafuente is partially supported by the EU H2020-SU-ICT-03-2018 Project No. 830929 CyberSec4Europe (cybersec4europe.eu).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 IFIP International Federation for Information Processing
About this paper
Cite this paper
Bartoletti, M., Chiang, J.Hy., Lluch-Lafuente, A. (2021). A Theory of Automated Market Makers in DeFi. In: Damiani, F., Dardha, O. (eds) Coordination Models and Languages. COORDINATION 2021. Lecture Notes in Computer Science(), vol 12717. Springer, Cham. https://doi.org/10.1007/978-3-030-78142-2_11
Download citation
DOI: https://doi.org/10.1007/978-3-030-78142-2_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-78141-5
Online ISBN: 978-3-030-78142-2
eBook Packages: Computer ScienceComputer Science (R0)