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 ataddressToken0
is going into the pool, and it is being swapped for the token ataddressToken1
. - If
amount0
is negative, the token ataddressToken0
is coming out of the pool, meaning the swap is fromaddressToken1
toaddressToken0
.
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
Pool model
Pools are abstractions on AMM pools, protocol & chain agnostic. Identifier on Mobula:pool
Example: