Skip to content

Instantly share code, notes, and snippets.

@snissn
Created February 22, 2023 16:39
Show Gist options
  • Save snissn/9553d86da644d63749a062d7dfc11aa8 to your computer and use it in GitHub Desktop.
Save snissn/9553d86da644d63749a062d7dfc11aa8 to your computer and use it in GitHub Desktop.
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