adriaparcerisasHistorical chart of a MakerDAO vote on poll 819
    Updated 2022-06-29
    with token_holders AS
    (
    SELECT
    date,
    address,
    sum(amount) as holding
    FROM
    (
    SELECT
    trunc(block_timestamp,'hour') as date,
    to_address as address,
    sum(raw_amount) / pow(10,18) as minute_amount,
    sum(minute_amount) over (partition by address order by date) as amount
    from ethereum.core.fact_token_transfers
    where contract_address = lower('0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2')
    --and block_timestamp <= '2022-06-27 16:00:00.000'
    -- and to_address = '0x0a3f6849f78076aefadf113f5bed87720274ddc0'
    group by 1,2

    UNION

    SELECT
    trunc(block_timestamp,'hour') as date,from_address as address,
    sum(-raw_amount) / pow(10,18) as minute_amount,
    sum(minute_amount) over (partition by address order by date) as amount
    from ethereum.core.fact_token_transfers
    where contract_address = lower('0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2')
    --and block_timestamp <= '2022-06-27 16:00:00.000'
    -- and from_address = '0x0a3f6849f78076aefadf113f5bed87720274ddc0'
    group by 1,2
    )
    group by 1,2
    order by 1 asc,3 desc
    )
    ,

    Run a query to Download Data