Skip to content

Commit

Permalink
GIX-1890: CR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lmuntaner committed Sep 19, 2023
1 parent 2b74a21 commit a6b4a51
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,3 @@
</Tooltip>
{/if}
</TestIdWrapper>
MATURITY_MODULATION_VARIANCE_PERCENTAGEMATURITY_MODULATION_VARIANCE_PERCENTAGE
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
? replacePlaceholders(
$i18n.neuron_detail.disburse_maturity_disabled_tooltip,
{
$fee: formatToken({ value: minimumAmountToDisburseMaturity(feeE8s) }),
$amount: formatToken({
value: minimumAmountToDisburseMaturity(feeE8s),
}),
}
)
: undefined;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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. <a href=\"https://wiki.internetcomputer.org/wiki/NNS_neuron_operations_related_to_maturity\" rel=\"noopener noreferrer\" aria-label=\"Find more information about the new stake maturity\" target=\"_blank\">Learn more</a>.",
"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?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
disableDisburse && percentageToDisburse > 0
? replacePlaceholders(
$i18n.neuron_detail.disburse_maturity_disabled_tooltip,
{ $fee: formatToken({ value: minimumAmountE8s }) }
{ $amount: formatToken({ value: minimumAmountE8s }) }
)
: undefined;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/utils/sns-neuron.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/tests/lib/utils/sns-neuron.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down

0 comments on commit a6b4a51

Please sign in to comment.