Salehzomland-staking-date_new_stakers
    Updated 2024-09-29
    with lst_price as (
    select
    date_trunc(hour,HOUR) as price_date
    ,avg(CLOSE) as avg_price
    from near.price.fact_prices_ohlc_hourly
    where ASSET_ID='wrapped-near'
    and price_date is not null
    -- and hour::date >= '2024-06-16'
    group by 1
    )
    ,lst_stake as (
    select
    'Stake' as type
    ,block_timestamp::date as date_a
    ,tx_hash
    ,signer_id as wallet
    ,args:amount/1e24 as amount

    from near.core.fact_actions_events_function_call
    -- where tx_hash='Gdg1QboJXVCKRLqWufAnK6FjVYVbcTgXUrHxneDXhnwW'
    where args:msg='ft_staking'
    and receiver_id='ft.zomland.near'
    and method_name='ft_transfer_call'
    and RECEIPT_SUCCEEDED=true
    )
    ,lst_unstake as (
    select
    'Untake' as type
    ,block_timestamp::date as date_a
    ,tx_hash
    ,signer_id as wallet
    ,-1*args:amount/1e24 as amount
    from near.core.fact_actions_events_function_call
    -- where tx_hash='GFwPZy1jeMWparRShjqT8Boj4JoArFtQXJHBsnmZk2oX'
    where method_name='withdraw_stake'
    and RECEIVER_ID='ft.zomland.near'
    QueryRunArchived: QueryRun has been archived