If remove a single feature from the ABI, will it work with other contracts that have that feature still? Does the order of functions matter in the ABI?

Use Case:

For simplicity, I want to build a Web3.js frontend to interact with contracts, however, some of the contracts will have function to look up the ENS domain of a person, and others won't. I don't need to worry about this function at all in the frontend, I just need to make sure the ABI in the JS works and doesn't generate errors.

Comparison of Two ABIs

  • If you don't need to use this function outside your contract why bother to make it public? You can make it internal/private and won't be available in the ABI – mirg Mar 15 '18 at 14:52
  • That's a very good point. It seems to be working sans the function call, but I'm not sure if I'm opening myself up to something bad. I want to be able to refactor the contracts on everything but the parts people interact with it. If I can have a bunch of different ABIs, but with all of the exact same functions, that would be ideal. e.g. Tranfer and setting the price will never change, but other functions might. – ThickMiddleManager Mar 15 '18 at 14:59
  • Well, the ABI is just an interface. I never tried to change it on purpose, but it shouldn't work in case you're trying to add something that doesn't exist. Removing something that is there and won't be called shouldn't be a problem (I think, but don't take it for granted). On the other hand, if you have a function in the ABI that you don't call from your JS, why should you bother to remove? The blockchain is public and someone else can call it anyway ;) – mirg Mar 15 '18 at 15:04
  • It's a matter of frontend coding simplicity, not what people can read. I want to manage multiple contracts with slightly different ABIs from the same code. It is possible, though a pain to account for all contract types. – ThickMiddleManager Mar 15 '18 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.