-
Notifications
You must be signed in to change notification settings - Fork 89
Fix/payment docs #1034
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
Fix/payment docs #1034
Conversation
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 fixes a broken usage percentage calculation in the payment documentation snippets and adds clarification to the staking rewards documentation.
Key Changes:
- Refactored the usage percentage calculation to properly handle edge cases (when avgPrice ≤ basePrice or avgPrice ≥ maxPrice)
- Added explicit conditional logic to avoid division errors and ensure calculated usage stays within 0-100% range
- Added specific dollar amount ($1,500 in LITKEY tokens) to the baseline reward description in staking documentation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/snippets/PriceProvider.jsx | Improved usage percentage calculation logic with better edge case handling and added debug logging |
| docs/node-ops/staking-and-delegation.mdx | Clarified baseline reward amount by adding specific $1,500 value |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Debug: log values to understand why calculation might fail | ||
| console.log('Usage calculation:', { | ||
| nodePrices: nodePriceData.map(n => n.price.toString()), | ||
| avgPrice: avgPrice.toString(), | ||
| basePrice: basePrice.toString(), | ||
| maxPrice: maxPrice.toString(), | ||
| avgVsBase: avgPrice.lt(basePrice) ? 'avg < base' : avgPrice.eq(basePrice) ? 'avg = base' : 'avg > base', | ||
| }); |
Copilot
AI
Dec 18, 2025
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.
Debug console.log statement should be removed before merging to production. This will pollute the browser console for end users viewing the documentation.
| calculatedUsage = Math.max(0, Math.min(100, calculatedUsage)); | ||
| } | ||
| } | ||
| console.log('Calculated usage:', calculatedUsage); |
Copilot
AI
Dec 18, 2025
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.
Debug console.log statement should be removed before merging to production. This will pollute the browser console for end users viewing the documentation.
| console.log('Calculated usage:', calculatedUsage); |
… dynamic pricing components
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Chris Cassano <1285652+glitch003@users.noreply.github.com>
Payment docs are broken due to a problem calculating usage percentage. this PR also includes a few other docs fixes