Solidity – How to Generate the Full List of Function Selectors for a Contract

abihashkeccaksolidity

A contract has many functions and how to automatically generate the full selector list, including inherited functions, for the whole contract?

Preferred solution shouldn’t require more than a web browser.

Best Answer

Maybe you can use the online Ethereum IDE (Remix):

  • Paste the whole code of the address you posted.
  • Select the same compiler version: v0.4.25+commit.59dbf8f1.
  • Select the contract by name: SaiProxyCreateAndExecute.

enter image description here

Press on Compilation Details and check the functionHashes section. You will get something like the following:

{
    "581f3c50": "createAndOpen(address,address)",
    "eefe3818": "createOpenAndLock(address,address)",
    "d3140a65": "createOpenLockAndDraw(address,address,uint256)",
    "0344a36f": "draw(address,bytes32,uint256)",
    "f9ef04be": "free(address,bytes32,uint256)",
    "da93dfcf": "give(address,bytes32,address)",
    "bc25a810": "lock(address,bytes32)",
    "1edf0c1e": "lockAndDraw(address,bytes32,uint256)",
    "516e9aec": "lockAndDraw(address,uint256)",
    "b95460f8": "open(address)",
    "bc244c11": "shut(address,bytes32)",
    "792037e3": "shut(address,bytes32,address)",
    "a3dc65a7": "wipe(address,bytes32,uint256)",
    "8a9fc475": "wipe(address,bytes32,uint256,address)",
    "faed77ab": "wipeAndFree(address,bytes32,uint256,uint256)",
    "1b968160": "wipeAndFree(address,bytes32,uint256,uint256,address)"
}
Related Topic