Overview
The GovernanceDeployer contract is a factory that deploys complete governance systems with a single transaction. It creates a StakingVault (voting token), Governor, and Timelock Controller, all properly configured and connected.Key Features
- One-Transaction Deployment: Creates entire governance stack atomically
- Deterministic Addresses: Uses CREATE2 for predictable contract addresses
- Staking Vault Integration: Deploys ERC4626 staking vaults with voting power
- Timelock Control: Governor proposals execute through a timelock
- Guardian Roles: Supports guardian addresses with cancellation powers
Architecture
GovernanceDeployer uses minimal proxy clones (EIP-1167) for gas-efficient deployments:- Governor Implementation: Clone of FolioGovernor
- Timelock Implementation: Clone of TimelockControllerUpgradeable
- StakingVault Implementation: Clone of StakingVault
Deployment Functions
Deploy Governed Staking Token
Deploy a complete governance system with a new staking vault.string
Name of the staking vault token
string
Symbol of the staking vault token
IERC20
Underlying token that will be staked
GovParams
Governance parameters including voting periods, thresholds, and guardians
bytes32
Salt for deterministic deployment
GovernanceDeployer.sol
This function deploys all three contracts (StakingVault, Governor, Timelock) and configures them to work together. The timelock becomes the owner of the staking vault.
Deploy Governance With Timelock
Deploy only the Governor and Timelock (for existing voting tokens).GovParams
Governance parameters
IVotes
Existing voting token to use
bytes32
Salt for deterministic deployment
GovernanceDeployer.sol
Governance Parameters
TheGovParams struct configures all governance settings:
uint48
Delay before voting begins after proposal creation (seconds)
uint32
Duration of voting period (seconds)
uint256
Minimum voting power required to create a proposal (D18 format)
uint256
Minimum voting power required for quorum (D18 format)
uint256
Delay before approved proposals can be executed (seconds)
address[]
Addresses that can cancel malicious proposals
Default Configuration
uint256
default:"3.5 days"
Half-life for reward distribution in staking vaults
uint256
default:"1 week"
Delay before unstaked tokens can be withdrawn
Events
event
Emitted when a complete governance system with staking vault is deployedParameters:
underlying- Underlying token addressstToken- Deployed staking vault addressgovernor- Deployed governor addresstimelock- Deployed timelock address
event
Emitted when governance (without new staking vault) is deployedParameters:
stToken- Voting token addressgovernor- Deployed governor addresstimelock- Deployed timelock address
Implementation Addresses
address
Immutable address of the FolioGovernor implementation to clone
address
Immutable address of the TimelockController implementation to clone
address
Immutable address of the StakingVault implementation to clone