-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path11_resolver_l2.js
113 lines (103 loc) · 2.95 KB
/
11_resolver_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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const { ethers } = require("hardhat");
const { formatsByCoinType } = require("@ensdomains/address-encoder");
const contentHash = require("content-hash");
/*
** This script set additional informations for the myname.eth node
*/
module.exports = async ({ deployments }) => {
const [, owner] = await ethers.getSigners();
const node = ethers.utils.namehash("myname.mydao.eth");
// Set ETH address
// @DEV: In production, the user will us the `registerWithConfig` method to automatically
// - register a node
// - link the node to a resolver
// - set its EOA address as the ethereum address in the record
await deployments.execute(
"PublicResolver",
{ from: owner.address },
"setAddr(bytes32,uint256,bytes)",
node,
60,
formatsByCoinType[60].decoder(owner.address)
);
// Set BITCOIN address
await deployments.execute(
"PublicResolver",
{ from: owner.address },
"setAddr(bytes32,uint256,bytes)",
node,
0,
formatsByCoinType[0].decoder("bc1q8fnmuy9cfzmym062a93cuqh2l8l0p46gxy74pg")
);
// Set COSMOS address
await deployments.execute(
"PublicResolver",
{ from: owner.address },
"setAddr(bytes32,uint256,bytes)",
node,
118,
formatsByCoinType[118].decoder(
"cosmos14n3tx8s5ftzhlxvq0w5962v60vd82h30sythlz"
)
);
// Set DOGE address
await deployments.execute(
"PublicResolver",
{ from: owner.address },
"setAddr(bytes32,uint256,bytes)",
node,
3,
formatsByCoinType[3].decoder("DBs4WcRE7eysKwRxHNX88XZVCQ9M6QSUSz")
);
// set texts
const texts = [
["avatar", "https://metadata.ens.domains/mainnet/avatar/qdqdqd.eth?v=1.0"],
["com.twitter", "qdqd___"],
["com.github", "qd-qd"],
["org.telegram", "qd_qd_qd"],
["email", "[email protected]"],
["url", "https://ens.domains/"],
["description", "smart-contract engineer"],
["notice", "This is a custom notice"],
["keywords", "solidity,ethereum,developer"],
["company", "ledger"],
];
for (const [key, value] of texts) {
await deployments.execute(
"PublicResolver",
{ from: owner.address },
"setText",
node,
key,
value
);
}
// Set a public key
await deployments.execute(
"PublicResolver",
{ from: owner.address },
"setPubkey",
node,
"0x934ddbf47f355fd7569b46dbeb8255e06c207b17a54e13fec5e201ac2ddf5ae4",
"0x671d4ed12be38d21744044337db1d46be093bd1e0aa1d57d5ac24c956235a757"
);
// Set content hash: ipfs://QmdTPkMMBWQvL8t7yXogo7jq5pAcWg8J7RkLrDsWZHT82y
await deployments.execute(
"PublicResolver",
{ from: owner.address },
"setContenthash",
node,
`0x${contentHash.fromIpfs(
"QmdTPkMMBWQvL8t7yXogo7jq5pAcWg8J7RkLrDsWZHT82y"
)}`
);
// Set canonical name
await deployments.execute(
"PublicResolver",
{ from: owner.address },
"setName",
node,
`${owner.address.toLowerCase()}.addr.reverse`
);
};
module.exports.tags = ["deploy-resolver-l2"];