Skip to content

Feat/contract provider revenue withdrawal (#90)#121

Closed
felixkamau wants to merge 8 commits into
Dev-AdeTutu:mainfrom
felixkamau:feat/contract-provider-revenue-withdrawal
Closed

Feat/contract provider revenue withdrawal (#90)#121
felixkamau wants to merge 8 commits into
Dev-AdeTutu:mainfrom
felixkamau:feat/contract-provider-revenue-withdrawal

Conversation

@felixkamau
Copy link
Copy Markdown

@felixkamau felixkamau commented Apr 24, 2026

Summary

This PR introduces a centralized treasury mechanism for the solar_grid smart contract. It replaces per-provider revenue tracking with a global treasury model and adds a configurable revenue split ratio. Tests have also been updated to align with recent Soroban SDK changes.

Related Issue

Closes #90

Type of Change

  • Bug fix
  • New feature
  • Refactor / code cleanup
  • Documentation update
  • Dependency update
  • Other:

Changes Made

  • Configurable Treasury Share

    • Added treasury_share to initialize to define the percentage of payments allocated to the treasury.
  • Centralized Revenue Tracking

    • Replaced provider_balances with a single TREASURY storage key for simplified accounting.
  • Payment Logic Update

    • Updated make_payment to automatically split incoming payments based on treasury_share.
  • Treasury Management Functions

    • Added:
      • withdraw_revenue for admin withdrawals
      • get_treasury to query current treasury balance
    • Removed legacy get_provider_revenue functionality.
  • Test Fixes (Soroban SDK Compatibility)

    • Updated event assertions to use get_payload() to match the latest SDK behavior.

How to Test

  1. Navigate to the contract directory:
    cd contracts/solar_grid
    

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 24, 2026

@felixkamau 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

@Dev-AdeTutu
Copy link
Copy Markdown
Owner

@felixkamau resolve conflict

@felixkamau
Copy link
Copy Markdown
Author

@Dev-AdeTutu

@felixkamau felixkamau closed this May 7, 2026
@felixkamau felixkamau deleted the feat/contract-provider-revenue-withdrawal branch May 7, 2026 19:53
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.

feat(contract): implement provider revenue withdrawal function

2 participants