Overview
Reserve Folio implements multiple security mechanisms to protect against common vulnerabilities while supporting a wide range of ERC20 tokens. Understanding these protections is critical for both governance and consuming protocols.
Reentrancy Protection
Folio uses OpenZeppelin’s ReentrancyGuardUpgradeable to prevent reentrancy attacks:
Protected Functions
All mutating external functions use the nonReentrant modifier:
mint(), redeem()
bid(), createTrustedFill()
openAuction(), openAuctionUnrestricted(), closeAuction()
startRebalance(), endRebalance()
distributeFees(), poke()
- Governance functions:
addToBasket(), removeFromBasket(), etc.
Read-Only Reentrancy
While Folio itself is protected from reentrancy, read-only reentrancy is still possible for consuming protocols. View functions can be called during state changes and return inconsistent data.
Checking for Active State Changes
Consuming protocols must check stateChangeActive() before trusting view data:
When state changes are active:
syncActive = true: Folio is in the middle of a transaction (reentrancy)
asyncActive = true: A trusted fill swap is ongoing (CoW Swap order pending)
The asyncActive check can be DoS’d for the current block if a malicious actor repeatedly creates and cancels trusted fills. Implement appropriate safeguards in consuming protocols.
Weird ERC20 Support
Folio supports most ERC20 tokens with the following compatibility matrix:
Folio Compatibility
Unsupported Token Types
Multiple Entrypoints
Tokens with non-standard transfer functions:
Pausable / Blocklist
Tokens that can be paused or have blocklists:
Risk: Folio could become stuck if tokens are paused or the Folio address is blacklisted.
Fee-on-Transfer
Tokens that charge a fee on transfer:
Risk: Balance accounting breaks as actual received amount differs from transfer amount.
ERC777 / Callback Tokens
Tokens with transfer hooks:
Risk: Reentrancy attacks via callback hooks.
Supported with Caveats
Rebasing Tokens
Tokens where balances change automatically:
Risk: Folio’s auction accounting relies on balance deltas. Large rebases between auctions can cause misreporting of bought/sold amounts.
Avoid using rebasing tokens with non-incremental rebases (large jumps). Daily incremental rebases like stETH are generally acceptable, but governance should understand the accounting implications.
SafeERC20 Wrapper
Folio uses OpenZeppelin’s SafeERC20 for all token operations:
Trusted Filler Token Restrictions
If trusted fillers are enabled, tokens must be supported by both the Folio and the external filler (e.g., CoW Swap). Check the trusted filler’s documentation for their token compatibility requirements.
For CoW Swap specifically:
- Token must be listed on CoW Protocol
- Must have liquidity routing available
- Cannot be pausable or have callbacks
- Should have reasonable slippage characteristics
Chain Assumptions
The protocol assumes specific chain characteristics:
Block Time
Auction timing mechanisms assume block times ≤ 30 seconds. Chains with longer block times may experience:
- Less precise auction pricing
- Larger time gaps in exponential decay curve
- Reduced warmup period effectiveness
Supported Chains
- Ethereum Mainnet (12s blocks) ✅
- Base (2s blocks) ✅
- Arbitrum (0.25s blocks) ✅
- Optimism (2s blocks) ✅
Value Range Assumptions
The protocol has defined bounds for all numeric values:
Token Supplies
Governance must ensure the Folio supply never grows beyond 1e36. This is a hard limit to prevent overflow in calculations.
Exchange Rates & Prices
Governance Safety Guidelines
Token Removal
When removing a token from the basket via removeFromBasket(), users have limited time to redeem before the token becomes inaccessible. Only remove tokens if they have become malicious or compromised.
Rebalance Price Monitoring
If prices move outside the initially-provided price ranges during a rebalance, MEV searchers can extract value from the Folio. The AUCTION_LAUNCHER must actively monitor markets and end dangerous rebalances.
MEV Considerations
Auction MEV
Dutch auctions are inherently MEV-prone:
Mitigations:
- Use
PriceControl.ATOMIC_SWAP to eliminate public MEV
- Use trusted fillers (CoW Swap) for MEV-protected execution
- Set narrow price ranges to limit extractable value
- Use 30-second warmup period to enable competition
Mint/Redeem MEV
Permissionless mint/redeem can be exploited:
Mitigations:
- Governance should rebalance gradually (multiple small auctions)
- Large rebalances should use trusted fillers or atomic execution
- Consider mint/redeem fees to make attacks unprofitable
Denial of Service Vectors
Dust Donations
Governance can be griefed by dust token donations:
Mitigation: Use DEFAULT_ADMIN_ROLE to forcibly remove tokens.
Async Fill DoS
Mitigation: Consuming protocols should implement rate limiting or use synchronous checks only.
Best Practices for Integrators
1. Always Check State Changes
2. Use Slippage Protection
3. Understand Token Risks
4. Monitor Deprecation
Before relying on a Folio:
Audit History
Reserve Folio has undergone multiple security audits:
Review audit reports before integrating or upgrading.
Emergency Procedures
Folio Deprecation
In case of critical vulnerability:
Version Deprecation
DAO or emergency council can deprecate a Folio version: