-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path13-gatekeeperOne.js
More file actions
25 lines (21 loc) · 888 Bytes
/
Copy path13-gatekeeperOne.js
File metadata and controls
25 lines (21 loc) · 888 Bytes
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
const hre = require("hardhat");
async function main() {
// const gateKeeperAddr = "0x0ccdBBc96c21Ad83636fAc53D8E0b3745759036e";
const GateKeeper = await hre.ethers.getContractFactory("GatekeeperOne");
const gateKeeperInstance = await GateKeeper.deploy();
await gateKeeperInstance.deployed();
const GateKeeperHack = await hre.ethers.getContractFactory("GateKeeperHack");
const gateKeeperHack = await GateKeeperHack.deploy(gateKeeperInstance.address);
await gateKeeperHack.deployed();
console.log("Entrant:", await gateKeeperInstance.entrant());
await gateKeeperHack.tryEnter(4294976102);
console.log("Entrant:", await gateKeeperInstance.entrant());
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});