DeFi Operator Path
Stage 1 of 7
On This Page
PART 1: What Happens When You Click “Swap”?
PART 2: Gas Mechanics
PART 3: Router Contracts
PART 4: Swap Fees
PART 5: Confirmations
PART 6: Trade Impact (Slippage)
PART 7: Expected Output
PART 8: Why Trades Fail
PART 9: Real Execution Risks
Putting It All Together
Key Takeaways
• Every transaction is an on-chain instruction
• Gas is unavoidable and varies by chain
• Router contracts execute your trades
• Slippage and liquidity affect outcomes
• Expected output is not guaranteed
• Execution mistakes = real losses
Lesson
1.2
Basic Mechanics
What You’ll Learn
• How gas works (and why it matters)
• What router contracts do
• How swaps are executed
• How to estimate trade outcomes (before confirming)
This lesson teaches you what actually happens when you click “Swap”
PART 1: What Happens When You Click “Swap”?
Behind the scenes:
You submit a transaction
It goes to the blockchain
A smart contract executes it
You receive tokens
Key Insight:
You are not trading “instantly” You are sending instructions to the blockchain
PART 2: Gas Mechanics
What is Gas?
Gas = the fee you pay to execute a transaction
On Ethereum:
Gas can be expensive
Depends on network congestion
On EVM chains (like Arbitrum, Avalanche):
Gas is cheaper
Faster confirmations
Why Gas Exists:
Pays validators
Prevents spam
Secures the network
Key Insight:
Gas is not optional Every action = cost
Important Components:
Gas Price
Cost per unit
Gas Limit
Max gas you’re willing to use
Operator Rule:
Always leave enough gas tokens in your wallet
PART 3: Router Contracts
What is a Router?
A smart contract that executes your trade
Example:
Using Uniswap:
You don’t trade with another person
You interact with a router contract
What the Router Does:
🔹 Finds liquidity pool
🔹 Calculates price
🔹 Executes swap
Key Insight:
You are interacting with code—not a human
PART 4: Swap Fees
Types of Costs:
🔹 Gas fee (network)
🔹 Swap fee (DEX)
Example:
Uniswap fee: ~0.3%
Gas: varies
Key Insight:
Your total cost = gas + swap fee + slippage
PART 5: Confirmations
What is Confirmation?
When the network finalizes your transaction
Depends on:
Chain speed
Network congestion
Key Insight:
Until confirmed, your trade is NOT final
PART 6: Trade Impact (Slippage)
What is Trade Impact?
How much your trade moves the price
Example:
Small pool + big trade 👉 price moves against you
Key Insight:
You are part of the market—you move it
Slippage:
Difference between expected and executed price
Operator Rule:
Always check slippage before confirming
PART 7: Expected Output
Before confirming a trade, you’ll see:
🔹 Tokens you receive
🔹 Minimum received
🔹 Price impact
Critical:
“Minimum received” protects you from bad execution
Example:
Expected: 100 tokens
Minimum: 95 tokens
👉 If worse → trade fails
PART 8: Why Trades Fail
❌ Not enough gas
❌ Slippage too low
❌ Price moved too fast
Key Insight:
Failed trades still cost gas
PART 9: Real Execution Risks
Hidden realities:
Price changes during confirmation
MEV bots (front-running)
Low liquidity traps
Key Insight:
The price you see is not guaranteed
PART 10: Ethereum vs EVM Chains (Practical View)
Ethereum:
Expensive
Reliable
Deep liquidity
Arbitrum / Avalanche:
Cheap
Faster
Slightly more risk
Operator Rule:
Match chain to trade size
Putting It All Together
Before every trade:
Do I have enough gas?
What are total fees?
What is slippage?
What is minimum received?
Final Question:
If this executes worse than expected… am I still okay with it?
Practice Mission
Open a DEX (like Uniswap)
Simulate a trade
Observe:
Gas fee
Price impact
Minimum received
Challenge:
Compare the same trade on:
Ethereum
Arbitrum
👉 Notice cost difference
Final Thought
In DeFi, clicking “Swap” is easy… understanding what happens after is where your edge comes from
