nsa2000osmo met3
    Updated 2023-02-11
    with tx_event AS (
    select
    distinct tx_id as tx_id_event, 'Superfluid Staking' as event from osmosis.core.fact_superfluid_staking
    union
    select distinct tx_id, 'Staking' as event from osmosis.core.fact_staking
    union
    select distinct tx_id, 'Staking Rewards' as event from osmosis.core.fact_staking_rewards
    union
    select distinct tx_id, 'Swaps' as event from osmosis.core.fact_swaps
    union
    select distinct tx_id, 'LP Action' as event from osmosis.core.fact_liquidity_provider_actions
    union
    select distinct tx_id, 'Governance Vote' as event from osmosis.core.fact_governance_votes
    union
    select distinct tx_id, 'IBC Transfer' as event from osmosis.core.fact_transfers WHERE transfer_Type !='OSMOSIS' -- exclude osmosis transfers
    -- ),
    -- events_aggregated AS (
    -- SELECT
    -- tx_id_event,
    -- array_agg(event) within group (order by event asc) as events_performed,
    -- count(tx_id_event) as counts
    -- FROM tx_event
    -- GROUP BY 1
    ),
    labelled_tx AS (
    SELECT
    block_timestamp,
    tx_id,
    tx_from,
    nvl(event, 'Others') as event,
    TRIM(REGEXP_REPLACE(fee, '[^[:digit:]]', ' ')) AS numeric_fee
    FROM osmosis.core.fact_transactions
    LEFT JOIN tx_event ON tx_id = tx_id_event
    )
    SELECT
    date_trunc('day', block_timestamp) as date,
    Run a query to Download Data