Swap model

Swaps are abstractions on AMM transfers, procotol & chain agnostic. Identifier on Mobula: swap Note on Swap Direction and Amount Signs:
In a swap, tokens move between addressToken0 and addressToken1. The direction of the swap and the meaning of the amounts can be understood as follows:
  • If amount0 is positive, the token at addressToken0 is going into the pool, and it is being swapped for the token at addressToken1.
  • If amount0 is negative, the token at addressToken0 is coming out of the pool, meaning the swap is from addressToken1 to addressToken0.
The amount1 value reflects the opposite movement:
  • Positive → token enters the pool
  • Negative → token leaves the pool
In simple terms:
  • Positive amount0 → swapping Token0 → Token1
  • Negative amount0 → swapping Token1 → Token0
Example: SOL → SUPER Agent Swap:
{
  "ratio": 1608943.9743539998,
  "swapSenderAddress": "CxNUEf6Aw8o8i84GfyPE3ZcKKpa4XRyuXEwypECbdjV8",
  "poolAddress": "EQ4p8CGFJz92FkL8H4eeN3txR1ohp613ZWdVkjFromED",
  "rawAmount0": "1000000000",
  "rawAmount1": "-1608943974354",
  "poolType": "raydium",
  "swapType": "REGULAR",
  "addressToken0": "So11111111111111111111111111111111111111112", //SOL
  "addressToken1": "GqwD19dg25154kJ8kK2FLCeXZJzPDs6CPaUhdsW9pump", //SuperAgent
  "blockHeight": "1737653025",
  "transactionHash": "3QbHFowf7xeW9BM2fR2TKfYcmUKNnhQN7XyqdEmqS3SWKtfEw686RDxKaFxp3dGGc7D1RZuHaCrzSJEkg3hn9s5A",
  "transactionSenderAddress": "CxNUEf6Aw8o8i84GfyPE3ZcKKpa4XRyuXEwypECbdjV8",
  "transactionIndex": 0,
  "blockHash": "GMKNhiUnUVQrTzYuy2t5qZVd1JfoyGi5LdifNG6gEHiP",
  "logIndex": 0,
  "chainId": "solana:solana",
  "timestamp": "1737653025",
  "date": "2025-01-23T17:23:45.000Z",
  "priceUSDToken0": 250.0741553570125,
  "priceUSDToken1": 0.00015542750980960583,
  "amount0": 1,       // Positive → Token0 goes into the pool
  "amount1": -1608943.974354, // Negative → Token1 comes out of the pool
  "amountUSD": 250.0741553570125,
  "type": "swap"
}

Pool model

Pools are abstractions on AMM pools, protocol & chain agnostic. Identifier on Mobula: pool Example:
{
    "chainId": "solana:solana",
    "address": "B945wuhaQz3p238XDnghSsLKix8MiizT2j2yuHSgX7Xi",
    "type": "pool",
    "factory": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
    "tokens": [
      "So11111111111111111111111111111111111111112",
      "C8U4ofzDkFdwxxP9twNut4vkxVVSQovHDedGAQ5apump"
    ],
    "createdAt": 1744358732000,
    "deployer": "BjMRkgnfkDPVPjLJqejEV5dhrnVNJ4ycriMp3ctcqYME",
    "source": "pumpfun"
}