A secure and decentralized platform for trading Bitcoin options with automated execution, collateral management, and price oracle integration built on Stacks blockchain.
- Decentralized Options Trading: Create and trade Bitcoin CALL and PUT options
- Automated Execution: Smart contract handles option exercise and settlement
- Price Oracle Integration: Secure price feeds for option execution
- Collateral Management: Automated collateral locking and release
- Configurable Parameters: Adjustable platform fees and collateral ratios
The platform consists of several key components:
- Option Creation: Users can create CALL or PUT options by specifying:
- Strike price
- Expiry (in blocks)
- Option amount
- Required collateral
- Price Oracle: Provides secure BTC price feeds for option execution
- Exercise Mechanism: Automated profit calculation and settlement
- Collateral System: Manages deposits and locked funds
- Clarinet for local development
- Stacks Wallet for deployment and interaction
- Basic understanding of options trading and Clarity smart contracts
- Clone the repository:
git clone https://github.com/abolore-install/bitcoin-options-trading-platform.git
- Install dependencies:
clarinet requirements
- Run tests:
clarinet test
(contract-call? .bitcoin-options create-option "CALL" u45000 u1000 u10000)
Parameters:
- Option type: "CALL" or "PUT"
- Strike price (in sats)
- Expiry (in blocks)
- Amount (in sats)
(contract-call? .bitcoin-options exercise-option u0)
Parameter:
- Option ID
(contract-call? .bitcoin-options expire-option u0)
Parameter:
- Option ID
-
Data Storage
- Options mapping
- User balances
- Oracle data
-
Core Functions
- Option creation
- Option exercise
- Option expiration
- Collateral management
-
Administrative Functions
- Fee management
- Oracle updates
- Parameter configuration
- Row-level security
- Collateral validation
- Price staleness checks
- Access control
The contract includes comprehensive test coverage:
clarinet test
Test suites cover:
- Option creation and validation
- Price oracle functionality
- Option exercise mechanics
- Administrative functions
- Error handling
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
For security concerns, please review our SECURITY.md file.
This project is licensed under the MIT License - see LICENSE.md for details.
Detailed documentation is available in the docs directory.