Etherscan – Method with Struct Not Visible in Etherscan: Troubleshooting Function Selectors

etherscanfunction-selectorstruct

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.

Best Answer

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)

Related Topic