Skip to content

Commit

Permalink
Merge pull request #8 from centrifuge/nits
Browse files Browse the repository at this point in the history
Remove custom error
  • Loading branch information
hieronx authored Jun 12, 2024
2 parents 677f412 + 8dc84db commit 0668ba5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/PermissionedERC20Wrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ struct Attestation {
/// through the Ethereum Attestation Service.
/// @author Modified from OpenZeppelin Contracts v5.0.0 (token/ERC20/extensions/ERC20Wrapper.sol)
contract PermissionedERC20Wrapper is Auth, ERC20, ERC20Wrapper, ERC20Permit {
/// @notice Thrown when `account` has no permission.
error NoPermission(address account);

bytes32 public constant verifiedCountrySchemaUid =
0x1801901fabd0e6189356b4fb52bb0ab855276d84f7ec140839fbd1f6801ca065;
bytes32 public constant verifiedAccountSchemaUid =
Expand Down Expand Up @@ -113,8 +110,7 @@ contract PermissionedERC20Wrapper is Auth, ERC20, ERC20Wrapper, ERC20Permit {
}

function _update(address from, address to, uint256 value) internal virtual override {
if (!hasPermission(to)) revert NoPermission(to);

require(hasPermission(to), "PermissionedERC20Wrapper/no-permission");
super._update(from, to, value);
}

Expand Down
4 changes: 2 additions & 2 deletions test/unit/PermissionedERC20Wrapper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contract PermissionedERC20WrapperTest is Test {
deal(address(usdc), userUS, 100);
vm.startPrank(userUS);
usdc.approve(address(wrappedUSDC), 100);
vm.expectRevert(abi.encodeWithSelector(PermissionedERC20Wrapper.NoPermission.selector, userUS));
vm.expectRevert("PermissionedERC20Wrapper/no-permission");
wrappedUSDC.depositFor(userUS, 100);
vm.stopPrank();
}
Expand Down Expand Up @@ -182,7 +182,7 @@ contract PermissionedERC20WrapperTest is Test {

function test_transfer_FromPermissionedToNonPermissioned_Fails() public {
deal(address(wrappedUSDC), userNonUS1, 100);
vm.expectRevert(abi.encodeWithSelector(PermissionedERC20Wrapper.NoPermission.selector, userUS));
vm.expectRevert("PermissionedERC20Wrapper/no-permission");
vm.prank(userNonUS1);
wrappedUSDC.transfer(userUS, 100);
}
Expand Down

0 comments on commit 0668ba5

Please sign in to comment.