Liquidity Pools
📖 Scenario: You are building a simple program to understand how liquidity pools work in blockchain. Liquidity pools hold two types of tokens and allow users to swap between them. Your program will track the amounts of two tokens in the pool and calculate the price ratio.
🎯 Goal: Create a program that sets up a liquidity pool with two tokens and their amounts, defines a fee percentage, calculates the price ratio of the tokens, and prints the result.
📋 What You'll Learn
Create a dictionary called
liquidity_pool with keys 'TokenA' and 'TokenB' and values 1000 and 500 respectivelyCreate a variable called
fee_percent and set it to 0.3Calculate the price ratio of TokenA to TokenB and store it in a variable called
price_ratioPrint the
price_ratio with a descriptive message💡 Why This Matters
🌍 Real World
Liquidity pools are used in decentralized finance (DeFi) to enable token swaps without a traditional exchange.
💼 Career
Understanding liquidity pools is important for blockchain developers working on DeFi platforms and smart contracts.
Progress0 / 4 steps