Contract Patterns
The contract examples in vara-dapp-patterns/contracts focus on small, production-oriented Sails patterns that solve one architectural problem at a time.
Included patterns
| Pattern | Problem it solves | Source |
|---|---|---|
| Delayed Self-Messages with Version Guards | Safe deferred actions when delayed messages may arrive after state changed | contracts/delayed-self-message |
| Factory Pattern for Child Program Instantiation | Creating many isolated program instances from one template CodeId | contracts/factory |
| Service Wrapper Pattern | Injecting policy into a reusable base service without rewriting domain logic | contracts/module-toggles |
| Signless & Gasless Sessions | Delegated execution with action allowlists and temporary session keys | contracts/signless-gasless |
What makes these examples useful
Each example stays small enough to audit quickly, but still shows the moving parts that matter in a real app: storage ownership, explicit error boundaries, internal scheduling, service composition, and delegation flow.
Why this section matters
These patterns are most useful when you are not looking for a full product template, but for one reliable building block you can transplant into a larger program.