Closed QYuQianchen closed 2 years ago
DAO v0.2 vote happend on xDAI
chain at block 18650367
(timestamp 1634644345
), which corresponds to the block 13448027
(timestamp 1634644343
) on Ethereum blockchain
Value extracted from 1hive/xdai-blocks subgraph
{
blocks(where: {number: 18650367}) {
id
number
timestamp
}
}
and blocklytics/ethereum-blocks subgraph
{
blocks(first: 1, orderBy: number, orderDirection: desc, where: {timestamp_lte: 1634644345}) {
id
number
timestamp
}
}
WITH accounting_base AS (
SELECT "from", "to", "value" FROM erc20."ERC20_evt_Transfer"
WHERE "contract_address" = '\xf5581dfefd8fb0e4aec526be659cfab1f8c781da'
AND "evt_block_number" <= 13448027 -- Cut-off block number for snapshot voting Oct-19-2021 11:52:23 AM +UTC
), accounting_result AS (
SELECT account, sum(amount) AS balance FROM (
-- view from sender
SELECT "from" AS account, -1 * "value" AS amount FROM accounting_base
UNION ALL
-- view from recipient
SELECT "to" AS account, 1 * "value" AS amount FROM accounting_base
) AS t
GROUP BY account
ORDER BY balance DESC
)
SELECT * FROM accounting_result
WHERE balance > 0
Base layer: Accounts that are eligible for voting in DAO v0.2
actual_stake
,virtual_stake
,rewards_to_collect_until_now
. Remember to apply cutoff block number when importing raw events.Note that
erc20."ERC20_evt_Transfer"
table onethereum
andxdai
chain."contract_address"
are listed above.Middle layer: Accounts that are likely to vote
Top layer: Accounts that actually did vote
Get the value, aggregate in python and draw a funnel chart