-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathescrow_basic.arl
More file actions
52 lines (39 loc) · 984 Bytes
/
escrow_basic.arl
File metadata and controls
52 lines (39 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
archetype escrow_basic
variable buyer : address = @tz1bfVgcJC4ukaQSHUe1EbrUd5SekXeP9CWk
variable seller : address = @tz1Lc2qBKEWCBeDU8npG6zCeCqpmaegRi6Jg
variable oracle : address = @tz1iawHeddgggn6P5r5jtq2wDRqcJVksGVSa
variable price : tez = 10tz
(* action deadline *)
variable deadline : date = 2019-06-01T00:00:00
(* state machine *)
states =
| Created initial
| Aborted with { i1 : balance = 0tz; }
| Confirmed with { i2 : balance = price; }
| Canceled with { i3 : balance = 0tz; }
| Completed with { i4 : balance = 0tz; }
transition abort () {
called by buyer or seller
from Created
to Aborted
}
transition confirm () {
from Created
to Confirmed when { balance = price }
}
transition complete () {
called by oracle
from Confirmed
to Completed when { now < deadline }
with effect {
transfer price to seller
}
}
transition cancel () {
called by oracle
from Confirmed
to Canceled
with effect {
transfer price to buyer
}
}