# Prediction Markets

## Overview

evently Markets is the platform's core product — a **LMSR-based prediction market** where anyone can create or trade on outcomes using USDm (the MegaETH stablecoin).

You don't bet. You **trade your conviction**. Information becomes a financial asset — priced by the market, settled on-chain, with instant finality on MegaETH's \~1ms blocks.

Markets cover Crypto, Politics, Culture, World, Business, Entertainment, Science, and more. Many markets are sourced from Polymarket and display live Polymarket odds alongside evently's own prices for comparison.

Each outcome is represented as a tradable **ERC-1155 share**. One winning share redeems for exactly **1 USDm** after market resolution — regardless of total volume or how many people traded the same way.

***

## Access

Markets are currently in invite-only early access. Users can gain access by:

* **Invite code** — redeem a code from an existing member
* **Waitlist** — submit your wallet at [evently.market/markets](https://evently.market/markets)

***

## Fee Structure

| Fee           | Recipient                   | Basis Points       |
| ------------- | --------------------------- | ------------------ |
| Creator fee   | Market creator              | 100 bps (1%)       |
| Treasury fee  | evently protocol treasury   | 100 bps (1%)       |
| Resolver pool | Resolver / staking post-TGE | 50 bps (0.5%)      |
| **Total**     |                             | **250 bps (2.5%)** |

Hard cap: 5% total via `setFees()`. Admin markets redirect the creator cut to the treasury.

***

## Pricing Mechanism — LMSR

Prices are determined by the **Logarithmic Market Scoring Rule (LMSR)**, the same mechanism used by Polymarket. The LMSR guarantees that:

* Being correct always yields a profit (unlike parimutuel)
* Prices always sum to exactly 100%
* The market maker (AMM) is always solvent

**Cost function:** `C(q) = b × ln( Σ exp(q[i] / b) )`

**Implied probability of option i:** `P(i) = exp(q[i]/b) / Σ exp(q[j]/b)`

`b = 200 USDm` controls price sensitivity. At creation all options start at equal probability (e.g. 50/50 for binary markets).

***

## Order Matching — CLOB + AMM

Trades are routed through two layers:

1. **CLOB (Central Limit Order Book):** resting limit orders are matched first at price-time priority
2. **LMSR AMM:** any remaining budget is priced by the AMM as market maker of last resort

**Buying:** CLOB ask orders at or below your price are filled first. Remainder goes to the AMM.

**Selling:** instant sell to the AMM via `sellToAMM()`, or post a limit ask via `placeOrder(SELL, ...)`.

***

## Market Categories

| Category        | Examples                                           |
| --------------- | -------------------------------------------------- |
| **Crypto**      | Price targets, DeFi TVL milestones, token launches |
| **Politics**    | Elections, policy outcomes, geopolitical events    |
| **Culture**     | Memes, entertainment, viral trends                 |
| **Pop Culture** | TV, film, music awards                             |
| **World**       | International events, macro                        |
| **Business**    | M\&A, earnings, IPOs                               |
| **Science**     | Research outcomes, discoveries                     |

***

## Market Lifecycle

```
Active → BettingClosed → Resolved → [Disputed] → Finalized
                                              |
                                        Cancelled / Slashed
```

### 1. Active

Shares can be bought and sold. Market is open until `bettingDeadline`.

### 2. BettingClosed

Deadline passed. No more trades. Waiting for resolution.

### 3. Resolved

Creator declares the winning option. A **24-hour dispute window** opens.

### 4. Disputed

A whitelisted user can dispute the resolution by locking **50 USDm collateral**. Admin adjudicates.

### 5. Finalized

No dispute raised (or dispute settled). Winners can redeem shares at **1 USDm each**.

### 6. Cancelled / Slashed

* **Cancelled:** all holders get a pro-rata refund from the pool + subsidy
* **Slashed:** creator collateral forfeited to treasury; holders get pro-rata refund

***

## Market Creation

### Community Markets (Whitelisted Users)

* Requires **50 USDm collateral** + LMSR subsidy (`b × ln(n)` USDm)
* Collateral + subsidy returned on honest resolution
* Creator earns **1% of all volume** accrued in `creatorAccruedFees`, claimable after finalization
* Must set clear `resolutionCriteria`
* 2 to 4 options per market; question max 300 characters; options max 100 characters each

### Official Markets (Admin)

Created by the evently team — no collateral required. Displayed with an **Official** badge. Many are sourced from Polymarket with live odds displayed via the Polymarket CLOB API.

***

## Trading

```
placeOrder(marketId, optionIndex, side, quantity, pricePerShare, minFill)
```

* `side`: BUY or SELL
* `pricePerShare`: limit price in USDm (18 decimals), must be between 0 and 1
* `minFill`: slippage guard — reverts if total shares filled < this value
* BUY orders escrow USDm upfront; SELL orders escrow shares upfront

For instant AMM sells:

```
sellToAMM(marketId, optionIndex, shares, minUsdmOut)
```

***

## Redeeming Winnings

After finalization:

```
redeemWinnings(marketId)
```

Each winning share redeems for **exactly 1 USDm**. Solvency is guaranteed by the LMSR invariant: `poolBalance + subsidyDeposited >= total winning shares`.

***

## Polymarket Integration

Official markets import odds and volume data from [Polymarket](https://polymarket.com) via the Gamma API and CLOB price history API. Polymarket odds are displayed for reference — evently prices are set independently by the LMSR AMM.

***

## Constants

| Constant               | Value                          |
| ---------------------- | ------------------------------ |
| Creator collateral     | 50 USDm                        |
| Dispute collateral     | 50 USDm                        |
| Dispute window         | 24 hours                       |
| LMSR b parameter       | 200 USDm                       |
| Max options per market | 4                              |
| Min options per market | 2                              |
| Min trade              | 0.001 shares (1e15)            |
| Max orders per book    | 200 per (market, option, side) |
