Templates live in templates/ and are real, tested Soroban crates. They are also
a Cargo workspace, so cargo test validates every template in CI.
The simplest starter. Demonstrates:
- Instance storage with a typed
DataKey. - An authenticated mutation (
incrementrequirescaller.require_auth()). - Event publishing.
- A unit test using
mock_all_auths.
sforge init my-counter --template counterA two-party token escrow. Demonstrates:
- SEP-41 token transfers into and out of the contract.
- A custom
#[contracterror]enum. - A small state machine (
init→release/refund, single settlement). - Four unit tests covering release, refund, double-settle, and validation.
sforge init my-escrow --template escrow- Create
templates/<name>/with aCargo.toml(usingsoroban-sdk = { workspace = true }) andsrc/lib.rswith tests. - Add it to the workspace members (the
templates/*glob already covers it). cargo testto verify.sforge templateswill list it automatically.
New templates are great good first issue contributions — see the seeded
issues.