Skip to content

Instantly share code, notes, and snippets.

@JuanXavier
Last active July 11, 2022 23:36
Show Gist options
  • Select an option

  • Save JuanXavier/443724477476c127cde5576ec7f5e3f4 to your computer and use it in GitHub Desktop.

Select an option

Save JuanXavier/443724477476c127cde5576ec7f5e3f4 to your computer and use it in GitHub Desktop.
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment