Skip to content

Commit

Permalink
refactor: remove no longer needed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg committed Feb 5, 2025
1 parent 4611f25 commit 93bc36b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
13 changes: 0 additions & 13 deletions src/libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@ import { Lockup } from "../types/DataTypes.sol";
/// @title Errors
/// @notice Library containing all custom errors the protocol may revert with.
library Errors {
/*//////////////////////////////////////////////////////////////////////////
GENERICS
//////////////////////////////////////////////////////////////////////////*/

/// @notice Thrown when an unexpected error occurs during a batch call.
error BatchError(bytes errorData);

/// @notice Thrown when `msg.sender` is not the admin.
error CallerNotAdmin(address admin, address caller);

/// @notice Thrown when trying to delegate call to a function that disallows delegate calls.
error DelegateCall();

/*//////////////////////////////////////////////////////////////////////////
SABLIER-BATCH-LOCKUP
//////////////////////////////////////////////////////////////////////////*/
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/Integration.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22 <0.9.0;

import { Errors as EvmUtilsErrors } from "@sablier/evm-utils/src/libraries/Errors.sol";

import { Errors } from "src/libraries/Errors.sol";
import { Lockup, LockupDynamic, LockupLinear, LockupTranched } from "src/types/DataTypes.sol";

Expand Down Expand Up @@ -243,7 +245,7 @@ abstract contract Integration_Test is Base_Test {
function expectRevert_DelegateCall(bytes memory callData) internal {
(bool success, bytes memory returnData) = address(lockup).delegatecall(callData);
assertFalse(success, "delegatecall success");
assertEq(returnData, abi.encodeWithSelector(Errors.DelegateCall.selector), "delegatecall return data");
assertEq(returnData, abi.encodeWithSelector(EvmUtilsErrors.DelegateCall.selector), "delegatecall return data");
}

function expectRevert_DEPLETEDStatus(bytes memory callData) internal {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22 <0.9.0;

import { Errors as EvmUtilsErrors } from "@sablier/evm-utils/src/libraries/Errors.sol";

import { ISablierLockupBase } from "src/interfaces/ISablierLockupBase.sol";
import { Errors } from "src/libraries/Errors.sol";

Expand All @@ -13,7 +15,7 @@ contract AllowToHook_Integration_Concrete_Test is Integration_Test {
resetPrank({ msgSender: users.eve });

// Run the test.
vm.expectRevert(abi.encodeWithSelector(Errors.CallerNotAdmin.selector, users.admin, users.eve));
vm.expectRevert(abi.encodeWithSelector(EvmUtilsErrors.CallerNotAdmin.selector, users.admin, users.eve));
lockup.allowToHook(users.eve);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
pragma solidity >=0.8.22 <0.9.0;

import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol";
import { Errors as EvmUtilsErrors } from "@sablier/evm-utils/src/libraries/Errors.sol";

import { ILockupNFTDescriptor } from "src/interfaces/ILockupNFTDescriptor.sol";
import { ISablierLockupBase } from "src/interfaces/ISablierLockupBase.sol";
import { Errors } from "src/libraries/Errors.sol";
import { LockupNFTDescriptor } from "src/LockupNFTDescriptor.sol";
import { Integration_Test } from "../../../Integration.t.sol";

Expand All @@ -14,7 +15,7 @@ contract SetNFTDescriptor_Integration_Concrete_Test is Integration_Test {
resetPrank({ msgSender: users.eve });

// Run the test.
vm.expectRevert(abi.encodeWithSelector(Errors.CallerNotAdmin.selector, users.admin, users.eve));
vm.expectRevert(abi.encodeWithSelector(EvmUtilsErrors.CallerNotAdmin.selector, users.admin, users.eve));
lockup.setNFTDescriptor(ILockupNFTDescriptor(users.eve));
}

Expand Down

0 comments on commit 93bc36b

Please sign in to comment.