Abolfazl_771025terra_supply 9
Updated 2023-01-01
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
›
⌄
with luna_price as(select
date_trunc('day',RECORDED_HOUR) as date,
avg(CLOSE) as price
from crosschain.core.fact_hourly_prices
where ID = 'terra-luna-2'
group by 1
),main as (select
date_trunc('day',block_timestamp) as date,
RECEIVER,
TX_ID,
sum(AMOUNT)/pow(10,6) as "staking reward (Luna)"
from terra.core.ez_transfers
where MESSAGE_VALUE['@type'] ='/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward'
and CURRENCY='uluna'
and TX_SUCCEEDED = TRUE
group by 1,2,3)
select
a.date,
count(DISTINCT tx_id) as "count of rewards distributed transaction",
count(DISTINCT RECEIVER) as "count of users that rewards distributed them",
sum("staking reward (Luna)") as "staking reward (Luna)",
sum("staking reward (Luna)"*price) as "staking reward (USD)"
from main a join luna_price b on a.date=b.date
group by 1
Run a query to Download Data