Module 0 · Exercise 1 · ~20 min
Work through a set of scenarios on a richer simulated Daml ledger. Each scenario gives you a goal ledger state — use the available actions to reach it. The simulator auto-checks when you get there.
Templates in play:
template Iou
with issuer: Party, owner: Party, amount: Decimal, currency: Text
where
signatory issuer, owner
choice Transfer : ContractId Iou with newOwner: Party controller owner
choice Split : (ContractId Iou, ContractId Iou) with splitAmount: Decimal controller owner
choice Archive_ : () controller issuer
template TransferProposal
with iouCid: ContractId Iou, proposedOwner: Party, currentOwner: Party
where
signatory currentOwner
observer proposedOwner
choice Accept : ContractId Iou controller proposedOwner
Goal: There is an active Iou contract owned by Bob with amount 100 USD, issued by Alice. That's it — one active contract, one archived, Bob as current owner.
Goal: Alice starts with a 100 USD Iou owned by Bob. Bob splits it into 60 + 40 and transfers the 60 to Carol. End state: Bob holds 40 USD (active); Carol holds 60 USD (active); original 100 USD is archived.
Goal: Transfer ownership from Bob to Carol using the propose/accept pattern: Bob creates a TransferProposal for his Iou to Carol, Carol accepts it, resulting in a new Iou owned by Carol (the original archived). This pattern is important because in real Daml, both signatories must authorize, so the owner can't unilaterally transfer to a party who hasn't consented.
Before marking this exercise complete, answer these to yourself:
Transfer (which acts unilaterally) and Accept (which requires two steps)?(Click each line to mark it read. Purely for your own tracking.)