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 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
contract FolioDeployer is IFolioDeployer, Versioned {
    address public immutable versionRegistry;
    address public immutable daoFeeRegistry;
    address public immutable trustedFillerRegistry;
    address public immutable folioImplementation;
    IGovernanceDeployer public immutable governanceDeployer;
}

Deployment Functions

Deploy Raw Folio

Deploy a Folio with predefined role assignments.
basicDetails
FolioBasicDetails
Basic configuration including name, symbol, initial assets and shares
additionalDetails
FolioAdditionalDetails
Additional settings including fees, auction length, and mandate
folioFlags
FolioFlags
Feature flags for trusted filler, rebalance control, and bids
owner
address
Address to receive DEFAULT_ADMIN_ROLE
basketManagers
address[]
Addresses to receive REBALANCE_MANAGER role
auctionLaunchers
address[]
Addresses to receive AUCTION_LAUNCHER role
brandManagers
address[]
Addresses to receive BRAND_MANAGER role
deploymentNonce
bytes32
Unique nonce for deterministic deployment
FolioDeployer.sol
function deployFolio(
    IFolio.FolioBasicDetails calldata basicDetails,
    IFolio.FolioAdditionalDetails calldata additionalDetails,
    IFolio.FolioFlags calldata folioFlags,
    address owner,
    address[] memory basketManagers,
    address[] memory auctionLaunchers,
    address[] memory brandManagers,
    bytes32 deploymentNonce
) public returns (Folio folio, address proxyAdmin)
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.
stToken
IVotes
Staking vault for governance voting power (use address(0) for self-governance)
basicDetails
FolioBasicDetails
Basic Folio configuration
additionalDetails
FolioAdditionalDetails
Additional Folio settings
folioFlags
FolioFlags
Feature flags
ownerGovParams
GovParams
Governance parameters for owner governor (reused for stToken if self-governed)
tradingGovParams
GovParams
Governance parameters for trading governor
govRoles
GovRoles
Role assignments including existing basket managers
deploymentNonce
bytes32
Unique deployment nonce
FolioDeployer.sol
function deployGovernedFolio(
    IVotes stToken,
    IFolio.FolioBasicDetails calldata basicDetails,
    IFolio.FolioAdditionalDetails calldata additionalDetails,
    IFolio.FolioFlags calldata folioFlags,
    IGovernanceDeployer.GovParams calldata ownerGovParams,
    IGovernanceDeployer.GovParams calldata tradingGovParams,
    GovRoles calldata govRoles,
    bytes32 deploymentNonce
) external returns (Folio folio, address proxyAdmin)

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
// Deploy a basic Folio
FolioDeployer deployer = FolioDeployer(DEPLOYER_ADDRESS);

IFolio.FolioBasicDetails memory basicDetails = IFolio.FolioBasicDetails({
    name: "My Index Folio",
    symbol: "MIF",
    assets: [DAI, USDC, USDT],
    amounts: [1000e18, 1000e6, 1000e6],
    initialShares: 3000e18
});

(Folio folio, address proxyAdmin) = deployer.deployFolio(
    basicDetails,
    additionalDetails,
    folioFlags,
    owner,
    basketManagers,
    auctionLaunchers,
    brandManagers,
    keccak256("unique-salt")
);

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

FolioDeployed
event
Emitted when a raw Folio is deployedParameters:
  • owner - Admin address
  • folio - Deployed Folio address
  • proxyAdmin - ProxyAdmin address
GovernedFolioDeployed
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
struct GovRoles {
    address[] existingBasketManagers;
    address[] auctionLaunchers;
    address[] brandManagers;
}
existingBasketManagers
address[]
Existing basket managers (pass empty array to deploy trading governor)
auctionLaunchers
address[]
Addresses for AUCTION_LAUNCHER role
brandManagers
address[]
Addresses for BRAND_MANAGER role

Constructor

FolioDeployer.sol
constructor(
    address _daoFeeRegistry,
    address _versionRegistry,
    address _trustedFillerRegistry,
    IGovernanceDeployer _governanceDeployer
)
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
bytes32 deploymentSalt = keccak256(
    abi.encode(
        msg.sender,
        keccak256(
            abi.encode(
                basicDetails,
                additionalDetails,
                folioFlags,
                owner,
                basketManagers,
                auctionLaunchers,
                brandManagers
            )
        ),
        deploymentNonce
    )
);
Changing any parameter (including the order of role arrays) will result in a different deployment address.

Build docs developers (and LLMs) love