From 926339ecf4730eb7243dd9631a6b5131a8e25240 Mon Sep 17 00:00:00 2001 From: Alexander Nemish Date: Wed, 24 Jun 2020 12:59:12 +0300 Subject: [PATCH] wip --- marlowe/src/Language/Marlowe/Client3.hs | 5 +++-- marlowe/test/Spec/Marlowe/Marlowe2.hs | 10 ++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/marlowe/src/Language/Marlowe/Client3.hs b/marlowe/src/Language/Marlowe/Client3.hs index 94b2b9a5b80..a3bcad40950 100644 --- a/marlowe/src/Language/Marlowe/Client3.hs +++ b/marlowe/src/Language/Marlowe/Client3.hs @@ -81,7 +81,8 @@ marloweContract2 :: forall e. (AsContractError e ) => Contract MarloweSchema e () marloweContract2 = do - create `select` apply {- <|> void sub -} + -- create `select` apply {- <|> void sub -} + (create `select` sub) >> apply where create = do -- traceM "Here create" @@ -100,7 +101,7 @@ marloweContract2 = do -- traceM "Here apply" (params, inputs) <- endpoint @"apply-inputs" @(MarloweParams, [Input]) @MarloweSchema -- traceM $ "Here endpoint " <> show inputs - MarloweData{..} <- applyInputs params inputs + MarloweData{..} <- applyInputs params inputs case marloweContract of Close -> pure () _ -> void apply diff --git a/marlowe/test/Spec/Marlowe/Marlowe2.hs b/marlowe/test/Spec/Marlowe/Marlowe2.hs index 8a6123839cd..0b576db4694 100644 --- a/marlowe/test/Spec/Marlowe/Marlowe2.hs +++ b/marlowe/test/Spec/Marlowe/Marlowe2.hs @@ -35,7 +35,7 @@ tests = testGroup "token account" ) ( callEndpoint @"create" w1 (defaultMarloweParams, Close) >> handleBlockchainEvents w1 ) - , -}zeroCouponBondTest + , -}zeroCouponBondTest1 ] zeroCouponBondTest :: TestTree @@ -64,8 +64,8 @@ zeroCouponBondTest = checkPredicate @MarloweSchema @MarloweError "ZCB" marloweCo handleBlockchainEvents alice -{- zeroCouponBondTest :: TestTree -zeroCouponBondTest = checkPredicate @MarloweSchema @MarloweError "ZCB" marloweContract2 +zeroCouponBondTest1 :: TestTree +zeroCouponBondTest1 = checkPredicate @MarloweSchema @MarloweError "ZCB" marloweContract2 (assertNoFailedTransactions -- /\ emulatorLog (const False) "" /\ assertDone w1 (const True) "contract should close" @@ -87,6 +87,7 @@ zeroCouponBondTest = checkPredicate @MarloweSchema @MarloweError "ZCB" marloweCo [ Case (Deposit aliceAcc bobPk ada (Constant 1000_000_000)) Close] (Slot 200) Close ))] (Slot 100) Close callEndpoint @"create" alice (params, zeroCouponBond) + callEndpoint @"sub" bob (params) -- notifyInterestingAddresses alice -- notifyInterestingAddresses bob -- addBlocks 10 @@ -102,7 +103,6 @@ zeroCouponBondTest = checkPredicate @MarloweSchema @MarloweError "ZCB" marloweCo addBlocks 5 notifySlot alice handleBlockchainEvents alice - handleUtxoQueries alice callEndpoint @"apply-inputs" alice (params, [IDeposit aliceAcc alicePk ada 850_000_000]) addBlocks 3 @@ -119,7 +119,6 @@ zeroCouponBondTest = checkPredicate @MarloweSchema @MarloweError "ZCB" marloweCo -- notifySlot bob -- callEndpoint @"sub" alice (alicePk) -- callEndpoint @"sub" bob (alicePk) - callEndpoint @"sub" bob (params) addBlocks 3 notifySlot bob handleBlockchainEvents bob @@ -131,7 +130,6 @@ zeroCouponBondTest = checkPredicate @MarloweSchema @MarloweError "ZCB" marloweCo handleBlockchainEvents bob -- callEndpoint @"apply-inputs" alice (params, [IDeposit aliceAcc bobPk ada 850_000_000]) -- handleBlockchainEvents bob - -} w1, w2 :: Wallet