An external interface can be generated by vyper
as such:
vyper -f external_interface contracts/CurveCryptoSwap.vy
Doing that results in the following output:
# External Interfaces
interface Curvecryptoswap:
def __default__(): payable
def price_oracle(k: uint256) -> uint256: view
def price_scale(k: uint256) -> uint256: view
def last_prices(k: uint256) -> uint256: view
...
But where exactly does this go? Vyper's documentation on external interfaces states:
The output can then easily be copy-pasted to be consumed.
I tried saving it to <brownie_project>/interfaces/ICurveCryptoSwap.vy
but brownie does not see it...
>>> from brownie import interface
>>> pool = interface.Curvecryptoswap(...)
AttributeError: 'InterfaceContainer' object has no attribute 'Curvecryptoswap'
All this is no problem when using vyper -f abi
, but the resulting JSON file is just so messy; the external interface provides much cleaner code to read.
import interfaces.ifoo as IFoo
. Do you need to import your generated file with the relative path:import interfaces.ICurveCryptoSwap
? I'm not a Python dev, so I'm discovering its import syntax by trial-and-error.