Lesson 9: TypeError: no matching function (argument="key", value="address", code=INVALID_ARGUMENT, version=6.6.6) #5946
-
I am running into the following error: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Ethers version 6 made some changes like |
Beta Was this translation helpful? Give feedback.
-
what if both : vrfCoordinatorV2Address = await vrfCoordinatorV2Mock.getAddress(); and vrfCoordinatorV2Address = vrfCoordinatorV2Mock.target; do not work ? i get:
with any of the three versions. 01-deploy-raffle.js: const { network, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify")
const { Log } = require("ethers")
const VRF_SUB_FUND_AMOUNT = ethers.parseEther("1") // 1 Ether, or 1e18 (10^18) Wei
module.exports = async function ({ getNamedAccounts, deployments }) {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
let vrfCoordinatorV2Address, subscriptionId
if (chainId == 31337) {
const vrfCoordinatorV2Mock = await ethers.getContractAt("VRFCoordinatorV2Mock")
vrfCoordinatorV2Address = await vrfCoordinatorV2Mock.getAddress()
const transactionResponse = await vrfCoordinatorV2Mock.createSubscription()
const transactionReceipt = await transactionResponse.wait(1)
subscriptionId = 1
// Fund the subscription
await vrfCoordinatorV2Mock.fundSubscription(subscriptionId, VRF_SUB_FUND_AMOUNT)
} else {
// testnet
vrfCoordinatorV2Address = networkConfig[chainId]["vrfCoordinatorV2"]
subscriptionId = networkConfig[chainId]["subscriptionId"]
}
const entranceFee = networkConfig[chainId]["entranceFee"]
const gasLane = networkConfig[chainId]["gasLane"]
const callbackGasLimit = networkConfig[chainId]["callbackGasLimit"]
const interval = networkConfig[chainId]["interval"]
const args = [
vrfCoordinatorV2Address,
entranceFee,
gasLane,
subscriptionId,
callbackGasLimit,
interval,
]
const raffle = await deploy("Raffle", {
from: deployer,
args: args,
log: true,
waitConfirmations: network.config.blockConfirmations || 1,
})
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
log("Verifying...")
await verify(raffle.address, args)
}
log("Raffle Deployed!")
log("------------------------------")
}
module.exports.tags = ["all", "raffle"] |
Beta Was this translation helpful? Give feedback.
-
Hi @affanmustafa, @Astronaut828 |
Beta Was this translation helpful? Give feedback.
You have two ways to fix this issue.
one way is change any
address
totarget
orawait .. getAddress()
like this, in
01-delpoy-raffle.js
file changefrom
to
or
this means you will use
ethersV6
.OR
the other way is, downgrade the
ethers
version to^5
change these lines in
package.json
fileto
then run
yarn
ory…