Skip to main content

Overview

The FolioVersionRegistry contract maintains a registry of Folio implementation versions. It tracks which deployer contracts are available for creating new Folios and allows the protocol to deprecate insecure or outdated versions.

Key Features

  • Version Tracking: Maps version strings to FolioDeployer contracts
  • Latest Version: Maintains pointer to most recent deployment
  • Deprecation: Can mark versions as deprecated for security
  • Version Queries: Retrieve deployer and implementation for any version

Registration Functions

Register Version

Register a new Folio version with its deployer.
IFolioDeployer
Address of the FolioDeployer contract for this version
FolioVersionRegistry.sol
The version string is automatically read from the deployer contract using Versioned(address(folioDeployer)).version(). Each version can only be registered once.
Only protocol owners can register new versions. The newly registered version automatically becomes the latest version.

Deprecate Version

Mark a version as deprecated, preventing its use in UI and warning users.
bytes32
Keccak256 hash of the version string to deprecate
FolioVersionRegistry.sol
Deprecation is irreversible. This should only be used for versions with security issues or critical bugs. Requires owner or emergency council role.

Query Functions

Get Latest Version

Retrieve the most recently registered version.
FolioVersionRegistry.sol
Returns:
  • versionHash: Keccak256 hash of version string
  • version: Human-readable version string (e.g., “3.4.1”)
  • folioDeployer: Deployer contract address
  • deprecated: Whether this version is deprecated
The latest version may be deprecated if it was the most recent registration before being flagged. Always check the deprecated flag.

Get Implementation for Version

Retrieve the Folio implementation address for a specific version.
bytes32
Version hash to look up
FolioVersionRegistry.sol

Get Deployer

Direct mapping access to get deployer for a version hash.
FolioVersionRegistry.sol

Check Deprecation Status

Check if a version is deprecated.
FolioVersionRegistry.sol

Events

event
Emitted when a new version is registeredParameters:
  • versionHash - Keccak256 hash of version string
  • folioDeployer - Deployer contract address
event
Emitted when a version is deprecatedParameters:
  • versionHash - Hash of deprecated version

Errors

error
Thrown when trying to register a zero address
error
Thrown when caller lacks required permissions
error
Thrown when trying to register an already-registered version
error
Thrown when trying to deprecate an already-deprecated version
error
Thrown when querying an unregistered version

Access Control

IRoleRegistry
Immutable reference to the RoleRegistry for permission checks
Permissions:
  • registerVersion(): Requires owner role
  • deprecateVersion(): Requires owner or emergency council role

Version Hash Calculation

Version hashes are calculated as:
For example, version “3.4.1” becomes:

Usage Example

Integration with Versioned Contract

All FolioDeployer contracts must inherit from the Versioned base contract, which implements a version() function returning a semantic version string.

Frontend Integration

Frontends should always check both if a version exists and whether it’s deprecated before allowing users to deploy with it. Use getLatestVersion() to show the recommended version.