diff --git a/test/Collateral.t.sol b/test/Collateral.t.sol index 2f812962..70f0042c 100644 --- a/test/Collateral.t.sol +++ b/test/Collateral.t.sol @@ -4,6 +4,7 @@ pragma solidity 0.8.27; import {IEngine} from "src/interfaces/IEngine.sol"; import {Bootstrap} from "test/utils/Bootstrap.sol"; import {Pay} from "src/utils/Pay.sol"; +import {MaliciousReceiver} from "test/utils/MaliciousReceiver.sol"; contract CollateralTest is Bootstrap { function setUp() public { @@ -649,18 +650,3 @@ contract WithdrawCollateral is CollateralTest { vm.stopPrank(); } } - -// Helper contract that rejects ETH transfers -contract MaliciousReceiver { - receive() external payable { - revert(); - } - - function onERC721Received(address, address, uint256, bytes calldata) - external - pure - returns (bytes4) - { - return 0x150b7a02; - } -} diff --git a/test/Pay.t.sol b/test/Pay.t.sol index 80c6b180..8bf5ec48 100644 --- a/test/Pay.t.sol +++ b/test/Pay.t.sol @@ -2,6 +2,7 @@ pragma solidity 0.8.27; import {Bootstrap} from "test/utils/Bootstrap.sol"; +import {MaliciousReceiver} from "test/utils/MaliciousReceiver.sol"; import {Pay} from "src/utils/Pay.sol"; import {IWETH} from "src/interfaces/tokens/IWETH.sol"; @@ -91,19 +92,4 @@ contract PayTest is Bootstrap { payFork.unwrapAndPay(amount, to); assertEq(to.balance, balanceBefore + amount); } -} - -// Helper contract that rejects ETH transfers -contract MaliciousReceiver { - receive() external payable { - revert(); - } - - function onERC721Received(address, address, uint256, bytes calldata) - external - pure - returns (bytes4) - { - return 0x150b7a02; - } -} +} \ No newline at end of file diff --git a/test/utils/MaliciousReceiver.sol b/test/utils/MaliciousReceiver.sol new file mode 100644 index 00000000..08b840f5 --- /dev/null +++ b/test/utils/MaliciousReceiver.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity 0.8.27; + +/// @notice Helper contract that rejects ETH transfers +/// @author cmontecoding +contract MaliciousReceiver { + receive() external payable { + revert(); + } + + function onERC721Received(address, address, uint256, bytes calldata) + external + pure + returns (bytes4) + { + return 0x150b7a02; + } +}