Flipside TeamClanker world copy
    Updated 2024-11-27
    with tab1 as (
    SELECT
    DISTINCT tx_hash
    FROM base.core.fact_transactions
    where from_address in (lower('0xE0c959EeDcFD004952441Ea4FB4B8f5af424e74B'), lower('0xC204af95b0307162118f7Bc36a91c9717490AB69'))
    AND STATUS like 'SUCCESS'
    ), tab2 as (
    SELECT
    DISTINCT CONTRACT_ADDRESS
    from base.core.fact_token_transfers
    where tx_hash in (SELECT * from tab1)
    and from_address like '0x0000000000000000000000000000000000000000'
    )

    SELECT --*,
    date(block_timestamp) as date,
    count(*) as swaps,
    count(DISTINCT ORIGIN_FROM_ADDRESS) as trader,
    suM(
    case when not AMOUNT_OUT_USD is NULL then AMOUNT_OUT_USD
    when not AMOUNT_IN_USD is NULL then AMOUNT_IN_USD end
    ) as volume_usd


    FROM base.defi.ez_dex_swaps
    where token_out in (select * from tab2)
    OR token_in in (select * from tab2)

    GROUP BY 1
    --LIMIT 1000



    QueryRunArchived: QueryRun has been archived