Skip to content

Vault detail: incorrect coin balance scaling and render perf on large state updates #85

@Muskan121622

Description

@Muskan121622

ssue Description

  • Summary
    • Coin balances and reserves were always divided by 10**18 in getBalances , causing incorrect values for ERC-20 tokens with other decimals. The vault client also recalculated formatted numbers on every render.
  • Impact
    • Users see wrong balances/reserves for tokens not using 18 decimals.
    • Extra render work increases UI latency during frequent state updates.
  • Fix
    • Use vault.decimals || 18 to scale coinReserve and coinBalance .
    • Memoize formatted display numbers with useMemo .
    • Keep hodlCoinBalance at 18 decimals (HodlCoin).
  • References
    • Scaling fix: app/[vaultId]/InteractionClient.tsx:291–296
    • Memoization: app/[vaultId]/InteractionClient.tsx:400–409 , 501–513
  • Verification
    • IDE diagnostics clean.
    • Manual check for tokens with non-18 decimals to confirm displayed balances match on-chain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions