Skip to content

fix: make unstaked vesting amounts non-rounded and unlock date to use days #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Aerilym
Copy link
Collaborator

@Aerilym Aerilym commented May 23, 2025

This pull request introduces optimizations and enhancements to the apps/staking modules and components, primarily focusing on improving performance with memoization and ensuring consistent precision in formatting token balances. The most important changes are grouped below by theme.

Performance Optimizations:

  • Updated the useVestingEndTime hook to use useMemo for computing the date and unit values, reducing unnecessary recalculations.

Token Balance Precision:

  • Introduced the SENT_DECIMALS constant in multiple components and updated the formatSENTBigInt calls to include it, ensuring token balances are formatted with consistent precision:
    • VestingUnstakedBalanceModule.tsx now includes formattedAmountAccurate for higher precision.
    • VestingHandler.tsx uses SENT_DECIMALS for formatting contract.initial_amount.
    • VestingInfo.tsx applies SENT_DECIMALS for initial_amount and updates the unstaked balance to use formattedAmountAccurate. [1] [2]… days

@Aerilym Aerilym requested review from Copilot and yougotwill May 23, 2025 07:05
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves performance and precision in the staking modules by refining vesting end time calculations and ensuring token balances are formatted consistently with full precision.

  • Updated the useVestingEndTime hook to use memoization for both date and unit computation.
  • Enhanced token balance formatting across VestingInfo, VestingHandler, and VestingUnstakedBalanceModule by incorporating SENT_DECIMALS.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
apps/staking/components/Vesting/VestingInfo.tsx Updated formatSENTBigInt call to include SENT_DECIMALS and use formattedAmountAccurate for vesting unstaked balance.
apps/staking/components/Vesting/VestingHandler.tsx Revised the formatting of contract.initial_amount by passing SENT_DECIMALS.
apps/staking/app/vested-stakes/modules/VestingUnstakedBalanceModule.tsx Added SENT_DECIMALS import and added a new formattedAmountAccurate field for more precise balance formatting.
apps/staking/app/vested-stakes/modules/VestingEndTimeModule.tsx Introduced useMemo for computing date and unit values to optimize calculation and clarity of relative time display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant