HDKL5
    Updated 2023-06-12
    with
    last_price as (
    select
    avg(close) as valu_usd
    from
    flow.core.fact_hourly_prices x
    join (
    select
    max(recorded_hour) as dates
    from
    flow.core.fact_hourly_prices
    where
    id ilike '%sloppy%'
    ) y on x.recorded_hour = y.dates
    where
    id ilike '%sloppy%'
    )
    select
    *,
    References * valu_usd as usd_References
    from
    (
    SELECT
    case
    when Merchants = '0x53f389d96fb4ce5e' then 'Donation wallet'
    when Merchants = '0xbfb26bb8adf90399' then 'SLOPPY-FLOW Pool'
    when Merchants = '0xc6cfb151ff031094' then 'SLOPPY-USDC Pool'
    else Merchants
    end as Merchants,
    volume_deposited,
    volume_withdrawn,
    volume_deposited - volume_withdrawn as References
    from
    (
    SELECT
    ifnull(x.wallet, y.wallet) as Merchants,
    Run a query to Download Data