4 | | - | case dt: DataTransaction => |
---|
5 | | - | let gameNotStarted = match getInteger(dt.sender, "gameState") { |
---|
6 | | - | case i: Int => |
---|
7 | | - | false |
---|
8 | | - | case _ => |
---|
9 | | - | true |
---|
10 | | - | } |
---|
11 | | - | let oldGameState = extract(getInteger(dt.sender, "gameState")) |
---|
12 | | - | let newGameState = match getInteger(dt.data, "gameState") { |
---|
13 | | - | case k: Int => |
---|
14 | | - | k |
---|
15 | | - | case _ => |
---|
16 | | - | 7 |
---|
17 | | - | } |
---|
18 | | - | let validStep = ((oldGameState + 1) == newGameState) |
---|
19 | | - | let gameInitialization = if (if (gameNotStarted) |
---|
20 | | - | then (extract(getInteger(dt.data, "command")) == 0) |
---|
21 | | - | else false) |
---|
22 | | - | then (extract(getInteger(dt.data, "gameState")) == 0) |
---|
23 | | - | else false |
---|
24 | | - | let playersRegistration = if (if (if (validStep) |
---|
25 | | - | then (extract(getInteger(dt.data, "command")) == 1) |
---|
26 | | - | else false) |
---|
27 | | - | then (extract(getString(dt.data, "player1")) == "") |
---|
28 | | - | else false) |
---|
29 | | - | then (extract(getString(dt.data, "player2")) == "") |
---|
30 | | - | else false |
---|
31 | | - | let player1Registration = if (if (validStep) |
---|
32 | | - | then (extract(getInteger(dt.data, "command")) == 2) |
---|
33 | | - | else false) |
---|
34 | | - | then sigVerify(dt.bodyBytes, dt.proofs[0], fromBase58String(extract(getString(dt.data, "player1")))) |
---|
35 | | - | else false |
---|
36 | | - | let player2Registration = if (if (validStep) |
---|
37 | | - | then (extract(getInteger(dt.data, "command")) == 3) |
---|
38 | | - | else false) |
---|
39 | | - | then sigVerify(dt.bodyBytes, dt.proofs[0], fromBase58String(extract(getString(dt.data, "player2")))) |
---|
40 | | - | else false |
---|
41 | | - | let gameBegin = if (validStep) |
---|
42 | | - | then (extract(getInteger(dt.data, "command")) == 4) |
---|
43 | | - | else false |
---|
44 | | - | let move1 = if (if (if (validStep) |
---|
45 | | - | then (extract(getInteger(dt.data, "command")) == 5) |
---|
46 | | - | else false) |
---|
47 | | - | then (2 >= extract(getInteger(dt.data, "move1"))) |
---|
48 | | - | else false) |
---|
49 | | - | then sigVerify(dt.bodyBytes, dt.proofs[0], fromBase58String(extract(getString(dt.sender, "player1")))) |
---|
50 | | - | else false |
---|
51 | | - | let move2 = if (if (if (validStep) |
---|
52 | | - | then (extract(getInteger(dt.data, "command")) == 6) |
---|
53 | | - | else false) |
---|
54 | | - | then (2 >= extract(getInteger(dt.data, "move2"))) |
---|
55 | | - | else false) |
---|
56 | | - | then sigVerify(dt.bodyBytes, dt.proofs[0], fromBase58String(extract(getString(dt.sender, "player2")))) |
---|
57 | | - | else false |
---|
58 | | - | let gameEnd = if (if ((extract(getInteger(dt.sender, "gameState")) == 6)) |
---|
59 | | - | then (extract(getInteger(dt.data, "command")) == 7) |
---|
60 | | - | else false) |
---|
61 | | - | then (extract(getString(dt.data, "gameState")) == "ended") |
---|
62 | | - | else false |
---|
63 | | - | if (if (if (if (if (if (if (gameInitialization) |
---|
| 5 | + | case tx: DataTransaction => |
---|
| 6 | + | if (sigVerify(tx.bodyBytes, tx.proofs[0], KYCPublicKey)) |
---|