Skip to content
Discussions/App Development/Is it possible to alter the behavior of the default Archive choice for a contract?Forum ↗

Is it possible to alter the behavior of the default Archive choice for a contract?

App Development5 posts292 views1 likesLast activity Jan 2023
BF
bfdaml9OP
Jan 2023

Hi all :slight_smile: I am trying to add an assertion to the archive choice so that I restrict its execution, this may not be the best idea but is it possible to do in the first place?
Adding a choice named “Archive” gives the following error
: error:
Multiple declarations of ‘_choice_TemplateNameArchive’
Declared at:

Thank you

CO
cocreature
Jan 2023

No you cannot change the Archive choice. This is deliberate: If all signatories agree a contract can always be archived. Even without a specific choice, the signatories could all delete it, e.g., using the repair functionality in Canton Repairing Nodes — Daml SDK 2.5.0 documentation.

So if you want to put a restriction on it usually the solution is to instead add more parties as signatories to ensure that noone can archive the contract while it is still important to others.

SH
Shaul
Jan 2023

@bfdaml9 if you can share, I’d be interested to understand more about the types of assertions and restrictions you want to put in place.
Depending on your goal, we have a few things on our roadmap that may be better alternatives.

BF
bfdaml9
Jan 2023

Thanks for the response :slight_smile:
My idea is to be able to treat the archiving choice as any other choice practiced on the contract. So by using any assertion method (assertMsg for example), I can prevent the archiving unless a condition is satisfied.

CO
cocreature
Jan 2023

In Daml you always rely on the signatories to uphold such guarantees. Is there a party or a group of parties that you can rely on to enforce that assertion? If so, add those as signatories and that way the default archive can only be called if they agree (which can mean it can never be called if that’s what those parties want) and instead you have a separate choice that has the assertion you’re looking for.

← Back to Discussions