This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A game with two players. Player 1 thinks of a secret word | |
-- and uses its hash, and the game validator script, to lock | |
-- some funds (the prize) in a pay-to-script transaction output. | |
-- Player 2 guesses the word by attempting to spend the transaction | |
-- output. If the guess is correct, the validator script releases the funds. | |
-- If it isn't, the funds stay locked. | |
import Control.Monad (void) | |
import qualified Data.ByteString.Char8 as C | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A game with two players. Player 1 thinks of a secret word | |
-- and uses its hash, and the game validator script, to lock | |
-- some funds (the prize) in a pay-to-script transaction output. | |
-- Player 2 guesses the word by attempting to spend the transaction | |
-- output. If the guess is correct, the validator script releases the funds. | |
-- If it isn't, the funds stay locked. | |
import Control.Monad (void) | |
import qualified Data.ByteString.Char8 as C | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A game with two players. Player 1 thinks of a secret word | |
-- and uses its hash, and the game validator script, to lock | |
-- some funds (the prize) in a pay-to-script transaction output. | |
-- Player 2 guesses the word by attempting to spend the transaction | |
-- output. If the guess is correct, the validator script releases the funds. | |
-- If it isn't, the funds stay locked. | |
import Control.Monad (void) | |
import qualified Data.ByteString.Char8 as C | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A game with two players. Player 1 thinks of a secret word | |
-- and uses its hash, and the game validator script, to lock | |
-- some funds (the prize) in a pay-to-script transaction output. | |
-- Player 2 guesses the word by attempting to spend the transaction | |
-- output. If the guess is correct, the validator script releases the funds. | |
-- If it isn't, the funds stay locked. | |
import Control.Monad (void) | |
import qualified Data.ByteString.Char8 as C | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A game with two players. Player 1 thinks of a secret word | |
-- and uses its hash, and the game validator script, to lock | |
-- some funds (the prize) in a pay-to-script transaction output. | |
-- Player 2 guesses the word by attempting to spend the transaction | |
-- output. If the guess is correct, the validator script releases the funds. | |
-- If it isn't, the funds stay locked. | |
import Control.Monad (void) | |
import qualified Data.ByteString.Char8 as C | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Vesting scheme as a PLC contract | |
import Control.Monad (void, when) | |
import qualified Data.Map as Map | |
import qualified Data.Text as T | |
import Language.Plutus.Contract hiding (when) | |
import qualified Language.Plutus.Contract.Typed.Tx as Typed | |
import qualified Language.PlutusTx as PlutusTx | |
import Language.PlutusTx.Prelude hiding (Semigroup (..), fold) | |
import Ledger (Address, PubKeyHash, Slot (Slot), Validator, pubKeyHash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Escrow where | |
import Language.Marlowe | |
main :: IO () | |
main = print . pretty $ contract | |
{- What does the vanilla contract look like? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Escrow where | |
import Language.Marlowe | |
main :: IO () | |
main = print . pretty $ contract | |
{- What does the vanilla contract look like? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(When [(Case (Deposit (Role "alice") (Role "alice") (Token "" "") (Constant 450)) (When [(Case (Choice (ChoiceId "choice" (Role "alice")) [(Bound 0 1)]) (When [(Case (Choice (ChoiceId "choice" (Role "bob")) [(Bound 0 1)]) (If (ValueEQ (ChoiceValue (ChoiceId "choice" (Role "alice"))) (ChoiceValue (ChoiceId "choice" (Role "bob")))) (If (ValueEQ (ChoiceValue (ChoiceId "choice" (Role "alice"))) (Constant 0)) (Pay (Role "alice") (Party (Role "bob")) (Token "" "") (Constant 450) Close) Close) (When [(Case (Choice (ChoiceId "choice" (Role "carol")) [(Bound 1 1)]) Close),(Case (Choice (ChoiceId "choice" (Role "carol")) [(Bound 0 0)]) (Pay (Role "alice") (Party (Role "bob")) (Token "" "") (Constant 450) Close))] 100 Close)))] 60 (When [(Case (Choice (ChoiceId "choice" (Role "carol")) [(Bound 1 1)]) Close),(Case (Choice (ChoiceId "choice" (Role "carol")) [(Bound 0 0)]) (Pay (Role "alice") (Party (Role "bob")) (Token "" "") (Constant 450) Close))] 100 Close)))] 40 (When [(Case (Choice (ChoiceId "choice" (Role "carol")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xml xmlns="https://developers.google.com/blockly/xml"><block type="BaseContractType" id="root_contract" deletable="false" x="13" y="187"><statement name="BaseContractType"><block type="WhenContractType" id="2Vyo!/1A*onBm@4__HV5"><field name="timeout">10</field><statement name="case"><block type="DepositActionType" id="_J5mua{UXj,WM6GUz;$_"><value name="from_party"><block type="RolePartyType" id="}#+4/lxE}U.mk=_n-3r/"><field name="role">alice</field></block></value><value name="value"><block type="ConstantValueType" id="{wn3:O+(:LBr98m~_a85"><field name="constant">350</field></block></value><value name="token"><block type="AdaTokenType" id="=eMx7YSJ8(znSxjcqJ-Z"/></value><value name="party"><block type="RolePartyType" id="jj$GMl/u)#+|,aYf@/qA"><field name="role">alice</field></block></value><statement name="contract"><block type="WhenContractType" id="b8sgwoSNX@uE{HlN9eMe"><field name="timeout">40</field><statement name="case"><block type="ChoiceActionType" id="*@@p^dT[fQ8%0T)#-bRL"><field name="choice_name"> |