adriaparcerisasBSC Sushiswap swap pairs
    Updated 2022-08-04
    WITH
    info as (
    select
    distinct event_inputs:pair as pair_address,
    event_inputs:token0 as address_in,
    event_inputs:token1 as address_out,
    case when address_in='0x15ecc58be6d8ae1a3a0b40340c606bf4bd4dce1f' then 'Binance Web3'
    when address_in='0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c' then 'Wrapped BNB'
    when address_in='0x71cce0035d82c21cf4b908bcd8f1117fff0fa623' then 'bitcoin'
    when address_in ='0xc282acb42f4dc31b65904f2a751d1ba7966e377a' then 'SNRW.e (Wormhole)'
    when address_in='0xcfb5d517b8cbf188f656cc211122cb0ea1bd8813' then 'Annihilation'
    when address_in='0x9d427e2fe3ad2cb93f83118d472a6068b4a778d6' then 'FMI COIN'
    when address_in='0x2170ed0880ac9a755fd29b2688956bd959f933f8' then 'Binance-Peg Ethereum Token'
    else z.address_name end as token_in,
    case when address_out='0x15ecc58be6d8ae1a3a0b40340c606bf4bd4dce1f' then 'Binance Web3' --3
    when address_out='0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c' then 'Wrapped BNB' --18
    when address_out='0x71cce0035d82c21cf4b908bcd8f1117fff0fa623' then 'bitcoin' --18
    when address_out ='0xc282acb42f4dc31b65904f2a751d1ba7966e377a' then 'SNRW.e (Wormhole)' --18
    when address_out='0xcfb5d517b8cbf188f656cc211122cb0ea1bd8813' then 'Annihilation' --18
    when address_out='0x9d427e2fe3ad2cb93f83118d472a6068b4a778d6' then 'FMI COIN' --10
    when address_out='0x2170ed0880ac9a755fd29b2688956bd959f933f8' then 'Binance-Peg Ethereum Token' --18
    else zz.address_name end as token_out,
    concat(token_in,'-',token_out) as swap_pair,
    case when token_in = 'FMI COIN' then 10
    when token_in = 'Binance Web3' then 9
    else 18 end as token_in_decimals,
    case when token_out = 'FMI COIN' then 10
    when token_out = 'Binance Web3' then 9
    else 18 end as token_out_decimals
    from bsc.core.fact_event_logs x
    left join bsc.core.dim_labels y on x.event_inputs:pair=y.address
    left join bsc.core.dim_labels z on x.event_inputs:token0=z.address
    left join bsc.core.dim_labels zz on x.event_inputs:token1=zz.address
    where origin_to_address = lower('0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506') --sushiswap router address
    and event_name = 'PairCreated' and tx_status = 'SUCCESS'
    )
    Run a query to Download Data