Skip to content

Commit

Permalink
Fix cancelAllNonExecutedProposals in the timelock model
Browse files Browse the repository at this point in the history
  • Loading branch information
qian-hu committed Jul 9, 2024
1 parent 8a8905a commit 60a2a5f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions contracts/model/EmergencyProtectedTimelockModel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ contract EmergencyProtectedTimelockModel {
function cancelAllNonExecutedProposals() public {
require(msg.sender == governance, "Caller is not authorized to cancel proposal.");

// Loop through all the proposals stored in the contract.
for (uint256 i = 0; i < nextProposalId; i++) {
// Ensure that only proposals in 'Submitted' or 'Scheduled' status are canceled.
if (proposals[i].status != ProposalStatus.Executed) {
proposals[i].status = ProposalStatus.Canceled;
if (nextProposalId > 0) {
// Loop through all the proposals stored in the contract.
for (uint256 i = 0; i < nextProposalId; i++) {
// Ensure that only proposals in 'Submitted' or 'Scheduled' status are canceled.
if (proposals[i].status != ProposalStatus.Executed) {
proposals[i].status = ProposalStatus.Canceled;
}
}
}
}
Expand Down

0 comments on commit 60a2a5f

Please sign in to comment.