34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
// 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"];
|