mamad-5XN3k32024-07-18 03:14 PM
    Updated 2024-07-19
    /*SELECT *
    , concat('0x',substr(data, 24 + 3, 32 + 8)) AS user_address
    , ethereum.public.udf_hex_to_int(substr(data,( 64) + 24 + 3, 32 + 8)) as amount_klay
    , ethereum.public.udf_hex_to_int(substr(data,( 64*2) + 24 + 3, 32 + 8)) as staked_token_amount
    FROM kaia.core.fact_event_logs
    WHERE tx_hash = '0xcf468d012cca562ecbd958013261913be8273124a9d45ad84665f874622bcf4c'
    AND topics[0] = '0x5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6'*/



    select
    distinct DECODED_LOG:"from"
    ,EVENT_NAME
    ,count(distinct ORIGIN_FROM_ADDRESS)
    ,sum(ethereum.public.udf_hex_to_int(DECODED_LOG:"secondArg"))/1e18 as amount_klay1
    FROM kaia.core.ez_decoded_event_logs
    --from kaia.core.ez_token_transfers
    where
    --TOPICS[0] = '0x658055f08cf63659025f616b2baf94baf8f4d2ee9c600c2ae722b4b7716cce46'
    --FROM_ADDRESS = lower('0xDfF9D1Cff3c37B84704EEd4465A83E6c453C35F6')
    --or TO_ADDRESS = lower('0xDfF9D1Cff3c37B84704EEd4465A83E6c453C35F6')
    TOPICS[0] = '0xdd9ce6d431d4ac3e8bea81bc2d7760b97d30c4e54252d8c8c59054849b8f61b5'
    /*tx_hash = lower('0xa57dc010d4ef7c1803a6b442f27d9f276d8278799207700649bfcdd7668c45ff')
    or tx_hash = lower('0x6692839b04986e425be80fe99f49534b3dd01bbe9a81dc0390d19380b88ec15f')
    or tx_hash = lower('0xb9ce1c1ef39d623c35da13e23e5be1d8ad0e3797682d83e6377887bee567e1e3')*/
    group by 1,2
    order by 4 desc


    /*select
    *
    , concat('0x',substr(data, 24 + 3, 32 + 8)) AS user_address
    , ethereum.public.udf_hex_to_int(substr(data,( 64) + 24 + 3, 32 + 8)) as amount_klay
    , ethereum.public.udf_hex_to_int(substr(data,( 64*2) + 24 + 3, 32 + 8)) as staked_token_amount
    FROM kaia.core.fact_event_logs
    --from kaia.core.ez_token_transfers
    QueryRunArchived: QueryRun has been archived