Skip to content

Commit

Permalink
Merge branch 'master' into audit-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaro authored Apr 22, 2022
2 parents 2bbb15b + de2b51c commit cbe4172
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 18 deletions.
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,25 @@ npm test
npm run migrate
```

## Current deployment (ethereum Görli and polygon Mumbai testnets)
## MainNet deployment

Registry smart contract:
- Polygon [0x87F0F4b7e0FAb14A565C87BAbbA6c40c92281b51](https://polygonscan.com/address/0x87F0F4b7e0FAb14A565C87BAbbA6c40c92281b51)
- Ethereum [0x87F0F4b7e0FAb14A565C87BAbbA6c40c92281b51](https://etherscan.io/address/0x87f0f4b7e0fab14a565c87babba6c40c92281b51)

Hermes smart contract
- V1 on Polygon [0xa62a2A75949d25e17C6F08a7818e7bE97c18a8d2](https://polygonscan.com/address/0xa62a2a75949d25e17c6f08a7818e7be97c18a8d2)
- V1 on Ethereum [0xa62a2A75949d25e17C6F08a7818e7bE97c18a8d2](https://etherscan.io/address/0xa62a2A75949d25e17C6F08a7818e7bE97c18a8d2)
- V2 on Polygon [0xDe82990405aCc36B4Fd53c94A24D1010fcc1F83d](https://polygonscan.com/address/0xDe82990405aCc36B4Fd53c94A24D1010fcc1F83d)


Implementation addresses:
- Hermes implementation address (same on both networks): `0x213a1B1d08F2715aE054ade98DEEd8a8F1cc937E`
- Channel implementation address (Polygon): `0x25882f4966065ca13b7bac15cc48391d9a4124f6`
- Channel implementation v2 address (Polygon): `0x813d3A0ef42FD4F25F2854811A64D5842EF3F8D1`
- Channel implementation address (Ethereum): `0xBd20839B331A7A8d10e34CDf7219edf334814c4f`

## Testnet3 deployment (ethereum Görli and polygon Mumbai testnets)

MYSTT test token:
- on Görli: [0xf74a5ca65E4552CfF0f13b116113cCb493c580C5](https://goerli.etherscan.io/address/0xf74a5ca65E4552CfF0f13b116113cCb493c580C5)
Expand All @@ -56,23 +74,6 @@ Implementation addresses:
- Channel implementation address (Mumbai): `0xf8982Ba93D3d9182D095B892DE2A7963eF9807ee`


## MainNet beta deployment

Registry smart contract:
- Polygon [0x87F0F4b7e0FAb14A565C87BAbbA6c40c92281b51](https://polygonscan.com/address/0x87F0F4b7e0FAb14A565C87BAbbA6c40c92281b51)
- Ethereum [0x87F0F4b7e0FAb14A565C87BAbbA6c40c92281b51](https://etherscan.io/address/0x87f0f4b7e0fab14a565c87babba6c40c92281b51)

Hermes smart contract
- Polygon [0xa62a2A75949d25e17C6F08a7818e7bE97c18a8d2](https://polygonscan.com/address/0xa62a2a75949d25e17c6f08a7818e7be97c18a8d2)
- Ethereum [0xa62a2A75949d25e17C6F08a7818e7bE97c18a8d2](https://etherscan.io/address/0xa62a2A75949d25e17C6F08a7818e7bE97c18a8d2)


Implementation addresses:
- Hermes implementation address (same on both networks): `0x213a1B1d08F2715aE054ade98DEEd8a8F1cc937E`
- Channel implementation address (Polygon): `0x25882f4966065ca13b7bac15cc48391d9a4124f6`
- Channel implementation address (Ethereum): `0xBd20839B331A7A8d10e34CDf7219edf334814c4f`


## Building golang bindings

To be able easily call these smart contract out of any software writen in Go you need to generate golang bindings and import [`payments`](https://github.com/mysteriumnetwork/payments) package into your software.
Expand Down
52 changes: 52 additions & 0 deletions migrations/3_upgrade_consumer_channel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const { BN } = require('web3-utils')

const MystToken = artifacts.require("MystToken")
const Registry = artifacts.require("Registry")
const ChannelImplementation = artifacts.require("ChannelImplementation")
const HermesImplementation = artifacts.require("HermesImplementation")

const tokenAddr = {
mumbai: '0xB923b52b60E247E34f9afE6B3fa5aCcBAea829E8',
goerli: '0xf74a5ca65E4552CfF0f13b116113cCb493c580C5',
polygon: '0x1379e8886a944d2d9d440b3d88df536aea08d9f3',
ethereum: '0x4cf89ca06ad997bc732dc876ed2a7f26a9e7f361'
}

// Hermes operator is signing hermes payment promises. Change it before actual deployment.
const HERMES_OPERATOR = '0x133cd135ebfaaf074c0068edefb1ca6d22112490'
const MEGA_OWNER = '0xC6b139344239b9E33F8dec27DE5Bd7E2a45F0374'

const deployNewImplementation = false
module.exports = async function (deployer, network, accounts) {
const account = accounts[0]

if (deployNewImplementation) {
// Deploy Channel implementation into blockchain
await deployer.deploy(ChannelImplementation, { from: account })

const tokenAddress = tokenAddr[network]
const registryAddress = '0x87F0F4b7e0FAb14A565C87BAbbA6c40c92281b51'
const hermesImplementationAddress = '0x213a1B1d08F2715aE054ade98DEEd8a8F1cc937E'
const hermesOperator = HERMES_OPERATOR
const token = await MystToken.at(tokenAddress)
const registry = await Registry.at(registryAddress)

// Set new channel implementation
await registry.setImplementations(ChannelImplementation.address, hermesImplementationAddress)

// Register new hermes
const hermesStake = web3.utils.toWei(new BN('1000'), 'ether') // 1000 tokens
const hermesFee = 2000 // 20.00%
const minChannelStake = web3.utils.toWei(new BN('0'), 'ether') // 0 token
const maxChannelStake = web3.utils.toWei(new BN('100'), 'ether') // 100 tokens
const url = Buffer.from('68747470733a2f2f6865726d6573322e6d797374657269756d2e6e6574776f726b2f', 'hex') // https://hermes2.mysterium.network/
await token.approve(registryAddress, hermesStake, { from: account })
await registry.registerHermes(hermesOperator, hermesStake, hermesFee, minChannelStake, maxChannelStake, url, { from: account })
const hermesAddress = await registry.getHermesAddress(hermesOperator)
console.log('HermesID: ', hermesAddress)

// Set hermes owner
const hermes = await HermesImplementation.at(hermesAddress)
await hermes.transferOwnership(MEGA_OWNER, { from: account })
}
}

0 comments on commit cbe4172

Please sign in to comment.