binhachonFLOOR Tokens - #4
    Updated 2022-07-02
    with total_supply as (
    select
    block_timestamp,
    from_address as address,
    -raw_amount/1e9 as amount
    from ethereum.core.fact_token_transfers
    where contract_address = lower('0xf59257E961883636290411c11ec5Ae622d19455e')
    and to_address = '0x0000000000000000000000000000000000000000'
    union all
    select
    block_timestamp,
    to_address as address,
    raw_amount/1e9 as amount
    from ethereum.core.fact_token_transfers
    where contract_address = lower('0xf59257E961883636290411c11ec5Ae622d19455e')
    and from_address = '0x0000000000000000000000000000000000000000'
    ),
    total_supply_1 as (
    select
    date_trunc('day', block_timestamp) as time,
    sum(amount) as daily_amount,
    sum(case when address = '0x759c6de5bca9ade8a1a2719a31553c4b7de02539' then amount else 0 end) as rebase_amount,
    sum(rebase_amount) over (order by time) as total_rebase_amount,
    sum(daily_amount) over (order by time) as total_supply,
    rebase_amount / total_supply * 100 as daily_APY
    from total_supply
    group by 1
    ),
    price as (
    select
    date_trunc('day', hour) as time,
    avg(price) as price_usd
    from ethereum.core.fact_hourly_token_prices
    where token_address = lower('0xf59257E961883636290411c11ec5Ae622d19455e')
    group by 1
    )
    Run a query to Download Data