Home / Solutions / DeFi & Trading
DeFi & Trading

DeFi and DEX data: swaps, liquidations, and full execution traces

A DEX swap settles its token movement in nested internal calls; an event-log-only feed sees the receipt, not the execution. SQD serves logs, transactions, traces, and state diffs from one endpoint, across 225+ networks, so the path of a swap or a liquidation is in scope, not out of reach.

225+ Networks
Traces Internal calls
State diffs Storage writes
Genesis Full history
Capabilities

Built for DeFi & Trading at scale

/

Cross-chain swap and pool indexing

Track swap, mint, burn, and sync events across AMMs on any EVM chain with one query shape. The same handler reads Uniswap V3 on Ethereum and PancakeSwap on BNB Chain; Solana AMMs use the Solana instruction shape, not EVM logs.

!

Liquidation and risk monitoring

Stream borrow, repay, and liquidation events from Aave, Compound, Morpho, and any lending protocol. Combine state diffs with event logs to recompute collateralization per block, the inputs a liquidation keeper or risk engine runs on.

#

Traces and state diffs, not just logs

Full execution traces and state diffs expose the internal calls and storage writes event logs omit. Reconstruct the exact execution order in a block, the swap path, the liquidation path, the value an event-only feed never sees.

%

MEV and order-flow analysis

Transaction traces and state diffs expose sandwich attacks, arbitrage paths, and front-running. Reconstruct the execution order within a block, including the internal and delegate calls basic event indexing misses entirely.

Why it matters

Most indexers stop at event logs. That is the receipt, not the execution.

Most of what a DeFi transaction does happens inside it, not as it. A Uniswap swap routed through three contracts is one submitted transaction and a tree of internal calls underneath; a Compound liquidation moves value through delegate calls across several contracts. An indexer that only reads event logs never sees those calls.

The gap is measurable. Over 20 Ethereum blocks (21,000,000 to 21,000,020), USDC was the direct recipient of 66 transactions but was called 260 times once internal calls are counted. The 194-call difference happened inside transactions aimed at routers, aggregators, and multisigs, and a transaction filter cannot see any of it.

MeasureCount
  • transactions where to = USDC66
  • calls where callTo = USDC260
  • internal calls a tx filter misses194
USDC on Ethereum, blocks 21,000,000-21,000,020

Trace-level data is what production indexers run on: GMX moved multichain perp data off subgraphs, Curvance indexes on Monad, and Levr.Bet runs prediction-market data on SQD.

The query that finds every internal call into a contract filters the trace stream by call type and callee:

internal calls into USDC
POST https://portal.sqd.dev/datasets/ethereum-mainnet/stream
{
"type": "evm",
"fromBlock": 21000000,
"toBlock": 21000020,
"traces": [{
"type": ["call"],
"callTo": ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"]
}],
"fields": {
"trace": { "type": true, "traceAddress": true, "callFrom": true, "callTo": true, "callValue": true, "callCallType": true }
}
}

Two gotchas: the response nests fields under action (callTo arrives as action.to, the call type as action.callType, which separates a call from a delegatecall), and a trace carries a transactionIndex, not a transaction hash, so to tie a hop to a hash you request the transaction. callValue on each hop is the ETH moved there.

A second use

Catch new pools the moment they deploy

A contract deployment is a create trace, so the same trace stream is a deployment registry. Filter traces by type create and you get the deployer and the new address, including pools created by a factory or by CREATE2 that a transaction list never surfaces as deployments. The first deployment in block 21,000,000:

a CREATE trace, nested response
{
"type": "create",
"transactionIndex": 14,
"action": { "from": "0xcdc180b5dd8ede4dfbe212f2aefc8789d16089b8" },
"result": { "address": "0x521de88737bda991043ee9af429ec1fcabb87f23" }
}

Deployer 0xcdc1…89b8 created 0x521d…7f23. For DeFi that means tracking a factory's new pools from the trace stream, no hand-maintained address list. The full walkthrough is in the internal transactions guide.

Playground

Try the Portal API

Live queries against real blockchain data. Pick a network, choose a query, hit run.

The public endpoint is free for development. See plans for dedicated portals and higher limits.

Network+200 more
Query
curl --compressed -X POST \
'https://portal.sqd.dev/datasets/ethereum-mainnet/stream' \
-H 'Content-Type: application/json' \
-d '{
"type": "evm",
"fromBlock": 21000000,
"toBlock": 21000050,
"fields": {
"block": {"number":true,"timestamp":true},
"transaction": {
"hash": true,
"from": true,
"to": true,
"value": true,
"sighash": true
}
},
"transactions": [
{
"to": [
"0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD"
]
}
]
}'
Ethereumethereum-mainnet/stream
Transactions hitting the Uniswap router
Use Cases

What teams build with SQD

Protocol analytics dashboards with cross-chain aggregation
Yield and APY backends computed from onchain events
Liquidation keepers and risk engines from event and state-diff streams
DEX aggregator data feeds across 225+ networks
MEV and order-flow reconstruction from traces
PnL and accounting from decoded swap and transfer history

Frequently asked questions

What DEX data does SQD serve?
Swaps, liquidity events (mint, burn, sync), and the full execution traces underneath them, from chain head through the same endpoint as historical data. Pool state like reserves or price is reconstructed from those events, not returned as a field. For latency-sensitive market-making or HFT execution a co-located RPC node is still appropriate; SQD covers everything downstream of execution: PnL accounting, risk monitoring, analytics, and client reporting. Production references include GMX and Levr.Bet.
Does SQD support liquidation events?
Liquidation events on EVM lending and perpetual protocols (Aave, Compound, Morpho, GMX, dYdX) are decoded like any contract event: define the ABI and the typed decoders return borrower, collateral, debt, liquidator, and price-feed fields, with full execution traces and state diffs alongside for reconstructing the liquidation path. Hyperliquid is different: it is not an EVM contract, so its fills come from the dedicated Hyperliquid fills dataset rather than an ABI-decoded log.
Which DEXes are pre-indexed?
SQD does not maintain pre-indexed datasets per DEX. Any DEX with public onchain contracts is indexed by pointing a Squid SDK indexer at the relevant factory and pair/pool contracts. Factory contracts can be tracked dynamically (Uniswap V2/V3-style factories) so new pools appear automatically; Uniswap V4 uses a single PoolManager, so its pools are tracked through that contract's events instead. Production indexers for GMX, PancakeSwap, and UNCX are reference implementations.
Get started

Your blockchain data infrastructure, handled.

Private Portal. Dedicated. Validated. Managed. Tell us what you're building, we'll show you what it looks like on SQD.