SafeCall
Library for performing safe calls to the recipients. Inspired by https://github.com/nomad-xyz/ExcessivelySafeCall
Functions
safeCall
Performs a call to the recipient using the provided gas limit, msg.value and payload in a safe way:
- If the recipient is not a contract, false is returned instead of reverting.
- If the recipient call reverts for any reason, false is returned instead of reverting.
- If the recipient call succeeds, true is returned, and any returned data is ignored.
function safeCall(address recipient, uint256 gasLimit, uint256 msgValue, bytes memory payload)
internal
returns (bool success);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the call |
gasLimit | uint256 | The gas limit to use for the call |
msgValue | uint256 | The msg.value to use for the call |
payload | bytes | The payload to use for the call |
Returns
Name | Type | Description |
---|---|---|
success | bool | True if the call succeeded, false otherwise |