-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path10_setup_l2.js
59 lines (52 loc) · 1.5 KB
/
10_setup_l2.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const { ethers } = require("hardhat");
/*
** This script set the root node, set the myname.eth node
** and set the public resolver to the freshly created node
*/
module.exports = async () => {
const [admin, owner] = await ethers.getSigners();
const publicResolver = await ethers.getContract("PublicResolver");
// create the root node
await deployments.execute(
"ENSRegistry",
{ from: admin.address },
"setSubnodeOwner",
"0x0000000000000000000000000000000000000000000000000000000000000000",
ethers.utils.id("eth"),
admin.address
);
// register mydao.eth domain
await deployments.execute(
"ENSRegistry",
{ from: admin.address },
"setSubnodeOwner",
ethers.utils.namehash("eth"),
ethers.utils.id("mydao"),
admin.address
);
// register myname.mydao.eth domain
await deployments.execute(
"ENSRegistry",
{ from: admin.address },
"setSubnodeOwner",
ethers.utils.namehash("mydao.eth"),
ethers.utils.id("myname"),
owner.address
);
// set the custom resolver
await deployments.execute(
"ENSRegistry",
{ from: owner.address },
"setResolver",
ethers.utils.namehash("myname.mydao.eth"),
publicResolver.address
);
// log the address of the owner of the ENS
// this address must match the address output when you run `yarn start:client myname.mydao.eth`
console.log(
"\n\n\x1b[34m\x1b[1m",
`Owner of the ENS address -> ${owner.address}`,
"\x1b[0m\n\n"
);
};
module.exports.tags = ["deploy-setup-l2"];