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

# RWA Stocks

> Access 1,997 tokenized stocks from Robinhood on Arbitrum

Discover and interact with tokenized real-world asset (RWA) stocks on Robinhood's Arbitrum chain. The platform provides contract scanning, token discovery, and balance queries for 1,997 tokenized stocks deployed as ERC-20 tokens.

## What Are RWA Stocks?

Robinhood has deployed tokenized representations of traditional equities on their own Arbitrum Orbit L2 chain. Each stock is an ERC-20 token with standard metadata (name, symbol, decimals, totalSupply) that maps to a real-world equity.

<CardGroup cols={2}>
  <Card title="Robinhood Chain" icon="link">
    An Arbitrum Orbit L2 (chain ID 46630) purpose-built for tokenized securities. Uses ETH as the native gas token.
  </Card>

  <Card title="1,997 Stocks" icon="chart-mixed">
    Deployed via a factory pattern with sequentially assigned contract addresses. Includes major US equities.
  </Card>
</CardGroup>

## Chain Details

| Property       | Value                                          |
| -------------- | ---------------------------------------------- |
| Chain ID       | `46630`                                        |
| Chain Name     | Robinhood Chain                                |
| Type           | Arbitrum Orbit L2                              |
| Native Token   | ETH                                            |
| RPC            | `https://rpc.testnet.chain.robinhood.com`      |
| Explorer       | `https://explorer.testnet.chain.robinhood.com` |
| WebSocket Feed | `wss://feed.testnet.chain.robinhood.com`       |

<Info>
  Robinhood Chain is currently in testnet. The RPC and explorer URLs will change when mainnet launches. The agent automatically uses the correct chain configuration.
</Info>

## How Token Discovery Works

Robinhood deployed stock tokens using a factory pattern, meaning contracts are created sequentially at predictable addresses. The `RwaAdapter` discovers tokens by scanning these addresses:

### Contract Scanning

The `scanContracts()` method takes a list of candidate addresses and probes each one for ERC-20 metadata:

1. **Read metadata** -- calls `symbol()`, `name()`, `decimals()`, and `totalSupply()` on each address
2. **Validate** -- contracts that respond with valid ERC-20 metadata are classified as stock tokens
3. **Activity check** -- tokens with `totalSupply > 0` are marked as active
4. **Cache results** -- discovered tokens are stored in an in-memory cache for fast subsequent lookups

The scanner runs with configurable concurrency (default: 10 parallel requests) to balance speed and RPC rate limits.

### MCP Tool: `arb_rwa_scan`

The MCP server exposes an `arb_rwa_scan` tool that wraps the scanner for use by the agent and external MCP clients. This tool:

* Accepts a range of contract addresses or a batch of known addresses
* Returns an array of `RwaStockInfo` objects with symbol, name, contract address, decimals, and activity status
* Results are cached across invocations for the lifetime of the MCP server process

## Stock Information

Each discovered token returns a `RwaStockInfo` object:

| Field             | Type      | Description                                 |
| ----------------- | --------- | ------------------------------------------- |
| `symbol`          | `string`  | Stock ticker symbol (e.g., "AAPL", "TSLA")  |
| `name`            | `string`  | Full stock name                             |
| `contractAddress` | `Address` | ERC-20 contract address on Robinhood Chain  |
| `chainId`         | `number`  | `46630` (Robinhood Chain)                   |
| `decimals`        | `number`  | Token decimals (typically 18)               |
| `isActive`        | `boolean` | Whether the token has nonzero total supply  |
| `totalSupply`     | `bigint`  | Current total supply of the tokenized stock |

## Registry Statistics

The adapter tracks aggregate statistics about the scanned registry:

```typescript theme={"theme":{"light":"dracula","dark":"dracula"}}
const stats = rwaAdapter.getRegistryStats();
// stats.total    — total number of discovered stock tokens
// stats.active   — tokens with nonzero totalSupply
// stats.inactive — tokens with zero totalSupply
```

## Querying Balances

Check how many shares of a tokenized stock an address holds:

```typescript theme={"theme":{"light":"dracula","dark":"dracula"}}
const balance = await rwaAdapter.getBalance(contractAddress, ownerAddress);
```

This calls the standard ERC-20 `balanceOf` on the Robinhood Chain.

## Symbol Lookup

After scanning, you can search the cache by ticker symbol:

```typescript theme={"theme":{"light":"dracula","dark":"dracula"}}
const apple = rwaAdapter.findBySymbol("AAPL");
// Returns RwaStockInfo or null if not in cache
```

Symbol matching is case-insensitive.

<Tip>
  Call `scanContracts()` or `getAvailableStocks()` at least once before using `findBySymbol()`. The symbol lookup searches the in-memory cache, which must be populated first.
</Tip>

## Price Data

<Note>
  Price oracle integration is pending. Robinhood has not yet published oracle contract addresses for their chain. When available, the adapter will read prices from Chainlink-style feeds on Robinhood Chain.
</Note>

The `getPrice(contractAddress)` method is stubbed and will return `null` until oracle contracts are deployed. Current status of each stock can be inferred from the `totalSupply` and activity flags.

## Example Prompts

```
Scan for available RWA stocks on Robinhood Chain
```

```
Look up the AAPL stock token on Arbitrum
```

```
What tokenized stocks are available on Robinhood?
```

```
Check my balance of TSLA tokens
```

```
How many RWA stocks are active on Robinhood Chain?
```

```
Find the contract address for NVDA on Robinhood
```

## SDK Reference

The RWA adapter is in the `@arb-agent/adapters` package as `RwaAdapter`.

### Constructor

```typescript theme={"theme":{"light":"dracula","dark":"dracula"}}
const rwa = new RwaAdapter(rpcUrl?: string);
```

If no RPC URL is provided, defaults to the Robinhood Chain public RPC endpoint.

### Methods

| Method                                  | Description                                          |
| --------------------------------------- | ---------------------------------------------------- |
| `getStockInfo(address)`                 | Fetch ERC-20 metadata for a single contract address  |
| `getAvailableStocks(addresses)`         | Batch fetch metadata for multiple addresses          |
| `scanContracts(addresses, concurrency)` | Scan a range of addresses to discover stock tokens   |
| `findBySymbol(symbol)`                  | Search the cache by ticker symbol (case-insensitive) |
| `getBalance(address, owner)`            | Check token balance for an owner address             |
| `getPrice(address)`                     | Fetch token price (pending oracle deployment)        |
| `getAllCached()`                        | Return all discovered stock tokens from the cache    |
| `getRegistryStats()`                    | Return total/active/inactive counts                  |

<Warning>
  RWA stock tokens are deployed on Robinhood Chain (chain ID 46630), not on Arbitrum One (chain ID 42161). The adapter creates its own client connected to the correct chain. Do not attempt to query these contracts on Arbitrum One.
</Warning>
