Skip to content

Commit

Permalink
feat: remove unused error and function (#240)
Browse files Browse the repository at this point in the history
- InsufficientETH
- handleStrictExclusivity

dead code, no longer used

Issue: Cantina #17
  • Loading branch information
marktoda authored Apr 9, 2024
1 parent 459f58a commit 4e87927
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 46 deletions.
11 changes: 0 additions & 11 deletions src/lib/ExclusivityLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ library ExclusivityLib {
}
}

/// @notice Applies strict exclusivity to the resolved order,
/// throwing if the filler does not have filling rights
/// @param exclusive The exclusive address
/// @param exclusivityEndTime The exclusivity end time
function handleStrictExclusivity(address exclusive, uint256 exclusivityEndTime) internal view {
// ensure the filler has fill right, else revert
if (!hasFillingRights(exclusive, exclusivityEndTime)) {
revert NoExclusiveOverride();
}
}

/// @notice checks if the caller currently has filling rights on the order
/// @dev if the order has no exclusivity, always returns true
/// @dev if the order has active exclusivity and the current filler is the exclusive address, returns true
Expand Down
4 changes: 0 additions & 4 deletions src/reactors/BaseReactor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ abstract contract BaseReactor is IReactor, ReactorEvents, ProtocolFees, Reentran
using ResolvedOrderLib for ResolvedOrder;
using CurrencyLibrary for address;

// Occurs when an output = ETH and the reactor does contain enough ETH but
// the direct filler did not include enough ETH in their call to execute/executeBatch
error InsufficientEth();

/// @notice permit2 address used for token transfers and signature verification
IPermit2 public immutable permit2;

Expand Down
27 changes: 0 additions & 27 deletions test/lib/ExclusivityLib.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -158,31 +158,4 @@ contract ExclusivityLibTest is Test {
assertEq(handled.outputs[i].recipient, recipient);
}
}

function testStrictExclusivityPass(address exclusive) public {
vm.assume(exclusive != address(0));
vm.prank(exclusive);
exclusivity.handleStrictExclusivity(exclusive, block.timestamp + 1);
}

function testStrictExclusivityNoExclusivity(address caller) public {
vm.prank(caller);
// when passing address(0) as the exclusive address, anyone can call
exclusivity.handleStrictExclusivity(address(0), block.timestamp + 1);
}

function testStrictExclusivityPassTime(address exclusive, address caller) public {
vm.assume(exclusive != address(0));
vm.assume(exclusive != caller);
vm.prank(caller);
exclusivity.handleStrictExclusivity(exclusive, block.timestamp - 1);
}

function testStrictExclusivityFail(address exclusive, address caller) public {
vm.assume(exclusive != address(0));
vm.assume(exclusive != caller);
vm.prank(caller);
vm.expectRevert(ExclusivityLib.NoExclusiveOverride.selector);
exclusivity.handleStrictExclusivity(exclusive, block.timestamp + 1);
}
}
4 changes: 0 additions & 4 deletions test/util/mock/MockExclusivityLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ contract MockExclusivityLib {
function hasFillingRights(address exclusive, uint256 exclusivityEndTime) external view returns (bool pass) {
return ExclusivityLib.hasFillingRights(exclusive, exclusivityEndTime);
}

function handleStrictExclusivity(address exclusive, uint256 exclusivityEndTime) external view {
return ExclusivityLib.handleStrictExclusivity(exclusive, exclusivityEndTime);
}
}

0 comments on commit 4e87927

Please sign in to comment.