diff --git a/Marlowe_Plutus_Pioneers_June_2021.pdf b/Marlowe_Plutus_Pioneers_June_2021.pdf new file mode 100644 index 0000000..7dc63b4 Binary files /dev/null and b/Marlowe_Plutus_Pioneers_June_2021.pdf differ diff --git a/README.md b/README.md index 9fc4ee3..1ddd278 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,12 @@ - Property based testing with `QuickCheck`. - Testing Plutus contracts with property based testing. +- [Lecture #9](https://youtu.be/-RpCqHuxfQQ) + + - Marlowe overview ([slides](Marlowe_Plutus_Pioneers_June_2021.pdf)) + - Marlowe in Plutus + - Marlowe Playground demo + ## Code Examples - Lecture #1: [English Auction](code/week01) @@ -61,6 +67,7 @@ - Lecture #6: [Oracles](code/week06) - Lecture #7: [State Machines](code/week07) - Lecture #8: [Testing](code/week08) +- Lecture #9: [Marlowe](code/week09) ## Exercises @@ -112,6 +119,11 @@ retrieve all remaining funds (including the NFT). - Modify the tests accordingly. +- Week #9 + + - Modify the example Marlowe contract, so that Charlie must put down twice the deposit in the very beginning, + which gets split between Alice and Bob if Charlie refuses to make his choice. + ## Solutions - Week #2 @@ -138,8 +150,15 @@ - [`RockPaperScissors`](code/week07/src/Week07/RockPaperScissors.hs) - [`TestRockPaperScissors`](code/week07/src/Week07/TestRockPaperScissors.hs) +- Week #8 + + - [`TokenSaleWithClose`](code/week08/src/Week08/TokenSaleWithClose.hs) + - [`ModelWithClose`](code/week08/test/Spec/ModelWithClose.hs) + - [`TraceWithClose`](code/week08/test/Spec/TraceWithClose.hs) + ## Some Plutus Modules +- [`Language.Marlowe.Semantics`](https://github.com/input-output-hk/plutus/blob/master/marlowe/src/Language/Marlowe/Semantics.hs), contains Marlowe types and semantics. - [`Plutus.Contract.StateMachine`](https://github.com/input-output-hk/plutus/blob/master/plutus-contract/src/Plutus/Contract/StateMachine.hs), contains types and functions for using state machines. - [`Plutus.Contract.Test`](https://github.com/input-output-hk/plutus/blob/master/plutus-contract/src/Plutus/Contract/Test.hs), provides various ways to write tests for Plutus contracts. - [`Plutus.Contract.Test.ContractModel`](https://github.com/input-output-hk/plutus/blob/master/plutus-contract/src/Plutus/Contract/Test/ContractModel.hs), support for property based testing of Plutus contracts. diff --git a/code/week09/app/homework.hs b/code/week09/app/homework.hs deleted file mode 100644 index 72c5a12..0000000 --- a/code/week09/app/homework.hs +++ /dev/null @@ -1,64 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -import Language.Marlowe.Extended - -main :: IO () -main = print . pretty $ contract "Charles" "Simon" "Alex" $ Constant 100 - -choiceId :: Party -> ChoiceId -choiceId p = ChoiceId "Winner" p - -contract :: Party -> Party -> Party -> Value -> Contract -contract alice bob charlie deposit = - When - [ f alice bob - , f bob alice - ] - 10 Close - where - f :: Party -> Party -> Case - f x y = - Case - (Deposit - x - x - ada - deposit - ) - (When - [Case - (Deposit - y - y - ada - deposit - ) - (When - [Case - (Choice - (choiceId charlie) - [Bound 1 2] - ) - (If - (ValueEQ - (ChoiceValue $ choiceId charlie) - (Constant 1) - ) - (Pay - bob - (Account alice) - ada - deposit - Close - ) - (Pay - alice - (Account bob) - ada - deposit - Close - ) - )] - 30 Close - )] - 20 Close - ) diff --git a/code/week09/hie.yaml b/code/week09/hie.yaml index b9631b7..a619b3b 100644 --- a/code/week09/hie.yaml +++ b/code/week09/hie.yaml @@ -2,5 +2,3 @@ cradle: cabal: - path: "./app/marlowe.hs" component: "exe:marlowe" - - path: "./app/homework.hs" - component: "exe:homework" diff --git a/code/week09/plutus-pioneer-program-week09.cabal b/code/week09/plutus-pioneer-program-week09.cabal index a22f094..9026fbc 100644 --- a/code/week09/plutus-pioneer-program-week09.cabal +++ b/code/week09/plutus-pioneer-program-week09.cabal @@ -15,11 +15,3 @@ executable marlowe , marlowe default-language: Haskell2010 ghc-options: -Wall -O2 - -executable homework - hs-source-dirs: app - main-is: homework.hs - build-depends: base ^>=4.14.1.0 - , marlowe - default-language: Haskell2010 - ghc-options: -Wall -O2