0

In my smart contract I have some methods that get a struct as an input:

contract MyContract {

  MyStruct {
    uint[] arr;
    address[] addresses; 
  }

  function myFunction(MyStruct[] structs) external {
  }
}

I called this function and on Etherscan although my contract is verified it seems to show the function selector (first 4 bytes of the encoded function signature) and not the function name. Is there a way to overcome this and show the function name?

enter image description here


UPDATE


Following this answer I have managed to match between my function signature and the right function selector. As far as I understood from the documentation I should be able to use the method-registry contract in order to register my method.

I have registered my function over the SignatureReg contract but I can't see any change in the names of the functions over etherscan. I was expecting etherscan to listen to this contract (or to query it) and update the method name accordingly once it is registered but I guess this is not how this things work. Still looking for a solution.

3 Answers 3

2
+25

Here are the step by steps from the metamask documentation:

  1. Go to the Mainnet Parity signature registration contract on etherscan

  2. Connect MetaMask

  3. Use etherscan's write contract feature to input the string value (without quotes or spaces) to the register function (0x59708645)

For example:

getOwners()

execTransaction(address,uint256,bytes,uint8,uint256,uint256,uint256,address,address,bytes)

Click "write"

Approve the transaction in MetaMask (you only pay gas)

1
  • Ok did it, still no change.
    – forhas
    Commented Jul 17, 2022 at 20:32
2

Function name will appear if you upload your contract source code to Etherscan, or if it recognizes the 4 byte signature.

In case you only want Etherscan to recognize the method signature, you can add it on the Verified Signatures page, connect your MetaMask wallet and use the Verify Signature option.

You can verify your contract code using Etherscan's Verify & Publish page, follow the questions and upload your code accordingly, function name should appear on the tx details thereafter.

If you're using Hardhat, it's very simple, follow this guide to verify your contract in Etherscan, once it's verified the function name should appear.

2
  • My contract is verified on etherscan. Standard functions that do not get structs as input params are recognized well but functions that get structs as input params are not.
    – forhas
    Commented Jul 15, 2022 at 8:44
  • Can you elaborate more on the Verify Signature option?
    – forhas
    Commented Jul 17, 2022 at 20:33
0

It seems that for the moment this is a known issue of Etherscan, it is mentioned in their tweeter page.

enter image description here

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.