banterlytics2023-07-28 07:48 PM
    Updated 2023-09-28
    WITH gen 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:tokenId::string AS token_id
    FROM ethereum.core.fact_decoded_event_logs
    WHERE block_timestamp BETWEEN '2021-04-15 19:56:00.000' AND '2023-07-28 13:43:36.000'
    AND contract_address = lower('0x57a204aa1042f6e66dd7730813f4024114d74f37')
    AND event_name = 'Transfer'
    AND token_id < 1001
    ),
    bebe 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:tokenId::string AS token_id
    FROM ethereum.core.fact_decoded_event_logs
    WHERE block_timestamp BETWEEN '2021-04-15 19:56:00.000' AND '2023-07-28 13:43:36.000'
    AND contract_address = lower('0x57a204aa1042f6e66dd7730813f4024114d74f37')
    AND event_name = 'Transfer'
    AND token_id > 1000
    ),
    transfers AS (
    SELECT
    event_to AS wallet,
    dt,
    'mint' AS action,
    1 AS value
    FROM gen
    WHERE event_from = '0x0000000000000000000000000000000000000000'
    UNION ALL
    SELECT
    Run a query to Download Data