Modular, upgradeable fee management contract for vaults.

The FeeManager is responsible for managing and calculating various fee types in a vault system, including deposit, redemption, performance, and protocol fees. It uses a flexible architecture with deterministic storage slots (via SlotLibrary) and supports per-vault configurations.

Key Responsibilities

Storage

Uses an isolated storage slot per deployment instance, computed deterministically using SlotLibrary.getSlot("FeeManager", name, version), ensuring safety and upgradability.

Each vault is associated with:

Fee Calculation Logic

calculateDepositFee(uint256 shares) → uint256

Computes a linear fee as shares * depositFeeD6 / 1e6.

calculateRedeemFee(uint256 shares) → uint256

Computes a linear fee as shares * redeemFeeD6 / 1e6.

calculateFee(...) → uint256 shares

Calculates the total fee to be charged based on: