Skip to content

fix(rfox): source the apy distribution rate from the current epoch - #12754

Merged
kaladinlight merged 1 commit into
developfrom
fix/rfox-apy-current-epoch-rate
Oct 9, 2026
Merged

kaladinlight merged 1 commit into
developfrom
fix/rfox-apy-current-epoch-rate

Conversation

@kaladinlight

@kaladinlight kaladinlight commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Description

The rFOX APY badge read the distribution rate from the latest completed epoch's detailsByStakingContract. A completed epoch only covers contracts that existed when it closed, so the new ethereum mainnet program rendered 0.00% APY until its first epoch (27) completes at the end of October.

The hook now reads the rate from the current epoch metadata's distributionRateByStakingContract, which is what the simulator, emissions pool and current-epoch rewards already use. Revenue still comes from the latest completed epoch as the monthly basis.

Side effect: the sunset arbitrum program now resolves to 0% since the current epoch no longer assigns it a rate, which is accurate.

Issue (if applicable)

closes #

Risk

Low. Display-only change to the APY figure on the rFOX and FOX ecosystem pages, no transaction or wallet changes.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

None.

Testing

Engineering

Validated against live data by replicating the hook's arithmetic: current epoch rate 0.5, epoch 26 revenue $46,893.76, on-chain totalStaked() of 17.14M FOX on the mainnet contract, FOX price at epoch 26 end. Result ~302% APY, matching the figure rendered locally (301.66%, price-feed delta only).

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Open the FOX ecosystem page with the ethereum mainnet rFOX program selected. The APY badge next to the rFOX Staking heading should show a non-zero APY (several hundred percent while the pool is small) instead of 0.00%.

Screenshots (if applicable)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Current APY now uses distribution rates from current epoch metadata. If metadata is unavailable, APY remains undefined; if a staking contract has no listed rate, its rate defaults to zero.

The latest completed epoch only covers contracts that existed when it
closed, so a newly launched program (ethereum mainnet) rendered 0% APY
until its first epoch completed. Read the rate from the current epoch
metadata like the simulator and emissions pool already do.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@kaladinlight
kaladinlight requested a review from a team as a code owner October 9, 2026 18:01
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 859de748-44ed-479d-bbbc-717156c0d21e

📥 Commits

Reviewing files that changed from the base of the PR and between 0626298 and 607a203.


📒 Files selected for processing (1)
  • src/pages/RFOX/hooks/useCurrentApyQuery.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.



📝 Walkthrough

Walkthrough

The current APY selector now reads distribution rates from current epoch metadata by staking contract. It returns undefined when metadata is unavailable and defaults a missing contract rate to 0.

Changes

Current APY

Layer / File(s) Summary
Select rate from current epoch metadata
src/pages/RFOX/hooks/useCurrentApyQuery.ts
The hook reads the staking contract’s rate from current epoch metadata. It returns undefined when metadata is unavailable and uses 0 when the contract has no rate. The callback dependencies include the current metadata value.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: 0xapotheosis


Merge Risk: ⚪ Minimal · up to 607a2

No actionable issue is established in the reviewed change; it appears mergeable after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: sourcing the rFOX APY distribution rate from the current epoch.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the epoch’s rate,
And finds the contract’s current state.
If metadata has not arrived,
No APY is yet derived.
A missing rate becomes zero,
Then off through fields the values go.

Comment @coderabbitai help to get the list of available commands.

@kaladinlight
kaladinlight merged commit 9321cf5 into develop Oct 9, 2026
4 checks passed
@kaladinlight
kaladinlight deleted the fix/rfox-apy-current-epoch-rate branch October 9, 2026 18:17
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