Documentation

How Prismex is built

Prismex is one interface over two very different ways to trade: a perpetual order book and an automated spot pool. This page walks the whole system from the browser down to the chain, including the parts that are deliberately not wired up yet, and why.

Settlement

Robinhood Chain (4663)

Leverage

24 perpetual markets

Spot

24 pairs

01Start here

What Prismex is

Prismex runs no matching engine and custodies nobody’s funds. What it runs is a front end and a thin server tier that routes user intent to the right execution path. Which venue handles an order is decided entirely by the surface in use: the leverage screen points at the perpetual book, the spot screen at the pool.

Leverage

A two-sided order book with isolated margin. Position size, liquidation price and taker fee are all derived from the margin and multiplier set on the ticket.

Spot

A direct swap against ETH through an on-chain pool. No margin and no liquidation — what exists instead is slippage, a route, and a platform fee.

02Surface

Routes and how the screen divides

The site has eight routes. Two of them — the root and /trade — render the same screen, so anyone typing the domain lands on the book without passing a marketing page first.

RouteContents
/ and /tradePerpetuals terminal: market list, chart, order book, ticket.
/swapSpot terminal: asset list, chart, swap card.
/portfolioEquity and history, read from the connected wallet.
/token$PRISMEX contract address, supply, lock proof.
/contactFeedback form.
/docsThis page.

From lg upward the terminal height is pinned to the viewport and each column scrolls on its own — that is what makes a trading screen feel like one. Below lg the pin is released: a 288px rail does not fit on a phone, so the columns stack into an ordinary scrolling page.

03Presentation

The design system

The Prismex spectrum was not picked out of the air: its six colours are samples taken from the gradient inside the logo, read left to right. That is the same spectrum that appears as the hairline across the top of large cards and as the network pill in the header.

Rose

#fda2ba

Orchid

#e59fe2

Lilac

#c4a1fa

Sky

#9abefd

Aqua

#8ad9ea

Mint

#9af2d2

The theme is light only. This screen gets read for hours in daylight, and the green/red pair separates more cleanly on warm paper #f8f7f4 than on a dark ground. Figures use font-variant-numeric: tabular-nums so a price column does not jitter every time a digit changes.

04Settlement

Robinhood Chain

All settlement happens on Robinhood Chain. The network parameters are not design choices — a wallet refuses to connect if any one of them is wrong.

ParameterValue
Chain id4663 (0x1237)
Native currencyEther — ETH, 18 decimals
RPChttps://rpc.mainnet.chain.robinhood.com
Explorerhttps://robinhoodchain.blockscout.com

If a wallet does not know the network yet, the switch request fails with code 4902. Prismex catches exactly that code, offers to add the network through wallet_addEthereumChain, then tries the switch once more.

05Identity

Wallets and sessions

Wallet discovery uses EIP-6963. Wallets announce themselves through the eip6963:announceProvider event; the page asks them to re-announce with eip6963:requestProvider. The picker therefore lists only wallets that are genuinely installed, rather than a fixed menu written into the code.

  1. 01

    Discovery

    The page listens for announcements and builds the list. With exactly one wallet present, the picker is skipped.

  2. 02

    Permission

    eth_requestAccounts raises the prompt in the wallet. The address that comes back is converted to its EIP-55 checksum form before it is displayed.

  3. 03

    Network

    The chain id is read from the wallet rather than assumed. Off Robinhood Chain, the header pill turns into a switch-network button.

  4. 04

    Memory

    The only thing stored in localStorage is the wallet's rdns — not the address, nothing secret. After a reload eth_accounts reconnects silently, which only succeeds if the permission is genuinely still granted.

Disconnecting tries wallet_revokePermissions first. Several wallets do not implement it; when it fails the page says so plainly instead of going quiet — the permission is still held by the wallet, and that is why reconnecting asks for no confirmation.

06Numbers

Where the market data comes from

Every number on the terminal comes from a public market feed. Nothing is generated, and nothing is cached long enough to go quietly out of date.

FeedWhat it answers for
Gate.io, then OKXCrypto last price, 24h high/low, notional volume, order-book depth and the funding rate. One batched call covers the whole crypto side of a list; the second venue is tried only when the first does not answer.
Yahoo FinanceTokenised equity last price, previous close, session high/low and share volume, which the desk converts to notional.
TradingViewEvery chart drawn on the terminal, for both desks.

Every feed is called from the server, in src/lib/feeds.ts, for two reasons: the upstreams do not all send CORS headers, and keeping the calls there means the browser talks to one origin rather than three. The client polls /api/quotes every twelve seconds and /api/book every six.

When an upstream fails, the symbol is simply left out of the response and the row shows a dash. A failed refresh never blanks the screen either — the last good payload stays where it is and the footer says the feed stalled. A missing quote is a fact worth showing, not a gap worth filling.

07Charts

The TradingView layer

Charts are TradingView’s advanced chart widget, one per market, driven by the symbol stored alongside each entry in the catalogue — OKX:BTCUSDT.P for a perpetual, NASDAQ:NVDA for an equity.

The widget reads its configuration from its own script tag, so there is no imperative API to call: changing symbol or interval means tearing the container down and building a new one. The cleanup matters. Without it, switching markets quickly stacks several widgets inside the same box and the older ones carry on polling in the background.

The range tabs above the chart map onto TradingView intervals rather than re-fetching anything of our own, and if the widget script cannot load, the panel says so and leaves the order book and quotes — which come from a different feed — untouched.

08Depth

The order book

Depth is live, eighteen levels a side. The venue supplies price and size per level; the running total is computed here, and it is what the shading behind each row is drawn from — so the bar describes the queue rather than a single level. Gate.io quotes futures depth in contracts rather than base units, so sizes are converted with the contract’s quanto multiplier, cached for an hour since it effectively never changes.

  1. 01

    Ordering

    Asks are reversed before rendering so the tightest offer sits nearest the mid, with the book opening outward from the middle in both directions.

  2. 02

    Mid and spread

    Both are derived from the top of each side rather than taken from a separate field, so they cannot disagree with the rows above and below them.

  3. 03

    Switching markets

    The previous book is cleared the moment the symbol changes, and a reply that arrives for a market already navigated away from is discarded. Otherwise BTC depth sits under an ETH header for a beat and reads as a wrong price.

  4. 04

    Funding

    Fetched alongside the book for perpetuals only. On the spot desk that column shows the pool fee instead, because funding does not apply there.

09Leverage

The perpetual ticket

The perpetual ticket derives four numbers from two inputs. Margin times the multiplier gives order value; order value divided by the mark gives position size; the liquidation estimate comes from the one-over-leverage distance to entry, nudged by maintenance margin.

InputBounds
MarginA decimal, in USDT. Anything that is not a digit or a point is dropped as you type.
Multiplier1x up to the ceiling for that market — 50x on BTC and ETH, down to 5x on the thinnest books. Moving to a market with a lower ceiling clamps the slider rather than keeping a value the desk does not offer.
Taker fee0.045% of order value.

The submit button stays disabled. The Prismex perpetual contracts are not deployed on Robinhood Chain yet, and a button that looks alive while doing nothing is worse than one that explains itself — the reason is printed directly beneath it.

10Spot

Quoting and routing swaps

The swap card works in both directions against ETH. Buying means paying ETH and receiving the asset; selling is the reverse. Both legs are priced in USD by the feed, so the rate is one live quote divided by the other, less the 0.25% platform fee.

  1. 01

    Rate

    Asset price over ETH price, or the inverse depending on direction. If either quote is missing the card says so rather than printing a rate built on a guess.

  2. 02

    Slippage tolerance

    0.5%, 1% or 2%. The chosen figure produces a minimum-received amount, and that amount is shown before anyone presses anything.

  3. 03

    Route

    Displayed as the asset pair. While the Prismex pools do not exist, there is no real route and the button names that.

When the pools do go live, the correct order for an ERC-20 input is: check the network, request an approval only if the existing allowance falls short, bound the output with the minimum above, then send. Unlimited approvals will not be used.

11Token

$PRISMEX and the lock proof

$PRISMEX is an ERC-20 on Robinhood Chain with 18 decimals. Its address is written in exactly one place — a single configuration file — and the whole site reads from there: the token page card, the explorer link and the shortened form all follow from that one value.

While the address is not a valid 42-character hex string, the token page calls it a placeholder instead of linking to an explorer page that does not exist. The same rule covers the lock proof: Prismex uses Hoodlock, and while the lock contract is empty the page shows a pending note rather than a dead button.

12Boundaries

What is never touched

A few things never enter this repository, and that is deliberate.

Never reaches the browser

No API keys, no signing keys, no secret of any kind bundled into the client. Every market feed used here is public and keyless, so there is nothing to leak in the first place.

Stays under user control

Private keys never leave the wallet. Prismex asks for the public address and the chain id, both of which anyone can already read off the chain.

If a feature ever needs a secret that does not exist yet, the page is still built and shows a calm “not configured” state. Nothing crashes, and no example value is invented to make it look like it works.

13Operations

Building and shipping

The app is Next.js with the App Router and Tailwind. The pages are static; the two feed handlers under /api are the only dynamic parts, and there is no database behind them.

CommandWhat it does
npm run devDevelopment server on port 3000.
npm run buildProduction build.
npm startServe the production build.

Every image is WebP, favicon included, and that covers the market logos as well: all 48 of them are converted and shipped from public/markets rather than hot-linked, so the terminal does not depend on a third-party image host to render its own rows.