0xHaM-dIdentity of Sushi's LPer
Updated 2022-10-01
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
›
⌄
WITH lp_tx AS (
SELECT
block_timestamp,
CASE
WHEN block_number < 15537393 THEN 'Before the Merge'
ELSE 'After the Merge'
END AS period,
tx_hash,
contract_address AS pool_address,
CASE
WHEN event_name = 'Mint' THEN 'Deposit'
WHEN event_name = 'Burn' THEN 'Withdraw'
END AS lp_act_type,
to_number(event_inputs:amount0) AS amount0,
to_number(event_inputs:amount1) AS amount1,
origin_from_address AS LPer
FROM ethereum.core.fact_event_logs
WHERE contract_address IN (SELECT pool_address FROM ethereum.core.dim_dex_liquidity_pools WHERE platform = 'sushiswap')
AND event_name IN ('Mint','Burn')
),
lp_tx2 AS (
SELECT
a.block_timestamp,
a.period,
a.tx_hash,
a.LPer,
a.pool_address,
b.pool_name,
a.lp_act_type,
CASE
WHEN lp_act_type = 'Deposit' THEN c.amount_usd
WHEN lp_act_type = 'Withdraw' THEN c.amount_usd*-1
END AS token0_amount_usd,
CASE
WHEN lp_act_type = 'Deposit' THEN d.amount_usd
WHEN lp_act_type = 'Withdraw' THEN d.amount_usd*-1
Run a query to Download Data