-
Notifications
You must be signed in to change notification settings - Fork 0
BitVault Protocol: Feature Enhancements & System Improvements #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nathaniel-cmd
wants to merge
7
commits into
main
Choose a base branch
from
feat/add-contract
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
The `liquidation-history` map was introduced to record details of liquidation events, including the timestamp, collateral liquidated, and debt repaid. This feature enhances transparency and provides historical data for auditing and monitoring purposes. Key changes: - Added a new `liquidation-history` map with fields: `timestamp`, `collateral-liquidated`, and `debt-repaid`. - Ensures that all liquidation events are logged for future reference and analysis. Impact: - Improves protocol transparency by maintaining a historical record of liquidation events. - Facilitates better monitoring and auditing of the system's liquidation processes. - Enhances user trust by providing clear and accessible data on liquidation activities.
This update introduces the `get-collateral-ratio` read-only function, which calculates and returns the collateralization ratio for a user's position. The ratio is expressed as a percentage, providing users with a clear view of their position's health. Key changes: - Added `get-collateral-ratio` function to compute the ratio of collateral value to debt. - Integrated price data (`btc-price`) and user position details (`collateral` and `debt`) for accurate calculations. - Handles edge cases where the debt is zero, returning a ratio of `0`. Impact: - Improves user experience by enabling real-time monitoring of position health. - Enhances transparency and usability of the protocol. - Supports better decision-making for users managing their collateralized positions.
This update enhances the `deposit-collateral` function by integrating robust validation mechanisms to ensure user deposits meet protocol requirements. It includes checks for minimum deposit amounts and collateralization ratio compliance. Key changes: - Added `check-min-collateral` to validate deposit amounts against minimum thresholds. - Integrated `check-position-health` to ensure positions maintain the required collateralization ratio. - Updated `deposit-collateral` to enforce these validations before updating user positions. Impact: - Improves protocol security by preventing under-collateralized positions. - Enhances user experience by providing clear error handling for invalid deposits. - Ensures compliance with system parameters, maintaining protocol integrity.
This update introduces two key public functions, `mint-stablecoin` and `repay-stablecoin`, enabling users to mint new stablecoins against their collateral and repay their debt, respectively. These functions ensure proper validation and maintain the protocol's collateralization requirements. Key changes: - Added `mint-stablecoin` to allow users to mint stablecoins by increasing their debt, ensuring sufficient collateralization and compliance with system limits. - Added `repay-stablecoin` to enable users to repay their stablecoin debt, reducing their outstanding liabilities and updating the total supply. - Integrated validation checks for amount bounds, price freshness, and collateralization ratio. Impact: - Enhances user functionality by enabling stablecoin minting and debt repayment. - Maintains protocol integrity by enforcing collateralization and system limits. - Improves user experience with clear error handling and position updates.
…tions This update introduces key functionalities for managing collateral, enforcing liquidation, and administering protocol parameters. These features enhance user interactions and ensure the protocol's stability and compliance. Key changes: - Added `withdraw-collateral` function to allow users to withdraw excess collateral while maintaining proper collateralization. - Implemented `liquidate-position` function to enable liquidation of undercollateralized positions, ensuring protocol health. - Added administrative functions: - `set-price` for updating BTC price, restricted to the authorized price oracle. - `set-price-oracle` for updating the price oracle address, restricted to the contract owner. Impact: - Improves user flexibility by enabling collateral withdrawals. - Enhances protocol security by enforcing liquidation for undercollateralized positions. - Provides robust administrative controls for maintaining protocol integrity.
… consistency This update ensures that the `last-price-update` variable consistently uses `stacks-block-height` across the contract. This change improves clarity and aligns with the protocol's standard for tracking block heights. Key changes: - Updated the `last-price-update` variable to explicitly use `stacks-block-height` in relevant functions, such as `set-price`. Impact: - Enhances code consistency and readability. - Reduces potential confusion regarding block height tracking.
…es, functionality, and usage examples This update introduces a detailed README file for the BitVault protocol, providing an in-depth overview of its features, technical specifications, and usage examples. The README serves as a comprehensive guide for developers and users interacting with the protocol. Key changes: - Added sections for system parameters, error codes, and core functionality. - Included detailed workflows for collateral management, stablecoin operations, and liquidation processes. - Provided usage examples for key functions such as `deposit-collateral`, `mint-stablecoin`, `repay-stablecoin`, and `liquidate-position`. - Documented oracle integration and security architecture, highlighting risk mitigation strategies. Impact: - Enhances developer and user understanding of the protocol. - Improves accessibility by offering clear and structured documentation. - Facilitates onboarding and interaction with the BitVault system.
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 critical upgrades to the BitVault protocol, enhancing its functionality, security, and transparency as a Bitcoin-collateralized stablecoin system on Stacks L2. The changes implement robust position management, real-time monitoring, and comprehensive documentation aligned with Bitcoin DeFi best practices.
Key Changes
1. Liquidation Tracking & Transparency
liquidation-historyMapRecords all liquidation events with:
{ timestamp: uint, collateral-liquidated: uint, debt-repaid: uint }2. Position Health Monitoring
get-collateral-ratioFunction0for debt-free positions3. Collateral Management
check-min-collateral: Enforces 0.01 BTC minimum depositcheck-position-health: Blocks undercollateralized withdrawalsMAX-DEPOSITenforcement (10,000 BTC ceiling)4. Stablecoin Operations
mint-stablecoinrepay-stablecoin5. Protocol Administration
set-price: Oracle-restricted price updatesset-price-oracle: Owner-controlled oracle assignmentStandardized
stacks-block-heightusage for temporal logic6. Comprehensive Documentation
Review Notes