tx · 7bGakQVWAYjrd6UKqXgBdbTwubM57okA23kmo735gCh 3Mt6NEJ6ZK6TFZs14tvnR5iAgemnomy2m1V: -0.00400000 Waves 2022.08.31 20:13 [2208912] smart account 3Mt6NEJ6ZK6TFZs14tvnR5iAgemnomy2m1V > SELF 0.00000000 Waves
{ "type": 13, "id": "7bGakQVWAYjrd6UKqXgBdbTwubM57okA23kmo735gCh", "fee": 400000, "feeAssetId": null, "timestamp": 1661965942724, "version": 2, "chainId": 84, "sender": "3Mt6NEJ6ZK6TFZs14tvnR5iAgemnomy2m1V", "senderPublicKey": "5f9EawB8nxaLg7KKhyqV2RDBMwRBG6o69D8zc9myAzrY", "proofs": [ "3a3W1iXsyq4qPC3LEYSQ7U7R5mxHjqqz7fo6gg918hMXhS2oz6rRSKNDjMGFQGJPhBaaSRqLUxGnJuuZuUmtRs4c" ], "script": "base64:AAIFAAAAAAAAAAwIAhIAEgASABIAEgAAAAAOAAAAABBnYW1lQ291bnRlckxhYmVsAgAAAA5HX0dBTUVTQ09VTlRFUgAAAAASZ2FtZVRvdGFsQmV0c0xhYmVsAgAAAAtHX1RPVEFMQkVUUwAAAAAWZ2FtZVByb2Nlc3NlZEJldHNMYWJlbAIAAAAPR19QUk9DRVNTRURCRVRTAAAAABdnYW1lV2lubmVyc0NvdW50ZXJMYWJlbAIAAAAOR19XSU5ORVJTQ09VTlQBAAAAD2dhbWVSZXN1bHRMYWJlbAAAAAEAAAAKZ2FtZU51bWJlcgkAASwAAAACCQABLAAAAAICAAAAAkdfCQABpAAAAAEFAAAACmdhbWVOdW1iZXICAAAAB19SRVNVTFQBAAAAD2JldERldGFpbHNMYWJlbAAAAAEAAAAJYmV0TnVtYmVyCQABLAAAAAIJAAEsAAAAAgIAAAACQl8JAAGkAAAAAQUAAAAJYmV0TnVtYmVyAgAAAAtfQkVUREVUQUlMUwEAAAASd2lubmVyRGV0YWlsc0xhYmVsAAAAAQAAAAx3aW5uZXJOdW1iZXIJAAEsAAAAAgkAASwAA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GJldHMgbm90IGZvdW5kCQAAAgAAAAECAAAAM0dhbWUgaGFzIG5vdCBiZWVuIGluaXRpYWxpemVkLCB0b3RhbCBiZXRzIG5vdCBmb3VuZAAAAAD0q58F", "height": 2208912, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: G82eTsvCbwMs9V4Z74omAjt4fPtSzibv7VzzseJAm9xJ Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let gameCounterLabel = "G_GAMESCOUNTER" | |
5 | + | ||
6 | + | let gameTotalBetsLabel = "G_TOTALBETS" | |
7 | + | ||
8 | + | let gameProcessedBetsLabel = "G_PROCESSEDBETS" | |
9 | + | ||
10 | + | let gameWinnersCounterLabel = "G_WINNERSCOUNT" | |
11 | + | ||
12 | + | func gameResultLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_RESULT") | |
13 | + | ||
14 | + | ||
15 | + | func betDetailsLabel (betNumber) = (("B_" + toString(betNumber)) + "_BETDETAILS") | |
16 | + | ||
17 | + | ||
18 | + | func winnerDetailsLabel (winnerNumber) = (("W_" + toString(winnerNumber)) + "_WINNERDETAILS") | |
19 | + | ||
20 | + | ||
21 | + | func gamesGetCounter () = getInteger(this, gameCounterLabel) | |
22 | + | ||
23 | + | ||
24 | + | func gameTotalBets () = getInteger(this, gameTotalBetsLabel) | |
25 | + | ||
26 | + | ||
27 | + | func gameProcessedBets () = getInteger(this, gameProcessedBetsLabel) | |
28 | + | ||
29 | + | ||
30 | + | func gameWinnersCounter () = getInteger(this, gameWinnersCounterLabel) | |
31 | + | ||
32 | + | ||
33 | + | func gameGetResult (gameNumber) = getStringValue(this, gameResultLabel(gameNumber)) | |
34 | + | ||
35 | + | ||
36 | + | func betDetails (betNumber) = getStringValue(this, betDetailsLabel(betNumber)) | |
37 | + | ||
38 | + | ||
39 | + | func winnerDetails (winnerNumber) = getStringValue(this, winnerDetailsLabel(winnerNumber)) | |
40 | + | ||
41 | + | ||
42 | + | @Callable(i) | |
43 | + | func initGame () = [IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameProcessedBetsLabel, 0), IntegerEntry(gameWinnersCounterLabel, 0)] | |
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | @Callable(i) | |
48 | + | func startGame () = match gamesGetCounter() { | |
49 | + | case currentGame: Int => | |
50 | + | let newGame = (currentGame + 1) | |
51 | + | [IntegerEntry(gameCounterLabel, newGame)] | |
52 | + | case _ => | |
53 | + | throw("Game has not been initialized, total games not found") | |
54 | + | } | |
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | @Callable(i) | |
59 | + | func placeBet () = match gamesGetCounter() { | |
60 | + | case currentGame: Int => | |
61 | + | match gameTotalBets() { | |
62 | + | case totalBets: Int => | |
63 | + | let newBet = (totalBets + 1) | |
64 | + | let bet = "1,2,3" | |
65 | + | [IntegerEntry(gameTotalBetsLabel, newBet), StringEntry(betDetailsLabel(newBet), ((("G" + toString(currentGame)) + "-") + bet))] | |
66 | + | case _ => | |
67 | + | throw("Game has not been initialized, total bets not found") | |
68 | + | } | |
69 | + | case _ => | |
70 | + | throw("Game has not been initialized, total games not found") | |
71 | + | } | |
72 | + | ||
73 | + | ||
74 | + | ||
75 | + | @Callable(i) | |
76 | + | func endGame () = match gamesGetCounter() { | |
77 | + | case currentGame: Int => | |
78 | + | [StringEntry(gameResultLabel(currentGame), "1,2,3")] | |
79 | + | case _ => | |
80 | + | throw("Game has not been initialized, total games not found") | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | @Callable(i) | |
86 | + | func processNextBet () = match gameTotalBets() { | |
87 | + | case totalBets: Int => | |
88 | + | match gameProcessedBets() { | |
89 | + | case lastProcessedBet: Int => | |
90 | + | match gameWinnersCounter() { | |
91 | + | case winnersCount: Int => | |
92 | + | let nextBet = (lastProcessedBet + 1) | |
93 | + | if ((nextBet > totalBets)) | |
94 | + | then throw("Next bet has not been placed.") | |
95 | + | else { | |
96 | + | let gameNumber = gamesGetCounter() | |
97 | + | let result = gameGetResult(1) | |
98 | + | let betDetail = betDetails(nextBet) | |
99 | + | if ((betDetail == result)) | |
100 | + | then { | |
101 | + | let newWinnersCount = (winnersCount + 1) | |
102 | + | [IntegerEntry(gameProcessedBetsLabel, nextBet), IntegerEntry(gameWinnersCounterLabel, (winnersCount + 1)), StringEntry(winnerDetailsLabel(newWinnersCount), ("B_" + toString(nextBet)))] | |
103 | + | } | |
104 | + | else [IntegerEntry(gameProcessedBetsLabel, nextBet)] | |
105 | + | } | |
106 | + | case _ => | |
107 | + | throw("Game has not been initialized, total winners not found") | |
108 | + | } | |
109 | + | case _ => | |
110 | + | throw("Game has not been initialized, total processed bets not found") | |
111 | + | } | |
112 | + | case _ => | |
113 | + | throw("Game has not been initialized, total bets not found") | |
114 | + | } | |
115 | + | ||
116 | + |
github/deemru/w8io/169f3d6 32.85 ms ◑