0

I want to call another contract from my vyper contract.

I have read several tutorials and documentations and there is 2 ways to do that:

First method:

interface MyExternalContract:
   def public_function1_of_my_external_contract(arg1: int128, arg2: int128)
   def public_function2_of_my_external_contract(arg1: int128, arg2: int128)
   ...

@external
def fonction_of_my_contract():
  MyExternalContract(address). public_function1_of_my_external_contract(1,2)

Second method:

contract MyExternalContract:
   def public_function1_of_my_external_contract(arg1: int128, arg2: int128)
   def public_function2_of_my_external_contract(arg1: int128, arg2: int128)
   ...

@external
def fonction_of_my_contract():
  MyExternalContract(address). public_function1_of_my_external_contract(1,2)

As you can see, the "interface" has been replaced by "contract".

What is the difference between those 2 methods ?

Thanks

1 Answer 1

0

The keyword contract is deprecated in v0.2.1, and replaced with interface keyword.

More detail at VIP: Change contract keyword to interface #1825

1
  • 2
    Welcome to the Ethereum Stack Exchange! Are you able to add a quick reference to it?
    – eth
    Nov 20, 2021 at 3:18

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.