diff --git a/src/@core/scss/base/bootstrap-extended/_progress.scss b/src/@core/scss/base/bootstrap-extended/_progress.scss index 3c2956d7..3abd8c31 100644 --- a/src/@core/scss/base/bootstrap-extended/_progress.scss +++ b/src/@core/scss/base/bootstrap-extended/_progress.scss @@ -22,3 +22,28 @@ .progress { border-radius: 3px; } + + +.scale { + width: 100%; + height: 3em; + position: relative; + /* margin: 30px; // */ +} +.box { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + padding-top: 0.5em; + /* opacity: 0.7; /**/ + background: transparent; +} +.overlay { + z-index: 9; + width: 2px; + border-right-color: green; + border-right-width: 2px; + border-right-style: dotted; +} diff --git a/src/chains/mainnet/rebus.json b/src/chains/mainnet/rebus.json index 8fcb3247..7f55e439 100644 --- a/src/chains/mainnet/rebus.json +++ b/src/chains/mainnet/rebus.json @@ -1,7 +1,7 @@ { "chain_name": "rebus", - "api": ["https://api.mainnet.rebus.money:1317"], - "rpc": ["https://api.mainnet.rebus.money:26657"], + "api": ["https://api.mainnet.rebus.money:1317","https://api.rebus.nodestake.top"], + "rpc": ["https://api.mainnet.rebus.money:26657","https://rpc.rebus.nodestake.top"], "snapshot_provider": "", "sdk_version": "0.45.6", "coin_type": "118", @@ -17,4 +17,4 @@ "logo": "/logos/rebus.png" } ] -} \ No newline at end of file +} diff --git a/src/chains/mainnet/secret.json b/src/chains/mainnet/secret.json index b4147458..67f67208 100644 --- a/src/chains/mainnet/secret.json +++ b/src/chains/mainnet/secret.json @@ -1,8 +1,8 @@ { "chain_name": "secret", "coingecko": "secret", - "api": ["https://api.roninventures.io","https://api.scrt.network"], - "rpc": ["http://beta-api.scrt.network:26657", "https://api.scrt.network:443"], + "api": ["https://secretnetwork-lcd.stakely.io", "https://secret.api.consensus.one", "https://secret-4.api.trivium.network:1317"], + "rpc": ["https://secretnetwork-rpc.stakely.io", "https://secret.rpc.consensus.one", "https://secret-4.api.trivium.network:26657"], "snapshot_provider": "", "sdk_version": "0.45.4", "coin_type": "529", diff --git a/src/chains/mainnet/teritori.json b/src/chains/mainnet/teritori.json index 29474faf..ebb12292 100644 --- a/src/chains/mainnet/teritori.json +++ b/src/chains/mainnet/teritori.json @@ -1,7 +1,7 @@ { "chain_name": "teritori", - "api": ["https://rest.mainnet.teritori.com"], - "rpc": ["https://rpc.mainnet.teritori.com"], + "api": ["https://rest.mainnet.teritori.com","https://api.teritori.nodestake.top"], + "rpc": ["https://rpc.mainnet.teritori.com","https://rpc.teritori.nodestake.top"], "snapshot_provider": "", "sdk_version": "0.45.4", "coin_type": "118", @@ -17,4 +17,4 @@ "logo": "/logos/teritori.svg" } ] -} \ No newline at end of file +} diff --git a/src/layouts/components/Navbar.vue b/src/layouts/components/Navbar.vue index 492a1b86..20b2c4ee 100644 --- a/src/layouts/components/Navbar.vue +++ b/src/layouts/components/Navbar.vue @@ -84,9 +84,9 @@ - + - + Active Proposals - - - - {{ myVotes[prop.id] || 'Vote' }} - - - - -
- {{ prop.id }}. {{ prop.title }} -
- {{ formatType(prop.contents['@type']) }} {{ formatEnding(prop.voting_end_time) }} -
-
-
+ + + {{ prop.id }} + + + + +
+ + {{ formatType(prop.contents['@type']) }} + {{ prop.title }} +
+ will {{ caculateTallyResult(prop.tally) }} {{ formatEnding(prop.voting_end_time) }} +
+
+ + + + + +
+
+ + + + + + +
+
+
+
+ + {{ percent(prop.tally.yes) }}% voters voted Yes + + + {{ percent(prop.tally.no) }}% voters voted No + + + {{ percent(prop.tally.veto) }}% voters voted No With Veto + + + {{ percent(prop.tally.abstain) }}% voters voted Abstain + + + + + {{ myVotes[prop.id] ? `${myVotes[prop.id]}`: 'Vote' }} + + + + + + + + {{ addNewLine(prop.description) }} + + + +
No active proposal! @@ -133,7 +255,7 @@ bg-variant="transparent" class="shadow-none" > - + {{ walletName }} Assets import { BRow, BCol, BAlert, BCard, BTable, BFormCheckbox, BCardHeader, BCardTitle, BMedia, BMediaAside, BMediaBody, BAvatar, - BCardBody, BLink, BButtonGroup, BButton, BTooltip, VBModal, VBTooltip, BCardFooter, + BCardBody, BLink, BButtonGroup, BButton, BTooltip, VBModal, VBTooltip, BCardFooter, BProgress, BProgressBar, BBadge, } from 'bootstrap-vue' import { formatNumber, formatTokenAmount, isToken, percent, timeIn, toDay, toDuration, tokenFormatter, getLocalAccounts, @@ -352,6 +474,7 @@ import { import OperationModal from '@/views/components/OperationModal/index.vue' import Ripple from 'vue-ripple-directive' import dayjs from 'dayjs' +import VueMarkdown from 'vue-markdown' import ParametersModuleComponent from './components/parameters/ParametersModuleComponent.vue' import DashboardCardHorizontal from './components/dashboard/DashboardCardHorizontal.vue' import DashboardCardVertical from './components/dashboard/DashboardCardVertical.vue' @@ -378,6 +501,10 @@ export default { BCardBody, BLink, BCardFooter, + BProgress, + BProgressBar, + VueMarkdown, + BBadge, OperationModal, ParametersModuleComponent, @@ -393,6 +520,7 @@ export default { }, data() { return { + detailId: 0, fields: ['validator', 'delegation', 'rewards', 'action'], delegations: [], rewards: [], @@ -414,6 +542,8 @@ export default { selectedProposalId: 0, selectedTitle: '', operationModalType: '', + tallyParam: null, + totalPower: 0, voteColors: { YES: 'success', NO: 'warning', @@ -461,9 +591,29 @@ export default { }, }, created() { - this.$http.getGovernanceListByStatus(2).then(res => { - this.proposals = res.proposals + this.$http.getStakingParameters().then(res => { + Promise.all([this.$http.getStakingPool(), this.$http.getBankTotal(res.bond_denom)]) + .then(pool => { + this.supply = `${formatNumber(formatTokenAmount(pool[1].amount, 2, res.bond_denom, false), true, 2)}` + this.bonded = `${formatNumber(formatTokenAmount(pool[0].bondedToken, 2, res.bond_denom, false), true, 2)}` + this.ratio = `${percent(pool[0].bondedToken / pool[1].amount)}%` + this.totalPower = pool[0].bondedToken + }) }) + + this.$http.getGovernanceListByStatus(2).then(gov => { + this.proposals = gov.proposals + this.proposals.forEach(p => { + this.$http.getGovernanceTally(p.id, 0).then(update => { + // const p2 = p + // p2.tally = update + // this.proposals.push(p2) + // this.proposals.sort((a, b) => a.id - b.id) + this.$set(p, 'tally', update) + }) + }) + }) + this.$http.getLatestBlock().then(res => { this.height = res.block.header.height if (timeIn(res.block.header.time, 3, 'm')) { @@ -475,19 +625,14 @@ export default { this.validators = res.block.last_commit.signatures.length }) - this.$http.getStakingParameters().then(res => { - Promise.all([this.$http.getStakingPool(), this.$http.getBankTotal(res.bond_denom)]) - .then(pool => { - this.supply = `${formatNumber(formatTokenAmount(pool[1].amount, 2, res.bond_denom, false), true, 2)}` - this.bonded = `${formatNumber(formatTokenAmount(pool[0].bondedToken, 2, res.bond_denom, false), true, 2)}` - this.ratio = `${percent(pool[0].bondedToken / pool[1].amount)}%` - }) - }) - this.$http.getCommunityPool().then(res => { this.communityPool = this.formatToken(res.pool) }) + this.$http.getGovernanceParameterTallying().then(res => { + this.tallyParam = res + }) + const conf = this.$http.getSelectedConfig() if (conf.excludes && conf.excludes.indexOf('mint') > -1) { this.inflation = '-' @@ -500,6 +645,22 @@ export default { } }, methods: { + caculateTallyResult(tally) { + if (this.tallyParam && tally && this.totalPower > 0) { + if (tally.veto < Number(this.tallyParam.veto_threshold) + && tally.yes > Number(this.tallyParam.threshold) + && tally.total / this.totalPower > Number(this.tallyParam.quorum)) { + return 'pass' + } + } + return 'be rejected' + }, + scaleWidth(p) { + if (this.tallyParam) { + return Number(this.tallyParam.quorum) * Number(this.tallyParam.threshold) * (1 - p.tally.abstain) * 100 + } + return 50 + }, selectProposal(modal, pid, title) { this.operationModalType = modal this.selectedProposalId = Number(pid) @@ -609,6 +770,13 @@ export default { return { title: this.convert(data[k]), subtitle: k } }) }, + addNewLine(value) { + return value ? value.replace(/(?:\\[rn])+/g, '\n') : '-' + }, + percent: v => percent(v), + processBarLength(v) { + return percent(v) + }, formatDate: v => dayjs(v).format('YYYY-MM-DD HH:mm:ss'), convert(v) { if (typeof v === 'object') { @@ -633,6 +801,13 @@ export default { } return v }, + showDetail(id) { + if (this.detailId !== id) { + this.detailId = id + } else { + this.detailId = 0 + } + }, }, } diff --git a/src/views/Governance.vue b/src/views/Governance.vue index e0b83a96..3333fd8a 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -7,7 +7,11 @@ lg="6" md="12" > - + @@ -64,9 +68,14 @@ export default { max: 1, operationModalType: '', next: '', + totalPower: 0, + tallyParam: null, } }, mounted() { + this.$http.getGovernanceParameterTallying().then(res => { + this.tallyParam = res + }) this.getList() }, methods: { @@ -81,9 +90,10 @@ export default { }, updateTally(res) { this.$http.getStakingPool().then(pool => { + this.totalPower = pool.bondedToken const voting = res.filter(i => i.status === 2) if (voting.length > 0) { - voting.forEach(p => this.$http.getGovernanceTally(p.id, pool.bondedToken).then(update => { + voting.forEach(p => this.$http.getGovernanceTally(p.id, 0).then(update => { this.$set(p, 'tally', update) })) } diff --git a/src/views/GovernanceProposalView.vue b/src/views/GovernanceProposalView.vue index 2ad5ddfa..ead05968 100644 --- a/src/views/GovernanceProposalView.vue +++ b/src/views/GovernanceProposalView.vue @@ -112,83 +112,95 @@ - - - - - - - - {{ percent(proposal.tally.yes) }}% voted Yes - - - {{ percent(proposal.tally.no) }}% voted No - - - {{ percent(proposal.tally.veto) }}% voted No With Veto - - - {{ percent(proposal.tally.abstain) }}% voted Abstain - - - - -
- - Load More Votes -
-
+
+
+
+ + + + + + + + {{ percent(proposal.tally.yes) }}% voted Yes + + + {{ percent(proposal.tally.no) }}% voted No + + + {{ percent(proposal.tally.veto) }}% voted No With Veto + + + {{ percent(proposal.tally.abstain) }}% voted Abstain + + +
+
+
+ + + +
+ + Load More Votes +
+
{ + this.tallyParam = res + }) const pid = this.$route.params.proposalid if (this.$route.query.from) { this.from = this.$route.query.from @@ -368,7 +385,8 @@ export default { this.$http.getGovernance(pid).then(p => { if (p.status === 2) { this.$http.getStakingPool().then(pool => { - this.$http.getGovernanceTally(pid, pool.bondedToken).then(t => p.updateTally(t)) + this.totalPower = pool.bondedToken + this.$http.getGovernanceTally(pid, 0).then(t => p.updateTally(t)) }) } this.proposal = p @@ -390,6 +408,15 @@ export default { }) }, methods: { + scaleWidth(p) { + if (this.tallyParam) { + if (p.status === 2) { + return Number(this.tallyParam.quorum) * Number(this.tallyParam.threshold) * (1 - p.tally.abstain) * 100 + } + return Number(this.tallyParam.threshold) * (1 - p.tally.abstain) * 100 + } + return 50 + }, percent: v => percent(v), formatDate: v => dayjs(v).format('YYYY-MM-DD HH:mm'), formatToken: v => tokenFormatter(v, {}), diff --git a/src/views/WalletVotes.vue b/src/views/WalletVotes.vue index 4e010f24..ffa35112 100644 --- a/src/views/WalletVotes.vue +++ b/src/views/WalletVotes.vue @@ -69,7 +69,6 @@
- {{ v.keyname }} : {{ v.vote.option }} + > {{ v.keyname }} : {{ formatOption(v.vote.option) }} @@ -237,6 +236,13 @@ export default { percent: v => percent(v), formatDate: v => dayjs(v).format('YYYY-MM-DD'), formatToken: v => tokenFormatter(v, {}), + formatOption: v => { + const start = String(v).lastIndexOf('_') + if (start > 0) { + return String(v).substring(start + 1) + } + return v + }, init() { this.accounts = getLocalAccounts() if (this.accounts) { diff --git a/src/views/components/dashboard/DashboardCardHorizontal.vue b/src/views/components/dashboard/DashboardCardHorizontal.vue index d27fa3a1..f3f2aa5f 100644 --- a/src/views/components/dashboard/DashboardCardHorizontal.vue +++ b/src/views/components/dashboard/DashboardCardHorizontal.vue @@ -5,29 +5,53 @@

{{ statistic || '-' }}

- {{ statisticTitle }} + {{ statisticTitle }} + + {{ showPrice(statistic, statisticTitle) }} + + + {{ showPrice(statistic, statisticTitle) }} + + + {{ showPrice(statistic, statisticTitle) }} +
- - + :text="statisticTitle.substring(0,1)" + :title="statisticTitle" + /> diff --git a/src/views/components/governance/ProposalSummaryComponent.vue b/src/views/components/governance/ProposalSummaryComponent.vue index 4b2e5cb3..1cf46b7e 100644 --- a/src/views/components/governance/ProposalSummaryComponent.vue +++ b/src/views/components/governance/ProposalSummaryComponent.vue @@ -63,101 +63,119 @@
- - - - - - - - - {{ percent(p.tally.yes) }}% voted Yes - - - {{ percent(p.tally.no) }}% voted No - - - {{ percent(p.tally.veto) }}% voted No With Veto - - - {{ percent(p.tally.abstain) }}% voted Abstain - - - - +
+
+ + + + + + +
+
+
+ + {{ percent(p.tally.yes) }}% voted Yes + + + {{ percent(p.tally.no) }}% voted No + + + {{ percent(p.tally.veto) }}% voted No With Veto + + + {{ percent(p.tally.abstain) }}% voted Abstain + +
+ + - {{ $t('btn_detail') }} + + {{ $t('btn_detail') }} + + + + {{ $t('btn_deposit') }} - - - {{ $t('btn_deposit') }} - - - {{ $t('btn_vote') }} - - - + + {{ $t('btn_vote') }} + + +