Skip to main content

A Theory of Automated Market Makers in DeFi

  • Conference paper
  • First Online:
Coordination Models and Languages (COORDINATION 2021)

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://github.com/blockchain-unica/defi-workbench.

References

  1. Formal specification of constant product market maker model & implementation (2018). https://github.com/runtimeverification/verified-smart-contracts/blob/uniswap/uniswap/x-y-k.pdf

  2. 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

  3. Balancer whitepaper (2019). https://balancer.finance/whitepaper/

  4. Curve statistics (2020). https://www.curve.fi/dailystats

  5. Curve (2020). https://www.curve.fi

  6. Makerdao (2020). https://makerdao.com

  7. Mooniswap implementation (2020). https://github.com/1inch-exchange/mooniswap/blob/02dccfab2ddbb8a409400288cb13441763370350/contracts/Mooniswap.sol

  8. Mooniswap whitepaper (2020). https://mooniswap.exchange/docs/MooniswapWhitePaper-v1.0.pdf

  9. Uniswap Documentation: Understanding Returns (2020). https://uniswap.org/docs/v2/advanced-topics/understanding-returns/

  10. Uniswap flash loan implementation (2020). https://github.com/Uniswap/uniswap-v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/contracts/UniswapV2Pair.sol#L172

  11. Uniswap oracle template (2020). https://github.com/Uniswap/uniswap-v2-periphery/blob/dda62473e2da448bc9cb8f4514dadda4aeede5f4/contracts/examples/ExampleOracleSimple.sol

  12. Uniswap statistics (2020). https://info.uniswap.org

  13. Uniswap token pair implementation (2020). https://github.com/Uniswap/uniswap-v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/contracts/UniswapV2Pair.sol

  14. Uniswap (2020). https://www.uniswap.org

  15. Curve computation of invariant constant (2021). https://github.com/curvefi/curve-contract/blob/a1b5a797790d3f5ef12b0e358892a0ce47c12f85/contracts/pool-templates/base/SwapTemplateBase.vy#L206

  16. Curve token pair implementation (2021). https://github.com/curvefi/curve-contract/blob/a1b5a797790d3f5ef12b0e358892a0ce47c12f85/contracts/pool-templates/base/SwapTemplateBase.vy

  17. 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

  18. Angeris, G., Evans, A., Chitra, T.: When does the tail wag the dog? Curvature and market making. arXiv preprint arXiv:2012.08040 (2020)

  19. 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

  20. 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)

    Google Scholar 

  21. 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

  22. Egorov, M.: Stableswap - efficient mechanism for stablecoin (2019). https://www.curve.fi/stableswap-paper.pdf

  23. 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

    Chapter  Google Scholar 

  24. Evans, A., Angeris, G., Chitra, T.: Optimal fees for geometric mean market makers (2021). https://web.stanford.edu/~guillean/papers/g3m-optimal-fee.pdf

  25. Krishnamachari, B., Feng, Q., Grippo, E.: Dynamic curves for decentralized autonomous cryptocurrency exchanges. arXiv preprint arXiv:2101.02778 (2021)

  26. Bartoletti, M., Chiang, J.H., Lluch-Lafuente, A.: A theory of Automated Market Makers in DeFi. arXiv preprint arXiv:2102.11350 (2021)

  27. 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

    Chapter  Google Scholar 

  28. Qin, K., Zhou, L., Gervais, A.: Quantifying blockchain extractable value: how dark is the forest? (2021). https://arxiv.org/abs/2101.05511

  29. 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

  30. Wang, D., et al.: Towards understanding flash loan and its applications in DeFi ecosystem. arXiv preprint arXiv:2010.12252 (2020)

  31. 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)

Download references

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

Authors

Corresponding author

Correspondence to James Hsin-yu Chiang .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 IFIP International Federation for Information Processing

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics