In Progress Add Mock
This commit is contained in:
9
deploy/00-deploy-mocks.js
Normal file
9
deploy/00-deploy-mocks.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// For Localhost, Hardhat, Ganache Without Price Feed To Get Price Feed
|
||||
|
||||
const { ethers, run, network } = require("hardhat");
|
||||
|
||||
module.exports = async ({ getNamedAccounts, deployments }) => {
|
||||
const { deploy, log } = deployments;
|
||||
const { deployer } = await getNamedAccounts();
|
||||
const chainId = network.config.chainId;
|
||||
};
|
||||
32
deploy/01-deploy-fund-me.js
Normal file
32
deploy/01-deploy-fund-me.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// import
|
||||
const { ethers, run, network } = require("hardhat");
|
||||
const { networkConfig } = require("../helper-hardhat-config");
|
||||
/* Above same as:
|
||||
const helperConfig = 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;
|
||||
|
||||
module.exports = async ({ getNamedAccounts, deployments }) => {
|
||||
const { deploy, log } = deployments;
|
||||
const { deployer } = await getNamedAccounts();
|
||||
const chainId = network.config.chainId;
|
||||
|
||||
const ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"];
|
||||
|
||||
// if contract doest't exist, we deploy a minimal version for our local testing
|
||||
|
||||
// When going for localhost / hardhat network we want to use a mock
|
||||
// Auto Change Chains To Get different Gas
|
||||
const fundMe = await deploy("FundMe", {
|
||||
from: deployer,
|
||||
args: [ethUsdPriceFeedAddress], // put price feed address
|
||||
log: true,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user