Skip to content

feat: implement grantee spending power reporting api #217#258

Open
oscarj007 wants to merge 1 commit intoGrant-Stream:mainfrom
oscarj007:feat/217-grantee-spending-power-api
Open

feat: implement grantee spending power reporting api #217#258
oscarj007 wants to merge 1 commit intoGrant-Stream:mainfrom
oscarj007:feat/217-grantee-spending-power-api

Conversation

@oscarj007
Copy link
Copy Markdown

@oscarj007 oscarj007 commented Mar 29, 2026

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
Added get_grantee_spending_power function: A public, read-only function in src/lib.rs.Basis Points (BPS) Integration: Used a $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.

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:
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 $10%$ and $5%$ inflation scenarios.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@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! 🚀

Learn more about application limits

@JerryIdoko
Copy link
Copy Markdown
Contributor

resolve conflicts

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.

138. Implement Grantee_Spending_Power_Reporting_API

2 participants