tkvresearchexuberant-beige
    Updated 2024-11-26
    with full_data as
    (
    select * from (values
    ('0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf','cbBTC','Ethereum')
    ) as l1(address,token_name,chain)
    )
    ,

    pre_final_data as

    (
    select BLOCK_TIMESTAMP,
    'Ethereum' as chain,
    SYMBOL,
    AMOUNT
    from ethereum.core.ez_token_transfers
    where contract_address in (select lower(address) from full_data)
    and from_address = '0x0000000000000000000000000000000000000000'
    union all
    select BLOCK_TIMESTAMP,
    'Ethereum' as chain,
    SYMBOL,
    -AMOUNT
    from ethereum.core.ez_token_transfers
    where contract_address in (select lower(address) from full_data)
    and to_address = '0x0000000000000000000000000000000000000000'
    union all
    select BLOCK_TIMESTAMP,
    'Base' as chain,
    SYMBOL,
    AMOUNT
    from base.core.ez_token_transfers
    where contract_address in (select lower(address) from full_data)