0Pricing
Web3 & DApp Development Fundamentals · レッスン

提案と投票

Governorコントラクト

「提案と投票」はCoddyKit上の無料Web3 & DApp Development Fundamentalsレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはWeb3 & DApp Development Fundamentals学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Web3 & DApp Development Fundamentalsコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

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.

よくある質問

「提案と投票」レッスンは無料ですか?

はい。「提案と投票」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Web3 & DApp Development Fundamentalsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Web3 & DApp Development Fundamentalsコースには全4レッスンが含まれています。

「提案と投票」で何を学びますか?

Governorコントラクト ブラウザで直接実行するハンズオンコードでWeb3 & DApp Development Fundamentalsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Web3 & DApp Development Fundamentalsを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのWeb3 & DApp Development Fundamentalsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「提案と投票」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このWeb3 & DApp Development Fundamentalsレッスンでコードを書いて実行できますか?

はい。すべてのWeb3 & DApp Development Fundamentalsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. DAOとは
  2. ガバナンストークン
  3. 提案と投票
  4. タイムロックと実行
← Web3 & DApp Development Fundamentalsに戻る