Skip to main content

Swap

Entity to stores details of a swap event emitted while swapping one token for the other in a pool.

Schema

FieldTypederivedFromDescription
idID!Swap Entity ID. Format: <transaction hash>#<index in transaction.swaps array>
transactionTransaction!Transaction Entity in which the swap event was emitted
timestampBigInt!Timestamp of the block in which which the swap event was emitted
poolPool!Pool in which the swap event was emitted
token0Token!token0 entity of the pool
token1Token!token1 entity of the pool
senderBytesthe address that triggered the swap
recipientBytes!The address that gets their tokens swapped
originBytes!The EOA address that initiated the transaction
amount0BigDecimal!Amount of token0 swapped
amount1BigDecimal!Amount of token1 swapped
amountUSDBigDecimalSwapped token value derived in USD based on available prices of tokens
sqrtPriceX96BigInt!The sqrt(price) of the pool after the swap, as a Q64.96
tickBigInt!The tick after the swap
logIndexBigIntOrder of the swap event within the logs of the transaction

Referencing Functions

FunctionNameCreateReadUpdateSave
handleSwap()