CryptoIcicleOsmo-20.Hot Contracts on Osmosis
    Updated 2022-07-09
    -- Payout 58.649 OSMO
    -- Grand Prize 175.95 OSMO
    -- Level Beginner

    -- Q20. A lot of new contracts are being deployed on Osmosis lately.
    -- Since the beginning of May, answer the following questions:
    -- What are the top ten most popular contracts on Osmosis?
    -- What is the cumulative total of contracts launched on Osmosis, and have there been any spikes since the Terra crash or other noteworthy events?
    with txns as (
    select
    concat(l1.label,'-->', l2.label) as pair,
    s.*
    from osmosis.core.fact_swaps s
    join osmosis.core.fact_transactions t on s.tx_id = t.tx_id and t.fee ilike '%uosmo'
    join osmosis.core.dim_labels l1 on l1.address = s.from_currency
    join osmosis.core.dim_labels l2 on l2.address = s.to_currency
    where s.block_timestamp >= '2022-05-01'
    and from_currency <> to_currency
    ),
    top_10 as (
    select
    pair as type,
    count(distinct tx_id) as n_txns
    from txns
    group by type
    order by n_txns desc
    limit 10
    )

    select
    date_trunc('day',block_timestamp) as date,
    pair as type,
    count(distinct tx_id) as n_txns
    from txns
    where pair in (select type from top_10)
    Run a query to Download Data