Merge pull request #57 from rstormsf/core

(Update) KeysManager address for sokol testnet
This commit is contained in:
Roman Storm 2018-01-09 17:08:32 -08:00 committed by GitHub
commit 8b6bd93e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 121 additions and 13 deletions

View File

@ -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,

View File

@ -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

View File

@ -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"
}
]