banterlyticsGen Kong Distro copy
    Updated 2023-05-28
    with all_tx as (
    select date_trunc('day', block_timestamp::date) as dt,
    tx_hash, decoded_log:to::string as event_to,
    decoded_log:from::string as event_from, (decoded_log:value::int)/pow(10,18) as amounts
    from ethereum.core.fact_decoded_event_logs
    where block_timestamp > '2022-01-01'
    and contract_address = lower('0x94e496474F1725f1c1824cB5BDb92d7691A4F03a')
    and event_name = 'Transfer'
    and block_timestamp < current_date - 30
    union all
    select date_trunc('day', block_timestamp::date) as dt,
    tx_hash, decoded_log:to::string as event_to,
    decoded_log:from::string as event_from, (decoded_log:value::int)/pow(10,18) as amounts
    from polygon.core.fact_decoded_event_logs
    where block_timestamp > '2022-02-28'
    and contract_address = lower('0xbC91347e80886453F3f8bBd6d7aC07C122D87735')
    and event_name = 'Transfer'
    and block_timestamp < current_date - 30),
    transfers as
    ((SELECT
    event_to as wallet,
    dt,
    'mint' as action,
    amounts as value
    FROM all_tx
    where event_from = '0x0000000000000000000000000000000000000000')
    union all
    (SELECT `1`
    event_to as wallet,
    dt,
    'gain' as action,
    amounts as value
    FROM all_tx
    where event_from != '0x0000000000000000000000000000000000000000')
    Run a query to Download Data