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.
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
Connect & Switch to Sepolia
Configure Swap
Swap quote (simulated)
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.
Approve Router
Before swapping, the DEX router must be approved to spend your tokens. This triggers a real approve() call on Sepolia.
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.
Execute Swap
SimulatedNo 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.
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.