diff --git a/protocol/governance/contracts/modules/core/BaseElectionModule.sol b/protocol/governance/contracts/modules/core/BaseElectionModule.sol index 3dfa01f76d..46623a5a57 100644 --- a/protocol/governance/contracts/modules/core/BaseElectionModule.sol +++ b/protocol/governance/contracts/modules/core/BaseElectionModule.sol @@ -218,7 +218,7 @@ contract BaseElectionModule is function nominate() public virtual override { // TODO: onlyOnMothership? - Council.onlyInPeriod(Council.ElectionPeriod.Nomination); + Council.onlyInPeriods(Council.ElectionPeriod.Nomination, Council.ElectionPeriod.Vote); SetUtil.AddressSet storage nominees = Council.load().getCurrentElection().nominees; diff --git a/protocol/governance/contracts/storage/Council.sol b/protocol/governance/contracts/storage/Council.sol index 8e9370fcaa..81e2fec449 100644 --- a/protocol/governance/contracts/storage/Council.sol +++ b/protocol/governance/contracts/storage/Council.sol @@ -115,6 +115,17 @@ library Council { } } + /// @dev Used to allow certain functions to only operate within a given periods + function onlyInPeriods( + Council.ElectionPeriod period1, + Council.ElectionPeriod period2 + ) internal view { + Council.ElectionPeriod currentPeriod = Council.getCurrentPeriod(load()); + if (currentPeriod != period1 && currentPeriod != period2) { + revert NotCallableInCurrentPeriod(); + } + } + /// @dev Ensures epoch dates are in the correct order, durations are above minimums, etc function validateEpochSchedule( Data storage self,