tx · HGZFn7rV6tHwSaiDZumdBS9ewMxCTaQjkXWtC658STP3
3MpdJJV3WyZufiGHRtb7xbY2Vsc2pBFcJYZ: -0.01400000 Waves
2021.05.12 16:19 [1522508] smart account 3MpdJJV3WyZufiGHRtb7xbY2Vsc2pBFcJYZ > SELF 0.00000000 Waves
{
"type": 13,
"id": "HGZFn7rV6tHwSaiDZumdBS9ewMxCTaQjkXWtC658STP3",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1620825561870,
"version": 1,
"sender": "3MpdJJV3WyZufiGHRtb7xbY2Vsc2pBFcJYZ",
"senderPublicKey": "ALG9JVGNn9aCL68dbg1AmW6yDQv1b8EDLq99pQS8L1k6",
"proofs": [
"5Z9BctCeMmwRM41SqgZnnogMM4PAGy6SzpzxkxX5gQfjubmdyKdQYRZPqQo2ra9c1f5oNhM6ewuMvP7fg7znm5WR"
],
"script": "base64:AAIEAAAAAAAAAAkIAhIAEgMKAQgAAAATAAAAABNnYW1lTWFzdGVyUHVibGljS2V5AQAAACCKqFcQ1VSNQa7ZONz4ZD59H7wLfuowVwcQ1qI/fK6ACwAAAAAKZGljZU51bWJlcgkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAIJAARMAAAAAgAAAAAAAAAAAwkABEwAAAACAAAAAAAAAAAECQAETAAAAAIAAAAAAAAAAAUJAARMAAAAAgAAAAAAAAAABgkABEwAAAACAAAAAAAAAAAHCQAETAAAAAIAAAAAAAAAAAgFAAAAA25pbAAAAAAJZ2FtZVRva2VuAQAAACCvQNOoGbkt3wVk9kpr+yD9dOUY7LBdGNCbLK5MVkSodQAAAAAJR0FNRVNUQVJUAAAAAAAAAAAAAAAAAA5HQU1FSU5QUk9HUkVTUwAAAAAAAAAAAQAAAAAMR0FNRUZJTklTSEVEAAAAAAAAAAACAAAAABBnYW1lQ291bnRlckxhYmVsAgAAAA1HX0dBTUVDT1VOVEVSAAAAABBnYW1lUGFzc0JldExhYmVsAgAAAAtCX1BBU1NCRVR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JAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAAOZ2FtZVN0YXRlTGFiZWwAAAABBQAAAAluZXdOdW1iZXIAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAABRnYW1lU3RhcnRIZWlnaHRMYWJlbAAAAAEFAAAACW5ld051bWJlcggFAAAACWxhc3RCbG9jawAAAAZoZWlnaHQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAD2dhbWVTdW1TaGFMYWJlbAAAAAEFAAAABm51bWJlcgkAAlgAAAABCQAB9wAAAAEJAAJbAAAAAQUAAAAKcmFuZG9tSGFzaAUAAAADbmlsCQAAAgAAAAECAAAACUlOSVRfTkVFRAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4CQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleUbBY7I=",
"chainId": 84,
"height": 1522508,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 6gK36wAP54nFVrp1p3ANaoAdXUMhkRrPyFHhwdNdvsiC
Next: 7z78JiN3D8bQ7oJ4SqWSE6nnG8ZBHYQPKT9fyhbLtnyM
Diff:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let gameMasterPublicKey = base58'ALG9JSGNn9aCL68dbg1AmW6yDQv1b8EDLq99pQS8L1k6' |
---|
| 4 | + | let gameMasterPublicKey = base58'ALG9JVGNn9aCL68dbg1AmW6yDQv1b8EDLq99pQS8L1k6' |
---|
| 5 | + | |
---|
| 6 | + | let diceNumber = [1, 2, 3, 4, 5, 6, 7, 8] |
---|
| 7 | + | |
---|
| 8 | + | let gameToken = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8' |
---|
| 9 | + | |
---|
| 10 | + | let GAMESTART = 0 |
---|
| 11 | + | |
---|
| 12 | + | let GAMEINPROGRESS = 1 |
---|
| 13 | + | |
---|
| 14 | + | let GAMEFINISHED = 2 |
---|
| 15 | + | |
---|
| 16 | + | let gameCounterLabel = "G_GAMECOUNTER" |
---|
| 17 | + | |
---|
| 18 | + | let gamePassBetLabel = "B_PASSBETS_" |
---|
| 19 | + | |
---|
| 20 | + | let gameCurrentPointLabal = "G_CurrentPoint_" |
---|
| 21 | + | |
---|
| 22 | + | let lastRolledNumber = 0 |
---|
5 | 23 | | |
---|
6 | 24 | | func authorizePermission (callerPublicKey) = (callerPublicKey != gameMasterPublicKey) |
---|
7 | 25 | | |
---|
8 | 26 | | |
---|
9 | | - | let diceNumbers = [1, 2, 3, 4, 5, 6, 7, 8] |
---|
10 | | - | |
---|
11 | | - | let GAMEINPROGRESS = 1 |
---|
12 | | - | |
---|
13 | | - | let GAMEFINISHED = 0 |
---|
14 | | - | |
---|
15 | | - | let gameCounterLabel = "G_GAMECOUNTER" |
---|
16 | | - | |
---|
17 | | - | let gameStateLabel = "G_STATE" |
---|
18 | | - | |
---|
19 | | - | let gameCurrentPointLabal = "G_CurrentPoint " |
---|
20 | | - | |
---|
21 | | - | let gameToken = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8' |
---|
22 | | - | |
---|
23 | | - | let lastRolledNumber = 0 |
---|
24 | | - | |
---|
25 | | - | func getGameStateLabel (gameCounter) = ((("G_" + toString(gameCounter)) + "_") + gameStateLabel) |
---|
| 27 | + | func gameStateLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_STATE") |
---|
26 | 28 | | |
---|
27 | 29 | | |
---|
28 | | - | func getGameState (gameCounter) = getInteger(this, getGameStateLabel(gameCounter)) |
---|
| 30 | + | func gameSumShaLabel (gameCounter) = ((("G_" + toString(gameCounter)) + "_") + "_SUMSHA") |
---|
| 31 | + | |
---|
| 32 | + | |
---|
| 33 | + | func gameStartHeightLabel (gameCounter) = ((("G_" + toString(gameCounter)) + "_") + "_STARTHEIGHT") |
---|
| 34 | + | |
---|
| 35 | + | |
---|
| 36 | + | func getGameState (gameCounter) = getInteger(this, gameStateLabel(gameCounter)) |
---|
| 37 | + | |
---|
| 38 | + | |
---|
| 39 | + | func getGameSumSha (gameCounter) = getString(this, gameSumShaLabel(gameCounter)) |
---|
| 40 | + | |
---|
| 41 | + | |
---|
| 42 | + | func getStartHeight (gameCounter) = getInteger(this, gameStartHeightLabel(gameCounter)) |
---|
29 | 43 | | |
---|
30 | 44 | | |
---|
31 | 45 | | func getCrapGameCounter () = getInteger(this, gameCounterLabel) |
---|
| 46 | + | |
---|
| 47 | + | |
---|
| 48 | + | func getRandomIndexForDice (randomHash) = diceNumber[(toInt(randomHash) % 8)] |
---|
32 | 49 | | |
---|
33 | 50 | | |
---|
34 | 51 | | @Callable(i) |
---|
|
38 | 55 | | case counter: Int => |
---|
39 | 56 | | throw("INIT_ALREADY_DONE") |
---|
40 | 57 | | case _ => |
---|
41 | | - | [IntegerEntry(gameCounterLabel, 1)] |
---|
| 58 | + | [IntegerEntry(gameCounterLabel, 0)] |
---|
| 59 | + | } |
---|
| 60 | + | |
---|
| 61 | + | |
---|
| 62 | + | |
---|
| 63 | + | @Callable(i) |
---|
| 64 | + | func startGame (randomHash) = if (authorizePermission(i.callerPublicKey)) |
---|
| 65 | + | then throw("startGame_FORBIDDEN") |
---|
| 66 | + | else match getCrapGameCounter() { |
---|
| 67 | + | case number: Int => |
---|
| 68 | + | let newNumber = (number + 1) |
---|
| 69 | + | [IntegerEntry(gameCounterLabel, newNumber), IntegerEntry(gameStateLabel(newNumber), 0), IntegerEntry(gameStartHeightLabel(newNumber), lastBlock.height), StringEntry(gameSumShaLabel(number), toBase58String(sha256(fromBase64String(randomHash))))] |
---|
| 70 | + | case _ => |
---|
| 71 | + | throw("INIT_NEED") |
---|
42 | 72 | | } |
---|
43 | 73 | | |
---|
44 | 74 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let gameMasterPublicKey = base58'ALG9JSGNn9aCL68dbg1AmW6yDQv1b8EDLq99pQS8L1k6' |
---|
| 4 | + | let gameMasterPublicKey = base58'ALG9JVGNn9aCL68dbg1AmW6yDQv1b8EDLq99pQS8L1k6' |
---|
| 5 | + | |
---|
| 6 | + | let diceNumber = [1, 2, 3, 4, 5, 6, 7, 8] |
---|
| 7 | + | |
---|
| 8 | + | let gameToken = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8' |
---|
| 9 | + | |
---|
| 10 | + | let GAMESTART = 0 |
---|
| 11 | + | |
---|
| 12 | + | let GAMEINPROGRESS = 1 |
---|
| 13 | + | |
---|
| 14 | + | let GAMEFINISHED = 2 |
---|
| 15 | + | |
---|
| 16 | + | let gameCounterLabel = "G_GAMECOUNTER" |
---|
| 17 | + | |
---|
| 18 | + | let gamePassBetLabel = "B_PASSBETS_" |
---|
| 19 | + | |
---|
| 20 | + | let gameCurrentPointLabal = "G_CurrentPoint_" |
---|
| 21 | + | |
---|
| 22 | + | let lastRolledNumber = 0 |
---|
5 | 23 | | |
---|
6 | 24 | | func authorizePermission (callerPublicKey) = (callerPublicKey != gameMasterPublicKey) |
---|
7 | 25 | | |
---|
8 | 26 | | |
---|
9 | | - | let diceNumbers = [1, 2, 3, 4, 5, 6, 7, 8] |
---|
10 | | - | |
---|
11 | | - | let GAMEINPROGRESS = 1 |
---|
12 | | - | |
---|
13 | | - | let GAMEFINISHED = 0 |
---|
14 | | - | |
---|
15 | | - | let gameCounterLabel = "G_GAMECOUNTER" |
---|
16 | | - | |
---|
17 | | - | let gameStateLabel = "G_STATE" |
---|
18 | | - | |
---|
19 | | - | let gameCurrentPointLabal = "G_CurrentPoint " |
---|
20 | | - | |
---|
21 | | - | let gameToken = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8' |
---|
22 | | - | |
---|
23 | | - | let lastRolledNumber = 0 |
---|
24 | | - | |
---|
25 | | - | func getGameStateLabel (gameCounter) = ((("G_" + toString(gameCounter)) + "_") + gameStateLabel) |
---|
| 27 | + | func gameStateLabel (gameCounter) = (("G_" + toString(gameCounter)) + "_STATE") |
---|
26 | 28 | | |
---|
27 | 29 | | |
---|
28 | | - | func getGameState (gameCounter) = getInteger(this, getGameStateLabel(gameCounter)) |
---|
| 30 | + | func gameSumShaLabel (gameCounter) = ((("G_" + toString(gameCounter)) + "_") + "_SUMSHA") |
---|
| 31 | + | |
---|
| 32 | + | |
---|
| 33 | + | func gameStartHeightLabel (gameCounter) = ((("G_" + toString(gameCounter)) + "_") + "_STARTHEIGHT") |
---|
| 34 | + | |
---|
| 35 | + | |
---|
| 36 | + | func getGameState (gameCounter) = getInteger(this, gameStateLabel(gameCounter)) |
---|
| 37 | + | |
---|
| 38 | + | |
---|
| 39 | + | func getGameSumSha (gameCounter) = getString(this, gameSumShaLabel(gameCounter)) |
---|
| 40 | + | |
---|
| 41 | + | |
---|
| 42 | + | func getStartHeight (gameCounter) = getInteger(this, gameStartHeightLabel(gameCounter)) |
---|
29 | 43 | | |
---|
30 | 44 | | |
---|
31 | 45 | | func getCrapGameCounter () = getInteger(this, gameCounterLabel) |
---|
| 46 | + | |
---|
| 47 | + | |
---|
| 48 | + | func getRandomIndexForDice (randomHash) = diceNumber[(toInt(randomHash) % 8)] |
---|
32 | 49 | | |
---|
33 | 50 | | |
---|
34 | 51 | | @Callable(i) |
---|
35 | 52 | | func initGame () = if (authorizePermission(i.callerPublicKey)) |
---|
36 | 53 | | then throw("initGame_FORBIDDEN") |
---|
37 | 54 | | else match getCrapGameCounter() { |
---|
38 | 55 | | case counter: Int => |
---|
39 | 56 | | throw("INIT_ALREADY_DONE") |
---|
40 | 57 | | case _ => |
---|
41 | | - | [IntegerEntry(gameCounterLabel, 1)] |
---|
| 58 | + | [IntegerEntry(gameCounterLabel, 0)] |
---|
| 59 | + | } |
---|
| 60 | + | |
---|
| 61 | + | |
---|
| 62 | + | |
---|
| 63 | + | @Callable(i) |
---|
| 64 | + | func startGame (randomHash) = if (authorizePermission(i.callerPublicKey)) |
---|
| 65 | + | then throw("startGame_FORBIDDEN") |
---|
| 66 | + | else match getCrapGameCounter() { |
---|
| 67 | + | case number: Int => |
---|
| 68 | + | let newNumber = (number + 1) |
---|
| 69 | + | [IntegerEntry(gameCounterLabel, newNumber), IntegerEntry(gameStateLabel(newNumber), 0), IntegerEntry(gameStartHeightLabel(newNumber), lastBlock.height), StringEntry(gameSumShaLabel(number), toBase58String(sha256(fromBase64String(randomHash))))] |
---|
| 70 | + | case _ => |
---|
| 71 | + | throw("INIT_NEED") |
---|
42 | 72 | | } |
---|
43 | 73 | | |
---|
44 | 74 | | |
---|
45 | 75 | | @Verifier(tx) |
---|
46 | 76 | | func verify () = match tx { |
---|
47 | 77 | | case _ => |
---|
48 | 78 | | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
49 | 79 | | } |
---|
50 | 80 | | |
---|