
Explore advanced Solidity through Yul and assembly, learning low-level bytecode concepts, storage versus memory, and optimization trade-offs while confronting risks to become a true Solidity expert.
Explore how types work in Yul and assembly within Solidity by demonstrating 32-byte words, colon-equal assignments, and returns for uint, bool, string, and address.
Explore basic operations in yul-style solidity, including for loops and if statements, a prime-check function using modulus on 32-byte words, and truthiness without booleans.
Master reading and writing storage with sload and sstore, explore slot and offset, and see how packing variables into the same slot affects access and security.
Learn how to read and write a smaller variable like E inside a 32-byte storage slot using precise offsets, bit shifting, and masking in Solidity.
Learn how Solidity computes storage slots for arrays and mappings, including fixed vs dynamic arrays, how hashes and concatenation locate elements, and how lengths are stored.
Errata: The illustration at 2:37 should have the array finishing as 0x1c, 0x1d, 0x1f as it is in hex, not decimal.
Explore how Solidity uses memory, starting with the free memory pointer at 0x40 and progressing through struct and array allocation, and how ABI encoding shapes memory layout.
Explore how mismanaging the free memory pointer in Solidity can overwrite memory and corrupt data, with foo becoming bar and unpacked memory spanning multiple 32-byte slots.
Explore how memory handles data larger than 32 bytes in youll, using explicit memory addressing to return and hash data with keccak256, including scratch space and free memory pointer.
Explore how Solidity logs and events work, including indexed versus non-indexed arguments, event signatures and topics, and emitting logs on a testnet.
Discover calldata in ethereum smart contracts, including function selectors and ABI-encoded arguments, how arbitrary transaction data is structured and gas costs are affected.
Explore how to call other contracts in Solidity using staticcall, regular call, and delegatecall, including function selectors, ABI encoding, memory handling, gas management, and handling return data.
Learn how dynamic length arguments encode in call data, using pointers, lengths, and surrounding fixed data in Solidity. Compare using structs versus arrays for fixed-length tuples to reduce gas costs.
Compare two transfer of value patterns for withdrawing ether: call with a payable recipient and empty abi encoding, highlighting gas costs, bytecode size, and reentrancy considerations.
Learn to imitate a solidity contract in fuel using yul, handling call data, function selectors, and a switch statement, calling get two or get 99, with leave and return semantics.
Explore building a 100% Yul contract with an all-in constructor, using memory slots and data markers, compiling with yield, and interfacing for testing on remix.
Deploy to Rink B and inspect etherscan verification challenges when using yul versus solidity, and prefer writing in solidity with assembly only for small, gas-efficient functions.
Store large data in contract bytecode by embedding strings with the data keyword. Use a static call to retrieve the bytes and convert them into a string, reverting on failure.
Illustrate an ERC-20 example showing constructor storage, function selectors, balance and total supply operations, and non-payable calls with memory and storage access and return behavior.
Examine how balance of derives from decode as address within calldata, including function selectors, offsets, and zero-padding to verify a valid address and revert on invalid or zero address.
Explores total supply in ERC20, how mint updates total supply and balances, owner-only mint enforcement, overflow checks, storage offsets, and emitting transfer events, with reference to OpenZeppelin hooks.
Explore how balanceOf loads a user's ERC20 balance by computing a storage offset from the address into a mapping, using hex 1000, and returning the balance.
Review ERC20 transfer and transfer from flows by examining execute transfer calls, balance deduction, and transfer emission, ensuring nonzero source and destination and proper balance checks.
Examine ERC20 approval via OpenZeppelin, detailing owner and spender allowances and transferFrom. See how storage slots, hashing, and memory choices influence gas efficiency and contract clarity.
Explore rarely used signed arithmetic in yul and assembly, including signed division, modulus, comparisons, and signed shifts, with sign extension and EVM 32-byte word handling.
If you've wondered what solidity is doing behind the scenes, this is the course to take. Perhaps you've head of assembly in Ethereum smart contracts and heard it can be efficient but dangerous. After you finish this course, you will have a ground-up understanding of what exactly happens when a smart contract receives a function call, how it encodes that data, where exactly it stores it, and how it updates the blockchain state. Even if you don't write contracts in assembly, you will have a much better understanding of solidity's design choices and previously cryptic error messages will make perfect sense.
We will learn how solidity represents various data types, and how we can come up with more efficient representations ourselves depending on the application. We will learn the assumptions solidity makes about memory layout and how to avoid violating those assumptions when we use low level instructions. We will learn what happens behind the scenes when smart contracts make function calls to each other, and how to implement that protocol by hand. And of course, we will build smart contracts from scratch in assembly.
Nobody can claim to be an expert in solidity without mastering assembly (also known as Yul). So if mastery is your goal, take this class!
Note: This class is not for beginners. You should be very comfortable with solidity before taking this course.