SocioCryptoAdding LP by pool Over Time
Updated 2023-11-07
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 Actions by pool @ https://flipsidecrypto.xyz/edit/queries/54e6e7d4-c978-49c0-9792-51e6c7ec5789
-- 'add_liquidity' 'remove_liquidity'
with swap_addliquidity as (
SELECT
DISTINCT tx_id as tx,
block_timestamp,
b.address_name
FROM sei.core.fact_msg_attributes a
LEFT JOIN sei.core.dim_labels b ON a.ATTRIBUTE_VALUE = b.address
WHERE ATTRIBUTE_KEY = '_contract_address'
AND ATTRIBUTE_VALUE IN (SELECT address FROM sei.core.dim_labels WHERE label ilike 'fuzio')
AND b.address_name NOT ilike '%bonding%'
)
,
add_liquidity as (
SELECT b.*
FROM sei.core.fact_msg_attributes a
INNER JOIN swap_addliquidity b ON a.tx_id = b.tx
WHERE ATTRIBUTE_KEY = 'action' AND ATTRIBUTE_VALUE = 'add_liquidity'
)
,
remove_liqudity as (
SELECT b.*
FROM sei.core.fact_msg_attributes a
INNER JOIN swap_addliquidity b ON a.tx_id = b.tx
WHERE ATTRIBUTE_KEY = 'action' AND ATTRIBUTE_VALUE = 'remove_liquidity'
)
,
token_amount_add as (
SELECT
tx_id,
2*ATTRIBUTE_VALUE as token_amount_sei
FROM sei.core.fact_msg_attributes
WHERE tx_id IN (SELECT tx FROM add_liquidity)
Run a query to Download Data