feat: implement grantee spending power reporting api #217#258
Open
oscarj007 wants to merge 1 commit intoGrant-Stream:mainfrom
Open
feat: implement grantee spending power reporting api #217#258oscarj007 wants to merge 1 commit intoGrant-Stream:mainfrom
oscarj007 wants to merge 1 commit intoGrant-Stream:mainfrom
Conversation
|
@oscarj007 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
resolve conflicts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #217
Description
Summary
Implemented the Grantee Spending Power Reporting API as requested in Issue #217. This PR adds a read-only utility function to the GrantContract to help foundations calculate the real-world purchasing power of disbursed funds based on local inflation data.
Changes Made$10,000$ divisor to allow for high-precision inflation rates (e.g., $5.5% = 550$ BPS) without floating-point numbers.Integer-Safe Math: Implemented the adjustment formula using:$$\text{Adjusted Power} = \frac{\text{Amount} \times 10,000}{10,000 + \text{Inflation_BPS}}$$Validation: Added a check to return 0 if the amount is zero or negative.
Added get_grantee_spending_power function: A public, read-only function in src/lib.rs.Basis Points (BPS) Integration: Used a
Why this is needed
Foundations often grant fixed amounts in stablecoins, but the local value of those tokens can drop significantly in countries with high inflation. This API allows the Grant-Stream dashboard to show "Real-world Impact" metrics, helping donors decide if they need to increase grant sizes to maintain a grantee's standard of living.
TestingBuild:$10%$ and $5%$ inflation scenarios.
Local build was attempted; final verification is pending GitHub Actions CI due to local environment constraints (Windows Linker).Logic Check: Verified the math against manual calculations for