Ranking of Pairs per token (Day1)
- table:
uniswap_v3_ethereum.Factory_call_createPool - Bonus Q: which token had the most #pools created?
Finding the top routing path (Day3)
- table: All the swaps using v3 Router02
uniswap_v3_ethereum.SwapRouter02_call_swapExactTokensForTokensUNION ALLuniswap_v3_ethereum.SwapRouter02_call_swapTokensForExactTokens- for swap volume:
uniswap_v3_ethereum.Pair_call_swap
- bonusQ: add the volume column
- the query was timed out, if you have a paid plan you can run it
How much of the volume/swap counts are MEV generated? (Day4)
- table: in a MEV tx, ‘to’ is the mev account
- uniswap_v3_ethereum.Pair_evt_Swap
- labels.mev_ethereum (case when NOT NULL then mev)
- bonusQ: SVM classification for mev labelling - did not do this one
Find the caller(original source) of the caller(direct source) of the swap (Day 5)
- Link the two traces in one tx that called the pool
row_number() OVER (PARTITION BY s.call_tx_hash, t1.trace_address ORDER BY cardinality(t2.trace_address) desc) AS rn
- table:
ethereum.creation_traces(CASE WHEN address IS NULL then eoa ELSE contract)- uniswap_v3_ethereum.Pair_call_swap
- bonusQ: further labelling
- I joined labels.ens and labels.contracts
The most traded pair per token (Day2)
- table:
uniswap_v3_ethereum.Pair_evt_Swap- for token symbol:
tokens.erc20,uniswap_v3_ethereum.Factory_evt_PoolCreated - for price:
prices.usd
- for token symbol:
- Bonus Q: which pair with WETH had the highest total volume?
How much liqidity was added / removed over time? (Day 7)
- table:
- uniswap_v3_ethereum.Pair_evt_Mint UNION ALL
- uniswap_v3_ethereum.Pair_evt_Burn
- to find the sender (LP): ethereum.transactions
- To have all rows for all the weeks even when there was no mint/burn
-- sequence(start, end, interval)
SELECT sequence(
(SELECT cast(min(week) as TIMESTAMP) FROM lp_combined)
, date_trunc('week', cast(NOW() as TIMESTAMP))
, interval '7' day
) as week
- bonusQ: Group by in/active LPs
Finding the LPs to check the diversity of the pool (Day8)
- Minted Liquidity - Burned Liquidity
- table:
uniswap_v3_ethereum.Pair_evt_Mint / Burn- distinguish contract/EOA :
ethereum.creation_traces
- distinguish contract/EOA :