hardhat.config
require('@nomiclabs/hardhat-ethers');
require('dotenv').config();
const { BSC_API_URL, MNEMONIC } = process.env;
module.exports = {
solidity: "0.5.16",
networks: {
bsc: {
url: BSC_API_URL,
accounts: {
mnemonic: MNEMONIC,
},
},
hardhat: {
forking: {
url: BSC_API_URL,
},
},
},
};
scripts/deploy.js
const { ethers } = require("hardhat");
async function main() {
const [deployer] = await ethers.getSigners();
const PancakeFactory = await ethers.getContractFactory('PancakeFactory');
const factory = await PancakeFactory.deploy(deployer.address);
await factory.deployed();
console.log('PancakeFactory deployed to:', factory.address);
const PancakePair = await ethers.getContractFactory('PancakePair');
const pair = await PancakePair.deploy();
await pair.deployed();
console.log('PancakePair deployed to:', pair.address);
console.log(`PancakeFactory Address: ${factory.address}`);
console.log(`PancakePair Address: ${pair.address}`);
}
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
After running npx hardhat compile i am getting error
PS D:taskpancake-swap-corescripts> npx hardhat compile
Error HH8: There’s one or more errors in your config file:
- Invalid value {“forking”:{}} for HardhatConfig.networks.hardhat – Expected a value of type HardhatNetworkConfig.
- Invalid value undefined for HardhatConfig.networks.bsc.url – Expected a value of type string.
- Invalid value {} for HardhatConfig.networks.bsc – Expected a value of type HttpNetworkHDAccountsConfig.
To learn more about Hardhat’s configuration, please go to https://hardhat.org/config/
How do i sucessfully fork pancake swap v2 to bsc??
New contributor
Lucky Rajput is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.