> ## Documentation Index
> Fetch the complete documentation index at: https://docs.o1.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart contract architecture

> How the factory, launch hook, fee escrow, vesting vault, announcement registry, and launch tokens work together.

The production system uses separate contracts for token creation, permanent liquidity, fee balances, vesting, and announcements. Each contract has a narrow responsibility, which makes its authority and custody easier to verify.

<CardGroup cols={1}>
  <Card title="Launch path" icon="rocket">
    The creator signs one factory transaction. It creates and distributes the token, opens the Uniswap v4 pool, and places the remaining supply into the permanent liquidity position.
  </Card>

  <Card title="Trading path" icon="arrow-right-arrow-left">
    The trader signs a swap through Uniswap. The launch hook applies the fee, the user receives the trade output, and the fee escrow records claimable balances.
  </Card>
</CardGroup>

## Contract responsibilities

| Contract              | Responsibility                                                                        | Custody or authority                                  |
| --------------------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| Base factory          | `B20LaunchpadFactory` creates B20 tokens and coordinates their launch                 | Controls settings for future launches only            |
| Robinhood factory     | `ERC20LaunchpadFactory` creates ERC-20 tokens and coordinates their launch            | Controls settings for future launches only            |
| Token deployer        | `LaunchTokenDeployer` creates the fixed-supply Robinhood token for the launch factory | Callable only by the factory; holds no user funds     |
| Launch hook           | `LaunchHook` opens approved pools, owns permanent positions, and applies swap fees    | Owns and permanently locks launch liquidity positions |
| Fee escrow            | `FeeEscrow` records and pays each recipient's swap-fee balance                        | Can pay only balances credited by the hook            |
| Vesting vault         | `VestingVault` stores and releases vested allocations                                 | Has no administrator; schedules are set once          |
| Announcement registry | `AnnouncementRegistry` publishes creator-authenticated announcements                  | Has no token authority and holds no funds             |
| Robinhood token       | `LaunchToken` is the fixed-supply ERC-20 implementation                               | Has no owner or administrative control                |

## Factory: launch coordination

`createLaunch` coordinates the complete launch. The Base factory creates a native B20 token, while the Robinhood factory creates a fixed-supply ERC-20. Both then follow the same distribution and market-opening process.

| Stage            | Factory behavior                                                                                                                       |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| Validate         | Confirms the selected quote, creation fee, deadline, supply distribution, vesting schedules, profile-editing choice, and launch limits |
| Create token     | Creates the fixed supply and verifies the expected immutable token properties                                                          |
| Distribute       | Sends immediate allocations to recipients and vested allocations to `VestingVault`                                                     |
| Configure market | Records the creator, platform fee receiver, fee split, anti-snipe schedule, currencies, and exact pool identity with `LaunchHook`      |
| Open pool        | Initializes the Uniswap v4 pool at the configured opening price                                                                        |
| Seed liquidity   | Sends the remaining token supply to the permanent position owned by the hook                                                           |
| Publish result   | Emits the token address, creator, pool ID, quote, supply, and spacing in `Launched`                                                    |

The factory owner may update quote currencies, supply, opening prices, liquidity ranges, fees, the platform fee receiver, and announcement support for future launches. Those changes cannot rewrite a completed token or pool.

## LaunchHook: market enforcement

Each pool receives a frozen configuration when it is created. The hook then enforces the launch market throughout its lifetime.

| Responsibility | Behavior                                                                                                                                                    |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Pool gate      | Accepts initialization only for a factory-registered launch                                                                                                 |
| Liquidity seed | Creates the token-only position and verifies that no quote currency is required                                                                             |
| Permanent lock | Rejects every removal and every external liquidity addition                                                                                                 |
| Anti-snipe     | Calculates the timestamp-based opening surcharge in quote currency                                                                                          |
| Fee accounting | Splits the base fee between creator, platform, and valid referrer                                                                                           |
| Trade record   | Publishes the executor, referrer, fee currency, fee amount, and optional comment in the `Trade` event; swap direction comes from the matching Uniswap event |

During the opening anti-snipe period, `LaunchHook` keeps o1's input-amount buy and sell flow open while applying the temporary surcharge. It rejects exact-output requests until the total fee reaches the normal 1% rate.

The detailed callback and function surface is available in [Functions and events](/launchpad/reference/events-functions).

## Escrow, vesting, and announcements

`FeeEscrow` tracks claimable balances. Anyone can trigger payment to the recorded recipient, while a recipient can also redirect their own claim. Only the launch hook can add new fee credits.

`VestingVault` shows each schedule and the amount available now. Anyone can trigger a claim, but payment always goes to the recorded beneficiary. Only the factory can create a schedule, and no administrator can change or recover it later.

`AnnouncementRegistry` records the creator at launch. That creator can later post announcements with a unique ID, description, and URI without receiving any token administration role.

## Trust boundaries

* The factory owner can change defaults for launches that have not happened yet.
* The factory owner cannot change an existing pool or token.
* The hook can credit fees only according to frozen pool configuration.
* The escrow can pay only swap fees already credited to it.
* The vesting vault can send tokens only to the recorded beneficiary.
* Transaction signing stays in the user's wallet; o1 services never hold signing keys.
