aave_brownie_py icon indicating copy to clipboard operation
aave_brownie_py copied to clipboard

Unable to find WETH contract in mainnet fork

Open sramasub opened this issue 3 years ago • 4 comments

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:

image

Here's my mainnet fork setup

image

I'm stuck here and unable to move forward. Any help would be appreciated.

sramasub avatar Nov 22 '22 12:11 sramasub

Hmm... odd. Yeah It looks like it's not connecting to your fork... Can you try to read from another contract on-chain?

PatrickAlphaC avatar Nov 22 '22 13:11 PatrickAlphaC

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

image

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

image

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.

sramasub avatar Nov 23 '22 04:11 sramasub

huh... weird. Maybe it's not connecting correctly when you spin it up yourself...

PatrickAlphaC avatar Nov 29 '22 14:11 PatrickAlphaC

I also had the same problem, for some reason letting brownie spin up its own ganache-cli instance solves it

olugbengatalabi avatar Apr 16 '23 23:04 olugbengatalabi