diff --git a/src/App.js b/src/App.js index eb87834..3d27764 100644 --- a/src/App.js +++ b/src/App.js @@ -6,6 +6,7 @@ import swal from 'sweetalert'; import './index/index.css'; import ReactDOM from 'react-dom'; import { error } from 'util'; +import addressGenerator from './addressGenerator' function generateElement(msg){ let errorNode = document.createElement("div"); @@ -55,6 +56,25 @@ class App extends Component { } }) } + componentDidMount(){ + if(window.location.hash.indexOf('just-generate-keys') !== -1) { + this.generateKeys(); + } + } + async generateKeys() { + const mining = await addressGenerator(); + const voting = await addressGenerator(); + const payout = await addressGenerator(); + this.setState({ + mining, + voting, + payout, + keysGenerated: true + }) + return { + mining, voting, payout + } + } async onClick() { this.setState({loading:true}); const initialKey = window.web3.eth.defaultAccount; @@ -74,15 +94,7 @@ class App extends Component { return; } if(Number(isValid) === 1){ - const mining = await this.keysManager.generateKeys(); - const voting = await this.keysManager.generateKeys(); - const payout = await this.keysManager.generateKeys(); - this.setState({ - mining, - voting, - payout, - keysGenerated: true - }) + const {mining, voting, payout} = await this.generateKeys() // add loading screen await this.keysManager.createKeys({ mining: mining.jsonStore.address, diff --git a/src/addresses.js b/src/addresses.js index 7b99b33..222fefd 100644 --- a/src/addresses.js +++ b/src/addresses.js @@ -1,16 +1,16 @@ const CORE_ADDRESSES = { - KEYS_MANAGER_ADDRESS: '0xfc90125492e58dbfe80c0bfb6a2a759c4f703ca8', + KEYS_MANAGER_ADDRESS: "0xfc90125492e58dbfe80c0bfb6a2a759c4f703ca8", } const SOKOL_ADDRESSES = { - KEYS_MANAGER_ADDRESS: '0x88a34124bfffa27ef3e052c8dd2908e212643771', + KEYS_MANAGER_ADDRESS: "0xD480319659AFe5044FB09e2B92d10c987044DE4B", } module.exports = (netId) => { switch (netId){ case '77': return SOKOL_ADDRESSES - case '99': + case '99': return CORE_ADDRESSES default: return CORE_ADDRESSES diff --git a/src/keysManagerAbi.json b/src/keysManagerAbi.json index 9986ded..18cb54f 100644 --- a/src/keysManagerAbi.json +++ b/src/keysManagerAbi.json @@ -1,4 +1,23 @@ [ + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "successfulValidatorClone", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ @@ -50,7 +69,7 @@ "constant": true, "inputs": [ { - "name": "_miningKey", + "name": "_votingKey", "type": "address" } ], @@ -175,6 +194,20 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "previousKeysManager", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [ @@ -296,6 +329,20 @@ "stateMutability": "view", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "name": "_miningKey", + "type": "address" + } + ], + "name": "migrateMiningKey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": false, "inputs": [ @@ -328,6 +375,20 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "name": "_initialKey", + "type": "address" + } + ], + "name": "migrateInitialKey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [ @@ -347,6 +408,20 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "contractVersion", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": true, "inputs": [ @@ -550,6 +625,10 @@ { "name": "_masterOfCeremony", "type": "address" + }, + { + "name": "_previousKeysManager", + "type": "address" } ], "payable": false, @@ -660,5 +739,22 @@ ], "name": "InitialKeyCreated", "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "key", + "type": "address" + } + ], + "name": "Migrated", + "type": "event" } ] \ No newline at end of file