CryptoLionUST dominance swap currency
    Updated 2021-07-24
    SELECT
    date_trunc('day',terra.swaps.block_timestamp) as day,
    sum(offer_amount_usd) as swap_amount,
    terra.swaps.offer_currency as swap_currency,
    -- terra.swaps.ask_currency as swapto_currency,
    count(terra.swaps.trader) as swaps,
    count(distinct terra.swaps.trader) as distinct_traders
    FROM terra.swaps
    INNER JOIN terra.msgs on terra.swaps.tx_id = terra.msgs.tx_id
    INNER JOIN terra.labels c
    ON msg_value:contract::string = c.address

    WHERE
    terra.swaps.block_timestamp >= CURRENT_DATE - 90
    AND terra.swaps.tx_status = 'SUCCEEDED'
    AND offer_amount_usd > 0
    AND address_name LIKE 'Terraswap%'
    AND address_name IS NOT NULL
    GROUP BY 1,3
    HAVING swap_currency IS NOT NULL
    -- AND swapto_currency IS NOT NULL
    ORDER BY 1 DESC
    Run a query to Download Data