Directory / marlowe / checklist.md
You are browsing a mirror of a file hosted on GitHub. View original
Converting Marlowe contracts from v1.3 to v2.0
The overview describes the differences between Marlowe 2.0 and Marlowe 1.3; here that information is presented as a checklist for converting contracts between v1.3 and v2.0.
Checklist
CommitCash
expressions inContract
:Rename the constructor to
Commit
.An action id field needs to be added as the first field of the constructor. As long as it is unique within the contract, the particular value is not relevant to the behaviour of the contract, but is used in constructing inputs, e.g. in Meadow.
The amount of money to be comitted must be converted from type
Money
to typeValue
, see item 3.Pay
constructs inContract
:An action id field needs to replace the payment id as the first field of the constructor. Note that this must be unique within the contract.
The
Person
making the contract is no longer a field; this is replaced by theIdCommit
of the commitment from which the payment is to be made.Payments originally had a single continuation
Contract
, irrespective of whether or not the construct had timed out. This is now distinguished, and so the original continuation should be duplicated.The amount of money to be paid must be converted from type
Money
to typeValue
, see item 3.Expressions of type
Money
should be renamed to their corresponding expressions of typeValue
:Marlowe 1.3 Marlowe 2.0 AvailableMoney Committed AddMoney AddValue ConstMoney Constant MoneyFromChoice ValueFromChoice Redeem
expressions inContract
:The
Redeem
constructor has been removed, and it should be replaced by aPay
constructor. This will be a payment from the commitment to the person who made the commitment initially.More details of how to construct payments in v2.0 are given above, but note that the extra information required will include an action id, a timeout, and a continuation to use if the timeout is exceeded.
Choices:
Identifiers for choices now include the choice and the participant as part of the identifier as described in the overview document. This affects
Observation
s andMoney
expressions that depend on choices:PersonChoseThis idCh per c
becomesChoseThis (idCh, per) c
PersonChoseSomething idCh per c
becomesChoseSomething (idCh, per) c
MoneyFromChoice idCh per val
becomesValueFromChoice (idCh, per) val
Where to go to find out more
The discussions about embedded Marlowe in the tutorials: v1.3, v2.0, give a complete example of a contract in both versions of the language.
Here are tutorials on Marlowe v1.3 and Marlowe v2.0, and Meadow in the cloud.
The semantics of Marlowe 2.0 can be found here.