> For the complete documentation index, see [llms.txt](https://whitepaper.after-bell.uk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.after-bell.uk/technical-architecture/smart-contracts.md).

# Smart Contracts

Describes AFTERBELL’s five named on-chain contract responsibilities.

### Contract responsibility map

AFTERBELL identifies five contract components. Together, they establish markets, represent conditional outcomes, settle CLOB activity, resolve outcomes, and handle fees.

| Contract          | Core responsibility               | Asset or state             |
| ----------------- | --------------------------------- | -------------------------- |
| ConditionalTokens | Outcome representation            | ERC-1155 positions         |
| MarketFactory     | Market creation and fees          | Market configuration       |
| OracleResolver    | Price verification and resolution | Resolution state           |
| CTFExchange       | CLOB settlement                   | USDG and outcome positions |
| FeeCollector      | Fee collection and distribution   | Protocol fees              |

The contracts execute on EVM-compatible Robinhood Chain. This map is conceptual. It does not assert that every contract directly calls every other contract or that the flow occurs in one transaction.

### ConditionalTokens

ConditionalTokens represents binary outcome positions as ERC-1155 tokens. Each market has Yes and No outcome positions. The contract supports split, merge, and redeem.

For “Will NVDA close above $150 on Friday?”, a user can hold a Yes or No position. Once the market resolves, the winning position retains redemption value. The losing position becomes worthless. Redemption is therefore tied to verified market resolution.

Split and merge describe lifecycle operations for conditional outcomes. The source does not define token IDs, condition IDs, collection IDs, token encoding, or exact mint and burn mechanics. Those details remain unspecified.

### MarketFactory

MarketFactory is responsible for market creation and fees. It establishes the protocol’s markets and associated fee configuration at a high level.

The source identifies a 0.5% trading fee and 0.1% resolution fee. It does not disclose MarketFactory constructors, function names, storage, access control, or the market configuration fields. This component should therefore be understood as the market establishment boundary, not as a documented ABI.

### OracleResolver

OracleResolver handles oracle reading, cross-checking, and the circuit breaker. It links resolution to two data sources:

```
Chainlink stock token feed → primary price
Robinhood REST API → off-chain cross-check
                    ↓
OracleResolver → resolution or pause
```

If the two prices disagree by more than 5%, the market pauses. Manual resolution can then use off-chain evidence. This preserves an exception path for an oracle discrepancy. The source does not specify oracle function signatures, timing thresholds, fallback feeds, or how manual evidence is represented on-chain.

### CTFExchange

CTFExchange provides the settlement boundary for the off-chain CLOB. Users sign EIP-712 orders. The CLOB receives and matches compatible orders off-chain. CTFExchange then settles resulting activity on-chain and supports batch execution.

The distinction is essential:

```
CLOB: discover and match compatible trading intent
CTFExchange: execute and enforce on-chain settlement
```

The source does not define order schemas, matching priority, nonces, cancellations, partial fills, or batch-size semantics. CTFExchange should not be described as the matching engine.

### FeeCollector

FeeCollector handles protocol fee collection and distribution. The named allocation is 70% to the treasury, 20% to market-maker subsidies, and 10% to the keeper bot.

This responsibility does not specify treasury spending, transfer timing, or accounting implementation. It also does not add fees beyond the stated trading and resolution fees. The contract’s role is fee handling within the source model.

### Conceptual interaction map

```
MarketFactory → ConditionalTokens → CTFExchange
                     ↓                 ↓
               OracleResolver → resolution → redeem
                     ↓
                FeeCollector
```

This is a responsibility map. It shows how market establishment, outcome representation, settlement, resolution, redemption, and fees relate. It is not a claim about direct calls, transaction order, or internal contract topology.

### Security status

{% hint style="warning" %}
Smart contracts are currently unaudited. An audit is planned before mainnet. No security guarantee or production-readiness claim follows from the named standards or components.
{% endhint %}

AFTERBELL remains under development. ERC-1155, EIP-712, and Chainlink integration describe architectural building blocks. They do not independently establish end-to-end security.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://whitepaper.after-bell.uk/technical-architecture/smart-contracts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
