simulateAndRevert
Performs a delegatecall
on a targetContract
in the context of self
. Internally reverts execution to avoid side effects (making it static).
This method reverts with data equal to abi.encode(bool(success), bytes(response))
. Specifically, the returndata
after a call to this method will be: success:bool || response.length:uint256 || response:bytes
.
Usage
_12interface ISafe {_12 function simulateAndRevert(_12 address targetContract,_12 bytes calldata payload_12 ) external;_12}_12_12contract Example {_12 function example() ... {_12 (ISafe safe).simulateAndRevert(0x..., "0x...");_12 }_12}
Parameters
targetContract
- Type:
address
Address of the contract containing the code to execute.
_10(ISafe safe).simulateAndRevert(_10 0x...,_10 "0x..."_10);
calldataPayload
- Type:
bytes
Payload to be executed.
_10(ISafe safe).simulateAndRevert(_10 0x...,_10 "0x..."_10);