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