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?

antioi
  • 61
  • 3

1 Answers1

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.

eth
  • 85,679
  • 53
  • 285
  • 406
  • 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 Oct 19 '21 at 05: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 Nov 10 '21 at 07:58