不管我把什么放在我的hardhat.config.js中,我的合同都会部署到0x5FbDB2315678afecb367f032d9F642f64180a3。我做错了什么?
PRIVATE_KEY=[redacted] node scripts/deploy.js --network sepolia
deploying...
awaiting disperse.deployed()
Disperse deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3我的hardhat.config.js非常基本,它只包含了用于网络的以下内容:
module.exports = {
networks: {
goerli: {
url: "https://rpc.ankr.com/eth_goerli",
accounts: [process.env.PRIVATE_KEY]
},
sepolia: {
url: "https://rpc.sepolia.org",
accounts: [process.env.PRIVATE_KEY]
}
},
...我的部署脚本也非常简单,它包含:
const Disperse = await hre.ethers.getContractFactory("DisperseNft");
console.log("deploying...")
const disperse = await Disperse.deploy();
console.log("awaiting disperse.deployed()")
await disperse.deployed();
console.log("Disperse deployed to:", disperse.address);发布于 2023-01-11 03:15:42
我想出了解决办法,虽然我不知道为什么要这样做。
而不是跑
node scripts/deploy.js 跑
npx hardhat run scripts/deploy.js发布于 2023-02-22 08:45:26
如果您试图在任何一个testnet/mainnet上部署契约,请沿着命令提供示例
npx hardhat run scripts/deploy.js --network goerlihttps://ethereum.stackexchange.com/questions/142714
复制相似问题