Skip to content

Commit 135b06f

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
update scripts
1 parent 938cd86 commit 135b06f

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

scripts/deploy/byocSetup.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,22 @@ async function verify(address: string, args: any[]) {
2727
}
2828

2929
async function main() {
30-
const registryAddress: string = "0x3F17972CB27506eb4a6a3D59659e0B57a43fd16C";
3130

3231
const [deployer]: SignerWithAddress[] = await ethers.getSigners();
3332
console.log("Deployer address:", deployer.address);
3433

35-
const trustedForwarders: string[] = ["0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81"];
34+
const trustedForwarder: string = "0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81";
3635

37-
const registry: TWRegistry = await ethers.getContractAt("TWRegistry", registryAddress);
38-
console.log("TWRegistry at: ", registry.address);
36+
// const registryAddress: string = ethers.constants.AddressZero; // replace
37+
// const registry: TWRegistry = await ethers.getContractAt("TWRegistry", registryAddress);
38+
const registry: TWRegistry = await ethers.getContractFactory("TWRegistry").then(f => f.deploy(trustedForwarder));
39+
console.log("\nDeploying new TWRegistry \ntx: ", registry.deployTransaction.hash, "\naddress: ", registry.address);
40+
41+
await registry.deployTransaction.wait();
3942

4043
const byocRegsitry: ByocRegistry = await ethers
4144
.getContractFactory("ByocRegistry")
42-
.then(f => f.deploy(trustedForwarders));
45+
.then(f => f.deploy(trustedForwarder));
4346
console.log(
4447
"Deploying ByocRegistry at tx: ",
4548
byocRegsitry.deployTransaction.hash,
@@ -51,20 +54,19 @@ async function main() {
5154

5255
const byocFactory: ByocFactory = await ethers
5356
.getContractFactory("ByocFactory")
54-
.then(f => f.deploy(registryAddress, trustedForwarders));
55-
console.log("Deploying ByocFactory at tx: ", byocFactory.deployTransaction.hash, " address: ", byocFactory.address);
57+
.then(f => f.deploy(registry.address, trustedForwarder));
58+
console.log("\nDeploying ByocFactory \ntx: ", byocFactory.deployTransaction.hash, "\naddress: ", byocFactory.address);
5659
await byocFactory.deployTransaction.wait();
57-
console.log("Deployed ByocFactory");
5860

5961
const tx = await registry.grantRole(await registry.OPERATOR_ROLE(), byocFactory.address);
60-
console.log("Granting operator role to ByocFactory: ", tx.hash);
62+
console.log("\nGranting operator role to ByocFactory: ", tx.hash);
6163

6264
await tx.wait();
6365

64-
console.log("Done. Now verifying contracts:");
66+
console.log("\nDone. Now verifying contracts:");
6567

66-
await verify(byocRegsitry.address, [trustedForwarders]);
67-
await verify(byocFactory.address, [registryAddress, trustedForwarders]);
68+
// await verify(byocRegsitry.address, [trustedForwarders]);
69+
await verify(byocFactory.address, [registry.address, trustedForwarder]);
6870
}
6971

7072
main()

scripts/grantAdminRoleTwRegistry.ts renamed to scripts/grantRoleTwRegistry.ts

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

33
import { Wallet } from "@ethersproject/wallet";
4+
import { BytesLike } from "@ethersproject/bytes";
45

56
import { TWRegistry } from "typechain";
67

@@ -13,6 +14,7 @@ async function main() {
1314
const currentAdmin: Wallet = new ethers.Wallet(currentAdminPkey, ethers.provider);
1415

1516
const receiverOfRole: string = ethers.constants.AddressZero;
17+
const role: BytesLike = ""; // replace
1618

1719
const isAdminOnRegistry: boolean = await twRegistry.hasRole(
1820
await twRegistry.DEFAULT_ADMIN_ROLE(),
@@ -24,7 +26,7 @@ async function main() {
2426

2527
const grantRoleTx = await twRegistry
2628
.connect(currentAdmin)
27-
.grantRole(await twRegistry.DEFAULT_ADMIN_ROLE(), receiverOfRole);
29+
.grantRole(role, receiverOfRole);
2830

2931
console.log(`\nGranting admin role to ${receiverOfRole} at tx: ${grantRoleTx.hash}`);
3032

scripts/revokeAdminRoleTwRegistry.ts renamed to scripts/revokeRoleTwRegistry.ts

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

33
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
4+
import { BytesLike } from "@ethersproject/bytes";
45

56
import { TWRegistry } from "typechain";
67

@@ -20,9 +21,11 @@ async function main() {
2021
console.log("Caller provided is admin on registry. Revoking role now.");
2122
}
2223

24+
const role: BytesLike = ""; // replace
25+
2326
const revokeRoleTx = await twRegistry
2427
.connect(roleHolder)
25-
.revokeRole(await twRegistry.DEFAULT_ADMIN_ROLE(), roleHolder.address);
28+
.revokeRole(role, roleHolder.address);
2629

2730
console.log(`\nRevoking admin role from ${roleHolder.address} at tx: ${revokeRoleTx.hash}`);
2831

0 commit comments

Comments
 (0)