Skip to content

Conversation

@peace-source
Copy link
Owner

Overview

This PR introduces the core infrastructure for BitOracle Pro - a decentralized Bitcoin price prediction market protocol built on Stacks L2. The implementation establishes a complete lifecycle for prediction markets from creation to resolution, with robust administrative controls and comprehensive documentation.

Key Features Added

Core Contract Infrastructure
Market Lifecycle Management
Non-Custodial STX Staking
Decentralized Price Resolution
Protocol Governance Controls

Technical Highlights

  • Built with Clarity v2.0.11 for Bitcoin-final settlement
  • SIP-009/SIP-010 compliant architecture
  • Gas-optimized L2 operations
  • Anti-frontrunning block-based resolution
  • Proportional reward distribution algorithm

Changes Breakdown

1. Core Contract Infrastructure (feat: Add initial constants...)

  • Established administrative constants and error codes
  • Configured platform parameters:
    • Oracle address whitelisting
    • Dynamic fee structure (2% base)
    • Minimum stake enforcement (1 STX)
  • Implemented primary data structures:
    (define-map markets {...})
    (define-map user-predictions {...})

2. Market Operations Engine (feat: Implement market creation...)

  • Market creation with temporal constraints:
    (create-market start-price start-block end-block)
  • Prediction staking system:
    • Bidirectional ("up"/"down") market positions
    • STX escrow with balance verification
    • Real-time pool allocation updates

3. Market Resolution & Claims (feat: Add market resolution...)

  • Oracle-gated market resolution:
    (resolve-market market-id end-price)
  • Provably fair reward calculation:
    Payout = (UserStake / WinningPool) * TotalPool * 0.98
    
  • Anti-double claim protection

4. Protocol Governance (feat: Add administrative functions...)

  • Owner-controlled parameters:
    • set-oracle-address
    • set-minimum-stake
    • set-fee-percentage
  • Fee withdrawal with balance checks
  • Contract state inspection methods

5. Documentation & Compliance (docs: Add README...)

  • Technical specification document
  • Deployment guide
  • Security model documentation
  • Regulatory compliance roadmap

…acle Pro

- Define administrative constants including contract owner and error codes.
- Set up platform configuration state variables such as oracle address, minimum stake, fee percentage, and market counter.
- Create a data map for market data structure to store market details including start price, end price, stakes, blocks, and resolution status.

This commit establishes the foundational elements required for the BitOracle Pro prediction market protocol.
- Add `create-market` function to initialize new prediction markets with start price, start block, and end block.
- Add `make-prediction` function to allow users to place stakes on active markets with specified predictions and stake amounts.
- Include necessary assertions and error handling for market creation and prediction staking.
- Update market and user prediction data maps accordingly.

This commit enables the core functionalities for creating markets and making predictions in the BitOracle Pro protocol.
- Implement `resolve-market` function to finalize market with the end price, ensuring only the oracle can resolve and market is not already resolved.
- Implement `claim-winnings` function to allow users to claim their winnings from resolved markets, including fee deduction and payout.
- Add read-only functions `get-market` and `get-user-prediction` to fetch market and user prediction details.

This commit completes the core functionalities for resolving markets and claiming winnings in the BitOracle Pro protocol.
- Implement `set-oracle-address` to update the oracle address, ensuring only the contract owner can perform this action.
- Implement `set-minimum-stake` to update the minimum stake requirement, ensuring only the contract owner can perform this action.
- Implement `set-fee-percentage` to update the platform fee percentage, ensuring only the contract owner can perform this action.
- Implement `withdraw-fees` to allow the contract owner to withdraw accumulated fees, ensuring sufficient balance and owner-only access.
- Add read-only function `get-contract-balance` to fetch the contract's STX balance.

This commit provides essential administrative functionalities for managing the BitOracle Pro protocol.
- Provide an overview of BitOracle Pro, a decentralized Bitcoin prediction market protocol.
- Detail core protocol features including L2 prediction markets, STX staking system, decentralized oracle, and automated payouts.
- Describe the technical architecture with Clarity smart contracts, Stacks L2 optimization, state management, and fee structure.
- Include contract specifications such as Stacks and Clarity versions, contract address, and compliance standards.
- Outline installation steps and requirements.
- Explain deployment process and contract functions for market operations, user operations, and administrative functions.
- Highlight the security model and attack mitigations.

This commit adds comprehensive documentation to guide users and developers in understanding and utilizing the BitOracle Pro protocol.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants