diff --git a/src/Vm.sol b/src/Vm.sol index 73fc47e5..ecfa07fe 100644 --- a/src/Vm.sol +++ b/src/Vm.sol @@ -1861,6 +1861,16 @@ interface Vm is VmSafe { function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData) external; + /// Reverts a call to an address with specified revert data. + /// + /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. + function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external; + + /// Reverts a call to an address with a specific `msg.value`, with specified revert data. + /// + /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. + function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData) external; + /// Mocks a call to an address, returning specified data. /// Calldata can either be strict or a partial match, e.g. if you only /// pass a Solidity selector to the expected calldata, then the entire Solidity @@ -1871,6 +1881,20 @@ interface Vm is VmSafe { /// Calldata match takes precedence over `msg.value` in case of ambiguity. function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external; + /// Mocks a call to an address, returning specified data. + /// Calldata can either be strict or a partial match, e.g. if you only + /// pass a Solidity selector to the expected calldata, then the entire Solidity + /// function will be mocked. + /// + /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. + function mockCall(address callee, bytes4 data, bytes calldata returnData) external; + + /// Mocks a call to an address with a specific `msg.value`, returning specified data. + /// Calldata match takes precedence over `msg.value` in case of ambiguity. + /// + /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. + function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external; + /// Mocks multiple calls to an address, returning specified data for each call. function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external; diff --git a/test/Vm.t.sol b/test/Vm.t.sol index 8b6113cf..468577a1 100644 --- a/test/Vm.t.sol +++ b/test/Vm.t.sol @@ -9,7 +9,7 @@ import {Vm, VmSafe} from "../src/Vm.sol"; // added to or removed from Vm or VmSafe. contract VmTest is Test { function test_VmInterfaceId() public pure { - assertEq(type(Vm).interfaceId, bytes4(0x329891d9), "Vm"); + assertEq(type(Vm).interfaceId, bytes4(0xa95c1408), "Vm"); } function test_VmSafeInterfaceId() public pure {