BlockTrackerTop Users by the Volume of Deposits
Updated 2023-08-28Copy Reference Fork
99
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 Top Users by the Volume of Net Deposit (total deposit - total withdraw) @ https://flipsidecrypto.xyz/edit/queries/66d1cbf3-5d79-4d0a-997a-07ba862157b6
-- forked from combine add and remove liquidity @ https://flipsidecrypto.xyz/edit/queries/ee852577-1623-4c9c-899b-0e60f9c41dab
with t_txs as(
SELECT
DISTINCT tx_id ,
block_timestamp
FROM sei.core.fact_msg_attributes
WHERE ATTRIBUTE_KEY = '_contract_address'
AND ATTRIBUTE_VALUE = 'sei1d9fgdm2vgcknz5prdumkg5apml0vv3lfulkfd0gn07uesysek74sn34hjw'
)
,
add_liquidity as (
SELECT
tx_id
FROM sei.core.fact_msg_attributes
WHERE tx_id IN (SELECT tx_id FROM t_txs)
AND ATTRIBUTE_KEY = 'action' AND ATTRIBUTE_VALUE = 'mint'
)
,
tokens as (
SELECT
tx_id,
ATTRIBUTE_VALUE as token
FROM sei.core.fact_msg_attributes
WHERE ATTRIBUTE_KEY = 'amount' AND msg_type = 'transfer' AND msg_index = 8
AND tx_id IN (SELECT tx_id FROM add_liquidity)
),
trader as (
SELECT
tx_id,
ATTRIBUTE_VALUE as user
FROM sei.core.fact_msg_attributes
WHERE tx_id IN (SELECT tx_id FROM add_liquidity)
AND ATTRIBUTE_KEY = 'sender' AND msg_type = 'message'
),
Run a query to Download Data