Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/Hyperfund.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
10 changes: 9 additions & 1 deletion src/HyperfundFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
18 changes: 13 additions & 5 deletions src/Hyperstaker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Loading