Skip to content

Adapter contract to resolve Polymarket prediction markets via UMA's Optimistic Oracle.

License

Notifications You must be signed in to change notification settings

Polymarket/uma-ctf-adapter

Repository files navigation

Polymarket UMA CTF Adapter

Version License Test

Overview

This repository contains contracts used to resolve Polymarket prediction markets via UMA's optimistic oracle.

Architecture

Contract Architecture

The Adapter is an oracle to Conditional Tokens Framework(CTF) conditions, which Polymarket prediction markets are based on.

It fetches resolution data from UMA's Optmistic Oracle and resolves the condition based on said resolution data.

When a new market is deployed, it is initialized, meaning:

  1. The market's parameters(ancillary data, request timestamp, reward token, reward, etc) are stored onchain
  2. The market is prepared on the CTF contract
  3. A resolution data request is sent out to the Optimistic Oracle

UMA Proposers will then respond to the request and fetch resolution data offchain. If the resolution data is not disputed, the data will be available to the Adapter after a defined liveness period(currently about 2 hours).

The first time a request is disputed, the market is automatically reset, meaning, a new Optimistic Oracle request is sent out. This ensures that obviously incorrect disputes do not slow down resolution of the market.

If the request is disputed again, this indicates a more fundamental disagreement among proposers and the Optimistic Oracle falls back to UMA's DVM to come to agreement. The DVM will return data after a 48 - 72 hour period.

After resolution data is available, anyone can call resolve which resolves the market using the resolution data.

Audit

These contracts have been audited by OpenZeppelin and the report is available here.

Deployments

See Deployments

Development

Clone the repo: git clone https://github.com/Polymarket/uma-ctf-adapter.git --recurse-submodules


Set-up

Install Foundry.

Foundry has daily updates, run foundryup to update forge and cast.

To install/update forge dependencies: forge update

To build contracts: forge build


Testing

To run all tests: forge test

Set -vvv to see a stack trace for a failed test.

About

Adapter contract to resolve Polymarket prediction markets via UMA's Optimistic Oracle.

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •