Skip to main content

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:

Enriched Swap model

The Enriched Swap extends the basic Swap model with baseTokenData, post & pre balances, baseToken and quoteToken identification, and derived fields for UI and analytics. Important: The baseTokenData field contains enriched data (including price, volume, market cap, liquidity, and many other stats) for the base token as determined by baseQuote logic.

Position data on Enriched Swaps

Every swap-enriched event includes a position object that tracks the swap sender’s (or recipient’s) running position for the base token. This is computed in real-time from on-chain data and historical trades.

Pool model

Pools are abstractions on AMM pools, protocol & chain agnostic. Identifier on Mobula: pool Example: