From fd7c9ece7d2a6d4b67763093114cb73788f5855f Mon Sep 17 00:00:00 2001 From: tansawit Date: Thu, 18 Jun 2020 23:53:39 +0700 Subject: [PATCH 1/5] scan: show commission max rate and change on validator index page --- scan/src/pages/ValidatorIndexPage.re | 21 +++++++++++++++++++++ scan/src/subscriptions/ValidatorSub.re | 12 ++++++++++++ 2 files changed, 33 insertions(+) diff --git a/scan/src/pages/ValidatorIndexPage.re b/scan/src/pages/ValidatorIndexPage.re index 9537793155..107beaf796 100644 --- a/scan/src/pages/ValidatorIndexPage.re +++ b/scan/src/pages/ValidatorIndexPage.re @@ -200,6 +200,27 @@ let make = (~address, ~hashtag: Route.validator_tab_t) => VCode(validator.commission->Format.fPercent), )} + {kvRow( + "COMMISSION MAX CHANGE", + { + "Maximum increment by which the validator can change their commission rate at a time" + |> React.string; + }, + { + VCode((validator.commissionMaxChange *. 100.)->Format.fPercent); + }, + )} + + {kvRow( + "COMMISSION MAX RATE", + { + "The highest possible commission rate the validator can set" |> React.string; + }, + { + VCode((validator.commissionMaxRate *. 100.)->Format.fPercent); + }, + )} + {kvRow( "BONDED HEIGHT", { diff --git a/scan/src/subscriptions/ValidatorSub.re b/scan/src/subscriptions/ValidatorSub.re index 4cf242c2dd..6161e94560 100644 --- a/scan/src/subscriptions/ValidatorSub.re +++ b/scan/src/subscriptions/ValidatorSub.re @@ -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, @@ -35,6 +37,8 @@ type t = { details: string, tokens: Coin.t, commission: float, + commissionMaxChange: float, + commissionMaxRate: float, bondedHeight: int, completedRequestCount: int, missedRequestCount: int, @@ -52,6 +56,8 @@ let toExternal = tokens, commissionRate, consensusPubKey, + commissionMaxChange, + commissionMaxRate, bondedHeight, jailed, details, @@ -70,6 +76,8 @@ let toExternal = details, tokens, commission: commissionRate *. 100., + commissionMaxChange, + commissionMaxRate, bondedHeight, // TODO: remove hardcoded when somewhere use it avgResponseTime: 2, @@ -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 @@ -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 From c8f8e41cccd3e4b8fa388702eae0f021b240ae39 Mon Sep 17 00:00:00 2001 From: tansawit Date: Thu, 18 Jun 2020 23:55:27 +0700 Subject: [PATCH 2/5] updated: changelog --- CHANGELOG_UNRELEASED.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG_UNRELEASED.md b/CHANGELOG_UNRELEASED.md index b77a1f12cf..ed6031d0c4 100644 --- a/CHANGELOG_UNRELEASED.md +++ b/CHANGELOG_UNRELEASED.md @@ -22,6 +22,7 @@ ### Scan +- (impv) [\#2005](https://github.com/bandprotocol/bandchain/pull/2005) Show max commission rate and max commission change on validator index page - (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 - (feat) [\#1985](https://github.com/bandprotocol/bandchain/pull/1985) Add redelegate button and submit transaction modal From 24e4cf159b8ba8908d525c142a9fd7b534e6d932 Mon Sep 17 00:00:00 2001 From: tansawit Date: Sun, 21 Jun 2020 18:54:47 +0700 Subject: [PATCH 3/5] update: move commission multiplication to validatorsub --- scan/src/pages/ValidatorIndexPage.re | 4 ++-- scan/src/subscriptions/ValidatorSub.re | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scan/src/pages/ValidatorIndexPage.re b/scan/src/pages/ValidatorIndexPage.re index 107beaf796..784fcd7255 100644 --- a/scan/src/pages/ValidatorIndexPage.re +++ b/scan/src/pages/ValidatorIndexPage.re @@ -207,7 +207,7 @@ let make = (~address, ~hashtag: Route.validator_tab_t) => |> React.string; }, { - VCode((validator.commissionMaxChange *. 100.)->Format.fPercent); + VCode(validator.commissionMaxChange->Format.fPercent); }, )} @@ -217,7 +217,7 @@ let make = (~address, ~hashtag: Route.validator_tab_t) => "The highest possible commission rate the validator can set" |> React.string; }, { - VCode((validator.commissionMaxRate *. 100.)->Format.fPercent); + VCode(validator.commissionMaxRate->Format.fPercent); }, )} diff --git a/scan/src/subscriptions/ValidatorSub.re b/scan/src/subscriptions/ValidatorSub.re index 6161e94560..e982f260be 100644 --- a/scan/src/subscriptions/ValidatorSub.re +++ b/scan/src/subscriptions/ValidatorSub.re @@ -76,8 +76,8 @@ let toExternal = details, tokens, commission: commissionRate *. 100., - commissionMaxChange, - commissionMaxRate, + commissionMaxChange: commissionMaxChange *. 100., + commissionMaxRate: commissionMaxRate *. 100., bondedHeight, // TODO: remove hardcoded when somewhere use it avgResponseTime: 2, From eb402cb17fa1e0e5c809f3eaae1e174e7b0bf52e Mon Sep 17 00:00:00 2001 From: Sawit Trisirisatayawong Date: Mon, 22 Jun 2020 13:48:59 +0700 Subject: [PATCH 4/5] Update CHANGELOG_UNRELEASED.md --- CHANGELOG_UNRELEASED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG_UNRELEASED.md b/CHANGELOG_UNRELEASED.md index 6d118bffa2..a0485b13e0 100644 --- a/CHANGELOG_UNRELEASED.md +++ b/CHANGELOG_UNRELEASED.md @@ -24,8 +24,8 @@ ### Scan -- (impv) [\#2005](https://github.com/bandprotocol/bandchain/pull/2005) Show max commission rate and max commission change on validator index page - (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 From f1c40e68a58604a7a98cb6a83d6d0b57e8ad9f8c Mon Sep 17 00:00:00 2001 From: tansawit Date: Tue, 23 Jun 2020 11:47:10 +0700 Subject: [PATCH 5/5] fixed: percentage decimal places on validator index page --- scan/src/pages/ValidatorIndexPage.re | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scan/src/pages/ValidatorIndexPage.re b/scan/src/pages/ValidatorIndexPage.re index 784fcd7255..b54fbd4f98 100644 --- a/scan/src/pages/ValidatorIndexPage.re +++ b/scan/src/pages/ValidatorIndexPage.re @@ -90,7 +90,7 @@ module Uptime = { "Percentage of the blocks that the validator is active for out of the last 250" |> React.string; }, - VCode(uptime->Format.fPercent), + VCode(uptime |> Format.fPercent(~digits=2)), ) |> Sub.resolve | None => @@ -197,7 +197,7 @@ let make = (~address, ~hashtag: Route.validator_tab_t) => { "Validator service fees charged to delegators" |> React.string; }, - VCode(validator.commission->Format.fPercent), + VCode(validator.commission |> Format.fPercent(~digits=2)), )} {kvRow( @@ -207,7 +207,7 @@ let make = (~address, ~hashtag: Route.validator_tab_t) => |> React.string; }, { - VCode(validator.commissionMaxChange->Format.fPercent); + VCode(validator.commissionMaxChange |> Format.fPercent(~digits=2)); }, )} @@ -217,7 +217,7 @@ let make = (~address, ~hashtag: Route.validator_tab_t) => "The highest possible commission rate the validator can set" |> React.string; }, { - VCode(validator.commissionMaxRate->Format.fPercent); + VCode(validator.commissionMaxRate |> Format.fPercent(~digits=2)); }, )}