Storage Slot Strategy
- Based on EIP-7201
-
Inputs include:
- Contract name (
contractName) - Human-readable name (
name) - Version number (
version)
- Contract name (
-
Final slot:
- Namespacing: Prevents overlap between different modules (
ShareModule,FeeManager, etc.) - Instance separation: Multiple deployments with different names produce distinct slots
- Versioning: Upgrades can cleanly migrate to new versions without collision
Function
getSlot(string contractName, string name, uint256 version) → bytes32
Description:
Computes a deterministic, collision-resistant storage slot for a contract module.
Parameters:
contractName: Logical name of the module (e.g.,"ShareModule")name: Instance identifier or label (e.g.,"Mellow")version: Numeric version for versioned slot separation
- A
bytes32value representing the computed storage slot