Mahrood copy
    Updated 2023-02-12
    -- forked from cbb5d898-0dac-4b91-9bf4-08f814a4b4e0

    with osmosis as ( select tx_from, trunc(block_timestamp,'week') as weeks
    from osmosis.core.fact_transactions
    where block_timestamp::date >= '2022-01-01'
    )
    ,
    weeks as ( select tx_from, count(weeks) as total_week
    from osmosis
    group by 1)
    ,
    active as ( select tx_from
    from weeks
    where total_week >= 20)
    ,
    swap as ( select date(BLOCK_TIMESTAMP) as date, trader as user, tx_id
    from osmosis.core.fact_swaps
    where trader in (select tx_from from active)
    and block_timestamp::date >= '2022-01-01')
    ,
    superfluid as ( select date(block_timestamp) as date, DELEGATOR_ADDRESS as user, tx_id
    from osmosis.core.fact_superfluid_staking
    where DELEGATOR_ADDRESS in (select tx_from from active)
    and block_timestamp::date >= '2022-01-01')
    ,
    staking as ( select date(block_timestamp) as date, DELEGATOR_ADDRESS as user, tx_id
    from osmosis.core.fact_staking
    where action = 'delegate'
    and DELEGATOR_ADDRESS in (select tx_from from active)
    and block_timestamp::date >= '2022-01-01')
    ,
    voting as ( select date(block_timestamp) as date, voter as user, tx_id
    from osmosis.core.fact_governance_votes
    where voter in (select tx_from from active)
    and block_timestamp::date >= '2022-01-01')
    ,
    Run a query to Download Data