Skip to content

feat: juice apys #2550

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

Merged
merged 14 commits into from
Aug 12, 2025
Merged

feat: juice apys #2550

merged 14 commits into from
Aug 12, 2025

Conversation

foodaka
Copy link
Collaborator

@foodaka foodaka commented Jul 24, 2025

General Changes

  • Adds together the APYs for merit and protocol so the rates are combined
  const isBorrow = protocolAction === ProtocolAction.borrow;
  const displayAPY = isBorrow
    ? protocolAPY - protocolIncentivesAPR - meritIncentivesAPR - merklIncentivesAPR
    : protocolAPY + protocolIncentivesAPR + meritIncentivesAPR + merklIncentivesAPR;

Developer Notes

Add any notes here that may be helpful for reviewers.


Reviewer Checklist

Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate any downstream issues that may occur.

  • End-to-end tests are passing without any errors
  • Code changes do not significantly increase the application bundle size
  • If there are new 3rd-party packages, they do not introduce potential security threats
  • If there are new environment variables being added, they have been added to the .env.example file as well as the pertinant .github/actions/* files
  • There are no CI changes, or they have been approved by the DevOps and Engineering team(s)

Copy link

vercel bot commented Jul 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
interface ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2025 4:23pm

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@foodaka foodaka marked this pull request as ready for review August 8, 2025 12:56
Copy link

github-actions bot commented Aug 8, 2025

Copy link

github-actions bot commented Aug 8, 2025

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

github-actions bot commented Aug 8, 2025

Copy link

github-actions bot commented Aug 8, 2025

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Contributor

@mgrabina mgrabina left a comment

Choose a reason for hiding this comment

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

two observations more

  1. is it possible to have negative total apy? EURC in ethereum
Image
  1. It's a bit confusing to see one apy in the borrows column (with incentives) and another in the detail page (without)
Image Image

Comment on lines 65 to 70
console.log('WHAT IS THE USER', user);
// amount calculations
const maxAmountToBorrow = getMaxAmountAvailableToBorrow(poolReserve, user);

console.log('maxAmountToBorrow', maxAmountToBorrow);

Copy link
Contributor

Choose a reason for hiding this comment

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

logs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed in 13c82b4

<IncentivesIcon width="16" height="16" />
</Box>
);
} else if (incentivesNetAPR === 'Infinity') {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we set Inifinite as a const, or use undefinded/uint_max const?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah its better 1c15a3e

Comment on lines 396 to 397
// p: { xs: '0 4px', xsm: '2px 4px' },
// border: `1px solid ${open ? theme.palette.action.disabled : theme.palette.divider}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

can remove?


const protocolIncentivesAPR =
incentives?.reduce((sum, inc) => {
return sum + (inc.incentiveAPR === 'Infinity' ? 0 : +inc.incentiveAPR);
Copy link
Contributor

Choose a reason for hiding this comment

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

is this intended? if incentive is infinite sum 0? if so, nomeclature feels confusing not sure if there is a better way

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ive updated here to handle infinity, im not sure tbh how often it is actually infinity but we can display it 1c15a3e

Comment on lines 49 to 54
console.log('USER BORROWS', user.availableBorrowsUSD);
console.log(
'availableForUserMarketReferenceCurrency',
availableForUserMarketReferenceCurrency.toString()
);
console.log('availableLiquidity', availableLiquidity.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

logs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed in 13c82b4

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Contributor

@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 consolidates APY calculations by combining protocol, merit, and merkl incentives into a single total APY display. The main change replaces individual FormattedNumber display with an IncentivesCard component that calculates and shows the combined rates.

  • Replaces individual APY display with unified incentives card component
  • Adds breakdown calculation for total APY including all incentive types
  • Updates tooltip content to show comprehensive APY breakdown with all incentive sources

Reviewed Changes

Copilot reviewed 10 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/modules/reserve-overview/SupplyInfo.tsx Replaces FormattedNumber + IncentivesButton with unified IncentivesCard component
src/locales/en/messages.po Adds new translation strings for APY breakdown display
src/locales/en/messages.js Updates compiled translation messages
src/hooks/useMerklIncentives.ts Adds breakdown calculation with total APY combining protocol and incentive rates
src/hooks/useMeritIncentives.ts Adds breakdown calculation with total APY combining protocol and incentive rates
src/components/transactions/Borrow/BorrowModalContent.tsx Adds console.log for debugging purposes
src/components/incentives/MeritIncentivesTooltipContent.tsx Enhances tooltip to show detailed APY breakdown with all components
src/components/incentives/IncentivesTooltipContent.tsx Updates tooltip to display comprehensive APY breakdown including all incentive types
src/components/incentives/IncentivesCard.tsx Implements unified APY calculation combining protocol + all incentive types
src/components/incentives/IncentivesButton.tsx Updates to support new breakdown calculations and tooltip display
Comments suppressed due to low confidence (1)

src/locales/en/messages.po:2439

  • The removal of the 'Net APR' translation entry suggests this text is no longer used. Verify that all references to this translation key have been properly updated to use the new 'Net Protocol Incentives' translation instead.
#: src/components/transactions/Borrow/BorrowModalContent.tsx

// amount calculations
const maxAmountToBorrow = getMaxAmountAvailableToBorrow(poolReserve, user);

console.log('maxAmountToBorrow', maxAmountToBorrow);
Copy link
Preview

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

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

Remove the console.log statement as it appears to be leftover debugging code and shouldn't be included in production code.

Suggested change
console.log('maxAmountToBorrow', maxAmountToBorrow);

Copilot uses AI. Check for mistakes.

@foodaka
Copy link
Collaborator Author

foodaka commented Aug 11, 2025

@mgrabina its a good catch on the reserves, ive added it there as well for consistency c5c94fc

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Comment on lines +82 to +86
const displayAPY = hasInfiniteIncentives
? 'Infinity'
: isBorrow
? protocolAPY - (protocolIncentivesAPR as number) - meritIncentivesAPR - merklIncentivesAPR
: protocolAPY + (protocolIncentivesAPR as number) + meritIncentivesAPR + merklIncentivesAPR;
Copy link
Contributor

Choose a reason for hiding this comment

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

Be aware that you approximate APR as APY here

Copy link
Contributor

@NandyBa NandyBa left a comment

Choose a reason for hiding this comment

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

Before PR:
Capture d’écran 2025-08-11 à 16 04 46

After PR:
Capture d’écran 2025-08-11 à 16 03 40

This is wrong


One user have
Capture d’écran 2025-08-11 à 16 09 07

And you still displaying invalid value here
Capture d’écran 2025-08-11 à 16 08 18

@NandyBa
Copy link
Contributor

NandyBa commented Aug 11, 2025

Add of incentive on the reserve page is a good thing

Copy link

Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@foodaka foodaka merged commit 930dc79 into main Aug 12, 2025
17 of 18 checks passed
@foodaka foodaka deleted the feat/aprs branch August 12, 2025 10:31
@MartinGbz
Copy link
Contributor

MartinGbz commented Aug 12, 2025

There are APY display issues on the following components:

(Rewards APY are only display on the Supply and SwapSupplyFrom modals)

  • SwapSupplyTo:
SupplySwapTo
  • Borrow
Borrow
  • SwapBorrowFrom
SwapBorrowFrom
  • SwapBorrowFrom
SwapBorrowTo

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.

4 participants