Skip to main content

Overview

The FolioDeployer contract is a factory that deploys new Folio instances. It supports two deployment patterns:
  1. Raw Folio: Deploy with predefined roles for manual governance
  2. Governed Folio: Deploy with full on-chain governance including timelock and voting

Key Features

  • Deterministic deployments using CREATE2
  • Integrated governance setup (optional)
  • Automatic role configuration
  • Asset transfer and initialization

Contract Details

FolioDeployer.sol

Deployment Functions

Deploy Raw Folio

Deploy a Folio with predefined role assignments.
FolioBasicDetails
Basic configuration including name, symbol, initial assets and shares
FolioAdditionalDetails
Additional settings including fees, auction length, and mandate
FolioFlags
Feature flags for trusted filler, rebalance control, and bids
address
Address to receive DEFAULT_ADMIN_ROLE
address[]
Addresses to receive REBALANCE_MANAGER role
address[]
Addresses to receive AUCTION_LAUNCHER role
address[]
Addresses to receive BRAND_MANAGER role
bytes32
Unique nonce for deterministic deployment
FolioDeployer.sol
The function automatically transfers the initial assets from msg.sender to the new Folio contract.

Deploy Governed Folio

Deploy a Folio with integrated on-chain governance.
IVotes
Staking vault for governance voting power (use address(0) for self-governance)
FolioBasicDetails
Basic Folio configuration
FolioAdditionalDetails
Additional Folio settings
FolioFlags
Feature flags
GovParams
Governance parameters for owner governor (reused for stToken if self-governed)
GovParams
Governance parameters for trading governor
GovRoles
Role assignments including existing basket managers
bytes32
Unique deployment nonce
FolioDeployer.sol

Deployment Process

Raw Folio Deployment

  1. CREATE2 Deployment: Deploys FolioProxyAdmin and FolioProxy deterministically
  2. Asset Transfer: Transfers initial assets from caller to Folio
  3. Initialization: Calls Folio.initialize() with provided parameters
  4. Role Setup: Grants roles to specified addresses
  5. Renounce: Deployer renounces admin role (unless deployer is owner)
Example Deployment

Governed Folio Deployment

  1. Folio Deployment: Uses deployFolio() internally with temporary owner
  2. Governance Deployment: Creates governor and timelock for ownership
  3. Optional Trading Governance: Creates separate governor for rebalancing (if no existing basket managers)
  4. Role Transfer: Swaps ownership to timelock
  5. ProxyAdmin Transfer: Transfers upgrade control to timelock
For self-governed Folios (stToken = address(0)), a new StakingVault is deployed using the Folio shares as the underlying asset.

Events

event
Emitted when a raw Folio is deployedParameters:
  • owner - Admin address
  • folio - Deployed Folio address
  • proxyAdmin - ProxyAdmin address
event
Emitted when a governed Folio is deployedParameters:
  • stToken - Staking token address
  • folio - Deployed Folio address
  • ownerGovernor - Owner governor address
  • ownerTimelock - Owner timelock address
  • tradingGovernor - Trading governor address
  • tradingTimelock - Trading timelock address

Data Structures

GovRoles

FolioDeployer.sol
address[]
Existing basket managers (pass empty array to deploy trading governor)
address[]
Addresses for AUCTION_LAUNCHER role
address[]
Addresses for BRAND_MANAGER role

Constructor

FolioDeployer.sol
The constructor:
  1. Sets immutable registry addresses
  2. Deploys the Folio implementation contract
  3. Stores the governance deployer reference

Deterministic Addresses

Deployments use CREATE2 for deterministic addresses:
Deployment Salt Calculation
Changing any parameter (including the order of role arrays) will result in a different deployment address.