Skip to main content

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

The GovParams 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 address
  • stToken - Deployed staking vault address
  • governor - Deployed governor address
  • timelock - Deployed timelock address
event
Emitted when governance (without new staking vault) is deployedParameters:
  • stToken - Voting token address
  • governor - Deployed governor address
  • timelock - 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

Usage Example

The deployer temporarily holds admin rights on the timelock but renounces them after granting guardian roles. This ensures proper decentralization.