I have a proxy smart contract and I would like to get the name of the called method in the fallback function. Is there a way?

For example, if I call the function getName() (stored in the logic contract), then in the fallback function (of the proxy contract) I would like to get the invoked function name, in this case getName.

contract Proxy {
  function () payable external {
    /* I would like to get here the name of the invoked function */

  function _fallback() internal {

  function _implementation() internal view returns (address);

  function _delegate(address implementation) internal { ... }

  function _willFallback() internal { }

Please, check here the full code of the proxy smart contract

1 Answer 1


Full name of the function being called is not passed to the smart contract, but only the first 4 bytes of the hash of function signature. These 4 bytes you can obtain as msg.sig. See documentation for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.