freemartianPrice calculataion
    Updated 2025-01-10
    WITH
    -- =========== START PRICE CALCULATION ================
    temp_transaction AS (
    SELECT
    block_timestamp,
    tx_hash,
    decoded_log:sender::string AS user,
    (decoded_log:spentAmount/pow(10,18))::string AS amount_out,
    '3BC' AS from_token,
    'WETH' AS to_token,
    (decoded_log:returnAmount/pow(10,18))::string AS to_amount,
    to_amount / amount_out AS PRICE_3BC_IN_ETH
    FROM base.core.ez_decoded_event_logs
    WHERE decoded_log:srcToken = '0x3e64cd8fd4d2fae3d7f4710817885b0941838d0b'
    AND block_timestamp::date >= '2025-01-09'
    and event_name = 'Swapped'
    AND decoded_log:dstToken::string = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
    AND amount_out is not null and to_amount is not null
    ),
    temp_eth_price AS (
    SELECT hour, symbol, price AS eth_price FROM base.price.ez_prices_hourly
    where token_address = '0x4200000000000000000000000000000000000006'
    AND hour::date >= '2025-01-09'
    ),
    temp_results AS(
    SELECT
    t.block_timestamp AS block_timestamp,
    t.AMOUNT_OUT AS AMOUNT_3BC,
    t.TO_AMOUNT AS AMOUNT_ETH,
    t.PRICE_3BC_IN_ETH,
    e.ETH_PRICE,
    t.PRICE_3BC_IN_ETH * e.eth_price AS PRICE_3BC_IN_USD
    FROM
    temp_transaction t
    CROSS JOIN
    temp_eth_price e
    Last run: 3 months agoAuto-refreshes every 1 hour
    HOUR
    PRICE
    ROW_NUM
    1
    2025-01-10 05:00:00.0000.0033653097551
    2
    2025-01-10 04:00:00.0000.0032707287072
    3
    2025-01-10 03:00:00.0000.0036815657693
    4
    2025-01-10 02:00:00.0000.0039945921024
    5
    2025-01-10 01:00:00.0000.0040404986545
    6
    2025-01-10 00:00:00.0000.0041630111826
    7
    2025-01-09 23:00:00.0000.0045001354417
    8
    2025-01-09 22:00:00.0000.0042791863358
    9
    2025-01-09 21:00:00.0000.0035752871839
    10
    2025-01-09 20:00:00.0000.00298369238510
    11
    2025-01-09 19:00:00.0000.00318513740611
    12
    2025-01-09 18:00:00.0000.00383331505912
    13
    2025-01-09 17:00:00.0000.00402881593413
    14
    2025-01-09 16:00:00.0000.00492909499714
    15
    2025-01-09 15:00:00.0000.00548161384115
    16
    2025-01-09 14:00:00.0000.00476777784116
    17
    2025-01-09 13:00:00.0000.00407460307517
    18
    2025-01-09 12:00:00.0000.00469461249218
    19
    2025-01-09 11:00:00.0000.00548403305819
    20
    2025-01-09 10:00:00.0000.00612088635320
    26
    1KB
    5s