-
-
Save snissn/9553d86da644d63749a062d7dfc11aa8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.0; | |
contract Caller { | |
address public callee; | |
constructor(address _callee) { | |
callee = address(new Callee()); | |
} | |
function callCallee() public returns (bool success, bytes memory data) { | |
(success, data) = callee.delegatecall(abi.encodeWithSignature("foo()")); | |
require(success, string(data)); | |
return (success, data); | |
} | |
} | |
contract Callee { | |
function foo() public returns (uint) { | |
revert("Custom error we can/should show useres"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment