On this page
Buy and sell
Omnipad v2 trades on Robinhood through its Router and pinned Pons adapter. The adapter handles supported bonding-curve and graduated-pool execution. The initial curve is not necessarily the final pool, and a token must be registered with the adapter before trading.
Quote a trade
Request POST https://api.omnisea.io/omnipad/4663/{token}/quote:
{"account":"0xYOUR_WALLET","side":"buy","amount":"1000000000000000"}amount is an integer string: native wei for buys, token base units for sells. It must be positive and less than 2^127. Read token decimals instead of assuming 18. The response includes amountOut, fee, value, deadline, router and platform. Large integers are decimal strings; deadline is Unix seconds, currently two minutes from quotation.
Quotes simulate execution and can fail if the wallet lacks funds. Sell quotes simulate approval read-only; they do not create an allowance. Debounce changing inputs and discard responses for older amounts, wallets, sides or tokens.
Payment and approval
function trade(bytes32 platform, address token, bool buy, uint128 amountIn,
uint256 minimumOut, uint128 maximumProtocolFee, uint64 deadline)
external payable returns (uint256 amountOut);The Pons platform ID is keccak256(bytes("pons")). The Router is 0x7d8c90Ca9A28D041e07824D1209d6Abc3178C0F7 on chain 4663. Download the Router ABI.
- Buy:
msg.value = amountIn + flatFee(). - Sell:
msg.value = flatFee(). The fee is not deducted from sale proceeds. Approve the Router, not the adapter, for the input token. - Outputs and unused input return to
msg.sender. Contract callers must forward these to their users.
Example: quote, protect, simulate, send
This ethers v6 example receives a signer connected to Robinhood, the downloaded ABI, a token and a bigint amount in base units. Supply your application's types when using TypeScript.
import { Contract, id } from "ethers";
async function trade(signer, routerAbi, token, amount, side) {
if (Number((await signer.provider.getNetwork()).chainId) !== 4663) throw Error("Switch to Robinhood");
if (side !== "buy" && side !== "sell") throw Error("Invalid side");
const routerAddress = "0x7d8c90Ca9A28D041e07824D1209d6Abc3178C0F7";
const router = new Contract(routerAddress, routerAbi, signer);
const account = await signer.getAddress();
const buy = side === "buy";
if (!buy) {
const erc20 = new Contract(token, [
"function allowance(address,address) view returns(uint256)",
"function approve(address,uint256) returns(bool)",
], signer);
if (await erc20.allowance(account, routerAddress) < amount) {
const approved = await (await erc20.approve(routerAddress, amount)).wait();
if (!approved || approved.status !== 1) throw Error("Approval failed");
}
}
const response = await fetch(`https://api.omnisea.io/omnipad/4663/${token}/quote`, {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ account, side, amount: amount.toString() }),
});
if (!response.ok) throw Error(await response.text());
const q = await response.json();
const platform = id("pons");
if (q.router.toLowerCase() !== routerAddress.toLowerCase() || q.platform !== platform) throw Error("Unexpected route");
const fee = await router.flatFee();
if (fee !== BigInt(q.fee)) throw Error("Re-quote fee");
const slippageBps = 100n; // Example 1%; require a user-selected tolerance.
const minimumOut = BigInt(q.amountOut) * (10000n - slippageBps) / 10000n;
const deadline = BigInt(q.deadline);
if (minimumOut === 0n || deadline <= BigInt(Math.floor(Date.now()/1000))) throw Error("Invalid quote");
const value = fee + (buy ? amount : 0n);
if (value !== BigInt(q.value)) throw Error("Unexpected payment");
const args = [platform, token, buy, amount, minimumOut, fee, deadline];
await router.trade.staticCall(...args, { value });
return (await router.trade(...args, { value })).wait();
}The quote simulator internally uses minimumOut = 1; that is not a safe user slippage limit. Compute a meaningful minimum as above. Refresh after approval, wallet/network changes or quote expiry. Simulation does not guarantee future price or inclusion.
Cross-chain funding is separate
The Router has no cross-chain buy or sell entrypoint. Use Omnigas to fund the user's Robinhood wallet, wait for delivery, then trade locally. Do not target this Router directly from an Omnigas hook: outputs would go to Omnigas as the caller. Bridge-and-buy needs a separate adapter that forwards outputs explicitly.