Afonso_Diaz2023-08-13 12:05 AM
    Updated 2023-08-12
    with t1 as (
    select
    tx_hash,
    block_timestamp,
    datediff('day', block_timestamp, current_date) as wallet_age,
    receiver_id as sweat_wallet
    from near.core.fact_actions_events
    where signer_id in ('sweat_welcome.near', 'sweat_oracle_4.near')
    and receiver_id not in ('sweat_welcome.near', 'sweat_oracle_4.near')
    and tx_hash not in (select distinct tx_hash from near.core.fact_actions_events
    where
    signer_id = 'sweat_welcome.near'
    and (action_name = 'Stake'
    or (action_name = 'FunctionCall' and action_data:method_name ilike any ('deposit%', 'withdraw%'))
    ))
    and action_data:deposit/1e24 <= '0.05'
    and action_data:deposit/1e24 > 0
    ),

    t2 as (
    select
    tx_hash,
    block_timestamp,
    tx_signer
    from near.core.fact_transactions
    where tx_signer in (select distinct sweat_wallet from t1)
    and tx_status = 'Success'
    ),

    t3 as (
    select
    date_trunc('month', created_at)::date as month,
    count(distinct user) as new_user from (
    select
    tx_signer as user,
    min(block_timestamp) as created_at
    Run a query to Download Data