Mock Ready
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// For Localhost, Hardhat, Ganache Without Price Feed To Get Price Feed
|
||||
|
||||
const { network } = require("hardhat");
|
||||
const {
|
||||
developmentChains,
|
||||
DECIMALS,
|
||||
INITIAL_ANSWER,
|
||||
} = require("../helper-hardhat-config");
|
||||
|
||||
module.exports = async ({ getNamedAccounts, deployments }) => {
|
||||
const { deploy, log } = deployments;
|
||||
const { deployer } = await getNamedAccounts();
|
||||
const chainId = network.config.chainId;
|
||||
const networkName = network.name;
|
||||
|
||||
// Don't deploy mock contract to real blockchain with price feed
|
||||
// Here can chekc with chainId as well
|
||||
if (developmentChains.includes(networkName)) {
|
||||
log("Local network '" + networkName + "', deploying mocks...");
|
||||
|
||||
await deploy("MockV3Aggregator", {
|
||||
contract: "MockV3Aggregator",
|
||||
from: deployer,
|
||||
log: true,
|
||||
args: [DECIMALS, INITIAL_ANSWER],
|
||||
});
|
||||
|
||||
log("Mocks deployed!");
|
||||
log("=====================================");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.tags = ["all", "mocks"];
|
||||
Reference in New Issue
Block a user