Not sure why the parsing error on line 42(trade_create_usBank parties = do)
-- Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
module TestScript where
import Daml.Script
import Iou
import IouTrade()
data Parties = Parties with
alice : Party
bob : Party
usBank : Party
eurBank : Party
trade_create_eurBank : Parties ->Script (ContractId Iou)
trade_create_eurBank parties = do
submit parties.eurBank do
createCmd Iou with
issuer = parties.eurBank
owner = parties.eurBank
currency = "EUR"
amount = 100.0
observers = []
trade_exercise_iouTransfer_eurBank : ContractId Iou -> Script ()
trade_exercise_iouTransfer_eurBank cid_iou = do
let Some alice = partyFromText "Alice"
let Some bob = partyFromText "Bob"
let Some usBank = partyFromText "USD_Bank"
let Some eurBank = partyFromText "EUR_Bank"
iouTransferAliceCid <- submit eurBank do
exerciseCmd cid_iou Iou_Transfer with newOwner = alice
pure ()
trade_create_usBank : Parties ->Script (ContractId Iou)
trade_create_usBank parties = do
submit parties.usBank do
createCmd Iou with
issuer = parties.usBank
owner = parties.usBank
currency = "USD"
amount = 110.0
observers = []
trade_exercise_iouTransfer_usBank : ContractId Iou -> Script ()
trade_exercise_iouTransfer_usBank cid_iou_us = do
let Some alice = partyFromText "Alice"
let Some bob = partyFromText "Bob"
let Some usBank = partyFromText "USD_Bank"
let Some eurBank = partyFromText "EUR_Bank"
iouTransferBobCid <- submit usBank do
exerciseCmd cid_iou_us Iou_Transfer with newOwner = bob
pure ()