> For the complete documentation index, see [llms.txt](https://sagebet.gitbook.io/sagebet-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sagebet.gitbook.io/sagebet-documentation/sagebet/architecture.md).

# Architecture

## Overview

Our mission is to build the most efficient, reliable, and accessible prediction market available. To that end, nearly every component of our software is on-chain, and all markets are resolved by a lightning-fast multi-sig [#oracle](#oracle "mention").

SageBet has 5 principle components: a market factory, individual market contracts, conditional tokens, collateral tokens, and an oracle. See below for details.&#x20;

## Market Factory

First, the market factory: <https://arbiscan.io/address/0x893A890ac35F337f38dF271b18B05bb2722d14F0>

This contract produces [#individual-market-contracts](#individual-market-contracts "mention") via a multi-sig. The individual markets are what users see on <https://sage.bet/> and are where all the action happens. Please see  sections below for more details. &#x20;

## Individual Market Contracts

Each market is created by a multi-sig transaction that calls [#the-market-factory](#the-market-factory "mention"). Each market contract has several configurable parameters: a JSON string that contains the market tile, market subtitle, outcomes names (e.g. "Yes/No" or "Team Canada/Team Mexico"); minimum trade size (usually $1); the fee amount (see [Fees](/sagebet-documentation/sagebet/market-and-trading-basics/fees.md)); and the fee recipient.&#x20;

All markets are built on top of an on-chain orderbook that contains open orders waiting to be filled. Take a look at the example below:

<figure><img src="https://2717306087-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigvbPyJyJ6b75QuHUc1R%2Fuploads%2FyTz0Gu2P9ZRWJj46pb7C%2FScreen%20Shot%202023-04-17%20at%204.08.00%20PM.png?alt=media&amp;token=9aa7f14f-f004-45ec-9b9f-35a39ba69706" alt=""><figcaption></figcaption></figure>

See [Market and trading basics](/sagebet-documentation/sagebet/market-and-trading-basics.md)for more information on the orderbook and how to trade.

## Conditional Tokens

All SageBet markets are built with [Gnosis Conditional Tokens](https://docs.gnosis.io/conditionaltokens/). This is an open-source, thoroughly-audited token class ([ERC-1155](https://eips.ethereum.org/EIPS/eip-1155)) that SageBet uses to represent market shares. When a market is resolved by the [#oracle](#oracle "mention"), holders of the winning set of conditional tokens can claim their pro-rata share of the market pot.&#x20;

See [Market and trading basics](/sagebet-documentation/sagebet/market-and-trading-basics.md)for more information on placing bets and claiming shares.&#x20;

## Collateral Tokens

Currently, all SageBet markets are traded and settled with [USDC](https://arbiscan.io/token/0xff970a61a04b1ca14834a43f5de4533ebddb5cc8). Technically, any ERC20 token can be set as the collateral token for a given market, as it is a configurable parameter. Until further notice, SageBet will exclusively use USDC.&#x20;

If you don't have any USDC, you can swap for some on [Uniswap](https://app.uniswap.org/#/swap), [1inch](https://app.1inch.io/#/42161/simple/swap/ETH/USDC), [Paraswap](https://app.paraswap.io/), or any other DEX of your choice. If you have any questions, please come find us via the links in [Community/Social](/sagebet-documentation/links/community-social.md).&#x20;

## Oracle

SageBet settles all of its markets via a multi-sig, using the resolveAndCloseMarket() function on the [#market-factory](#market-factory "mention")contract. Real-world events such as sports games and political races are monitored in real-time and resolved as soon as their outcome is public of the market' specified resolution time has passed.&#x20;

There have been many oracle designs proposed and tried for on-chain prediction markets, each with their own advantages and limitations. It is a classic case of the "blockchain trilemma" as illisutrated below:

<figure><img src="https://2717306087-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigvbPyJyJ6b75QuHUc1R%2Fuploads%2FvEzfggds5lNipZtEJo4j%2FScreen%20Shot%202023-04-17%20at%206.11.40%20PM.png?alt=media&amp;token=5c287600-1c57-4073-b78a-0c1069de623d" alt=""><figcaption><p>You choose amny of the two, but never all three.</p></figcaption></figure>

SageBet decided to prioritize Security and Speed by opting for a multi-sig oracle that settles the outcome for each market. This diminishes the decentralization of the system, but the benefits of a fast and secure oracle were preferred. Inevitably there are trust risks with semi-centralized solutions — the only means to ameliorate these risks for users is transparency, communication, and establishing a strong, spotless record of properly resolving markets quickly and fairly.&#x20;

We will be adding more documentation soon.

This is the current home of the multi-sig Gnosis Safe: [0x35475f6661a911c1448048344B3597bA6B13f28A](https://arbiscan.io/address/0x35475f6661a911c1448048344b3597ba6b13f28a)
