Proxima
  • 🎉Introduction
    • Welcome to Proxima
  • 🌊Streams
    • Overview
    • Quick start
    • Using streams
    • Our streams
      • Block headers
      • New tokens/collections
      • DEX events
      • Exchange rates
      • Private streams
        • Mangrove
        • All ERC20 events
        • All ERC721 events
        • Raw Uniswap events
      • Smart contract's events
    • Understanding streams
    • Architecture
  • 💾Data APIs
    • APIs
      • Fungible tokens
      • Decentralized exchanges
      • Account balances
  • 🚧Maru
    • Introduction
    • Programming Model
    • How Maru works
      • Architecture
      • Dataflow
      • Economics
      • Domain Specific Language
      • Arrangements
      • Open Problems
    • Background Knowledge
      • Multiset Hashes
      • Plonky2
    • Use Cases
      • Lifting Expensive Computation Off-Chain
      • Social Graph Database
      • Indexer
Powered by GitBook
On this page
  1. Streams
  2. Our streams

DEX events

proxima.{dex}.{network}.gen-dex-amm.1_0

Events happening on decentralized exchanges like Uniswap, Quickswap, etc.

TypeScript schema:

export type GeneralizedAmmDexEvent =
  NewAmmDex |
  NewPool |
  PoolUpdate;

export interface BlockchainEventBase extends JsonObject {
  ref?: TxRef;
}

export interface NewAmmDex extends BlockchainEventBase {
  type: "newDex";

  dex: AmmDex;
}

export interface NewPool extends BlockchainEventBase {
  type: "newPool";

  pool: Pool;
  dexId: AmmDexId;
  state: PoolState;
}

export interface PoolUpdate extends BlockchainEventBase {
  type: "poolUpdate";

  dexId: AmmDexId;
  poolId: PoolId;
  oldState: PoolState;
  newState: PoolState;
  event?: PoolEvent;
}

export interface PoolState extends JsonObject {
  liquidity: Amount[];
  priceWeights?: Amount[];
}

export type PoolEvent = SwapEvent | MintEvent | BurnEvent | undefined;

export interface SwapEvent extends JsonObject {
  type: "swap";
  amounts: Amount[];
}

export interface MintEvent extends JsonObject {
  type: "mint";
  lpTransfers?: Transfer[];
}

export interface BurnEvent extends JsonObject {
  type: "burn";
  lpTransfers?: Transfer[];
}


export interface AmmDex extends JsonObject {
  id: AmmDexId;
  network: Network;
  displayName: string;
  protocol: AmmDexProtocol | string;
}

export type AmmDexProtocol = "uniswap2" | "uniswap3";

export interface Network extends JsonObject {
  name: string;
  chainId?: number;
}

export interface Pool extends JsonObject {
  id: PoolId;
  assets: Asset[];
  lp?: Asset;
}

export type TxRef = Partial<Omit<TxRefBase, "chain">>;

export interface Transfer extends JsonObject {
  from?: UserId;
  to: UserId;
  value: Amount;
}

export type UserId = Address;
export type PoolId = Address;
export type AmmDexId = string;
export type Asset = Address;
PreviousNew tokens/collectionsNextExchange rates

Last updated 2 years ago

🌊