Skip to content

Add a protocol revenue split function distributing accumulated treasury fees to stakers across all keys #832

Description

@Chucks1093

Summary

Protocol fees accumulate in the treasury but are never redistributed on-chain. A distribute_protocol_revenue function that splits the treasury balance pro-rata across all stakers weighted by their staked key value would create a meaningful on-chain yield for long-term stakers.

Scope

  • Add distribute_protocol_revenue(snapshot_id: u32) callable only by the protocol admin
  • Require an existing holder snapshot identified by snapshot_id to determine staker weights
  • Compute each staker's share as their staked_quantity * current_price / total_staked_value
  • Transfer each staker's share from the treasury to their wallet
  • Emit a protocol_revenue_distributed event with total_distributed, staker_count, and snapshot_id

Acceptance Criteria

  • Each staker receives the correct pro-rata share of treasury balance
  • Unknown snapshot_id panics with SnapshotNotFound
  • Non-admin caller panics with Unauthorized
  • Dust from floor division retained in treasury
  • protocol_revenue_distributed event emitted with correct fields

ETA: 24 hours


Coordinate on Telegram

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions