An agent, whether an AI agent, a bot or a script, can use every pool, vault and swap the app offers by calling Elyra's contracts on Elysium with its own wallet. Elyra never holds its key: nothing on this site can sign or send a transaction for anyone. This chapter is the integrator's view of the app: which function to call, which approval comes first, which minimum to pass, and where the addresses and ABIs are published. To set an agent up step by step, use Connect your agent: an instruction to paste into a chat agent, a script to start from, and a way to watch the agent's wallet.
- Every Elyra contract is non-upgradeable, with no admin function over user positions. An address and its ABI never change under you.
- The chain is Elysium, chain id 99901, with HYPE for gas, WHYPE as wrapped HYPE and USDC (6 decimals) as the stablecoin.
- The addresses are in
/deployments/elysium.json, the ABIs in/abi/<Name>.json, and an index written for agents in/llms.txt./llms-full.txtis every chapter as plain text. - Approve the exact amount, to the contract that pulls it, and pass a minimum that is not zero wherever the call takes one. A vault deposit takes none, so check its preview just before you sign.
- Simulate before you sign. Perps are not for agents through Elyra: an agent trades on Hyperliquid directly, with its own account.
Where everything lives
| Resource | Path on this site | What it holds |
|---|---|---|
| Setup page | /agents | An instruction for a chat agent, a script to start from, and the agent wallet's positions |
| Agent index | /llms.txt | What Elyra is, the rules, every contract with its ABI link, every chapter with its summary |
| Full docs | /llms-full.txt | Every chapter of these docs as plain text, in reading order |
| Deployment manifest | /deployments/elysium.json | Chain id, deploy block, every Elyra contract, the seed vaults by name |
| Chain constants | /deployments/elysium-external.json | Uniswap v3 and v4, Permit2, Universal Router, WHYPE, USDC, the EQX stock tokens and Elyra's price feeds, Multicall3 |
| ABIs | /abi/index.json, /abi/<Name>.json | One JSON ABI per Elyra contract, and which address uses which |
All of them are generated from the same manifest and ABIs the app itself uses, at build time. The sources are verified on the Elysium explorer. The addresses this site was built with:
Chain 99901, deployed from block 13,736,511. Each address opens on the explorer. $ELYRA has not launched yet, so it has no address here.
The loop
- 01ReadAddresses from the manifest, ABIs from
/abi, and the state you need from view calls:previewDeposit,maxDeposit,paused, a pool'sslot0,Router.quoteExactIn. - 02BuildEncode the call:
to,data,valueand chain id 99901. Set every minimum and deadline the function takes; the next sections say which. - 03CheckThe
tomust be in the manifest or the chain constants, and an approval's spender must be the contract the next call goes to. Anything else is a mistake or an attack. - 04SimulateAn
eth_callfrom your own address, or oneeth_simulateV1request for an approval and the call that follows it. A revert here costs nothing. - 05Sign and sendWith the agent's own key, through any RPC. Wait for the receipt before the next step.
- 06ConfirmRead the receipt's events (
Swapped,ZapMint,Deposit) rather than trusting the simulation's numbers.
What an agent can call
| Goal | Call | Approval first | Bound you set |
|---|---|---|---|
| Swap | Router.swapExactIn(hops, amountIn, minAmountOut, to, deadline) | The exact amountIn of the token to the Router. HYPE goes as msg.value equal to amountIn, with no approval | minAmountOut, deadline |
| Unwrap WHYPE | WHYPE.withdraw(amount) | None | - |
| One-token liquidity, Uniswap v3 | ElyraZapV3.zapMint(params), or zapIncrease for a position you own | The exact amountIn to the zap | minLiquidity, maxSlippageBps (at most 5 000), deadline |
| One-token liquidity, Uniswap v4 and Elyra pools | ElyraZapV4.zapMint(params) | The exact amountIn to the zap, which holds its own Permit2 allowances | Same as v3 |
| Remove v3 liquidity | Uniswap's NonfungiblePositionManager.decreaseLiquidity, then collect (or both in one multicall) | None: you own the position NFT | amount0Min, amount1Min, deadline |
| Deposit into an LP, hedged or structured vault | deposit(assets, receiver) (ERC-4626) | The exact assets to the vault | None on chain: read previewDeposit and maxDeposit first |
| Withdraw from those vaults | redeem(shares, receiver, owner) | None | None on chain: read previewRedeem and maxRedeem first |
| DLMM vault | DlmmVaultZap.zapIn(params), zapOut(params) | The input token to the zap; for zapOut, the vault shares to the zap | minSwapOut and minShares, or minOut; deadline |
| Stock vault | StockVault.deposit(amount0Max, amount1Max, minShares, to, deadline), withdraw(shares, to, amount0Min, amount1Min, deadline) | Both tokens to the vault | minShares, the two minimums, deadline |
Routes through the Router
A route is up to three swap hops, each a Hop of a kind and its ABI-encoded data. The Router checks that the hops chain token to token (routeTokens) and treats HYPE and WHYPE as the same token.
kind | Hop | data |
|---|---|---|
| 0 | A Uniswap v4 pool, Elyra's DAMM and stock pools included | abi.encode(PoolKey, bool zeroForOne, bytes hookData) |
| 1 | An Elyra DLMM pair | abi.encode(address pair, bool swapForY) |
| 3 | Wrap HYPE to WHYPE or unwrap WHYPE to HYPE; does not count toward the three | empty |
Quote a route with quoteExactIn(hops, amountIn) through eth_call. It is not a view function: it runs each v4 hop and reverts with the result, so it costs nothing as a call and must never be sent as a transaction. Elyra's pools are listed under Elyra pools and how the app picks a route under Swaps and routing.
The rules
- Exact approvals. Approve the amount of this one call, to the contract that pulls it, never
type(uint256).max. When a token already has a different non-zero allowance, set it to 0 first: some tokens refuse a change from one non-zero value to another. This is what the app does (apps/web/lib/trade/approvals.ts). - A real minimum. The zaps'
maxSlippageBpsis measured against the pool price inside the same transaction, so a price moved before yours moves that bound with it.minLiquidityis the only bound fixed when you sign: derive it frompreviewZapat a price you trust, less your slippage. The same goes forminAmountOutfrom a fresh quote. See One-token deposits. - Short deadlines. Minutes, where a function takes one. ERC-4626
depositandredeemtake none, so a signed vault transaction stays valid until it is mined: send it at once, never hold it. - Vault decimals. LP, hedged and structured vault shares carry 3 more decimals than their asset (OpenZeppelin virtual shares). Read the vault's own
decimals(), never the asset's. USDC has 6 decimals and EQX stock tokens have 8. - Vaults can say no. Deposits and withdrawals revert while the pool's spot price is more than 3 % from its 30-minute average (
TwapGuard). A hedged vault pauses both when its last hedge report is over an hour old or its equity jumped more than 15 %; readpaused(). A vault with a cap reports what it still takes inmaxDeposit. See Vaults and Hedged vaults. - Check every address. Before signing, the
toof the transaction and the spender of every approval must appear in/deployments/elysium.jsonor/deployments/elysium-external.json. Many tokens on Elysium carry stock names; only the EQX addresses in the chain constants are the ones Elyra lists. - Time is a timestamp. On Elysium,
block.numberinside a contract returns the HyperEVM block number. Every deadline Elyra takes is in unix seconds.
Simulating a sequence
Most actions are two transactions: an approval, then the call that uses it. A plain eth_call of the second fails until the first is mined. eth_simulateV1 runs calls in order inside one simulated block, so the second sees the first. Check that the RPC you use answers it; on a local fork, anvil does.
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_simulateV1",
"params": [
{
"blockStateCalls": [
{
"calls": [
{ "from": "<agent>", "to": "<USDC>", "data": "<approve(vault, amount)>" },
{ "from": "<agent>", "to": "<USDC vault>", "data": "<deposit(amount, agent)>" }
]
}
],
"validation": false
},
"latest"
]
}
Each call comes back with a status, its returnData and gasUsed. A status of 0x1 on both means the pair would succeed against the current block. Simulate again right before you send: the chain moves.
Agent starter kit
A runnable example to start from: the agent starter kit, plain TypeScript with viem as its only dependency, served from this site. It runs the loop above end to end. It reads /llms.txt and the two deployment files and stops if they disagree about an address. It quotes native HYPE for USDC with Router.quoteExactIn, then plans a deposit of the swap's minimum output into a USDC vault from the manifest: the swap with a minimum and a deadline, an exact approval, and the deposit. It checks every to against the deployment files and simulates the three calls in one eth_simulateV1 request. It signs and sends only with --send, one transaction at a time, with its own key.
It runs against a local fork by default. On a fork with no key set, it makes a throwaway key and funds it, so there is nothing else to set up. Set SITE to the address of this site first:
mkdir elyra-agent-quickstart && cd elyra-agent-quickstart
for f in README.md quickstart.ts elyra.ts elyra.test.ts package.json tsconfig.json; do
curl -fsSO "$SITE/examples/agent-quickstart/$f"
done
npm install
anvil --fork-url https://rpc.elysium.kinetiq.xyz --chain-id 99901 --port 8549 # Foundry, in another terminal
ELYRA_SITE="$SITE" RPC_URL=http://127.0.0.1:8549 npm start # read, quote, plan and simulate
ELYRA_SITE="$SITE" RPC_URL=http://127.0.0.1:8549 npm run send # and send it, on the fork
On Elysium itself it needs the agent wallet's own key in its environment, and --mainnet as well as --send. The README lists the variables and what to change first.
Referrals for agent builders
An agent built for other people can earn from their activity without touching their funds. Register a code once with ReferralRegistry.register(bytes8 code). A user who calls bind(code) is tied to you for life, and 20 % of every protocol fee their activity pays goes to you, through FeeRouter. The share comes out of the protocol fee, not out of the user's trade. A binding can never be changed, so never bind a user who has not asked for it. See Fees and referrals.
Reading data
The chain is the source of truth, and everything an agent needs before it signs is a view call: vault previews and limits, pool prices, Router.quoteExactIn, ElyraZapV3.previewZap, token balances and allowances. Multicall3 (in the chain constants) batches them.
The app's own API serves ranked markets, vault and pool lists and a portfolio by address; its routes are listed in Indexer, API and bots. Treat them as beta: they are unversioned and follow what the app needs.
Rate limits
- The files on this site (
/llms.txt,/llms-full.txt,/deployments/*.json,/abi/*.jsonand the starter kit) are static: built once per release and cached for five minutes. Read them when the agent starts, not on every call. - The app's API answers reads without a limit, from caches it refreshes every 15 seconds (pools, the market list) or 30 seconds (vaults, launches), so polling faster gains nothing. Its writes are limited to 30 a minute per route group and IP address, and the contact form to 5 a minute. Past a limit it answers
429with{ error, code: "rate_limited" }and aRetry-Afterheader in seconds. - The chain. The public RPC,
https://rpc.elysium.kinetiq.xyz, keeps full history but rate-limits parallel calls, has no WebSocket and stopseth_getLogsat 10,000 results. Batch view calls with Multicall3, slow down on a429, and give an agent that reads a lot an RPC of its own.
Not for agents, for now
- Perps. A Hyperliquid order through Elyra is signed by the signer's agent wallet for a person using the app. An agent opens its own Hyperliquid account and trades through Hyperliquid's API with its own key or its own agent wallet. See Perpetuals.
- Keeper enrolment.
PositionKeeperneedssetApprovalForAllon the position manager, which covers every position the wallet holds. See Position automation. - Launches and range orders. App flows with their own rules; read Launch a token and Limit orders before calling those contracts.
Coming next
- An MCP server. A hosted tool server, over MCP and plain JSON, whose read tools answer market, vault, pool and portfolio questions and whose build tools return the transactions above as unsigned, simulated plans for your agent to sign. It will keep every rule on this page, and its address will appear in
/llms.txtwhen it is live. - Perps for agents. Until they are live, perps stay an app flow: see Not for agents, for now.
- RouterswapExactIn, quoteExactIn, routeTokens and the hop kinds
- DlmmVaultZapzapIn and zapOut with their minimums
Elyra