jackguyNFT-token-dash-5 copy copy
    Updated 2024-01-16
    -- forked from NFT-token-dash-5 copy @ https://flipsidecrypto.xyz/edit/queries/2703c2c6-decf-4951-b657-4539a9e2ca8c

    -- forked from NFT-token-dash-5 @ https://flipsidecrypto.xyz/edit/queries/c1f23276-d61d-4e2d-879e-b19d46774bb0

    with tab1 as (
    SELECT
    case when TOKEN1_SYMBOL LIKE 'WETH' then TOKEN0_ADDRESS else TOKEN1_ADDRESS end as token
    FROM ethereum.uniswapv3.ez_swaps
    where pool_address IN (
    lower('0x5ee84bed805df225ee23aec4160cc0bfcf1bd892'),
    lower('0xe72377ae353edc1d07f6c0be34969a481d030d19'),
    lower('0x882784c5807d5e2e4950ae2327ca5d9b56a1015a'),
    lower('0x92741be6adcb2722681925afce9af0a7306ce90f'),
    lower('0x4a382e0fb2abc4bc087d2f7953a4689ecbb96374'),
    lower('0xb17015d33c97a2caca73be2a8669076a333fd43d'),
    lower('0x01a8227d4e7c3068ad1000c97a059af5c5fa3476')
    )
    AND ( token0_symbol LIKE 'μAZUKI'
    OR token1_symbol LIKE 'μAZUKI' )
    ), tab2 as (
    SELECT
    block_timestamp,
    tx_hash,
    user,
    sum(CASE when flow like 'out' then -1 * amount else amount end) as net_flow
    FROM (
    SELECT
    block_timestamp,
    tx_hash,
    from_address as user,
    'out' as flow,
    RAW_AMOUNT_PRECISE::NUMBER(38, 0) as AMOUNT
    from ethereum.core.fact_token_transfers
    WHERE contract_address in (SELECT * FROM tab1)
    QueryRunArchived: QueryRun has been archived