Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fedekunze/1648 gov params tab #1678

Merged
merged 23 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d11b334
gov params tab
Nov 30, 2018
08b8d78
fix conflicts
Dec 3, 2018
fa7e481
keep fixing params
Dec 3, 2018
0e8a5d7
update gov params tab
Dec 3, 2018
f876081
update gov params and tabParams tests
Dec 3, 2018
21df33b
fix unit tests
Dec 3, 2018
96342dd
updated lcd and snaps
Dec 3, 2018
1b5dead
changelog
Dec 3, 2018
ac4abd2
switch to percentages
Dec 3, 2018
dbcb02f
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
8e825b0
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
0481fb3
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
71e95f9
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
6c78345
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
f94a663
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
52ffeb9
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
e80995b
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
8dc17a8
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 3, 2018
8d0529c
Merge branch 'develop' into fedekunze/1648-gov-params-tab
fedekunze Dec 4, 2018
06fe2f5
Update CHANGELOG.md
faboweb Dec 4, 2018
9da45d9
Update CHANGELOG.md
faboweb Dec 4, 2018
7fdf112
Update app/src/renderer/components/governance/TabParameters.vue
jbibla Dec 4, 2018
5f3a329
Merge branch 'develop' into fedekunze/1648-gov-params-tab
fedekunze Dec 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [\#1685](https://github.com/cosmos/voyager/pull/1685) added .idea to .gitignore @sabau
- [\#1578](https://github.com/cosmos/voyager/issues/1578) added e2e tests for submit governance proposals @fedekunze
- [\#1672](https://github.com/cosmos/voyager/issues/1672) added e2e tests for staking parameters tab @fedekunze
- [\#1648](https://github.com/cosmos/voyager/issues/1648) added governance parameters tab @fedekunze
- [\#1550](https://github.com/cosmos/voyager/issues/1578) added e2e tests for voting on governance proposals @fedekunze
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
- [\#1555](https://github.com/cosmos/voyager/issues/1578) added e2e tests for submitting a deposit on a governance proposal @fedekunze
fedekunze marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
5 changes: 5 additions & 0 deletions app/src/renderer/components/governance/PageGovernance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export default {
displayName: `Proposals`,
pathName: `Proposals`
}
// TODO uncomment when updated to latest SDK
// {
// displayName: `Parameters`,
// pathName: `Governance Parameters`
// }
],
showModalPropose: false
}),
Expand Down
278 changes: 278 additions & 0 deletions app/src/renderer/components/governance/TabParameters.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
<template>
<div>
<div>
<h3>
Deposit Parameters
<i
v-tooltip.top="depositTooltips.description"
class="material-icons info-button"
>info_outline</i
>
</h3>
<div class="parameters__details parameters__section">
<div class="row">
<div class="column">
<dl class="info_dl">
<dt>
Minimum Deposit
<i
v-tooltip.top="depositTooltips.min_deposit"
class="material-icons info-button"
>info_outline</i
>
</dt>
<dd>
{{
governanceParameters.parameters.deposit.min_deposit
? minimumDeposit
: `n/a`
}}
</dd>
</dl>
</div>
<div class="column">
<dl class="info_dl">
<dt>
Maximum Deposit Period
<i
v-tooltip.top="depositTooltips.max_deposit_period"
class="material-icons info-button"
>info_outline</i
>
</dt>
<dd>
{{
governanceParameters.parameters.deposit.max_deposit_period
? depositPeriodInDays + ` days`
: `n/a`
}}
</dd>
</dl>
</div>
</div>
</div>
</div>
<div>
<h3>
Tally Parameters
<i
v-tooltip.top="tallyingTooltips.description"
class="material-icons info-button"
>info_outline</i
>
</h3>
<div class="parameters__details parameters__section">
<div class="row">
<div class="column">
<dl class="info_dl">
<dt>
Threshold
<i
v-tooltip.top="tallyingTooltips.threshold"
class="material-icons info-button"
>info_outline</i
>
</dt>
<dd>
{{
governanceParameters.parameters.tallying.threshold
? `${parseFloat(
governanceParameters.parameters.tallying.threshold
) * 100} %`
: `n/a`
}}
</dd>
</dl>
<dl class="info_dl">
<dt>
Veto
<i
v-tooltip.top="tallyingTooltips.veto"
class="material-icons info-button"
>info_outline</i
>
</dt>
<dd>
{{
governanceParameters.parameters.tallying.veto
? `${parseFloat(
governanceParameters.parameters.tallying.veto
) * 100} %`
: `n/a`
}}
</dd>
</dl>
</div>
<div class="column">
<dl class="info_dl">
<dt>
Governance Penalty
<i
v-tooltip.top="tallyingTooltips.governance_penalty"
class="material-icons info-button"
>info_outline</i
>
</dt>
<dd>
{{
governanceParameters.parameters.tallying.governance_penalty
? governanceParameters.parameters.tallying
.governance_penalty
: `n/a`
}}
</dd>
</dl>
</div>
</div>
</div>
</div>
<div>
<h3>
Voting Parameters
<i
v-tooltip.top="votingTooltips.description"
class="material-icons info-button"
>info_outline</i
>
</h3>
<div class="parameters__details parameters__section">
<div class="row">
<div class="column">
<dl class="info_dl">
<dt>
Voting Period
<i
v-tooltip.top="votingTooltips.voting_period"
class="material-icons info-button"
>info_outline</i
>
</dt>
<dd>
{{
governanceParameters.parameters.voting.voting_period
? votingPeriodInDays + ` days`
: `n/a`
}}
</dd>
</dl>
</div>
<div class="column"></div>
</div>
</div>
</div>
</div>
</template>

<script>
import { mapGetters } from "vuex"
import { TmBtn, TmListItem, TmPage, TmPart, TmToolBar } from "@tendermint/ui"
export default {
name: `tab-staking-parameters`,
components: {
TmBtn,
TmListItem,
TmPage,
TmPart,
TmToolBar
},
data: () => ({
depositTooltips: {
description: `Governance deposit parameters for the Cosmos Hub`,
min_deposit: `Minimum deposit for a proposal to enter the voting period`,
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
max_deposit_period: `Deposits must reach the "minimum deposit" threshold in this period of time`
},
tallyingTooltips: {
description: `Tally parameters for governance in the Cosmos Hub`,
threshold: `Percentage of "Yes" votes required for proposal to pass`,
veto: `Percentage of "No With Veto" votes required for proposal to be vetoed`,
governance_penalty: `Penalty for a validator who fails to vote`
},
votingTooltips: {
description: `Voting parameters for governance in the Cosmos Hub`,
voting_period: `Length of the voting period for proposals on the Cosmos Hub`
}
}),
computed: {
...mapGetters([`config`, `governanceParameters`]),
minimumDeposit() {
let coin = this.governanceParameters.parameters.deposit.min_deposit[0]
return `${coin.amount} ${coin.denom}s`
},
depositPeriodInDays() {
return (
parseInt(
this.governanceParameters.parameters.deposit.max_deposit_period
) /
(10 ** 9 * 60 * 60 * 24)
)
},
votingPeriodInDays() {
return (
parseInt(this.governanceParameters.parameters.voting.voting_period) /
(10 ** 9 * 60 * 60 * 24)
)
}
},
async mounted() {
this.$store.dispatch(`getGovParameters`)
}
}
</script>
<style>
.parameters__details > .row > .column {
flex: 1;
}

.parameters__section {
background-color: var(--app-fg);
display: flex;
margin-bottom: 1rem;
padding: 2rem;
width: 100%;
}

h3 {
margin: 1em auto;
}

.info-button {
color: var(--link);
}

.column {
display: flex;
flex-flow: column;
position: relative;
}

.row {
display: flex;
flex-direction: row;
width: 100%;
}

.info_dl {
display: flex;
flex-flow: column;
margin-bottom: 1.5rem;
margin-right: 1rem;
}

.info_dl dt {
color: var(--dim);
font-size: small;
margin-bottom: 4px;
}

.info_dl dd {
border: 1px solid var(--white-fade-2);
border-radius: 2px;
font-size: 1rem;
line-height: 1rem;
padding: 0.5rem;
}

.info_dl dd.info_dl__text-box {
min-height: 6.91rem;
}
</style>
30 changes: 20 additions & 10 deletions app/src/renderer/components/staking/TabParameters.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-if="config.devMode">
<div>
<div>
<h3 class="staking-pool">
Staking Pool
Expand All @@ -14,7 +14,12 @@
<div class="column">
<dl class="info_dl">
<dt>
Loose {{ parameters.parameters.bond_denom }}
Loose
{{
stakingParameters.parameters.bond_denom
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this logic necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah if there's an error to display the params then the title won't be displayed completely

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would it be better to show bondingDenom over stakingParameters.parameters.bond_denom?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk, is there a case on which the bondingDenom is not set? maybe we should check that and remove the hardcoded values from parameters everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(on another PR)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! can you create an issue?

? stakingParameters.parameters.bond_denom
: bondingDenom
}}
<i
v-tooltip.top="poolTooltips.loose_tokens"
class="material-icons info-button"
Expand All @@ -29,7 +34,12 @@
<div class="column">
<dl class="info_dl">
<dt>
Delegated {{ parameters.parameters.bond_denom }}
Delegated
{{
stakingParameters.parameters.bond_denom
? stakingParameters.parameters.bond_denom
: bondingDenom
}}
<i
v-tooltip.top="poolTooltips.bonded_tokens"
class="material-icons info-button"
Expand Down Expand Up @@ -67,7 +77,7 @@
</dt>
<dd id="unbonding_time">
{{
parameters.parameters.unbonding_time
stakingParameters.parameters.unbonding_time
? unbondingTimeInDays + ` days`
: `n/a`
}}
Expand All @@ -77,8 +87,8 @@
<dt>Current Staking Coin Denomination</dt>
<dd id="bond_denom">
{{
parameters.parameters.bond_denom
? parameters.parameters.bond_denom
stakingParameters.parameters.bond_denom
? stakingParameters.parameters.bond_denom
: `n/a`
}}
</dd>
Expand All @@ -89,8 +99,8 @@
<dt>Maximum Number of Validators</dt>
<dd id="max_validators">
{{
parameters.parameters.max_validators
? parameters.parameters.max_validators
stakingParameters.parameters.max_validators
? stakingParameters.parameters.max_validators
: `n/a`
}}
</dd>
Expand Down Expand Up @@ -128,10 +138,10 @@ export default {
}
}),
computed: {
...mapGetters([`config`, `parameters`, `pool`]),
...mapGetters([`config`, `stakingParameters`, `pool`, `bondingDenom`]),
unbondingTimeInDays() {
return (
parseInt(this.parameters.parameters.unbonding_time) /
parseInt(this.stakingParameters.parameters.unbonding_time) /
(10 ** 9 * 60 * 60 * 24)
)
}
Expand Down
Loading