Sandeshnear treasury
Updated 2023-02-16
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 9f5a4bc9-210e-4797-9b05-1ae88d5bc99b
-- forked from jackguy https://flipsidecrypto.xyz/jackguy/mdao-multisigs-M7MTQW
with near_out as
(
with near_price as
(
select recorded_hour::date as "date",avg(close) as price_usd from crosschain.core.fact_hourly_prices
where id='near'
and provider='coingecko'
group by "date"
),
near_txns as
(
select fr.block_timestamp,
fr.tx_hash,
parse_json(fr.actions):"receipt":"Action":"actions"[0]:"Transfer":"deposit" as amount,
parse_json(fr.actions):"receipt":"Action":"signer_id" as sender,
parse_json(fr.actions):"receiver_id" as receiver,
amount*np.price_usd as amount_usd
from near.core.fact_receipts fr
inner join near_price np
on fr.block_timestamp::date=np."date"
where 1=1
-- and tx_hash='BSudcmqufUaHRZcvPqdgexGHYBM7xrfDC9JF7uHy6wAy'
and( sender = '79501b068d4fcbbcea3e7c332891a7d8abfd9864657b9c2cc3c18c944b1db558'
or receiver = '79501b068d4fcbbcea3e7c332891a7d8abfd9864657b9c2cc3c18c944b1db558')
-- and receiver != '79501b068d4fcbbcea3e7c332891a7d8abfd9864657b9c2cc3c18c944b1db558'
and amount is not null
)
select * from near_txns
)
SELECT
*,
Run a query to Download Data