Hipo: fix APY halved by outdated treasury state semantics#2844
Conversation
Since Hipo's treasury upgrade, get_treasury_state returns the pool exchange rate before/after the latest round (previous_rate/current_rate) at stack positions 11/12, replacing last_staked/last_recovered. The rate advances once per validation round, so the growth must be compounded per single round duration; the old 2-round duration halved the APY (showed ~8.3% instead of the actual ~17.3%). Also adds apyBaseInception derived from the launch exchange rate of 1.0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Hipo adapter now calculates APY from treasury exchange-rate changes, derives compounding from round duration, and returns an additional inception-based APY metric. ChangesHipo APY calculation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
The hipo adapter exports pools: Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/adaptors/hipo/index.js`:
- Around line 52-63: Validate previousRate, currentRate, and roundDuration in
the APY calculation before computing compoundingFrequency; require finite rate
values and roundDuration greater than zero, and throw when any value is invalid.
Remove the `|| 1` fallback from the currentRate/previousRate calculation so
malformed treasury data cannot be persisted as a 0% APY.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 01bad34c-1217-45b8-a8c2-617077890b1f
📒 Files selected for processing (1)
src/adaptors/hipo/index.js
Throw on non-finite or non-positive rates and round duration instead of falling back to a 0% APY when treasury data is malformed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The hipo adapter exports pools: Test Suites: 1 passed, 1 total |
Since Hipo's treasury upgrade, get_treasury_state returns the pool exchange rate before/after the latest round (previous_rate/current_rate) at stack positions 11/12, replacing last_staked/last_recovered. The rate advances once per validation round, so the growth must be compounded per single round duration; the old 2-round duration halved the APY (showed ~8.3% instead of the actual ~17.3%). Also adds apyBaseInception derived from the launch exchange rate of 1.0.
Summary by CodeRabbit