Creating Digital Currency using Daml Finance

Hi @Frankie,

that flow is LGTM.

Fyi, we’ve implemented a workaround for keying Instrument.I (and Account.I) interfaces, given that keys are currently not supported in interfaces. Here’s how it works:

Each instance of an Instrument.I implementation is always created concurrently with a Reference template instance that has a key. This creations occur as a single atomic action. The Reference instance includes a ContractId Instrument.I field, essentially serving as a pointer to the corresponding Instrument.I instance. We also have our own, e.g., exerciseInterfaceByKey, utility functions in place that work using the Reference template instances.

For this to function properly, it’s assumed that the issuer and depository of the Instrument.I will not create Instrument instances without corresponding Reference instances, and it’s crucial that any updates to the Instrument.I instance are mirrored in the Reference to maintain consistency.

You are right that it is indeed possible to create multiple Instrument instances with the same ID and version. However, this is only feasible if you do not create the Reference instance concurrently.

For more details on this workaround, please refer to the the following forum discussion 5374.

I hope that helps,

Johan