Whitelisting with voting

Hi @frangio .

At Aragon, we saw the following need... We have a voting contract that lets people create votes and others to vote. One of the way this can be done is with ERC20 voting which uses ERC20Votes from OZ where we check if user has a token with getPastVotes. This is great, because if someone transfers his token, he can still vote for votes that were created before this user would transfer his tokens.

Now, we need a whitelist type of Voting. So, owner can add x amount of addresses and this means they are whitelisted. This needs checkpoints solution(if not, owner can remove the user from whitelist after some vote was created and now this user can't vote anymore since he was removed) as well taken from ERC20Votes, but it doesn't need delegate features + some others parts of the code from ERC20Votes, because whitelisting users mean, setting something to true or false at that specific block number.

I was curious if OZ already has this or you never came across with such a scenario ?

Thank you..

Hi @novaknole. I don't think we have something that will cover exactly this use case, but you should check out the Checkpoints data structure. I think you'd be able to use it out of the box to keep a checkpoint history for each account, where each checkpoint is a boolean (whether they are whitelisted or not). But this data structure is inefficient for that because each checkpoint is a 224 bit number. In your case you just need 1 bit really, so you can probably do something a lot more efficient.