Skip to content

Implement Tiered Staking System & Governance Framework#1

Open
peace-source wants to merge 6 commits intomainfrom
feat/implement
Open

Implement Tiered Staking System & Governance Framework#1
peace-source wants to merge 6 commits intomainfrom
feat/implement

Conversation

@peace-source
Copy link
Owner

Overview

This PR introduces core protocol upgrades for the Bitcoin Analytics Protocol, combining 6 strategic commits to enable:

  • Dynamic tier-based rewards
  • Stake-weighted governance
  • Enhanced contract controls
  • Comprehensive documentation

Key Improvements

1. Tiered Staking Engine

  • Added tier-level and rewards-multiplier tracking in UserPositions
  • Implemented lock-period bonuses (1-1.5x multiplier)
  • Integrated automatic tier upgrades based on stake size

2. Governance Framework

  • Proposal creation with 1M voting power threshold
  • Time-bound voting system (100-2880 blocks)
  • Stake-weighted voting mechanism

3. Security Enhancements

  • Contract pause/resume functionality
  • Cooldown-protected withdrawals
  • Owner-restricted emergency controls

4. Documentation

  • Added protocol overview and technical specs
  • Detailed reward calculation formulas
  • Governance process flowcharts
  • Security mechanism explanations

Deployment Notes

1. Initialize contract with admin privileges
2. Configure base_reward_rate parameter
3. Verify tier thresholds in TierLevels map

Approval Recommended For:

  • Protocol engineers
  • Security auditors
  • Governance committee

…r tracking

The `UserPositions` map has been updated to include `tier-level` and `rewards-multiplier` fields. These additions enable the protocol to track user-specific tier levels and dynamic reward multipliers, which are essential for implementing the tiered rewards system and incentivizing long-term staking.

Key changes:
- Added `tier-level` field to represent the user's current tier in the rewards system.
- Added `rewards-multiplier` field to calculate dynamic rewards based on staking duration and tier.

Impact:
- Enables a more sophisticated rewards mechanism tied to user activity and staking behavior.
- Lays the groundwork for implementing tier-based governance and reward distribution.
- Improves the protocol's ability to incentivize user participation and loyalty.
…staking logic

Enhanced the `stake-stx` function to dynamically update the user's `tier-level` and `rewards-multiplier` based on their total staked amount and lock period. This ensures that users are rewarded according to their staking behavior and tier system configuration.

Key changes:
- Integrated `get-tier-info` to determine the user's tier level based on their total staked amount.
- Added `calculate-lock-multiplier` to adjust rewards based on the lock period.
- Updated `UserPositions` map to reflect the new `tier-level` and `rewards-multiplier` values.

Impact:
- Improves user incentives by dynamically adjusting rewards based on staking behavior.
- Strengthens the tiered rewards system, encouraging higher stakes and longer lock periods.
- Enhances the protocol's ability to manage user engagement and reward distribution effectively.
Introduced the `create-proposal` function to enable users to create governance proposals. This function validates the user's voting power and ensures the proposal meets protocol requirements before being added to the `Proposals` map.

Key changes:
- Added validation to ensure users have at least 1,000,000 voting power to create a proposal.
- Included checks for valid proposal descriptions and voting periods.
- Updated the `Proposals` map to store proposal details, including creator, description, voting period, and execution status.
- Incremented the `proposal-count` variable to track the total number of proposals.

Impact:
- Empowers users with sufficient voting power to participate in protocol governance.
- Establishes a robust framework for decentralized decision-making.
- Enhances the protocol's transparency and community engagement.
Implemented key contract control functions (`pause-contract` and `resume-contract`) to allow the contract owner to manage the protocol's operational state. Additionally, introduced the `vote-on-proposal` function to enable users to participate in governance by voting on proposals.

Key changes:
- Added `pause-contract` and `resume-contract` functions to toggle the `contract-paused` state, ensuring only the contract owner can perform these actions.
- Developed the `vote-on-proposal` function to allow users to cast votes on governance proposals, with validation for voting power and proposal validity.
- Included read-only functions (`get-contract-owner`, `get-stx-pool`, and `get-proposal-count`) for retrieving essential contract information.

Impact:
- Enhances protocol governance by enabling community-driven decision-making.
- Provides the contract owner with tools to manage the protocol during emergencies or upgrades.
- Improves transparency and accessibility through read-only functions.
…validation

Added private utility functions to streamline calculations and validations for staking and governance operations. These functions enhance modularity and maintainability of the contract.

Key changes:
- `get-tier-info`: Determines the user's tier level and reward multiplier based on their staked amount.
- `calculate-lock-multiplier`: Calculates the reward multiplier based on the staking lock period.
- `calculate-rewards`: Computes staking rewards for a user over a specified number of blocks.
- `is-valid-description`: Validates the length of a proposal description.
- `is-valid-lock-period`: Ensures the lock period is one of the allowed durations.
- `is-valid-voting-period`: Validates the voting period for governance proposals.

Impact:
- Improves code readability and reusability by encapsulating common logic.
- Ensures consistent validation and calculation across staking and governance features.
- Enhances the protocol's ability to handle dynamic reward and governance configurations.
…tocol smart contract

Enhanced the `README.md` file to provide detailed documentation for the Bitcoin Analytics Protocol (BAP). This update includes an overview, key features, technical specifications, function references, reward calculation details, governance processes, and security mechanisms.

Key additions:
- **Overview**: High-level description of the protocol's purpose and capabilities.
- **Key Features**: Detailed explanation of staking, governance, rewards, and security features.
- **Technical Specification**: Core components, state variables, and their roles.
- **Function Reference**: Parameters and descriptions for staking, governance, and control functions.
- **Reward Calculation**: Formula and multiplier components for dynamic rewards.
- **Governance Process**: Step-by-step explanation of proposal creation, voting, and execution.
- **Security Model**: Protection mechanisms and emergency protocols.

Impact:
- Improves developer onboarding by providing clear and structured documentation.
- Enhances transparency and usability for protocol users and contributors.
- Establishes a foundation for future updates and community engagement.
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.

1 participant

Comments