cloudr3n2023-09-11 09:37 PM
    Updated 2024-02-01
    -- decoded_log:to can be the same when origin_to_address is different
    SELECT
    sum(amount),
    count(from_address)
    FROM
    (SELECT
    block_timestamp,
    tx_hash,
    decoded_log:from as from_address,
    decoded_log,
    decoded_log:to as to_address,
    decoded_log:ERC20TokenValue*pow(10,-6) as amount
    --count(distinct decoded_log:to),
    --count(distinct origin_to_address)
    FROM
    polygon.core.ez_decoded_event_logs
    WHERE
    contract_address=lower('0xd2d74e2136d60a3c0d252c6de4102a82f2511def')
    and event_name='MerchantPayment'
    and decoded_log:ERC20Token='0xdc3326e71d45186f113a2f448984ca0e8d201995'
    --and decoded_log:tokenIds!=[3]

    )

    Last run: about 1 year ago
    SUM(AMOUNT)
    COUNT(FROM_ADDRESS)
    1
    18307.71192
    1
    16B
    10s