Skip to content

fix(single-lease): use stable decimals for short size in header#163

Merged
metodi96 merged 1 commit into
mainfrom
fix/short-size-header
May 13, 2026
Merged

fix(single-lease): use stable decimals for short size in header#163
metodi96 merged 1 commit into
mainfrom
fix/short-size-header

Conversation

@metodi96
Copy link
Copy Markdown
Collaborator

Summary

Fix the single-lease header's size readout for short positions. On a short, `lease.amount` is denominated in the stable the user holds, not in the LPN. The header was applying LPN decimals to the stable amount, producing values 100× off — a BTC short showing $0.69 instead of $69.98 while the Summary widget directly below showed the correct figure.

Changes

  • `SingleLeaseHeader.vue` — replace `lpn.decimal_digits` with `asset.decimal_digits` (decimals of `lease.amount.ticker`) in the short branch of the `stable` computed. Drop the now-unused `getLpnByProtocol` lookup.

Verification

  • Reproduced the bug on a BTC short: header showed $0.69, Summary showed $69.98. After the fix, header matched Summary ($69.98).
  • Ran lint, vitest, and the worker build via the pre-commit hook — all clean.
  • Cross-checked against `PositionSummaryWidget.vue:326` which already used `asset.decimal_digits` for the same lease, confirming the fix aligns the two surfaces on a single source of truth.

The header's `stable` computed picked LPN decimals for shorts. For a
short, `lease.amount` is the stable the user holds (USDC), not the
borrowed crypto. On a BTC short, decimals 8 was being applied to a
USDC base amount that uses decimals 6 — $69.98 rendered as $0.69.
Use the lease.amount.ticker currency's decimals, matching what
PositionSummaryWidget already does.
@metodi96 metodi96 merged commit 7644c18 into main May 13, 2026
2 checks passed
@metodi96 metodi96 deleted the fix/short-size-header branch May 13, 2026 13:27
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