hessOverview of Staking Sweat (Last 30 Days)
    Updated 2024-08-16
    with tb1 as ( select DISTINCT tx_signer as user
    from near.core.fact_transactions a join near.core.dim_address_labels b on a.tx_receiver = b.address
    where project_name ilike '%sweat%'
    UNION
    select DISTINCT tx_receiver as user
    from near.core.fact_transactions a join near.core.dim_address_labels b on a.tx_signer = b.address
    where project_name ilike '%sweat%'
    )
    ,
    tb2 as ( select block_timestamp,
    tx_hash,
    status_value,
    replace(value, 'EVENT_JSON:') as json,
    regexp_substr(status_value, 'Success') as reg_success,
    try_parse_json(json):standard as standard,
    try_parse_json(json):event as event,
    try_parse_json(json):data as data_logs
    from near.core.fact_receipts,
    table(flatten(input => logs))
    where 1=1
    and receiver_id = 'token.sweat'
    and reg_success is not null
    and block_timestamp >= '2024-01-01'
    ),

    tb3 AS ( select block_timestamp,
    tx_hash,
    standard,
    event,
    value:amount/pow(10,18) as amount,
    value:owner_id as owner_id,
    value:old_owner_id as old_owner_id,
    value:new_owner_id as new_owner_id,
    nvl(old_owner_id, 'mint') as from_address,
    nvl(new_owner_id, owner_id) as to_address
    from tb2, table(flatten(input => data_logs))
    QueryRunArchived: QueryRun has been archived