feat: adds the prediction-market-bets and prediction-market-payouts file#4
Open
feat: adds the prediction-market-bets and prediction-market-payouts file#4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prediction Market Smart Contracts
These smart contracts facilitate the creation, management, and payout of prediction markets using the Clarity language. They are split into two main contracts:
1. Prediction Market Payout Management Contract
Overview
This contract is designed to manage payouts for prediction markets. It handles the resolution of markets, calculation of winnings, and distribution of funds to participants. It also supports fee collection and withdrawal of accumulated fees by the contract owner.
Features
Functions
Public Functions:
resolve-market: Resolve a market by specifying the winning option and total pool.claim-payout: Claim winnings for a resolved market if the user bet on the winning option.withdraw-balance: Withdraw funds from the user's balance.withdraw-fees: Withdraw accumulated fees as the contract owner.Read-Only Functions:
get-market-payout: Retrieve payout details for a specific market.get-user-bet: Retrieve a user's bet for a specific market.get-user-balance: Check the balance of a specific user.get-total-fees: Get the total fees collected by the contract.Data Structures
market-payouts: Tracks resolved market details including total pool, winning option, and resolution status.user-bets: Tracks user bets for each market, including bet amount, chosen option, and claim status.user-balances: Tracks user balances.total-fees: Tracks total fees collected by the contract.2. Prediction Market Betting Contract
Overview
This contract facilitates the creation and participation in prediction markets. Users can create markets, place bets on outcomes, and resolve markets. The contract also manages user balances for deposits and withdrawals.
Features
Functions
Public Functions:
create-market: Create a new prediction market with a description and list of options.place-bet: Place a bet on a specific option in an open market.resolve-market: Resolve a market by specifying the winning option.claim-winnings: Claim winnings for a resolved market if the user bet on the winning option.deposit-funds: Deposit funds into the contract for betting.withdraw-funds: Withdraw unused funds from the user's balance.Read-Only Functions:
get-market: Retrieve details of a specific market.get-bet: Retrieve a specific user's bet in a market.get-balance: Check the balance of a specific user.Data Structures
markets: Tracks market details including creator, description, options, total pool, and resolution status.bets: Tracks user bets for each market, including bet amount and chosen option.user-balances: Tracks user balances for deposits and winnings.total-bets: Tracks the total number of markets created.How They Work Together
These contracts work in tandem to provide a seamless experience for creating, participating in, and managing prediction markets.
Usage Instructions
Notes