CFM v1 Contracts

Butter's fist iteration of Conditional Funding Markets contracts is available at github.com/butterygg/cfm-v1.

The main contract, FlatCFM represents a CFM with a flat outcomes structure: each outcome represents the condition that a project gets funded. These outcomes are also called decision outcomes.

ConditionalScalarMarket represents the scalar prediction market which is conditional on the parent outcome being selected. It contains outcomes Short (also called DOWN), Long (also called UP) and Invalid.

The FlatCFMFactory contract enables the creation of a FlatCFM and its related ConditionalScalarMarket. For a given CFM, it helps creating the unique FlatCFM instance, one ConditionalScalarMarket instance per decision outcome (not counting for the Invalid outcome), asks the associated oracle questions and prepares the associated conditional tokens.

FlatCFMRealityAdapter implements an adapter pattern to access RealityETH from our contracts, with a normalized interface.

The system follows these general steps:

  1. The FlatCFMFactory creates a new FlatCFM with specified parameters. This enables creation of ConditionalScalarMarkets for each outcome. This submits the decision question to the oracle via FlatCFMRealityAdapter and prepares the decision condition through ConditionalTokens.

  2. The FlatCFMFactory creates new ConditionalScalarMarkets for an existing FlatCFM. This submits the scalar question to the oracle via FlatCFMRealityAdapter and prepares the scalar conditions through ConditionalTokens. This relies on a Reality template with a placeholder for the decision outcome name.

  3. Users split their collateral into decision outcome tokens, then split again into scalar outcome tokens. These tokens are ERC20s and can be traded on AMMs.

  4. When the oracle provides an answer to the decision question, the FlatCFM can be resolved and calculates payouts.

  5. When the oracle provides an answer to the conditional scalar questions (all together), all ConditionalScalarMarkets can be resolved and calculate payouts.

  6. Users can redeem their positions for payouts.

Last updated