PatrickAlphaC / hardhat-nft-fcc

102 stars 140 forks source link

invalid contract address or ENS name #21

Closed mertdeveci5 closed 2 years ago

mertdeveci5 commented 2 years ago

Hey everyone - trying to run the test deploys on the local network however have been getting the below error

invalid contract address or ENS name (argument="addressOrName", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.5.0)

I checked typos on vrfCoordinatorV2Mock etc and corrected any of them. The error points to deploy\02-deploy-random-ipfs-nft.js:

I am really not able to understand what is wrong here. The only difference I have from Patrick's code is the below where I have to use getContractAt and he uses getContract, the reason being getContract simply does not exist and there is an error. Would love the help

 if (developmentChains.includes(network.name)) {
    let vrfCoordinatorV2Address;
    const vrfCoordinatorV2Mock = await ethers.getContractAt(
      "VRFCoordinatorV2Mock"
    );
RoboCrypter commented 2 years ago

Do you have a "VRFCoordinatorV2Mock" in your contracts ?

mertdeveci5 commented 2 years ago

I have "VRFCoordinatorV2Mock.sol" under test folder under contracts. Then again, the file also has an error below as to I cannot resolve why this pops up. Is this a version issue or smt? The current code from Patrick is relatively recent.

RoboCrypter commented 2 years ago

send me your repo link. I will look into that.

mertdeveci5 commented 2 years ago

Just added you to the repo, would appreciate the help

RoboCrypter commented 2 years ago

kindly push your code to your repo.

PatrickAlphaC commented 2 years ago

getContractAt looks for an address at a specific address, since you're not passing the address, getContractAt won't work, you'll need to fix the issue with not having getContract.

mertdeveci5 commented 2 years ago

Hey Patrick - thanks for this. Do you have an idea why this is happening? getContract simply does not exist and it throws an error. There might be a change with hardhat-deploy-ethers package I believe and hardhat-ethers as well since you made the tutorial?

PatrickAlphaC commented 2 years ago

getContract should come with hardhat deploy.

What happens when you do this:

git clone https://github.com/PatrickAlphaC/hardhat-nft-fcc
cd hardhat-nft-fcc
yarn

And then run the command you want. If it works in this repo, you'd just need to see what your repo is missing.

mertdeveci5 commented 2 years ago

kindly push your code to your repo.

pushed, sorry for the delay

mertdeveci5 commented 2 years ago

kindly push your code to your repo.

pushed, sorry for the delay

resolved for now man - thank you much appreciated

Rasta669 commented 1 year ago

Hello, I'm having the same issue, can you show how you solved it, apart from cloning the repo