Shared Liquidity & Polymarket Mirroring
Relevant source files
The following files were used as context for generating this wiki page:
- src/app/llms.txt/route.ts
- README.md
- src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelArbitrage.tsx/event/[slug]/_components/EventOrderPanelArbitrage.tsx)
- src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelForm.tsx/event/[slug]/_components/EventOrderPanelForm.tsx)
- src/app/[locale]/admin/api/event-creations/ai/route.ts
- tests/unit/syncEventsRoute.test.ts
- src/app/[locale]/(platform)/settings/sdks/page.tsx/settings/sdks/page.tsx)
Shared Liquidity and Polymarket Mirroring is a core infrastructure feature that allows the Kuest prediction market to leverage existing trading volume and order flow from the Polymarket network. By mirroring Polymarket markets, Kuest operators can provide active trading opportunities with deep liquidity from day one, rather than relying solely on local market participants.
The system facilitates "Shared Liquidity" by utilizing Polymarket-derived smart contracts on the Polygon network. This ensures that trades, market makers, and USDC balances exist within a unified environment compatible with external tooling. Furthermore, the platform supports multi-wallet connections, enabling users to bridge their Kuest and Polymarket identities to perform cross-venue operations such as arbitrage.
Sources: README.md:37-41, src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelArbitrage.tsx:442-450
Architecture & Integration Strategy
The mirroring architecture is built on a service-oriented model where the Kuest frontend interacts with both local and remote (Polymarket) APIs.
Service Endpoints
The platform utilizes several specialized API endpoints to maintain market parity and execution:
- Gamma API: Used for market discovery, events, tags, and search metadata.
- CLOB API: Handles orders, cancellations, order books, and pricing.
- Polymarket Gamma API: Specifically targeted to fetch market rule samples for AI-driven event creation.
Sources: src/app/llms.txt/route.ts:140-149, src/app/[locale]/admin/api/event-creations/ai/route.ts:7-8
Mirroring Data Flow
The following diagram illustrates how market data is synchronized and presented to the user for shared liquidity operations.
The system normalizes outcome token mappings between the Kuest environment and Polymarket to ensure that orders are routed to the correct contract addresses.
Sources: tests/unit/syncEventsRoute.test.ts:72-85, src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelArbitrage.tsx:162-170
Multi-Venue Arbitrage Trading
The Kuest platform provides a specialized EventOrderPanelArbitrage component that allows users to simultaneously execute trades across both the local Kuest market and the mirrored Polymarket market.
Core Logic
The arbitrage engine identifies price discrepancies where the combined cost of opposite outcomes (e.g., Kuest "YES" and Polymarket "NO") is less than $1.00 (the resolution payout).
- Quote Selection: The system uses
selectBestArbitrageQuoteto evaluate both trade directions (Kuest YES + Polymarket NO, or vice versa) and selects the one with the highest "edge" (profit after fees). - Cost Calculation: Unit costs include the base price plus taker fees for both Kuest (determined by
operatorShareBps) and Polymarket (determined byfeeRateandfeeExponent). - Multi-Wallet Bridge: If enabled, users can connect a separate wallet for Polymarket operations through the
MultiWalletConnectionBridge.
Sources: src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelArbitrage.tsx:160-230, src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelArbitrage.tsx:116-125
Execution Workflow
A successful arbitrage trade requires a dual-signature process to ensure both legs of the trade are authorized before submission.
Technical Specifications
Mirrored Data Mapping
When syncing markets, the system tracks specific token identifiers to maintain parity.
| Field | Description | Source |
|---|---|---|
polymarket_token_id | The unique identifier for the outcome on the Polymarket CLOB. | src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelArbitrage.tsx:166 |
condition_id | The shared condition identifier (e.g., for UMA or Chainlink resolution). | src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelForm.tsx:288 |
outcomeIndex | The 0 or 1 index representing "YES" or "NO". | tests/unit/syncEventsRoute.test.ts:76 |
Fee and Reward Structure
Shared liquidity is supported by transparent fee sharing and rewards.
- Operator Fees: Operators can configure
builderTakerFeeShareBpsto earn from trades routed through their frontend. - Liquidity Rewards: Users providing limit orders near the midpoint can earn "Daily Rewards" or "Maker Rebates" as part of the shared liquidity incentives.
Sources: src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelForm.tsx:438-442, src/i18n/messages/en.json:440-444
Developer Resources & SDKs
To support automated market making and arbitrage, the project provides personalized SDK bundles.
- CLOB Client: Handles order book trading and shared liquidity routing.
- Relayer Client: Helps route and execute signed actions.
- Supported Languages: Python, Rust, and TypeScript.
- Market Maker Examples: Practical references for implementing SDK workflows to seed new markets or provide liquidity.
Sources: src/app/[locale]/(platform)/settings/sdks/page.tsx:64-110, src/app/[locale]/(platform)/settings/sdks/page.tsx:150-175
Conclusion
Shared Liquidity and Polymarket Mirroring enable Kuest to bypass the "cold start" problem of new prediction markets. By integrating with the broader Polygon/Polymarket ecosystem, the platform provides users with competitive pricing and arbitrage opportunities while allowing operators to capture fee revenue from an established liquidity pool.
Sources: README.md:30-45, src/app/[locale]/(platform)/event/[slug]/_components/EventOrderPanelArbitrage.tsx:470-490