-
In lesson:9 while deploying my contract on sepolia testnet I get this error. My 01-deploy-raffle.js: const { network, ethers } = require("hardhat");
const {
developmentChains,
networkConfig,
} = require("../helper-hardhat-config");
const { verify } = require("../utils/verify");
const VRF_SUB_FUND_AMOUNT = ethers.utils.parseEther("1");
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chainId;
let vrfCoordinatorV2Address, subscriptionId;
if (developmentChains.includes(network.name)) {
vrfCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock");
vrfCoordinatorV2Address = vrfCoordinatorV2Mock.address;
const transactionResponse = await vrfCoordinatorV2Mock.createSubscription();
const transactionReceipt = await transactionResponse.wait(1);
subscriptionId = transactionReceipt.events[0].args.subId;
await vrfCoordinatorV2Mock.fundSubscription(
subscriptionId,
VRF_SUB_FUND_AMOUNT
);
} else {
vrfCoordinatorV2Address = networkConfig[chainId]["vrfCoordinatorV2"];
subscriptionId = networkConfig[chainId]["subscriptionId"];
}
const entranceFee = networkConfig[chainId]["entranceFee"];
const callbackGasLimit = networkConfig[chainId]["callbackGasLimit"];
const gasLane = networkConfig[chainId]["gasLane"];
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,
});
await vrfCoordinatorV2Mock.addConsumer(subscriptionId, raffle.address);
if (!developmentChains.includes(network.name) || process.env.API_KEY) {
log("Verifying...");
await verify(raffle.address, args);
}
log("---------------------------------------------------");
};
module.exports.tags = ["all", "raffle"]; hardhat-config.js: require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");
require("hardhat-deploy");
require("solidity-coverage");
require("hardhat-gas-reporter");
require("hardhat-contract-sizer");
require("dotenv").config();
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.7",
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337,
blockConfirmations: 1,
},
goerli: {
chainId: 5,
blockConfirmations: 6,
url: process.env.RPC_URL,
accounts: [process.env.PRIVATE_KEY],
},
sepolia: {
chainId: 11155111,
blockConfirmations: 6,
url: process.env.RPC_URL,
accounts: [process.env.PRIVATE_KEY],
},
},
namedAccounts: {
deployer: {
default: 0,
},
player: {
default: 1,
},
},
mocha: {
timeout: 200000,
},
etherscan: {
apiKey: process.env.API_KEY,
},
gasReporter: {
enabled: false,
outputFile: "gas-reporter.txt",
noColors: true,
currency: "USD",
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
token: "ETH",
},
}; helper-hardhat-config.js: const { ethers } = require("hardhat");
const networkConfig = {
5: {
name: "goerli",
vrfCoordinatorV2: "0x2ca8e0c643bde4c2e08ab1fa0da3401adad7734d",
entranceFee: ethers.utils.parseEther("0.01"),
gasLane:
"0x79d3d8832d904592c0bf9818b621522c988bb8b0c05cdc3b15aea1b6e8db0c15",
subscriptionId: "10710",
callbackGasLimit: "500000",
interval: "30",
},
11155111: {
name: "sepolia",
subscriptionId: "10710",
gasLane:
"0x474e34a077df58807dbe9c96d3c009b23b3c6d0cce433e59bbf5b34f823bc56c", // 30 gwei
interval: "30",
entranceFee: ethers.utils.parseEther("0.01"), // 0.01 ETH
callbackGasLimit: "500000", // 500,000 gas
vrfCoordinatorV2: "0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625",
},
31337: {
name: "hardhat",
entranceFee: ethers.utils.parseEther("0.01"),
gasLane:
"0x79d3d8832d904592c0bf9818b621522c988bb8b0c05cdc3b15aea1b6e8db0c15",
callbackGasLimit: "500000",
interval: "30",
},
};
const developmentChains = ["hardhat", "goerli","sepolia"];
module.exports = {
networkConfig,
developmentChains,
}; Full error:
I also tried after resetting my account but it doesn't work?? |
Beta Was this translation helpful? Give feedback.
Answered by
ptdatta
Mar 14, 2023
Replies: 2 comments 22 replies
-
Check your helper-hardhat-config.js:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
On the hardhat network it deployed completely fine but when I switch to sepolia it gives that error |
Beta Was this translation helpful? Give feedback.
22 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On the hardhat network it deployed completely fine but when I switch to sepolia it gives that error