binhachonTerra LP-ers: Aftermath - Swap
Updated 2022-06-21
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 address_list as (
select
distinct from_address
from (
select
from_address,
pool_name,
sum(case when lp_action = 'add_liquidity' then stake_units else -stake_units end) as stake_units
from flipside_prod_db.thorchain.liquidity_actions
where pool_name like 'TERRA.%'
and from_address like 'thor%'
and block_timestamp::date <= '2022-05-20'
group by 1, 2
)
where stake_units > 0
),
last_date as (
select
max(block_timestamp) as last_date
from flipside_prod_db.thorchain.liquidity_actions
where pool_name like 'TERRA.%'
and block_timestamp::date <= '2022-05-12'
),
latest_actions as (
select
address,
max(latest_action) as latest_action
from (
select
from_address as address,
max(block_timestamp) as latest_action
from flipside_prod_db.thorchain.swaps
where address in (select from_address from address_list)
group by 1
union all
select
Run a query to Download Data