Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintrc

This file was deleted.

22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
env: {
commonjs: true,
es2021: true,
node: true
},
extends: [
'eslint-config-streamr-ts'
],
parserOptions: {
ecmaVersion: 12,
requireConfigFile: false
},
rules: {
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}],
},
parser: '@babel/eslint-parser'
}
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ RUN npm --version
COPY ./ ./
RUN npm ci --only=production
ENV DEBUG=*
CMD node index.js && ./bridge/deploy_bridge_and_du2.sh

# run deployments and combine their outputs (addresses) into config.json
CMD ./run.sh

46 changes: 1 addition & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,51 +25,7 @@ Private Keys:

## Dev docker addresses

This script generates the following Ethereum addresses:

### Dev "mainnet" (localhost:8545):
* DATAcoin address: 0xbAA81A0179015bE47Ad439566374F2Bae098686F
* Marketplace2 address: 0xF1371c0f40528406dc4f4cAf89924eA9Da49E866
* OTHERcoin address: 0x642D2B84A32A9A92FEc78CeAA9488388b3704898
* UniswapAdaptor address: 0xE4eA76e830a659282368cA2e7E4d18C4AE52D8B3
* UniswapFactory address: 0xd2D23b73A67208a90CBfEE1381415329954f54E2
* Tracker NodeRegistry: 0xBFCF120a8fD17670536f1B27D9737B775b2FD4CF
* ENS: 0x92E8435EB56fD01BF4C79B66d47AC1A94338BB03
* FIFSRegistrar for TLD (top level domain) 'eth': 0x57B81a9442805f88c4617B506206531e72d96290
* PublicResolver (reusable): 0xBc0c81a318D57ae54dA28DE69184A9c3aE9a1e1c
* Uniswap2 router: 0xeE1bC9a7BFF1fFD913f4c97B6177D47E804E1920
* Uniswap2Adapter: 0x0bADa0acE1d16ABf1ce1aAED9Bc7Ce231ECc35b5

Bridge related:
* foreign_amb: 0xaFA0dc5Ad21796C9106a36D68f69aAD69994BB64
* dedicated DATA foreign_erc_mediator: 0xedD2aa644a6843F2e5133Fe3d6BD3F4080d97D9F
* foreign omnibridge: 0x6346Ed242adE018Bd9320D5E3371c377BAB29c31
* foreign_erc20: 0xbAA81A0179015bE47Ad439566374F2Bae098686F

DataUnion related:
* foreign_du_factory: 0x4bbcBeFBEC587f6C4AF9AF9B48847caEa1Fe81dA


### Dev "xdai" (localhost:8546)
* Storage NodeRegistry: 0xbAA81A0179015bE47Ad439566374F2Bae098686F
* Uniswap2 router: 0xd2D23b73A67208a90CBfEE1381415329954f54E2
* BinanceAdapter: 0xdc5F6368cd31330adC259386e78604a5E29E9415
* StreamRegistry: 0xa86863053cECFD9f6f861e0Fd39a042238411b75
* Chainlink oracle: 0xD94D41F23F1D42C51Ab61685e5617BBC858e5871
* LINK token contract: 0x3387F44140ea19100232873a5aAf9E46608c791E
* ENScache: 0xD1d514082ED630687a5DCB85406130eD0745fA06
* Stream Storage Registry: 0xE4eA76e830a659282368cA2e7E4d18C4AE52D8B3

Bridge related:
* home_amb: 0xaFA0dc5Ad21796C9106a36D68f69aAD69994BB64
* home_erc677: 0x73Be21733CC5D08e1a14Ea9a399fb27DB3BEf8fF
* dedicated DATA home_erc_mediator: 0xedD2aa644a6843F2e5133Fe3d6BD3F4080d97D9F
* home omnibridge: 0x41B89Db86BE735c03A9296437E39F5FDAdC4c678

DataUnion related:
* home_du_factory: 0x4A4c4759eb3b7ABee079f832850cD3D0dC48D927


The contract addresses generated by these scripts are written into [config.json].
## Running

smart-contracts-init container is no longer part of streamr-docker-dev. Instead we use the docker-compose.yml file here to build the preloaded parity images
Expand Down
9 changes: 8 additions & 1 deletion bridge/deploy_bridge_and_du2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CONTRACTS=streamr/tokenbridge-contracts

AMBRESULTS="bridgeDeploymentResultsAMB.json"
ERC677RESULTS="bridgeDeploymentResultsERC677.json"
OMNIBRIDGERESULTS="bridgeDeploymentResultsOmnibridge.json"

echo "1. Deploying AMB"
TASK=amb
Expand Down Expand Up @@ -39,8 +40,14 @@ CONTRACTS=poanetwork/omnibridge
TASK=omnibridge
ENV="-e HOME_AMB_BRIDGE=$HOME_AMB_BRIDGE -e FOREIGN_AMB_BRIDGE=$FOREIGN_AMB_BRIDGE"
docker run --name $TASK $ENV --env-file omnibridgeMediator.env $CONTRACTS deploy.sh
docker cp $TASK:/contracts/deploy/bridgeDeploymentResults.json $ERC677RESULTS
docker cp $TASK:/contracts/deploy/bridgeDeploymentResults.json $OMNIBRIDGERESULTS
docker rm $TASK

# TODO: the following set env vars to empty because $OMNIBRIDGERESULTS is empty
# reason is probably that /contracts/deploy/bridgeDeploymentResults.json isn't where expected
# need to investigate what the poanetwork/omnibridge deploy.sh produces
export FOREIGN_OMNIBRIDGE=`jq -r .foreignBridge.foreignBridgeMediator.address` < $OMNIBRIDGERESULTS
export HOME_OMNIBRIDGE=`jq -r .homeBridge.homeBridgeMediator.address` < $OMNIBRIDGERESULTS

echo "3. Deploying DataUnion and Factory Contracts"
node ../deploy_du2_factories.js
25 changes: 25 additions & 0 deletions deploy_du2_factories.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const fs = require("fs")

const {
ContractFactory,
Wallet,
Expand Down Expand Up @@ -81,6 +83,29 @@ async function deployDUFactories(){
let factMainnet = await dtx.deployed()
console.log(`factMainnet: ${factMainnet.address}`)

fs.writeFileSync("du-addresses.json", JSON.stringify({
mainnet: {
dataUnionFactory: factMainnet.address,
dataUnionTemplate: duforeign.address,
tokenMigrator: mainnetMigrationMgr.address,

// env variables that are set in deploy_bridge_and_du2.sh
tokenMediator: process.env.FOREIGN_ERC677_MEDIATOR,
amb: process.env.FOREIGN_AMB_BRIDGE,
omnibridge: process.env.FOREIGN_OMNIBRIDGE,
},
xdai: {
dataUnionFactory: factSidechain.address,
dataUnionTemplate: duhome.address,
tokenMigrator: sidechainMigrationMgr.address,

// env variables that are set in deploy_bridge_and_du2.sh
token: process.env.HOME_ERC677,
tokenMediator: process.env.HOME_ERC677_MEDIATOR,
amb: process.env.HOME_AMB_BRIDGE,
omnibridge: process.env.HOME_OMNIBRIDGE,
}
}))
}

async function start() {
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ services:
CHAIN_URL: http://10.200.10.1:8545
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./output:/output
Loading