feat: Clean Ledger — finalize_and_purge with cleanup bounty#257
Open
mgtmdccix-oss wants to merge 2 commits intoGrant-Stream:mainfrom
Open
feat: Clean Ledger — finalize_and_purge with cleanup bounty#257mgtmdccix-oss wants to merge 2 commits intoGrant-Stream:mainfrom
mgtmdccix-oss wants to merge 2 commits intoGrant-Stream:mainfrom
Conversation
…ant-Stream#102) - oracle_heartbeat(): oracle signals liveness, records timestamp - propose_safety_rate(): DAO member opens vote after 48h oracle silence - vote_on_safety_rate(): weighted DAO vote with double-vote protection - execute_safety_rate(): applies rate on 90% supermajority after voting ends - get_exchange_rate(): returns manual rate or (1,1) fallback - Added SafetyVoteProposal struct, SafetyVoteStatus enum, DataKey variants, error codes 304-309, and constants for timeouts/thresholds - Tests: heartbeat blocks proposal, full flow, rejection below 90%, oracle recovery blocks execution
Implements the Clean Ledger / Social Cleanup bounty logic: - Any caller can invoke finalize_and_purge() on a 100%-completed grant - Removes the grant's storage entry to reduce Stellar state bloat - Pays caller a small bounty (5 bps of the platform fee) from treasury - Guards: status must be Completed and remaining_balance must be zero - Emits a 'purged' event for off-chain indexers Closes: optimization/economics label issue
|
@mgtmdccix-oss 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! 🚀 |
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 #220
Summary
Implements the Clean Ledger / Social Cleanup bounty incentive to prevent zombie contracts and reduce Stellar state bloat.
What changed
contracts/grant_contracts/src/cleanup_bounty.rscontracts/grant_contracts/src/lib.rs— registered the new module and removed a duplicatepub mod temporal_guardHow it works
finalize_and_purge(env, grant_id, caller)— permissionless, any address can call it:status == Completedandremaining_balance == 0total_amount × platform_fee_bps / 10_000 × 5 / 10_000(0.05% of the platform fee)env.storage().instance().remove()— frees the ledger entrypurgedeventEconomics
CLEANUP_BOUNTY_BPSLabels
optimizationeconomicslogic