Skip to content

Commit a2ffbc0

Browse files
committed
admits cancel during claiming
1 parent 8418af5 commit a2ffbc0

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/DealNFT.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ contract DealNFT is ERC721, IDealNFT, ReentrancyGuard {
331331
*/
332332
function cancel() external {
333333
if(msg.sender != config.sponsor && msg.sender != config.arbitrator) revert NotAuthorized();
334-
if(state() > State.Active) revert CannotCancel();
334+
if(state() > State.Claiming) revert CannotCancel();
335335
config.cancelled = true;
336336
emit StateUpdated(State.Cancelled);
337337
}

test/DealNFTCancel.t.sol

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,24 @@ contract DealNFTCancelTest is Test, DealSetup {
3333
deal.cancel();
3434
}
3535

36-
function test_RevertWhen_CancelWhenClaiming() public {
36+
function test_CancelWhenClaiming() public {
3737
skip(15 days);
3838
assertEq(uint(deal.state()), uint256(DealNFT.State.Claiming));
3939

40+
vm.prank(sponsor);
41+
deal.cancel();
42+
43+
assertEq(uint(deal.state()), uint256(DealNFT.State.Cancelled));
44+
}
45+
46+
function test_RevertWhen_CancelWhenCancelled() public {
47+
skip(15 days);
48+
49+
vm.prank(sponsor);
50+
deal.cancel();
51+
52+
assertEq(uint(deal.state()), uint256(DealNFT.State.Cancelled));
53+
4054
vm.expectRevert(DealNFT.CannotCancel.selector);
4155
vm.prank(sponsor);
4256
deal.cancel();

0 commit comments

Comments
 (0)