IV · BUILD
Every pool is a building block
Quote, route and swap from your own app or contract.
TYPESCRIPT (VIEM)
// best route across Stoa pools, Uniswap, Aero, Ramses and Liquidity Book, direct or via WHYPE
const { result: route } = await client.simulateContract({
address: ROUTER, abi: routerAbi,
functionName: 'quote',
args: [USDC, WHYPE, 250_000_000n],
})
// route.amountOut, route.mid, route.leg1, route.leg2
// then: writeContract({ functionName: 'swap', args: [{ ...route, ... }] })SOLIDITY
// 1. off-chain: route = router.quote(USDC, WHYPE, 250e6) (eth_call)
// 2. on-chain: follow the route with your limits
IStoaRouter.SwapParams memory p = IStoaRouter.SwapParams({
tokenIn: USDC, tokenOut: WHYPE, // address(0) = native HYPE
mid: route.mid, // zero for a direct swap
leg1: route.leg1, leg2: route.leg2, // allowlisted venues only
amountIn: 250e6,
minOut: route.amountOut * 995 / 1000, // 0.5% slippage
to: msg.sender, deadline: block.timestamp + 60,
referrer: address(0)
});
IStoaRouter(router).swap(p);Router and SDK docsELYSIUM NETWORK
- Chain ID 99901
- WHYPE
0xbA87…5E81 - USDC
0xb47c…0B65 - Permit2
0x0000…8BA3
STOA CONTRACTS
- StoaRouter
0x1047…7dbA - StoaPool (WHYPE/USDC)
0x7800…400a - FeeDistributor
0x19C1…aD1e

