Cryptocurrency Smart Contracts and dApps 3 — Questions and Answers
Question 1: What is 'flash loan' arbitrage in DeFi?
- Borrowing and repaying a large uncollateralized loan within a single transaction to exploit price differences (Correct answer)
- Lending tokens to validators in exchange for staking rewards
- Rapidly moving funds between centralized exchanges using bank wires
- Taking out a loan backed by NFTs to buy more crypto
Correct answer: Borrowing and repaying a large uncollateralized loan within a single transaction to exploit price differences
Flash loans are uncollateralized loans that must be borrowed and repaid within one atomic transaction; traders use them to exploit price discrepancies across DEXs at scale.
Question 2: Which consensus component do Ethereum smart contracts rely on for deterministic execution across all nodes?
- The EVM (Ethereum Virtual Machine) (Correct answer)
- The JSON-RPC API
- The Beacon Chain BLS signatures
- The P2P gossip protocol
Correct answer: The EVM (Ethereum Virtual Machine)
Every full node runs the same EVM, ensuring that executing the same smart contract bytecode with the same inputs always produces identical outputs, enabling consensus.
Question 3: What is 'slippage' in the context of a decentralized exchange (DEX)?
- A fee charged by liquidity providers for early withdrawal
- The difference between the expected price of a trade and the price at which it executes (Correct answer)
- The delay between submitting a transaction and block confirmation
- A penalty for impermanent loss exceeding a threshold
Correct answer: The difference between the expected price of a trade and the price at which it executes
Slippage occurs when large trades or low liquidity move the pool price between order submission and execution, causing the actual fill price to differ from the quoted price.
Question 4: In the context of dApps, what is 'wallet connect'?
- A hardware wallet firmware protocol
- An open protocol that links mobile wallets to desktop dApps via QR code (Correct answer)
- A Solidity library for managing multi-sig wallets
- A Coinbase product for custodial wallet integration
Correct answer: An open protocol that links mobile wallets to desktop dApps via QR code
WalletConnect is a protocol that creates an encrypted connection between a dApp and a user's mobile wallet by scanning a QR code, enabling transaction signing without exposing private keys.
Question 5: What is the role of 'events' in a Solidity smart contract?
- They trigger automatic execution of code on a schedule
- They emit logs that off-chain applications can listen to and index (Correct answer)
- They call external contracts when a condition is met
- They pause contract execution until a validator approves
Correct answer: They emit logs that off-chain applications can listen to and index
Events emit structured log data to the transaction receipt, allowing front-end applications and indexers (like The Graph) to efficiently track on-chain activity without querying the full state.
Question 6: What distinguishes an 'EOA' from a 'contract account' on Ethereum?
- EOAs are controlled by private keys and cannot hold code; contract accounts hold EVM bytecode (Correct answer)
- EOAs pay no gas fees; contract accounts pay double fees
- EOAs are used only on testnets; contract accounts are mainnet-only
- EOAs require multi-sig approval; contract accounts are single-key
Correct answer: EOAs are controlled by private keys and cannot hold code; contract accounts hold EVM bytecode
Externally Owned Accounts (EOAs) are controlled by a private key and contain no code, while contract accounts are governed entirely by their deployed EVM bytecode.
Question 7: What is 'impermanent loss' for a liquidity provider in an AMM?
- Gas fees paid when adding or removing liquidity
- The loss incurred when a smart contract is hacked
- The opportunity cost vs. simply holding when token prices diverge after depositing into a pool (Correct answer)
- A permanent reduction in LP tokens due to protocol fee burning
Correct answer: The opportunity cost vs. simply holding when token prices diverge after depositing into a pool
Impermanent loss occurs when the price ratio of pooled tokens changes from the time of deposit, causing the LP's withdrawn value to be less than if they had just held the tokens.
What is 'flash loan' arbitrage in DeFi?