← Theory library
Vyper theory
Pythonic, deliberately minimal EVM language used across DeFi.
Easy
- 1. What Vyper isA Pythonic, security-first smart contract language for the EVM.
- 2. Version pragma and file layoutPinning the compiler version and structuring a Vyper module.
- 3. Value typesbool, int128/uint256, address, bytes32, decimal and their ranges.
- 4. Storage variables and public()Declaring persistent state and exposing getters.
- 5. Constants and immutablesconstant vs immutable, and when to use each.
- 6. Functions and decorators@external, @internal and how Vyper replaces Solidity's function modifiers.
- 7. view, pure and payableState-mutability decorators and receiving ETH.
- 8. Every function needs a visibility decoratorThere is no implicit visibility — Vyper forces you to be explicit.
- 9. Control flow: if and forBranches and bounded loops — Vyper has no while loop.
- 10. Iterating with range()Fixed and bounded ranges for numeric loops.
- 11. assert and raiseGuarding functions and reverting with a reason.
- 12. HashMapVyper's mapping type for key/value storage.
- 13. Fixed-size arraysStatically sized arrays with compile-time bounds.
- 14. Dynamic arrays with DynArrayVariable-length arrays bounded by a maximum capacity.
- 15. StructsGrouping related fields into a named type.
- 16. Enums / flagsNamed states, and Vyper's bitflag-based flag type.
- 17. Bytes and String typesFixed-length Bytes[N] and String[N] with a max size.
- 18. Constructor: __init__Deploy-time setup with __init__.
- 19. Global variables: msg, block, txReading transaction and block context.
- 20. Events and logDeclaring and emitting logs for off-chain consumers.
Medium
- 21. External calls and interfacesCalling other contracts safely and typed.
- 22. Sending ETH: send, raw_call and defaultMoving value out of a contract safely.
- 23. Reentrancy guard: @nonreentrantLocking a function against reentrant calls.
- 24. Access control: the owner patternRestricting sensitive functions without modifiers.
- 25. Custom error messages and revert reasonsWriting informative, gas-conscious revert strings.
- 26. Type conversions with convert()Explicit, checked conversions between types.
- 27. Multiple return valuesReturning tuples from a function.
- 28. Internal helper functionsFactoring shared logic without inheritance.
- 29. self and module-level stateHow self. distinguishes storage from locals.
- 30. Interfaces and implementsDeclaring a contract's ERC compliance explicitly.
- 31. Building an ERC-20 tokenWiring balances, allowances and standard events together.
- 32. Building an ERC-721 tokenNFT ownership tracking in Vyper.
- 33. Escrow and time-locks with block.timestampGating logic on block time.
- 34. Randomness pitfalls on chainWhy blockhash/timestamp are not safe randomness sources.
- 35. Auditing checklist for Vyper contractsWhat to look for before shipping.
- 36. Gas considerations in VyperWhere Vyper contracts typically spend gas.
- 37. Vyper vs Solidity: design philosophyTwo approaches to the same virtual machine.
Hard
- 38. Testing Vyper contracts with TitanoboaA Python-native way to run and inspect Vyper contracts.
- 39. Testing with Brownie/ApeFramework-based testing across Vyper and Solidity.
- 40. Deploying and verifying a Vyper contractFrom compiled artifact to a verified on-chain contract.
- 41. No inheritance: composing via interfaces and callsHow Vyper achieves modularity without base contracts.
- 42. Proxies and upgradability with VyperVyper contracts are immutable — upgrade patterns work around a fixed address.
- 43. Front-running and MEV considerationsDesigning functions that resist transaction-ordering attacks.
- 44. Working with Chainlink oracles in VyperPulling reliable external price data on chain.
- 45. Building a simple staking contractDeposits, rewards accrual and withdrawals.
- 46. Building a simple escrow contractHolding funds until conditions are met.
- 47. Vyper security: known past vulnerability classesLearning from real incidents in the Vyper ecosystem.
- 48. Reading Vyper bytecode and the ABIWhat the compiler actually hands you.
- 49. Interacting with Vyper contracts from a dAppConnecting a front end to a deployed contract.
- 50. Capstone: a full Vyper vault contractBringing deposits, withdrawals, access control and safety together.