diff --git a/src/Hyperfund.sol b/src/Hyperfund.sol index 1e726b1..99a279c 100644 --- a/src/Hyperfund.sol +++ b/src/Hyperfund.sol @@ -9,7 +9,7 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IHypercertToken} from "./interfaces/IHypercertToken.sol"; contract Hyperfund is AccessControlUpgradeable, PausableUpgradeable, UUPSUpgradeable { - // immutable values that are read from the HyperfundStorage + // immutable values that are set on initialization IHypercertToken public hypercertMinter; uint256 public hypercertId; uint256 public hypercertTypeId; @@ -22,9 +22,6 @@ contract Hyperfund is AccessControlUpgradeable, PausableUpgradeable, UUPSUpgrade // allowlist for non-financial contributions, 0 means the contributor is not allowed mapping(address contributor => uint256 units) public nonfinancialContributions; - // keeps track of how many fractions have been split off the original hypercert - // WARNING: if fractions are split outside of the hyperfund it would result in the hyperfund failing - uint256 internal constant TYPE_MASK = type(uint256).max << 128; // Roles @@ -216,4 +213,12 @@ contract Hyperfund is AccessControlUpgradeable, PausableUpgradeable, UUPSUpgrade function _isFraction(uint256 _fractionId) internal view returns (bool) { return _fractionId & TYPE_MASK == hypercertTypeId; } + + /** + * @dev This empty reserved space is put in place to allow future versions to add new + * variables without shifting down storage in the inheritance chain. + * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + * Keeping a total of 30 slots available. + */ + uint256[23] private __gap; } diff --git a/src/HyperfundFactory.sol b/src/HyperfundFactory.sol index 321a7a5..b13ac3a 100644 --- a/src/HyperfundFactory.sol +++ b/src/HyperfundFactory.sol @@ -12,7 +12,7 @@ import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.s contract HyperfundFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable { address hypercertMinter; - // Mapping to associate (hypercert ID) with Hyperfund and Hyperstaker addresses + // Mapping to associate (hypercert ID) with flag for Hyperfund and Hyperstaker created mapping(uint256 => bool) public hyperfunds; mapping(uint256 => bool) public hyperstakers; @@ -131,4 +131,12 @@ contract HyperfundFactory is Initializable, UUPSUpgradeable, OwnableUpgradeable hyperstakers[hypercertTypeId] = true; emit HyperstakerCreated(hyperstaker, hypercertTypeId, admin, manager, pauser, upgrader); } + + /** + * @dev This empty reserved space is put in place to allow future versions to add new + * variables without shifting down storage in the inheritance chain. + * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + * Keeping a total of 30 slots available. + */ + uint256[26] private __gap; } diff --git a/src/Hyperstaker.sol b/src/Hyperstaker.sol index 3385323..c90f8b4 100644 --- a/src/Hyperstaker.sol +++ b/src/Hyperstaker.sol @@ -20,21 +20,21 @@ error RoundNotSet(); error AlreadyClaimed(); contract Hyperstaker is AccessControlUpgradeable, PausableUpgradeable, UUPSUpgradeable { - uint256 internal constant TYPE_MASK = type(uint256).max << 128; - + // immutable values that are set on initialization IHypercertToken public hypercertMinter; uint256 public hypercertTypeId; uint256 public totalUnits; + + mapping(uint256 hypercertId => Stake stake) public stakes; Round[] public rounds; + uint256 internal constant TYPE_MASK = type(uint256).max << 128; + // Roles bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE"); - // Mapping of hypercert id to stake info - mapping(uint256 => Stake) public stakes; - struct Stake { uint256 stakingStartTime; address staker; @@ -194,4 +194,12 @@ contract Hyperstaker is AccessControlUpgradeable, PausableUpgradeable, UUPSUpgra function onERC1155Received(address, address, uint256, uint256, bytes memory) public pure returns (bytes4) { return this.onERC1155Received.selector; } + + /** + * @dev This empty reserved space is put in place to allow future versions to add new + * variables without shifting down storage in the inheritance chain. + * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps + * Keeping a total of 30 slots available. + */ + uint256[24] private __gap; }