/uma-conditional-tokens-adapter

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

Primary LanguageSolidityMIT LicenseMIT

Polymarket UMA CTF Adapter

Github Actions Github Actions Coverage

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 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(request timestamp, 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). If the proposal is disputed, UMA's DVM is the fallback and 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.

Deployments

See current deployments

Dependencies

Install dependencies with yarn install

Compile

Compile the contracts with yarn compile

Testing

Test the contracts with yarn test

Coverage

Generate coverage reports with yarn coverage