Skip to main content
The UMA CTF Adapter requires specific configuration parameters to interact with the Conditional Tokens Framework and UMA’s Optimistic Oracle.

Constructor Parameters

The UmaCtfAdapter contract takes three constructor parameters:
src/UmaCtfAdapter.sol
constructor(address _ctf, address _finder, address _oo) {
    ctf = IConditionalTokens(_ctf);
    IFinder finder = IFinder(_finder);
    optimisticOracle = IOptimisticOracleV2(_oo);
    collateralWhitelist = IAddressWhitelist(finder.getImplementationAddress("CollateralWhitelist"));
}

Parameters

_ctf
address
required
The Conditional Token Framework contract address
When deploying for negative risk markets, this should be the NegRiskOperator contract address instead of the standard CTF contract.
_finder
address
required
The UMA Finder contract addressThe Finder is UMA’s registry contract that stores addresses of all UMA protocol contracts. The adapter uses it to locate the CollateralWhitelist.
_oo
address
required
The UMA Optimistic Oracle V2 contract addressThis is the oracle that provides resolution data for markets.

Environment Variables

Create a .env file in the project root for deployment configuration:
.env.example
PK=
ADMIN=
CTF=
FINDER=
OPTIMISTIC_ORACLE=
RPC_URL=
ETHERSCAN_API_KEY=

Variable Descriptions

PK
string
required
Private key of the deployer account
Never commit your private key to version control. Keep your .env file secure.
ADMIN
address
required
Address that will be granted admin privilegesThe admin can pause/unpause markets, flag markets for manual resolution, and perform emergency functions.
CTF
address
required
Conditional Tokens Framework contract addressSame as the _ctf constructor parameter.
FINDER
address
required
UMA Finder contract addressSame as the _finder constructor parameter.
OPTIMISTIC_ORACLE
address
required
UMA Optimistic Oracle V2 contract addressSame as the _oo constructor parameter.
RPC_URL
string
required
RPC endpoint for the target networkExamples:
  • Polygon: https://polygon-rpc.com
  • Mumbai: https://rpc-mumbai.maticvigil.com
ETHERSCAN_API_KEY
string
API key for contract verificationUsed to verify contracts on Polygonscan or other block explorers.

UMA Contract Addresses

The UMA protocol maintains deployments on various networks. You’ll need the following contract addresses:

Required UMA Contracts

The Finder contract is UMA’s central registry. All other UMA contract addresses can be discovered through the Finder.The adapter uses the Finder to locate:
  • CollateralWhitelist: List of approved collateral tokens
  • OptimisticOracleV2: The oracle contract (also passed directly to constructor)
The Optimistic Oracle V2 is UMA’s oracle that enables markets to resolve via optimistic dispute resolution.Key features:
  • Proposers submit resolution data
  • 2-hour default liveness period for disputes
  • Falls back to DVM if disputes occur
Retrieved automatically via the Finder. Lists approved ERC20 tokens that can be used for:
  • Reward payments to proposers
  • Bond requirements for proposals/disputes
Common whitelisted tokens include USDC, DAI, and WETH.

Finding UMA Addresses

Refer to UMA’s official documentation for contract addresses on your target network:
Once you have the Finder address, you can query other UMA contract addresses programmatically:
address optimisticOracle = finder.getImplementationAddress("OptimisticOracleV2");
address collateralWhitelist = finder.getImplementationAddress("CollateralWhitelist");

Deployment Script

The repository includes a deployment script at deploy/scripts/deploy_adapter.sh:
deploy/scripts/deploy_adapter.sh
#!/usr/bin/env bash

source .env

echo "Deploying UmaCtfAdapter..."

echo "Deploy args:
Admin: $ADMIN
ConditionalTokensFramework: $CTF
Finder: $FINDER
OptimisticOracle: $OPTIMISTIC_ORACLE
"

OUTPUT="$(forge script DeployAdapter \
    --private-key $PK \
    --rpc-url $RPC_URL \
    --json \
    --broadcast \
    -s "deployAdapter(address,address,address,address)" $ADMIN $CTF $FINDER $OPTIMISTIC_ORACLE)"

ADAPTER=$(echo "$OUTPUT" | grep "{" | jq -r .returns.adapter.value)
echo "Adapter deployed: $ADAPTER"

echo "Complete!"
The script:
  1. Loads environment variables from .env
  2. Displays deployment parameters
  3. Deploys the adapter using Forge
  4. Extracts and displays the deployed adapter address

Constants

The adapter includes several important constants:
src/UmaCtfAdapter.sol
/// @notice Time period after which an admin can manually resolve a condition
uint256 public constant SAFETY_PERIOD = 1 hours;

/// @notice Unique query identifier for the Optimistic Oracle
/// From UMIP-107
bytes32 public constant YES_OR_NO_IDENTIFIER = "YES_OR_NO_QUERY";

/// @notice Maximum ancillary data length
/// From OOV2 function OO_ANCILLARY_DATA_LIMIT
uint256 public constant MAX_ANCILLARY_DATA = 8139;
These constants are hardcoded and cannot be changed after deployment.

Next Steps

View Deployments

See official deployments on Polygon, Mumbai, and Amoy

Initialize Markets

Learn how to initialize prediction markets

Build docs developers (and LLMs) love