Documentation
Quotes
Request executable quotes from the Manager. On-chain quote functions already apply the protocol trade fee.
Use quoteBuyFair when you need tokens out plus fee and net ETH. Use quoteBuy for tokens out only. quoteSell returns net ETH out after the fee.
Do not deduct the 125 bps (1.25%) trade fee again off-chain.
Functions
quoteBuyviewquoteBuy(address token, uint256 ethIn) view returns (uint256)ethIn is gross ETH in wei. Returns expected tokens out (raw, 6 decimals).
quoteBuyFairviewquoteBuyFair(address token, uint256 ethInGross) view returns (uint256 tokensOut, uint256 feeEth, uint256 netEth, uint256 grossEth)Same fee math as buy(). Near the sellable cap, grossEth may be less than ethInGross; unused ETH is refunded on buy.
quoteSellviewquoteSell(address token, uint256 tokenIn) view returns (uint256)tokenIn is the raw token amount (6 decimals). Returns net ETH out in wei after the trade fee.
Example
viemts
import {
createPublicClient,
createWalletClient,
http,
parseAbi,
parseAbiItem,
zeroAddress,
type Address,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
/** Arklis BondingCurveManager — Robinhood Chain (4663) */
export const MANAGER = "0x8c0CB9498fE0dCC9F5405e99A17C01579c7C6066" as const;
export const CHAIN_ID = 4663 as const;
export const FEE_BPS_TOTAL = 125n;
export const BPS_DENOM = 10000n;
export const TOKEN_DECIMALS = 6;
const rpcUrl = process.env.RPC_URL!;
export const publicClient = createPublicClient({
chain: {
id: CHAIN_ID,
name: "Robinhood Chain",
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
rpcUrls: { default: { http: [rpcUrl] } },
},
transport: http(rpcUrl),
});
export const managerAbi = parseAbi([
"function quoteBuy(address token, uint256 ethIn) view returns (uint256)",
"function quoteBuyFair(address token, uint256 ethInGross) view returns (uint256 tokensOut, uint256 feeEth, uint256 netEth, uint256 grossEth)",
"function quoteSell(address token, uint256 tokenIn) view returns (uint256)",
"function buy(address token, uint256 minTokensOut, address calloutAnnouncer) payable returns (uint256 tokensOut)",
"function sell(address token, uint256 tokenAmount, uint256 minEthOut, address calloutAnnouncer) returns (uint256 ethOut)",
"function sellWithPermit(address token, uint256 tokenAmount, uint256 minEthOut, address calloutAnnouncer, uint256 deadline, uint8 v, bytes32 r, bytes32 s) returns (uint256 ethOut)",
"event TokenCreated(address indexed token, address indexed creator, string name, string symbol, string uri, uint256 virtualEth, uint256 virtualToken)",
"event Trade(address indexed token, address indexed trader, bool indexed isBuy, uint256 ethAmount, uint256 tokenAmount, uint256 feeEth, uint256 reserveEth, uint256 soldTokens, uint256 spotPriceWei)",
"event CurveCompleted(address indexed token)",
]);
/** On-chain quotes already include the 125 bps trade fee. */
export async function quoteBuy(token: Address, ethInGrossWei: bigint) {
const [tokensOut, feeEth, netEth, grossEth] = await publicClient.readContract({
address: MANAGER,
abi: managerAbi,
functionName: "quoteBuyFair",
args: [token, ethInGrossWei],
});
return { tokensOut, feeEth, netEth, grossEth };
}
export async function quoteSell(token: Address, tokenInRaw: bigint) {
return publicClient.readContract({
address: MANAGER,
abi: managerAbi,
functionName: "quoteSell",
args: [token, tokenInRaw],
});
}Coming soon