A decentralized stablecoin protocol implemented on the Stacks blockchain, allowing users to create stablecoins backed by Bitcoin (BTC) collateral. The system implements a CDP (Collateralized Debt Position) model with built-in governance, price oracle integration, and liquidation mechanisms.
- BTC-collateralized stablecoin minting
- Dynamic collateralization ratio management
- Automated liquidation system
- Multi-oracle price feed support
- Governance controls for risk parameters
- Emergency shutdown capability
- Stability fee mechanism
- Minimum Collateralization Ratio: 150%
- Liquidation Ratio: 120%
- Annual Stability Fee: 2%
- Maximum Allowed Price: 1,000,000,000
- Minimum Allowed Price: 1
- Maximum Collateral Ratio: 1000%
- Minimum Collateral Ratio: 101%
- Maximum Stability Fee: 100%
(create-vault (collateral-amount uint))
(mint-stablecoin (amount uint))
(repay-debt (amount uint))
(withdraw-collateral (amount uint))
(liquidate (vault-owner principal))
(update-price (new-price uint))
(set-minimum-collateral-ratio (new-ratio uint))
(set-liquidation-ratio (new-ratio uint))
(set-stability-fee (new-fee uint))
- Reentrancy protection
- Emergency shutdown mechanism
- Price validity checks
- Authorization controls
- Parameter boundary validation
- Stacks blockchain environment
- Clarity smart contract support
- Access to BTC price oracle
- Governance token implementation
- Clone the repository
- Deploy the contract to the Stacks blockchain
- Initialize the system with initial BTC price
- Set up oracles and liquidators
;; Transfer collateral and create a vault
(contract-call? .stablecoin create-vault u1000000)
;; Mint stablecoins against deposited collateral
(contract-call? .stablecoin mint-stablecoin u500)
;; Update minimum collateral ratio (restricted to governance)
(contract-call? .stablecoin set-minimum-collateral-ratio u160)
The system implements several risk management mechanisms:
-
Minimum Collateralization Ratio (150%)
- Ensures adequate collateral backing
- Provides buffer against price volatility
-
Liquidation Mechanism
- Automatic liquidation at 120% ratio
- Incentivized liquidator network
-
Price Oracle System
- Multiple oracle support
- Price validity checks
- Maximum/minimum price bounds
-
Emergency Controls
- System-wide emergency shutdown
- Parameter adjustment capabilities
- Governance oversight
graph TD
A[User] -->|Create Vault| B[Vault System]
B -->|Check Ratio| C[Risk Engine]
C -->|Price Feed| D[Oracle System]
B -->|If Unsafe| E[Liquidation]
F[Governance] -->|Update Params| C
- Fork the repository
- Create your feature branch (
git checkout -b feature/your-branch
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/your-branch
) - Open a Pull Request
# Run the test suite
clarinet test tests/bitstable-core.test.ts
- Implement multi-collateral support
- Add flash loan protection
- Enhance oracle system with medianizer
- Implement governance token voting
- Add automated stability fee collection
- Develop liquidation auction mechanism
This project is licensed under the MIT License - see the LICENSE.md file for details
- MakerDAO for pioneering CDP systems
- Stacks blockchain community
- Bitcoin network
- Project Link: https://github.com/gid-ctl/bitstable.git
This software is in beta. Use at your own risk. No guarantee of stablecoin value or system security is provided.