-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.html
34 lines (27 loc) · 1.16 KB
/
deploy.html
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
<html>
<head>
<title>Deploy Multicall</title>
</head>
<body>
<script src="node_modules/ethers/dist/ethers.umd.js" type="text/javascript"></script>
<script type="text/javascript">
(async function() {
const data = await ethers.utils.fetchJson("./contract.json");
await window.ethereum.enable();
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
console.log(await signer.getAddress());
const ens = new ethers.Contract((await provider.getNetwork()).ensAddress, [
"function owner(bytes32 node) view returns (address)"
], provider);
const reverseRegistrar = await ens.owner(ethers.utils.namehash("addr.reverse"));
const factory = new ethers.ContractFactory(data.abi, data.initcode, signer);
const contract = await factory.deploy(reverseRegistrar);
console.log("Contract:", contract.address);
console.log("Transaction:", contract.deployTransaction.hash);
const receipt = await contract.deployTransaction.wait();
console.log("Receipt:", receipt);
})();
</script>
</body>
</html>