Automated market makers a practical guide to decentralized exchanges and cryptocurrency trading

What You'll Learn Understand the principals of decentralized finance (DeFi) Grasp mathematical formulae that underpin decentralized exchanges Work with Solidity programming language Review current industry best practices Who This Book Is For Those new to Blockchain and Cryptocurrency trading, w...

Full description

Bibliographic Details
Main Authors: Ottina, Miguel, Steffensen, Peter Johannes (Author), Kristensen, Jesper (Author)
Format: eBook
Language:English
Published: New York Apress 2023
Subjects:
Online Access:
Collection: O'Reilly - Collection details see MPG.ReNa
Table of Contents:
  • 3.4.3 All-Asset Withdrawal
  • 3.4.4 Single-Asset Withdrawal
  • 3.5 Pool Tokens Swap
  • 3.5.1 Swap of Pool Tokens That Belong to Pools of Different Types
  • 3.6 Summary
  • Chapter 4: Curve Finance
  • 4.1 The StableSwap Invariant
  • 4.2 Mathematical Preliminaries
  • 4.2.1 Finding the Parameter D
  • 4.3 Trading Formulae
  • 4.3.1 Taking Fee into Consideration
  • 4.4 All-Asset Deposit
  • 4.5 All-Asset Withdrawal
  • 4.6 Single-Asset Withdrawal
  • 4.7 StableSwap LP Token Swap
  • 4.8 Summary
  • Chapter 5: Uniswap v3
  • 5.1 Ticks
  • 5.1.1 Initialized Ticks
  • 5.1.2 Tick Spacing
  • 5.2 Liquidity Providers' Position
  • 5.3 Impermanent Loss
  • 5.4 Multiple Positions
  • 5.5 Protocol Implementation
  • 5.5.1 Variables
  • 5.5.2 Fees
  • 5.5.3 Trades
  • 5.5.4 The swap Function
  • 5.5.5 Example
  • 5.6 LP Tokens
  • 5.6.1 Minting LP Tokens
  • 5.6.2 Modifying the Position: Part I
  • 5.6.3 Update the Position
  • 5.6.4 Tick Class
  • 5.6.5 Burning LP Tokens
  • 5.7 Analysis of Liquidity Provisioning
  • 5.7.1 Capital Efficiency
  • 5.7.2 Independence with Respect to Other Liquidity Providers
  • 5.8 Summary
  • References
  • Index
  • Intro
  • Table of Contents
  • About the Authors
  • About This Book
  • Chapter 1: Introduction to AMMs
  • 1.1 Preliminary Notions
  • 1.2 Historical Overview
  • 1.3 Summary
  • Chapter 2: Uniswap v2
  • 2.1 Trading in a Uniswap v2 pool
  • 2.1.1 Spot Price
  • 2.1.2 Accounting for Fees
  • 2.2 Impact of the Trades on the Price
  • 2.2.1 A Simple Example
  • 2.2.2 Analysis of Two Consecutive Trades
  • 2.2.3 Impact of the Trade Size on the Average Purchase Price
  • 2.2.4 Impact of the Trade Size on the Average Sell Price
  • 2.2.5 Impact of the Trade Size on the Price Growth Ratio
  • Includes bibliographical references (pages 281-287) and index
  • 2.3 Providing Liquidity
  • 2.3.1 Minting LP Tokens
  • Starting the Pool
  • 2.3.2 Burning LP Tokens
  • Distribution of Fees
  • 2.3.3 Pool Value and Impermanent Loss
  • Computing Impermanent Loss Without Fees
  • Accounting for Fees
  • 2.3.4 LP Token Swap
  • Common Token Case
  • No In-Common Token Case: Oracle Swap
  • 2.4 Motivating DEX Aggregators
  • 2.5 Summary
  • Chapter 3: Balancer
  • 3.1 The Constant Value Function
  • 3.2 Spot Price
  • 3.2.1 Constant Value Distribution
  • 3.3 Trading Formulae
  • 3.4 Providing Liquidity
  • 3.4.1 All-Asset Deposit
  • 3.4.2 Single-Asset Deposit