⇄ GLD/USD AMM
—
Pool GLD—
Pool USD—
Price—
LP supply—

Swap

GLD/USD · 0.3%
You pay
GLD
balance: —
You receive
USD
Rate—
Price impact—
Min received—

Liquidity

share preview: —

My position

LP balance: —

Pool share: —

Underlying: —

Pool composition

— —

pair: —

Pool activity

Loading…

showing the latest events

📘 How this dApp works

GLD/USD · Sepolia · 0.3% fee

How to use

1. Press Connect Wallet (top-right) and switch your wallet to Sepolia — the chain badge next to it turns green when the network matches (the ⚙ Settings panel can switch chains too).

2. Fund your wallet with Sepolia ETH for gas and test GLD/USD; the Swap card shows your balance with a MAX button.

3. Swap: type an amount under “You pay” — the “You receive” quote, rate, price impact and min received fill in live — then press Swap and confirm in your wallet.

4. Provide liquidity: on the Add tab enter GLD and USD, check the share preview, and press Add liquidity to receive LP tokens.

5. Exit and follow: on the Remove tab enter LP tokens (MAX) and press Remove liquidity; track your share in My position and every trade in Pool activity.

The process — what happens on-chain

1. You only ever talk to the AMMRouter contract. It prices your trade with the pure math of AMMLibrary — getAmountOut on the constant-product curve, 0.3% fee included.

2. After your approval, the router pulls the input tokens from your wallet with transferFrom into the AMMPair pool, which holds both reserves.

3. AMMPair.swap pays out your tokens, then re-checks the invariant: with the 0.3% fee left in the pool, x·y must not shrink — otherwise the whole transaction reverts (K()) and you keep your tokens.

4. For liquidity, AMMRouter.addLiquidity looks the pair up in AMMFactory (creating it with createPair if missing) and AMMPair.mint issues your ERC20 LP tokens; removeLiquidity + burn return your pro-rata share of both reserves, fees included.

5. Every step updates the reserves and emits Swap / Mint / Burn / Sync events — the KPI row and the Pool activity feed decode exactly these logs.

Flow graph

One Swap click → five on-chain stages, executed in a single transaction 1 · Approve tokens ERC20 (GLD/USD) 2 · Router quotes AMMRouter + AMMLibrary 3 · Pool swap AMMPair.swap 4 · Invariant check AMMPair (x·y = k) 5 · Tokens received ERC20 → your wallet on-chain action token flow Sepolia · 0.3% fee