AshlyCryptoLiFi Bridge
    Updated 2023-04-22
    with
    priceTb1 as (
    SELECT
    date_trunc('day', hour) as p_date,
    TOKEN_ADDRESS,
    DECIMALS,
    avg(price) as price
    FROM
    polygon.core.fact_hourly_token_prices
    GROUP by
    1,
    2,
    3
    ),
    priceTb2 as (
    SELECT
    date_trunc('day', hour) as p_date,
    symbol,
    avg(price) as price
    FROM
    ethereum.core.fact_hourly_token_prices
    GROUP by
    1,
    2
    )
    SELECT
    date_trunc('day', block_timestamp) as date,
    'Polygon' as chain,
    count(DISTINCT tx_hash) as tx_cnt,
    count(DISTINCT origin_from_address) as usr_cnt,
    sum(price * (raw_amount / pow(10, DECIMALS))) as volume,
    sum(tx_cnt) over (
    order by
    date
    ) as cum_tx_cnt,
    sum(Volume) over (
    Run a query to Download Data