maybeyonasno_thor_bnb
    Updated 2021-12-13
    with multi_swaps_txs as (
    select tx_id from (
    select
    tx_id,
    count(tx_id) as swaps
    from thorchain.swaps
    group by 1
    )
    where swaps > 1
    ),
    native_swaps as (
    select
    split(from_asset,'-')[0]::string as from_asset,
    split(to_asset,'-')[0]::string as to_asset,
    split(from_asset,'.')[0]::string as from_chain,
    split(to_asset,'.')[0]::string as to_chain,
    split(from_asset,'-')[0]::string || ' to ' || split(to_asset,'-')[0]::string as asset_route,
    from_chain || ' to ' || to_chain as chain_route,
    case when from_chain=to_chain then 'Same chain'
    else 'Different chain' end as swap_type,
    count(tx_id) as swaps,
    sum(from_amount) as from_amount,
    sum(to_amount) as to_amount,
    sum(from_amount_usd) as from_amount_usd,
    sum(to_amount_usd) as to_amount_usd
    from thorchain.swaps
    where tx_id not in (select tx_id from multi_swaps_txs)
    group by 1,2,3,4,5,6,7
    ),
    swap_from as (
    select
    block_timestamp,
    tx_id,
    from_asset,
    from_amount,
    from_amount_usd
    Run a query to Download Data