Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

scan: show commission max rate and change on validator index page #2005

Merged
merged 10 commits into from
Jun 23, 2020
1 change: 1 addition & 0 deletions CHANGELOG_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
### Scan

- (impv) [\#2008](https://github.com/bandprotocol/bandchain/pull/2008) Add target validator's address on redelegate
- (impv) [\#2005](https://github.com/bandprotocol/bandchain/pull/2005) Show max commission rate and max commission change on validator index page
- (bugs) [\#1996](https://github.com/bandprotocol/bandchain/pull/1996) Fix id bug on `RequestSub.re`
- (chore) [\#1987](https://github.com/bandprotocol/bandchain/pull/1987) Remove `request_tab_t` in `Route.re`
- (impv) [\#1986](https://github.com/bandprotocol/bandchain/pull/1986) Add autofocus input on submittx modal
Expand Down
21 changes: 21 additions & 0 deletions scan/src/pages/ValidatorIndexPage.re
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,27 @@ let make = (~address, ~hashtag: Route.validator_tab_t) =>
VCode(validator.commission->Format.fPercent),
)}
<VSpacing size=Spacing.lg />
{kvRow(
"COMMISSION MAX CHANGE",
{
"Maximum increment by which the validator can change their commission rate at a time"
|> React.string;
},
{
VCode(validator.commissionMaxChange->Format.fPercent);
},
)}
<VSpacing size=Spacing.lg />
{kvRow(
"COMMISSION MAX RATE",
{
"The highest possible commission rate the validator can set" |> React.string;
},
{
VCode(validator.commissionMaxRate->Format.fPercent);
},
)}
<VSpacing size=Spacing.lg />
{kvRow(
"BONDED HEIGHT",
{
Expand Down
12 changes: 12 additions & 0 deletions scan/src/subscriptions/ValidatorSub.re
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type internal_t = {
website: string,
tokens: Coin.t,
commissionRate: float,
commissionMaxChange: float,
commissionMaxRate: float,
consensusPubKey: PubKey.t,
bondedHeight: int,
jailed: bool,
Expand All @@ -35,6 +37,8 @@ type t = {
details: string,
tokens: Coin.t,
commission: float,
commissionMaxChange: float,
commissionMaxRate: float,
bondedHeight: int,
completedRequestCount: int,
missedRequestCount: int,
Expand All @@ -52,6 +56,8 @@ let toExternal =
tokens,
commissionRate,
consensusPubKey,
commissionMaxChange,
commissionMaxRate,
bondedHeight,
jailed,
details,
Expand All @@ -70,6 +76,8 @@ let toExternal =
details,
tokens,
commission: commissionRate *. 100.,
commissionMaxChange: commissionMaxChange *. 100.,
commissionMaxRate: commissionMaxRate *. 100.,
bondedHeight,
// TODO: remove hardcoded when somewhere use it
avgResponseTime: 2,
Expand All @@ -95,6 +103,8 @@ module SingleConfig = [%graphql
website
tokens @bsDecoder(fn: "GraphQLParser.coin")
commissionRate: commission_rate @bsDecoder(fn: "float_of_string")
commissionMaxChange: commission_max_change @bsDecoder(fn: "float_of_string")
commissionMaxRate: commission_max_rate @bsDecoder(fn: "float_of_string")
consensusPubKey: consensus_pubkey @bsDecoder(fn: "PubKey.fromBech32")
bondedHeight: bonded_height @bsDecoder(fn: "GraphQLParser.int64")
jailed
Expand All @@ -115,6 +125,8 @@ module MultiConfig = [%graphql
website
tokens @bsDecoder(fn: "GraphQLParser.coin")
commissionRate: commission_rate @bsDecoder(fn: "float_of_string")
commissionMaxChange: commission_max_change @bsDecoder(fn: "float_of_string")
commissionMaxRate: commission_max_rate @bsDecoder(fn: "float_of_string")
consensusPubKey: consensus_pubkey @bsDecoder(fn: "PubKey.fromBech32")
bondedHeight: bonded_height @bsDecoder(fn: "GraphQLParser.int64")
jailed
Expand Down