|
1 | 1 | import hre, { ethers } from "hardhat"; |
2 | 2 |
|
3 | 3 | import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; |
4 | | - |
5 | | -import { TWFactory } from "typechain/TWFactory"; |
6 | | -import { Multiwrap } from "typechain/Multiwrap"; |
| 4 | +import { Multiwrap } from "typechain"; |
| 5 | +import { nativeTokenWrapper } from "../../utils/nativeTokenWrapper"; |
7 | 6 |
|
8 | 7 | async function main() { |
9 | 8 |
|
10 | 9 | const [caller]: SignerWithAddress[] = await ethers.getSigners(); |
11 | 10 |
|
12 | | - const nativeTokenWrapperAddress: string = ethers.constants.AddressZero; // replace |
13 | | - const twFactoryAddress: string = ethers.constants.AddressZero; // replace |
14 | | - |
15 | | - const twFactory: TWFactory = await ethers.getContractAt('TWFactory', twFactoryAddress); |
| 11 | + const chainId: number = hre.network.config.chainId as number; |
| 12 | + const nativeTokenWrapperAddress: string = nativeTokenWrapper[chainId]; |
16 | 13 |
|
17 | | - const hasFactoryRole = await twFactory.hasRole( |
18 | | - ethers.utils.solidityKeccak256(["string"], ["FACTORY_ROLE"]), |
19 | | - caller.address |
20 | | - ) |
21 | | - if(!hasFactoryRole) { |
22 | | - throw new Error("Caller does not have FACTORY_ROLE on factory"); |
23 | | - } |
24 | 14 | const multiwrap: Multiwrap = await ethers.getContractFactory("Multiwrap").then(f => f.deploy(nativeTokenWrapperAddress)); |
25 | | - |
26 | 15 | console.log("Deploying Multiwrap \ntransaction: ", multiwrap.deployTransaction.hash, "\naddress: ", multiwrap.address); |
27 | | - |
28 | | - console.log("\n") |
29 | | - |
30 | | - const addImplementationTx = await twFactory.addImplementation(multiwrap.address) |
31 | | - console.log("Adding Multiwrap implementation to TWFactory: ", addImplementationTx.hash); |
32 | | - await addImplementationTx.wait(); |
| 16 | + await multiwrap.deployTransaction.wait(); |
33 | 17 |
|
34 | 18 | console.log("\n") |
35 | 19 |
|
|
0 commit comments