Course 16: AMM, UTLSwap & UTLFarm PREMIUM

📚14 Lessons
~2.5 hours
🎯Advanced Level
🏆250 KENO upon completion

🎯Learning Objectives

By the end of this course, you will be able to:

  • Explain why Automated Market Makers (AMMs) replaced traditional order books as the dominant DEX model
  • Apply the constant product formula (x × y = k) to calculate swap prices, slippage, and pool ratios
  • Describe how liquidity pools work, including adding/removing liquidity and LP token mechanics
  • Understand UTLSwap — Kenostod's native AMM contract on BNB Smart Chain — and how to interact with it
  • Calculate impermanent loss and evaluate when providing liquidity is profitable vs risky
  • Explain UTLFarm — how LP tokens are staked for KENO yield rewards and why it incentivizes liquidity
  • Map the full DeFi stack: how UTLSwap and UTLFarm work together as a complete decentralized financial system
  • Identify and defend against MEV sandwich attacks when trading on AMMs
⚡ Why This Course Is Revolutionary

This is not a theory course. UTLSwap and UTLFarm are live, deployed smart contracts on BNB Smart Chain — part of the UTL Protocol ecosystem you have learned throughout this curriculum. In the On-Chain Lab section, you will interact directly with these contracts using real KENO tokens. This is Education-Fi in action: you learn it, you use it.

📈The Death of the Order Book

To understand why Automated Market Makers matter, you first need to understand what came before them and why it failed on-chain.

The Traditional Order Book Model

Traditional exchanges — from the New York Stock Exchange to Coinbase Pro — use an order book: a live list of every buy and sell order placed by users. When a buyer's price matches a seller's price, a matching engine executes the trade. The buyer gets the asset; the seller gets the cash.

Order books work beautifully in centralized systems where a server processes thousands of orders per second. But when developers tried to put an order book on a blockchain, they ran into three fundamental problems:

Problem Why It Breaks On-Chain
Every order update costs gas Placing, canceling, and modifying orders are all on-chain transactions. A busy order book would burn thousands of dollars per minute in gas fees.
Speed mismatch Blockchains produce blocks every 3–15 seconds. High-frequency traders exploit this delay — by the time your order is confirmed, the price has moved.
Front-running by validators Block producers can see your order before it confirms and insert their own order first. The public mempool is a front-runner's paradise.

The Breakthrough: Replace the Order Book with Math

In 2018, Uniswap's founder Hayden Adams published a radically simple idea: instead of matching buyers with sellers, use a mathematical formula to set the price automatically. No order book. No matching engine. No market makers needed. Just a smart contract holding two tokens and a single equation governing every trade.

This became the Automated Market Maker (AMM) — the architecture that powers Uniswap, PancakeSwap, Curve, SushiSwap, and now UTLSwap.

🌟 The Paradigm Shift

Order books require counterparties — someone must be willing to sell exactly when you want to buy. AMMs replace counterparties with liquidity pools — smart contracts that are always ready to trade, 24/7, at any size, with no registration or counterparty needed. This is what makes DeFi truly permissionless.

📈How AMMs Work — The x × y = k Formula

Every AMM built on the constant product model (Uniswap V2, PancakeSwap, UTLSwap) operates from a single mathematical invariant:

x × y = k
Where x = reserve of Token A  |  y = reserve of Token B  |  k = constant product (never changes)

The pool holds two tokens. The product of their quantities must always equal the same constant k. Every trade changes the ratio of tokens, moving along a curve — but k stays fixed (excluding fees).

A Real Example: KENO/BNB Pool

Imagine UTLSwap's KENO/BNB pool has:

  • x = 100,000 KENO
  • y = 100 BNB
  • k = 100,000 × 100 = 10,000,000
  • Implied price: 1,000 KENO per BNB

Now a trader wants to buy 10 BNB worth of KENO. They send 10 BNB into the pool. After the trade, the pool has 110 BNB. Since k must stay at 10,000,000:

// Before trade x = 100000 KENO | y = 100 BNB | k = 10000000 // After trader adds 10 BNB: new_y = 110 BNB new_x = k / new_y = 10000000 / 110 = 90909 KENO // KENO received by trader: 100000 - 90909 = 9091 KENO // Effective price: 10 BNB for 9091 KENO = 909.1 KENO/BNB // vs starting price of 1000 KENO/BNB — that's 9.1% slippage

This is price impact — large trades relative to pool size move the price significantly. The formula naturally enforces this: the bigger your trade relative to the pool, the worse your price.

The Price Curve

The constant product formula creates a hyperbolic price curve. This means:

  • Small trades have minimal price impact — the curve is nearly flat near the current price
  • Large trades have severe price impact — moving along the curve costs progressively more
  • The pool can never be drained — buying all of one token would require an infinite amount of the other
💡 Why k Never Truly Stays Constant

In practice, the 0.3% swap fee (standard in most AMMs) is added to the pool on every trade. So k actually grows slightly with each swap — this is how liquidity providers earn fees. The invariant is maintained before fee addition, then k increases, benefiting all LPs proportionally.

Key Terms

Constant Product
The invariant x × y = k that governs all AMM price calculations
Slippage
The difference between expected and actual swap price due to trade size relative to pool
Price Impact
How much your trade moves the pool price, expressed as a percentage
Slippage Tolerance
The maximum price movement you accept; transactions revert if exceeded

🛡️Liquidity Pools Deep Dive

Liquidity pools are the fuel of every AMM. Without people depositing tokens, there is nothing for traders to trade against. Understanding how to add and remove liquidity — and what you get in return — is essential DeFi knowledge.

Adding Liquidity

To add liquidity to a pool, you must deposit both tokens in the pool's current ratio. If the KENO/BNB pool has a ratio of 1000 KENO per BNB and you want to add liquidity, you must deposit both KENO and BNB at that same 1000:1 ratio.

  • Approve the AMM contract

    Before depositing, you sign an ERC-20 approval transaction allowing the pool contract to move your tokens. This is a one-time permission per token per contract.

  • Deposit tokens at current ratio

    You send both tokens to the pool contract simultaneously. The contract verifies you've deposited at the correct ratio (within a small tolerance for block timing).

  • Receive LP tokens

    The contract mints and sends you LP tokens (Liquidity Provider tokens) — ERC-20 tokens that represent your proportional share of the pool. If you deposited 10% of all pool liquidity, you receive tokens representing 10% ownership.

  • Earn swap fees automatically

    Every swap in the pool generates a 0.3% fee. This fee is distributed proportionally to all LPs by being added to the pool reserves. Your LP tokens grow in value as fees accumulate — no claiming needed.

LP Tokens — Your Proof of Position

LP tokens are the most important concept in liquidity provision. They are:

  • Transferable — you can send them to another wallet
  • Stakeable — you can deposit them into a farm (like UTLFarm) to earn additional yield
  • Redeemable — burning your LP tokens returns your proportional share of the pool, including accumulated fees
  • Priced — they have a dollar value equal to your share of pool assets
Liquidity Provider Lifecycle
💰
LP Deposits
KENO + BNB
🛡️
UTLSwap Pool
Holds reserves
🌐
LP Tokens
Proof of share
🌿
UTLFarm
Stake for KENO

Removing Liquidity

To exit a pool, you return your LP tokens to the contract. The contract burns them and sends you back your proportional share of current pool reserves. Note: you get back the pool's current ratio of tokens, not the ratio you deposited at. If the ratio changed (because the price moved), you get a different split than you put in. This price-ratio divergence is the root cause of impermanent loss, covered in Section 6.

⚠️ Critical: Ratio Must Match

You cannot deposit only one token into a standard AMM pool. If you try to add 10,000 KENO without also adding the corresponding BNB amount, the transaction will revert. Some advanced AMMs (like Curve's stablecoin pools or Uniswap V3) allow single-sided deposits through internal swapping, but this adds complexity and fees.

UTLSwap — Kenostod's Native AMM

UTLSwap is the Kenostod ecosystem's Automated Market Maker — a live, open-source smart contract on BNB Smart Chain that enables permissionless token swaps between KENO and BNB, and serves as the liquidity infrastructure for the entire UTL Protocol.

UTLSwap Architecture

UTLSwap is built on the battle-tested constant product formula (x × y = k), with additional Kenostod-specific features designed for the Education-Fi ecosystem:

  • KENO/BNB Liquidity Pool

    The primary pool holds KENO tokens and BNB. Any holder can swap KENO for BNB or BNB for KENO at any time. The swap fee is 0.3%, of which 100% goes to liquidity providers — Kenostod takes no protocol fee.

  • Whitelisted Token Access

    Since KENO has transfer restrictions (the whitelist you learned about in the UTL Protocol courses), UTLSwap is whitelisted by the KENO contract owner. This allows the AMM contract to move KENO tokens on behalf of traders without being blocked by the whitelist check.

  • LP Token Minting (UTL-LP)

    When you add liquidity, UTLSwap mints UTL-LP tokens — BEP-20 tokens on BNB Smart Chain. These are the tokens you stake in UTLFarm to earn KENO yield. They are transferable and represent a real, redeemable claim on pool assets.

  • Slippage Protection

    Every swap includes a minimum output parameter. If the price moves beyond your tolerance between when you sign and when your transaction confirms, the contract automatically reverts — protecting you from sandwich attacks and price manipulation.

  • Deadline Parameter

    Every swap includes a deadline timestamp. If your transaction sits in the mempool too long (e.g., during network congestion), the contract rejects it after the deadline — preventing stale trades from executing at much worse prices.

UTLSwap Live Contract

UTLSwap — AMM Contract
BNB Smart Chain (Mainnet) — UTL Protocol
The core swap and liquidity pool contract for the Kenostod ecosystem. Enables KENO/BNB trading and mints UTL-LP tokens for liquidity providers.
💰
KENO Token Contract
0x48bb049afe50b050b458624dc6233acd51024ab4
The BEP-20 KENO token. UTLSwap is whitelisted on this contract, enabling permissionless swaps through the AMM without triggering transfer restrictions.

How to Swap on UTLSwap

// Step 1: Approve UTLSwap to spend your KENO // (one-time per wallet, done on KENO contract) KENO.approve(UTLSwapAddress, amount); // Step 2: Call swapExactTokensForBNB on UTLSwap UTLSwap.swapExactTokensForBNB( amountIn, // KENO you're sending amountOutMin, // Minimum BNB you'll accept (slippage protection) deadline // Unix timestamp — tx reverts after this time ); // Step 3: BNB arrives in your wallet automatically // Pool now holds more KENO, less BNB // Your 0.3% fee stays in the pool for LPs
🌟 UTLSwap Is the Bridge to DeFi for KENO Holders

Before UTLSwap, KENO could only be transferred directly between whitelisted addresses. UTLSwap creates a permissionless market — any wallet can swap BNB for KENO without needing to be whitelisted themselves, because UTLSwap (not the trader) is the one moving the KENO. This is a fundamental unlock for the ecosystem.

📈Impermanent Loss — The LP's Risk

Impermanent loss (IL) is the reduction in dollar value of your pooled assets compared to simply holding those same assets outside the pool. It occurs whenever the price ratio between the two tokens in your pool changes after you deposit.

The word "impermanent" is critical: if the price ratio returns to exactly where it was when you deposited, the loss disappears. But if you withdraw while prices differ from your entry, the loss becomes realized and permanent.

Why IL Happens — The Math

When you deposit into an AMM pool, you give up price exposure for fee income. Here's why:

Imagine you deposit into the KENO/BNB pool when 1 BNB = 1000 KENO. You deposit 1,000 KENO and 1 BNB (total: ~$600 at $600/BNB). The pool ratio is 1000:1.

Now BNB price doubles to $1,200. Arbitrageurs notice they can buy "cheap" BNB from your pool (still priced at the old ratio) and sell it on Binance for profit. They trade KENO into your pool for BNB until the pool reflects the new market price. Your pool now holds more KENO and less BNB than you started with.

BNB Price Change If You Held In the Pool IL %
No change$600$6000%
+50% ($900)$750$7332.0%
+100% ($1,200)$900$8495.7%
+200% ($1,800)$1,200$1,03913.4%
+400% ($3,000)$1,800$1,34225.5%
−50% ($300)$450$4245.7%
IL = 2√(r) / (1+r) − 1
Where r = price ratio change (new price / old price). Example: price doubles → r = 2 → IL = 2√2/(1+2) − 1 = −5.7%

When Is Providing Liquidity Worth It?

Impermanent loss doesn't mean LPs always lose. You earn fees on every swap through your pool. The question is whether accumulated fees exceed your IL over the period you're in the pool.

  • High volume, stable ratio → fees accumulate fast with minimal IL → great for LPs
  • Low volume, volatile ratio → IL exceeds fees → bad for LPs
  • UTLFarm rewards → KENO yield earned by staking LP tokens can offset IL even during volatile periods
⚠️ The UTLFarm Advantage

This is why UTLFarm exists alongside UTLSwap. By earning KENO rewards on top of swap fees, liquidity providers have a third income stream that helps overcome impermanent loss even in volatile market conditions. The combination of swap fees + KENO farming rewards is what makes the Kenostod liquidity ecosystem sustainable.

🌿UTLFarm — Yield Farming with LP Tokens

UTLFarm is Kenostod's yield farming contract — a live BEP-20 smart contract that rewards liquidity providers with KENO tokens for staking their UTL-LP tokens. It is the incentive layer that sits on top of UTLSwap, completing the two-layer DeFi architecture.

What Is Yield Farming?

Yield farming (also called liquidity mining) is the practice of staking or locking crypto assets in a protocol in exchange for token rewards. In the Kenostod ecosystem:

  1. You add liquidity to UTLSwap's KENO/BNB pool
  2. You receive UTL-LP tokens representing your pool share
  3. You deposit (stake) those LP tokens into UTLFarm
  4. UTLFarm pays you KENO rewards every block
  5. You can claim KENO at any time, or unstake and exit completely

UTLFarm Mechanics

  • KENO Per Block Reward

    The farm distributes a fixed amount of KENO per BNB Smart Chain block. This reward is split proportionally among all stakers — the more LP tokens you stake relative to the total staked, the larger your share of each block's rewards.

  • Reward Accumulation

    Rewards accumulate continuously with every block (~3 seconds on BSC). There is no minimum staking period. You can claim rewards or unstake at any moment — the contract calculates exactly how many blocks you have staked and distributes proportionally.

  • No Lock-Up Period

    UTLFarm has no forced lock-up. You maintain full control of your LP tokens and can withdraw instantly. This respects the DeFi principle of self-custody — your assets, your decisions.

  • Compounding Strategy

    Advanced farmers claim their KENO rewards, then use those KENO tokens to add more liquidity to UTLSwap (getting more LP tokens), then stake those additional LP tokens in UTLFarm. This compounds their position over time — earning rewards on rewards.

UTLFarm Live Contract

🌿
UTLFarm — Yield Farming Contract
0x37D320A881CcF553F6cd757f0A33743ae01A2644
Live on BNB Smart Chain. Accepts UTL-LP tokens and distributes KENO rewards per block to all stakers proportionally. Verified and auditable on BscScan.

How to Farm: Step-by-Step

// Step 1: Get LP tokens by adding liquidity to UTLSwap UTLSwap.addLiquidity(kenoAmount, bnbAmount, deadline); // → Receive UTL-LP tokens in your wallet // Step 2: Approve UTLFarm to move your LP tokens UTLLP.approve(UTLFarmAddress, lpAmount); // Step 3: Stake LP tokens in UTLFarm UTLFarm.deposit(lpAmount); // → You begin earning KENO rewards every block // Step 4: Claim your KENO rewards at any time UTLFarm.harvest(); // → KENO sent to your wallet // Step 5: Unstake when ready UTLFarm.withdraw(lpAmount); // → LP tokens returned + any pending KENO
🏆 APR vs APY — Know the Difference

APR (Annual Percentage Rate) is the raw yield rate without compounding — what the farm advertises. APY (Annual Percentage Yield) accounts for compounding — what you actually earn if you regularly claim and restake rewards. For UTLFarm, frequent compounding can significantly boost returns above the displayed APR.

🌐The Full DeFi Stack — UTLSwap + UTLFarm Together

Understanding each piece individually is good. Understanding how they work together as a system is what makes you a true DeFi practitioner. Here is the complete Kenostod DeFi stack, layer by layer:

Layer 1: The Token — KENO

The foundation. KENO is a BEP-20 token with a whitelist system that controls which contracts can move it. Every layer above must interact with the KENO token contract. UTLSwap and UTLFarm are both whitelisted on KENO, allowing them to facilitate trades and reward distributions without triggering transfer restrictions.

Layer 2: The Exchange — UTLSwap

UTLSwap creates the price discovery mechanism for KENO. It holds the KENO/BNB liquidity pool, executes trades using x × y = k, generates 0.3% fees for LPs, and mints UTL-LP tokens as proof of liquidity provision. Without UTLSwap, KENO has no on-chain market price and no permissionless way to trade.

Layer 3: The Incentive — UTLFarm

UTLFarm solves the cold start problem: why would anyone provide liquidity before there are traders, and why would traders come before there's liquidity? By rewarding early LPs with KENO, UTLFarm bootstraps liquidity into UTLSwap. More liquidity → less slippage → more traders → more fees → more LP income → more liquidity. This is the DeFi flywheel.

The Ecosystem Flywheel

How UTLSwap + UTLFarm Create a Self-Sustaining Ecosystem
💰
LPs Add Liquidity
KENO + BNB
UTLSwap Pool
Deep liquidity
📈
More Traders
Low slippage
🌿
More Fees + KENO
LP rewards

Comparison: Kenostod vs PancakeSwap Architecture

Feature PancakeSwap Kenostod (UTLSwap + UTLFarm)
AMM Formula x × y = k (constant product) x × y = k (constant product)
Swap Fee 0.25% (0.17% to LPs, 0.08% to treasury) 0.3% (100% to LPs)
Farm Reward Token CAKE KENO
Governance CAKE holders vote KENO holders + UTL Protocol
Education Layer None 21-course E-Fi curriculum
Access Model Fully permissionless Whitelist-gated (KENO contract)

🚨MEV & Sandwich Attacks on AMMs

Maximal Extractable Value (MEV) is the profit that block validators can capture by reordering, inserting, or censoring transactions within a block. On AMMs, the primary MEV attack is the sandwich attack.

How a Sandwich Attack Works

  1. You submit a large KENO swap on UTLSwap
  2. A MEV bot sees your pending transaction in the mempool
  3. The bot submits its own identical swap with a higher gas fee — so it gets included before yours
  4. The bot's trade moves the price (buying pushes price up)
  5. Your transaction executes at the now-worse price
  6. The bot immediately sells its tokens at the inflated price for a risk-free profit
// Sandwich Attack Timeline // Block N mempool — all visible to bots: // 1. YOUR pending tx: Swap 100 BNB → KENO (market price) // 2. BOT front-runs: Swap 20 BNB → KENO (higher gas, goes first) // Pool price moves: KENO gets more expensive // 3. YOUR tx executes: Gets less KENO than expected // 4. BOT back-runs: Sells KENO → BNB at inflated price // Bot's net profit: ~0.5-2% of your trade size // Your net loss: paid more BNB per KENO than market

Protecting Yourself on UTLSwap

  • Set tight slippage tolerance — 0.5% max on stable pairs; 1-2% on volatile pairs. Your transaction reverts automatically if slippage exceeds this.
  • Break large trades into smaller chunks — multiple smaller swaps are harder to profitably sandwich than one large swap
  • Use low-traffic times — MEV competition is lower during off-peak hours on BSC
  • Set aggressive deadlines — a 2-minute deadline prevents your transaction from sitting in the mempool long enough to attract bots
💡 Why UTLSwap's Whitelist Helps

Because KENO requires whitelist approval for transfers, MEV bots that are not whitelisted cannot actually receive KENO — which means they cannot execute the "back-run" half of the sandwich. This is an unintentional but real MEV protection benefit of the KENO whitelist architecture.

🔎Real-World Case Studies

Case Study 1: Uniswap V2 — The AMM That Changed Everything (2020)

What happened: Uniswap V2 launched in May 2020 and introduced the constant product AMM in its definitive form. Within 6 months, it was processing more daily volume than Coinbase Pro — a centralized exchange with hundreds of employees and years of infrastructure. It did this with a 700-line smart contract and zero employees.

The lesson: Mathematical simplicity beats operational complexity. The x × y = k formula, combined with permissionless liquidity provision, created more efficient markets than any order book system had achieved for long-tail tokens. UTLSwap is built on the same foundation.

Case Study 2: PancakeSwap — The BNB Chain AMM Empire (2020–Present)

What happened: PancakeSwap launched on BNB Smart Chain in September 2020, copying Uniswap's architecture but with lower gas fees (~$0.01 vs Ethereum's $20–$100). By combining an AMM (PancakeSwap Exchange) with yield farming (CAKE rewards for LP stakers), PancakeSwap grew to over $1B in daily trading volume and hundreds of millions in total value locked.

The lesson: The AMM + Farm combination is the proven playbook for DeFi liquidity bootstrapping. Lower gas fees dramatically expand the accessible user base. Kenostod's UTLSwap + UTLFarm directly follows this architecture on BSC — the same chain PancakeSwap dominates.

Case Study 3: The LUNA/UST Collapse — When Liquidity Pools Fail (May 2022)

What happened: TerraUSD (UST) was an algorithmic stablecoin backed by LUNA tokens. Curve Finance pools held billions in UST liquidity. When a coordinated attack drained the Curve UST pool, UST lost its $1.00 peg. As UST fell, the system minted massive amounts of LUNA to restore the peg — hyperinflating LUNA to near zero. $40B in market cap evaporated in 72 hours.

The lesson: Algorithmic stablecoin liquidity pools carry systemic risk. Liquidity pools are only as safe as the underlying tokens. KENO's $1.00 soft peg and fixed supply (no algorithmic minting) are designed to avoid the death spiral mechanism that destroyed LUNA. Understanding pool risk means understanding token risk first.

Case Study 4: Curve Wars — When Liquidity Becomes a Political Game (2021–2022)

What happened: Curve Finance controls the deepest stablecoin liquidity on Ethereum. Curve's governance token (veCRV) determines how CURVE rewards are distributed to different pools. DeFi protocols realized that whoever controlled the most veCRV could direct enormous liquidity to their own pools. A multi-billion dollar "war" broke out, with protocols like Convex Finance, Frax, and MIM competing to accumulate veCRV and control the liquidity firehose.

The lesson: Liquidity is a strategic resource in DeFi. Protocols that control deep liquidity can attract more users, better pricing, and more ecosystem integrations. UTLFarm's KENO rewards are Kenostod's mechanism for directing and retaining strategic liquidity in the KENO/BNB pool.

🔬On-Chain Lab — Interact With UTLSwap & UTLFarm

This is the hands-on portion of Course 16. You will interact directly with live contracts on BNB Smart Chain using your MetaMask wallet and BscScan's Write Contract interface. No coding required — just a browser and your wallet.

⚠️ Before You Begin

You need: (1) MetaMask connected to BNB Smart Chain, (2) a small amount of BNB for gas (~0.01 BNB is sufficient), (3) some KENO tokens in a whitelisted wallet. All transactions are real — small amounts are sufficient for practice.

Lab Exercise 1 — Read the UTLSwap Pool State

  • Open UTLSwap on BscScan

    Navigate to the UTLSwap contract address on bscscan.com → Contract → Read Contract. Find the getReserves() function and call it. Record the current KENO and BNB reserves in the pool.

  • Calculate the current implied price

    Using the reserves you just read, apply the formula: KENO price = BNB reserve / KENO reserve × BNB price. Compare to the displayed price on the UTL dashboard.

Lab Exercise 2 — Check UTLFarm State

  • Open UTLFarm on BscScan

    Go to bscscan.com/address/0x37D320A881CcF553F6cd757f0A33743ae01A2644#readContract. Find and call kenoPerBlock() to see the current reward rate.

  • Check total staked LP tokens

    Call totalStaked() — this shows how many LP tokens are currently staked across all farmers. Calculate what percentage of the pool you would own if you staked 100 LP tokens.

  • View pending rewards for your wallet

    Call pendingKeno(yourAddress) using your wallet address as input. This shows how many KENO tokens you have earned and not yet claimed.

🅄 Open UTLFarm on BscScan

✏️Written Exercises

Complete these exercises to reinforce your understanding. Take your time — thoughtful answers demonstrate true comprehension.

Exercise 1: AMM Price Calculation

The UTLSwap KENO/BNB pool has 500,000 KENO and 200 BNB. A trader wants to buy 50 BNB worth of KENO. Using the constant product formula, calculate: (a) how many KENO they will receive, (b) their effective price per BNB in KENO, and (c) the percentage slippage compared to the starting price.

Exercise 2: Impermanent Loss Scenario

You add liquidity to the KENO/BNB pool: 10,000 KENO at $1.00 each and 10 BNB at $1,000 each (total: $20,000). Three months later, BNB price has risen to $2,500 while KENO stays at $1.00. (a) What does your position now hold in the pool? (b) What would you have if you had just held both assets? (c) What is your impermanent loss in dollars and percentage?

Exercise 3: UTLFarm Strategy

UTLFarm is paying 10 KENO per block. There are currently 1,000,000 LP tokens staked in total. You are considering staking 50,000 LP tokens. (a) What percentage of total rewards would you earn? (b) If a BNB block is produced every 3 seconds, how many KENO per day would you earn? (c) At $1.00/KENO, what is your daily dollar yield? Should you account for impermanent loss in this calculation — why or why not?

Exercise 4: Sandwich Attack Defense

You want to swap 5,000 BNB worth of KENO on UTLSwap (a very large trade). The pool has 1,000,000 KENO and 1,000 BNB. Explain: (a) why this trade is at high risk of a sandwich attack, (b) what specific parameters you would set to protect yourself, and (c) an alternative strategy to execute this trade more safely.

Exercise 5: DeFi Stack Design

Kenostod is launching a new KENO/USDT pool alongside the existing KENO/BNB pool. As the protocol designer, explain: (a) what advantages a stablecoin pair (KENO/USDT) has over KENO/BNB for liquidity providers, (b) how impermanent loss differs between the two pairs, and (c) what reward rate (higher or lower than KENO/BNB) you would set in UTLFarm for the KENO/USDT pool and why.

🎓Final Exam — 12 Questions

Score 9/12 (75%) or higher to complete Course 16 and earn your 250 KENO reward.

1. In the AMM formula x × y = k, what does "k" represent?
The current token price
A constant that never changes, ensuring the pool product stays fixed
The total dollar value of the pool
The number of liquidity providers in the pool
2. Why did order books fail as the primary DEX architecture on blockchains?
Order books are illegal in most countries
Every order update costs gas, blocks are too slow for HFT, and validators can front-run orders
Order books only work with Bitcoin, not ERC-20 tokens
AMMs are required by BNB Smart Chain's protocol
3. A pool has 200,000 KENO and 200 BNB. What is the implied price of KENO in BNB?
1 KENO = 0.001 BNB (1000 KENO per BNB)
1 KENO = 0.01 BNB (100 KENO per BNB)
1 KENO = 1 BNB
1 KENO = 200 BNB
4. What do you receive when you add liquidity to UTLSwap?
A receipt email from Kenostod
UTL-LP tokens representing your proportional share of the pool
The same tokens you deposited, locked for 1 year
KENO tokens equal to your deposit value
5. Impermanent loss occurs when:
The blockchain network goes offline temporarily
The price ratio between pool tokens changes after you deposit, resulting in less value than simply holding
You forget to claim your farming rewards for more than 7 days
The AMM contract charges an exit fee when removing liquidity
6. What is the primary purpose of UTLFarm in the Kenostod ecosystem?
To lock student KENO tokens so they cannot be sold
To incentivize liquidity provision in UTLSwap by rewarding LP token stakers with KENO
To replace MetaMask as the primary wallet for KENO
To generate revenue for Kenostod Academy LLC
7. In a sandwich attack, what is the attacker's goal?
To crash the entire pool by draining all liquidity
To front-run and back-run a victim's trade, profiting from the price movement caused by their transaction
To steal the victim's LP tokens from UTLFarm
To duplicate the victim's wallet private key through the mempool
8. Why can't you add only one token (e.g., only KENO) to a standard UTLSwap pool?
It's a legal restriction under DeFi regulations
Adding a single token would break the x × y = k invariant, which requires both sides of the pool to remain balanced at the current ratio
MetaMask only supports two-token transactions
Single-token deposits are only available to addresses with more than 1,000,000 KENO
9. The DeFi flywheel describes how UTLSwap + UTLFarm interact. Which ordering is correct?
Traders come first → Fees attract LPs → LPs add liquidity → UTLFarm rewards them
UTLFarm KENO rewards attract LPs → LPs add liquidity → deeper liquidity attracts traders → trading fees increase LP income → more LPs join
KENO price rises first → UTLFarm deploys → UTLSwap launches → LPs enter
Kenostod manually seeds all liquidity before allowing public participation
10. The UTLFarm contract address is 0x37D320A881CcF553F6cd757f0A33743ae01A2644. Why does this contract need to be whitelisted on the KENO token?
So it can charge higher fees to farmers
Because KENO's transfer restrictions would otherwise block UTLFarm from distributing KENO rewards to stakers
Whitelisting gives it priority in the BSC mempool
It is not whitelisted — UTLFarm uses BNB, not KENO, for rewards
11. How does a KENO/USDT pool have less impermanent loss risk than a KENO/BNB pool?
USDT is a stablecoin pegged to $1.00, so the KENO/USDT price ratio only changes when KENO's price moves — not when BNB independently moves in the opposite direction
Stablecoin pools have zero impermanent loss by definition
USDT pools are regulated and therefore safer than unregulated BNB pools
BNB has higher gas fees which increase impermanent loss on BNB pairs
12. What is the "compounding" strategy in UTLFarm?
Waiting longer between claims to receive a bonus multiplier from the contract
Claiming KENO rewards → using them to add more UTLSwap liquidity → staking the new LP tokens in UTLFarm → earning rewards on a larger position
Depositing the same LP tokens multiple times to count them twice in the reward calculation
Sending KENO rewards directly back to UTLFarm without converting to LP tokens