canton-daml-patterns
Installation
SKILL.md
Canton Daml Design Patterns
Overview
Beyond single templates, real Canton apps compose multi-step transactions and use standard multi-party patterns. All Daml transactions are atomic (all-or-nothing across all participants), which is what makes safe swaps and settlements possible.
Atomic composition
A choice can compose several actions; thanks to atomicity neither party is left out of pocket. A swap settles two transfers in one transaction:
choice Trade_Settle : (ContractId Asset, ContractId Asset)
with
quoteAssetCid : ContractId Asset
baseApprovalCid : ContractId TransferApproval
controller buyer
do
-- exercise transfers both ways; either the whole thing commits or none of it
...
The requester sees all consequences of their submission (no surprises), but must therefore have the information to interpret them — which is why counterparties disclose the needed contracts first.