diff --git a/src/PermissionedERC20Wrapper.sol b/src/PermissionedERC20Wrapper.sol index fdc7d3d..46398fc 100644 --- a/src/PermissionedERC20Wrapper.sol +++ b/src/PermissionedERC20Wrapper.sol @@ -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 = @@ -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); } diff --git a/test/unit/PermissionedERC20Wrapper.t.sol b/test/unit/PermissionedERC20Wrapper.t.sol index 44d1c72..130f736 100644 --- a/test/unit/PermissionedERC20Wrapper.t.sol +++ b/test/unit/PermissionedERC20Wrapper.t.sol @@ -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(); } @@ -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); }