Skip to content
Permalink
Browse files

headings in escrow example v2.0

  • Loading branch information...
simonjohnthompson committed Apr 11, 2019
1 parent faa7115 commit f147b68569629efe3576fc9497ec51fda90b8e0b
Showing with 9 additions and 1 deletion.
  1. +9 −1 docs/tutorial-v2.0/escrow-ex.md
@@ -34,6 +34,8 @@ The second contract is itself a `Choice` depending on whether or not there has b

In order to make sure that the contract does indeed progress properly, we will add timeouts and commitments to is, and this will give the first example of a Marlowe contract.

### Adding timeouts

First, let us examine how to modify what we have written to take care of the case that the condition of the `When` never becomes true. We add two fields to the contract
```haskell
(When (OrObs (two_chose alice bob carol refund)
@@ -66,6 +68,8 @@ Note also that the contract identifies the commitment from which the payment is
The contract also _identifies_ the payment with the identifier `2`.
-->

### Adding commitments

Next, we should look at how _cash is committed_ as the first step of the contract.

```haskell
@@ -81,6 +85,8 @@ Commit iCC1 alice (Constant 450) 10 100 -- ADDED
```
The commitment requested from `alice` is given an identifier, `iCC1`. The cash value (`450`) and timeout (`100`) on the commitment are also specified. Moreover, a _timeout on making the commitment_, `10`, is specified as part of the contract, too, as well as a contract to be followed if the commitment is not forthcoming: that is `Null` in this case.

### Identifiers

Finally, we have to add _action identifiers_ to each instance of an action, that is to each `Commit` and `Pay`. These action ids, which could be generated automatically by an implementation of Marlowe, must occur once only in each contract. Their role is to allow inputs, such as commitments of cash by a participant, to be linked to a unique point in the contract.

We will see [later](./embedded-marlowe.md) that parts of this contract description, such as `redeem_original`, use the Haskell embedding of Marlowe to give some shorthand definitions. In this case the redemption is defined in terms of `Pay` and so id’s need to be supplied to that construct too. With identifiers, the full contract becomes
@@ -110,12 +116,14 @@ This example has shown many of the ingredients of the Marlowe contract language;

### Notes

- While identifiers need to be provided manually in the example here, these could be generated by users’ wallets in a version of Marlowe deployed on a blockchain.
- Many of the items used here, including, for example `alice` and `two_chose`, and defined using the embedded DSL, which is discussed in more detail when we look at [embedded Marlowe](./embedded-marlowe.md).

- While identifiers need to be provided manually in the example here, these could be generated by users’ wallets in a version of Marlowe deployed on a blockchain.

## Where to go to find out more

- [Composing contracts: an adventure in financial engineering](https://www.microsoft.com/en-us/research/publication/composing-contracts-an-adventure-in-financial-engineering/)

- [Certified symbolic management of financial multi-party contracts](https://dl.acm.org/citation.cfm?id=2784747)


0 comments on commit f147b68

Please sign in to comment.
You can’t perform that action at this time.