5

Building Crypto-Trading Smart Contracts

In the previous chapters, we dived into Decentralized Exchanges (DEXs) and went through the processes of how various DEXs handle crypto trading. In this chapter, we will apply this knowledge in practice by building smart contracts for trading cryptocurrencies.

The smart contracts we will build in this chapter conform to the architecture and workflows we discussed in the Architecture of AMM section of Chapter 4, Introduction to Decentralized Exchanges. These smart contracts will make up the on-chain components of a Constant Product Market Maker (CPMM), which is a type of DEX we discussed in Chapter 4, Introduction to Decentralized Exchanges. These components include token pairs, pair factories, and AMM ...

Get Building Full Stack DeFi Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.