rajsSynquote TC
    Updated 2022-10-22
    SELECT
    address,
    sum(amount) as amount
    FROM
    (
    SELECT
    case when contract_address = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' then -event_inputs:value / pow(10,6)
    when contract_address = '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6' then -event_inputs:value / pow(10,8)
    else -event_inputs:value / pow(10,18) end as amount,
    block_timestamp,
    event_inputs:"from" as address,
    'Sent' as type,
    contract_address
    from polygon.core.fact_event_logs
    -- where tx_hash = '0xa7f9054d39581908b9594081f1fe627b18d359b44ecff95725124eee5365f0f4'
    where origin_to_address = '0xc0b06137bfdd5bf5c099eb6e6ebeb9342dad1dd8'
    -- and event_inputs:"from" = '0x74838cff669b37cb5ee1fac9d525057f62ea9023'
    and event_inputs:"to" = '0x0abbf77da112cd7f0316663aca1a1107cb4ef6d7'
    and event_name = 'Transfer'
    and block_timestamp >= '2022-10-10 08:00:00.000'
    -- and block_timestamp <= '2022-10-14 13:30:00.000'

    UNION

    SELECT
    case when contract_address = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' then event_inputs:value / pow(10,6)
    when contract_address = '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6' then event_inputs:value / pow(10,8)
    else event_inputs:value / pow(10,18) end as amount,
    block_timestamp,
    event_inputs:"to" as address,
    'Received' as type,
    contract_address
    from polygon.core.fact_event_logs
    -- where tx_hash = '0xa7f9054d39581908b9594081f1fe627b18d359b44ecff95725124eee5365f0f4'
    where origin_to_address = '0xc0b06137bfdd5bf5c099eb6e6ebeb9342dad1dd8'
    -- and event_inputs:"to" = '0x74838cff669b37cb5ee1fac9d525057f62ea9023'
    Run a query to Download Data