@@ -104,6 +104,7 @@ const chainlinkNodeAddress = '0x7b5F1610920d5BAf00D684929272213BaF962eFe'
104
104
const chainlinkJobId = 'c99333d032ed4cb8967b956c7f0329b5'
105
105
let nodeRegistryAddress = ''
106
106
let streamRegistryAddress = ''
107
+ let streamRegistryFromOwner
107
108
108
109
async function getProducts ( ) {
109
110
// return await (await fetch(`${streamrUrl}/api/v1/products?publicAccess=true`)).json()
@@ -258,14 +259,15 @@ async function deployStreamRegistries() {
258
259
kind : 'uups'
259
260
} )
260
261
const streamRegistry = await streamRegistryFactoryTx . deployed ( )
262
+ streamRegistryFromOwner = streamRegistry
261
263
streamRegistryAddress = streamRegistry . address
262
264
log ( `Streamregistry deployed at ${ streamRegistry . address } ` )
263
-
265
+
264
266
log ( `setting Streamregistry address in ENSCache` )
265
267
const setStreamRegTx = await ensCache . setStreamRegistry ( streamRegistry . address )
266
268
await setStreamRegTx . wait ( )
267
269
log ( `setting enscache address as trusted role in streamregistry` )
268
-
270
+
269
271
const ensa = ensCache . address
270
272
const role = await streamRegistry . TRUSTED_ROLE ( )
271
273
log ( `granting role ${ role } ensaddress ${ ensa } ` )
@@ -283,6 +285,7 @@ async function deployStreamRegistries() {
283
285
await tx1 . wait ( )
284
286
const tx2 = await streamRegistry2 . setPublicPermission ( storageNodeAssignmentsStreamId , MaxUint256 , MaxUint256 , { gasLimit : 5999990 } )
285
287
await tx2 . wait ( )
288
+
286
289
}
287
290
288
291
async function smartContractInitialization ( ) {
@@ -526,6 +529,24 @@ async function smartContractInitialization() {
526
529
}
527
530
528
531
await deployStreamStorageRegistry ( sidechainWallet )
532
+
533
+ const newWallet = new ethers . Wallet ( privKeyStreamRegistry , new ethers . providers . JsonRpcProvider ( sidechainURL ) )
534
+ const marketDeployer3 = await ethers . getContractFactory ( Marketplace2Json . abi , Marketplace2Json . bytecode , newWallet )
535
+ const marketDeployTx3 = await marketDeployer3 . deploy (
536
+ sidechainDataCoin ,
537
+ sidechainWallet . address ,
538
+ '0x0000000000000000000000000000000000000000'
539
+ )
540
+ const market2 = await marketDeployTx3 . deployed ( )
541
+ log ( `Marketplace2 deployed on sidechain at ${ market2 . address } ` )
542
+
543
+ const watcherDevopsKey = '0x628acb12df34bb30a0b2f95ec2e6a743b386c5d4f63aa9f338bec6f613160e78'
544
+ const watcherWallet = new ethers . Wallet ( watcherDevopsKey )
545
+ const role = await streamRegistryFromOwner . TRUSTED_ROLE ( )
546
+ log ( `granting role ${ role } to devops ${ watcherWallet . address } ` )
547
+ const grantRoleTx2 = await streamRegistryFromOwner . grantRole ( role , watcherWallet . address )
548
+ await grantRoleTx2 . wait ( )
549
+
529
550
//put additions here
530
551
531
552
//all TXs should now be confirmed:
@@ -544,12 +565,12 @@ async function smartContractInitialization() {
544
565
if ( p . pricePerSecond == 0 ) {
545
566
continue
546
567
}
547
- console . log ( `create ${ p . id } ` )
568
+ log ( `create ${ p . id } ` )
548
569
const tx = await market . createProduct ( `0x${ p . id } ` , p . name , wallet . address , p . pricePerSecond ,
549
570
p . priceCurrency == "DATA" ? 0 : 1 , p . minimumSubscriptionInSeconds )
550
571
//await tx.wait(1)
551
572
if ( p . state == "NOT_DEPLOYED" ) {
552
- console . log ( `delete ${ p . id } ` )
573
+ log ( `delete ${ p . id } ` )
553
574
await tx . wait ( 1 )
554
575
await market . deleteProduct ( `0x${ p . id } ` )
555
576
//await tx2.wait(1)
0 commit comments