Abbas_ra21LP Background
Updated 2023-09-26
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 Lp users 3 @ https://flipsidecrypto.xyz/edit/queries/98068fa4-33b0-4cea-8727-dd0f11991fd4
-- forked from Lp users @ https://flipsidecrypto.xyz/edit/queries/306b21a6-7547-4335-8bb2-3509f41b76b8
-- forked from Lp pools @ https://flipsidecrypto.xyz/edit/queries/32216c19-6d10-480e-8c2e-e2615f1b11b9
with
price AS (
select
Token_address,
Price,
rank() over (
partition by
Token_address
order by
HOUR desc
) AS rank
from
avalanche.core.fact_hourly_token_prices
qualify
rank = 1
),
tb AS (
select
BLOCK_TIMESTAMP,
TX_HASH,
'Add' AS Action,
origin_from_address AS user,
Pool_name AS pool,
TOKENS:token0 AS Token0,
SYMBOLS:token0 AS Symbol0,
DECODED_LOG:amount0 / power(10, A.DECIMALS:token0) AS amount0,
amount0 * B.price AS amount0_USD,
TOKENS:token1 AS Token1,
SYMBOLS:token1 AS Symbol1,
DECODED_LOG:amount1 / power(10, A.DECIMALS:token1) AS amount1,
amount1 * C.price AS amount1_USD
from
avalanche.core.ez_decoded_event_logs
Run a query to Download Data