When i want to deploy my contract with this command:
npx hardhat run --network goerli scripts/deploy.js
I get this error:
ProviderError: HttpProviderError at HttpProvider.request (/Users/alirezamac/Documents/Token-dex/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)
And here is my config file:
require("@nomicfoundation/hardhat-toolbox");
require ("dotenv").config()
module.exports = {
solidity: "0.8.17",
networks: {
goerli: {
url: process.env.INFURA_GOERLI_ENDPOINT,
accounts: [process.env.PRIVATE_KEY],
chainId: 5
},
},
};
and also this is my deploy file:
const hre = require("hardhat");
async function main() {
const Token = await hre.ethers.getContractFactory("MyToken")
const token = await Token.deploy();
await token.deployed()
console.log("Congratulations!! Your token deployed, Here's token address:", token.address);
const Dex = await hre.ethers.getContractFactory("Dex2")
const myDex = await Dex.deploy(token.address)
await token.deployed()
console.log("Here's your dex contract address:", myDex.address);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});