Problem Mock & package.json

This commit is contained in:
2024-08-05 16:57:41 +08:00
parent 6e9c6dd633
commit 3ab5ee37c6
11 changed files with 128 additions and 1096 deletions
+17 -7
View File
@@ -6,18 +6,28 @@ const { networkConfig } = require("../helper-hardhat-config");
const networkConfig = helperConfig.networkConfig;
*/
// main function
//function deployFunc() {
// const {getNamedAccounts, deployments} = hre;
// // Same as hre.getNamedAccounts & hre.deployments
//}
//module.exports.default = deployFunc;
/*
// main function that auto run via hardhat deploy
function deployFunc() {
const { getNamedAccounts, deployments } = hre; // Hardhat runtime environment
// Same as hre.getNamedAccounts & hre.deployments
console.log("Hello World!");
}
module.exports.default = deployFunc;
*/
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const { deployer } = await getNamedAccounts(); // Take from hardhat.config.js namedAccounts
const chainId = network.config.chainId;
if (networkConfig[chainId] === undefined) {
console.log("Is Not Testnet / Mainnet! No Mock Up...");
console.log(deployments);
const ethUsdAggregator = await deployments.get("MockV3Aggregator");
return;
}
const ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"];
// if contract doest't exist, we deploy a minimal version for our local testing