cloudr3nGrabSG - Voucher Purchased
    Updated 2024-02-01
    /*
    contract_address = 0xd2d74e2136d60a3c0d252c6de4102a82f2511def -- same for all 3 vouchers
    ids 0 -- $1
    ids 1 -- $2
    ids 2 -- $5

    TransferBatch = Mint
    MerchantPayment = Voucher Redeemed
    */

    SELECT
    date(block_timestamp) as day,
    count(tx_hash) as purchase_count,
    sum(purchase_count) over (order by day asc) cumu_purchase,
    cumu_purchase*14 as cumu_purchase_sgd
    FROM
    polygon.core.ez_decoded_event_logs
    WHERE
    contract_address=lower('0xd2d74e2136d60a3c0d252c6de4102a82f2511def')
    and event_name='TransferBatch'
    and origin_to_address='0xd2d74e2136d60a3c0d252c6de4102a82f2511def'
    and origin_from_address!='0x3aa7e64b811857d942e6cc39cfbbad2664b14cdf' -- likely dev wallet
    GROUP BY
    day
    ORDER BY
    day desc
    Last run: about 1 year ago
    DAY
    PURCHASE_COUNT
    CUMU_PURCHASE
    CUMU_PURCHASE_SGD
    1
    2024-01-31 00:00:00.0009184325802
    2
    2024-01-30 00:00:00.0003183425676
    3
    2024-01-29 00:00:00.0001183125634
    4
    2024-01-28 00:00:00.0005183025620
    5
    2024-01-27 00:00:00.0001182525550
    6
    2024-01-25 00:00:00.00022182425536
    7
    2024-01-24 00:00:00.0001180225228
    8
    2024-01-23 00:00:00.0006180125214
    9
    2024-01-22 00:00:00.0001179525130
    10
    2024-01-21 00:00:00.00015179425116
    11
    2024-01-20 00:00:00.0003177924906
    12
    2024-01-17 00:00:00.0004177624864
    13
    2024-01-15 00:00:00.00011177224808
    14
    2024-01-14 00:00:00.00017176124654
    15
    2024-01-13 00:00:00.0003174424416
    16
    2024-01-12 00:00:00.0002174124374
    17
    2024-01-11 00:00:00.0001173924346
    18
    2024-01-10 00:00:00.0008173824332
    19
    2024-01-09 00:00:00.0001173024220
    20
    2024-01-08 00:00:00.0002172924206
    ...
    131
    5KB
    7s