@diamondslab/diamonds 1.0.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schemas/DeploymentSchema.d.ts +34 -248
- package/dist/schemas/DeploymentSchema.d.ts.map +1 -1
- package/package.json +4 -8
- package/docs/DIAMOND_ABI_CONFIGURATION_SUMMARY.md +0 -40
- package/docs/DIAMOND_ABI_GENERATION.md +0 -220
- package/docs/DIAMOND_ABI_GENERATOR_EXAMPLES.md +0 -1204
- package/docs/DIAMOND_ABI_GENERATOR_IMPLEMENTATION.md +0 -947
- package/docs/DIAMOND_ABI_GENERATOR_QUICK_REFERENCE.md +0 -336
- package/docs/README-DEFENDER.md +0 -394
- package/docs/README_DIAMOND_ABI_GENERATOR.md +0 -303
- package/docs/ROADMAP.md +0 -250
- package/docs/assets/image.png +0 -0
- package/docs/defender-integration.md +0 -451
- package/docs/diamond_module-BaseStrategy_design-v2.uxf +0 -247
- package/docs/diamond_module-BaseStrategy_design.uxf +0 -272
- package/docs/monitoring-troubleshooting.md +0 -556
- package/docs/testing-guide.md +0 -713
- package/examples/Diamond_Config_and_Deployment_examples/diamonds/ProxyDiamond/callbacks/ERC20ProxyFacet.ts +0 -31
- package/examples/Diamond_Config_and_Deployment_examples/diamonds/ProxyDiamond/proxydiamond.config.json +0 -27
- package/examples/Local_Hardhat_Deployer_Script_example/LocalDiamondDeployer.ts +0 -180
- package/examples/OZ_Defender_Deployer_Script_example/OZDiamondDeployer.ts +0 -107
- package/examples/OZ_Defender_Deployer_Script_example/run-oz-deploy.ts +0 -17
- package/examples/Test_examples/ProxyDiamondDeployment.test.ts +0 -202
- package/examples/defender-deployment/.env.example +0 -35
- package/examples/defender-deployment/contracts/ExampleDiamond.sol +0 -41
- package/examples/defender-deployment/contracts/ExampleFacet1.sol +0 -84
- package/examples/defender-deployment/contracts/ExampleFacet2.sol +0 -104
- package/examples/defender-deployment/contracts/UpgradeFacet.sol +0 -92
- package/examples/defender-deployment/deploy-script.ts +0 -170
- package/examples/defender-deployment/diamond-config.json +0 -36
- package/examples/defender-deployment/upgrade-script.ts +0 -237
- package/examples/hardhat-diamonds-config.example.ts +0 -41
- package/src/core/CallbackManager.ts +0 -70
- package/src/core/DeploymentManager.ts +0 -64
- package/src/core/Diamond.ts +0 -197
- package/src/core/DiamondDeployer.ts +0 -36
- package/src/core/index.ts +0 -4
- package/src/index.ts +0 -5
- package/src/repositories/DBDeploymentRepository.ts +0 -22
- package/src/repositories/DeploymentRepository.ts +0 -12
- package/src/repositories/FileDeploymentRepository.ts +0 -67
- package/src/repositories/databaseHandler.ts +0 -14
- package/src/repositories/index.ts +0 -4
- package/src/repositories/jsonFileHandler.ts +0 -252
- package/src/repositories/prismaDBHandler.ts +0 -10
- package/src/schemas/DeploymentSchema.ts +0 -71
- package/src/schemas/index.ts +0 -1
- package/src/strategies/BaseDeploymentStrategy.ts +0 -649
- package/src/strategies/DeploymentStrategy.ts +0 -25
- package/src/strategies/LocalDeploymentStrategy.ts +0 -5
- package/src/strategies/OZDefenderDeploymentStrategy.ts +0 -849
- package/src/strategies/RPCDeploymentStrategy.ts +0 -881
- package/src/strategies/index.ts +0 -5
- package/src/types/config.ts +0 -34
- package/src/types/defender.ts +0 -24
- package/src/types/deployments.ts +0 -102
- package/src/types/index.ts +0 -4
- package/src/types/rpc.ts +0 -37
- package/src/utils/common.ts +0 -54
- package/src/utils/configurationResolver.ts +0 -141
- package/src/utils/contractMapping.ts +0 -220
- package/src/utils/defenderClients.ts +0 -22
- package/src/utils/defenderStore.ts +0 -62
- package/src/utils/diamondAbiGenerator.ts +0 -523
- package/src/utils/diffDeployedFacets.ts +0 -131
- package/src/utils/index.ts +0 -15
- package/src/utils/loupe.ts +0 -159
- package/src/utils/rpcStore.ts +0 -152
- package/src/utils/signer.ts +0 -93
- package/src/utils/txlogging.ts +0 -97
- package/src/utils/workspaceSetup.ts +0 -315
|
@@ -3,40 +3,16 @@ export declare const DeployedFacetSchema: z.ZodObject<{
|
|
|
3
3
|
address: z.ZodOptional<z.ZodString>;
|
|
4
4
|
tx_hash: z.ZodOptional<z.ZodString>;
|
|
5
5
|
version: z.ZodOptional<z.ZodNumber>;
|
|
6
|
-
funcSelectors: z.ZodOptional<z.ZodArray<z.ZodString
|
|
6
|
+
funcSelectors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
7
|
verified: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
-
},
|
|
9
|
-
address?: string | undefined;
|
|
10
|
-
tx_hash?: string | undefined;
|
|
11
|
-
version?: number | undefined;
|
|
12
|
-
funcSelectors?: string[] | undefined;
|
|
13
|
-
verified?: boolean | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
address?: string | undefined;
|
|
16
|
-
tx_hash?: string | undefined;
|
|
17
|
-
version?: number | undefined;
|
|
18
|
-
funcSelectors?: string[] | undefined;
|
|
19
|
-
verified?: boolean | undefined;
|
|
20
|
-
}>;
|
|
8
|
+
}, z.core.$strip>;
|
|
21
9
|
export declare const DeployedFacetsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
22
10
|
address: z.ZodOptional<z.ZodString>;
|
|
23
11
|
tx_hash: z.ZodOptional<z.ZodString>;
|
|
24
12
|
version: z.ZodOptional<z.ZodNumber>;
|
|
25
|
-
funcSelectors: z.ZodOptional<z.ZodArray<z.ZodString
|
|
13
|
+
funcSelectors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
14
|
verified: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
-
},
|
|
28
|
-
address?: string | undefined;
|
|
29
|
-
tx_hash?: string | undefined;
|
|
30
|
-
version?: number | undefined;
|
|
31
|
-
funcSelectors?: string[] | undefined;
|
|
32
|
-
verified?: boolean | undefined;
|
|
33
|
-
}, {
|
|
34
|
-
address?: string | undefined;
|
|
35
|
-
tx_hash?: string | undefined;
|
|
36
|
-
version?: number | undefined;
|
|
37
|
-
funcSelectors?: string[] | undefined;
|
|
38
|
-
verified?: boolean | undefined;
|
|
39
|
-
}>>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
40
16
|
export declare const ExternalLibrariesSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
41
17
|
export declare const DeployedDiamondDataSchema: z.ZodObject<{
|
|
42
18
|
DiamondAddress: z.ZodOptional<z.ZodString>;
|
|
@@ -45,260 +21,70 @@ export declare const DeployedDiamondDataSchema: z.ZodObject<{
|
|
|
45
21
|
address: z.ZodOptional<z.ZodString>;
|
|
46
22
|
tx_hash: z.ZodOptional<z.ZodString>;
|
|
47
23
|
version: z.ZodOptional<z.ZodNumber>;
|
|
48
|
-
funcSelectors: z.ZodOptional<z.ZodArray<z.ZodString
|
|
24
|
+
funcSelectors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
25
|
verified: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
-
},
|
|
51
|
-
address?: string | undefined;
|
|
52
|
-
tx_hash?: string | undefined;
|
|
53
|
-
version?: number | undefined;
|
|
54
|
-
funcSelectors?: string[] | undefined;
|
|
55
|
-
verified?: boolean | undefined;
|
|
56
|
-
}, {
|
|
57
|
-
address?: string | undefined;
|
|
58
|
-
tx_hash?: string | undefined;
|
|
59
|
-
version?: number | undefined;
|
|
60
|
-
funcSelectors?: string[] | undefined;
|
|
61
|
-
verified?: boolean | undefined;
|
|
62
|
-
}>>>;
|
|
26
|
+
}, z.core.$strip>>>;
|
|
63
27
|
ExternalLibraries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
64
28
|
protocolVersion: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
},
|
|
66
|
-
DiamondAddress?: string | undefined;
|
|
67
|
-
DeployerAddress?: string | undefined;
|
|
68
|
-
DeployedFacets?: Record<string, {
|
|
69
|
-
address?: string | undefined;
|
|
70
|
-
tx_hash?: string | undefined;
|
|
71
|
-
version?: number | undefined;
|
|
72
|
-
funcSelectors?: string[] | undefined;
|
|
73
|
-
verified?: boolean | undefined;
|
|
74
|
-
}> | undefined;
|
|
75
|
-
ExternalLibraries?: Record<string, string> | undefined;
|
|
76
|
-
protocolVersion?: number | undefined;
|
|
77
|
-
}, {
|
|
78
|
-
DiamondAddress?: string | undefined;
|
|
79
|
-
DeployerAddress?: string | undefined;
|
|
80
|
-
DeployedFacets?: Record<string, {
|
|
81
|
-
address?: string | undefined;
|
|
82
|
-
tx_hash?: string | undefined;
|
|
83
|
-
version?: number | undefined;
|
|
84
|
-
funcSelectors?: string[] | undefined;
|
|
85
|
-
verified?: boolean | undefined;
|
|
86
|
-
}> | undefined;
|
|
87
|
-
ExternalLibraries?: Record<string, string> | undefined;
|
|
88
|
-
protocolVersion?: number | undefined;
|
|
89
|
-
}>;
|
|
29
|
+
}, z.core.$strip>;
|
|
90
30
|
/**
|
|
91
31
|
* Schema for the version information of a facet configuration to be deployed
|
|
92
32
|
*/
|
|
93
33
|
export declare const FacetVersionConfigSchema: z.ZodObject<{
|
|
94
34
|
deployInit: z.ZodOptional<z.ZodString>;
|
|
95
35
|
upgradeInit: z.ZodOptional<z.ZodString>;
|
|
96
|
-
fromVersions: z.ZodOptional<z.ZodArray<z.ZodNumber
|
|
97
|
-
callbacks: z.ZodOptional<z.ZodArray<z.ZodString
|
|
98
|
-
deployInclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
99
|
-
deployExclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
100
|
-
},
|
|
101
|
-
deployInit?: string | undefined;
|
|
102
|
-
upgradeInit?: string | undefined;
|
|
103
|
-
fromVersions?: number[] | undefined;
|
|
104
|
-
callbacks?: string[] | undefined;
|
|
105
|
-
deployInclude?: string[] | undefined;
|
|
106
|
-
deployExclude?: string[] | undefined;
|
|
107
|
-
}, {
|
|
108
|
-
deployInit?: string | undefined;
|
|
109
|
-
upgradeInit?: string | undefined;
|
|
110
|
-
fromVersions?: number[] | undefined;
|
|
111
|
-
callbacks?: string[] | undefined;
|
|
112
|
-
deployInclude?: string[] | undefined;
|
|
113
|
-
deployExclude?: string[] | undefined;
|
|
114
|
-
}>;
|
|
36
|
+
fromVersions: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
37
|
+
callbacks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
38
|
+
deployInclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
|
+
deployExclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
115
41
|
/**
|
|
116
42
|
* Schema for the deployment information of a single facet
|
|
117
43
|
*/
|
|
118
44
|
export declare const FacetConfigSchema: z.ZodObject<{
|
|
119
45
|
priority: z.ZodNumber;
|
|
120
|
-
libraries: z.ZodOptional<z.ZodArray<z.ZodString
|
|
46
|
+
libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
121
47
|
versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
122
48
|
deployInit: z.ZodOptional<z.ZodString>;
|
|
123
49
|
upgradeInit: z.ZodOptional<z.ZodString>;
|
|
124
|
-
fromVersions: z.ZodOptional<z.ZodArray<z.ZodNumber
|
|
125
|
-
callbacks: z.ZodOptional<z.ZodArray<z.ZodString
|
|
126
|
-
deployInclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
127
|
-
deployExclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
upgradeInit?: string | undefined;
|
|
131
|
-
fromVersions?: number[] | undefined;
|
|
132
|
-
callbacks?: string[] | undefined;
|
|
133
|
-
deployInclude?: string[] | undefined;
|
|
134
|
-
deployExclude?: string[] | undefined;
|
|
135
|
-
}, {
|
|
136
|
-
deployInit?: string | undefined;
|
|
137
|
-
upgradeInit?: string | undefined;
|
|
138
|
-
fromVersions?: number[] | undefined;
|
|
139
|
-
callbacks?: string[] | undefined;
|
|
140
|
-
deployInclude?: string[] | undefined;
|
|
141
|
-
deployExclude?: string[] | undefined;
|
|
142
|
-
}>>>;
|
|
143
|
-
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
priority: number;
|
|
145
|
-
libraries?: string[] | undefined;
|
|
146
|
-
versions?: Record<string, {
|
|
147
|
-
deployInit?: string | undefined;
|
|
148
|
-
upgradeInit?: string | undefined;
|
|
149
|
-
fromVersions?: number[] | undefined;
|
|
150
|
-
callbacks?: string[] | undefined;
|
|
151
|
-
deployInclude?: string[] | undefined;
|
|
152
|
-
deployExclude?: string[] | undefined;
|
|
153
|
-
}> | undefined;
|
|
154
|
-
}, {
|
|
155
|
-
priority: number;
|
|
156
|
-
libraries?: string[] | undefined;
|
|
157
|
-
versions?: Record<string, {
|
|
158
|
-
deployInit?: string | undefined;
|
|
159
|
-
upgradeInit?: string | undefined;
|
|
160
|
-
fromVersions?: number[] | undefined;
|
|
161
|
-
callbacks?: string[] | undefined;
|
|
162
|
-
deployInclude?: string[] | undefined;
|
|
163
|
-
deployExclude?: string[] | undefined;
|
|
164
|
-
}> | undefined;
|
|
165
|
-
}>;
|
|
50
|
+
fromVersions: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
51
|
+
callbacks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
deployInclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
deployExclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
54
|
+
}, z.core.$strip>>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
166
56
|
/**
|
|
167
57
|
* Schema for the deployment configuration information of ALL facets to be deployed
|
|
168
58
|
*/
|
|
169
59
|
export declare const FacetsConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
170
60
|
priority: z.ZodNumber;
|
|
171
|
-
libraries: z.ZodOptional<z.ZodArray<z.ZodString
|
|
61
|
+
libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
172
62
|
versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
173
63
|
deployInit: z.ZodOptional<z.ZodString>;
|
|
174
64
|
upgradeInit: z.ZodOptional<z.ZodString>;
|
|
175
|
-
fromVersions: z.ZodOptional<z.ZodArray<z.ZodNumber
|
|
176
|
-
callbacks: z.ZodOptional<z.ZodArray<z.ZodString
|
|
177
|
-
deployInclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
178
|
-
deployExclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
upgradeInit?: string | undefined;
|
|
182
|
-
fromVersions?: number[] | undefined;
|
|
183
|
-
callbacks?: string[] | undefined;
|
|
184
|
-
deployInclude?: string[] | undefined;
|
|
185
|
-
deployExclude?: string[] | undefined;
|
|
186
|
-
}, {
|
|
187
|
-
deployInit?: string | undefined;
|
|
188
|
-
upgradeInit?: string | undefined;
|
|
189
|
-
fromVersions?: number[] | undefined;
|
|
190
|
-
callbacks?: string[] | undefined;
|
|
191
|
-
deployInclude?: string[] | undefined;
|
|
192
|
-
deployExclude?: string[] | undefined;
|
|
193
|
-
}>>>;
|
|
194
|
-
}, "strip", z.ZodTypeAny, {
|
|
195
|
-
priority: number;
|
|
196
|
-
libraries?: string[] | undefined;
|
|
197
|
-
versions?: Record<string, {
|
|
198
|
-
deployInit?: string | undefined;
|
|
199
|
-
upgradeInit?: string | undefined;
|
|
200
|
-
fromVersions?: number[] | undefined;
|
|
201
|
-
callbacks?: string[] | undefined;
|
|
202
|
-
deployInclude?: string[] | undefined;
|
|
203
|
-
deployExclude?: string[] | undefined;
|
|
204
|
-
}> | undefined;
|
|
205
|
-
}, {
|
|
206
|
-
priority: number;
|
|
207
|
-
libraries?: string[] | undefined;
|
|
208
|
-
versions?: Record<string, {
|
|
209
|
-
deployInit?: string | undefined;
|
|
210
|
-
upgradeInit?: string | undefined;
|
|
211
|
-
fromVersions?: number[] | undefined;
|
|
212
|
-
callbacks?: string[] | undefined;
|
|
213
|
-
deployInclude?: string[] | undefined;
|
|
214
|
-
deployExclude?: string[] | undefined;
|
|
215
|
-
}> | undefined;
|
|
216
|
-
}>>;
|
|
65
|
+
fromVersions: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
66
|
+
callbacks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
67
|
+
deployInclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
deployExclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
}, z.core.$strip>>>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
217
71
|
export declare const DeployConfigSchema: z.ZodObject<{
|
|
218
72
|
protocolVersion: z.ZodNumber;
|
|
219
73
|
protocolInitFacet: z.ZodOptional<z.ZodString>;
|
|
220
74
|
protocolCallback: z.ZodOptional<z.ZodString>;
|
|
221
75
|
facets: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
222
76
|
priority: z.ZodNumber;
|
|
223
|
-
libraries: z.ZodOptional<z.ZodArray<z.ZodString
|
|
77
|
+
libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
224
78
|
versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
225
79
|
deployInit: z.ZodOptional<z.ZodString>;
|
|
226
80
|
upgradeInit: z.ZodOptional<z.ZodString>;
|
|
227
|
-
fromVersions: z.ZodOptional<z.ZodArray<z.ZodNumber
|
|
228
|
-
callbacks: z.ZodOptional<z.ZodArray<z.ZodString
|
|
229
|
-
deployInclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
230
|
-
deployExclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
fromVersions?: number[] | undefined;
|
|
235
|
-
callbacks?: string[] | undefined;
|
|
236
|
-
deployInclude?: string[] | undefined;
|
|
237
|
-
deployExclude?: string[] | undefined;
|
|
238
|
-
}, {
|
|
239
|
-
deployInit?: string | undefined;
|
|
240
|
-
upgradeInit?: string | undefined;
|
|
241
|
-
fromVersions?: number[] | undefined;
|
|
242
|
-
callbacks?: string[] | undefined;
|
|
243
|
-
deployInclude?: string[] | undefined;
|
|
244
|
-
deployExclude?: string[] | undefined;
|
|
245
|
-
}>>>;
|
|
246
|
-
}, "strip", z.ZodTypeAny, {
|
|
247
|
-
priority: number;
|
|
248
|
-
libraries?: string[] | undefined;
|
|
249
|
-
versions?: Record<string, {
|
|
250
|
-
deployInit?: string | undefined;
|
|
251
|
-
upgradeInit?: string | undefined;
|
|
252
|
-
fromVersions?: number[] | undefined;
|
|
253
|
-
callbacks?: string[] | undefined;
|
|
254
|
-
deployInclude?: string[] | undefined;
|
|
255
|
-
deployExclude?: string[] | undefined;
|
|
256
|
-
}> | undefined;
|
|
257
|
-
}, {
|
|
258
|
-
priority: number;
|
|
259
|
-
libraries?: string[] | undefined;
|
|
260
|
-
versions?: Record<string, {
|
|
261
|
-
deployInit?: string | undefined;
|
|
262
|
-
upgradeInit?: string | undefined;
|
|
263
|
-
fromVersions?: number[] | undefined;
|
|
264
|
-
callbacks?: string[] | undefined;
|
|
265
|
-
deployInclude?: string[] | undefined;
|
|
266
|
-
deployExclude?: string[] | undefined;
|
|
267
|
-
}> | undefined;
|
|
268
|
-
}>>;
|
|
269
|
-
}, "strip", z.ZodTypeAny, {
|
|
270
|
-
protocolVersion: number;
|
|
271
|
-
facets: Record<string, {
|
|
272
|
-
priority: number;
|
|
273
|
-
libraries?: string[] | undefined;
|
|
274
|
-
versions?: Record<string, {
|
|
275
|
-
deployInit?: string | undefined;
|
|
276
|
-
upgradeInit?: string | undefined;
|
|
277
|
-
fromVersions?: number[] | undefined;
|
|
278
|
-
callbacks?: string[] | undefined;
|
|
279
|
-
deployInclude?: string[] | undefined;
|
|
280
|
-
deployExclude?: string[] | undefined;
|
|
281
|
-
}> | undefined;
|
|
282
|
-
}>;
|
|
283
|
-
protocolInitFacet?: string | undefined;
|
|
284
|
-
protocolCallback?: string | undefined;
|
|
285
|
-
}, {
|
|
286
|
-
protocolVersion: number;
|
|
287
|
-
facets: Record<string, {
|
|
288
|
-
priority: number;
|
|
289
|
-
libraries?: string[] | undefined;
|
|
290
|
-
versions?: Record<string, {
|
|
291
|
-
deployInit?: string | undefined;
|
|
292
|
-
upgradeInit?: string | undefined;
|
|
293
|
-
fromVersions?: number[] | undefined;
|
|
294
|
-
callbacks?: string[] | undefined;
|
|
295
|
-
deployInclude?: string[] | undefined;
|
|
296
|
-
deployExclude?: string[] | undefined;
|
|
297
|
-
}> | undefined;
|
|
298
|
-
}>;
|
|
299
|
-
protocolInitFacet?: string | undefined;
|
|
300
|
-
protocolCallback?: string | undefined;
|
|
301
|
-
}>;
|
|
81
|
+
fromVersions: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
82
|
+
callbacks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
deployInclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
84
|
+
deployExclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
85
|
+
}, z.core.$strip>>>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
}, z.core.$strip>;
|
|
302
88
|
export type FacetVersionConfig = z.infer<typeof FacetVersionConfigSchema>;
|
|
303
89
|
export type FacetConfig = z.infer<typeof FacetConfigSchema>;
|
|
304
90
|
export type FacetsConfig = z.infer<typeof FacetsConfigSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeploymentSchema.d.ts","sourceRoot":"","sources":["../../src/schemas/DeploymentSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"DeploymentSchema.d.ts","sourceRoot":"","sources":["../../src/schemas/DeploymentSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;;;iBAM9B,CAAC;AAGH,eAAO,MAAM,oBAAoB;;;;;;kBAA4C,CAAC;AAG9E,eAAO,MAAM,uBAAuB,uCAAmC,CAAC;AAGxE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;iBAOpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;iBAOnC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;iBAK5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;kBAA0C,CAAC;AAE1E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;iBAK7B,CAAC;AAGH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diamondslab/diamonds",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Tools for deploying and interfacing with ERC-2535 Diamond Proxies",
|
|
5
5
|
"repository": "github:diamondslab/diamonds",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"test:integration": "hardhat test test/integration/**/*.test.ts --config hardhat.config.ts",
|
|
37
37
|
"test:coverage": "hardhat coverage --config hardhat.config.ts",
|
|
38
38
|
"test:performance": "hardhat test test/integration/performance/**/*.test.ts --config hardhat.config.ts",
|
|
39
|
-
"build": "
|
|
39
|
+
"build": "npx tsc",
|
|
40
40
|
"clean": "rimraf artifacts/* cache/* diamond-abi/* typechain-types/* diamond-typechain-types/*",
|
|
41
41
|
"compile": "npx hardhat compile --config hardhat.config.ts && yarn diamond:generate-abi-typechain",
|
|
42
42
|
"clean-compile": "yarn clean && yarn compile",
|
|
@@ -124,16 +124,13 @@
|
|
|
124
124
|
},
|
|
125
125
|
"files": [
|
|
126
126
|
"dist/",
|
|
127
|
-
"src/",
|
|
128
|
-
"docs/",
|
|
129
|
-
"examples/",
|
|
130
127
|
"LICENSE",
|
|
131
|
-
"README.md"
|
|
132
|
-
"package.json"
|
|
128
|
+
"README.md"
|
|
133
129
|
],
|
|
134
130
|
"devDependencies": {
|
|
135
131
|
"@commitlint/cli": "^19.8.1",
|
|
136
132
|
"@commitlint/config-conventional": "^19.8.1",
|
|
133
|
+
"@diamondslab/hardhat-diamonds": "^1.0.0",
|
|
137
134
|
"@ethersproject/abi": "^5.8.0",
|
|
138
135
|
"@ethersproject/bytes": "^5.8.0",
|
|
139
136
|
"@ethersproject/providers": "^5.8.0",
|
|
@@ -185,7 +182,6 @@
|
|
|
185
182
|
"ethers": "^6.4.0",
|
|
186
183
|
"globals": "^15.14.0",
|
|
187
184
|
"hardhat": "^2.26.0",
|
|
188
|
-
"hardhat-diamonds": "git+https://github.com/diamondslab/hardhat-diamonds.git#develop",
|
|
189
185
|
"hardhat-gas-reporter": "^1.0.8",
|
|
190
186
|
"husky": "^9.1.7",
|
|
191
187
|
"jest": "^30.0.4",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Diamond ABI Configuration
|
|
2
|
-
|
|
3
|
-
The Diamond ABI generator is configurable with storage location and file naming. Here's what was accomplished:
|
|
4
|
-
|
|
5
|
-
✅ Configuration Features
|
|
6
|
-
Configurable Storage Path: Added diamondAbiPath to DiamondPathsConfig with default ./diamond-abi
|
|
7
|
-
Configurable File Naming: Added diamondAbiFileName to DiamondConfig with default using diamond name
|
|
8
|
-
Smart Defaults: When not specified, the filename defaults to {diamondName}.json
|
|
9
|
-
|
|
10
|
-
Diamond Class (Diamond.ts):
|
|
11
|
-
|
|
12
|
-
Added properties and getter methods for ABI path configuration
|
|
13
|
-
Implemented path resolution with sensible defaults
|
|
14
|
-
|
|
15
|
-
DiamondAbiGenerator (diamondAbiGenerator.ts):
|
|
16
|
-
|
|
17
|
-
Updated to use Diamond's configured paths instead of hardcoded values
|
|
18
|
-
Maintained backward compatibility with existing usage
|
|
19
|
-
|
|
20
|
-
Deployment Strategies:
|
|
21
|
-
|
|
22
|
-
Updated BaseDeploymentStrategy and OZDefenderDeploymentStrategy
|
|
23
|
-
Pass Diamond objects to contract mapping functions
|
|
24
|
-
Test Suite Updates:
|
|
25
|
-
|
|
26
|
-
Updated CLI tools - The diamond-abi-cli.ts now uses Diamond's configured paths instead of hardcoded defaults.
|
|
27
|
-
deployment strategies - Confirmed that BaseDeploymentStrategy and OZDefenderDeploymentStrategy use facet artifacts directly and don't need diamond ABI file loading.
|
|
28
|
-
|
|
29
|
-
Flexibility: Users can now specify custom ABI storage locations
|
|
30
|
-
Customization: Diamond ABI files can have custom names
|
|
31
|
-
Backward Compatibility: Existing code works without changes
|
|
32
|
-
Smart Defaults: Sensible defaults when configuration not provided
|
|
33
|
-
Professional Standards: Clean, maintainable code with full test coverage
|
|
34
|
-
|
|
35
|
-
Hardhat Compatibility: ✅ Tested - diamond ABI files stored safely outside artifacts directory
|
|
36
|
-
|
|
37
|
-
Default: {configFileDirectory}/diamond-abi/
|
|
38
|
-
Custom: User-configurable via diamondAbiPath config option
|
|
39
|
-
Avoids: artifacts directory to prevent hardhat compile conflicts
|
|
40
|
-
The implementation maintains full backward compatibility while providing professional-grade configuration management throughout the diamond system.
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
# Diamond ABI Generation System - Implementation Summary
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This document summarizes the comprehensive Diamond ABI generation system that has been implemented for the ERC-2535 Diamond Proxy contract management system. The system provides sophisticated ABI generation capabilities that integrate seamlessly with the existing diamond deployment infrastructure.
|
|
6
|
-
|
|
7
|
-
## Key Features Implemented
|
|
8
|
-
|
|
9
|
-
### 1. Core ABI Generation System
|
|
10
|
-
|
|
11
|
-
- **DiamondAbiGenerator Class**: Comprehensive ABI generation with configurability
|
|
12
|
-
- **Function Selector Registry Integration**: Seamless integration with existing diamond deployment system
|
|
13
|
-
- **Artifact Management**: Automatic loading and processing of contract artifacts
|
|
14
|
-
- **Metadata Enrichment**: Enhanced ABI artifacts with diamond-specific metadata
|
|
15
|
-
|
|
16
|
-
### 2. Advanced Functionality
|
|
17
|
-
|
|
18
|
-
- **Preview Mode**: Preview ABI changes before applying diamond cuts
|
|
19
|
-
- **Selective Facet Inclusion**: Configure which facets to include in generated ABI
|
|
20
|
-
- **Source Information**: Optional inclusion of source code information in ABI
|
|
21
|
-
- **Validation**: Function selector uniqueness validation
|
|
22
|
-
- **Performance Optimization**: Efficient processing of large diamond deployments
|
|
23
|
-
|
|
24
|
-
### 3. Command Line Interface
|
|
25
|
-
|
|
26
|
-
- **Professional CLI Tool**: Full-featured command-line interface for ABI operations
|
|
27
|
-
- **Multiple Commands**: Generate, preview, compare, and validate ABI files
|
|
28
|
-
- **Rich Output**: Colored output with detailed progress information
|
|
29
|
-
- **Flexible Configuration**: Support for different networks, chain IDs, and deployment paths
|
|
30
|
-
|
|
31
|
-
### 4. Integration Features
|
|
32
|
-
|
|
33
|
-
- **Deployment Repository Integration**: Works with existing FileDeploymentRepository
|
|
34
|
-
- **Strategy Pattern Support**: Compatible with Local and OpenZeppelin Defender strategies
|
|
35
|
-
- **Configuration Management**: Leverages existing DiamondConfig system
|
|
36
|
-
- **Error Handling**: Comprehensive error handling and recovery
|
|
37
|
-
|
|
38
|
-
## Files Created/Modified
|
|
39
|
-
|
|
40
|
-
### Core Implementation
|
|
41
|
-
|
|
42
|
-
- `src/utils/diamondAbiGenerator.ts` - Main ABI generation system
|
|
43
|
-
- `src/utils/index.ts` - Export configuration
|
|
44
|
-
- `src/index.ts` - Main module exports
|
|
45
|
-
|
|
46
|
-
### Scripts and Tools
|
|
47
|
-
|
|
48
|
-
- `scripts/diamond-abi-cli.ts` - Professional CLI tool
|
|
49
|
-
- `scripts/create-diamond-abi.ts` - Updated ABI generation script
|
|
50
|
-
|
|
51
|
-
### Testing Infrastructure
|
|
52
|
-
|
|
53
|
-
- `test/unit/diamondAbiGenerator.test.ts` - Comprehensive unit tests
|
|
54
|
-
- `test/integration/diamondAbiGeneration.test.ts` - End-to-end integration tests
|
|
55
|
-
|
|
56
|
-
### Configuration
|
|
57
|
-
|
|
58
|
-
- `package.json` - Updated with new scripts and CLI configuration
|
|
59
|
-
- `tsconfig.json` - Fixed for proper module compilation
|
|
60
|
-
|
|
61
|
-
## Technical Architecture
|
|
62
|
-
|
|
63
|
-
### Class Structure
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
class DiamondAbiGenerator {
|
|
67
|
-
constructor(diamond: Diamond, options?: DiamondAbiGeneratorOptions)
|
|
68
|
-
|
|
69
|
-
// Core functionality
|
|
70
|
-
generateAbi(options?: GenerateAbiOptions): Promise<DiamondAbiResult>
|
|
71
|
-
previewAbi(cuts: FacetCut[], options?: GenerateAbiOptions): Promise<DiamondAbiResult>
|
|
72
|
-
|
|
73
|
-
// Configuration
|
|
74
|
-
setFacetFilter(filter: (facetName: string) => boolean): void
|
|
75
|
-
setIncludeSourceInfo(include: boolean): void
|
|
76
|
-
setValidateSelectors(validate: boolean): void
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Function Exports
|
|
81
|
-
|
|
82
|
-
```typescript
|
|
83
|
-
// High-level functions for easy use
|
|
84
|
-
export function generateDiamondAbi(diamond: Diamond, options?: GenerateAbiOptions): Promise<DiamondAbiResult>
|
|
85
|
-
export function previewDiamondAbi(diamond: Diamond, cuts: FacetCut[], options?: GenerateAbiOptions): Promise<DiamondAbiResult>
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### CLI Commands
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# Generate ABI for deployed diamond
|
|
92
|
-
diamond-abi generate [options]
|
|
93
|
-
|
|
94
|
-
# Preview ABI changes for planned cuts
|
|
95
|
-
diamond-abi preview [options]
|
|
96
|
-
|
|
97
|
-
# Compare two ABI files
|
|
98
|
-
diamond-abi compare <file1> <file2>
|
|
99
|
-
|
|
100
|
-
# Validate ABI file
|
|
101
|
-
diamond-abi validate <file>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Key Implementation Details
|
|
105
|
-
|
|
106
|
-
### 1. Artifact Processing
|
|
107
|
-
|
|
108
|
-
- Automatic loading of contract artifacts from Hardhat compilation
|
|
109
|
-
- Fallback handling for missing artifacts in test environments
|
|
110
|
-
- Support for both deployed and planned facets
|
|
111
|
-
|
|
112
|
-
### 2. Function Selector Management
|
|
113
|
-
|
|
114
|
-
- Integration with existing function selector registry
|
|
115
|
-
- Duplicate selector detection and handling
|
|
116
|
-
- Selector-to-facet mapping generation
|
|
117
|
-
|
|
118
|
-
### 3. Metadata Generation
|
|
119
|
-
|
|
120
|
-
- Diamond-specific metadata inclusion
|
|
121
|
-
- Timestamp and version information
|
|
122
|
-
- Deployment configuration details
|
|
123
|
-
- Performance statistics
|
|
124
|
-
|
|
125
|
-
### 4. Error Handling
|
|
126
|
-
|
|
127
|
-
- Graceful handling of missing artifacts
|
|
128
|
-
- Comprehensive error reporting
|
|
129
|
-
- Fallback mechanisms for test environments
|
|
130
|
-
|
|
131
|
-
## Usage Examples
|
|
132
|
-
|
|
133
|
-
### Programmatic Usage
|
|
134
|
-
|
|
135
|
-
```typescript
|
|
136
|
-
import { generateDiamondAbi, Diamond } from 'diamonds';
|
|
137
|
-
|
|
138
|
-
const diamond = new Diamond(config, repository);
|
|
139
|
-
const result = await generateDiamondAbi(diamond, {
|
|
140
|
-
outputDir: './artifacts/diamond-abi',
|
|
141
|
-
includeSourceInfo: true,
|
|
142
|
-
validateSelectors: true
|
|
143
|
-
});
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### CLI Usage
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
# Generate ABI for localhost deployment
|
|
150
|
-
npx diamond-abi generate --diamond GeniusDiamond --network localhost
|
|
151
|
-
|
|
152
|
-
# Preview changes with verbose output
|
|
153
|
-
npx diamond-abi preview --diamond GeniusDiamond --verbose
|
|
154
|
-
|
|
155
|
-
# Compare two versions
|
|
156
|
-
npx diamond-abi compare old-abi.json new-abi.json
|
|
157
|
-
|
|
158
|
-
# Validate ABI file
|
|
159
|
-
npx diamond-abi validate diamond-abi.json
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## Test Coverage
|
|
163
|
-
|
|
164
|
-
### Unit Tests
|
|
165
|
-
|
|
166
|
-
- ✅ Basic ABI generation functionality
|
|
167
|
-
- ✅ Preview mode with planned cuts
|
|
168
|
-
- ✅ Configuration options
|
|
169
|
-
- ✅ Error handling scenarios
|
|
170
|
-
- ✅ Output validation
|
|
171
|
-
- ✅ Performance characteristics
|
|
172
|
-
|
|
173
|
-
### Integration Tests
|
|
174
|
-
|
|
175
|
-
- ✅ End-to-end workflow with real diamond deployments
|
|
176
|
-
- ✅ Integration with deployment strategies
|
|
177
|
-
- ✅ ABI integrity validation
|
|
178
|
-
- ✅ Performance benchmarking
|
|
179
|
-
- ✅ Large-scale deployment testing
|
|
180
|
-
|
|
181
|
-
## Performance Characteristics
|
|
182
|
-
|
|
183
|
-
### Benchmarks (from integration tests)
|
|
184
|
-
|
|
185
|
-
- **Small diamonds (1-5 facets)**: ~50-200ms generation time
|
|
186
|
-
- **Medium diamonds (10-20 facets)**: ~100-300ms generation time
|
|
187
|
-
- **Large diamonds (50+ facets)**: ~500-1000ms generation time
|
|
188
|
-
- **Memory usage**: Scales linearly with diamond complexity
|
|
189
|
-
- **Artifact processing**: Efficient caching and reuse
|
|
190
|
-
|
|
191
|
-
## Future Enhancements
|
|
192
|
-
|
|
193
|
-
### Planned Features
|
|
194
|
-
|
|
195
|
-
1. **TypeScript Interface Generation**: Generate TypeScript interfaces from ABI
|
|
196
|
-
2. **Documentation Generation**: Auto-generate API documentation
|
|
197
|
-
3. **Version Management**: Track ABI versions and changes over time
|
|
198
|
-
4. **External Tool Integration**: Integration with front-end frameworks
|
|
199
|
-
5. **Advanced Validation**: Extended validation rules and checks
|
|
200
|
-
|
|
201
|
-
### Performance Optimizations
|
|
202
|
-
|
|
203
|
-
1. **Parallel Processing**: Process multiple facets in parallel
|
|
204
|
-
2. **Caching**: Implement intelligent caching for repeated operations
|
|
205
|
-
3. **Streaming**: Stream processing for very large diamonds
|
|
206
|
-
4. **Compression**: Optional compression for large ABI files
|
|
207
|
-
|
|
208
|
-
## Conclusion
|
|
209
|
-
|
|
210
|
-
The Diamond ABI generation system provides a comprehensive, professional-grade solution for managing ERC-2535 Diamond Proxy ABIs. The implementation includes:
|
|
211
|
-
|
|
212
|
-
- ✅ Complete feature set with advanced capabilities
|
|
213
|
-
- ✅ Seamless integration with existing diamond deployment infrastructure
|
|
214
|
-
- ✅ Professional CLI tools for developer productivity
|
|
215
|
-
- ✅ Comprehensive testing suite with 100% passing tests
|
|
216
|
-
- ✅ Excellent performance characteristics
|
|
217
|
-
- ✅ Proper error handling and validation
|
|
218
|
-
- ✅ Extensible architecture for future enhancements
|
|
219
|
-
|
|
220
|
-
The system is ready for production use and provides a solid foundation for diamond-based smart contract development workflows.
|