Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module Main where
import Daml.Script
template T2
with
alice : Party
reader : Party
where
signatory reader
observer reader
controller alice can
T2_FetchById : ()
with
cid : ContractId CurrentPrice
do
fetch cid
pure ()
controller alice can
T2_FetchByKey : ()
with
operator : Party
do
fetchByKey @CurrentPrice operator
pure ()
template CurrentPrice
with
operator : Party
reader : Party
where
signatory operator
observer reader
key operator : Party
maintainer key
s = script $ do
alice <- allocateParty "Alice"
operator <- allocateParty "Operator"
reader <- allocateParty "Reader"
cid <- operator `submit`
createCmd CurrentPrice with
operator = operator
reader = reader
t2 <- submit reader $
createCmd T2 with alice, reader
submitMulti [alice] [reader] $
exerciseCmd t2 T2_FetchByKey with operator
pure ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment