binhachonTHORChain and $vTHOR Overlap - #1
Updated 2022-05-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 vthor_holders as (
select
address,
sum(amount) as current_balance
from (
select
from_address as address,
-raw_amount/1e18 as amount
from flipside_prod_db.ethereum_core.fact_token_transfers
where contract_address = '0x815c23eca83261b6ec689b60cc4a58b54bc24d8d'
and from_address != '0x0000000000000000000000000000000000000000'
union all
select
to_address as address,
raw_amount/1e18 as amount
from flipside_prod_db.ethereum_core.fact_token_transfers
where contract_address = '0x815c23eca83261b6ec689b60cc4a58b54bc24d8d'
and to_address != '0x0000000000000000000000000000000000000000'
)
group by 1
),
thorchain_current_lper as (
select
case
when asset_address like '0x%' then asset_address
else coalesce(from_address, asset_address)
end as lper,
pool_name,
sum(case when lp_action = 'add_liquidity' then stake_units else - stake_units end) as current_lping
from flipside_prod_db.thorchain.liquidity_actions
group by 1, 2
),
vthor_holders_with_lp as (
select
vthor_holders.*,
pool_name,
Run a query to Download Data