Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE OverloadedStrings #-}
module Escrow where
import Language.Marlowe
main :: IO ()
main = print . pretty $ contract
{- What does the vanilla contract look like?
@simonjohnthompson
simonjohnthompson / Main.hs
Last active October 28, 2020 11:46
Analysis example
{-# LANGUAGE OverloadedStrings #-}
module Example where
import Language.Marlowe
main :: IO ()
main = print . pretty $ contract
{- Define a contract, Close is the simplest contract which just ends the contract straight away
@simonjohnthompson
simonjohnthompson / Main.hs
Last active October 27, 2020 11:56
Kraken
{-# LANGUAGE OverloadedStrings #-}
module Example where
import Language.Marlowe
main :: IO ()
main = print . pretty $ contract
{- Define a contract, Close is the simplest contract which just ends the contract straight away
@simonjohnthompson
simonjohnthompson / Main.hs
Created March 23, 2021 17:22 — forked from palas/Main.hs
Swap
{-# LANGUAGE OverloadedStrings #-}
module Escrow where
import Language.Marlowe.Extended
main :: IO ()
main = print . pretty $ contract
-- We can set explicitRefunds True to run Close refund analysis
-- but we get a shorter contract if we set it to False
@simonjohnthompson
simonjohnthompson / Main.hs
Created March 23, 2021 17:22 — forked from palas/Main.hs
Zero Coupon Bond
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}
module ZeroCouponBond where
import Language.Marlowe.Extended
main :: IO ()
main = print . pretty $ contract
discountedPrice, notional :: Value
@simonjohnthompson
simonjohnthompson / Main.hs
Created March 23, 2021 17:22 — forked from palas/Main.hs
Escrow with collateral
{-# LANGUAGE OverloadedStrings #-}
module Escrow where
import Language.Marlowe.Extended
main :: IO ()
main = print . pretty $ contract
-- We can set explicitRefunds True to run Close refund analysis
-- but we get a shorter contract if we set it to False
@simonjohnthompson
simonjohnthompson / Main.hs
Created March 23, 2021 17:22 — forked from palas/Main.hs
Simple escrow
{-# LANGUAGE OverloadedStrings #-}
module Escrow where
import Language.Marlowe.Extended
main :: IO ()
main = print . pretty $ contract
-- We can set explicitRefunds True to run Close refund analysis
-- but we get a shorter contract if we set it to False
@simonjohnthompson
simonjohnthompson / metadata.json
Created March 23, 2021 17:29
Simple escrow - SJT revised.
{"valueParameterDescriptions":[["Price","Amount to be paid by the \"Buyer\" for the item."]],"slotParameterDescriptions":[["Buyer's deposit timeout","Deadline by which the \"Buyer\" must deposit the selling \"Price\" in the contract."],["Buyer's dispute timeout","Deadline by which, if the \"Buyer\" has not opened a dispute, the \"Seller\" will be paid."],["Seller's response timeout","Deadline by which, if the \"Seller\" has not responded to the dispute, the \"Buyer\" will be refunded."],["Timeout for arbitrage","Deadline by which, if the \"Arbiter\" has not resolved the dispute, the \"Buyer\" will be refunded."]],"roleDescriptions":[["Arbiter","The party that will choose who gets the money in the event of a disagreement between the \"Buyer\" and the \"Seller\" about the outcome."],["Buyer","The party that wants to buy the item. Payment is made to the seller if they acknowledge receiving the item. "],["Seller","The party that wants to sell the item. They receive the payment if the exchange is uneventful."]],"
@simonjohnthompson
simonjohnthompson / metadata.json
Created March 23, 2021 17:48
Escrow with collateral - SJT revised.
{"valueParameterDescriptions":[["Collateral amount","The amount to be deposited by both parties at the start of the contract to serve as an incentive for collaboration."],["Price","The amount to be paid by the \"Buyer\" as part of the exchange."]],"slotParameterDescriptions":[["Collateral deposit by seller timeout","The deadline by which the \"Seller\" must deposit the \"Collateral amount\" in the contract."],["Deposit of collateral by buyer timeout","The deadline by which the \"Buyer\" must deposit the \"Collateral amount\" in the contract."],["Deposit of price by buyer timeout","The deadline by which the \"Buyer\" must deposit the \"Price\" in the contract."],["Dispute by buyer timeout","The deadline by which, if the \"Buyer\" has not opened a dispute, the \"Seller\" will be paid."],["Seller's response timeout","The deadline by which, if the \"Seller\" has not responded to the dispute, the \"Buyer\" will be refunded."]],"roleDescriptions":[["Buyer","The party that pays for the item on sale."],["Seller","The
@simonjohnthompson
simonjohnthompson / metadata.json
Created March 23, 2021 17:52
Zero Coupon Bond - SJT revised.
{"valueParameterDescriptions":[["Discounted price","The price of the Zero Coupon Bond at the start date."],["Notional","The full price of the Zero Coupon Bond."]],"slotParameterDescriptions":[["Initial exchange deadline","The \"Investor\" must deposit the discounted price of the bond before this deadline or the offer will expire."],["Maturity exchange deadline","The \"Issuer\" must deposit the full price of the bond before this deadline or it will default."]],"roleDescriptions":[["Investor","The party that buys the bond at a discounted price, i.e. makes the loan."],["Issuer","The party that issues the bond, i.e. receives the loan."]],"contractType":"ZC","contractName":"Zero Coupon Bond","contractDescription":"A simple loan. The investor pays the issuer the discounted price at the start, and is repaid the full (notional) price at the end.","choiceDescriptions":[]}