@@ -7,53 +7,61 @@ import BN = require("bn.js");
77import { signCreateWallet } from "./helper/signatureUtils" ;
88
99export async function newWalletImpl ( ) {
10- const ERC1271Lib = await ( await ethers . getContractFactory (
11- "ERC1271Lib"
12- ) ) . deploy ( ) ;
10+ const ERC1271Lib = await (
11+ await ethers . getContractFactory ( "ERC1271Lib" )
12+ ) . deploy ( ) ;
1313 const ERC20Lib = await ( await ethers . getContractFactory ( "ERC20Lib" ) ) . deploy ( ) ;
14- const GuardianLib = await ( await ethers . getContractFactory (
15- "GuardianLib"
16- ) ) . deploy ( ) ;
17- const InheritanceLib = await ( await ethers . getContractFactory (
18- "InheritanceLib"
19- ) ) . deploy ( ) ;
20- const LockLib = await ( await ethers . getContractFactory ( "LockLib" , {
21- libraries : {
22- GuardianLib : GuardianLib . address
23- }
24- } ) ) . deploy ( ) ;
25- const MetaTxLib = await ( await ethers . getContractFactory ( "MetaTxLib" , {
26- libraries : {
27- ERC20Lib : ERC20Lib . address
28- }
29- } ) ) . deploy ( ) ;
14+ const GuardianLib = await (
15+ await ethers . getContractFactory ( "GuardianLib" )
16+ ) . deploy ( ) ;
17+ const InheritanceLib = await (
18+ await ethers . getContractFactory ( "InheritanceLib" )
19+ ) . deploy ( ) ;
20+ const LockLib = await (
21+ await ethers . getContractFactory ( "LockLib" , {
22+ libraries : {
23+ GuardianLib : GuardianLib . address
24+ }
25+ } )
26+ ) . deploy ( ) ;
27+ const MetaTxLib = await (
28+ await ethers . getContractFactory ( "MetaTxLib" , {
29+ libraries : {
30+ ERC20Lib : ERC20Lib . address
31+ }
32+ } )
33+ ) . deploy ( ) ;
3034 const QuotaLib = await ( await ethers . getContractFactory ( "QuotaLib" ) ) . deploy ( ) ;
31- const RecoverLib = await ( await ethers . getContractFactory ( "RecoverLib" , {
32- libraries : {
33- GuardianLib : GuardianLib . address
34- }
35- } ) ) . deploy ( ) ;
36- const UpgradeLib = await ( await ethers . getContractFactory (
37- "UpgradeLib"
38- ) ) . deploy ( ) ;
39- const WhitelistLib = await ( await ethers . getContractFactory (
40- "WhitelistLib"
41- ) ) . deploy ( ) ;
35+ const RecoverLib = await (
36+ await ethers . getContractFactory ( "RecoverLib" , {
37+ libraries : {
38+ GuardianLib : GuardianLib . address
39+ }
40+ } )
41+ ) . deploy ( ) ;
42+ const UpgradeLib = await (
43+ await ethers . getContractFactory ( "UpgradeLib" )
44+ ) . deploy ( ) ;
45+ const WhitelistLib = await (
46+ await ethers . getContractFactory ( "WhitelistLib" )
47+ ) . deploy ( ) ;
4248
43- const smartWallet = await ( await ethers . getContractFactory ( "SmartWallet" , {
44- libraries : {
45- ERC1271Lib : ERC1271Lib . address ,
46- ERC20Lib : ERC20Lib . address ,
47- GuardianLib : GuardianLib . address ,
48- InheritanceLib : InheritanceLib . address ,
49- LockLib : LockLib . address ,
50- MetaTxLib : MetaTxLib . address ,
51- QuotaLib : QuotaLib . address ,
52- RecoverLib : RecoverLib . address ,
53- UpgradeLib : UpgradeLib . address ,
54- WhitelistLib : WhitelistLib . address
55- }
56- } ) ) . deploy ( ethers . constants . AddressZero ) ;
49+ const smartWallet = await (
50+ await ethers . getContractFactory ( "SmartWallet" , {
51+ libraries : {
52+ ERC1271Lib : ERC1271Lib . address ,
53+ ERC20Lib : ERC20Lib . address ,
54+ GuardianLib : GuardianLib . address ,
55+ InheritanceLib : InheritanceLib . address ,
56+ LockLib : LockLib . address ,
57+ MetaTxLib : MetaTxLib . address ,
58+ QuotaLib : QuotaLib . address ,
59+ RecoverLib : RecoverLib . address ,
60+ UpgradeLib : UpgradeLib . address ,
61+ WhitelistLib : WhitelistLib . address
62+ }
63+ } )
64+ ) . deploy ( ethers . constants . AddressZero ) ;
5765
5866 return smartWallet ;
5967}
@@ -63,62 +71,70 @@ export async function newWalletFactoryContract(deployer?: string) {
6371 let smartWallet : Contract ;
6472 let walletFactory : Contract ;
6573
66- testPriceOracle = await ( await ethers . getContractFactory (
67- "TestPriceOracle"
68- ) ) . deploy ( ) ;
74+ testPriceOracle = await (
75+ await ethers . getContractFactory ( "TestPriceOracle" )
76+ ) . deploy ( ) ;
6977
70- const ERC1271Lib = await ( await ethers . getContractFactory (
71- "ERC1271Lib"
72- ) ) . deploy ( ) ;
78+ const ERC1271Lib = await (
79+ await ethers . getContractFactory ( "ERC1271Lib" )
80+ ) . deploy ( ) ;
7381 const ERC20Lib = await ( await ethers . getContractFactory ( "ERC20Lib" ) ) . deploy ( ) ;
74- const GuardianLib = await ( await ethers . getContractFactory (
75- "GuardianLib"
76- ) ) . deploy ( ) ;
77- const InheritanceLib = await ( await ethers . getContractFactory (
78- "InheritanceLib"
79- ) ) . deploy ( ) ;
80- const LockLib = await ( await ethers . getContractFactory ( "LockLib" , {
81- libraries : {
82- GuardianLib : GuardianLib . address
83- }
84- } ) ) . deploy ( ) ;
85- const MetaTxLib = await ( await ethers . getContractFactory ( "MetaTxLib" , {
86- libraries : {
87- ERC20Lib : ERC20Lib . address
88- }
89- } ) ) . deploy ( ) ;
82+ const GuardianLib = await (
83+ await ethers . getContractFactory ( "GuardianLib" )
84+ ) . deploy ( ) ;
85+ const InheritanceLib = await (
86+ await ethers . getContractFactory ( "InheritanceLib" )
87+ ) . deploy ( ) ;
88+ const LockLib = await (
89+ await ethers . getContractFactory ( "LockLib" , {
90+ libraries : {
91+ GuardianLib : GuardianLib . address
92+ }
93+ } )
94+ ) . deploy ( ) ;
95+ const MetaTxLib = await (
96+ await ethers . getContractFactory ( "MetaTxLib" , {
97+ libraries : {
98+ ERC20Lib : ERC20Lib . address
99+ }
100+ } )
101+ ) . deploy ( ) ;
90102 const QuotaLib = await ( await ethers . getContractFactory ( "QuotaLib" ) ) . deploy ( ) ;
91- const RecoverLib = await ( await ethers . getContractFactory ( "RecoverLib" , {
92- libraries : {
93- GuardianLib : GuardianLib . address
94- }
95- } ) ) . deploy ( ) ;
96- const UpgradeLib = await ( await ethers . getContractFactory (
97- "UpgradeLib"
98- ) ) . deploy ( ) ;
99- const WhitelistLib = await ( await ethers . getContractFactory (
100- "WhitelistLib"
101- ) ) . deploy ( ) ;
103+ const RecoverLib = await (
104+ await ethers . getContractFactory ( "RecoverLib" , {
105+ libraries : {
106+ GuardianLib : GuardianLib . address
107+ }
108+ } )
109+ ) . deploy ( ) ;
110+ const UpgradeLib = await (
111+ await ethers . getContractFactory ( "UpgradeLib" )
112+ ) . deploy ( ) ;
113+ const WhitelistLib = await (
114+ await ethers . getContractFactory ( "WhitelistLib" )
115+ ) . deploy ( ) ;
102116
103- smartWallet = await ( await ethers . getContractFactory ( "SmartWallet" , {
104- libraries : {
105- ERC1271Lib : ERC1271Lib . address ,
106- ERC20Lib : ERC20Lib . address ,
107- GuardianLib : GuardianLib . address ,
108- InheritanceLib : InheritanceLib . address ,
109- LockLib : LockLib . address ,
110- MetaTxLib : MetaTxLib . address ,
111- QuotaLib : QuotaLib . address ,
112- RecoverLib : RecoverLib . address ,
113- UpgradeLib : UpgradeLib . address ,
114- WhitelistLib : WhitelistLib . address
115- }
116- } ) ) . deploy ( ethers . constants . AddressZero /*testPriceOracle.address*/ ) ;
117+ smartWallet = await (
118+ await ethers . getContractFactory ( "SmartWallet" , {
119+ libraries : {
120+ ERC1271Lib : ERC1271Lib . address ,
121+ ERC20Lib : ERC20Lib . address ,
122+ GuardianLib : GuardianLib . address ,
123+ InheritanceLib : InheritanceLib . address ,
124+ LockLib : LockLib . address ,
125+ MetaTxLib : MetaTxLib . address ,
126+ QuotaLib : QuotaLib . address ,
127+ RecoverLib : RecoverLib . address ,
128+ UpgradeLib : UpgradeLib . address ,
129+ WhitelistLib : WhitelistLib . address
130+ }
131+ } )
132+ ) . deploy ( ethers . constants . AddressZero /*testPriceOracle.address*/ ) ;
117133 console . log ( "smartWallet address:" , smartWallet . address ) ;
118134
119- walletFactory = await ( await ethers . getContractFactory (
120- "WalletFactory"
121- ) ) . deploy ( smartWallet . address ) ;
135+ walletFactory = await (
136+ await ethers . getContractFactory ( "WalletFactory" )
137+ ) . deploy ( smartWallet . address ) ;
122138
123139 await walletFactory . deployed ( ) ;
124140
@@ -171,29 +187,28 @@ export async function newWallet(
171187 // const allEvents = await getAllEvent(walletFactory, tx.blockNumber);
172188 // console.log(allEvents);
173189
174- const smartWallet = await ( await ethers . getContractFactory ( "SmartWallet" , {
175- libraries : {
176- ERC1271Lib : ethers . constants . AddressZero ,
177- ERC20Lib : ethers . constants . AddressZero ,
178- GuardianLib : ethers . constants . AddressZero ,
179- InheritanceLib : ethers . constants . AddressZero ,
180- LockLib : ethers . constants . AddressZero ,
181- MetaTxLib : ethers . constants . AddressZero ,
182- QuotaLib : ethers . constants . AddressZero ,
183- RecoverLib : ethers . constants . AddressZero ,
184- UpgradeLib : ethers . constants . AddressZero ,
185- WhitelistLib : ethers . constants . AddressZero
186- }
187- } ) ) . attach ( walletAddrComputed ) ;
190+ const smartWallet = await (
191+ await ethers . getContractFactory ( "SmartWallet" , {
192+ libraries : {
193+ ERC1271Lib : ethers . constants . AddressZero ,
194+ ERC20Lib : ethers . constants . AddressZero ,
195+ GuardianLib : ethers . constants . AddressZero ,
196+ InheritanceLib : ethers . constants . AddressZero ,
197+ LockLib : ethers . constants . AddressZero ,
198+ MetaTxLib : ethers . constants . AddressZero ,
199+ QuotaLib : ethers . constants . AddressZero ,
200+ RecoverLib : ethers . constants . AddressZero ,
201+ UpgradeLib : ethers . constants . AddressZero ,
202+ WhitelistLib : ethers . constants . AddressZero
203+ }
204+ } )
205+ ) . attach ( walletAddrComputed ) ;
188206
189207 // console.log("SmartWallet:", smartWallet);
190208 return smartWallet ;
191209}
192210
193- export async function getAllEvent (
194- contract : any ,
195- fromBlock : number
196- ) {
211+ export async function getAllEvent ( contract : any , fromBlock : number ) {
197212 const events = await contract . queryFilter (
198213 { address : contract . address } ,
199214 fromBlock
@@ -250,9 +265,12 @@ export async function getContractABI(contractName: string) {
250265 } ) ;
251266}
252267
253- export function sortSignersAndSignatures ( signers : string [ ] , signatures : Buffer [ ] ) {
268+ export function sortSignersAndSignatures (
269+ signers : string [ ] ,
270+ signatures : Buffer [ ]
271+ ) {
254272 const sigMap = new Map ( ) ;
255- signers . forEach ( function ( signer , i ) {
273+ signers . forEach ( function ( signer , i ) {
256274 sigMap . set ( signer , signatures [ i ] ) ;
257275 } ) ;
258276
0 commit comments