Web3 QA Hub

Swap & Staking Simulation Lab

Walk through a token swap (approve + execute) and a staking lifecycle (stake → earn → unstake). Real balance reads on Sepolia; swap and stake steps are simulated.

intermediateSepolia

Learning Objectives

  • Read live token balance and simulate a swap quote with slippage tolerance
  • Approve a router contract via a real on-chain call
  • Observe the full swap state machine: pending → confirming → success
  • Configure a staking position with lock duration and projected APY
  • Walk through the stake → rewards → unstake lifecycle and its QA checklist
1

Connect & Switch to Sepolia

2

Configure Swap

Your LINK balanceConnect wallet
Simulated rate1 LINK ≈ 2.84 MockUSD

Swap quote (simulated)

You pay0.5 LINK
You receive ~1.4200 MockUSD
Min. received1.4129 MockUSD
Price impact0.12%
QA

Verify: balance ≥ swap amount, slippage is within acceptable range (<1% for most cases), price impact is not unusually high. A real DEX quote can change between blocks — QA should test stale-quote and frontrun scenarios.

3

Approve Router

Before swapping, the DEX router must be approved to spend your tokens. This triggers a real approve() call on Sepolia.

Estimated gas (approve)Connect wallet + fill amount
QA

QA check: verify the Approval event was emitted with the correct spender and amount. Try approving 0 first (reset allowance), then the target amount — some tokens reject non-zero → non-zero approvals.

4

Execute Swap

Simulated

No real DEX contract is deployed on this testnet. The button below simulates the swap state machine so you can observe the full QA flow: pending → confirming → success.

QA

Real swap QA checklist: (1) token balance decreased by exact swap amount, (2) output token balance increased by ≥ minReceived, (3) Swap event emitted with correct amounts, (4) deadline not exceeded, (5) slippage-exceeded path returns tokens and emits no Swap event.