I am researching the example around multi-party agreement
I was wondering if there is a way to combine the Sign and Finalize Choices below into 1 Choice.
The rational for this is that in this case no other logic would need to reside on when to call the “Sign Choice” versus the “Finalize Choice” in any connecting originating systems.
choice Sign : ContractId Pending with
signer : Party
controller signer
do
-- Check the controller is in the toSign list, and if they are, sign the Pending contract
assert (signer `elem` toSign)
create this with alreadySigned = signer :: alreadySigned
choice Finalize : ContractId Agreement with
signer : Party
controller signer
do
-- Check that all the required signatories have signed Pending
assert (sort alreadySigned == sort finalContract.signatories)
create finalContract
An alternative way would be to write a trigger, but wondered if there is maybe a way to accomplish this just inside DAML
Any thoughts ?