Random, Upkeep, Mock Ready

This commit is contained in:
2024-08-11 07:38:17 +08:00
parent 255dc6e19b
commit 5df036c2c1
9 changed files with 98 additions and 69 deletions
+18 -3
View File
@@ -1,20 +1,35 @@
const { network } = require("hardhat");
const { network, ethers } = require("hardhat");
const { developmentChains } = require("../helper-hardhat-config");
//require("../contracts/test/VRFCoordinatorV2_5Mock");
const BASE_FEE = "250000000000000000"; // 0.25 is this the premium in LINK?
const GAS_PRICE_LINK = 1e9; // link per gas, is this the gas lane? // 0.000000001 LINK per gas
// 0.25 or 250000000000000000 is this the premium in LINK
const BASE_FEE = ethers.utils.parseEther("0.25");
// link per gas, is this the gas lane? // 0.000000001 LINK per gas
const GAS_PRICE_LINK = 1e9;
// This should be the conversion rate between Wei and LINK
const WEI_PRE_UNIT_LINK = ethers.utils.parseUnits("1", "ether");
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chainId;
// If we are on a local development network, we need to deploy mocks!
if (chainId == 31337) {
log("Local network detected! Deploying mocks...");
/* // Deprecated
await deploy("VRFCoordinatorV2Mock", {
from: deployer,
log: true,
args: [BASE_FEE, GAS_PRICE_LINK],
});
*/
await deploy("VRFCoordinatorV2_5Mock", {
from: deployer,
log: true,
args: [BASE_FEE, GAS_PRICE_LINK, WEI_PRE_UNIT_LINK],
});
log("Mocks Deployed!");
log("----------------------------------------------------------");