-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhardhat.config.ts
59 lines (51 loc) · 1.72 KB
/
hardhat.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { HardhatUserConfig } from "hardhat/types";
import { task } from "hardhat/config";
import { ContractFactory } from "ethers";
import { TransactionResponse } from "@ethersproject/abstract-provider";
import "@nomiclabs/hardhat-waffle";
import * as dotenv from "dotenv";
dotenv.config();
task("vrf-callback", "Mocks a VRF callback")
.addParam("coordinator", "VRF coordinator contract address")
.addParam("request", "Request ID")
.addParam("tokenpack", "TokanPack contract address")
.addParam("randomness", "Random number to send in mocked callback")
.setAction(async (args, hre) => {
const signers = await hre.ethers.getSigners();
const vrfCoordinatorFactory: ContractFactory =
await hre.ethers.getContractFactory("VRFCoordinatorMock", {
signer: signers[0],
});
const vrfCoordinator = vrfCoordinatorFactory.attach(args.coordinator);
const vrfTx: TransactionResponse =
await vrfCoordinator.callBackWithRandomness(
args.request,
parseInt(args.randomness),
args.tokenpack,
{ gasLimit: 230000 }
);
console.log("Transaction:", await vrfTx.wait());
});
const config: HardhatUserConfig = {
solidity: {
compilers: [{ version: "0.8.3", settings: {} }],
},
networks: {
hardhat: {
forking: {
url: process.env.MUMBAI_NODE_URL || "https://rpc-mumbai.maticvigil.com",
},
},
mumbai: {
url: process.env.MUMBAI_NODE_URL || "https://rpc-mumbai.maticvigil.com",
accounts: [
process.env.MUMBAI_ACCOUNT_1!,
process.env.MUMBAI_ACCOUNT_2!,
process.env.MUMBAI_ACCOUNT_3!,
process.env.MUMBAI_ACCOUNT_4!,
process.env.MUMBAI_ACCOUNT_5!,
],
},
},
};
export default config;