cloudr3n2023-05-01 11:12 PM
    Updated 2023-05-01
    with
    dexSwaps as
    (select
    block_timestamp,
    tx_hash,
    origin_from_address, amount_in,amount_out,
    case when amount_in_usd is null then amount_out_usd
    when amount_out_usd is null then amount_in_usd
    when amount_in_usd>=amount_out_usd then amount_in_usd
    when amount_out_usd>amount_in_usd then amount_out_usd end as amount_usd,
    token_in, token_out, symbol_in,
    case when token_out='0x1337bedc9d22ecbe766df105c9623922a27963ec' then 'av3CRV'
    when token_out='0x53f7c5869a859f0aec3d334ee8b4cf01e3492f21' then 'avWETH'
    when token_out='0x686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d' then 'avWBTC'
    when token_out='0xf14f4ce569cb3679e99d5059909e23b07bd2f387' then 'NXUSD'
    when token_out='0x0f577433bf59560ef2a79c124e9ff99fca258948' then 'MONEY'
    when token_out='0x46a51127c3ce23fb7ab1de06226147f446e4a857' then 'avUSDC'
    when token_out='0x532e6537fea298397212f09a61e03311686f548e' then 'avUSDT'
    when token_out='0xd586e7f844cea2f87f50152665bcbc2c279d8d70' then 'DAI.e'
    else symbol_out end as symbol_out
    from
    avalanche.core.ez_dex_swaps
    where token_in not in
    ('0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7', --wavax
    '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', --usdc
    '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664', --usdce
    '0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7', --usdt
    '0xc7198437980c041c805a1edcba50c1ce5db95118', --usdte
    '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab', --weth
    '0x152b9d0fdc40c096757f570a51e494bd4b943e50', --btcb
    '0x50b7545627a5162f82a992c33b87adc75187b218' --wbtc
    ) AND
    token_out not in
    ('0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7', --wavax
    '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', --usdc
    '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664', --usdce
    Run a query to Download Data