MoDeFinear bd - supply dist
Updated 2024-10-10
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
›
⌄
-- forked from near bd - holders balance dist @ https://flipsidecrypto.xyz/edit/queries/650cb15f-c7dd-4cda-a4b4-feb670fc3707
with panicked_txs as (
select tx_hash
from near.core.fact_receipts
where STATUS_VALUE:Failure is not null
and block_timestamp::date>'2023-10-28'
group by 1),
succeeded_txs as (
select tx_hash as tx
from near.core.fact_transactions
where tx_succeeded=true
and block_timestamp::date>'2023-10-28'
and tx_hash not in (select tx_hash from panicked_txs)),
price as (
select
value[0]::string as hour,
value[1]::float as price
from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/queries/7ea1cb32-d9b9-4f97-89f2-ae4fda842f00/latest-run')
as response), lateral FLATTEN (input => response:data:result:rows)),
----------------------- ft transfers -----------------------
--$bd token transfers
bd_transfers as (
select BLOCK_TIMESTAMP, from_address, to_address, amount_raw, amount_raw/pow(10,24) as amount, tx_hash
from (
select l.value::STRING as str,
split(str,' ')[1] as amount_raw,
split(str,' ')[3]::string as from_address,
split(str,' ')[5]::string as to_address, a.*
from near.core.fact_receipts a,
LATERAL FLATTEN(INPUT => a.logs) l
where RECEIVER_ID='blackdragon.tkn.near'
and (str ilike 'Transfer % from % to %' or str ilike 'Refund % from % to %')
QueryRunArchived: QueryRun has been archived