neozipkit 0.1.1 → 0.2.1
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/README.md +52 -105
- package/contracts/INTEGRATION.md +338 -0
- package/contracts/NETWORKS.md +156 -0
- package/contracts/README.md +152 -0
- package/{src/server/blockchain → contracts}/constants.ts +5 -22
- package/contracts/deploy-bytecode.mjs +94 -0
- package/dist/blockchain/ZipKitMinter.d.ts +106 -0
- package/dist/blockchain/ZipKitMinter.js +347 -0
- package/dist/blockchain/ZipKitNFT.d.ts +3 -0
- package/dist/blockchain/ZipKitNFT.js +7 -0
- package/dist/blockchain/ZipKitOTS.d.ts +135 -0
- package/dist/blockchain/ZipKitOTS.js +564 -0
- package/dist/blockchain/ZipKitVerifier.d.ts +69 -0
- package/dist/blockchain/ZipKitVerifier.js +289 -0
- package/dist/{server/blockchain/WalletAnalyzer.d.ts → blockchain/ZipKitWallet.d.ts} +31 -43
- package/dist/{server/blockchain/WalletAnalyzer.js → blockchain/ZipKitWallet.js} +193 -161
- package/dist/blockchain/contracts.d.ts +14 -0
- package/dist/blockchain/contracts.js +77 -0
- package/dist/blockchain/index.d.ts +7 -0
- package/dist/blockchain/index.js +50 -0
- package/dist/{server/blockchain → blockchain}/types.d.ts +12 -34
- package/dist/{server/blockchain → blockchain}/types.js +1 -22
- package/dist/browser-index.d.ts +0 -3
- package/dist/browser-index.js +4 -5
- package/dist/browser.d.ts +0 -3
- package/dist/browser.js +4 -5
- package/dist/index.d.ts +8 -15
- package/dist/index.js +12 -24
- package/dist/server/{platform/server/ZipKitServer.d.ts → ZipKitServer.d.ts} +4 -35
- package/dist/server/{platform/server/ZipKitServer.js → ZipKitServer.js} +55 -182
- package/dist/shared/ZipEntry.js +1 -1
- package/dist/shared/ZipKit.d.ts +0 -6
- package/dist/shared/ZipKit.js +1 -18
- package/dist/shared/types.js +2 -2
- package/dist/shared/version.d.ts +2 -4
- package/dist/shared/version.js +4 -5
- package/package.json +13 -3
- package/src/blockchain/README.md +229 -0
- package/src/blockchain/ZipKitMinter.ts +470 -0
- package/src/blockchain/ZipKitNFT.ts +12 -0
- package/src/blockchain/ZipKitOTS.ts +622 -0
- package/src/blockchain/ZipKitVerifier.ts +382 -0
- package/src/blockchain/ZipKitWallet.ts +338 -0
- package/src/blockchain/contracts.ts +88 -0
- package/src/blockchain/index.ts +61 -0
- package/src/blockchain/types.ts +91 -0
- package/src/browser/{TokenVerifierBrowser.ts → TokenVerifierBrowser.ts-remove} +1 -1
- package/src/browser-index.ts +3 -3
- package/src/index.ts +10 -17
- package/src/server/README.md +25 -0
- package/src/server/ZipKitServer.ts +305 -0
- package/src/shared/ZipEntry.ts +1 -1
- package/src/shared/ZipKit.ts +1 -19
- package/src/shared/types.ts +3 -3
- package/src/shared/version.ts +3 -4
- package/src/types/modules.d.ts +11 -1
- package/contracts/Lock.sol +0 -34
- package/contracts/compile-contract.js +0 -168
- package/contracts/deploy/deploy-both-contracts.js +0 -286
- package/contracts/deploy/deploy-enhanced-contract.js +0 -197
- package/contracts/deploy/deploy-private-contract.js +0 -190
- package/contracts/deploy/deploy-public-clean.js +0 -1063
- package/contracts/deploy/deploy-public-contract.js +0 -1107
- package/contracts/deployment.config.example.js +0 -25
- package/contracts/remix-compile.js +0 -222
- package/contracts/setup-deployment.js +0 -51
- package/contracts/src/ZipFileNFT-DEPRECATED-6field.sol +0 -260
- package/contracts/src/ZipFileNFT-DEPRECATED-Enhanced.sol +0 -289
- package/dist/browser/CertificateGeneratorBrowser.d.ts +0 -75
- package/dist/browser/CertificateGeneratorBrowser.js +0 -433
- package/dist/browser/TokenVerifierBrowser.d.ts +0 -76
- package/dist/browser/TokenVerifierBrowser.js +0 -299
- package/dist/server/blockchain/NFTMinter.d.ts +0 -41
- package/dist/server/blockchain/NFTMinter.js +0 -323
- package/dist/server/blockchain/TokenQuerier.d.ts +0 -31
- package/dist/server/blockchain/TokenQuerier.js +0 -259
- package/dist/server/blockchain/TokenVerifier.d.ts +0 -20
- package/dist/server/blockchain/TokenVerifier.js +0 -395
- package/dist/server/blockchain/WalletFormatter.d.ts +0 -39
- package/dist/server/blockchain/WalletFormatter.js +0 -196
- package/dist/server/blockchain/WalletManager.d.ts +0 -46
- package/dist/server/blockchain/WalletManager.js +0 -294
- package/dist/server/blockchain/ZipMetadata.d.ts +0 -27
- package/dist/server/blockchain/ZipMetadata.js +0 -131
- package/dist/server/blockchain/ZipTokenProcessor.d.ts +0 -44
- package/dist/server/blockchain/ZipTokenProcessor.js +0 -204
- package/dist/server/blockchain/constants.d.ts +0 -102
- package/dist/server/blockchain/constants.js +0 -968
- package/dist/server/blockchain/index.d.ts +0 -9
- package/dist/server/blockchain/index.js +0 -44
- package/dist/server/blockchain/test-certificate.d.ts +0 -8
- package/dist/server/blockchain/test-certificate.js +0 -100
- package/dist/server/platform/servercomponents/ZipKitOTS.d.ts +0 -91
- package/dist/server/platform/servercomponents/ZipKitOTS.js +0 -271
- package/examples/unzip-token.ts +0 -488
- package/examples/zip-token.ts +0 -604
- package/src/server/blockchain/NFTMinter.ts +0 -357
- package/src/server/blockchain/TokenQuerier.ts +0 -287
- package/src/server/blockchain/TokenVerifier.ts +0 -453
- package/src/server/blockchain/WalletAnalyzer.ts +0 -397
- package/src/server/blockchain/WalletFormatter.ts +0 -206
- package/src/server/blockchain/WalletManager.ts +0 -294
- package/src/server/blockchain/ZipMetadata.ts +0 -117
- package/src/server/blockchain/ZipTokenProcessor.ts +0 -234
- package/src/server/blockchain/index.ts +0 -42
- package/src/server/blockchain/test-certificate.ts +0 -137
- package/src/server/blockchain/types.ts +0 -134
- package/src/server/platform/server/ZipKitServer.ts +0 -459
- package/src/server/platform/servercomponents/ZipKitOTS.ts +0 -313
- package/src/server/platform/servercomponents/opentimestamps.d.ts +0 -23
- /package/contracts/{bytecode.txt → NZIP-NFT-bytecode.txt} +0 -0
- /package/dist/{server/blockchain → blockchain}/CertificateToken.d.ts +0 -0
- /package/dist/{server/blockchain → blockchain}/CertificateToken.js +0 -0
- /package/src/{server/blockchain → blockchain}/CertificateToken.ts +0 -0
- /package/src/browser/{CertificateGeneratorBrowser.ts → CertificateGeneratorBrowser.ts-remove} +0 -0
|
@@ -1,1063 +0,0 @@
|
|
|
1
|
-
const { ethers } = require('ethers');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Clean NZIP NFT Public Contract Deployment Script
|
|
7
|
-
* Reads bytecode from external file to avoid issues with large strings
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// Configuration - Load from environment variables or config file
|
|
11
|
-
function loadConfig() {
|
|
12
|
-
let config = {};
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
config = require('../deployment.config.js');
|
|
16
|
-
console.log('📁 Loaded configuration from deployment.config.js');
|
|
17
|
-
} catch (err) {
|
|
18
|
-
console.log('📁 No deployment.config.js found, using environment variables');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const CHAIN_ID = process.env.CHAIN_ID ? parseInt(process.env.CHAIN_ID) : (config.CHAIN_ID || 84532);
|
|
22
|
-
const PRIVATE_KEY = process.env.PRIVATE_KEY || config.PRIVATE_KEY;
|
|
23
|
-
|
|
24
|
-
return { CHAIN_ID, PRIVATE_KEY, EXISTING_CONTRACT: config.EXISTING_CONTRACT };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const { CHAIN_ID, PRIVATE_KEY, EXISTING_CONTRACT } = loadConfig();
|
|
28
|
-
|
|
29
|
-
// Network configurations
|
|
30
|
-
const NETWORK_CONFIG = {
|
|
31
|
-
84532: {
|
|
32
|
-
name: 'Base Sepolia',
|
|
33
|
-
rpcUrl: 'https://sepolia.base.org',
|
|
34
|
-
explorer: 'https://sepolia.basescan.org'
|
|
35
|
-
},
|
|
36
|
-
8453: {
|
|
37
|
-
name: 'Base Mainnet',
|
|
38
|
-
rpcUrl: 'https://mainnet.base.org',
|
|
39
|
-
explorer: 'https://basescan.org'
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Load bytecode and ABI from files
|
|
44
|
-
function loadContractData() {
|
|
45
|
-
const bytecodePath = path.join(__dirname, '../bytecode.txt');
|
|
46
|
-
|
|
47
|
-
if (!fs.existsSync(bytecodePath)) {
|
|
48
|
-
throw new Error('❌ bytecode.txt file not found. Please create it and paste your compiled bytecode.');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const bytecode = fs.readFileSync(bytecodePath, 'utf8').trim();
|
|
52
|
-
|
|
53
|
-
if (!bytecode || bytecode === 'PASTE_YOUR_COMPILED_BYTECODE_HERE') {
|
|
54
|
-
throw new Error('❌ Please paste your compiled bytecode into contracts/bytecode.txt');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const abi = [
|
|
58
|
-
{
|
|
59
|
-
"inputs": [],
|
|
60
|
-
"stateMutability": "nonpayable",
|
|
61
|
-
"type": "constructor"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"inputs": [
|
|
65
|
-
{
|
|
66
|
-
"internalType": "address",
|
|
67
|
-
"name": "sender",
|
|
68
|
-
"type": "address"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"internalType": "uint256",
|
|
72
|
-
"name": "tokenId",
|
|
73
|
-
"type": "uint256"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"internalType": "address",
|
|
77
|
-
"name": "owner",
|
|
78
|
-
"type": "address"
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"name": "ERC721IncorrectOwner",
|
|
82
|
-
"type": "error"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"inputs": [
|
|
86
|
-
{
|
|
87
|
-
"internalType": "address",
|
|
88
|
-
"name": "operator",
|
|
89
|
-
"type": "address"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"internalType": "uint256",
|
|
93
|
-
"name": "tokenId",
|
|
94
|
-
"type": "uint256"
|
|
95
|
-
}
|
|
96
|
-
],
|
|
97
|
-
"name": "ERC721InsufficientApproval",
|
|
98
|
-
"type": "error"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"inputs": [
|
|
102
|
-
{
|
|
103
|
-
"internalType": "address",
|
|
104
|
-
"name": "approver",
|
|
105
|
-
"type": "address"
|
|
106
|
-
}
|
|
107
|
-
],
|
|
108
|
-
"name": "ERC721InvalidApprover",
|
|
109
|
-
"type": "error"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"inputs": [
|
|
113
|
-
{
|
|
114
|
-
"internalType": "address",
|
|
115
|
-
"name": "operator",
|
|
116
|
-
"type": "address"
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
"name": "ERC721InvalidOperator",
|
|
120
|
-
"type": "error"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"inputs": [
|
|
124
|
-
{
|
|
125
|
-
"internalType": "address",
|
|
126
|
-
"name": "owner",
|
|
127
|
-
"type": "address"
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
"name": "ERC721InvalidOwner",
|
|
131
|
-
"type": "error"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"inputs": [
|
|
135
|
-
{
|
|
136
|
-
"internalType": "address",
|
|
137
|
-
"name": "receiver",
|
|
138
|
-
"type": "address"
|
|
139
|
-
}
|
|
140
|
-
],
|
|
141
|
-
"name": "ERC721InvalidReceiver",
|
|
142
|
-
"type": "error"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"inputs": [
|
|
146
|
-
{
|
|
147
|
-
"internalType": "address",
|
|
148
|
-
"name": "sender",
|
|
149
|
-
"type": "address"
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"name": "ERC721InvalidSender",
|
|
153
|
-
"type": "error"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"inputs": [
|
|
157
|
-
{
|
|
158
|
-
"internalType": "uint256",
|
|
159
|
-
"name": "tokenId",
|
|
160
|
-
"type": "uint256"
|
|
161
|
-
}
|
|
162
|
-
],
|
|
163
|
-
"name": "ERC721NonexistentToken",
|
|
164
|
-
"type": "error"
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
"inputs": [
|
|
168
|
-
{
|
|
169
|
-
"internalType": "address",
|
|
170
|
-
"name": "owner",
|
|
171
|
-
"type": "address"
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
"name": "OwnableInvalidOwner",
|
|
175
|
-
"type": "error"
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"inputs": [
|
|
179
|
-
{
|
|
180
|
-
"internalType": "address",
|
|
181
|
-
"name": "account",
|
|
182
|
-
"type": "address"
|
|
183
|
-
}
|
|
184
|
-
],
|
|
185
|
-
"name": "OwnableUnauthorizedAccount",
|
|
186
|
-
"type": "error"
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
"anonymous": false,
|
|
190
|
-
"inputs": [
|
|
191
|
-
{
|
|
192
|
-
"indexed": true,
|
|
193
|
-
"internalType": "address",
|
|
194
|
-
"name": "owner",
|
|
195
|
-
"type": "address"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"indexed": true,
|
|
199
|
-
"internalType": "address",
|
|
200
|
-
"name": "approved",
|
|
201
|
-
"type": "address"
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"indexed": true,
|
|
205
|
-
"internalType": "uint256",
|
|
206
|
-
"name": "tokenId",
|
|
207
|
-
"type": "uint256"
|
|
208
|
-
}
|
|
209
|
-
],
|
|
210
|
-
"name": "Approval",
|
|
211
|
-
"type": "event"
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
"anonymous": false,
|
|
215
|
-
"inputs": [
|
|
216
|
-
{
|
|
217
|
-
"indexed": true,
|
|
218
|
-
"internalType": "address",
|
|
219
|
-
"name": "owner",
|
|
220
|
-
"type": "address"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
"indexed": true,
|
|
224
|
-
"internalType": "address",
|
|
225
|
-
"name": "operator",
|
|
226
|
-
"type": "address"
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
"indexed": false,
|
|
230
|
-
"internalType": "bool",
|
|
231
|
-
"name": "approved",
|
|
232
|
-
"type": "bool"
|
|
233
|
-
}
|
|
234
|
-
],
|
|
235
|
-
"name": "ApprovalForAll",
|
|
236
|
-
"type": "event"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
"anonymous": false,
|
|
240
|
-
"inputs": [
|
|
241
|
-
{
|
|
242
|
-
"indexed": false,
|
|
243
|
-
"internalType": "uint256",
|
|
244
|
-
"name": "_fromTokenId",
|
|
245
|
-
"type": "uint256"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
"indexed": false,
|
|
249
|
-
"internalType": "uint256",
|
|
250
|
-
"name": "_toTokenId",
|
|
251
|
-
"type": "uint256"
|
|
252
|
-
}
|
|
253
|
-
],
|
|
254
|
-
"name": "BatchMetadataUpdate",
|
|
255
|
-
"type": "event"
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
"anonymous": false,
|
|
259
|
-
"inputs": [
|
|
260
|
-
{
|
|
261
|
-
"indexed": false,
|
|
262
|
-
"internalType": "uint256",
|
|
263
|
-
"name": "_tokenId",
|
|
264
|
-
"type": "uint256"
|
|
265
|
-
}
|
|
266
|
-
],
|
|
267
|
-
"name": "MetadataUpdate",
|
|
268
|
-
"type": "event"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
"anonymous": false,
|
|
272
|
-
"inputs": [
|
|
273
|
-
{
|
|
274
|
-
"indexed": true,
|
|
275
|
-
"internalType": "address",
|
|
276
|
-
"name": "previousOwner",
|
|
277
|
-
"type": "address"
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
"indexed": true,
|
|
281
|
-
"internalType": "address",
|
|
282
|
-
"name": "newOwner",
|
|
283
|
-
"type": "address"
|
|
284
|
-
}
|
|
285
|
-
],
|
|
286
|
-
"name": "OwnershipTransferred",
|
|
287
|
-
"type": "event"
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"anonymous": false,
|
|
291
|
-
"inputs": [
|
|
292
|
-
{
|
|
293
|
-
"indexed": true,
|
|
294
|
-
"internalType": "address",
|
|
295
|
-
"name": "from",
|
|
296
|
-
"type": "address"
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"indexed": true,
|
|
300
|
-
"internalType": "address",
|
|
301
|
-
"name": "to",
|
|
302
|
-
"type": "address"
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
"indexed": true,
|
|
306
|
-
"internalType": "uint256",
|
|
307
|
-
"name": "tokenId",
|
|
308
|
-
"type": "uint256"
|
|
309
|
-
}
|
|
310
|
-
],
|
|
311
|
-
"name": "Transfer",
|
|
312
|
-
"type": "event"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
"anonymous": false,
|
|
316
|
-
"inputs": [
|
|
317
|
-
{
|
|
318
|
-
"indexed": true,
|
|
319
|
-
"internalType": "uint256",
|
|
320
|
-
"name": "tokenId",
|
|
321
|
-
"type": "uint256"
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
"indexed": true,
|
|
325
|
-
"internalType": "address",
|
|
326
|
-
"name": "creator",
|
|
327
|
-
"type": "address"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
"indexed": false,
|
|
331
|
-
"internalType": "string",
|
|
332
|
-
"name": "fileName",
|
|
333
|
-
"type": "string"
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
"indexed": false,
|
|
337
|
-
"internalType": "string",
|
|
338
|
-
"name": "merkleRootHash",
|
|
339
|
-
"type": "string"
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
"indexed": false,
|
|
343
|
-
"internalType": "uint256",
|
|
344
|
-
"name": "creationTimestamp",
|
|
345
|
-
"type": "uint256"
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
"indexed": false,
|
|
349
|
-
"internalType": "string",
|
|
350
|
-
"name": "ipfsHash",
|
|
351
|
-
"type": "string"
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
"indexed": false,
|
|
355
|
-
"internalType": "uint256",
|
|
356
|
-
"name": "tokenizationTime",
|
|
357
|
-
"type": "uint256"
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
"indexed": false,
|
|
361
|
-
"internalType": "uint256",
|
|
362
|
-
"name": "blockNumber",
|
|
363
|
-
"type": "uint256"
|
|
364
|
-
}
|
|
365
|
-
],
|
|
366
|
-
"name": "ZipFileTokenized",
|
|
367
|
-
"type": "event"
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
"inputs": [
|
|
371
|
-
{
|
|
372
|
-
"internalType": "address",
|
|
373
|
-
"name": "to",
|
|
374
|
-
"type": "address"
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
"internalType": "uint256",
|
|
378
|
-
"name": "tokenId",
|
|
379
|
-
"type": "uint256"
|
|
380
|
-
}
|
|
381
|
-
],
|
|
382
|
-
"name": "approve",
|
|
383
|
-
"outputs": [],
|
|
384
|
-
"stateMutability": "nonpayable",
|
|
385
|
-
"type": "function"
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
"inputs": [
|
|
389
|
-
{
|
|
390
|
-
"internalType": "address",
|
|
391
|
-
"name": "owner",
|
|
392
|
-
"type": "address"
|
|
393
|
-
}
|
|
394
|
-
],
|
|
395
|
-
"name": "balanceOf",
|
|
396
|
-
"outputs": [
|
|
397
|
-
{
|
|
398
|
-
"internalType": "uint256",
|
|
399
|
-
"name": "",
|
|
400
|
-
"type": "uint256"
|
|
401
|
-
}
|
|
402
|
-
],
|
|
403
|
-
"stateMutability": "view",
|
|
404
|
-
"type": "function"
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
"inputs": [
|
|
408
|
-
{
|
|
409
|
-
"internalType": "bytes32",
|
|
410
|
-
"name": "",
|
|
411
|
-
"type": "bytes32"
|
|
412
|
-
}
|
|
413
|
-
],
|
|
414
|
-
"name": "compositeKeyToTokenId",
|
|
415
|
-
"outputs": [
|
|
416
|
-
{
|
|
417
|
-
"internalType": "uint256",
|
|
418
|
-
"name": "",
|
|
419
|
-
"type": "uint256"
|
|
420
|
-
}
|
|
421
|
-
],
|
|
422
|
-
"stateMutability": "view",
|
|
423
|
-
"type": "function"
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
"inputs": [
|
|
427
|
-
{
|
|
428
|
-
"internalType": "string",
|
|
429
|
-
"name": "merkleRootHash",
|
|
430
|
-
"type": "string"
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
"internalType": "uint256",
|
|
434
|
-
"name": "creationTimestamp",
|
|
435
|
-
"type": "uint256"
|
|
436
|
-
}
|
|
437
|
-
],
|
|
438
|
-
"name": "generateCompositeKey",
|
|
439
|
-
"outputs": [
|
|
440
|
-
{
|
|
441
|
-
"internalType": "bytes32",
|
|
442
|
-
"name": "",
|
|
443
|
-
"type": "bytes32"
|
|
444
|
-
}
|
|
445
|
-
],
|
|
446
|
-
"stateMutability": "pure",
|
|
447
|
-
"type": "function"
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
"inputs": [
|
|
451
|
-
{
|
|
452
|
-
"internalType": "uint256",
|
|
453
|
-
"name": "tokenId",
|
|
454
|
-
"type": "uint256"
|
|
455
|
-
}
|
|
456
|
-
],
|
|
457
|
-
"name": "getApproved",
|
|
458
|
-
"outputs": [
|
|
459
|
-
{
|
|
460
|
-
"internalType": "address",
|
|
461
|
-
"name": "",
|
|
462
|
-
"type": "address"
|
|
463
|
-
}
|
|
464
|
-
],
|
|
465
|
-
"stateMutability": "view",
|
|
466
|
-
"type": "function"
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
"inputs": [
|
|
470
|
-
{
|
|
471
|
-
"internalType": "uint256",
|
|
472
|
-
"name": "tokenId",
|
|
473
|
-
"type": "uint256"
|
|
474
|
-
}
|
|
475
|
-
],
|
|
476
|
-
"name": "getBlockchainMetadata",
|
|
477
|
-
"outputs": [
|
|
478
|
-
{
|
|
479
|
-
"internalType": "uint256",
|
|
480
|
-
"name": "blockNumber",
|
|
481
|
-
"type": "uint256"
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
"internalType": "uint256",
|
|
485
|
-
"name": "tokenizationTime",
|
|
486
|
-
"type": "uint256"
|
|
487
|
-
}
|
|
488
|
-
],
|
|
489
|
-
"stateMutability": "view",
|
|
490
|
-
"type": "function"
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
"inputs": [
|
|
494
|
-
{
|
|
495
|
-
"internalType": "string",
|
|
496
|
-
"name": "merkleRoot",
|
|
497
|
-
"type": "string"
|
|
498
|
-
}
|
|
499
|
-
],
|
|
500
|
-
"name": "getTokensByMerkleRoot",
|
|
501
|
-
"outputs": [
|
|
502
|
-
{
|
|
503
|
-
"internalType": "uint256[]",
|
|
504
|
-
"name": "",
|
|
505
|
-
"type": "uint256[]"
|
|
506
|
-
}
|
|
507
|
-
],
|
|
508
|
-
"stateMutability": "view",
|
|
509
|
-
"type": "function"
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
"inputs": [],
|
|
513
|
-
"name": "getVersion",
|
|
514
|
-
"outputs": [
|
|
515
|
-
{
|
|
516
|
-
"internalType": "string",
|
|
517
|
-
"name": "",
|
|
518
|
-
"type": "string"
|
|
519
|
-
}
|
|
520
|
-
],
|
|
521
|
-
"stateMutability": "pure",
|
|
522
|
-
"type": "function"
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
"inputs": [
|
|
526
|
-
{
|
|
527
|
-
"internalType": "uint256",
|
|
528
|
-
"name": "tokenId",
|
|
529
|
-
"type": "uint256"
|
|
530
|
-
}
|
|
531
|
-
],
|
|
532
|
-
"name": "getZipFileInfo",
|
|
533
|
-
"outputs": [
|
|
534
|
-
{
|
|
535
|
-
"components": [
|
|
536
|
-
{
|
|
537
|
-
"internalType": "string",
|
|
538
|
-
"name": "fileName",
|
|
539
|
-
"type": "string"
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
"internalType": "string",
|
|
543
|
-
"name": "merkleRootHash",
|
|
544
|
-
"type": "string"
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
"internalType": "string",
|
|
548
|
-
"name": "ipfsHash",
|
|
549
|
-
"type": "string"
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
"internalType": "address",
|
|
553
|
-
"name": "creator",
|
|
554
|
-
"type": "address"
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
"internalType": "uint256",
|
|
558
|
-
"name": "creationTimestamp",
|
|
559
|
-
"type": "uint256"
|
|
560
|
-
},
|
|
561
|
-
{
|
|
562
|
-
"internalType": "uint256",
|
|
563
|
-
"name": "tokenizationTime",
|
|
564
|
-
"type": "uint256"
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
"internalType": "uint256",
|
|
568
|
-
"name": "blockNumber",
|
|
569
|
-
"type": "uint256"
|
|
570
|
-
}
|
|
571
|
-
],
|
|
572
|
-
"internalType": "struct ZipFileNFT.ZipFileInfo",
|
|
573
|
-
"name": "",
|
|
574
|
-
"type": "tuple"
|
|
575
|
-
}
|
|
576
|
-
],
|
|
577
|
-
"stateMutability": "view",
|
|
578
|
-
"type": "function"
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
"inputs": [
|
|
582
|
-
{
|
|
583
|
-
"internalType": "address",
|
|
584
|
-
"name": "owner",
|
|
585
|
-
"type": "address"
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
"internalType": "address",
|
|
589
|
-
"name": "operator",
|
|
590
|
-
"type": "address"
|
|
591
|
-
}
|
|
592
|
-
],
|
|
593
|
-
"name": "isApprovedForAll",
|
|
594
|
-
"outputs": [
|
|
595
|
-
{
|
|
596
|
-
"internalType": "bool",
|
|
597
|
-
"name": "",
|
|
598
|
-
"type": "bool"
|
|
599
|
-
}
|
|
600
|
-
],
|
|
601
|
-
"stateMutability": "view",
|
|
602
|
-
"type": "function"
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
"inputs": [
|
|
606
|
-
{
|
|
607
|
-
"internalType": "string",
|
|
608
|
-
"name": "merkleRootHash",
|
|
609
|
-
"type": "string"
|
|
610
|
-
},
|
|
611
|
-
{
|
|
612
|
-
"internalType": "uint256",
|
|
613
|
-
"name": "creationTimestamp",
|
|
614
|
-
"type": "uint256"
|
|
615
|
-
}
|
|
616
|
-
],
|
|
617
|
-
"name": "isZipFileTokenized",
|
|
618
|
-
"outputs": [
|
|
619
|
-
{
|
|
620
|
-
"internalType": "bool",
|
|
621
|
-
"name": "exists",
|
|
622
|
-
"type": "bool"
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
"internalType": "uint256",
|
|
626
|
-
"name": "tokenId",
|
|
627
|
-
"type": "uint256"
|
|
628
|
-
}
|
|
629
|
-
],
|
|
630
|
-
"stateMutability": "view",
|
|
631
|
-
"type": "function"
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
"inputs": [],
|
|
635
|
-
"name": "name",
|
|
636
|
-
"outputs": [
|
|
637
|
-
{
|
|
638
|
-
"internalType": "string",
|
|
639
|
-
"name": "",
|
|
640
|
-
"type": "string"
|
|
641
|
-
}
|
|
642
|
-
],
|
|
643
|
-
"stateMutability": "view",
|
|
644
|
-
"type": "function"
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
"inputs": [],
|
|
648
|
-
"name": "owner",
|
|
649
|
-
"outputs": [
|
|
650
|
-
{
|
|
651
|
-
"internalType": "address",
|
|
652
|
-
"name": "",
|
|
653
|
-
"type": "address"
|
|
654
|
-
}
|
|
655
|
-
],
|
|
656
|
-
"stateMutability": "view",
|
|
657
|
-
"type": "function"
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
"inputs": [
|
|
661
|
-
{
|
|
662
|
-
"internalType": "uint256",
|
|
663
|
-
"name": "tokenId",
|
|
664
|
-
"type": "uint256"
|
|
665
|
-
}
|
|
666
|
-
],
|
|
667
|
-
"name": "ownerOf",
|
|
668
|
-
"outputs": [
|
|
669
|
-
{
|
|
670
|
-
"internalType": "address",
|
|
671
|
-
"name": "",
|
|
672
|
-
"type": "address"
|
|
673
|
-
}
|
|
674
|
-
],
|
|
675
|
-
"stateMutability": "view",
|
|
676
|
-
"type": "function"
|
|
677
|
-
},
|
|
678
|
-
{
|
|
679
|
-
"inputs": [
|
|
680
|
-
{
|
|
681
|
-
"internalType": "string",
|
|
682
|
-
"name": "fileName",
|
|
683
|
-
"type": "string"
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
"internalType": "string",
|
|
687
|
-
"name": "merkleRootHash",
|
|
688
|
-
"type": "string"
|
|
689
|
-
},
|
|
690
|
-
{
|
|
691
|
-
"internalType": "uint256",
|
|
692
|
-
"name": "creationTimestamp",
|
|
693
|
-
"type": "uint256"
|
|
694
|
-
},
|
|
695
|
-
{
|
|
696
|
-
"internalType": "string",
|
|
697
|
-
"name": "ipfsHash",
|
|
698
|
-
"type": "string"
|
|
699
|
-
},
|
|
700
|
-
{
|
|
701
|
-
"internalType": "string",
|
|
702
|
-
"name": "metadataURI",
|
|
703
|
-
"type": "string"
|
|
704
|
-
}
|
|
705
|
-
],
|
|
706
|
-
"name": "publicMintZipFile",
|
|
707
|
-
"outputs": [
|
|
708
|
-
{
|
|
709
|
-
"internalType": "uint256",
|
|
710
|
-
"name": "",
|
|
711
|
-
"type": "uint256"
|
|
712
|
-
}
|
|
713
|
-
],
|
|
714
|
-
"stateMutability": "nonpayable",
|
|
715
|
-
"type": "function"
|
|
716
|
-
},
|
|
717
|
-
{
|
|
718
|
-
"inputs": [],
|
|
719
|
-
"name": "renounceOwnership",
|
|
720
|
-
"outputs": [],
|
|
721
|
-
"stateMutability": "nonpayable",
|
|
722
|
-
"type": "function"
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
"inputs": [
|
|
726
|
-
{
|
|
727
|
-
"internalType": "address",
|
|
728
|
-
"name": "from",
|
|
729
|
-
"type": "address"
|
|
730
|
-
},
|
|
731
|
-
{
|
|
732
|
-
"internalType": "address",
|
|
733
|
-
"name": "to",
|
|
734
|
-
"type": "address"
|
|
735
|
-
},
|
|
736
|
-
{
|
|
737
|
-
"internalType": "uint256",
|
|
738
|
-
"name": "tokenId",
|
|
739
|
-
"type": "uint256"
|
|
740
|
-
}
|
|
741
|
-
],
|
|
742
|
-
"name": "safeTransferFrom",
|
|
743
|
-
"outputs": [],
|
|
744
|
-
"stateMutability": "nonpayable",
|
|
745
|
-
"type": "function"
|
|
746
|
-
},
|
|
747
|
-
{
|
|
748
|
-
"inputs": [
|
|
749
|
-
{
|
|
750
|
-
"internalType": "address",
|
|
751
|
-
"name": "from",
|
|
752
|
-
"type": "address"
|
|
753
|
-
},
|
|
754
|
-
{
|
|
755
|
-
"internalType": "address",
|
|
756
|
-
"name": "to",
|
|
757
|
-
"type": "address"
|
|
758
|
-
},
|
|
759
|
-
{
|
|
760
|
-
"internalType": "uint256",
|
|
761
|
-
"name": "tokenId",
|
|
762
|
-
"type": "uint256"
|
|
763
|
-
},
|
|
764
|
-
{
|
|
765
|
-
"internalType": "bytes",
|
|
766
|
-
"name": "data",
|
|
767
|
-
"type": "bytes"
|
|
768
|
-
}
|
|
769
|
-
],
|
|
770
|
-
"name": "safeTransferFrom",
|
|
771
|
-
"outputs": [],
|
|
772
|
-
"stateMutability": "nonpayable",
|
|
773
|
-
"type": "function"
|
|
774
|
-
},
|
|
775
|
-
{
|
|
776
|
-
"inputs": [
|
|
777
|
-
{
|
|
778
|
-
"internalType": "address",
|
|
779
|
-
"name": "operator",
|
|
780
|
-
"type": "address"
|
|
781
|
-
},
|
|
782
|
-
{
|
|
783
|
-
"internalType": "bool",
|
|
784
|
-
"name": "approved",
|
|
785
|
-
"type": "bool"
|
|
786
|
-
}
|
|
787
|
-
],
|
|
788
|
-
"name": "setApprovalForAll",
|
|
789
|
-
"outputs": [],
|
|
790
|
-
"stateMutability": "nonpayable",
|
|
791
|
-
"type": "function"
|
|
792
|
-
},
|
|
793
|
-
{
|
|
794
|
-
"inputs": [
|
|
795
|
-
{
|
|
796
|
-
"internalType": "bytes4",
|
|
797
|
-
"name": "interfaceId",
|
|
798
|
-
"type": "bytes4"
|
|
799
|
-
}
|
|
800
|
-
],
|
|
801
|
-
"name": "supportsInterface",
|
|
802
|
-
"outputs": [
|
|
803
|
-
{
|
|
804
|
-
"internalType": "bool",
|
|
805
|
-
"name": "",
|
|
806
|
-
"type": "bool"
|
|
807
|
-
}
|
|
808
|
-
],
|
|
809
|
-
"stateMutability": "view",
|
|
810
|
-
"type": "function"
|
|
811
|
-
},
|
|
812
|
-
{
|
|
813
|
-
"inputs": [],
|
|
814
|
-
"name": "symbol",
|
|
815
|
-
"outputs": [
|
|
816
|
-
{
|
|
817
|
-
"internalType": "string",
|
|
818
|
-
"name": "",
|
|
819
|
-
"type": "string"
|
|
820
|
-
}
|
|
821
|
-
],
|
|
822
|
-
"stateMutability": "view",
|
|
823
|
-
"type": "function"
|
|
824
|
-
},
|
|
825
|
-
{
|
|
826
|
-
"inputs": [
|
|
827
|
-
{
|
|
828
|
-
"internalType": "uint256",
|
|
829
|
-
"name": "tokenId",
|
|
830
|
-
"type": "uint256"
|
|
831
|
-
}
|
|
832
|
-
],
|
|
833
|
-
"name": "tokenURI",
|
|
834
|
-
"outputs": [
|
|
835
|
-
{
|
|
836
|
-
"internalType": "string",
|
|
837
|
-
"name": "",
|
|
838
|
-
"type": "string"
|
|
839
|
-
}
|
|
840
|
-
],
|
|
841
|
-
"stateMutability": "view",
|
|
842
|
-
"type": "function"
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
"inputs": [],
|
|
846
|
-
"name": "totalSupply",
|
|
847
|
-
"outputs": [
|
|
848
|
-
{
|
|
849
|
-
"internalType": "uint256",
|
|
850
|
-
"name": "",
|
|
851
|
-
"type": "uint256"
|
|
852
|
-
}
|
|
853
|
-
],
|
|
854
|
-
"stateMutability": "view",
|
|
855
|
-
"type": "function"
|
|
856
|
-
},
|
|
857
|
-
{
|
|
858
|
-
"inputs": [
|
|
859
|
-
{
|
|
860
|
-
"internalType": "address",
|
|
861
|
-
"name": "from",
|
|
862
|
-
"type": "address"
|
|
863
|
-
},
|
|
864
|
-
{
|
|
865
|
-
"internalType": "address",
|
|
866
|
-
"name": "to",
|
|
867
|
-
"type": "address"
|
|
868
|
-
},
|
|
869
|
-
{
|
|
870
|
-
"internalType": "uint256",
|
|
871
|
-
"name": "tokenId",
|
|
872
|
-
"type": "uint256"
|
|
873
|
-
}
|
|
874
|
-
],
|
|
875
|
-
"name": "transferFrom",
|
|
876
|
-
"outputs": [],
|
|
877
|
-
"stateMutability": "nonpayable",
|
|
878
|
-
"type": "function"
|
|
879
|
-
},
|
|
880
|
-
{
|
|
881
|
-
"inputs": [
|
|
882
|
-
{
|
|
883
|
-
"internalType": "address",
|
|
884
|
-
"name": "newOwner",
|
|
885
|
-
"type": "address"
|
|
886
|
-
}
|
|
887
|
-
],
|
|
888
|
-
"name": "transferOwnership",
|
|
889
|
-
"outputs": [],
|
|
890
|
-
"stateMutability": "nonpayable",
|
|
891
|
-
"type": "function"
|
|
892
|
-
},
|
|
893
|
-
{
|
|
894
|
-
"inputs": [
|
|
895
|
-
{
|
|
896
|
-
"internalType": "uint256",
|
|
897
|
-
"name": "tokenId",
|
|
898
|
-
"type": "uint256"
|
|
899
|
-
},
|
|
900
|
-
{
|
|
901
|
-
"internalType": "string",
|
|
902
|
-
"name": "providedMerkleRoot",
|
|
903
|
-
"type": "string"
|
|
904
|
-
}
|
|
905
|
-
],
|
|
906
|
-
"name": "verifyZipFile",
|
|
907
|
-
"outputs": [
|
|
908
|
-
{
|
|
909
|
-
"internalType": "bool",
|
|
910
|
-
"name": "isValid",
|
|
911
|
-
"type": "bool"
|
|
912
|
-
}
|
|
913
|
-
],
|
|
914
|
-
"stateMutability": "view",
|
|
915
|
-
"type": "function"
|
|
916
|
-
},
|
|
917
|
-
{
|
|
918
|
-
"inputs": [
|
|
919
|
-
{
|
|
920
|
-
"internalType": "uint256",
|
|
921
|
-
"name": "",
|
|
922
|
-
"type": "uint256"
|
|
923
|
-
}
|
|
924
|
-
],
|
|
925
|
-
"name": "zipFileInfo",
|
|
926
|
-
"outputs": [
|
|
927
|
-
{
|
|
928
|
-
"internalType": "string",
|
|
929
|
-
"name": "fileName",
|
|
930
|
-
"type": "string"
|
|
931
|
-
},
|
|
932
|
-
{
|
|
933
|
-
"internalType": "string",
|
|
934
|
-
"name": "merkleRootHash",
|
|
935
|
-
"type": "string"
|
|
936
|
-
},
|
|
937
|
-
{
|
|
938
|
-
"internalType": "string",
|
|
939
|
-
"name": "ipfsHash",
|
|
940
|
-
"type": "string"
|
|
941
|
-
},
|
|
942
|
-
{
|
|
943
|
-
"internalType": "address",
|
|
944
|
-
"name": "creator",
|
|
945
|
-
"type": "address"
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
"internalType": "uint256",
|
|
949
|
-
"name": "creationTimestamp",
|
|
950
|
-
"type": "uint256"
|
|
951
|
-
},
|
|
952
|
-
{
|
|
953
|
-
"internalType": "uint256",
|
|
954
|
-
"name": "tokenizationTime",
|
|
955
|
-
"type": "uint256"
|
|
956
|
-
},
|
|
957
|
-
{
|
|
958
|
-
"internalType": "uint256",
|
|
959
|
-
"name": "blockNumber",
|
|
960
|
-
"type": "uint256"
|
|
961
|
-
}
|
|
962
|
-
],
|
|
963
|
-
"stateMutability": "view",
|
|
964
|
-
"type": "function"
|
|
965
|
-
}
|
|
966
|
-
];
|
|
967
|
-
|
|
968
|
-
return { bytecode, abi };
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
async function deployContract() {
|
|
972
|
-
console.log('🌐 NZIP NFT Public Contract Deployment');
|
|
973
|
-
console.log('=====================================');
|
|
974
|
-
|
|
975
|
-
// Check if user has a deprecated contract configured
|
|
976
|
-
if (EXISTING_CONTRACT) {
|
|
977
|
-
console.log(`⚠️ Deprecated contract detected in config: ${EXISTING_CONTRACT}`);
|
|
978
|
-
console.log('📋 This contract is no longer supported and should not be used.');
|
|
979
|
-
console.log('📋 Proceeding with new contract deployment...\n');
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
// Validate configuration
|
|
983
|
-
if (!PRIVATE_KEY) {
|
|
984
|
-
console.log('❌ PRIVATE_KEY is required for deployment.');
|
|
985
|
-
console.log('📁 Set it in environment variable or deployment.config.js');
|
|
986
|
-
console.log('📁 Example: PRIVATE_KEY=your_private_key_without_0x_prefix');
|
|
987
|
-
throw new Error('❌ PRIVATE_KEY environment variable is required');
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
if (!NETWORK_CONFIG[CHAIN_ID]) {
|
|
991
|
-
throw new Error(`❌ Unsupported chain ID: ${CHAIN_ID}`);
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
const networkConfig = NETWORK_CONFIG[CHAIN_ID];
|
|
995
|
-
console.log(`🌐 Network: ${networkConfig.name}`);
|
|
996
|
-
console.log(`🔗 RPC URL: ${networkConfig.rpcUrl}`);
|
|
997
|
-
console.log(`🔍 Explorer: ${networkConfig.explorer}\n`);
|
|
998
|
-
|
|
999
|
-
// Load contract data
|
|
1000
|
-
console.log('📋 Loading contract bytecode...');
|
|
1001
|
-
const { bytecode, abi } = loadContractData();
|
|
1002
|
-
console.log(`✅ Bytecode loaded (${bytecode.length} characters)`);
|
|
1003
|
-
|
|
1004
|
-
// Setup provider and wallet
|
|
1005
|
-
const provider = new ethers.JsonRpcProvider(networkConfig.rpcUrl);
|
|
1006
|
-
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);
|
|
1007
|
-
|
|
1008
|
-
console.log(`👤 Deployer address: ${wallet.address}`);
|
|
1009
|
-
|
|
1010
|
-
// Check balance
|
|
1011
|
-
const balance = await provider.getBalance(wallet.address);
|
|
1012
|
-
console.log(`💰 Balance: ${ethers.formatEther(balance)} ETH`);
|
|
1013
|
-
|
|
1014
|
-
if (balance === 0n) {
|
|
1015
|
-
throw new Error('❌ Insufficient balance for deployment');
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
// Create contract factory
|
|
1019
|
-
const contractFactory = new ethers.ContractFactory(abi, bytecode, wallet);
|
|
1020
|
-
|
|
1021
|
-
console.log('\n🚀 Deploying contract...');
|
|
1022
|
-
|
|
1023
|
-
// Deploy the contract
|
|
1024
|
-
const contract = await contractFactory.deploy();
|
|
1025
|
-
|
|
1026
|
-
console.log(`📝 Transaction hash: ${contract.deploymentTransaction().hash}`);
|
|
1027
|
-
console.log('⏳ Waiting for deployment confirmation...');
|
|
1028
|
-
|
|
1029
|
-
// Wait for deployment
|
|
1030
|
-
await contract.waitForDeployment();
|
|
1031
|
-
|
|
1032
|
-
const contractAddress = await contract.getAddress();
|
|
1033
|
-
|
|
1034
|
-
console.log('\n🎉 Contract deployed successfully!');
|
|
1035
|
-
console.log('=====================================');
|
|
1036
|
-
console.log(`📍 Contract Address: ${contractAddress}`);
|
|
1037
|
-
console.log(`🌐 Network: ${networkConfig.name}`);
|
|
1038
|
-
console.log(`🔍 Explorer: ${networkConfig.explorer}/address/${contractAddress}`);
|
|
1039
|
-
|
|
1040
|
-
// Test the contract
|
|
1041
|
-
try {
|
|
1042
|
-
const version = await contract.getVersion();
|
|
1043
|
-
console.log(`📋 Contract Version: ${version}`);
|
|
1044
|
-
} catch (err) {
|
|
1045
|
-
console.log('⚠️ Warning: Could not verify contract version');
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
console.log('\n✅ Deployment completed successfully!');
|
|
1049
|
-
console.log(`📋 Save this address: ${contractAddress}`);
|
|
1050
|
-
|
|
1051
|
-
return contractAddress;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
// Run deployment
|
|
1055
|
-
deployContract()
|
|
1056
|
-
.then((address) => {
|
|
1057
|
-
console.log(`\n🎯 Final contract address: ${address}`);
|
|
1058
|
-
process.exit(0);
|
|
1059
|
-
})
|
|
1060
|
-
.catch((error) => {
|
|
1061
|
-
console.error('\n❌ Deployment failed:', error.message);
|
|
1062
|
-
process.exit(1);
|
|
1063
|
-
});
|