Skip to content

New Prediction Market Template#41

Open
ejacquier wants to merge 6 commits intomainfrom
new-prediction-market-template
Open

New Prediction Market Template#41
ejacquier wants to merge 6 commits intomainfrom
new-prediction-market-template

Conversation

@ejacquier
Copy link
Contributor

Prediction Market - New Template

Full prediction market lifecycle with 3 workflows sharing a single PredictionMarket smart contract, resolved deterministically using Chainlink BTC/USD Data Feed on-chain.

Workflows:

  • market-creation — Cron trigger creates binary markets ("Will BTC be above $100,000 by tomorrow?") with configurable strike price, duration, and question template
  • market-resolution — Cron trigger polls markets for expiration, reads live BTC/USD price from Chainlink Data Feed on Sepolia, resolves as Yes/No
  • market-dispute — LogTrigger fires on DisputeRaised events, re-reads fresh price from the feed, confirms or overturns the original resolution

Key details:

  • Single PredictionMarket.sol contract with action dispatch (ACTION_CREATE, ACTION_RESOLVE, ACTION_RESOLVE_DISPUTE) via _processReport
  • Pre-deployed on Sepolia at 0xEb792aF46AB2c2f1389A774AB806423DB43aA425 — works out of the box
  • All 3 workflows use generated TypeScript bindings (cre generate-bindings evm) and cre.capabilities.* namespace
  • 9 tests passing across 3 workflow directories
  • README includes deployment options (Foundry + Hardhat Ignition), alternative HTTP trigger approaches for creation and resolution, and customization guide
  • No AI — resolution is deterministic via on-chain Chainlink Data Feeds

@github-actions
Copy link

👋 ejacquier, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Copy link

@dz235 dz235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential issues:

  1. Market definition: The current cron schedule creates 24 markets per day, all sharing an identical question: "Will BTC be above $100,000 by [date]?".
  2. Resolution logic: The question uses the phrase "by [date]", which implies the market resolves Yes if BTC exceeds the strike price at any point before expiration. However both the resolution and dispute workflows evaluate outcome using a single spot price read. Under current logic, a price of $99,000 resolves the market as No, even if BTC traded above $100,000 earlier in the market's lifecycle.

Suggestions:

  1. Consider using Data Streams instead of Data Feeds. DS's timestamped historical prices, such as a price report showing BTC >$100,000 at time T, could be used to resolve or dispute a market. This would also demonstrate CRE’s ability to read off-chain data. (and for an extra point, the same workflow could even include onchain verification of a streams report!)

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.

3 participants