mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
8830eaa2ec
You definitely want to review this with whitespace disabled. changelog_begin changelog_end
41 lines
902 B
Haskell
41 lines
902 B
Haskell
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
-- SPDX-License-Identifier: Apache-2.0
|
|
|
|
module PlatformIndependence where
|
|
|
|
import DA.Stack
|
|
|
|
type AssetId = ContractId Asset
|
|
|
|
data ADT
|
|
= Foo
|
|
| Bar
|
|
| Baz
|
|
|
|
give : HasCallStack => Party -> Party -> Text -> Update (ContractId Asset)
|
|
give issuer owner name = do
|
|
let fs = [ srcLocFile srcLoc | (_t, srcLoc) <- getCallStack callStack]
|
|
trace (show fs) $ create Asset{..}
|
|
|
|
incompletePattternMatch : ADT -> Update ()
|
|
incompletePattternMatch adt =
|
|
case adt of
|
|
Foo -> pure ()
|
|
Bar -> pure ()
|
|
|
|
template Asset
|
|
with
|
|
issuer : Party
|
|
owner : Party
|
|
name : Text
|
|
where
|
|
ensure name /= ""
|
|
signatory issuer
|
|
choice Give : AssetId
|
|
with
|
|
newOwner : Party
|
|
controller owner
|
|
do incompletePattternMatch Baz
|
|
create this with
|
|
owner = newOwner
|