You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module.exports = {
solidity: "0.8.8",
defaultNetwork: "hardhat",
network: {
hardhat: {
chainId: 31337,
blockConfirmations: 1,
},
sepolia: {
chainId: 11155111,
blockConfirmations: 6,
url: SEPOLIA_RPC_URL,
accounts: PRIVATE_KEY,
},
},
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
},
},
};
`
This is the error:
`Debugger attached.
yarn run v1.22.19
warning package.json: No license field
$ /home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/.bin/hardhat deploy
Debugger attached.
Nothing to compile
Local network detected! Deploying mocks ...
deploying "VRFCoordinatorV2Mock" (tx: 0x943bba99f5f8086776d6cdb4802eaa8a7605f1273f6e6ee44f72e50fda0b31b1)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 2544160 gas
Mocks deployed
An unexpected error occurred:
Error: ERROR processing /home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/deploy/01-deploy-raffle.js:
TypeError: Cannot read properties of undefined (reading 'length')
at getFrom (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/helpers.ts:1642:14)
at _deploy (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/helpers.ts:537:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)
at _deployOne (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/helpers.ts:934:16)
at Object.module.exports [as func] (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/deploy/01-deploy-raffle.js:47:18)
at DeploymentsManager.executeDeployScripts (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1220:22)
at DeploymentsManager.runDeploy (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1053:5)
at DeploymentsManager.executeDeployScripts (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1223:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)
at DeploymentsManager.runDeploy (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1053:5)
at SimpleTaskDefinition.action (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/index.ts:409:5)
at Environment._runTaskDefinition (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat/src/internal/core/runtime-environment.ts:330:14)
at Environment.run (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat/src/internal/core/runtime-environment.ts:163:14)
at SimpleTaskDefinition.action (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/index.ts:555:32)
Waiting for the debugger to disconnect...
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Waiting for the debugger to disconnect...`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
This is my 01-deploy-raffle.js and i run to this problem at 15:19:55 when I try to deploy the contract to hardhat
`const { network, ethers } = require("hardhat");
const {
developmentChains,
networkConfig,
} = require("../helper-hardhat-config");
const { verify } = require("../helper-hardhat-config");
const VRF_SUB_FUND_AMOUNT = ethers.utils.parseEther("30");
module.exports = async function ({ getNamedAccounts, deployments }) {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chainId;
let vrfCoordinatorV2Address;
let subscriptionId;
if (developmentChains.includes(network.name)) {
const 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 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", {
form: 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("-----------------------------");
};
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();
const GOERLI_RPC_URL = process.env.GOERLI_RPC_URL;
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || "key";
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || "key";
module.exports = {
solidity: "0.8.8",
defaultNetwork: "hardhat",
network: {
hardhat: {
chainId: 31337,
blockConfirmations: 1,
},
sepolia: {
chainId: 11155111,
blockConfirmations: 6,
url: SEPOLIA_RPC_URL,
accounts: PRIVATE_KEY,
},
},
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
},
},
};
`
This is the error:
`Debugger attached.
yarn run v1.22.19
warning package.json: No license field
$ /home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/.bin/hardhat deploy
Debugger attached.
Nothing to compile
Local network detected! Deploying mocks ...
deploying "VRFCoordinatorV2Mock" (tx: 0x943bba99f5f8086776d6cdb4802eaa8a7605f1273f6e6ee44f72e50fda0b31b1)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 2544160 gas
Mocks deployed
An unexpected error occurred:
Error: ERROR processing /home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/deploy/01-deploy-raffle.js:
TypeError: Cannot read properties of undefined (reading 'length')
at getFrom (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/helpers.ts:1642:14)
at _deploy (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/helpers.ts:537:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)
at _deployOne (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/helpers.ts:934:16)
at Object.module.exports [as func] (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/deploy/01-deploy-raffle.js:47:18)
at DeploymentsManager.executeDeployScripts (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1220:22)
at DeploymentsManager.runDeploy (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1053:5)
at DeploymentsManager.executeDeployScripts (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1223:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)
at DeploymentsManager.runDeploy (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1053:5)
at SimpleTaskDefinition.action (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/index.ts:409:5)
at Environment._runTaskDefinition (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat/src/internal/core/runtime-environment.ts:330:14)
at Environment.run (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat/src/internal/core/runtime-environment.ts:163:14)
at SimpleTaskDefinition.action (/home/alanle1011/hardhat_course/hardhat-smartcontract-lottery/node_modules/hardhat-deploy/src/index.ts:555:32)
Waiting for the debugger to disconnect...
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Waiting for the debugger to disconnect...`
Beta Was this translation helpful? Give feedback.
All reactions