Skip to content

Commit 0b51ee4

Browse files
timoxleysamt1803
andauthored
Deploy Marketplace to Docker sidechain. (#221)
* Deploy Marketplace to Docker sidechain. * fix: wrong parameter in index script; don't restart on failure * fix: use ethers5 from hardhat to deploy marketplace to sidechain * lint: fix lint error * Add development.streamr.contracts.Marketplace * Add trusted role to sidechain devops user. Related: ETH-257 * Fix redeclaration. * change order a bit so that Streamstorage contract address does not change; updated logfile with current output (for address verification) Co-authored-by: Christoph-Samuel Pitter <[email protected]>
1 parent 91cea6e commit 0b51ee4

File tree

3 files changed

+1165
-1141
lines changed

3 files changed

+1165
-1141
lines changed

packages/docker-dev-chain-init/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ WORKDIR /
2424
RUN node --version
2525
RUN npm --version
2626
COPY ./ ./
27-
RUN npm i
27+
RUN npm ci
2828
ENV DEBUG=*
2929
RUN npm run build -w=docker-dev-chain-init
3030
CMD npm run preload -w=docker-dev-chain-init && ./packages/docker-dev-chain-init/bridge/deploy_bridge_and_du2.sh

packages/docker-dev-chain-init/index.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const chainlinkNodeAddress = '0x7b5F1610920d5BAf00D684929272213BaF962eFe'
104104
const chainlinkJobId = 'c99333d032ed4cb8967b956c7f0329b5'
105105
let nodeRegistryAddress = ''
106106
let streamRegistryAddress = ''
107+
let streamRegistryFromOwner
107108

108109
async function getProducts() {
109110
// return await (await fetch(`${streamrUrl}/api/v1/products?publicAccess=true`)).json()
@@ -258,14 +259,15 @@ async function deployStreamRegistries() {
258259
kind: 'uups'
259260
})
260261
const streamRegistry = await streamRegistryFactoryTx.deployed()
262+
streamRegistryFromOwner = streamRegistry
261263
streamRegistryAddress = streamRegistry.address
262264
log(`Streamregistry deployed at ${streamRegistry.address}`)
263-
265+
264266
log(`setting Streamregistry address in ENSCache`)
265267
const setStreamRegTx = await ensCache.setStreamRegistry(streamRegistry.address)
266268
await setStreamRegTx.wait()
267269
log(`setting enscache address as trusted role in streamregistry`)
268-
270+
269271
const ensa = ensCache.address
270272
const role = await streamRegistry.TRUSTED_ROLE()
271273
log(`granting role ${role} ensaddress ${ensa}`)
@@ -283,6 +285,7 @@ async function deployStreamRegistries() {
283285
await tx1.wait()
284286
const tx2 = await streamRegistry2.setPublicPermission(storageNodeAssignmentsStreamId, MaxUint256, MaxUint256, { gasLimit: 5999990 })
285287
await tx2.wait()
288+
286289
}
287290

288291
async function smartContractInitialization() {
@@ -526,6 +529,24 @@ async function smartContractInitialization() {
526529
}
527530

528531
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+
529550
//put additions here
530551

531552
//all TXs should now be confirmed:
@@ -544,12 +565,12 @@ async function smartContractInitialization() {
544565
if (p.pricePerSecond == 0) {
545566
continue
546567
}
547-
console.log(`create ${p.id}`)
568+
log(`create ${p.id}`)
548569
const tx = await market.createProduct(`0x${p.id}`, p.name, wallet.address, p.pricePerSecond,
549570
p.priceCurrency == "DATA" ? 0 : 1, p.minimumSubscriptionInSeconds)
550571
//await tx.wait(1)
551572
if (p.state == "NOT_DEPLOYED") {
552-
console.log(`delete ${p.id}`)
573+
log(`delete ${p.id}`)
553574
await tx.wait(1)
554575
await market.deleteProduct(`0x${p.id}`)
555576
//await tx2.wait(1)

0 commit comments

Comments
 (0)