Skip to content

feat: update how total APYs are displayed#5609

Open
therealemjy wants to merge 1 commit into
mainfrom
feat/total-apys
Open

feat: update how total APYs are displayed#5609
therealemjy wants to merge 1 commit into
mainfrom
feat/total-apys

Conversation

@therealemjy
Copy link
Copy Markdown
Member

Jira ticket(s)

VPD-1321

Changes

  • update how total APYs are displayed

@therealemjy therealemjy requested a review from cuzz-venus June 1, 2026 08:37
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dapp-preview Ready Ready Preview Jun 1, 2026 8:47am
dapp-testnet Ready Ready Preview Jun 1, 2026 8:47am
venus.io Ready Ready Preview Jun 1, 2026 8:47am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

🦋 Changeset detected

Latest commit: fd6d7cc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@venusprotocol/evm Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jun 1, 2026

Greptile Summary

This PR updates the APY breakdown display in the Market operation form. The total borrow APY is now shown as a negative value (reflecting the actual cost to the user) instead of the previous misleading positive figure, and the generic "Total APY" label is replaced with context-sensitive "Total supply APY" / "Total borrow APY" labels. All 7 locale files are updated consistently.

  • ApyBreakdown/index.tsx: The accumulator now uses .plus(totalBorrowApyPercentage) instead of .minus(totalBorrowApyPercentage). Because getCombinedDistributionApys already returns totalBorrowApyPercentage as a negative number, this correctly surfaces a negative total for borrow/repay actions.
  • Translation files: The shared totalApy.label key is removed and split into supplyApyLabel and borrowApyLabel; no other code was found referencing the removed key.
  • Tests: Snapshot-based assertions are replaced with explicit textContent checks and a new multi-mutation sign-correctness case is added.

Confidence Score: 4/5

The change is safe to merge. The borrow APY sign flip is correct given the pre-existing convention in getCombinedDistributionApys where totalBorrowApyPercentage is already a negative number, and the tests validate each case explicitly.

The core arithmetic change is correct and well-tested. The only minor concern is that the label defaults silently to "Total borrow APY" when no mutations are present, relying on the ternary's else-arm catching undefined rather than an explicit guard.

No files require special attention; the translation key removal is verified to have no other consumers in the codebase.

Important Files Changed

Filename Overview
apps/evm/src/pages/Market/OperationForm/ApyBreakdown/index.tsx Core logic change: borrow APY is now added (not subtracted) to the total, correctly reflecting the negative value already carried by totalBorrowApyPercentage; label is now context-sensitive (supply vs borrow) rather than generic "Total APY"
apps/evm/src/pages/Market/OperationForm/ApyBreakdown/tests/index.spec.tsx Tests replaced with explicit string assertions instead of snapshots; adds a dedicated test for the zero-mutations default label and a multi-mutation sign-correctness case
apps/evm/src/libs/translations/translations/en.json Removes generic totalApy.label key; adds supplyApyLabel and borrowApyLabel for context-specific labels — all 7 locale files updated consistently
apps/evm/src/libs/errors/handleError/index.ts Converts value import of BaseError to a type-only import — safe cleanup with no runtime impact

Reviews (1): Last reviewed commit: "feat: update how total APYs are displaye..." | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 81.31% 45807 / 56332
🔵 Statements 81.31% 45807 / 56332
🔵 Functions 62.21% 647 / 1040
🔵 Branches 72.28% 5158 / 7136
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/libs/errors/handleError/index.ts 92.1% 33.33% 100% 92.1% 3, 32-33
apps/evm/src/pages/Market/OperationForm/ApyBreakdown/index.tsx 100% 96% 100% 100%
Generated in workflow #13539 for commit fd6d7cc by the Vitest Coverage Report Action

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