SocioAnalyticapool liquidity (main query)
Updated 2024-11-24
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
›
⌄
with token_info as (
select
token_address,
symbol,
name,
decimals
from aptos.core.dim_tokens
)
, base as (
select a.* ,
b.symbol as symbol_x,
c.symbol as symbol_y,
amount_x / pow(10, b.decimals) as amount_x_1,
amount_y / pow(10, c.decimals) as amount_y_1,
symbol_x || '-' || symbol_y || '-' || 'LP' as lp_token
from (
select
'Add liquidity' as type,
block_timestamp,
tx_hash,
TRIM(SPLIT_PART(SPLIT(event_type, ',')[0], '<', 2) :: string, ' ') as token_x,
TRIM(SPLIT_PART(SPLIT(event_type, ',')[1],'>',1) :: string, ' ') as token_y,
event_data : amount_x :: int as amount_x,
event_data : amount_y :: int as amount_y,
event_data : fee_amount as fee_amount,
event_data : liquidity as lp_token_amount,
event_data : user :: string as user_address
from aptos.core.fact_events
where event_address = '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa'
and event_resource ilike 'AddLiquidity%'
union all
select
'remove liquidity' as type,
block_timestamp,
tx_hash,
TRIM(SPLIT_PART(SPLIT(event_type, ',')[0], '<', 2) :: string, ' ') as token_x,
QueryRunArchived: QueryRun has been archived