|When Case list Timeout Contract
|Let ValueId Value Contract
|Assert Observation Contract
Close is the simplest contract, when we evaluate it, the execution is completed
and we generate Payments §?? for the assets in the internal accounts to their
default owners 3.
The contract Payaptvc, generates a Payment from the internal account a
to a payee §2.1.3 pof #v Tokens and then continues to contract c. Warnings
will be generated if the value vis not positive, or if there is not enough in the
account to make the payment in full. In the latter case, a partial payment
(of the available amount) is made
The contract If obs x y allows branching. We continue to branch xif the
Observation obs evaluates to true, or to branch yotherwise.
When is the most complex constructor for contracts, with the form When cs
t c. The list cs contains zero or more pairs of Actions and Contract continu-
ations. When we do a computeTransaction §2.2.1, we follow the continuation
associated to the first Action that matches the Input. If no action is matched
it returns a ApplyAllNoMatchError. If a valid Transaction is computed with
aTimeInterval with a start time bigger than the Timeout t, the contingency
continuation cis evaluated. The explicit timeout mechanism is what allows
Marlowe to avoid waiting forever for external inputs.
ALet contract Let i v c allows a contract to record a value using an identifier
i. In this case, the expression vis evaluated, and the result is stored with
the name i. The contract then continues as c. As well as allowing us to
use abbreviations, this mechanism also means that we can capture and save
volatile values that might be changing with time, e.g. the current price of oil,
or the current time, at a particular point in the execution of the contract, to
be used later on in contract execution.
An assertion contract Assert b c does not have any effect on the state of
the contract, it immediately continues as c, but it issues a warning if the
observation bevaluates to false. It can be used to ensure that a property
holds in a given point of the contract, since static analysis will fail if any
execution causes a warning. The Assert term might be removed from future
on-chain versions of Marlowe.
3Even if the payments are generated one at a time (per account and per Token), the
cardano implementation generates a single transaction
13