Sbhn_NPtop-ivory
    Updated 2025-01-14
    with deposit as (
    SELECT
    sum(ethereum.public.udf_hex_to_int(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[0]) / pow(10,18)) AS deposited
    from ink.core.fact_event_logs
    where topic_0 = '0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15'
    and origin_to_address = '0xcab283e4bb527aa9b157bae7180fef19e2aaa71a'
    ),

    withdraw as (select
    sum(ethereum.public.udf_hex_to_int(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[0]) / pow(10,18)) AS withdrawn
    from ink.core.fact_event_logs
    where topic_0 = '0x6c3a45613039e0a1117bd6ce110ab3c920271709c010983d921a2cd268e2ea47'
    and origin_to_address = '0xcab283e4bb527aa9b157bae7180fef19e2aaa71a')

    select deposited,
    withdrawn,
    deposited-withdrawn as net
    from deposit,withdraw


    QueryRunArchived: QueryRun has been archived