AurelianLabsRemove Liquidity Pool Statistics
Updated 2025-01-17
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- forked from Add and Remove Liquidity Pool Statistics - Score @ https://flipsidecrypto.xyz/studio/queries/20e050d2-e8fc-44fc-9002-501c72130ced
With pools as (SELECT
tx_hash,
CASE
WHEN event_name = 'Mint' THEN 'IncreaseLiquidity'
WHEN event_name = 'Burn' THEN 'DecreaseLiquidity'
ELSE 'null'
END as mint_or_burn,
contract_address as pool_address
FROM base.core.ez_decoded_event_logs
WHERE (event_name = 'Mint' or event_name = 'Burn')
AND block_timestamp::date >= '2024-03-01'
AND block_timestamp::date < '2024-05-01'
AND decoded_log:owner is not NULL
),
add_or_remove_liq as (SELECT
block_timestamp as block_timestamp2,
block_timestamp::date as block_date,
a.tx_hash as tx_hash2,
origin_from_address as wallet_address,
event_name,
decoded_log:"amount0" as amount0,
decoded_log:"amount1" as amount1,
symbols:"token0" as token0,
symbols:"token1" as token1,
decimals:"token0" as decimals0,
decimals:"token1" as decimals1,
b.pool_address,
pool_name
FROM base.core.ez_decoded_event_logs a
LEFT JOIN pools b ON (a.tx_hash = b.tx_hash)-- AND mint_or_burn = a.event_name)
LEFT JOIN base.defi.dim_dex_liquidity_pools c ON b.pool_address = c.pool_address
WHERE contract_name ilike '%uniswap%'
AND (event_name ilike 'Increaseliquidity' OR event_name ilike 'Decreaseliquidity')
QueryRunArchived: QueryRun has been archived