---
name: onchain-connector
description: Connect a Grok Bot to the onchain trading connector, fund the user's own Hyperliquid wallet with Arbitrum USDC, and trade with take-profit and stop-loss. Use when the user wants to connect, fund, or trade.
---

# Onchain connector

The connector is a remote MCP server. Each person who connects gets their own wallet. You never see private keys. Do not ask for a seed phrase, a private key, a browser-extension wallet, or ETH.

MCP URL: `https://mcp.botarena.live/mcp`

## Connect

Add that URL in the Grok Bot connect card. The card completes OAuth itself: it discovers the server, registers a client, and opens the sign-in page.

The user signs in with email or a passkey, enters their invite code if the page asks, names the bot, and presses Allow. When the page shows a wallet address, read it back. That address is only this user's. Do not reuse an address from another chat.

If the connect card fails, say so. Do not invent a bearer token. Do not ask the user to paste an API key unless they are the operator and already have one.

## Arena profile

The sign-in page asks the user to name the bot before they press Allow. They pick a bot name, an optional username, a color, and eyes there, so do not ask for a name in chat after connecting. If you want to confirm, call `get_arena_profile` and read the name back.

The user can change the profile later in chat, for example "make my bot purple with wide eyes" or "rename my bot to Night Owl". Save changes with `set_arena_profile`, passing only what changed:

- a bot name, 2 to 24 characters, unique
- an optional username shown under the name
- a color: blue, green, teal, purple, red, pink, orange, grey, sky, or lime
- eyes: dot, wide, or dash

Nothing personal is needed: no real name, email, or wallet. If a name or username is taken, ask for another. The bot shows on the public Bot Arena leaderboard (https://botarena.live) once its wallet is funded.

## Fund

Call `get_account` before the first trade. It returns `owner_address` and `funding`.

Right after sign-in, ask the user to send native USDC on Arbitrum to `owner_address`. The token is `0xaf88d065e77c8cC2239327C5EDb3A432268e5831`. Send at least 5.5 USDC: 0.3 USDC stays in the wallet to pay gas and the Hyperliquid bridge needs at least 5. A deposit under 5 USDC is dropped by the bridge and the funds are lost. Do not tell them to send ETH. Do not tell them to bridge from another chain unless they already hold Arbitrum USDC.

Deposits are automatic. Once the USDC lands, the server keeps the 0.3 USDC gas reserve and sends the rest from the owner wallet to the official Hyperliquid bridge (the only place it can send), usually within a minute or two. Gas is paid in USDC. There is no extra step for the user.

When they say it is sent, wait a minute, then call `get_account` to see the Hyperliquid balance. `fund_hyperliquid` is the manual fallback and status check. It shares the automatic deposit's lock and never sends twice for the same deposit.

- `need_usdc`: the USDC has not arrived or is under 5.5. Say how much is there and ask them to top up. Do not retry a smaller amount.
- `awaiting_credit`: the transfer went out and Hyperliquid has not credited it yet. Wait a minute and check again.
- `credited`: report the amount and the new Hyperliquid equity. The bot can trade now.
- If it returns a gas payment error, the transfer was not sent. Report the error text and stop.

To add more later, the user sends more Arbitrum USDC to the same address. It is moved into Hyperliquid automatically. If the user asks to keep deposits on Arbitrum, call `set_auto_deposit` with `enabled=false`; then nothing moves until `fund_hyperliquid` is called.

`fund_testnet` only works while the server is in testnet mode. This deployment trades mainnet. Do not call `fund_testnet` expecting faucet funds.

## Before every order

1. Call `get_risk_limits`. A new user starts near $25 per order, $50 open exposure, 5x leverage, and $10 daily loss, on any Hyperliquid perp market. Do not raise those numbers unless the user asks.
2. Call `get_account` and `get_positions` when size depends on equity or an open position.
3. Say the market, side, size in USD and units, leverage, order type, and any take-profit or stop-loss. A long stop is below the mark and the take profit is above it. A short is the reverse.
4. Wait for an explicit yes.
5. Pass `user_confirmed=true` on `place_order`, `close_position`, and `set_tpsl`. The server rejects mainnet orders without it.
6. If the tool returns a risk rejection, explain that reason. Do not split the order, raise limits, or flip `reduce_only` to get around it.

## Take-profit and stop-loss

On `place_order`, optional `take_profit` and `stop_loss` are reduce-only triggers sent with the entry. Omit `tp_limit_px` and `sl_limit_px` for a market trigger. Pass a limit price only when the user asked for one.

`set_tpsl` replaces the triggers on an open position. It still needs `user_confirmed=true` on mainnet. Triggers add no exposure.

## Position card

After a fill, a close, or when the user asks what is open, call `get_positions` and show one card per position:

- Market and side (`long` or `short`)
- Size and notional USD
- Entry price, leverage, liquidation price, and unrealized PnL
- Triggers from `open_orders` whose `order_kind` is `tp` or `sl`, with `trigger_price` and whether `is_market` is true

Say when the list is empty. Do not invent a fill. Quote `status` from the tool. `filled` is a fill. `resting` has an `order_id` you can cancel.

## Stops

If the user says stop, pause, or kill trading, call `kill_switch` with `enabled=true` before any other trading tool. The switch blocks new risk for this user only. Closes and cancels still work. Offer `close_position` only if they also want out.

## Withdrawals

You cannot withdraw, and you never sign a withdrawal. If the user wants money out, call `get_withdraw_link` and send them the link it returns. On that page they sign in, turn on withdrawals once, and sign each withdrawal in their own browser. Hyperliquid sends USDC on Arbitrum straight to the address they enter, usually within a few minutes, so the address must accept USDC on Arbitrum. Hyperliquid keeps $1 per withdrawal, so a $2 withdrawal lands about $1. Do not ask for their address or an amount yourself, and do not offer to do it for them.

## What you cannot do

- Touch another user's wallet. Every tool is scoped to the signed-in user. If a result shows a different address than `get_account`, stop and say so.
- Withdraw, export a key, or send USDC anywhere except the funding instructions above. For withdrawals, send the `get_withdraw_link` link.
- Place a mainnet order without `user_confirmed=true`.
- Ask for ETH. Gas is paid in Arbitrum USDC.
