Skip to content

Commit

Permalink
feat: update executeProposal
Browse files Browse the repository at this point in the history
  • Loading branch information
iavl committed Mar 27, 2024
1 parent c14521b commit ae9ecee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/ProxyAdminMultiSig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ contract ProxyAdminMultiSig is IErrors {

/// @dev executes a proposal
function executeProposal(uint256 proposalId) external onlyOwner {
if (!_isPendingProposal(proposalId)) {
revert NotPendingProposal();
}

Proposal storage p = _proposals[proposalId];
if (p.approvalCount < _threshold) {
revert NotEnoughApproval();
Expand Down
14 changes: 13 additions & 1 deletion test/ProxyAdminMultiSig.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -514,13 +514,25 @@ contract MultiSigTest is IErrors, Test, Utils {
vm.expectRevert(NotOwner.selector);
multiSig.executeProposal(proposalId);

// case 2: not enough approval
// case 2: proposal not exist
vm.expectRevert(NotPendingProposal.selector);
vm.prank(alice);
multiSig.executeProposal(200);

// case 3: not enough approval
vm.prank(alice);
multiSig.approveProposal(proposalId);

vm.expectRevert(NotEnoughApproval.selector);
vm.prank(bob);
multiSig.executeProposal(proposalId);

// case 4: can't execute deleted proposal
vm.prank(bob);
multiSig.deleteProposal(proposalId);
vm.expectRevert(NotPendingProposal.selector);
vm.prank(charlie);
multiSig.executeProposal(proposalId);
}

function testGetAllProposals() public {
Expand Down

0 comments on commit ae9ecee

Please sign in to comment.