ArioDaily TVL ($) in NEAR Protocol by Top 5 Projects
    Updated 2024-04-08
    -- forked from Saleh / here_stake_fin_total @ https://flipsidecrypto.xyz/Saleh/q/MVCqz-9KpUzq/here_stake_fin_total
    with price as (
    select
    date_trunc(day, hour) as date,
    avg(PRICE) as price
    from
    near.price.ez_prices_hourly
    where
    SYMBOL = 'WNEAR'
    group by
    1
    ),
    lst_stake as (
    select
    'Stake' as type
    ,block_timestamp::date as date
    ,tx_hash
    ,SIGNER_ID as wallet
    ,RECEIVER_ID
    ,DEPOSIT/1e24 as amount
    from near.core.fact_actions_events_function_call join near.core.fact_transactions using( tx_hash)
    where RECEIVER_ID='storage.herewallet.near'
    and METHOD_NAME in( 'deposit','storage_deposit')
    and RECEIPT_SUCCEEDED=true
    )
    ,lst_unstake_tg as (
    select
    'Unstake_TG' as type
    ,block_timestamp::date as date
    ,tx_hash
    ,PREDECESSOR_ID as wallet
    ,RECEIVER_ID
    ,-1*ARGS:amount/1e24 as amount
    from near.core.fact_actions_events_function_call
    join near.core.fact_transactions using( tx_hash)
    QueryRunArchived: QueryRun has been archived