adriaparcerisassweat after ai integration
    Updated 2025-03-01

    WITH
    t1 as (
    select
    trunc(block_timestamp,'day') as date,
    count(distinct tx_signer) as users
    FROM near.core.fact_transactions
    where tx_succeeded = 'TRUE'
    group by 1
    ),
    t2 as(
    SELECT
    trunc(block_timestamp,'day') as date,
    count(distinct tx_signer) as users
    FROM near.core.fact_transactions
    WHERE tx_receiver = 'token.sweat' and tx_succeeded = 'TRUE'
    group by 1
    )
    SELECT
    ifnull(t1.date,t2.date) as date,
    ifnull(t1.users,0) as near_users,
    ifnull(t2.users,0) as sweat_users,
    sweat_users/near_users as share_rate
    from t1
    left join t2 on t1.date=t2.date
    where t1.date>=current_date-INTERVAL '1 MONTH' and t1.date<current_date
    order by 1 asc