Governance / GovernanceToken.delegate


trying to understand governanceToken.delegate call. I follow the tutorial by dao-template/01-deploy-governor-token.ts at main · PatrickAlphaC/dao-template (

I modified it a bit and I am playing now with more voters than just the deployer / in my case alice.

For example created the following:

  • governanceToken - ERC20Votes
  • split the token between two addresses (alice bob).
  • when I call castVoteWithReason the vote gets executed, but the voteWeight I get back for Bob - 2nd voter is always 0, and not his actual voteWeight - which is his balance of governance Token...

I guess I am missing some scope here, so would like more context... where can I read more about it.

CallStack and events

Simple Test Code is here: blockchain-developer-bootcamp-final-project-v2/VoteFlow.t.sol at feat/foundry-testing-switch · kristjank/blockchain-developer-bootcamp-final-project-v2 (

TL;DR: Why is Bobs weight always 0? even if we transfered half of governance tokens to him?

Thanks all

Got it working, by moving 1 block forward after the delegate calls. Why do we still need to call
blockchain-developer-bootcamp-final-project-v2/VoteFlow.t.sol at master · kristjank/blockchain-developer-bootcamp-final-project-v2 (

in order for the ERC20Votes to take the votes into account? Snapshot?

You need to advance the blocks until the proposal becomes "active". The proposal becomes active in your case 1 block after proposing.

I believe you need to mine 2 blocks instead of just 1 because the votes snapshot refers to the end of the block not the beginning, so it needs to be completely mined before the governor can query votes at that block.

thanks Frangio. Got that, but a small question...

So in order for me to test the full flow, I had to call delegate with all the four voters, then move 1 block forward.

The logic that was following (propose, vote, queue and execute) then works.

Looking to get the right reasoning for this, so I can understand the expected flows.

Yes tokens do not count as votes until delegated, including as one's own votes.

This is mentioned in the docs for ERC20Votes:

By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.

if we pass 3 contract address as targets in proposal, when we want execute transactions, what will happen if first contract don't has fallback function for receive ether ?

Thanks @frangio! Appreciate the direction and explanation.

Did you try to simulate it?