Skip to content

Commit e68775c

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
redeploy drop to networks
1 parent a7327bf commit e68775c

File tree

5 files changed

+43
-19
lines changed

5 files changed

+43
-19
lines changed

scripts/addImplementation.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { ethers } from "hardhat";
2+
3+
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
4+
import { TWFactory } from "typechain/TWFactory";
5+
6+
async function main() {
7+
8+
const [caller]: SignerWithAddress[] = await ethers.getSigners();
9+
10+
console.log("\nCaller address: ", caller.address);
11+
12+
const twFactoryAddress: string = ethers.constants.AddressZero; // replace
13+
const twFactory: TWFactory = await ethers.getContractAt("TWFactory", twFactoryAddress);
14+
15+
const hasFactoryRole = await twFactory.hasRole(
16+
ethers.utils.solidityKeccak256(["string"], ["FACTORY_ROLE"]),
17+
caller.address
18+
)
19+
if(!hasFactoryRole) {
20+
throw new Error("Caller does not have FACTORY_ROLE on new factory");
21+
}
22+
23+
const implementations: string[] = []; // replace
24+
const data = implementations.map((impl) => twFactory.interface.encodeFunctionData("addImplementation", [impl]));
25+
26+
const tx = await twFactory.multicall(data);
27+
console.log("Adding implementations: ", tx.hash);
28+
29+
await tx.wait();
30+
31+
console.log("Done.");
32+
}
33+
34+
main()
35+
.then(() => process.exit(0))
36+
.catch((e) => {
37+
console.error(e)
38+
process.exit(1)
39+
})

scripts/deploy/dropERC1155.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ async function main() {
2727

2828
await dropERC1155.deployTransaction.wait();
2929

30-
console.log("\n")
31-
32-
const addImplementationTx = await twFactory.addImplementation(dropERC1155.address)
33-
console.log("Adding DropERC1155 implementation to TWFactory: ", addImplementationTx.hash);
34-
await addImplementationTx.wait();
35-
3630
console.log("\n")
3731

3832
console.log("Verifying contract.")

scripts/deploy/dropERC20.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ async function main() {
2525

2626
console.log("Deploying DropERC20 \ntransaction: ", dropERC20.deployTransaction.hash, "\naddress: ", dropERC20.address);
2727

28-
console.log("\n")
29-
30-
const addImplementationTx = await twFactory.addImplementation(dropERC20.address)
31-
console.log("Adding DropERC20 implementation to TWFactory: ", addImplementationTx.hash);
32-
await addImplementationTx.wait();
28+
await dropERC20.deployTransaction.wait();
3329

3430
console.log("\n")
3531

scripts/deploy/dropERC721.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ async function main() {
2727

2828
await dropERC721.deployTransaction.wait();
2929

30-
console.log("\n")
31-
32-
const addImplementationTx = await twFactory.addImplementation(dropERC721.address)
33-
console.log("Adding DropERC721 implementation to TWFactory: ", addImplementationTx.hash);
34-
await addImplementationTx.wait();
35-
3630
console.log("\n")
3731

3832
console.log("Verifying contract.")

scripts/transferBalance.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ async function main() {
1010
console.log(`\nTransferring balance from ${caller.address} to ${receiver}`);
1111

1212
const balance = await ethers.provider.getBalance(caller.address);
13-
const cost = ethers.utils.parseUnits("300", "gwei").mul(21_000);
13+
const gasPrice = ethers.utils.parseUnits("0", "gwei"); // replace
14+
const cost = gasPrice.mul(21_000);
1415

1516
const tx = await caller.sendTransaction({
1617
to: receiver,
17-
gasPrice: ethers.utils.parseUnits("300", "gwei"),
18+
gasPrice: gasPrice,
1819
value: balance.sub(cost)
1920
});
2021
console.log("Transferring balance: ", tx.hash);

0 commit comments

Comments
 (0)