puriftiming analysis cubquest
    Updated 2024-08-25
    with beraland_deleg as (select date_trunc('day',block_timestamp) as day, concat('0x',substr(TOPICS[1], 27,64)) as address, (ethereum.public.udf_hex_to_int(data)::int)/1e18 as amount, tx_hash
    from berachain.testnet.fact_event_logs
    where ORIGIN_TO_ADDRESS='0xbda130737bdd9618301681329bf2e46a016ff9ad'
    and contract_address='0xbda130737bdd9618301681329bf2e46a016ff9ad'
    and ORIGIN_FUNCTION_SIGNATURE='0xfb8afcfa'
    and concat('0x',substr(TOPICS[2], 27,64))=lower('0x35c1e9C7803b47aF738f37Beada3C7c35Eed73d4')
    order by BLOCK_TIMESTAMP desc),
    leasing as (
    select user, day from (
    select date_trunc('day', block_timestamp) as day, concat('0x',substr(TOPICS[1], 27,64)) as user, tx_hash from berachain.testnet.fact_event_logs
    where contract_address=lower('0x76511C7470Ab395C1D7d6F56E1998f64e346a915')
    and topics[0]='0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62'
    and concat('0x',substr(TOPICS[2], 27,64))=lower('0x0000000000000000000000000000000000000000')
    )
    ),
    badge_minters as (
    select
    distinct minter as minter
    from
    (
    select
    decoded_log ['to'] as minter,
    from
    berachain.testnet.fact_decoded_event_logs
    where
    CONTRACT_ADDRESS = lower('0x886D2176D899796cD1AfFA07Eff07B9b2B80f1be')
    and decoded_log ['from'] = lower('0x0000000000000000000000000000000000000000')
    )
    ),
    mint_honey as (
    select user, sum(amount) as amount from (
    select date_trunc('day', block_timestamp) as day, concat('0x',substr(TOPICS[1], 27,64)) as user, (utils.udf_hex_to_int(substr(data,67,64))::int)/1e18 as amount, tx_hash from berachain.testnet.fact_event_logs
    where contract_address=lower('0xAd1782b2a7020631249031618fB1Bd09CD926b31')
    and topics[0]='0x5bf1ae7c4c81d8f51bd6f74471f2622d4952dfeca98ba4f9f0da428b2f84edf5'
    ) group by 1 having count(distinct tx_hash)=1
    ),
    QueryRunArchived: QueryRun has been archived