jackguyCopy of osmo holders
    Updated 2022-10-15
    WITH tab1 as (
    SELECT
    receiver,
    min(block_timestamp) min_in,
    sum(amount) as sum_in
    FROM osmosis.core.fact_transfers
    LEFT outer JOIN osmosis.core.dim_labels
    ON currency = address
    WHERE (project_name LIKE 'wBNB'
    OR currency = CONCAT('u', lower('wBNB')))
    AND receiver LIKE '%osmo%'
    GROUP BY 1
    ), tab2 as (
    SELECT
    SENDER,
    max(block_timestamp) max_out,
    sum(amount) as sum_out
    FROM osmosis.core.fact_transfers
    LEFT outer JOIN osmosis.core.dim_labels
    ON currency = address
    WHERE (project_name LIKE '{{t'
    OR currency = CONCAT('u', lower('wBNB')))
    AND receiver LIKE '%osmo%'
    GROUP BY 1
    ), tab3 as (
    SELECT
    *,
    sum_in - sum_out as net_tokens
    from tab1
    LEFT outer JOIN tab2
    ON sender = receiver
    ), tab4 as (
    SELECT
    *,
    sum(new_u) over (ORDER BY min_in) as sum_num_u
    FROM (
    Run a query to Download Data