Skip to content

Commit

Permalink
Update model
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmt committed Jun 12, 2024
1 parent fb685aa commit 0e48f52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 5 additions & 6 deletions contracts/model/DualGovernance.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/Math.sol";

import "./EmergencyProtectedTimelock.sol";
import "./Escrow.sol";

Expand Down Expand Up @@ -84,8 +86,9 @@ contract DualGovernance {
"Proposals can only be scheduled in Normal or Veto Cooldown states."
);
if (currentState == State.VetoCooldown) {
uint256 submissionTime = emergencyProtectedTimelock.proposals(proposalId).submissionTime;
require(
block.timestamp < lastVetoSignallingTime,
submissionTime < lastVetoSignallingTime,
"Proposal submitted after the last time Veto Signalling state was entered."
);
}
Expand Down Expand Up @@ -174,10 +177,6 @@ contract DualGovernance {
currentState = parentState;
}

function max(uint256 a, uint256 b) private pure returns (uint256) {
return a > b ? a : b;
}

// State Transitions

function activateNextState() public {
Expand Down Expand Up @@ -231,7 +230,7 @@ contract DualGovernance {
transitionState(State.RageQuit);
} else if (
block.timestamp - lastStateChangeTime > calculateDynamicTimelock(rageQuitSupport)
&& block.timestamp - max(lastStateChangeTime, lastStateReactivationTime)
&& block.timestamp - Math.max(lastStateChangeTime, lastStateReactivationTime)
> VETO_SIGNALLING_MIN_ACTIVE_DURATION
) {
enterSubState(State.VetoSignallingDeactivation);
Expand Down
2 changes: 0 additions & 2 deletions contracts/model/EmergencyProtectedTimelock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ contract EmergencyProtectedTimelock {
function submit(address executor, ExecutorCall[] memory calls) external returns (uint256 proposalId) {
// Ensure that only the governance can submit new proposals.
require(msg.sender == governance, "Only governance can submit proposal.");
// Establish the minimum timelock duration for the proposal's execution.
uint256 executionDelay = PROPOSAL_EXECUTION_MIN_TIMELOCK;

proposals[nextProposalId].id = nextProposalId;
proposals[nextProposalId].proposer = executor;
Expand Down

0 comments on commit 0e48f52

Please sign in to comment.