Overview
The Folio contract is the heart of the Reserve Folio protocol. It’s a backed ERC20 token that allows permissionless minting and redemption while maintaining a flexible basket of underlying assets. The contract supports semi-permissioned rebalancing through a sophisticated auction mechanism.Key Features
- Flexible Basket: Supports multiple ERC20 tokens of any denomination
- Permissionless Mint/Redeem: Anyone can mint or redeem shares proportionally
- Dutch Auction Rebalancing: Uses exponential decay curves for efficient price discovery
- Fee System: TVL fees and mint fees with DAO revenue sharing
- Role-Based Access: Three main roles for governance and operations
Architecture
Folio implements:- ERC20Upgradeable (share token)
- AccessControlEnumerableUpgradeable (role management)
- ReentrancyGuardUpgradeable (security)
Roles
The Folio contract operates with three primary roles:bytes32
Can set assets, fees, auction parameters, and deprecate the Folio
bytes32
Can start/end rebalances and manage individual auctions (typically a timelock)
bytes32
Can open auctions and end rebalances/auctions (typically an EOA or multisig)
bytes32
Optional role for off-chain use with no on-chain permissions
Minting and Redeeming
Mint
Mint new Folio shares by depositing the basket of tokens proportionally.Amount of shares to mint (before fees)
address
Address to receive the minted shares
Minimum shares to receive after fees (slippage protection)
Folio.sol
Minting incurs fees: (1) DAO fee shares, (2) fee recipient shares, (3) self-fee shares that are burned.
Redeem
Burn Folio shares to receive the underlying basket proportionally.Amount of shares to burn
address
Address to receive the underlying tokens
address[]
Array of asset addresses (must match basket)
uint256[]
Minimum amounts of each asset to receive
Folio.sol
Rebalancing
Start Rebalance
Initiate a new rebalancing operation with target basket weights and prices.TokenRebalanceParams[]
Rebalance parameters for each token including weights and price ranges
RebalanceLimits
Target basket unit (BU) limits: low, spot, and high
uint256
Time (in seconds) that AUCTION_LAUNCHER has exclusive access
uint256
Total time-to-live for the entire rebalance
Folio.sol
Open Auction (Restricted)
AUCTION_LAUNCHER opens an auction with specific parameters.uint256
Nonce of the target rebalance
address[]
Subset of rebalance tokens to include in this auction
WeightRange[]
New basket weight ranges (can be progressively tightened)
PriceRange[]
New price ranges (subject to PriceControl setting)
RebalanceLimits
New BU limits (must be within existing range)
uint256
Desired auction length in seconds
Folio.sol
Bidding
Participate in an ongoing auction by swapping tokens.uint256
ID of the auction to bid on
IERC20
Token being sold by the Folio
IERC20
Token being bought by the Folio
uint256
Amount of sell token to receive
uint256
Maximum amount of buy token willing to pay
bool
If true, uses callback pattern (caller must implement IBidderCallee)
bytes
Arbitrary data passed to callback
Folio.sol
Fee Management
Set TVL Fee
Set the annual TVL fee (demurrage fee on AUM).uint256
New annual fee as D18 (e.g., 0.1e18 = 10%)
Folio.sol
Set Mint Fee
Set the fee charged on minting operations.uint256
New mint fee as D18 (e.g., 0.01e18 = 1%)
Folio.sol
Distribute Fees
Distribute accumulated fees to DAO and fee recipients.Folio.sol
Fees accumulate as “pending shares” and are distributed proportionally based on the configured fee recipients and DAO split.
View Functions
Total Assets
Get all assets and amounts held by the Folio.Folio.sol
To Assets
Convert shares to underlying asset amounts.Number of shares to convert
Math.Rounding
Rounding direction (Floor or Ceil)
Folio.sol
Get Rebalance
Get current rebalance state.Folio.sol
Events
event
Emitted when a new auction is openedParameters:
rebalanceNonce- Rebalance nonceauctionId- New auction IDtokens- Tokens in auctionweights- Weight rangesprices- Price rangeslimits- BU limitsstartTime- Auction start timestampendTime- Auction end timestamp
event
Emitted when a bid is placedParameters:
auctionId- Auction IDsellToken- Token soldbuyToken- Token boughtsellAmount- Amount soldbuyAmount- Amount bought
event
Emitted when rebalancing beginsParameters:
nonce- Rebalance noncepriceControl- Price control settingtokens- Token parameterslimits- BU limitsstartedAt- Start timestamprestrictedUntil- Restricted period endavailableUntil- Total expirationbidsEnabled- Whether bids are enabled
event
Emitted when fees are distributedParameters:
recipient- Fee recipient addressamount- Shares distributed
Constants
uint256
default:"1e18"
18-decimal fixed point scaling factor
uint256
default:"1e27"
27-decimal fixed point scaling factor (for high precision)
uint256
default:"0.05e18"
Maximum mint fee: 5%
uint256
default:"0.1e18"
Maximum annual TVL fee: 10%
uint256
default:"30"
Auction warmup period in seconds