Skip to content

Commit 184cd33

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
deploy signature-drop and multiwrap
1 parent 37a330b commit 184cd33

File tree

3 files changed

+50
-22
lines changed

3 files changed

+50
-22
lines changed

scripts/addImplementation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ethers } from "hardhat";
22

33
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
4-
import { TWFactory } from "typechain/TWFactory";
4+
import { TWFactory } from "typechain";
55

66
async function main() {
77

scripts/deploy/multiwrap.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
11
import hre, { ethers } from "hardhat";
22

33
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";
76

87
async function main() {
98

109
const [caller]: SignerWithAddress[] = await ethers.getSigners();
1110

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];
1613

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-
}
2414
const multiwrap: Multiwrap = await ethers.getContractFactory("Multiwrap").then(f => f.deploy(nativeTokenWrapperAddress));
25-
2615
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();
3317

3418
console.log("\n")
3519

scripts/deploy/signatureDrop.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import hre, { ethers } from "hardhat";
2+
3+
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
4+
5+
import { SignatureDrop, SigMint } from "typechain";
6+
7+
async function main() {
8+
9+
const [caller]: SignerWithAddress[] = await ethers.getSigners();
10+
11+
console.log("\n")
12+
13+
const sigmint: SigMint = await ethers.getContractFactory("SigMint").then(f => f.deploy());
14+
console.log("Deploying SigMint \ntransaction: ", sigmint.deployTransaction.hash, "\naddress: ", sigmint.address);
15+
await sigmint.deployTransaction.wait();
16+
17+
const sigdrop: SignatureDrop = await ethers.getContractFactory("SignatureDrop").then(f => f.deploy());
18+
console.log("Deploying SignatureDrop \ntransaction: ", sigdrop.deployTransaction.hash, "\naddress: ", sigdrop.address);
19+
await sigdrop.deployTransaction.wait();
20+
21+
console.log("\n")
22+
23+
console.log("Verifying contract.")
24+
await verify(sigdrop.address, []);
25+
await verify(sigmint.address, []);
26+
}
27+
28+
async function verify(address: string, args: any[]) {
29+
try {
30+
return await hre.run("verify:verify", {
31+
address: address,
32+
constructorArguments: args,
33+
});
34+
} catch (e) {
35+
console.log(address, args, e);
36+
}
37+
}
38+
39+
main()
40+
.then(() => process.exit(0))
41+
.catch((e) => {
42+
console.error(e)
43+
process.exit(1)
44+
})

0 commit comments

Comments
 (0)