@@ -5,19 +5,24 @@ const fs = require('fs');
55async function main ( ) {
66 const output = {
77 walletImplementation : '' ,
8- walletFactory : ''
8+ walletFactory : '' ,
9+ forwarderImplementation : '' ,
10+ forwarderFactory : ''
911 } ;
1012
1113 const feeData = await ethers . provider . getFeeData ( ) ;
14+
15+ const [ walletDeployer , forwarderDeployer ] = await ethers . getSigners ( ) ;
16+
1217 const gasParams = {
13- gasPrice : feeData . gasPrice !
18+ gasPrice : feeData . gasPrice ! . mul ( '2' )
1419 } ;
15- const [ deployer ] = await ethers . getSigners ( ) ;
16- const selfTransactions = 2 ;
1720
18- for ( let i = 0 ; i < selfTransactions ; i ++ ) {
19- const tx = await deployer . sendTransaction ( {
20- to : deployer . address ,
21+ console . log ( 'Deploying wallet contracts....' ) ;
22+ const walletSelfTransactions = 2 ;
23+ for ( let i = 0 ; i < walletSelfTransactions ; i ++ ) {
24+ const tx = await walletDeployer . sendTransaction ( {
25+ to : walletDeployer . address ,
2126 value : ethers . utils . parseEther ( '0' ) ,
2227 gasPrice : gasParams . gasPrice
2328 } ) ;
@@ -29,7 +34,8 @@ async function main() {
2934 const walletFactoryContractName = 'WalletFactory' ;
3035
3136 const WalletImplementation = await ethers . getContractFactory (
32- walletImplementationContractName
37+ walletImplementationContractName ,
38+ walletDeployer
3339 ) ;
3440 const walletImplementation = await WalletImplementation . deploy ( gasParams ) ;
3541 await walletImplementation . deployed ( ) ;
@@ -40,7 +46,8 @@ async function main() {
4046 ) ;
4147
4248 const WalletFactory = await ethers . getContractFactory (
43- walletFactoryContractName
49+ walletFactoryContractName ,
50+ walletDeployer
4451 ) ;
4552 const walletFactory = await WalletFactory . deploy (
4653 walletImplementation . address ,
@@ -52,6 +59,54 @@ async function main() {
5259 `${ walletFactoryContractName } deployed at ` + walletFactory . address
5360 ) ;
5461
62+ const forwarderSelfTransactions = 234 ;
63+ console . log ( 'Deploying forwarder contracts....' ) ;
64+
65+ for ( let i = 0 ; i < forwarderSelfTransactions ; i ++ ) {
66+ const tx = await forwarderDeployer . sendTransaction ( {
67+ to : forwarderDeployer . address ,
68+ value : ethers . utils . parseEther ( '0' ) ,
69+ gasPrice : gasParams . gasPrice
70+ } ) ;
71+ await tx . wait ( ) ;
72+ console . log ( `Self transaction with nonce: ${ i } complete` ) ;
73+ }
74+
75+ const forwarderImplementationContractName = 'Forwarder' ;
76+ const forwarderFactoryContractName = 'ForwarderFactory' ;
77+
78+ const ForwarderImplementation = await ethers . getContractFactory (
79+ forwarderImplementationContractName ,
80+ forwarderDeployer
81+ ) ;
82+
83+ const forwarderImplementation = await ForwarderImplementation . deploy (
84+ gasParams
85+ ) ;
86+ await forwarderImplementation . deployed ( ) ;
87+ output . forwarderImplementation = forwarderImplementation . address ;
88+
89+ console . log (
90+ `${ forwarderImplementationContractName } deployed at ` +
91+ forwarderImplementation . address ,
92+ forwarderDeployer
93+ ) ;
94+
95+ const ForwarderFactory = await ethers . getContractFactory (
96+ forwarderFactoryContractName
97+ ) ;
98+
99+ const forwarderFactory = await ForwarderFactory . deploy (
100+ forwarderImplementation . address ,
101+ gasParams
102+ ) ;
103+
104+ await forwarderFactory . deployed ( ) ;
105+ output . forwarderFactory = forwarderFactory . address ;
106+ console . log (
107+ `${ forwarderFactoryContractName } deployed at ` + forwarderFactory . address
108+ ) ;
109+
55110 fs . writeFileSync ( 'output.json' , JSON . stringify ( output ) ) ;
56111
57112 // Wait 5 minutes. It takes some time for the etherscan backend to index the transaction and store the contract.
@@ -62,6 +117,8 @@ async function main() {
62117
63118 await walletImplementation . deployTransaction . wait ( 10 ) ;
64119 await walletFactory . deployTransaction . wait ( 10 ) ;
120+ await forwarderImplementation . deployTransaction . wait ( 10 ) ;
121+ await forwarderFactory . deployTransaction . wait ( 10 ) ;
65122
66123 console . log ( 'Done waiting, verifying' ) ;
67124 await verifyContract (
@@ -73,6 +130,16 @@ async function main() {
73130 walletImplementation . address
74131 ] ) ;
75132
133+ await verifyContract (
134+ forwarderImplementationContractName ,
135+ forwarderImplementation . address ,
136+ [ ]
137+ ) ;
138+
139+ await verifyContract ( 'ForwarderFactory' , forwarderFactory . address , [
140+ forwarderImplementation . address
141+ ] ) ;
142+
76143 console . log ( 'Contracts verified' ) ;
77144}
78145
0 commit comments