forked from completium/try-archetype
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6-state_machine.arl
More file actions
33 lines (27 loc) · 1.01 KB
/
6-state_machine.arl
File metadata and controls
33 lines (27 loc) · 1.01 KB
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
archetype state_machine
states =
| Created initial
| InProgress
| Interrupted
| Completed
variable value : nat = 0
entry inc_value () {
value += 1
}
transition init () {
from Created to InProgress
when { transferred > 3tz }
with effect { () /* nothing */}
}
/////////////////////////////////////////////////////////////////////
// //
// FIXME: implement transitions //
// ** from InProgress to Completed when value > 1 //
// and transfer balance to caller //
// ** from InProgress to Completed and transfer 50% of balance //
// to caller //
// //
/////////////////////////////////////////////////////////////////////
// Solution at the following address:
// https://completium.com/docs/contract/tuto/archetype-statem
// (ctrl+click to follow link)