0

I'm getting the code of a smart contract by using

web3.eth.getCode(contract_address)

I want to call certain functions that I'm fairly certain exist on that contract, however I don't know the signatures of every single function in the contract. How would I first check that the function exists? Assuming the function exists, would it be possible to just decode that function and then call it? Otherwise, how would I decode the whole contract including the functions I don't know in order to get the abi and create the web3 contract onject?

  • For some contracts EIP-165 will work. In general it is not possible: 1/ If the contract is a proxy the bytecode won't contain the executable functions. 2/ You could try calling the function. 3/ reverse engineering the bytecode to discover the signatures and a signatures database. – Ismael Oct 14 '21 at 06:43
  • Take a look at this post: https://ethereum.stackexchange.com/questions/111409/check-for-interface-superset/111416#111416 – ashhanai Oct 14 '21 at 08:22
  • Nope. You have to have the ABI. – Hristo Todorov Oct 14 '21 at 08:32

0 Answers0