# IGovernorFactory

Matt Stam (@mattstam)

IGovernorFactory

Clone factory for deploying token clones (minimal proxies of IGovernor).

https://blog.openzeppelin.com/workshop-recap-cheap-contract-deployment-through-clones/ Only CREATE2 / deterministic creation is supported, since in the Git Consensus Protocol onboarding, the addresses will always need to be be predicted ahead of time. The usual flow is: 1. Predict the address of the governor using GovernorFactory.predictAddress() 2. Deploy the token using TokenFactory.createToken(..., govAddr, ...) 3. Deploy the governor using GovernorFactory.createGovernor(..., tokenAddr, ...)

# Methods

# createGovernor

function createGovernor(address tokenAddr, string name, uint256 votingDelay, uint256 votingPeriod, uint256 proposalThreshold, uint256 quorumNumerator, bytes32 salt) external nonpayable returns (address instanceAddr)

Creates an IGovernor with an optional initial distribution. Uses CREATE2 so that the governor's address can be computed deterministically using predictAddress().

# Parameters

Name Type Description
tokenAddr address The ERC20 token that will be used for voting.
name string Name of the governor (e.g. "ExampleGovernor").
votingDelay uint256 The number of blocks that must pass between a proposal being proposed and when it becomes executable (e.g. 1 = 1 block).
votingPeriod uint256 The number of blocks that voting is open for a proposal (e.g. 100800 = 2 weeks = 12/s per block).
proposalThreshold uint256 The minimum number of votes required for an account to create a proposal (e.g. 0 = anyone can create a proposal).
quorumNumerator uint256 The quorumNumerator/100 to give a percentage representing minimum number of votes out of the supply required to pass a proposal (e.g. 5 = 5%).
salt bytes32 The salt value used by CREATE2.

# Returns

Name Type Description
instanceAddr address The address of the newly created governor clone.

# predictAddress

function predictAddress(bytes32 salt) external view returns (address instanceAddr)

Predicts the address of an IGovernor deployed using CREATE2 + salt value.

# Parameters

Name Type Description
salt bytes32 The salt value used by CREATE2.

# Returns

Name Type Description
instanceAddr address The address of the newly created governor clone.

# Events

# GovernorCreated

event GovernorCreated(address instanceAddr, address creatorAddr, address tokenAddr, string name, uint256 votingDelay, uint256 votingPeriod, uint256 proposalThreshold, uint256 quorumNumerator)

# Parameters

Name Type Description
instanceAddr address undefined
creatorAddr address undefined
tokenAddr address undefined
name string undefined
votingDelay uint256 undefined
votingPeriod uint256 undefined
proposalThreshold uint256 undefined
quorumNumerator uint256 undefined