contract ExampleContract { function askTheMeaningOfLife(address source) public returns (uint256) { (bool ok, bytes memory result) = source.call(abi.encodeWithSignature("meaningOfLifeAndAllExistence()")); require(ok, "call failed"); return abi.decode(result, (uint256)); } } contract AnotherContract { function meaningOfLifeAndAllExistence() public pure returns (uint256) { return 42; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter