vegardtotal walkers
    Updated 2022-09-19
    with
    list1 as (
    select tx_receiver as user_address, (deposit / pow(10, 24)) as near_amount
    from near.core.fact_transfers
    where tx_signer like '%sweat_oracle_%'
    and status = 1
    having near_amount <= 0.055
    ),

    list2 as (
    select
    block_timestamp::date as day,
    tx_hash,
    replace(value, 'EVENT_JSON:') as json,
    try_parse_json(json):data as data
    from near.core.fact_receipts,
    table(flatten(input => logs))
    where receiver_id = 'token.sweat'
    and regexp_substr(status_value, 'Success') != ''
    and try_parse_json(json):event = 'ft_mint'
    ),

    list3 as (
    select day, tx_hash,
    value:amount / pow(10, 18) as near_amount,
    value:owner_id as owner_id,
    value:new_owner_id as owner_id_new,
    case when owner_id_new is not null then owner_id_new else owner_id end as origin_to_address
    from list2, table(flatten(input => data))
    where near_amount > 0
    )

    select count(distinct(owner_id)) as number_of_walkers from list3
    where exists (
    select * from list1 where list3.origin_to_address = list1.user_address
    )
    Run a query to Download Data