Skip to content

Commit 8999d16

Browse files
Merge pull request #151 from BitGo/COIN-114-deploy-v1-wallet-factory-contracts
fix(deploy): make use of current nonce to deploy contracts
2 parents 58eda4f + 2771369 commit 8999d16

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

scripts/deployV1FactoryContracts.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ async function main() {
1717
const gasParams = {
1818
gasPrice: feeData.gasPrice!.mul('2')
1919
};
20+
const walletTxCount = await walletDeployer.getTransactionCount();
2021

2122
console.log('Deploying wallet contracts....');
22-
const walletSelfTransactions = 2;
23+
console.log('Wallet Tx Count: ', walletTxCount);
24+
const walletSelfTransactions = 2 - walletTxCount;
2325
for (let i = 0; i < walletSelfTransactions; i++) {
2426
const tx = await walletDeployer.sendTransaction({
2527
to: walletDeployer.address,
@@ -59,8 +61,11 @@ async function main() {
5961
`${walletFactoryContractName} deployed at ` + walletFactory.address
6062
);
6163

62-
const forwarderSelfTransactions = 234;
64+
const forwarderTxCount = await forwarderDeployer.getTransactionCount();
65+
6366
console.log('Deploying forwarder contracts....');
67+
console.log('Forwarder Tx Count: ', forwarderTxCount);
68+
const forwarderSelfTransactions = 234 - forwarderTxCount;
6469

6570
for (let i = 0; i < forwarderSelfTransactions; i++) {
6671
const tx = await forwarderDeployer.sendTransaction({
@@ -88,12 +93,12 @@ async function main() {
8893

8994
console.log(
9095
`${forwarderImplementationContractName} deployed at ` +
91-
forwarderImplementation.address,
92-
forwarderDeployer
96+
forwarderImplementation.address
9397
);
9498

9599
const ForwarderFactory = await ethers.getContractFactory(
96-
forwarderFactoryContractName
100+
forwarderFactoryContractName,
101+
forwarderDeployer
97102
);
98103

99104
const forwarderFactory = await ForwarderFactory.deploy(

0 commit comments

Comments
 (0)