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
amount0is positive, the token ataddressToken0is going into the pool, and it is being swapped for the token ataddressToken1. - If
amount0is negative, the token ataddressToken0is coming out of the pool, meaning the swap is fromaddressToken1toaddressToken0.
amount1 value reflects the opposite movement:
- Positive → token enters the pool
- Negative → token leaves the pool
- Positive
amount0→ swapping Token0 → Token1 - Negative
amount0→ swapping Token1 → Token0
Enriched Swap model
The Enriched Swap extends the basic Swap model withbaseTokenData, 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.
Pool model
Pools are abstractions on AMM pools, protocol & chain agnostic. Identifier on Mobula:pool
Example: