diff --git a/README.md b/README.md index 249279b..0066cf9 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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. diff --git a/migrations/3_upgrade_consumer_channel.js b/migrations/3_upgrade_consumer_channel.js new file mode 100644 index 0000000..018f35c --- /dev/null +++ b/migrations/3_upgrade_consumer_channel.js @@ -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 }) + } +}