Build on Robin.
Launch and trade onchain.
Production contract addresses, canonical call surfaces, event layouts, and viem integration patterns for launching Robin tokens and executing BUY and SELL transactions.
Getting Started
The shortest path from a Node.js script to Robin mainnet.
Use Robinhood Chain Mainnet with chain ID 4663.
Read quotes, fees, contract relationships, and live market state directly onchain.
Simulate first, then submit the exact request that passed simulation.
npm install viem
Network & Contracts
Canonical Robin production addresses on Robinhood Chain Mainnet.
Curve Templates
Template IDs are fixed protocol inputs selected when a token is created.
Token Metadata
Structured metadata consumed by the Robin token creation path.
type TokenMetadata = {
description: string;
imageURI: string;
website: string;
twitter: string;
telegram: string;
};
// UTF-8 byte limits
// name: 1-64
// symbol: 1-10
// description: max 500
// imageURI: max 2048
// website: max 512
// twitter: max 512
// telegram: max 512Create a Token
Create a Robin token and its isolated permanent market in one Factory transaction.
createToken( string name, string symbol, TokenMetadata metadata, uint8 templateId, bytes32 userSalt ) payable returns ( address token, address market )
RobinConfig.createFeeWei(). Do not hard-code the creation fee in production integrations.Create + Buy
Create a token and execute its first BUY atomically.
createAndBuy( string name, string symbol, TokenMetadata metadata, uint8 templateId, bytes32 userSalt, uint256 minTokensOutRaw, address tokenRecipient, address refundRecipient, uint256 deadline ) payable returns ( address token, address market, uint256 tokensOutRaw, uint256 grossUsedWei, uint256 refundWei )
msg.value is the live creation fee plus the initial BUY gross input. The Robin production UI currently uses 1.00% slippage protection and a 10-minute Create + Buy deadline.Discover Token & Market
Use Factory state and confirmed events as canonical launch discovery surfaces.
marketOfToken(token) -> market tokenOfMarket(market) -> token isRobinToken(token) -> bool isRobinMarket(market) -> bool launchCount() -> uint256 launchAt(index) -> (token, market) predictTokenAddress( creator, userSalt, name, symbol ) -> token
TokenCreated event for the final token and market addresses.Read Market State
Quote trades and inspect curve state without changing chain state.
quoteBuy(uint256 grossInputWei) -> BuyQuote quoteSell(uint256 tokenInRaw) -> SellQuote virtualEthWei() tokensSoldRaw() accountedReserveWei() reserveAt(uint256 qRaw) maxQRaw() remainingCurveInventoryRaw()
BuyQuote {
qBeforeRaw
qAfterRaw
tokensOutRaw
grossInputWei
grossUsedWei
curveCostWei
protocolFeeWei
creatorFeeWei
totalFeeWei
refundWei
}
SellQuote {
qBeforeRaw
qAfterRaw
tokenInRaw
grossRefundWei
protocolFeeWei
creatorFeeWei
totalFeeWei
netETHOutWei
}Buy Tokens
Quote immediately before the write and protect the trade with minTokensOutRaw.
buy( uint256 minTokensOutRaw, address tokenRecipient, address refundRecipient, uint256 deadline ) payable returns ( uint256 tokensOutRaw, uint256 grossUsedWei, uint256 refundWei )
const quote =
await publicClient.readContract({
address: market,
abi: marketAbi,
functionName: "quoteBuy",
args: [grossInputWei],
});
const minTokensOutRaw =
quote.tokensOutRaw * 9900n / 10000n;
const simulation =
await publicClient.simulateContract({
address: market,
abi: marketAbi,
functionName: "buy",
account,
args: [
minTokensOutRaw,
account,
account,
deadline,
],
value: grossInputWei,
});
const hash =
await walletClient.writeContract(
simulation.request,
);Sell Tokens
Approve the exact RobinMarket when required, then re-quote immediately before SELL.
sell( uint256 tokenInRaw, uint256 minETHOutWei, address ethRecipient, uint256 deadline ) returns ( uint256 netETHOutWei )
const allowance =
await publicClient.readContract({
address: token,
abi: tokenAbi,
functionName: "allowance",
args: [
account,
market,
],
});
if (allowance < tokenInRaw) {
const approvalSimulation =
await publicClient.simulateContract({
address: token,
abi: tokenAbi,
functionName: "approve",
account,
args: [
market,
(1n << 256n) - 1n,
],
});
const approvalHash =
await walletClient.writeContract(
approvalSimulation.request,
);
await publicClient.waitForTransactionReceipt({
hash: approvalHash,
});
}
const quote =
await publicClient.readContract({
address: market,
abi: marketAbi,
functionName: "quoteSell",
args: [tokenInRaw],
});
const minETHOutWei =
quote.netETHOutWei * 9900n / 10000n;
const simulation =
await publicClient.simulateContract({
address: market,
abi: marketAbi,
functionName: "sell",
account,
args: [
tokenInRaw,
minETHOutWei,
account,
deadline,
],
});
const hash =
await walletClient.writeContract(
simulation.request,
); transferFrom(). Approval must target the exact canonical market for the token.Events
Canonical event surfaces for launches, trades, and token transfers.
TokenCreated( indexed token, indexed market, indexed creator, launchId, templateId, virtualEthWei, name, symbol, metadataHash, effectiveSalt ) Buy( indexed buyer, indexed tokenRecipient, indexed refundRecipient, qBeforeRaw, qAfterRaw, tokenOutRaw, grossInputWei, grossUsedWei, curveCostWei, protocolFeeWei, creatorFeeWei, refundWei ) Sell( indexed seller, indexed ethRecipient, qBeforeRaw, qAfterRaw, tokenInRaw, grossRefundWei, protocolFeeWei, creatorFeeWei, netETHOutWei ) Transfer( indexed from, indexed to, value ) Approval( indexed owner, indexed spender, value )
Fees & Configuration
Current production values and runtime configuration surfaces.
createEnabled() createFeeWei() protocolFeeBps() creatorFeeBps() protocolTreasury() configChangeDelay() pendingTradingFees() pendingCreateFee() pendingEnableCreation() pendingProtocolTreasury()
Complete viem Examples
A production-oriented integration pattern for Robinhood Chain Mainnet.
import {
createPublicClient,
createWalletClient,
defineChain,
http,
} from "viem";
const robinhoodChain =
defineChain({
id: 4663,
name: "Robinhood Chain",
nativeCurrency: {
name: "Ether",
symbol: "ETH",
decimals: 18,
},
rpcUrls: {
default: {
http: [
"https://rpc.mainnet.chain.robinhood.com",
],
},
},
blockExplorers: {
default: {
name: "Explorer",
url:
"https://robinhoodchain.blockscout.com",
},
},
});
const publicClient =
createPublicClient({
chain: robinhoodChain,
transport: http(),
});
const factory =
"0x9297877b5E67F7d6A2bE7A3C0AfcdF6c940Cd719";
// Recommended write flow:
//
// 1. Read current protocol state.
// 2. Read a fresh quote.
// 3. Compute slippage protection.
// 4. simulateContract(...).
// 5. writeContract(simulation.request).
// 6. Wait for the receipt.
// 7. Parse confirmed event logs.ABI Reference
The most important callable surfaces for third-party integrations.
createToken, createAndBuy, TokenCreated, marketOfToken, tokenOfMarket, predictTokenAddress, launchCount, launchAt
quoteBuy, quoteSell, buy, sell, tokensSoldRaw, virtualEthWei, accountedReserveWei, remainingCurveInventoryRaw, Buy, Sell
balanceOf, allowance, approve, transfer, transferFrom, tokenMetadata, metadataURI, creator, market
Errors & Safety
Fail closed around stale quotes, wrong markets, expired deadlines, and invalid metadata.
Submit the exact request that passed simulation instead of rebuilding a different request.
SELL allowance should target the canonical market returned by RobinFactory for that token.
Quotes can become stale while a wallet is open or while an approval transaction confirms.
Protect transactions from being mined after the intended execution window.
For permanent curve behavior, virtual ETH, protocol design, fees, and security assumptions, continue to the main Robin documentation.
Open Docs