aave_brownie_py
aave_brownie_py copied to clipboard
Unable to find WETH contract in mainnet fork
I'm using a mainnet fork in Ganache, however when I execute the function call to get the WETH contract it says, that the contract is not found. I'm using the mainnet address of 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2. Here's the code:

Here's my mainnet fork setup

I'm stuck here and unable to move forward. Any help would be appreciated.
Hmm... odd. Yeah It looks like it's not connecting to your fork... Can you try to read from another contract on-chain?
I found out the reason. And I find it really odd
As above, I have the ganache-cli already running, I THEN open up a console which attaches itself to the running ganache. I then try to access the contract and it gives me the error

However, when I open up a console allowing itself to spin up its ganache at the time of opening the console, it works fine..

Is there a reason why it behaves this way? I essentially test by having the ganache running on a different terminal, so looks like I should have brownie spin up its own every time I run a test.
huh... weird. Maybe it's not connecting correctly when you spin it up yourself...
I also had the same problem, for some reason letting brownie spin up its own ganache-cli instance solves it