Skip to content

feat: adds prediction-market_markets and prediction-market-core contracts.#3

Open
Airstarr wants to merge 1 commit intomainfrom
high-contract
Open

feat: adds prediction-market_markets and prediction-market-core contracts.#3
Airstarr wants to merge 1 commit intomainfrom
high-contract

Conversation

@Airstarr
Copy link
Copy Markdown
Owner

Prediction Market Contracts README

Features

1. Core Functionality (prediction-market-core.clar)

  • Market Creation: Users can create new prediction markets by providing a description and resolution time. A fee is charged for creating a market.
  • Betting: Users can place bets on outcomes (Yes/No) for active markets. The system tracks individual bets and calculates the total amount for each outcome.
  • Market Resolution: Market creators can resolve markets by determining the outcome once the resolution time is reached.
  • Payouts: Winning bettors can claim their payouts, which are calculated based on the total bets placed and the market outcome.
  • Emergency Controls: Contract owners can pause or resume markets for administrative purposes.

2. Market Management (prediction-market-markets.clar)

  • Market Metadata: Stores detailed information about each market, including title, description, category, tags, and resolution rules.
  • Market Statistics: Tracks statistics such as total participants, total volume, and average bet size.
  • Category Management: Allows markets to be organized by categories, facilitating easier navigation and searching.
  • Timestamps: Records key timestamps for market creation, updates, resolution, and last bet placement.

3. Error Handling

Each contract contains robust error handling to ensure smooth operations:

  • Unauthorized access errors for restricted functions.
  • Validation errors for market creation parameters and betting actions.
  • Status checks to prevent operations on closed or already resolved markets.

4. Data Structures

  • Markets: Information about each market is stored in maps, including creator, resolution time, total amounts, and active status.
  • Bets: Tracks individual bets placed by users, including the amounts for Yes and No outcomes.
  • Accumulated Fees: A mechanism for managing and withdrawing fees collected from market creation.

5. Read-Only Functions

Users can access various read-only functions to retrieve information such as:

  • Market details (metadata, timestamps, statistics).
  • Markets filtered by category.
  • Overall market status.

Author

  • OJO ESTHER

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.

1 participant