Time: ~40 min. Goal: the forge build / test / script loop on a local chain.
Exercises are the numbered comments in the starter files.
cd lab1 && forge install foundry-rs/forge-std@v1.17.0 --no-git && forge build (compiles as-is).src/WorkshopSeats.sol; complete Exercises 1-4 (book, cancel).test/WorkshopSeats.t.sol; write Exercises 5-8. Use vm.prank, vm.expectRevert, makeAddr.forge test -vv until green; forge test --gas-report; forge coverage (optional). anvil --port 18513 --chain-id 31337
forge script script/Deploy.s.sol --rpc-url anvil --broadcast --private-key <anvil account #0 key>
cast call <addr> "seatsLeft()(uint256)" --rpc-url anvilXDC note: same commands work on XDC (chain 50) / Apothem (51) by changing --rpc-url; in this workshop we never broadcast outside anvil.
Solution: lab1-solution.tar.gz (download link below; same layout, run the same forge install step first).
Download starter · Download solution · All workshop material