Implement Governance Engine, Tiered Staking System & Comprehensive Documentation#1
Open
israel-capslock wants to merge 9 commits into
Open
Implement Governance Engine, Tiered Staking System & Comprehensive Documentation#1israel-capslock wants to merge 9 commits into
israel-capslock wants to merge 9 commits into
Conversation
- Introduced a `Proposals` map to store governance proposal data. - Each proposal includes creator, description, start and end blocks, execution status, votes for and against, and minimum votes required. - This enhancement supports decentralized decision-making by allowing stakeholders to vote on protocol changes.
…on maps - Introduced `UserPositions` map to track user financial data including collateral, debt, health factor, staked STX, token balance, voting power, tier level, and rewards multiplier. - Added `StakingPositions` map to manage staking details such as staked amount, start block, last claim, lock period, cooldown start, and accumulated rewards. - Implemented `TierLevels` map to define tier configurations with minimum stake, reward multiplier, and enabled features for each tier.
…, and reward calculation - Implemented `get-tier-info` to determine user tier based on staked amount, categorizing into Silver, Gold, and Platinum tiers. - Added `calculate-lock-multiplier` to compute bonus multipliers based on lock periods, with higher multipliers for longer lock durations. - Developed `calculate-rewards` function to calculate user rewards based on staked amount, base rate, multiplier, and number of blocks.
- Implemented `is-valid-description` to validate proposal descriptions based on length constraints. - Added `is-valid-lock-period` to ensure lock periods are either 0, 1 month, or 2 months. - Developed `is-valid-voting-period` to validate voting periods within a specified block range. - Created `initialize-contract` public function to set up the tier system with Silver, Gold, and Platinum tiers, each with specific minimum stakes, reward multipliers, and enabled features.
- Added `stake-stx` public function to allow users to stake STX with a specified lock period. - Validates lock period, contract pause state, and minimum stake amount. - Transfers STX from the user to the contract. - Calculates new total stake, tier level, and reward multiplier based on the stake amount and lock period. - Updates the user's staking position and financial position with new tier and reward information. - Updates the total STX pool in the protocol.
- Implemented `initiate-unstake` public function to start the unstaking process by setting a cooldown period. - Validates the user's staking position and ensures no active cooldown. - Updates the staking position with the current block height as the cooldown start. - Added `complete-unstake` public function to finalize the unstaking process after the cooldown period. - Validates the cooldown period has passed. - Transfers the staked STX back to the user. - Clears the user's staking position from the map.
- Implemented `create-proposal` public function to allow users to create governance proposals. - Validates the user's voting power, proposal description, and voting period. - Generates a new proposal ID and sets the proposal details including creator, description, start and end blocks, execution status, votes for and against, and minimum votes required. - Updates the proposal count and returns the new proposal ID.
- Implemented `vote-on-proposal` public function to allow users to vote on governance proposals. - Validates the proposal ID, voting period, and user's voting power. - Updates the proposal with the user's vote (for or against) and their voting power. - Added admin controls: - `pause-contract` to allow the contract owner to pause the protocol. - `resume-contract` to allow the contract owner to resume the protocol. - Created read-only functions: - `get-contract-owner` to return the contract owner. - `get-stx-pool` to return the total STX liquidity in the protocol. - `get-proposal-count` to return the current number of proposals.
- Detailed introduction and protocol highlights. - Description of core components including token economy, tiered staking, governance engine, and reward system. - Documentation of smart contract functions for staking, governance, and administrative controls. - Explanation of reward calculation formula and example. - Security features including cooldown system, tiered safeguards, and governance checks. - Error reference table with codes, descriptions, and resolutions. - Development guide with requirements and deployment checklist.
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.
Overview
This PR introduces core functionality for Bitstack Analytics Protocol - a decentralized data intelligence platform combining stakeholder governance with multi-tiered financial incentives. Key architectural components include:
New Features Implemented
Decentralized Governance System
Proposalsregistry with creator details/voting timelinesTiered Financial Positions
Dynamic Reward Infrastructure
Security Architecture
Impact Analysis
This implementation enables:
Documentation