Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Codegen Mapping

How Cambrian constructs lower on the public targets.

Solidity-EVM (--target evm)

CambrianSolidity
entity EContract E (flat file under src/)
membersStorage variables (+ transforms inlined into route bodies)
routesExternal / public functions
view routesview functions
msg::sender / msg::valuemsg.sender / msg.value (payable when value is read)
~> dest typed sendExternal call
deploy E(...)Factory / CREATE2 when deterministic
event / emitSolidity event / emit
error / throw NameCustom errors / revert
test / property / invariantFoundry tests / fuzz / invariant handlers

Lean-EVM (--target lean)

CambrianLean
entity stateStructure fields (plus ghost key lists for iterated maps when needed)
routesFunctions World → … (failing routes in an error monad / Except-style surface)
sends / deploysWorld updates (call, occupancy, balances)
property / testTheorems in *Spec.lean
invariantAction / step / runTrace style definitions + checks

Prefer reading a generated output tree for the exact file layout; lowering details evolve with each backend.