Implement of Governor.sol & ERC20Votes.sol

Hi Team,
I am currently implementing the governor contract to make the community decide the certain contract parameters.
I am planning to implement Governor.sol + ERC20Votes.sol. I have a question about the current contract code in Governor.sol as well as ERC20Votes.sol.

  1. Users can freely delegate their votes by delegate() in ERC20Votes.sol.
  2. We can determine that if a certain user has already voted for a certain proposal by hasVoted(proposalId, account)

It is good to use the current ERC20Votes' checkpoint to vote for the proposal, but how can it prevent the user to double vote by just simply re-delegate the checkpoints to their other address after he/she cast his/her votes so that he/she can vote infinitely. The reason why I asked is that I cannot see any checkpoint destroy or lock mechanism in governor logic or I do not know how to do that.

It will be very appreciated if you can sure me how to prevent the double vote or how I can implement this feature.

Many thanks!

Take a look at the Ballot.sol contract on Remix. It also implements a working delegation feature without double delegation but you'll need to modify it to work with ERC20 tokens.

ERC20Votes keeps track of historical voting power, and the Governor contract will query the voting power at the block that voting started. So if a user transfers and delegates, that will not apply to an ongoing vote.

Please note that at the time this question was asked Governor had not been released yet. I imagine you were looking at the master branch on GitHub. You should always use the releases rather than this branch.