Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/reserve-protocol/reserve-index-dtf/llms.txt

Use this file to discover all available pages before exploring further.

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.
name
string
Name of the staking vault token
symbol
string
Symbol of the staking vault token
underlying
IERC20
Underlying token that will be staked
govParams
GovParams
Governance parameters including voting periods, thresholds, and guardians
deploymentNonce
bytes32
Salt for deterministic deployment
GovernanceDeployer.sol
function deployGovernedStakingToken(
    string memory name,
    string memory symbol,
    IERC20 underlying,
    IGovernanceDeployer.GovParams calldata govParams,
    bytes32 deploymentNonce
) external returns (
    StakingVault stToken,
    address governor,
    address timelock
)
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
GovParams
Governance parameters
stToken
IVotes
Existing voting token to use
deploymentNonce
bytes32
Salt for deterministic deployment
GovernanceDeployer.sol
function deployGovernanceWithTimelock(
    IGovernanceDeployer.GovParams calldata govParams,
    IVotes stToken,
    bytes32 deploymentNonce
) public returns (address governor, address timelock)

Governance Parameters

The GovParams struct configures all governance settings:
votingDelay
uint48
Delay before voting begins after proposal creation (seconds)
votingPeriod
uint32
Duration of voting period (seconds)
proposalThreshold
uint256
Minimum voting power required to create a proposal (D18 format)
quorumThreshold
uint256
Minimum voting power required for quorum (D18 format)
timelockDelay
uint256
Delay before approved proposals can be executed (seconds)
guardians
address[]
Addresses that can cancel malicious proposals

Default Configuration

DEFAULT_REWARD_PERIOD
uint256
default:"3.5 days"
Half-life for reward distribution in staking vaults
DEFAULT_UNSTAKING_DELAY
uint256
default:"1 week"
Delay before unstaked tokens can be withdrawn

Events

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

Implementation Addresses

governorImplementation
address
Immutable address of the FolioGovernor implementation to clone
timelockImplementation
address
Immutable address of the TimelockController implementation to clone
stakingVaultImplementation
address
Immutable address of the StakingVault implementation to clone

Usage Example

// Example governance parameters
IGovernanceDeployer.GovParams memory params = IGovernanceDeployer.GovParams({
    votingDelay: 1 days,
    votingPeriod: 7 days,
    proposalThreshold: 100e18,  // 100 tokens
    quorumThreshold: 1000e18,   // 1000 tokens
    timelockDelay: 2 days,
    guardians: new address[](0)
});

// Deploy complete governance system
(StakingVault stToken, address governor, address timelock) = 
    deployer.deployGovernedStakingToken(
        "Staked FOL",
        "stFOL",
        folToken,
        params,
        bytes32(0)
    );
The deployer temporarily holds admin rights on the timelock but renounces them after granting guardian roles. This ensures proper decentralization.

Build docs developers (and LLMs) love