# 0xperp/awesome-amm architecture

> Architecture diagram of the GitHub repository 0xperp/awesome-amm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xperp/awesome-amm
- Repository: https://github.com/0xperp/awesome-amm

## Overview

##### Project Type and Purpose
- This repository is not a typical application codebase but rather a curated, research‐ and resource‐focused documentation on various AMM (Automated Market Maker) designs and orderbook implementations.
- The README compiles historical posts, whitepapers, design formulas, and even sections on AMM aggregators (like Rango) that use advanced patterns (for example, the diamond design pattern) alongside sections for virtual AMMs, derivatives, and options AMMs.

##### Extract Key Architectural Components from the README
- Automated Market Makers:
– Constant Product AMMs
– Stableswap (Hybrid) AMMs
– Constant Mean AMMs
– Concentrated Liquidity designs
– Front-running resistance mechanisms (as exemplified in Mooniswap)
- AMM Aggregator (Rango) – a specific system design covering:
– The Diamond contract (central swap/bridge transaction handler)
– Middleware contracts (handling tokens and messaging on destination chains)
– Individual facets for each connector or protocol (e.g., Axelar, THORChain, Stargate, 1inch, Paraswap, etc.)
- Virtual Automated Market Makers (vAMMs):
– Emphasize the concept of a “controller” or “clearing house” that manages collateral.
- Derivatives and Options AMMs:
– Designs that use AMM principles to price and manage options contracts.
- Orderbooks:
– Focus on implementations like 0x, DyDx, Serum, etc., which have distinct mechanisms from pure AMMs.

b. Relationships and Interactions:
- How the central documentation aggregates multiple design concepts.
- In the orderbooks section, indicate interactions (or contrasts) versus liquidity-pool–based AMMs.

##### Architectural Patterns and Technologies
- The diamond design pattern is central to the Rango aggregator: note it as a modular design that uses facets, middleware, and helper libraries.
- For each design you include (e.g., the constant product, stableswap, concentrated liquidity) briefly annotate the key formulas or invariants if desired.

##### Final Assembly
- Create branches leading to:
- “AMM Designs” (with sub-branches: Constant Product, Stableswap, Constant Mean, Concentrated Liquidity, Front-Running Resistance)
- “AMM Aggregator (Rango)” (with sub-branches: Diamond Contract, Middleware, and further facets such as Axelar, ThorChain, etc.)
- “Virtual AMMs (vAMM)” (with “Clearing House” or “Controller” elements)
- “Derivatives & Options AMMs”
- “Orderbooks”

## Diagram (Mermaid)

```mermaid
graph TD
    A["Awesome AMM Resource Repository"]:::repo
    AD["AMM Designs"]:::category
    AA["AMM Aggregator (Rango)"]:::category
    VA["Virtual AMMs (vAMM)"]:::category
    DO["Derivatives & Options AMMs"]:::category
    OR["Orderbooks"]:::category

    A --> AD
    A --> AA
    A --> VA
    A --> DO
    A --> OR
    AD --> AD1["Constant Product AMM"]:::theoretical
    AD --> AD2["Stableswap AMM"]:::theoretical
    AD --> AD3["Constant Mean AMM"]:::theoretical
    AD --> AD4["Concentrated Liquidity"]:::theoretical
    AD --> AD5["Front-Running Resistance"]:::theoretical

    AA --> AA1["Diamond Contract"]:::implementation
    AA --> AA2["Middleware"]:::implementation
    AA --> AA3["Facets: Axelar,ThorChain,Stargate,1inch,Paraswap"]:::implementation
    AA1 -->|"includes"| AA2
    AA1 -->|"includes"| AA3

    VA --> VA1["Clearing House/Controller"]:::implementation

    DO --> DO1["Option Pricing & Management"]:::theoretical

    OR --> OR1["Orderbook Implementations: 0x,DyDx,Serum"]:::implementation

    AD4 -->|"informs"| DO1
    AD -->|"contrasts"| OR

    click A "https://github.com/0xperp/awesome-amm/blob/main/README.md"
    click AD "https://github.com/0xperp/awesome-amm/tree/main/images/"

    classDef repo fill:#F9E79F,stroke:#7D6608,stroke-width:2px;
    classDef category fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef theoretical fill:#A9DFBF,stroke:#1E8449,stroke-width:2px;
    classDef implementation fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
```
