Strongly Typed Financial Software
summary
Builds a spot-swap server with Axum + Tokio server and Leptos client, uses Rust traits, generics, newtype wrappers and macros to enforce money rules, and implements an unsigned decimal using U128 with six decimals precision plus signed/positive wrappers to prevent negative or zero where disallowed. Uses a phantom type parameter to tag USD vs EUR so the compiler rejects mixing assets; a real bug (subtracting euros from dollars) cost ~30 minutes to debug before being eliminated by these types.
AI-written summary · about
chapters (16)
- 0:00Strongly typed financial software
- 2:15Strong typing in financial code
- 3:40Currency calculation mistakes fixed
- 7:32Spot swap application demo
- 8:36Representing money with decimals
- 10:23Preventing negative decimals
- 12:51Enforcing positive decimals
- 14:14Strongly typed asset representations
- 16:21Mixed currency compile-time checks
- 17:02Currency exchange prices safely
- 18:27Strongly typed API endpoints
- 19:53Real-world bug fixed with types
- 21:26Bug classes eliminated with types
- 22:07Client-server with shared types
- 23:52Asset types in wire formats
- 24:33Summary and Q&A








