adriaparcerisasOsmosis whales 2.4
    Updated 2022-06-20
    WITH
    whales as (
    SELECT
    distinct delegator_address as user,
    sum(case when action='delegate' and currency='uosmo' then amount/pow(10,decimal) else 0 end) as delegated,
    sum(case when action='undelegate' and currency='uosmo' then amount/pow(10,decimal) else 0 end) as undelegated,
    delegated-undelegated as staked
    from osmosis.core.fact_staking
    group by 1
    )
    SELECT
    project_name,
    --to_currency,
    --case when staked >25000 then 'whale'
    --else 'everyday user' end as user_type,
    count(distinct tx_id) as swaps
    FROM osmosis.core.fact_swaps x, whales w, osmosis.core.dim_labels y
    WHERE x.trader=w.user and x.to_currency=y.address
    and staked>25000
    group by 1
    order by 2 desc
    Run a query to Download Data