@@ -5,6 +5,8 @@ import { fileURLToPath } from "url";
5
5
import { json } from "starknet" ;
6
6
import { getNetwork , getAccount } from "./network.js" ;
7
7
import { initial_assigned_recipients } from "../assigned_custom.js" ;
8
+ // import merkle_data from "../test_merkle_data.json" assert { type: "json" };
9
+ import merkle_data from "../merkle_data.json" assert { type : "json " } ;
8
10
9
11
const __filename = fileURLToPath ( import . meta. url ) ;
10
12
const __dirname = path . dirname ( __filename ) ;
@@ -88,8 +90,8 @@ export const deployBlobert = async (seeder,descriptor_regular, descriptor_custom
88
90
let token_name = "Blobert" ;
89
91
let token_symbol = "BLOB" ;
90
92
let owner = 0x0140809B710276e2e07c06278DD8f7D4a2528acE2764Fce32200852CB3893e5Cn
91
- //todo change
92
- let fee_token_address = 0x4ef0e2993abf44178d3a40f2818828ed1c09cde9009677b7a3323570b4c0f2en
93
+ let fee_token_address = 0x0124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49n
94
+ // let fee_token_address = 0x4ef0e2993abf44178d3a40f2818828ed1c09cde9009677b7a3323570b4c0f2en
93
95
let fee_token_amount = 100 * ( 10 ** 18 )
94
96
95
97
let constructorCalldata = [
@@ -100,28 +102,26 @@ export const deployBlobert = async (seeder,descriptor_regular, descriptor_custom
100
102
descriptor_regular ,
101
103
descriptor_custom ,
102
104
fee_token_address ,
103
- fee_token_amount , 0 // u256
105
+ fee_token_amount , 0 // u256 high
104
106
]
105
107
106
- // merkle roots
107
- let merkle_roots = whitelist_merkle_roots ( )
108
- constructorCalldata . push ( merkle_roots . length )
109
- for ( let j = 0 ; j < merkle_roots . length ; j ++ ) {
110
- constructorCalldata . push ( merkle_roots [ j ] ) ;
111
- }
112
-
113
- // todo update whitelist time
108
+ // add merkle roots
109
+ constructorCalldata
110
+ = addArrayToCalldata ( constructorCalldata , whitelist_merkle_roots ( ) )
114
111
115
112
// mint start time
116
- constructorCalldata . push ( Math . round ( new Date ( ) . getTime ( ) / 1000 ) + 60 * 20 ) // regular mint start time // 12 minutes from now
117
- constructorCalldata . push ( Math . round ( new Date ( ) . getTime ( ) / 1000 ) + 30 ) // whitelist mint start time // 30 seconds from now
113
+ let wltime = Math . round ( new Date ( ) . getTime ( ) / 1000 ) + ( 50 * 60 )
114
+ let regtime = wltime + ( 60 * 60 * 24 )
115
+ constructorCalldata
116
+ . push ( regtime )
117
+ constructorCalldata
118
+ . push ( wltime )
118
119
119
120
// initial custom nft recipients
120
121
let initial_assigned_recips = initial_assigned_recipients ( ) ;
121
- constructorCalldata . push ( initial_assigned_recips . length )
122
- for ( let j = 0 ; j < initial_assigned_recips . length ; j ++ ) {
123
- constructorCalldata . push ( initial_assigned_recips [ j ] ) ;
124
- }
122
+ constructorCalldata
123
+ = addArrayToCalldata ( constructorCalldata , initial_assigned_recips )
124
+
125
125
126
126
// Deploy contract
127
127
console . log ( `\nDeploying ${ name } ... \n\n` . green ) ;
@@ -137,7 +137,7 @@ export const deployBlobert = async (seeder,descriptor_regular, descriptor_custom
137
137
"Tx hash: " . green ,
138
138
`${ network . explorer_url } /tx/${ contract . transaction_hash } )` ,
139
139
) ;
140
- await account . waitForTransaction ( contract . transaction_hash ) ;
140
+ let a = await account . waitForTransaction ( contract . transaction_hash ) ;
141
141
console . log ( "Contract Address: " . green , contract . address , "\n\n" ) ;
142
142
143
143
}
@@ -213,95 +213,10 @@ export const deployDescriptorRegular = async () => {
213
213
}
214
214
215
215
export const deployDescriptorCustom = async ( ) => {
216
-
216
+
217
217
// Load account
218
218
const account = getAccount ( ) ;
219
219
220
- ///////////////////////////////////////////
221
- ///////////////////////////////////////////
222
- ///////////////////////////////////////////
223
-
224
- let descriptor_custom_data_addresses = [ ] ;
225
-
226
- // Declare custom data 1
227
- let descriptor_custom_data_1 = "DescriptorCustomData1"
228
- const descriptor_custom_data_1_class_hash
229
- = ( await declare ( getPath ( descriptor_custom_data_1 ) , descriptor_custom_data_1 ) ) . class_hash ;
230
-
231
- // Deploy contract
232
- console . log ( `\nDeploying ${ descriptor_custom_data_1 } ... \n\n` . green ) ;
233
- let contract = await account . deployContract ( {
234
- classHash : descriptor_custom_data_1_class_hash
235
- } ) ;
236
-
237
- // Wait for transaction
238
- let network = getNetwork ( process . env . STARKNET_NETWORK ) ;
239
- console . log (
240
- "Tx hash: " . green ,
241
- `${ network . explorer_url } /tx/${ contract . transaction_hash } )` ,
242
- ) ;
243
- await account . waitForTransaction ( contract . transaction_hash ) ;
244
- console . log ( "Contract Address: " . green , contract . address , "\n\n" ) ;
245
- descriptor_custom_data_addresses . push ( contract . address )
246
-
247
-
248
- ///////////////////////////////////////////
249
- ///////////////////////////////////////////
250
- ///////////////////////////////////////////
251
-
252
-
253
- // Declare custom data 2
254
- let descriptor_custom_data_2 = "DescriptorCustomData2"
255
- const descriptor_custom_data_2_class_hash
256
- = ( await declare ( getPath ( descriptor_custom_data_2 ) , descriptor_custom_data_2 ) ) . class_hash ;
257
-
258
- // Deploy contract
259
- console . log ( `\nDeploying ${ descriptor_custom_data_2 } ... \n\n` . green ) ;
260
- contract = await account . deployContract ( {
261
- classHash : descriptor_custom_data_2_class_hash ,
262
- constructorCalldata : [ ] ,
263
- } ) ;
264
-
265
- // Wait for transaction
266
- network = getNetwork ( process . env . STARKNET_NETWORK ) ;
267
- console . log (
268
- "Tx hash: " . green ,
269
- `${ network . explorer_url } /tx/${ contract . transaction_hash } )` ,
270
- ) ;
271
- await account . waitForTransaction ( contract . transaction_hash ) ;
272
- console . log ( "Contract Address: " . green , contract . address , "\n\n" ) ;
273
- descriptor_custom_data_addresses . push ( contract . address )
274
-
275
-
276
- ///////////////////////////////////////////
277
- ///////////////////////////////////////////
278
- ///////////////////////////////////////////
279
-
280
-
281
- // // Declare custom data 3
282
- let descriptor_custom_data_3 = "DescriptorCustomData3"
283
- const descriptor_custom_data_3_class_hash
284
- = ( await declare ( getPath ( descriptor_custom_data_3 ) , descriptor_custom_data_3 ) ) . class_hash ;
285
-
286
- // Deploy contract
287
- console . log ( `\nDeploying ${ descriptor_custom_data_3 } ... \n\n` . green ) ;
288
- contract = await account . deployContract ( {
289
- classHash : descriptor_custom_data_3_class_hash ,
290
- constructorCalldata : [ ] ,
291
- } ) ;
292
-
293
-
294
- // Wait for transaction
295
- network = getNetwork ( process . env . STARKNET_NETWORK ) ;
296
- console . log (
297
- "Tx hash: " . green ,
298
- `${ network . explorer_url } /tx/${ contract . transaction_hash } )` ,
299
- ) ;
300
- await account . waitForTransaction ( contract . transaction_hash ) ;
301
- console . log ( "Contract Address: " . green , contract . address , "\n\n" ) ;
302
- descriptor_custom_data_addresses . push ( contract . address )
303
-
304
-
305
220
///////////////////////////////////////////
306
221
///////////////////////////////////////////
307
222
///////////////////////////////////////////
@@ -313,26 +228,19 @@ export const deployDescriptorCustom = async () => {
313
228
314
229
// Deploy contract
315
230
console . log ( `\nDeploying ${ descriptor_custom } ... \n\n` . green ) ;
316
- contract = await account . deployContract ( {
317
- classHash : descriptor_custom_class_hash ,
318
- constructorCalldata : [
319
- descriptor_custom_data_addresses . length ,
320
- descriptor_custom_data_addresses [ 0 ] ,
321
- descriptor_custom_data_addresses [ 1 ] ,
322
- descriptor_custom_data_addresses [ 2 ] ,
323
- ] ,
231
+ let contract = await account . deployContract ( {
232
+ classHash : descriptor_custom_class_hash
324
233
} ) ;
325
234
326
235
327
236
// Wait for transaction
328
- network = getNetwork ( process . env . STARKNET_NETWORK ) ;
237
+ let network = getNetwork ( process . env . STARKNET_NETWORK ) ;
329
238
console . log (
330
239
"Tx hash: " . green ,
331
240
`${ network . explorer_url } /tx/${ contract . transaction_hash } )` ,
332
241
) ;
333
242
await account . waitForTransaction ( contract . transaction_hash ) ;
334
243
console . log ( "Contract Address: " . green , contract . address , "\n\n" ) ;
335
- descriptor_custom_data_addresses . push ( contract . address )
336
244
337
245
return contract . address
338
246
}
@@ -341,9 +249,20 @@ export const deployDescriptorCustom = async () => {
341
249
342
250
function whitelist_merkle_roots ( ) {
343
251
return [
344
- 0x3a5f886e952da36285158c8e9e2cec6d4d17d1271cbb66d6c770bc0ea795025n , // tier 1
345
- 0x7355045c69306c4f0aa9b82ec8fe14cedc41f4e1ecf632f159d416d89b30a7n , // tier 2
346
- 0x5ae7c1084891066205bff66d47382b55de150e9e7f8807e76e33cc65b7e8a23n , // tier 3
347
- 0xe124d0eba590a8049e8a1107799a3ed7253f0eaa4c2c1d1e6927969dc1069dn , // tier 4
252
+ BigInt ( merkle_data [ "1" ] [ "root" ] ) ,
253
+ BigInt ( merkle_data [ "2" ] [ "root" ] ) ,
254
+ BigInt ( merkle_data [ "3" ] [ "root" ] ) ,
255
+ BigInt ( merkle_data [ "4" ] [ "root" ] ) ,
348
256
]
257
+ }
258
+
259
+
260
+ const addArrayToCalldata = ( calldata , arr ) => {
261
+
262
+ calldata . push ( arr . length )
263
+ for ( let j = 0 ; j < arr . length ; j ++ ) {
264
+ calldata . push ( arr [ j ] ) ;
265
+ }
266
+
267
+ return calldata
349
268
}
0 commit comments