Skip to content

feat: refactored to use new endpoint SavingsGhoIncentive#2963

Open
AGMASO wants to merge 1 commit intoSDK-779-interface-incentivesfrom
fix/sgho-rewards-with-new-endpoint
Open

feat: refactored to use new endpoint SavingsGhoIncentive#2963
AGMASO wants to merge 1 commit intoSDK-779-interface-incentivesfrom
fix/sgho-rewards-with-new-endpoint

Conversation

@AGMASO
Copy link
Copy Markdown
Collaborator

@AGMASO AGMASO commented May 1, 2026

General Changes

  • Refactor to use the new savingsGhoIncentive GraphQL endpoint for all sGHO APR/APY displays and tooltips, while keeping reserve-level Merit incentives scoped to actual reserve incentives.

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)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

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

Project Deployment Actions Updated (UTC)
interface Ready Ready Preview, Comment May 1, 2026 0:46am

Request Review

Copy link
Copy Markdown
Contributor

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 refactors sGHO-related APR/APY fetching and UI to use the new savingsGhoIncentive GraphQL endpoint, and wires that data into the various sGHO/staking surfaces and incentive tooltips.

Changes:

  • Added useSavingsGhoIncentive hook to query the new savingsGhoIncentive GraphQL endpoint.
  • Replaced sGHO incentive displays/tooltips to use SavingsGhoIncentivesButton (backed by the new hook).
  • Removed legacy useStakeTokenAPR and relaxed filtering in useMeritIncentives.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/modules/staking/StakingPanelNoWallet.tsx Switches staking incentives button to the new sGHO incentives source.
src/modules/staking/GhoStakingPanel.tsx Switches staking incentives button to the new sGHO incentives source.
src/modules/sGho/SGhoHeader.tsx Replaces legacy APR hook usage with useSavingsGhoIncentive for header APY display and user estimates.
src/modules/sGho/SGhoDepositPanel.tsx Updates “Current APY” calculation and tooltip button to use the new endpoint.
src/modules/reserve-overview/Gho/SavingsGho.tsx Uses useSavingsGhoIncentive and new incentives button for Savings GHO panel.
src/modules/markets/Gho/GhoBanner.tsx Updates Savings GHO banner APY display to use the new endpoint.
src/hooks/useStakeTokenAPR.ts Removes the legacy adapter hook (no longer used).
src/hooks/useSavingsGhoIncentive.ts Introduces the new GraphQL hook for savingsGhoIncentive.
src/hooks/useMeritIncentives.ts Removes actionKey/protocolAction allowlist filtering from Merit incentives selection.
src/components/transactions/SavingsGho/SavingsGhoModalDepositContent.tsx Replaces merit incentives APR sourcing with the new endpoint for modal details.
src/components/incentives/IncentivesButton.tsx Adds SavingsGhoIncentivesButton and refactors Merit button rendering to reuse shared content.
Comments suppressed due to low confidence (1)

src/hooks/useMeritIncentives.ts:166

  • Removing the actionKeyprotocolAction allowlist means stake-scoped Merit campaigns (e.g. ethereum-sgho, ethereum-stkgho) can now be returned for generic supply/borrow contexts wherever useMeritIncentives is used (markets/dashboard/tooltips). Consider restoring this filtering (or an equivalent backend-side filter) to avoid showing stake-only campaigns in the wrong protocol context.
  for (const m of merits) {
    let apr = 0;
    const enriched = m as unknown as EnrichedMerit;
    const rewardTokenAddress = enriched.rewardTokenAddress ?? '';
    const rewardTokenSymbol = enriched.rewardTokenSymbol ?? '';

    if (m.__typename === 'MeritSupplyIncentive') {
      apr = parseFloat(m.extraSupplyApr.formatted);
    } else if (m.__typename === 'MeritBorrowIncentive') {
      apr = parseFloat(m.borrowAprDiscount.formatted);
    } else if (m.__typename === 'MeritBorrowAndSupplyIncentiveCondition') {
      apr = parseFloat(m.extraApr.formatted);
    }

    if (!Number.isFinite(apr) || apr <= 0) continue;

    totalMeritAPR += apr;
    const actionKey = enriched.actionKey ?? '';
    if (actionKey) {
      activeActions.push(actionKey);
      actionMessages[actionKey] = {
        customMessage: enriched.customMessage ?? undefined,
        customForumLink: enriched.customForumLink ?? undefined,
      };
      if (!firstAction) firstAction = actionKey;
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 106 to 113
title={
<Box display="flex" alignItems="center">
<Trans>APR</Trans>
</Box>
}
>
<MeritIncentivesButton
symbol="GHO"
market={currentMarketData.market}
protocolAction={ProtocolAction.stake}
/>
<SavingsGhoIncentivesButton />
</PanelItem>
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

This panel is titled “APR” but renders SavingsGhoIncentivesButton, which supplies a value derived from convertAprToApy(...) (i.e., an APY-style rate). Update the title (and any related labels) to match the value being displayed, or change the value to an actual APR.

Copilot uses AI. Check for mistakes.
value={meritIncentives?.incentiveAPR || '0'}
percent
/>
<DetailsNumberLine description={<Trans>APR</Trans>} value={savingsGhoAPY} percent />
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

savingsGhoAPY is computed as an APY (APR converted to APY), but the modal details line is labeled “APR”. Update the label to “APY” or change the calculation to display the raw APR so the UI is consistent.

Suggested change
<DetailsNumberLine description={<Trans>APR</Trans>} value={savingsGhoAPY} percent />
<DetailsNumberLine description={<Trans>APY</Trans>} value={savingsGhoAPY} percent />

Copilot uses AI. Check for mistakes.
const apr = meritIncentives?.incentiveAPR || '0';
const aprFormatted = (+apr * 100).toFixed(2);
const { data: savingsGhoIncentive } = useSavingsGhoIncentive();
const aprFormatted = savingsGhoIncentive?.aprDecimal
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

aprFormatted is derived by converting an APR to APY (convertAprToApy(...) * 100), but it’s named/formatted as an APR value. This is easy to misapply in UI copy (and can result in “APR” labels showing an APY). Consider renaming to apyFormatted (and/or removing the APR→APY conversion if the intent is to display APR).

Suggested change
const aprFormatted = savingsGhoIncentive?.aprDecimal
const apyFormatted = savingsGhoIncentive?.aprDecimal

Copilot uses AI. Check for mistakes.
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.

2 participants