Skip to content

Commit

Permalink
Deployed one more hermes sc
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed May 3, 2022
1 parent 7d3531a commit 0a360b1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ 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)
- V3 on Polygon [0x80ed28d84792d8b153bf2f25f0c4b7a1381de4ab](https://polygonscan.com/address/0x80ed28d84792d8b153bf2f25f0c4b7a1381de4ab)


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

## Testnet3 deployment (ethereum Görli and polygon Mumbai testnets)
Expand Down
24 changes: 16 additions & 8 deletions migrations/3_upgrade_consumer_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const MystToken = artifacts.require("MystToken")
const Registry = artifacts.require("Registry")
const ChannelImplementation = artifacts.require("ChannelImplementation")
const HermesImplementation = artifacts.require("HermesImplementation")
const deployRegistry = require("../scripts/deployRegistry")

const tokenAddr = {
mumbai: '0xB923b52b60E247E34f9afE6B3fa5aCcBAea829E8',
Expand All @@ -13,20 +14,26 @@ const tokenAddr = {
}

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

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

if (deployNewImplementation) {
// Deploy Channel implementation into blockchain
// Deploy Channel and Hermes implementations into blockchain
await deployer.deploy(ChannelImplementation, { from: account })
console.log(' :> ChannelImplementation:', ChannelImplementation.address)

await deployer.deploy(HermesImplementation, { from: account })
console.log(' :> HermesImplementation:', HermesImplementation.address)

const tokenAddress = tokenAddr[network]
const registryAddress = '0x87F0F4b7e0FAb14A565C87BAbbA6c40c92281b51'
const hermesImplementationAddress = '0x213a1B1d08F2715aE054ade98DEEd8a8F1cc937E'
const [registryAddress, _] = await deployRegistry(web3, account)
const channelImplementationAddress = ChannelImplementation.address
const hermesImplementationAddress = HermesImplementation.address

const hermesOperator = HERMES_OPERATOR
const token = await MystToken.at(tokenAddress)
const registry = await Registry.at(registryAddress)
Expand All @@ -35,11 +42,12 @@ module.exports = async function (deployer, network, accounts) {
await registry.setImplementations(ChannelImplementation.address, hermesImplementationAddress)

// Register new hermes
const hermesStake = web3.utils.toWei(new BN('1000'), 'ether') // 1000 tokens
const hermesStake = web3.utils.toWei(new BN('500'), 'ether') // 500 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/
const url = Buffer.from('68747470733a2f2f6865726d6573332e6d797374657269756d2e6e6574776f726b2f', 'hex') // https://hermes3.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)
Expand Down

0 comments on commit 0a360b1

Please sign in to comment.