From a6b4a5187978e0ec56f95f4b00bc9ad6085db9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lloren=C3=A7?= Date: Tue, 19 Sep 2023 11:58:07 +0200 Subject: [PATCH] GIX-1890: CR changes --- .../components/neuron-detail/actions/SpawnNeuronButton.svelte | 1 - .../actions/SnsDisburseMaturityButton.svelte | 4 +++- frontend/src/lib/i18n/en.json | 2 +- frontend/src/lib/modals/neurons/DisburseMaturityModal.svelte | 2 +- frontend/src/lib/utils/sns-neuron.utils.ts | 2 +- .../actions/SnsDisburseMaturityButton.spec.ts | 2 +- frontend/src/tests/lib/utils/sns-neuron.utils.spec.ts | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/lib/components/neuron-detail/actions/SpawnNeuronButton.svelte b/frontend/src/lib/components/neuron-detail/actions/SpawnNeuronButton.svelte index a2ca51ce2a8..5758692188e 100644 --- a/frontend/src/lib/components/neuron-detail/actions/SpawnNeuronButton.svelte +++ b/frontend/src/lib/components/neuron-detail/actions/SpawnNeuronButton.svelte @@ -74,4 +74,3 @@ {/if} -MATURITY_MODULATION_VARIANCE_PERCENTAGEMATURITY_MODULATION_VARIANCE_PERCENTAGE diff --git a/frontend/src/lib/components/sns-neuron-detail/actions/SnsDisburseMaturityButton.svelte b/frontend/src/lib/components/sns-neuron-detail/actions/SnsDisburseMaturityButton.svelte index 7c406025bdb..95186711dd0 100644 --- a/frontend/src/lib/components/sns-neuron-detail/actions/SnsDisburseMaturityButton.svelte +++ b/frontend/src/lib/components/sns-neuron-detail/actions/SnsDisburseMaturityButton.svelte @@ -21,7 +21,9 @@ ? replacePlaceholders( $i18n.neuron_detail.disburse_maturity_disabled_tooltip, { - $fee: formatToken({ value: minimumAmountToDisburseMaturity(feeE8s) }), + $amount: formatToken({ + value: minimumAmountToDisburseMaturity(feeE8s), + }), } ) : undefined; diff --git a/frontend/src/lib/i18n/en.json b/frontend/src/lib/i18n/en.json index 625dc19a57c..293094db2f4 100644 --- a/frontend/src/lib/i18n/en.json +++ b/frontend/src/lib/i18n/en.json @@ -611,7 +611,7 @@ "spawn_neuron": "Spawn Neuron", "spawn": "Spawn", "stake_maturity_disabled_tooltip": "Currently, you do not have any maturity available to stake into this neuron.", - "disburse_maturity_disabled_tooltip": "You do not have enough maturity to disburse. The minimum is: $fee.", + "disburse_maturity_disabled_tooltip": "You do not have enough maturity to disburse. The minimum is: $amount.", "stake_maturity_tooltip": "Merge Maturity has been replaced by Stake Maturity. Learn more.", "start_dissolve_description": "This will cause your neuron to lose its age bonus.\nAre you sure you wish to continue?", "stop_dissolve_description": "Are you sure you want to stop the dissolve process?", diff --git a/frontend/src/lib/modals/neurons/DisburseMaturityModal.svelte b/frontend/src/lib/modals/neurons/DisburseMaturityModal.svelte index 6ad3abe5707..e7cb3574492 100644 --- a/frontend/src/lib/modals/neurons/DisburseMaturityModal.svelte +++ b/frontend/src/lib/modals/neurons/DisburseMaturityModal.svelte @@ -48,7 +48,7 @@ disableDisburse && percentageToDisburse > 0 ? replacePlaceholders( $i18n.neuron_detail.disburse_maturity_disabled_tooltip, - { $fee: formatToken({ value: minimumAmountE8s }) } + { $amount: formatToken({ value: minimumAmountE8s }) } ) : undefined; diff --git a/frontend/src/lib/utils/sns-neuron.utils.ts b/frontend/src/lib/utils/sns-neuron.utils.ts index cb0cbadbc4d..fb5bc989fd9 100644 --- a/frontend/src/lib/utils/sns-neuron.utils.ts +++ b/frontend/src/lib/utils/sns-neuron.utils.ts @@ -990,4 +990,4 @@ export const totalDisbursingMaturity = ({ * Source: https://sourcegraph.com/github.com/dfinity/ic/-/blob/rs/sns/governance/src/governance.rs?L1651 */ export const minimumAmountToDisburseMaturity = (fee: bigint): bigint => - BigInt(Math.round(Number(fee) / MATURITY_MODULATION_VARIANCE_PERCENTAGE)); + BigInt(Math.ceil(Number(fee) / MATURITY_MODULATION_VARIANCE_PERCENTAGE)); diff --git a/frontend/src/tests/lib/components/sns-neuron-detail/actions/SnsDisburseMaturityButton.spec.ts b/frontend/src/tests/lib/components/sns-neuron-detail/actions/SnsDisburseMaturityButton.spec.ts index d9ed636acf1..910a5a30593 100644 --- a/frontend/src/tests/lib/components/sns-neuron-detail/actions/SnsDisburseMaturityButton.spec.ts +++ b/frontend/src/tests/lib/components/sns-neuron-detail/actions/SnsDisburseMaturityButton.spec.ts @@ -50,7 +50,7 @@ describe("SnsDisburseMaturityButton", () => { expect(await po.isDisabled()).toBe(true); expect(await po.getTooltipText()).toBe( - "You do not have enough maturity to disburse. The minimum is: 0.00010526." + "You do not have enough maturity to disburse. The minimum is: 0.00010527." ); }); diff --git a/frontend/src/tests/lib/utils/sns-neuron.utils.spec.ts b/frontend/src/tests/lib/utils/sns-neuron.utils.spec.ts index c6a6d5c3c63..f74d7240d63 100644 --- a/frontend/src/tests/lib/utils/sns-neuron.utils.spec.ts +++ b/frontend/src/tests/lib/utils/sns-neuron.utils.spec.ts @@ -2496,7 +2496,7 @@ describe("sns-neuron utils", () => { describe("minimumAmountToDisburseMaturity", () => { it("returns worst case of maturity modulation", () => { - expect(minimumAmountToDisburseMaturity(10_000n)).toBe(10526n); + expect(minimumAmountToDisburseMaturity(10_000n)).toBe(10527n); }); it("returns 0 if fee is 0", () => {