cheeyoung-kekUntitled Query
Updated 2022-07-23Copy Reference Fork
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
›
⌄
with
trans as
(
select
txn_hash,
receiver_id as contract
from flipside_prod_db.mdao_near.actions_events_addkey
where BLOCK_TIMESTAMP >= CURRENT_DATE - 7
),
gas as (
select a.TXN_HASH,BLOCK_TIMESTAMP, TX_SIGNER, contract , transaction_fee/pow(10,24) as fee , (gas_used) / Power(10, 12) as gas_used ,TX_RECEIPT[0]:outcome:status as status
from flipside_prod_db.mdao_near.transactions a inner join trans b
on b.TXN_HASH =a.TXN_HASH
where BLOCK_TIMESTAMP >= CURRENT_DATE - 7
)
select
BLOCK_TIMESTAMP::date as date ,
case when contract is null then 'others ' else contract end as contract,
sum(fee) as tx_fee ,
sum(gas_used) as gas_used
from gas
where status ilike '%succes%'
group by 1,2
order by gas_used desc
limit 50
Run a query to Download Data