Skip to content

EthGlobalBangkok/polyswap-contracts

Repository files navigation

📈 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: 0xE930639F0EbE2A7309f214e48e9F5ae3C5306Ff7 View on Sourcify

🧑‍💻 Authors


Lucas Leclerc

Baptiste Florentin

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •