In Parties and Authority — Daml SDK 2.7.6 documentation, I just want to be know why the template IouTransferProposal
's IouTransferProposal_Reject
looks the same as the IouTransferProposal_Accept
. From a script I put together, and gut feeling, every time you reject a transfer, you end up with one more active IOU from the initial owner/issuer (same party).
I’d like to implement a Rejection-function, but to with this selection I’d like to archive the Proposal … since it’s rejected by at least one of the parties that need to accept it. I searched and found that changing from
IouTransferProposal_Reject
: ContractId Iou
do
create iou with
owner = newOwner
to something like
IouTransferProposal_Reject
: ()
do
return ()
does the job. Is this the standard way of archiving a contract upon rejection of a proposal?
Kind regards,
Hendré
1 Like
Hi @hendrehayman, if you only want to archive the proposal, then your choice would indeed do the trick. However, things are a bit more subtle here:
If you look at the ProposeTransfer
choice on the Iou
it will archive the Iou
contract and create a proposal instead. If the transfer is rejected, we don’t just want to archive the proposal, we also have to recreate the original Iou
:
ProposeTransfer
: ContractId IouTransferProposal
with
newOwner : Party
do
assertMsg "newOwner cannot be equal to owner." (owner /= newOwner)
create IouTransferProposal with
iou = this
newOwner
The Reject
and Accept
choices are indeed quite close, however there is a crucial difference: Reject
recreates the original Iou
without any changes. Accept
on the other hand changes the owner.
In the code this is the difference between the following two:
Reject
create iou
Accept
create iou with
owner = newOwner
1 Like