Pick a real mainnet transaction from the last 7 days that calls a contract you don't recognize. Produce a step-by-step annotated trace: every state-changing opcode, gas consumption per phase, storage slots touched, and a one-paragraph explanation of what the contract is doing. Conclude with 3 specific gas-optimization observations.
Use either cast run (Foundry), debug_traceTransaction directly, or Tenderly to obtain the trace. Tenderly's UI is the friendliest for first-time tracing.
For unverified contracts, decompile the bytecode with Dedaub or evm.codes Playground to make the trace readable.
Look for surprising gas costs first — they almost always point to an SSTORE on a cold storage slot or an expensive LOG operation.
Tx: 0xabc...def
Block: 19,123,456 | Gas used: 142,371 / 200,000
Top-level call:
CALL UniswapV3Router.exactInputSingle(...) Gas: 142k
Subcall 1: CALL WETH9.transferFrom(user, router, 1e18) Gas: 51,200
- SLOAD allowances[user][router]: 2,100 (cold)
- SSTORE allowances[user][router] -= amount: 5,000 (update)
- SLOAD balances[user]: 2,100 (cold)
- SSTORE balances[user] -= amount: 5,000
- SSTORE balances[router] += amount: 22,100 (new slot)
- LOG3 Transfer: 1,800
...
Optimization observations: