DOCUMENTATION
How FLUIDEX works
FLUIDEX is an automated market maker (AMM) liquidity protocol on Robinhood Chain. This page explains how the application works end to end: how swaps are priced, how liquidity pools operate, how market data is computed, and how the smart contracts fit together.
System overview
The protocol is built from four smart contracts working together:
- FluidexToken (FLUIDEX) — the protocol's ERC-20 token. It is the primary asset traded against USDG.
- FluidexFactory — the registry that creates and tracks trading pairs. Given two token addresses, it deploys (or returns) the pair contract that holds their liquidity.
- FluidexPair — the pool contract itself. It holds reserves of two tokens and enforces the pricing formula for every trade.
- FluidexRouter — the user-facing entry point. All swaps and liquidity operations go through the Router, which calculates amounts and moves tokens safely on your behalf.
The web application never holds your funds. It reads pool state directly from Robinhood Chain (chain ID 4663) and sends transactions from your connected wallet to the Router.
How a swap works
Each pool prices trades with the constant-product formula x · y = k, where x and y are the reserves of the two tokens and k must not decrease:
- You enter an amount of one token (for example USDG) in the Trade panel.
- The app quotes the output using the pool's current reserves, minus the protocol fee configured in the Factory (
feeBps). - On first use, your wallet asks you to approve the Router to spend your token.
- The Router's
swapExactTokensForTokensfunction pulls your input, sends it to the Pair, and the Pair pays out the other token. - Because the reserves change, the price moves with every trade — larger trades move the price more (slippage). The app shows the quoted rate before you confirm.
Providing liquidity
Anyone can become a liquidity provider (LP) by depositing both tokens in equal value:
- Approve both tokens, then call the Router's
addLiquiditywith your desired amounts. - If the pair does not exist yet, the Router asks the Factory to create it automatically.
- The Pair mints LP tokens to your wallet, proportional to your share of the pool.
- Trading fees accumulate inside the pool, so your share of the reserves grows over time.
- To exit, call
removeLiquidity: your LP tokens are burned and you receive your share of both tokens back.
Providing liquidity carries impermanent-loss risk: if the relative price of the two tokens moves, your withdrawn value can differ from simply holding the tokens.
Market data & oracle computing
The interface computes market metrics from onchain state rather than trusting a single price source:
- Price — derived from the ratio of the pair's reserves (
getReserves). - Liquidity / TVL — the combined value of both sides of the pool.
- Pair discovery — the app asks the Factory (
getPair) which pool serves a token pair, so it always reads the canonical pool. - Balances — read directly from each token contract for the connected wallet.
Until the token address is configured and a pool is funded, the interface runs in simulation mode and all metrics are marked as demonstration data.
Deployed contracts
Protocol contracts live on Robinhood Chain. Verify them on the block explorer:
Safety notes
- Always verify contract addresses on the explorer before approving tokens.
- Approvals grant the Router permission to move a token; you can revoke them at any time from your wallet.
- Quoted swap amounts are estimates — the executed amount depends on pool state at confirmation time.
Ready to trade? Open the app and connect your wallet.
