Afonso_Diaztop stakers
    Updated 2025-01-19
    with

    pricet as (
    select
    hour::date as date,
    avg(price) as price_usd
    from near.price.ez_prices_hourly
    where symbol = 'BRRR'
    group by 1
    ),

    stakes as (
    select
    tx_hash,
    block_timestamp,
    signer_id as user,
    args:amount/1e18 as amount
    from near.core.fact_actions_events_function_call
    where method_name = 'account_stake_booster'
    and receiver_id = 'contract.main.burrow.near'
    and receipt_succeeded = 1
    and block_timestamp >= '2024-07-01'
    ),

    main as (
    select
    *,
    amount * price_usd as amount_usd
    from stakes
    left join pricet on date = block_timestamp::date
    )

    select
    user,
    count(distinct tx_hash) as transactions,
    sum(amount) as volume_brrr,
    QueryRunArchived: QueryRun has been archived