Skip to content

Latest commit

Β 

History

History
45 lines (28 loc) Β· 2.32 KB

File metadata and controls

45 lines (28 loc) Β· 2.32 KB

πŸ“ˆ PolySwap Smart Contracts

Automated DeFi swaps triggered by on-chain prediction market outcomes.

This repository contains the core smart contracts of PolySwap, a protocol that allows users to create conditional swap intents based on prediction markets like Polymarket.

πŸ› οΈ What It Does

PolySwap lets users define CoW Swap orders that become valid only when a specific prediction market condition is met. The contract checks the status of a Polymarket order and activates the swap only if that order has been fully filled (indicating the prediction condition was reached).

🧱 Contract Overview

  • BaseConditionalOrder: Abstract contract to inherit for compatibility with ComposableCoW.
  • Polyswap: Main contract that inherits from BaseConditionalOrder and verifies if the Polymarket order is filled.
  • PolySwapOrder: Verifies if the Polyswap order parameters are correct and defines the order struct.

The Polyswap contract uses the Polymarket CTFExchange contract to check, via the getOrderStatus() function, whether:

  • the order is filled or cancelled, and
  • the remaining amount is 0.

If both conditions are met, the swap is executed using the Composable CoW Swap protocol. Both conditions being met means that the limit order has been filled and that the price of the limit order has been achieved.

πŸ§ͺ Stack

πŸš€ Deployment

All contracts are deployed on Polygon for compatibility with Polymarket's on-chain infrastructure.

Contract Address (CTF Exchange): 0xEa8FA1438785b9464f988e3AFa1E464Ba3A110B1 View on Polygonscan

Contract Address (Neg Risk CTF Exchange): 0x04a7745Ee5c5cCE28aD0A2c956e789415a90EA7D View on Polygonscan

πŸ§‘β€πŸ’» Authors


Lucas Leclerc

Baptiste Florentin