binhachonNew User Onboarding - #2
    Updated 2022-06-26
    with swap_txs as (
    select
    tx_id,
    count(*) as freq
    from flipside_prod_db.thorchain.swaps
    group by 1
    ),
    swap_txs_1 as (
    select
    min(block_timestamp) as block_timestamp,
    min(block_id) as block_id,
    '1. Swap' as type,
    blockchain,
    native_to_address as to_address
    from flipside_prod_db.thorchain.swaps
    where tx_id in (select tx_id from swap_txs where freq = 1)
    and blockchain != 'THOR'
    and to_address like 'thor%'
    group by 3, 4, 5
    ),
    upgrade_txs as (
    select
    to_address,
    '2. Upgrade' as type,
    min(block_id) as block_id,
    min(block_timestamp) as block_timestamp
    from flipside_prod_db.thorchain.upgrades
    group by 1, 2
    ),
    transfers as (
    select
    to_address,
    case
    when from_address in ('thor1ty6h2ll07fqfzumphp6kq3hm4ps28xlm2l6kd6', 'thor1t60f02r8jvzjrhtnjgfj4ne6rs5wjnejwmj7fh', 'thor1uz4fpyd5f5d6p9pzk8lxyj4qxnwq6f9utg0e7k') then '3. Transfer from CEX'
    else '3. Direct transfer' end
    as type,
    Run a query to Download Data