Yousefi_1994MarketingDAO - Total Value Locked
Updated 2023-02-13
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 deposit_found as (
select
block_timestamp,
tx_hash,
actions:predecessor_id as predecessor_id,
case
when actions:receipt:Action:actions[0]:FunctionCall:deposit is not null then actions:receipt:Action:actions[0]:FunctionCall:deposit
when actions:receipt:Action:actions[2]:Transfer:deposit is not null then actions:receipt:Action:actions[2]:Transfer:deposit
else actions:receipt:Action:actions[0]:Transfer:deposit
end as deposit
from near.core.fact_receipts
where receiver_id = 'marketing.sputnik-dao.near'
),
withdraw_fund as (
select
block_timestamp,
tx_hash,
receiver_id,
actions:receipt:Action:actions[0]:Transfer:deposit as withdraw
from near.core.fact_receipts
where actions:predecessor_id = 'marketing.sputnik-dao.near'
),
near_price_usd as (
select
timestamp::date as days,
avg(price_usd) as price_usd
from near.core.fact_prices
where symbol = 'wNEAR'
and timestamp::date = current_date - 1
group by days
limit 1
),
deposit_final_result as (
select
sum(deposit)/1e24 as amount
from deposit_found
Run a query to Download Data