feat: add campaign apy - #5803
Conversation
🦋 Changeset detectedLatest commit: 25081e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryAdds per-user APY calculation and UI treatment for collateral-gated Merkl borrow campaigns.
Confidence Score: 3/5The PR should not merge until transaction simulations recompute Merkl campaign eligibility and prospective badges account for every gated campaign. Account-dependent Merkl distributions are copied unchanged into post-transaction previews, and markets with multiple gated campaigns receive a prospective APY based on only one campaign. Files Needing Attention: apps/evm/src/clients/api/queries/useGetPools/useGetPoolsQuery/getPools/index.ts, apps/evm/src/clients/api/queries/getSimulatedPool/index.ts, apps/evm/src/components/Apy/index.tsx
|
| Filename | Overview |
|---|---|
| apps/evm/src/clients/api/queries/useGetPools/useGetPoolsQuery/getPools/appendMerklCollateralGates/index.ts | Computes campaign eligibility and prorated APY correctly for current pool state, but its account-dependent output is not recomputed during transaction simulation. |
| apps/evm/src/clients/api/queries/useGetPools/useGetPoolsQuery/getPools/index.ts | Integrates Merkl gate resolution into fetched pool construction, leaving simulated pools with stale derived values. |
| apps/evm/src/components/Apy/index.tsx | Adds the Merkl prospective-APY badge but retains only the last ineligible campaign when multiple campaigns coexist. |
| apps/evm/src/components/Apy/DistributionList/index.tsx | Centralizes reward rows and gated-campaign messaging, while violating the repository's one-function-per-file organization rule. |
| apps/evm/src/components/ApyBreakdown/formatRows/index.tsx | Displays borrow rewards with the correct sign and exposes unavailable campaign maximums, but consumes potentially stale simulated gate values. |
Reviews (1): Last reviewed commit: "feat: add campaign apy" | Re-trigger Greptile
| // Resolve per-user reward APYs of collateral-gated Merkl campaigns | ||
| appendMerklCollateralGates({ pools }); |
There was a problem hiding this comment.
Simulations retain stale Merkl gates
When a transaction preview changes participating collateral, collateral status, or eligible debt, getSimulatedPool copies the Merkl gate and prorated APY computed for the current pool instead of recalculating them. The form therefore shows stale eligibility, reward APY, and total post-transaction APY—for example, withdrawing the qualifying collateral can leave the reward displayed as active.
Knowledge Base Used: Lending transaction flows
| } else if ( | ||
| distribution.type === 'merkl' && | ||
| distribution.collateralGate?.isUserEligible === false | ||
| ) { | ||
| gatedMerklDistribution = distribution; |
There was a problem hiding this comment.
Badge drops additional gated campaigns
When a borrow market has multiple active gated Merkl campaigns for which the user is ineligible, this assignment retains only the last campaign and the badge subtracts only its maximum APY. The tooltip still lists every campaign, so the prospective APY shown on the badge omits rewards included in its breakdown.
Jira ticket(s)
VPD-1960
Changes