purifconventional-tan
    Updated 2024-09-25
    with data as (select tx_hash,concat('0x',substr(TOPICS[1], 27,64)) as address,
    utils.udf_hex_to_int(substr(substr(data, 0,66),3,66)) as timestamp,
    (utils.udf_hex_to_int(substr(data,67,64))::int)/1e18 as pot_before,
    (utils.udf_hex_to_int(substr(data,131,64))::int)/1e18 as pot_after,
    utils.udf_hex_to_int(substr(data,323,64))::int as yeet_count,
    utils.udf_hex_to_int(substr(data,387,64))::int as yeet_round,
    from berachain.testnet.fact_event_logs
    where ORIGIN_TO_ADDRESS=LOWER('0x14D65204c710997F595F4663f0451b66d3532f53')
    and ORIGIN_FUNCTION_SIGNATURE='0x8bbefe4b'
    and topics[0]='0x67e0e8435cacda8ca6cf3a8f63b166cdb95dc96e7d1c6e068009b117d47e1ac6'
    order by block_timestamp)

    select address, sum(pot_after-pot_before) as yeet_amount
    from data
    group by 1 having(sum(pot_after-pot_before)) >=1
    order by 2 desc

    --https://docs.cloud.debank.com/en/readme/api-pro-reference/user#get-user-total-balance-on-all-supported-chains
    /*select live.udf_api(
    'GET',
    'https://pro-openapi.debank.com/v1/user/total_balance?id=0x5853ed4f26a3fcea565b3fbc698bb19cdf6deb85',
    {'Accept': 'application/json',
    'AccessKey':''},
    {}
    ) as resp*/
    QueryRunArchived: QueryRun has been archived