Wagerly
🔍 Description
Wagerly is a decentralized prediction market that allows users to speculate on the real-time profit or loss (PnL) of a specific trader's perpetual futures position. By leveraging on-chain position data, our protocol creates a novel financial primitive where you can bet on a trader's performance, as well as an asset's price. This enables new use cases for hedging, speculation, and monetizing trading alpha in a fully transparent and trustless manner.
Markets are trustless, and also incentivize market creaters by directing swap revenue to them as LPs.
🛠️ How It Works
A primary challenge for decentralized prediction markets is the resolution process. Most platforms rely on external, often slow, and potentially centralized third-party oracles or dispute resolution systems (like UMA) to determine the final outcome. This introduces latency, cost, and a potential point of failure.
Wagerly fundamentally solves this problem. By using native, on-chain precompiles (L1Read), our Market contract can directly and synchronously read a user's position data and the asset's mark price from the underlying execution layer. This makes the entire lifecycle of the market, from creation to settlement, fully automated and trustless without any external dependencies.
Here's the flow:
Automated Market Creation: A market is deployed targeting a specific trader's address (targetUser) and position (perpId). Upon initialization, the contract makes a staticcall to an on-chain positionReader precompile. It instantly reads the position's size (szi) and entry notional (entryNtl) and saves this as a permanent "fingerprint". This is not just an anti-gaming mechanism; it's the first step in a fully on-chain verification process.
Minting & Liquidity: Users deposit USDC to mint a complete set of outcome tokens: one yesToken (predicting profit) and one noToken (predicting loss). This ensures that for every 1 USDC of value locked, there is always one winning token that can be redeemed for it.
Trading: Each market has its own dedicated Automated Market Maker (MarketAMM) for its yesToken and noToken. Functions like buyYesTokens handle the entire process in one transaction: the user sends USDC, the contract mints a full set, and then automatically swaps the unwanted tokens for the desired ones.
Instant & Trustless Settlement: After the market's endTime, the settle() function is called. It performs a final, definitive PnL calculation by again calling the positionReader and markPxReader precompiles. The outcome is determined immediately by this on-chain data (pnl > 0 ? Profitable : Unprofitable). There is no dispute window, no third-party oracle, and no subjective resolution. The outcome is as verifiable and final as a standard token transfer.
Claiming Winnings: Once settled, holders of the winning token can burn their tokens to claim 1 USDC each.
Key Features:
Oracle-less Resolution: Solves the core prediction market problem by using L1Read precompiles for instant, trustless, and automated settlement. It completely eliminates the need for systems like UMA or other third-party data providers.
Immutable Position Fingerprinting: The initial position commitment (committedSzi, committedEntryNtl) creates a verifiable and tamper-proof basis for the market, preventing any form of manipulation by the targeted trader.
Capital Efficiency: The integrated AMM and streamlined buying process create a seamless user experience for speculation and liquidity provision.
Directing swap revenue to market creators.
Integrations
- Privy for Wallet Auth.
- HL names for better UX
💻 Demo
- https://youtu.be/c069X4vrfcg
📂 Project Links
Code: https://github.com/ChinmayGopal931/wagerly
Deployment https://wagerly-markets.vercel.app/
FE: https://github.com/ChinmayGopal931/mosaic-landing
Slides: https://gamma.app/docs/Wagerly-Decentralized-Permission-less-and-Creator-centric-Predict-vmlvx9k1f03gw7l
👥 Team
0xidli on X