Back to Games Catalog
Deterministic Educational Environment · No real funds or wallet connection
ProyectosWeb3 Labs · DeFi Math Engine v1.0

DeFi Protocol Simulator

Visually and interactively explore the mathematical invariants governing decentralized financial protocols: constant product liquidity pools, impermanent loss, and overcollateralized liquidations.

Preconfigured Educational Scenarios

Pool Liquidity Reserves

k = 3,000,000,000
1,000 ETH
10 ETH (Baja liquidez)2,000 ETH (Pool profunda)
3,000,000 USDC
30,000 USDC6,000,000 USDC

Swap Order Configuration

5 ETH
Share relative to reserve:0.50% del pool
Liquidity Fee (LP Fee Tier)
0%

Constant Product Curve (x · y = k) & State Displacement

Observe how larger trade sizes push the equilibrium point further along the hyperbola.

Pre-SwapPost-Swap
P₀ (1000 ETH)P₁ (1005.0 ETH)Reserva X (ETH)Reserva Y (USDC)
ETH Reserve Balance (Before → After)
1000.00 ETH→ 1005.00 ETH
USDC Reserve Balance (Before → After)
3,000,000 USDC→ 2,985,119 USDC
Estimated Output Amount (amountOut)
14,880.82 USDC
Fee paid to pool:0.0150 ETH (0.30%)
Initial Spot Price vs Effective Price
Spot inicial:3,000 USDC/ETH
Precio de curva (sin fee):2,985.1192 USDC/ETH
Precio Efectivo (neto):2,976.1638 USDC/ETH
Pure Price Impact (x·y=k Curve)-0.50%

Caused strictly by your order size relative to pool liquidity. Total execution cost including fee: -0.79%

Execution Slippage0.00% (neutral)

Executable Order: Unfavorable deviation stays within your configured tolerance.

Core Distinction: Price Impact vs. Slippage

Price Impact is deterministic and depends on pool reserve depth versus your order size. Slippage is the variation between the quoted price when broadcasting your transaction and the actual execution price when mined due to competing mempool transactions (or MEV bots).

Why does the k constant grow?

In swaps with a fee tier (e.g. 0.3%), the fee collected is retained within the pool, increasing the product k = x · y with every trade and rewarding liquidity providers.

Non-Linear Impact Acceleration

As your trade consumes a larger fraction of pool reserves, the x · y = k curve turns asymptotic, causing the marginal execution price to spike quadratically.