hess10. Top Traded By Volume
    Updated 2025-03-08
    with base as (select tx_hash,
    block_timestamp,
    origin_from_address AS swapper,
    DECODED_LOG:"amount0In"::NUMBER AS amount0In,
    DECODED_LOG:"amount0Out"::NUMBER AS amount0Out,
    DECODED_LOG:"amount1In"::NUMBER AS amount1In,
    DECODED_LOG:"amount1Out"::NUMBER AS amount1Out,
    DECODED_LOG:"sender"::STRING AS sender,
    DECODED_LOG:"to"::STRING AS recipient,
    contract_address as pool_address,
    case when decoded_log:amount1Out::NUMBER = 0 then decoded_log:amount1In::NUMBER else decoded_log:amount1Out::NUMBER end AS token_1_amounts,
    case when decoded_log:amount0In::NUMBER = 0 then decoded_log:amount0Out::NUMBER else decoded_log:amount0In::NUMBER end AS token_0_amounts,
    DECODED_LOG:"amount0"::NUMBER as amount0,
    DECODED_LOG:"amount1"::NUMBER as amount1,
    case when amount0 > 0 then amount0 else abs(amount0) end as token0,
    case when amount1 > 0 then amount1 else abs(amount1) end as token1,
    Coalesce(token_1_amounts,token1) as token_1_amount,
    Coalesce(token_0_amounts,token0) as token_0_amount
    FROM ink.core.ez_decoded_event_logs
    WHERE event_name = 'Swap'
    and origin_to_address = lower('0x652e53c6a4fe39b6b30426d9c96376a105c89a95')
    and TX_SUCCEEDED = 'TRUE')
    ,
    pool as (select concat('0x', substr(topics[1], 24 + 3, 32 + 8)) as token_0_address,
    concat('0x', substr(topics[2], 24 + 3, 32 + 8)) as token_1_address,
    regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS pool_data,
    concat('0x', substr(pool_data[0], 25, 40)) as pool_address
    from ink.core.fact_event_logs
    having pool_address is not null)
    ,
    pair as ( select a.*,
    token_0_address,
    token_1_address
    from base a left outer join pool b on a.pool_address = b.pool_address)
    ,
    token_bonk as ( select * from $query('43200306-984d-4255-816a-7685810d5804'))
    Last run: about 1 month ago
    TOKEN_NAME
    TOKEN_ADDRESS
    VOLUME
    1
    USDC0xf1815bd50389c46847f0bda824ec8da914045d148367610.53939918
    2
    USDT00x0200c29006150606b650577bbe7b6248f58470c16998736.35523129
    3
    WETH0x42000000000000000000000000000000000000065909927.66706647
    4
    xVELO0x7f9adfbd38b669f03d1d11000bc76b9aaea28a81989841.878565288
    5
    CAT0x20c69c12abf2b6f8d8ca33604dd25c700c7e70a5302453.284259645
    6
    iETH0x11476323d8dfcbafac942588e2f38823d2dd308e153045.451044237
    7
    PRL0x75e7a5316e44755ff4ad724ee45337d1eef6895e98176.89174796
    8
    PURPLE0xd642b49d10cc6e1bc1c6945725667c35e0875f2275950.160659794
    9
    MYST0xee73d2f34d66f0f07af6ab37b42713520e33119c15295.966924692
    10
    DINERO0x09d9420332bff75522a45fcff4855f82a0a3ff508245.674284709
    10
    709B
    5s