0Pricing
Web3 & DApp Development Fundamentals · Aula

Propostas e votação

Contratos de governança

Propostas e votação é uma aula grátis de Web3 & DApp Development Fundamentals no CoddyKit. Esta é a aula 3 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Web3 & DApp Development Fundamentals, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Web3 & DApp Development Fundamentals inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

The Governance Lifecycle

On-chain governance follows a clear lifecycle: propose, vote, queue, execute.

Each stage is handled by a Governor smart contract that enforces the rules automatically.

The Governor Contract

OpenZeppelin's Governor is the standard framework for DAO voting. It manages proposals, tallies votes, and triggers execution.

It is modular: you plug in a vote-counting strategy, a token, and timing parameters.

contract MyGovernor is
    Governor,
    GovernorVotes,
    GovernorVotesQuorumFraction,
    GovernorTimelockControl
{ /* ... */ }

Creating a Proposal

A proposal bundles the actions to execute: target contracts, call data, and values, plus a human-readable description.

governor.propose(
    [targetContract],   // addresses
    [0],                // ETH values
    [callData],         // encoded function calls
    "Increase reward rate to 5%"
);

The Voting Delay

After a proposal is created, a voting delay passes before voting opens.

This gives members time to review and lets the snapshot block settle so balances are fixed.

votingDelay  = 1 block   // wait before voting
votingPeriod = 50400 blocks // ~1 week of voting

Casting Votes

During the voting period, members cast votes weighted by their delegated power at the snapshot block.

Standard options are For, Against, and Abstain.

governor.castVote(proposalId, 1);
// 0 = Against, 1 = For, 2 = Abstain

Vote Counting and Quorum

When voting ends, the Governor tallies the weighted votes. A proposal succeeds only if it has more For than Against votes and meets the quorum.

Abstain votes typically count toward quorum but not toward the For/Against decision.

Proposal States

A proposal moves through defined states:

  • Pending — waiting for voting delay
  • Active — voting open
  • Defeated or Succeeded
  • Queued then Executed

Queuing a Successful Proposal

A succeeded proposal is usually queued in a timelock before it can run.

This delay (covered next lesson) is a safety buffer letting users react before the change takes effect.

governor.queue(targets, values, calldatas, descHash);

Execution

After the timelock delay, anyone can call execute to carry out the proposal's actions on-chain.

The Governor (or its timelock) holds the permissions needed to make the changes.

governor.execute(targets, values, calldatas, descHash);
// the approved actions now run

Gas Costs and Off-Chain Voting

On-chain voting costs gas per vote. To save costs, many DAOs deliberate and signal off-chain (Snapshot) and only push final, binding actions on-chain.

This hybrid keeps participation cheap while preserving trustless execution.

Putting It Together

Governor contracts standardize the propose-vote-queue-execute flow. Voting delays, periods, quorum, and proposal states make governance predictable and secure.

Next we focus on timelocks, the safety layer before execution.

Quick Check

Test your understanding of the governance flow.

Recap: Proposals and Voting

You learned that:

  • Governance follows propose, vote, queue, execute
  • The Governor contract enforces the rules
  • A voting delay and period structure the timeline
  • Success needs a majority For plus quorum
  • Proposals pass through defined states

Next: timelocks and safe execution.

Perguntas Frequentes

A aula “Propostas e votação” é grátis?

Sim — o texto completo de “Propostas e votação” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Web3 & DApp Development Fundamentals, atualize para CoddyKit PRO. O curso de Web3 & DApp Development Fundamentals inclui 4 aulas no total.

O que vou aprender em “Propostas e votação”?

Contratos de governança Você pratica Web3 & DApp Development Fundamentals com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Web3 & DApp Development Fundamentals?

Nenhuma experiência prévia é necessária. Web3 & DApp Development Fundamentals no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 3 de 4.

Quanto tempo leva a aula “Propostas e votação”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Web3 & DApp Development Fundamentals?

Sim. Cada aula de Web3 & DApp Development Fundamentals inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. O que é uma DAO
  2. Tokens de governança
  3. Propostas e votação
  4. Bloqueios temporais e execução
← Voltar para Web3 & DApp Development Fundamentals