''InterfaceContainer' object has no attribute 'WethInterface'
from brownie import accounts, config, network, interface
def main(): """ Runs the get_weth function to get WETH """ get_weth()
def get_weth(account=None): """ Mints WETH by depositing ETH. """ account = ( account if account else accounts.add(config["wallets"]["from_key"]) ) # add your keystore ID as an argument to this call weth = interface.WethInterface( config["networks"][network.show_active()]["weth_token"] ) tx = weth.deposit({"from": account, "value": 0.1 * 1e18}) print("Received 0.1 WETH") return tx
Solution 1:[1]
I ran into the same issue a few days ago. I changed the name of the interface file from "IWeth.sol" to "WethInterface.sol".
I don't know why it worked, but you can give it a try.
Solution 2:[2]
you can name the file what you want but, when you want to call the interface you need to call the name of the contract exactly per example
contract WethInterface {}
wethContract = interface.WethInterface(wethAddress)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Mowgli |
