Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Unable to find WETH contract in mainnet fork #17

Open
sramasub opened this issue Nov 22, 2022 · 4 comments
Open

Unable to find WETH contract in mainnet fork #17

sramasub opened this issue Nov 22, 2022 · 4 comments

Comments

@sramasub
Copy link

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.

@PatrickAlphaC
Copy link
Owner

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

@sramasub
Copy link
Author

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.

@PatrickAlphaC
Copy link
Owner

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

@olugbengatalabi
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants