-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvrf.deploy.ts
More file actions
43 lines (33 loc) · 1.04 KB
/
vrf.deploy.ts
File metadata and controls
43 lines (33 loc) · 1.04 KB
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
import { ethers } from "hardhat";
const hre = require("hardhat");
const deployContracts = async () => {
let coinToss;
const coinTossContract = await ethers.getContractFactory("ChainlinkCoinFlip");
// create and manage your subscription from https://vrf.chain.link/
// use this link learn how to -> https://docs.chain.link/vrf/v2-5/subscription/create-manage#create-a-subscription-programmatically
const subId = "";
coinToss = await coinTossContract.deploy(subId);
await hre.run("verify:verify", {
address: coinToss.address,
constructorArguments: [subId],
});
console.log({
coinToss: coinToss.address,
});
};
// NOTE
// to run a chainlink vrf,
// make sure to add the contract address in the VRF dashboard ->https://vrf.chain.link/
const flip = async()=>{
const addy = ""
const d = await ethers.getContractAt("ChainlinkCoinFlip",addy)
// NOTE
// head = true, tail = false
const face = true
await d.playWithVRF(face)
}
const main = async () => {
await deployContracts();
// await flip()
};
main();