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

# Architecture

gage is two layers of contracts on Robinhood Chain and a few services that only read events and send permissionless transactions.

```
FRONT END   Next.js · wagmi · Robinhood Wallet first, WalletConnect second
            Borrow · Lend · Deal · Portfolio · Rewards · Pool · Dashboard
     │ reads the API · sends transactions
SERVICES    Indexer (Ponder) · Valuation and suggested range · Notifier · Keeper
     │ events up · permissionless transactions down
CONTRACTS
  Vault layer (immutable, no owner)
    DealVault            deals, escrow, the state machine, internal balances, fee accounting
      ERC20Adapter       Stock Tokens, WETH, memes
      UniV4PositionAdapter   PositionManager NFTs: pool and hook checks
    CollateralRegistry   allowlists, lanes, minimums, caps, terms, fee, pause of new deals · owner: Safe
    FeeSink              receives USDG fees · route: treasury or Buyback
    EntryRouter          stateless: ETH → USDG and fund in one transaction
  Token layer
    sGAGE                ERC-20, 5,000,000,000 minted once
    Drip                 locked balances unlocking on the quadratic curve
    Emissions            52-week schedule, weekly budgets, rollover, burn at week 52
    DealRewards          registration of funded deals, reservation from the week's budget, drip grants
    LPHook               v4 hook on GAGE/sGAGE: records adds and removes, never reverts
    LPRewards            LP score, emissions stream, collect by position owner
    CreatorFeeSplitter   the Pons creator wallet: half to operations, half to the sGAGE floor
    Buyback              fees → ETH → GAGE → sGAGE → burn
    ReinvestRouter       stateless: sGAGE → GAGE/sGAGE position, match or zap
    SeedTimelock         holds the seed position for 365 days
EXTERNAL
    Stock Tokens · USDG · WETH · Uniswap v4 · the Pons GAGE/ETH launch pool
```

## The vault layer

The vault is the contract that holds every deal, every escrowed asset and every internal balance. It is immutable and has no owner. Nothing in it can move a user's collateral or USDG, delay a reclaim or accelerate a claim.

The registry is the only place with an owner, a 2-of-3 Safe. It decides what can be listed (allowlists, per lane), the minimums and caps, the allowed terms, the fee, and whether new deals are paused. Every parameter has a compile-time bound. Pausing touches only listing and funding; cancelling, reclaiming, claiming and withdrawing can never be paused.

The fee sink pulls fees from the vault and routes them to a treasury or to Buyback. The entry router swaps ETH to USDG and funds in one transaction; it holds nothing between transactions.

## The token layer

Nothing in the token layer touches the vault. The vault never reads a token price and never holds GAGE or sGAGE. Deal rewards are registered permissionlessly by reading a funded deal from the vault; the app registers right after funding and a keeper backstops within the hour.

## The services

* **Indexer** consumes vault and token-layer events into deals, balances, drips, epochs, positions and stats, and serves the app.
* **Valuation** values any listed collateral from the chain's pools, computes the scenarios on the lender's panel, screens memes, and suggests ranges.
* **Notifier** sends expiry reminders by Telegram, email and web push.
* **Keeper** sends permissionless transactions: register deals, checkpoint positions, release epochs, buyback clips. A convenience, never a dependency; anyone can send the same transactions.

State is fully derivable from events. Nothing the services hold is needed to settle a deal.

## Chain

Robinhood Chain is an Arbitrum Orbit L2 with a single sequencer operated by Robinhood. Time-based rights carry generous grace windows so a sequencer outage cannot cost a borrower their collateral. All timing is by block timestamp.


---

# 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://docs.gage.cash/protocol/architecture.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.
