daml/daml-lf/tests/DontDiscloseNonConsumingExercisesToObservers.daml
Gary Verhaegen a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00

34 lines
875 B
Haskell

-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
module DontDiscloseNonConsumingExercisesToObservers where
template NonObservable with
p : Party
obs : Party
where
signatory p
observer obs
controller p can
nonconsuming CreateEvent : ContractId Event
do create $ Event p
template Event with
p : Party
where
signatory p
-- Bob should not be able to fetch when DontDiscloseNonConsumingExercisesToObservers is set,
-- because he is only an observer and the choice CreateEventis non-consuming.
test_DontDiscloseNonConsumingExercisesToObervers = scenario do
alice <- getParty "alice"
bob <- getParty "bob"
cid <- submit alice $ do
c <- create $ NonObservable alice bob
exercise c CreateEvent
submitMustFail bob $ fetch cid