Feature/issues 667 668 669 670 - #718
Merged
levi0005 merged 5 commits intoSep 1, 2026
Merged
Conversation
…istribution to Fee Stakeholders - Add revenue-sharing data structures (DistributionConfig, DistributionProposal) - Add storage keys for stakeholder registry and distribution tracking - Implement propose_distribution() for configuring stakeholder set - Implement execute_distribution() to lock in epoch configuration - Implement claim_share() for eligible stakeholders to withdraw pro-rata shares - Add helper functions: get_distribution_epoch(), get_distribution_config(), get_pending_distribution() - Add bps_of() helper for basis point calculations - Support multi-epoch distributions with changing stakeholder rosters - Comprehensive accounting to prevent over-distribution Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
… Governance - Add Guardian role to Role enum (distinct from Admin/Multisig signers) - Add emergency_pause_by_guardian() for immediate protocol halt - Enable single guardian to trigger pause without multisig/timelock - Require full governance workflow to unpause (multisig + timelock) - Add tracking for emergency pause initiator and timestamp - Add query functions: get_last_emergency_pause_time(), get_emergency_pause_initiator() - Add require_guardian() helper for role validation - Implements 'fast to pause, slow to unpause' security pattern - Edge case handling: guardian role revocation during incident Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…nce Timelock Duration - Convert GOVERNANCE_TIMELOCK_DELAY from hardcoded constant to governed parameter - Add TimelockDelay variant to ParameterKey enum in shared types - Implement minimum timelock bound (12 hours = 43,200 seconds) - Implement maximum timelock bound (90 days = 7,776,000 seconds) - Add get_governance_timelock_delay() getter with default 24-hour fallback - Initialize governed timelock parameter in contract initialization - Store original timelock on proposals via timelock_delay field - Ensure in-flight proposals retain their original timelock on parameter changes - Update Proposal and ParameterProposal structs to store timelock_delay - Apply to both governance module and price_oracle contract - Prevent retroactive timelock changes from affecting committed proposals Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…or Executed Governance Proposals - Add get_total_proposal_count() to get multisig proposal count - Add get_total_parameter_proposal_count() to get parameter proposal count - Implement query_executed_proposals() to retrieve executed multisig proposals - Implement query_executed_parameter_proposals() to retrieve executed parameter changes - Implement query_pending_proposals() to monitor in-flight governance proposals - Return full proposal details including voting info, timing, and status - Support pagination with configurable limits (capped at 100) - Enable searchable audit trail showing what changed, who voted, when - Read-only interface with no authorization required for querying - Useful for SDK indexer integration and dashboard visualization Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
@Able-faz-system 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.
Summary
This pull request implements comprehensive governance, revenue-sharing, and audit features for the Kora Protocol, addressing four high-complexity
issues. The changes enhance protocol security, enable stakeholder revenue sharing, improve governance transparency, and provide parameter flexibility.
Closes #667
Closes #668
Closes #669
Closes #670
Issues Addressed
Issue #667: Treasury Revenue-Sharing Distribution to Fee Stakeholders
Complexity: High (200 points)
Implements a mechanism for the treasury to regularly distribute protocol fees to a defined set of stakeholders, enabling actual revenue-sharing beyond
point-based recognition systems.
Changes:
DistributionConfigandDistributionProposalstructs for epoch-based distribution managementpropose_distribution()- Admin proposes stakeholder set and distribution percentage (0-10,000 bps)execute_distribution()- Locks epoch configuration after timelock expiresclaim_share()- Eligible stakeholders withdraw pro-rata shares from distribution poolget_distribution_epoch()- Current epoch numberget_distribution_config()- Configuration for specific epochget_pending_distribution()- Pending proposal detailsbps_of()for safe basis point calculationsKey Features:
Issue #669: Emergency Multi-Role Pause Governance
Complexity: High (200 points)
Addresses security vulnerabilities in single-admin pause mechanism by introducing a Guardian role enabling immediate protocol halt without multisig
overhead, while requiring full governance for unpause (fast to pause, slow to unpause pattern).
Changes:
Guardianrole toRoleenum, distinct from Admin and Multisig signersemergency_pause_by_guardian()- Any guardian can trigger immediate pause without multisig/timelockget_last_emergency_pause_time()- Query last emergency pause timestampget_emergency_pause_initiator()- Query guardian who initiated pauserequire_guardian()for role validationKey Features:
Issue #670: Governance Parameter for Governance Timelock Duration Itself
Complexity: High (200 points)
Converts hardcoded
GOVERNANCE_TIMELOCK_DELAYconstant into a governed, adjustable parameter with enforced minimum bounds, allowing protocols to modifytimelock durations as they mature without requiring full contract upgrades.
Changes:
TimelockDelayvariant toParameterKeyenum in shared typesProposalandParameterProposalstructs withtimelock_delayfield to store original timelock at creationget_governance_timelock_delay()- Get current governed timelock with 24-hour default fallbackinitialize()now sets default timelock parameter (24 hours = 86,400 seconds)require_valid_parameter()to handle timelock constraintsKey Features:
Issue #668: On-Chain Audit Trail Dashboard for Executed Governance Proposals
Complexity: High (200 points)
Provides transparent, searchable queryable interface for all executed governance proposals, enabling visibility into "what changed, who voted, when"
without manual proposal ID checking.
Changes:
get_total_proposal_count()- Get total multisig proposal count for paginationget_total_parameter_proposal_count()- Get total parameter proposal countquery_executed_proposals()- Retrieve executed multisig actions with full voting details (paginated, limit 100)query_executed_parameter_proposals()- Retrieve executed parameter changes with governance detailsquery_pending_proposals()- Monitor in-flight governance proposals not yet executedKey Features:
Technical Details
File Changes
contracts/treasury/src/lib.rs(262 insertions)contracts/access_control/src/lib.rs(183 insertions)contracts/shared/src/types.rs(5 insertions)TimelockDelayparameter typetimelock_delayfield toProposalandParameterProposalstructsError Handling
New Treasury Errors (4):
NotEligibleStakeholder(16) - Caller not in stakeholder registryNoShareAvailable(17) - No claimable share or already claimedInvalidDistributionConfig(18) - Invalid distribution configurationDistributionProposalNotFound(19) - No pending distribution proposalNew Access Control Errors (2):
NotGuardian(32) - Caller not assigned Guardian roleGuardianEmergencyPauseFailed(33) - Emergency pause cannot be triggeredSecurity Considerations
Testing Recommendations
Compatibility
initialize())Documentation
Related Issues
Commits
1096675- Issue [High] Implement Treasury Revenue-Sharing Distribution to Fee Stakeholders #667: Implement Treasury Revenue-Sharing Distribution61fa075- Issue [High] Implement Emergency Multi-Role Pause Governance #669: Implement Emergency Multi-Role Pause Governance3b92969- Issue [High] Add a Governance Parameter for the Governance Timelock Duration Itself #670: Add Governance Parameter for Timelock Durationb93a4a6- Issue [High] Add an On-Chain Audit Trail Dashboard for Executed Governance Proposals #668: Add Governance Audit Trail Dashboard