Overview
TheShareManager is an abstract upgradeable contract responsible for managing vault share issuance, allocation, whitelisting, permissions, and lockups in a modular vault system. It relies on a compact bitmask (flags) for enabling/disabling features and supports configurable per-account permissions.
Key Responsibilities
- Tracking total and active share supply
- Managing global and per-account lockups
- Verifying whitelist and transfer permissions
- Enforcing mint/burn/transfer pauses
- Allocating and claiming shares through queues
- Emitting granular control events on state transitions
Storage
Storage is accessed via a deterministic slot generated bySlotLibrary.getSlot("ShareManager", name, version).
Permission System
Controlled through roles defined as:SET_FLAGS_ROLE: Allows changing global flags (e.g., mint pause, whitelist enforcement).SET_ACCOUNT_INFO_ROLE: Grants permission to set per-account configuration.SET_WHITELIST_MERKLE_ROOT_ROLE: Grants permission to set new whitelist merkle root.- All share-related actions are guarded via:
onlyQueue()onlyVaultOrQueue()onlyRole(...)
View Functions
vault(): Returns the vault address.sharesOf(account): Total shares (active + claimable).activeSharesOf(account): Abstract; must be implemented by child.claimableSharesOf(account): Reads from theIShareModule.totalShares():allocatedShares + activeShares()accounts(account): ReturnsAccountInfostruct (deposit/transfer flags, lockups, blacklisting).flags(): Decoded bitmask asFlagsstruct.whitelistMerkleRoot(): Current root used for off-chain whitelist proof verification.isDepositorWhitelisted(account, proof): Verifies Merkle proof or checks local permission flags.updateChecks(from, to): Reverts on violations (paused actions, lockups, blacklisting, etc.).
Mutable Functions
setVault(...): One-time vault initialization.setFlags(...): Updates global bitmask configuration.setWhitelistMerkleRoot(…): Updates whitelist merkle root.setAccountInfo(...): Sets access rights for an individual address.claimShares(...): Claims shares from the vault’sIShareModule.allocateShares(...): Allocates shares for future minting (only callable by a queue).mintAllocatedShares(...): Mints shares from allocated pool to user.mint(...): Mints shares to a user with optional lockup.burn(...): Burns a user’s shares (only queue).__ShareManager_init(...): Sets Merkle root at construction or upgrade.
Internal Hooks (Implemented by Child)
Bitmask-Controlled Features
Controlled viaShareManagerFlagLibrary:
hasMintPausehasBurnPausehasTransferPausehasWhitelisthasTransferWhitelistglobalLockuptargetedLockup
updateChecks.