Merge pull request #194 from varasev/RewardByBlock-item
(Feature) Add `RewardByBlock` item to drop-down list on the page `Modify Proxy Contract Ballot` for Sokol network
This commit is contained in:
commit
51d663a476
|
@ -87,7 +87,7 @@ class App extends Component {
|
||||||
|
|
||||||
getNetIdClass() {
|
getNetIdClass() {
|
||||||
const { netId } = this.props.contractsStore
|
const { netId } = this.props.contractsStore
|
||||||
return netId in constants.NETWORKS && constants.NETWORKS[netId].TESTNET ? 'sokol' : ''
|
return netId in constants.NETWORKS && constants.NETWORKS[netId].TESTNET ? constants.SOKOL : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
isNewBallotPage() {
|
isNewBallotPage() {
|
||||||
|
|
|
@ -72,7 +72,7 @@ export class BallotEmissionFundsMetadata extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { ballotStore, contractsStore, networkBranch } = this.props
|
const { ballotStore, contractsStore, networkBranch } = this.props
|
||||||
let note, explorerLink
|
let note
|
||||||
|
|
||||||
if (this.noActiveBallotExists === true) {
|
if (this.noActiveBallotExists === true) {
|
||||||
note = (
|
note = (
|
||||||
|
@ -85,11 +85,8 @@ export class BallotEmissionFundsMetadata extends React.Component {
|
||||||
note = <p>To be able to create a new ballot, the previous ballot of this type must be finalized.</p>
|
note = <p>To be able to create a new ballot, the previous ballot of this type must be finalized.</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (constants.NETWORKS[contractsStore.netId].NAME.toLowerCase() === 'sokol') {
|
const networkName = constants.NETWORKS[contractsStore.netId].NAME.toLowerCase()
|
||||||
explorerLink = `https://sokol.poaexplorer.com/address/search/${contractsStore.emissionFunds.address}`
|
const explorerLink = `https://blockscout.com/poa/${networkName}/address/${contractsStore.emissionFunds.address}`
|
||||||
} else {
|
|
||||||
explorerLink = `https://poaexplorer.com/address/${contractsStore.emissionFunds.address}`
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="frm-BallotEmissionFundsMetadata">
|
<div className="frm-BallotEmissionFundsMetadata">
|
||||||
|
|
|
@ -2,6 +2,8 @@ import React from 'react'
|
||||||
import { FormInput } from '../FormInput'
|
import { FormInput } from '../FormInput'
|
||||||
import { FormSelect } from '../FormSelect'
|
import { FormSelect } from '../FormSelect'
|
||||||
import { inject, observer } from 'mobx-react'
|
import { inject, observer } from 'mobx-react'
|
||||||
|
import { constants } from '../../utils/constants'
|
||||||
|
import { getNetworkName } from '../../utils/utils'
|
||||||
|
|
||||||
@inject('ballotStore', 'contractsStore')
|
@inject('ballotStore', 'contractsStore')
|
||||||
@observer
|
@observer
|
||||||
|
@ -16,11 +18,12 @@ export class BallotProxyMetadata extends React.Component {
|
||||||
/*4*/ { value: '4', label: ballotStore.ProxyBallotType[4] }, // VotingToChangeProxy
|
/*4*/ { value: '4', label: ballotStore.ProxyBallotType[4] }, // VotingToChangeProxy
|
||||||
/*5*/ { value: '5', label: ballotStore.ProxyBallotType[5] }, // BallotsStorage
|
/*5*/ { value: '5', label: ballotStore.ProxyBallotType[5] }, // BallotsStorage
|
||||||
/*6*/ { value: '7', label: ballotStore.ProxyBallotType[7] }, // ValidatorMetadata
|
/*6*/ { value: '7', label: ballotStore.ProxyBallotType[7] }, // ValidatorMetadata
|
||||||
/*7*/ { value: '8', label: ballotStore.ProxyBallotType[8] } // ProxyStorage
|
/*7*/ { value: '8', label: ballotStore.ProxyBallotType[8] }, // ProxyStorage
|
||||||
|
/*8*/ { value: '9', label: ballotStore.ProxyBallotType[9] } // RewardByBlock
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!contractsStore.proxyStorage || !contractsStore.proxyStorage.doesMethodExist('getValidatorMetadata')) {
|
if (getNetworkName(contractsStore.netId).toLowerCase() !== constants.SOKOL) {
|
||||||
options.splice(6) // keep 0-5 and remove 6-... items if ProxyStorage is old
|
options.splice(8) // keep 0-7 items and remove 8th if the network is not Sokol
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -2,15 +2,14 @@ import React from 'react'
|
||||||
import { LogoPOA } from '../LogoPOA'
|
import { LogoPOA } from '../LogoPOA'
|
||||||
import { LogoSokol } from '../LogoSokol'
|
import { LogoSokol } from '../LogoSokol'
|
||||||
import { LogoDai } from '../LogoDai'
|
import { LogoDai } from '../LogoDai'
|
||||||
|
import { constants } from '../../utils/constants'
|
||||||
|
|
||||||
export const Logo = ({ href = null, extraClass = '', networkBranch = '' }) => {
|
export const Logo = ({ href = null, extraClass = '', networkBranch = '' }) => {
|
||||||
switch (networkBranch) {
|
switch (networkBranch) {
|
||||||
case 'sokol':
|
case constants.SOKOL:
|
||||||
return <LogoSokol href={href} extraClass={extraClass} />
|
return <LogoSokol href={href} extraClass={extraClass} />
|
||||||
case 'dai':
|
case constants.DAI:
|
||||||
case 'dai-test':
|
|
||||||
return <LogoDai href={href} extraClass={extraClass} />
|
return <LogoDai href={href} extraClass={extraClass} />
|
||||||
case 'poa':
|
|
||||||
default:
|
default:
|
||||||
return <LogoPOA href={href} extraClass={extraClass} />
|
return <LogoPOA href={href} extraClass={extraClass} />
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class AppMainRouter extends Component {
|
||||||
]
|
]
|
||||||
|
|
||||||
const networkName = constants.NETWORKS[web3Config.netId].NAME.toLowerCase()
|
const networkName = constants.NETWORKS[web3Config.netId].NAME.toLowerCase()
|
||||||
if (networkName === 'core' || networkName === 'sokol') {
|
if (networkName === constants.CORE || networkName === constants.SOKOL) {
|
||||||
// if we're in Core or Sokol
|
// if we're in Core or Sokol
|
||||||
promises.push(contractsStore.setEmissionFunds(web3Config))
|
promises.push(contractsStore.setEmissionFunds(web3Config))
|
||||||
promises.push(contractsStore.setVotingToManageEmissionFunds(web3Config))
|
promises.push(contractsStore.setVotingToManageEmissionFunds(web3Config))
|
||||||
|
|
|
@ -26,7 +26,8 @@ class BallotStore {
|
||||||
4: 'VotingToChangeProxy',
|
4: 'VotingToChangeProxy',
|
||||||
5: 'BallotsStorage',
|
5: 'BallotsStorage',
|
||||||
7: 'ValidatorMetadata',
|
7: 'ValidatorMetadata',
|
||||||
8: 'ProxyStorage'
|
8: 'ProxyStorage',
|
||||||
|
9: 'RewardByBlock'
|
||||||
}
|
}
|
||||||
@observable ballotType
|
@observable ballotType
|
||||||
@observable keysBallotType
|
@observable keysBallotType
|
||||||
|
|
|
@ -51,29 +51,27 @@ constants.navigationData = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
constants.SOKOL = 'sokol'
|
||||||
|
constants.CORE = 'core'
|
||||||
|
constants.DAI = 'dai'
|
||||||
|
|
||||||
constants.NETWORKS = {
|
constants.NETWORKS = {
|
||||||
'77': {
|
'77': {
|
||||||
NAME: 'Sokol',
|
NAME: 'Sokol',
|
||||||
RPC: 'https://sokol.poa.network',
|
RPC: 'https://sokol.poa.network',
|
||||||
BRANCH: 'sokol',
|
BRANCH: constants.SOKOL,
|
||||||
TESTNET: true
|
TESTNET: true
|
||||||
},
|
},
|
||||||
'99': {
|
'99': {
|
||||||
NAME: 'Core',
|
NAME: 'Core',
|
||||||
RPC: 'https://core.poa.network',
|
RPC: 'https://core.poa.network',
|
||||||
BRANCH: 'core',
|
BRANCH: constants.CORE,
|
||||||
TESTNET: false
|
TESTNET: false
|
||||||
},
|
},
|
||||||
'79': {
|
|
||||||
NAME: 'Dai-Test',
|
|
||||||
RPC: 'https://dai-test.poa.network',
|
|
||||||
BRANCH: 'dai-test',
|
|
||||||
TESTNET: true
|
|
||||||
},
|
|
||||||
'100': {
|
'100': {
|
||||||
NAME: 'Dai',
|
NAME: 'Dai',
|
||||||
RPC: 'https://dai.poa.network',
|
RPC: 'https://dai.poa.network',
|
||||||
BRANCH: 'dai',
|
BRANCH: constants.DAI,
|
||||||
TESTNET: false
|
TESTNET: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ let getWeb3 = () => {
|
||||||
console.log('No web3 instance injected, using Local web3.')
|
console.log('No web3 instance injected, using Local web3.')
|
||||||
console.error('Metamask not found')
|
console.error('Metamask not found')
|
||||||
|
|
||||||
netId = netIdByName('core')
|
netId = netIdByName(constants.CORE)
|
||||||
|
|
||||||
const network = constants.NETWORKS[netId]
|
const network = constants.NETWORKS[netId]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue