A decentralized lending platform built on the Stacks blockchain that enables users to deposit Bitcoin as collateral and borrow against it. The protocol implements automated liquidations, dynamic interest rates, and protocol-level security measures.
- Collateralized Lending: Users can deposit BTC as collateral and borrow against it
- Automated Liquidations: Protection against undercollateralized positions
- Price Oracle Integration: Real-time BTC price feeds with validity checks
- Flexible Interest Rates: 5% APR base rate
- Governance Controls: Protocol fee management and emergency pause functionality
- Minimum Collateral Ratio: 150%
- Liquidation Threshold: 130%
- Liquidation Penalty: 10%
- Price Validity Period: 1 hour
- Base Protocol Fee: 1%
deposit-collateral
: Deposit BTC as collateralborrow
: Take out a loan against deposited collateralrepay-loan
: Repay an existing loan with interestliquidate
: Liquidate undercollateralized positions
get-loan
: Retrieve loan details for a specific userget-collateral-balance
: Check collateral balanceget-borrow-balance
: Check borrowed amountget-current-collateral-ratio
: Calculate current collateral ratio
update-btc-price
: Update the BTC price oracleupdate-protocol-fee
: Modify protocol fee (max 10%)pause-protocol
: Emergency protocol pause
Code | Description |
---|---|
100 | Not Authorized |
101 | Insufficient Balance |
102 | Invalid Amount |
103 | Below Minimum Collateral |
104 | Loan Not Found |
105 | Loan Already Exists |
106 | Invalid Liquidation |
107 | Price Expired |
- Price oracle validity checks
- Minimum collateral requirements
- Automated liquidation triggers
- Contract owner authorization checks
- Maximum fee caps
The protocol uses the following key calculations:
- Collateral Ratio = (Collateral Value × 100) ÷ Borrowed Value
- Interest Amount = (Borrowed Amount × Interest Rate × Blocks Elapsed) ÷ (100 × 144 × 365)
- Liquidation Value = Borrowed Amount × (100 + Liquidation Penalty)
To interact with the protocol:
- Ensure you have sufficient BTC for collateral
- Call
deposit-collateral
to secure your position - Use
borrow
to take out a loan (maintaining >150% collateral ratio) - Monitor your position's health using
get-current-collateral-ratio
- Repay loans before reaching the liquidation threshold (130%)
- Maintain adequate collateral ratio to avoid liquidation
- Monitor BTC price movements
- Be aware of interest accrual on borrowed amounts
- Understand liquidation penalties and triggers
The protocol includes governance mechanisms for:
- Fee adjustment (capped at 10%)
- Emergency protocol pausing
- Price oracle updates
- Stacks blockchain compatibility
- Access to accurate BTC price feeds
- Sufficient STX for transaction fees
This protocol is open for review and improvement suggestions. Please ensure all proposed changes maintain or enhance the security and stability of the system.