Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release-0.3-3' into validator-share-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkanani committed Aug 27, 2020
2 parents 1f89961 + d8bcac6 commit 692e532
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: CI

on:
push:
branches:
branches:
- develop
- master
- release-0.3-3
pull_request:
branches:
- develop
- master

jobs:
build:
Expand Down
59 changes: 59 additions & 0 deletions scripts/update-slots.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const ethUtils = require('ethereumjs-util')

const contractAddresses = require('../contractAddresses.json')

const Registry = artifacts.require('Registry')
const Governance = artifacts.require('Governance')
const StakeManager = artifacts.require('StakeManager')

function getRegistry() {
return Registry.at(contractAddresses.root.Registry)
}

function getGovernance() {
return Governance.at(contractAddresses.root.GovernanceProxy)
}

async function getStakeManager() {
return StakeManager.at(contractAddresses.root.StakeManagerProxy)
}

async function updateSlot(n) {
const registry = await getRegistry()
const governance = await getGovernance()
const stakeManager = await getStakeManager()

let slots = await stakeManager.validatorThreshold()
console.log("Current slots", slots.toString())

const data = stakeManager.contract.methods.updateValidatorThreshold(n).encodeABI()
console.log("StakeManager ABI encoded data:", data)

const receipt = await governance.update(
stakeManager.address,
data
)
console.log("Tx hash:", receipt.tx)

slots = await stakeManager.validatorThreshold()
console.log("Updated slots", slots.toString())
}


module.exports = async function (callback) {
// args starts with index 6, example: first arg == process.args[6]
console.log(process.argv)
try {
const accounts = await web3.eth.getAccounts()
console.log("Current configured address to make transactions:", accounts[0])

// set validator share address
// -- --network <network-name> <new-slot>
await updateSlot(process.argv[6])

} catch (e) {
// truffle exec <script> doesn't throw errors, so handling it in a verbose manner here
console.log(e)
}
callback()
}

0 comments on commit 692e532

Please sign in to comment.