mariyabLUNA-LUNA withdraw Terraswap vs provideliquidity in astroport
Updated 2022-02-06
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
›
⌄
with
provider_to_astro as (
select
distinct event_attributes:sender::string as user,
event_attributes:"0_amount"::string/1e6 as amount
from terra.msg_events
where event_attributes:"0_contract_address" = 'terra1j66jatn3k50hjtg2xemnjm8s7y8dws9xqa5y8w'
AND event_attributes:"0_action" = 'provide_liquidity'),
withraw_from_terraswap as (
select
distinct event_attributes:"1_holder_address"::string as user,
event_attributes:"1_amount"::string/1e6 as amount
from terra.msg_events
where event_attributes:"0_contract_address" = 'terra1nuy34nwnsh53ygpc4xprlj263cztw7vc99leh2'
AND event_attributes:"1_action" = 'withdraw_liquidity'
and block_timestamp >= '2021-12-27'
),
all_together as (
select wt.user as user , pt.amount as add_amount ,wt.amount as remove_amount
from provider_to_astro as pt inner join withraw_from_terraswap as wt
on wt.user=pt.user
group by 1,2,3)
select
sum(REMOVE_AMOUNT) as REMOVE_AMOUNT,
sum(add_amount) as add_amount ,
count (user) as senders
from all_together
Run a query to Download Data