Skip to content
Discussions/App Development/Notification of parameters of an exercise of a nonconsuming choiceForum ↗

Notification of parameters of an exercise of a nonconsuming choice

App Development2 posts320 views5 likesLast activity Dec 2020
DA
DarkoOP
Dec 2020

Hi all,

I want to double-check my understanding regarding the visibility of choice parameters to observers in non-consuming choices.

Since observers do not get informed about the execution of a nonconsuming choice, they also do not see any parameters that have been passed into the choice, even if there is an archive within that choice.
Is that correct?

I have prepared an example below, and the question is, given the following code, does Charlie ever get to see privateData. Looking at the transaction graph I don’t believe he does, but I want to make sure.

module Main where

import Daml.Script

type PrivateResultId = ContractId PrivateResult

template PublicContract
  with
    partyA : Party
    parties  : [Party]
  where
    signatory partyA
    observer parties

    nonconsuming choice PrivateChoice : PrivateResultId with
        actor: Party
        privateData : Text
     controller actor
       do
         assert (actor `elem` parties)
         archive self
         create PrivateResult with privateData, signatories = [partyA, actor]
    
template PrivateResult
  with
    privateData : Text
    signatories : [Party]
  where
    signatory signatories

test : Script PrivateResultId
test = script do
  alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
  bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
  charlie <- allocatePartyWithHint "Charlie" (PartyIdHint "Charlie")

  aliceTV <- submit alice do
    createCmd PublicContract with
      partyA = alice
      parties = [bob, charlie]

  submit bob do
    exerciseCmd aliceTV PrivateChoice with actor = bob, privateData = "data"

Thanks!

CO
cocreature
Dec 2020
Darko:

Since observers do not get informed about the execution of a nonconsuming choice, they also do not see any parameters that have been passed into the choice, even if there is an archive within that choice.
Is that correct?

Yes that is correct, they will see the exercise of the Archive choice but nothing about the exercise of PrivateChoice.

← Back to Discussions