-
Notifications
You must be signed in to change notification settings - Fork 433
feat: show boosted incentives in debt and collateral swap #2663
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
Page | Size (compressed) |
---|---|
global |
1.43 MB (🟡 +4.56 KB) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Sixteen Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
Page | Size (compressed) | First Load |
---|---|---|
/ |
60.9 KB (🟡 +1.31 KB) |
1.49 MB |
/404 |
2.79 KB (🟡 +327 B) |
1.43 MB |
/500 |
3.19 KB (🟡 +283 B) |
1.43 MB |
/bridge |
33.75 KB (🟡 +309 B) |
1.46 MB |
/dashboard |
52.05 KB (🟡 +1.09 KB) |
1.48 MB |
/faucet |
15.21 KB (🟡 +308 B) |
1.44 MB |
/governance |
80.81 KB (🟡 +196 B) |
1.51 MB |
/governance/ipfs-preview |
100.63 KB (🟡 +965 B) |
1.53 MB |
/governance/v3/proposal |
122.85 KB (🟡 +108 B) |
1.55 MB |
/history |
24.04 KB (🟡 +311 B) |
1.45 MB |
/markets |
36.06 KB (🟡 +2.43 KB) |
1.46 MB |
/reserve-overview |
23.31 KB (🟡 +293 B) |
1.45 MB |
/safety-module |
37.37 KB (🟡 +347 B) |
1.47 MB |
/sgho |
79.28 KB (🟡 +323 B) |
1.51 MB |
/staking |
32.11 KB (🟡 +308 B) |
1.46 MB |
/v3-migration |
35.67 KB (🟡 +474 B) |
1.46 MB |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link
is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.
There was a problem hiding this 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 adds the ability to display boosted incentive information in APY for collateral swap and debt swap transactions. It introduces new centralized APY calculation logic and replaces the existing plain APY displays with enhanced components that show incentive breakdowns.
- Adds a new
useBoostedAPY
hook that centralizes APY calculations including protocol, merit, and Merkl incentives - Creates new
DetailsAPYLine
andDetailsAPYTransitionLine
components to display APY with incentives for single and transition views - Updates supply, collateral swap, and debt swap modals to use the new APY components
Reviewed Changes
Copilot reviewed 12 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/hooks/useBoostedAPY.ts |
New hook that centralizes APY calculations including all incentive types |
src/components/transactions/FlowCommons/DetailsAPYLine.tsx |
New component for displaying APY with incentives in single asset views |
src/components/transactions/FlowCommons/DetailsAPYTransitionLine.tsx |
New component for displaying APY transitions with incentives in swap views |
src/components/transactions/Supply/SupplyModalContent.tsx |
Updated to use new DetailsAPYLine component |
src/components/transactions/Switch/CollateralSwap/CollateralSwapModalDetails.tsx |
Replaced plain APY display with DetailsAPYTransitionLine |
src/components/transactions/DebtSwitch/DebtSwitchModalDetails.tsx |
Updated to use DetailsAPYTransitionLine for debt swaps |
src/components/incentives/IncentivesCard.tsx |
Refactored to use the new useBoostedAPY hook |
src/locales/en/messages.po |
Updated localization entries |
src/ui-config/marketsConfig.tsx |
Minor syntax fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
futureMarket={market} | ||
futureProtocolAPY={+swapTarget.reserve.supplyAPY} | ||
futureIncentives={swapTarget.reserve.aIncentivesData} | ||
futureAddress={swapTarget.reserve.aTokenAddress} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For collateral swaps, the future address should use swapTarget.reserve.underlyingAsset
instead of aTokenAddress
to match the pattern used for the current asset address on line 83.
futureAddress={swapTarget.reserve.aTokenAddress} | |
futureAddress={swapTarget.reserve.underlyingAsset} |
Copilot uses AI. Check for mistakes.
futureMarket={market} | ||
futureProtocolAPY={+targetBorrowAPY} | ||
futureIncentives={switchTarget.reserve.vIncentivesData} | ||
futureAddress={switchTarget.reserve.aTokenAddress} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For debt swaps, the future address should use switchTarget.reserve.underlyingAsset
instead of aTokenAddress
to match the pattern used for the current asset address on line 63.
futureAddress={switchTarget.reserve.aTokenAddress} | |
futureAddress={switchTarget.reserve.underlyingAsset} |
Copilot uses AI. Check for mistakes.
const { data: meritIncentives } = useMeritIncentives({ | ||
symbol, | ||
market, | ||
protocolAction, | ||
protocolAPY, | ||
protocolIncentives: incentives, | ||
}); | ||
|
||
const { data: merklIncentives } = useMerklIncentives({ | ||
market, | ||
rewardedAsset: address, | ||
protocolAction, | ||
protocolAPY, | ||
protocolIncentives: incentives, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proper way to handle which asset is passed? ie is it the underlying or is it the atoken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
<TxModalDetails gasLimit={gasLimit} skipLoad={true} disabled={Number(amount) === 0}> | ||
<DetailsNumberLine description={<Trans>Supply APY</Trans>} value={supplyApy} percent /> | ||
<DetailsIncentivesLine | ||
incentives={poolReserve.aIncentivesData} | ||
<DetailsAPYLine | ||
symbol={poolReserve.symbol} | ||
market={currentMarketData.marketTitle} | ||
protocolAction={ProtocolAction.supply} | ||
protocolAPY={+supplyApy} | ||
incentives={poolReserve.aIncentivesData} | ||
address={poolReserve.aTokenAddress} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Pass market ID instead of title when computing boosted supply APY
The new DetailsAPYLine
hook requires the canonical market identifier so that useMeritIncentives
can look up campaign data. Here the supply modal passes currentMarketData.marketTitle
, which is the human‑readable title and does not exist in MERIT_DATA_MAP
. As a result, on markets with Merit campaigns the boosted APY and Merit/Merkl incentive buttons never load and users only see the base APY. The same issue occurs in the wrapped-token branch further down in this file. Please pass currentMarketData.market
in both places.
Useful? React with 👍 / 👎.
{market && ( | ||
<DetailsAPYTransitionLine | ||
symbol={switchSource.reserve.symbol} | ||
market={market} | ||
protocolAction={ProtocolAction.borrow} | ||
protocolAPY={+sourceBorrowAPY} | ||
incentives={switchSource.reserve.vIncentivesData} | ||
address={switchSource.reserve.underlyingAsset} | ||
futureSymbol={switchTarget.reserve.symbol} | ||
futureMarket={market} | ||
futureProtocolAPY={+targetBorrowAPY} | ||
futureIncentives={switchTarget.reserve.vIncentivesData} | ||
futureAddress={switchTarget.reserve.aTokenAddress} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Debt switch uses wrong token addresses for borrow incentives
When rendering the borrow APY transition, the hook is called with address={switchSource.reserve.underlyingAsset}
and futureAddress={switchTarget.reserve.aTokenAddress}
. For borrow actions useBoostedAPY
expects the variable debt token address (the contract that receives the incentives). Passing the underlying asset or aToken causes useMerklIncentives
to filter by the wrong address, so Merkl incentives and the boosted borrow APY never appear even when the market offers them. These props should use variableDebtTokenAddress
for both the current and target reserve.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
General Changes
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.
.env.example
file as well as the pertinant.github/actions/*
files