full-blockchain-solidity-course-py icon indicating copy to clipboard operation
full-blockchain-solidity-course-py copied to clipboard

Lesson 6: Not getting error when I forked and connect to mainnet network

Open shashankvivek opened this issue 2 years ago • 8 comments

I am referring to the codecamp video here and I just started forking the mainnet. The weird thing is that I was expecting an error such as

image

but my contract is getting deployed every time I run, brownie run .\scripts\deploy.py --network mainnet-fork

brownie-config.yaml

dependencies:
  #- <organization/repo>@<version>
  - smartcontractkit/[email protected]
compiler:
  solc:
    remappings:
      - '@chainlink=smartcontractkit/[email protected]'
dotenv: .env
networks:
  # with --network with no network name , falls back to default "development" network
  # default: development
  kovan:
    eth_usd_price_feed: '0x9326BFA02ADD2366b30bacB125260Af641031331'
    verify: True
  mainnet-fork:
    eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'
    verify: False
  development:
    verify: False
  ganache-local:
    verify: False
wallets:
  from_key: ${PRIVATE_KEY}

what mistake am I doing? Please guide me through this silly mistake of mine.

shashankvivek avatar Mar 19 '22 22:03 shashankvivek

Please refer to: https://github.com/smartcontractkit/full-blockchain-solidity-course-py/discussions/1110 and https://github.com/eth-brownie/brownie/issues/1441

cromewar avatar Mar 20 '22 02:03 cromewar

@cromewar : Forgive me for my silly question, but the issue and link which you have tagged is about python version that is not compatible with Brownie v1.18.1. I have Python 3.9.9 and Brownie v1.18.1 .

What I was confused about in the question is that "why am I not getting insufficient fund for transfer error when I used address of mainnet? "

shashankvivek avatar Mar 20 '22 10:03 shashankvivek

Well this have being a common question here as allot of users didn't get the error Patrick had, so after research and thanks to @n4n0b1t3 we conclude the problem was related to python versions. However you have the correct one so, any extra idea on this @n4n0b1t3 ???

cromewar avatar Mar 20 '22 14:03 cromewar

Please note: This question belongs to the discussion group and is not filed under issues, issues are reserved for software bugs and the like.

As Patrick says in the video at one point, he replaced the mainnet-fork with his own version and that might not be necessary anymore. What you could do is the following, in your projects directory terminal type brownie networks list true

When searching for mainnet-fork you should find something like this. I guess, that you are fine if your network setup looks like this one here. If the code works, don't sweat it and continue with the tutorial. Look forward to lesson 7, this one you will have the pleasure of MANY things not working (at least not at the start ;-)

  ├─Ganache-CLI (Mainnet Fork)
  │ ├─id: mainnet-fork
  │ ├─cmd: ganache-cli
  │ ├─host: http://127.0.0.1
  │ └─timeout: 120
  │   ├─accounts: 10
  │   ├─evm_version: istanbul
  │   ├─fork: mainnet
  │   ├─gas_limit: 12000000
  │   ├─mnemonic: brownie
  │   └─port: 8545

This is the last time I have seen this kind of question: https://github.com/smartcontractkit/full-blockchain-solidity-course-py/discussions/1151

n4n0b1t3 avatar Mar 20 '22 16:03 n4n0b1t3

Thanks for the clarification @n4n0b1t3

shashankvivek avatar Mar 20 '22 20:03 shashankvivek

For what it's worth, I just went through this section and also experienced the same thing as @shashankvivek. I decided to continue going forward and went through the forking exercise Patrick mentioned. Eventually, I closed out of Ganache UI and that seemed to render the desired results (i.e. finally saw the fork.url from alchemy referenced). Hopefully this is helpful.

trevoraaron avatar Apr 21 '22 22:04 trevoraaron

I'm currently having this issue guys ValueError: insufficient funds for gas * price + value any tips on how to fix?

Mobey-eth avatar Jul 18 '22 17:07 Mobey-eth

trevoraaron

do you mean i should close and reopen terminal?

Mobey-eth avatar Jul 18 '22 17:07 Mobey-eth