1

As far as I am aware an interface is just like an ABI, which allows a contract to encode data it sends to another contract. But, can't any contract implement an arbitrary function "bar(address,address,uint256)", and the originating contract wouldn't be able to know. Therefore, what is the safest way to interface with unknown contracts?

1 Answer 1

0

I think interacting with an unknown contract is like running an unknown program that a stranger emailed you. Just like you would probably only run such a program from a computer (or VM) you don't value, you would probably only want to interact with unknown contracts for testing purposes using test amounts and accounts that are not connected to anything of value.

2
  • ok, is there a way for me to make sure, without seeing the code, that an arbitrary function is doing what I want when I make the call? or would I have to define such a contract beforehand on my own?
    – antioi
    Commented Oct 19, 2021 at 5:50
  • It's much better when you define it. I think "Turing complete" also means that some functions can be constructed so that you have to run it to know what it does...
    – eth
    Commented Nov 10, 2021 at 7:58

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.