Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonz-dfinity committed Jul 17, 2024
1 parent 53b45ee commit 562f923
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions frontend/src/lib/utils/neuron.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,26 +207,26 @@ export const bonusMultiplier = ({
}): number =>
1 +
multiplier *
(Math.min(Number(amount), max) /
// to avoid NaN
(max === 0 ? 1 : max));
(Math.min(Number(amount), max) /
// to avoid NaN
(max === 0 ? 1 : max));

// TODO: Do we need this? What does it mean to have a valid stake?
// TODO: https://dfinity.atlassian.net/browse/L2-507
export const hasValidStake = (neuron: NeuronInfo): boolean =>
// Ignore if we can't validate the stake
nonNullish(neuron.fullNeuron)
? neuron.fullNeuron.cachedNeuronStake +
neuron.fullNeuron.maturityE8sEquivalent >
BigInt(DEFAULT_TRANSACTION_FEE_E8S)
neuron.fullNeuron.maturityE8sEquivalent >
BigInt(DEFAULT_TRANSACTION_FEE_E8S)
: false;

export const getDissolvingTimestampSeconds = (
neuron: NeuronInfo
): bigint | undefined =>
neuron.state === NeuronState.Dissolving &&
neuron.fullNeuron?.dissolveState !== undefined &&
"WhenDissolvedTimestampSeconds" in neuron.fullNeuron.dissolveState
neuron.fullNeuron?.dissolveState !== undefined &&
"WhenDissolvedTimestampSeconds" in neuron.fullNeuron.dissolveState
? neuron.fullNeuron.dissolveState.WhenDissolvedTimestampSeconds
: undefined;

Expand Down Expand Up @@ -282,7 +282,7 @@ export const formattedMaturity = ({ fullNeuron }: NeuronInfo): string =>
export const formattedTotalMaturity = ({ fullNeuron }: NeuronInfo): string =>
formatMaturity(
(fullNeuron?.maturityE8sEquivalent ?? 0n) +
(fullNeuron?.stakedMaturityE8sEquivalent ?? 0n)
(fullNeuron?.stakedMaturityE8sEquivalent ?? 0n)
);

/**
Expand Down Expand Up @@ -368,7 +368,7 @@ export const isNeuronControllable = ({
fullNeuron?.controller !== undefined &&
(fullNeuron.controller === identity?.getPrincipal().toText() ||
getAccountByPrincipal({ principal: fullNeuron.controller, accounts }) !==
undefined);
undefined);

export const isNeuronControlledByHardwareWallet = ({
neuron,
Expand Down Expand Up @@ -737,12 +737,12 @@ export const canBeMerged = (
}
return sameManageNeuronFollowees(neurons)
? {
isValid: true,
}
isValid: true,
}
: {
isValid: false,
messageKey: "error.merge_neurons_not_same_manage_neuron_followees",
};
isValid: false,
messageKey: "error.merge_neurons_not_same_manage_neuron_followees",
};
};

export const mapNeuronIds = ({
Expand Down Expand Up @@ -975,7 +975,7 @@ export const maturityLastDistribution = ({
return (
actual_timestamp_seconds -
(fromNullable(rounds_since_last_distribution) ?? 1n) *
BigInt(SECONDS_IN_DAY)
BigInt(SECONDS_IN_DAY)
);
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/tests/lib/utils/neuron.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ describe("neuron-utils", () => {
{
topic: 100 as Topic,
followees: [3n, 4n],
}
},
],
},
};
Expand Down

0 comments on commit 562f923

Please sign in to comment.