tx · 4Xgs92tEEYbCYmRww2REc3iY4fEDSPiHobZ1g8R6WUBS 3Mt6NEJ6ZK6TFZs14tvnR5iAgemnomy2m1V: -0.00700000 Waves 2022.08.31 22:06 [2209027] smart account 3Mt6NEJ6ZK6TFZs14tvnR5iAgemnomy2m1V > SELF 0.00000000 Waves
{ "type": 13, "id": "4Xgs92tEEYbCYmRww2REc3iY4fEDSPiHobZ1g8R6WUBS", "fee": 700000, "feeAssetId": null, "timestamp": 1661972836720, "version": 2, "chainId": 84, "sender": "3Mt6NEJ6ZK6TFZs14tvnR5iAgemnomy2m1V", "senderPublicKey": "5f9EawB8nxaLg7KKhyqV2RDBMwRBG6o69D8zc9myAzrY", "proofs": [ "2RyZdaboRJ36qgPBY9hSqWbHfJWcKNJPsrPZcdwQnudtN29f9nn5bP9RYwAk2JKrorgf2VuLgfBfwjCNG1eTeYar" ], "script": "base64:AAIFAAAAAAAAABAIAhIAEgASABIAEgASABIAAAAAGgAAAAAOZ2FtZVRva2VuTGFiZWwCAAAACUdfVE9LRU5JRAAAAAAQZ2FtZUJhbGFuY2VMYWJlbAIAAAAJR19CQUxBTkNFAAAAABVnYW1lQ29tbXVuaXR5UG90TGFiZWwCAAAADkdfQ09NTVVOSVRZUE9UAAAAABFnYW1lUHJpemVQb3RMYWJlbAIAAAAKR19QUklaRVBPVAAAAAAZZ2FtZVByaXplU2hhcmVBbW91bnRMYWJlbAIAAAASR19QUklaRVNIQVJFQU1PVU5UAAAAABBnYW1lQ291bnRlckxhYmVsAgAAAA5HX0dBTUVTQ09VTlRFUgAAAAASZ2FtZVRvdGFsQmV0c0xhYmVsAgAAAAtHX1RPVEFMQkVUUwAAAAAWZ2FtZVByb2Nlc3NlZEJldHNMYWJlbAIAAAAPR19QUk9DRVNTRURCRVRTAAAAABdnYW1lV2lubmVyc0NvdW50ZXJMYWJlbAIAAAAOR19XSU5ORVJTQ09VTlQAAAAAGWdhbWVQcm9jZXNzZWRXaW5uZXJzTGFiZWwCAAAAEkdf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AAAByRtYXRjaDIJAQAAABRnYW1lUHJpemVTaGFyZUFtb3VudAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDICAAAAA0ludAQAAAAQcHJpemVTaGFyZUFtb3VudAUAAAAHJG1hdGNoMgQAAAAJYmV0UGxhY2VyCQEAAAANd2lubmVyRGV0YWlscwAAAAEFAAAACm5leHRXaW5uZXIEAAAAB2FkZHJlc3MJAQAAAAV2YWx1ZQAAAAEJAAQmAAAAAQUAAAAJYmV0UGxhY2VyBAAAAAh3aW5uaW5ncwkBAAAAFGdhbWVQcml6ZVNoYXJlQW1vdW50AAAAAAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAdhZGRyZXNzBQAAABBwcml6ZVNoYXJlQW1vdW50CQEAAAAJZ2FtZVRva2VuAAAAAAUAAAADbmlsCQAAAgAAAAECAAAAO0dhbWUgaGFzIG5vdCBiZWVuIGluaXRpYWxpemVkLCBwcml6ZSBzaGFyZSBhbW91bnQgbm90IGZvdW5kCQAAAgAAAAECAAAAQEdhbWUgaGFzIG5vdCBiZWVuIGluaXRpYWxpemVkLCB0b3RhbCBwcm9jZXNzZWQgd2lubmVycyBub3QgZm91bmQJAAACAAAAAQIAAAA2R2FtZSBoYXMgbm90IGJlZW4gaW5pdGlhbGl6ZWQsIHRvdGFsIHdpbm5lcnMgbm90IGZvdW5kAAAAAI2f7BU=", "height": 2209027, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G82eTsvCbwMs9V4Z74omAjt4fPtSzibv7VzzseJAm9xJ Next: 59pAUTAXhHGoTvkSJCWrRWBHbWcfBUyoUbn84kR1cMPG Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let gameTokenLabel = "G_TOKENID" | |
5 | + | ||
6 | + | let gameBalanceLabel = "G_BALANCE" | |
7 | + | ||
8 | + | let gameCommunityPotLabel = "G_COMMUNITYPOT" | |
9 | + | ||
10 | + | let gamePrizePotLabel = "G_PRIZEPOT" | |
11 | + | ||
12 | + | let gamePrizeShareAmountLabel = "G_PRIZESHAREAMOUNT" | |
13 | + | ||
4 | 14 | let gameCounterLabel = "G_GAMESCOUNTER" | |
5 | 15 | ||
6 | 16 | let gameTotalBetsLabel = "G_TOTALBETS" | |
9 | 19 | ||
10 | 20 | let gameWinnersCounterLabel = "G_WINNERSCOUNT" | |
11 | 21 | ||
22 | + | let gameProcessedWinnersLabel = "G_PROCESSEDWINNERS" | |
23 | + | ||
12 | 24 | func gameResultLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_RESULT") | |
13 | 25 | ||
14 | 26 | ||
16 | 28 | ||
17 | 29 | ||
18 | 30 | func winnerDetailsLabel (winnerNumber) = (("W_" + toString(winnerNumber)) + "_WINNERDETAILS") | |
31 | + | ||
32 | + | ||
33 | + | func gameBalance () = getInteger(this, gameBalanceLabel) | |
34 | + | ||
35 | + | ||
36 | + | func gameCommunityPot () = getInteger(this, gameCommunityPotLabel) | |
37 | + | ||
38 | + | ||
39 | + | func gamePrizePot () = getInteger(this, gamePrizePotLabel) | |
40 | + | ||
41 | + | ||
42 | + | func gamePrizeShareAmount () = getInteger(this, gamePrizeShareAmountLabel) | |
19 | 43 | ||
20 | 44 | ||
21 | 45 | func gamesGetCounter () = getInteger(this, gameCounterLabel) | |
30 | 54 | func gameWinnersCounter () = getInteger(this, gameWinnersCounterLabel) | |
31 | 55 | ||
32 | 56 | ||
57 | + | func gameProcessedWinners () = getInteger(this, gameProcessedWinnersLabel) | |
58 | + | ||
59 | + | ||
33 | 60 | func gameGetResult (gameNumber) = getStringValue(this, gameResultLabel(gameNumber)) | |
34 | 61 | ||
35 | 62 | ||
39 | 66 | func winnerDetails (winnerNumber) = getStringValue(this, winnerDetailsLabel(winnerNumber)) | |
40 | 67 | ||
41 | 68 | ||
69 | + | func gameToken () = match getString(this, gameTokenLabel) { | |
70 | + | case tokenId: String => | |
71 | + | if ((tokenId == "")) | |
72 | + | then unit | |
73 | + | else fromBase58String(tokenId) | |
74 | + | case _ => | |
75 | + | unit | |
76 | + | } | |
77 | + | ||
78 | + | ||
42 | 79 | @Callable(i) | |
43 | - | func initGame () = [IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameProcessedBetsLabel, 0), IntegerEntry(gameWinnersCounterLabel, 0)] | |
80 | + | func initGame () = [IntegerEntry(gameBalanceLabel, 0), IntegerEntry(gameCommunityPotLabel, 0), IntegerEntry(gamePrizePotLabel, 10000000), IntegerEntry(gamePrizeShareAmountLabel, 0), IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameProcessedBetsLabel, 0), IntegerEntry(gameWinnersCounterLabel, 0)] | |
44 | 81 | ||
45 | 82 | ||
46 | 83 | ||
87 | 124 | case totalBets: Int => | |
88 | 125 | match gameProcessedBets() { | |
89 | 126 | 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 | - | } | |
127 | + | let nextBet = (lastProcessedBet + 1) | |
128 | + | if ((nextBet > totalBets)) | |
129 | + | then throw("Next bet has not been placed.") | |
130 | + | else match gamesGetCounter() { | |
131 | + | case gameNumber: Int => | |
132 | + | match gameWinnersCounter() { | |
133 | + | case winnersCount: Int => | |
134 | + | let result = gameGetResult(gameNumber) | |
135 | + | let betDetail = betDetails(nextBet) | |
136 | + | if ((betDetail == result)) | |
137 | + | then { | |
138 | + | let newWinnersCount = (winnersCount + 1) | |
139 | + | [IntegerEntry(gameProcessedBetsLabel, nextBet), IntegerEntry(gameWinnersCounterLabel, (winnersCount + 1)), StringEntry(winnerDetailsLabel(newWinnersCount), toBase58String(i.caller.bytes))] | |
140 | + | } | |
141 | + | else [IntegerEntry(gameProcessedBetsLabel, nextBet)] | |
142 | + | case _ => | |
143 | + | throw("Game has not been initialized, total winners not found") | |
144 | + | } | |
145 | + | case _ => | |
146 | + | throw("Game has not been initialized, total games not found") | |
147 | + | } | |
109 | 148 | case _ => | |
110 | 149 | throw("Game has not been initialized, total processed bets not found") | |
111 | 150 | } | |
114 | 153 | } | |
115 | 154 | ||
116 | 155 | ||
156 | + | ||
157 | + | @Callable(i) | |
158 | + | func calculatePrize () = match gameWinnersCounter() { | |
159 | + | case winnersCount: Int => | |
160 | + | if ((winnersCount == 0)) | |
161 | + | then throw("There are no winners this round.") | |
162 | + | else match gamePrizePot() { | |
163 | + | case prizePotAmount: Int => | |
164 | + | let prizePot = gamePrizePot() | |
165 | + | let prizeShareAmount = (prizePotAmount / winnersCount) | |
166 | + | [IntegerEntry(gamePrizeShareAmountLabel, prizeShareAmount)] | |
167 | + | case _ => | |
168 | + | throw("Game has not been initialized, total games not found") | |
169 | + | } | |
170 | + | case _ => | |
171 | + | throw("Game has not been initialized, total winners not found") | |
172 | + | } | |
173 | + | ||
174 | + | ||
175 | + | ||
176 | + | @Callable(i) | |
177 | + | func processNextWinner () = match gameWinnersCounter() { | |
178 | + | case totalWinners: Int => | |
179 | + | if ((totalWinners == 0)) | |
180 | + | then throw("There are no winners this round.") | |
181 | + | else match gameProcessedWinners() { | |
182 | + | case lastProcessedWinner: Int => | |
183 | + | let nextWinner = (lastProcessedWinner + 1) | |
184 | + | if ((nextWinner > totalWinners)) | |
185 | + | then throw("No more winners to be processed.") | |
186 | + | else match gamePrizeShareAmount() { | |
187 | + | case prizeShareAmount: Int => | |
188 | + | let betPlacer = winnerDetails(nextWinner) | |
189 | + | let address = value(addressFromString(betPlacer)) | |
190 | + | let winnings = gamePrizeShareAmount() | |
191 | + | [ScriptTransfer(address, prizeShareAmount, gameToken())] | |
192 | + | case _ => | |
193 | + | throw("Game has not been initialized, prize share amount not found") | |
194 | + | } | |
195 | + | case _ => | |
196 | + | throw("Game has not been initialized, total processed winners not found") | |
197 | + | } | |
198 | + | case _ => | |
199 | + | throw("Game has not been initialized, total winners not found") | |
200 | + | } | |
201 | + | ||
202 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let gameTokenLabel = "G_TOKENID" | |
5 | + | ||
6 | + | let gameBalanceLabel = "G_BALANCE" | |
7 | + | ||
8 | + | let gameCommunityPotLabel = "G_COMMUNITYPOT" | |
9 | + | ||
10 | + | let gamePrizePotLabel = "G_PRIZEPOT" | |
11 | + | ||
12 | + | let gamePrizeShareAmountLabel = "G_PRIZESHAREAMOUNT" | |
13 | + | ||
4 | 14 | let gameCounterLabel = "G_GAMESCOUNTER" | |
5 | 15 | ||
6 | 16 | let gameTotalBetsLabel = "G_TOTALBETS" | |
7 | 17 | ||
8 | 18 | let gameProcessedBetsLabel = "G_PROCESSEDBETS" | |
9 | 19 | ||
10 | 20 | let gameWinnersCounterLabel = "G_WINNERSCOUNT" | |
11 | 21 | ||
22 | + | let gameProcessedWinnersLabel = "G_PROCESSEDWINNERS" | |
23 | + | ||
12 | 24 | func gameResultLabel (gameNumber) = (("G_" + toString(gameNumber)) + "_RESULT") | |
13 | 25 | ||
14 | 26 | ||
15 | 27 | func betDetailsLabel (betNumber) = (("B_" + toString(betNumber)) + "_BETDETAILS") | |
16 | 28 | ||
17 | 29 | ||
18 | 30 | func winnerDetailsLabel (winnerNumber) = (("W_" + toString(winnerNumber)) + "_WINNERDETAILS") | |
31 | + | ||
32 | + | ||
33 | + | func gameBalance () = getInteger(this, gameBalanceLabel) | |
34 | + | ||
35 | + | ||
36 | + | func gameCommunityPot () = getInteger(this, gameCommunityPotLabel) | |
37 | + | ||
38 | + | ||
39 | + | func gamePrizePot () = getInteger(this, gamePrizePotLabel) | |
40 | + | ||
41 | + | ||
42 | + | func gamePrizeShareAmount () = getInteger(this, gamePrizeShareAmountLabel) | |
19 | 43 | ||
20 | 44 | ||
21 | 45 | func gamesGetCounter () = getInteger(this, gameCounterLabel) | |
22 | 46 | ||
23 | 47 | ||
24 | 48 | func gameTotalBets () = getInteger(this, gameTotalBetsLabel) | |
25 | 49 | ||
26 | 50 | ||
27 | 51 | func gameProcessedBets () = getInteger(this, gameProcessedBetsLabel) | |
28 | 52 | ||
29 | 53 | ||
30 | 54 | func gameWinnersCounter () = getInteger(this, gameWinnersCounterLabel) | |
31 | 55 | ||
32 | 56 | ||
57 | + | func gameProcessedWinners () = getInteger(this, gameProcessedWinnersLabel) | |
58 | + | ||
59 | + | ||
33 | 60 | func gameGetResult (gameNumber) = getStringValue(this, gameResultLabel(gameNumber)) | |
34 | 61 | ||
35 | 62 | ||
36 | 63 | func betDetails (betNumber) = getStringValue(this, betDetailsLabel(betNumber)) | |
37 | 64 | ||
38 | 65 | ||
39 | 66 | func winnerDetails (winnerNumber) = getStringValue(this, winnerDetailsLabel(winnerNumber)) | |
40 | 67 | ||
41 | 68 | ||
69 | + | func gameToken () = match getString(this, gameTokenLabel) { | |
70 | + | case tokenId: String => | |
71 | + | if ((tokenId == "")) | |
72 | + | then unit | |
73 | + | else fromBase58String(tokenId) | |
74 | + | case _ => | |
75 | + | unit | |
76 | + | } | |
77 | + | ||
78 | + | ||
42 | 79 | @Callable(i) | |
43 | - | func initGame () = [IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameProcessedBetsLabel, 0), IntegerEntry(gameWinnersCounterLabel, 0)] | |
80 | + | func initGame () = [IntegerEntry(gameBalanceLabel, 0), IntegerEntry(gameCommunityPotLabel, 0), IntegerEntry(gamePrizePotLabel, 10000000), IntegerEntry(gamePrizeShareAmountLabel, 0), IntegerEntry(gameCounterLabel, 0), IntegerEntry(gameTotalBetsLabel, 0), IntegerEntry(gameProcessedBetsLabel, 0), IntegerEntry(gameWinnersCounterLabel, 0)] | |
44 | 81 | ||
45 | 82 | ||
46 | 83 | ||
47 | 84 | @Callable(i) | |
48 | 85 | func startGame () = match gamesGetCounter() { | |
49 | 86 | case currentGame: Int => | |
50 | 87 | let newGame = (currentGame + 1) | |
51 | 88 | [IntegerEntry(gameCounterLabel, newGame)] | |
52 | 89 | case _ => | |
53 | 90 | throw("Game has not been initialized, total games not found") | |
54 | 91 | } | |
55 | 92 | ||
56 | 93 | ||
57 | 94 | ||
58 | 95 | @Callable(i) | |
59 | 96 | func placeBet () = match gamesGetCounter() { | |
60 | 97 | case currentGame: Int => | |
61 | 98 | match gameTotalBets() { | |
62 | 99 | case totalBets: Int => | |
63 | 100 | let newBet = (totalBets + 1) | |
64 | 101 | let bet = "1,2,3" | |
65 | 102 | [IntegerEntry(gameTotalBetsLabel, newBet), StringEntry(betDetailsLabel(newBet), ((("G" + toString(currentGame)) + "-") + bet))] | |
66 | 103 | case _ => | |
67 | 104 | throw("Game has not been initialized, total bets not found") | |
68 | 105 | } | |
69 | 106 | case _ => | |
70 | 107 | throw("Game has not been initialized, total games not found") | |
71 | 108 | } | |
72 | 109 | ||
73 | 110 | ||
74 | 111 | ||
75 | 112 | @Callable(i) | |
76 | 113 | func endGame () = match gamesGetCounter() { | |
77 | 114 | case currentGame: Int => | |
78 | 115 | [StringEntry(gameResultLabel(currentGame), ((("G" + toString(currentGame)) + "-") + "1,2,3"))] | |
79 | 116 | case _ => | |
80 | 117 | throw("Game has not been initialized, total games not found") | |
81 | 118 | } | |
82 | 119 | ||
83 | 120 | ||
84 | 121 | ||
85 | 122 | @Callable(i) | |
86 | 123 | func processNextBet () = match gameTotalBets() { | |
87 | 124 | case totalBets: Int => | |
88 | 125 | match gameProcessedBets() { | |
89 | 126 | 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 | - | } | |
127 | + | let nextBet = (lastProcessedBet + 1) | |
128 | + | if ((nextBet > totalBets)) | |
129 | + | then throw("Next bet has not been placed.") | |
130 | + | else match gamesGetCounter() { | |
131 | + | case gameNumber: Int => | |
132 | + | match gameWinnersCounter() { | |
133 | + | case winnersCount: Int => | |
134 | + | let result = gameGetResult(gameNumber) | |
135 | + | let betDetail = betDetails(nextBet) | |
136 | + | if ((betDetail == result)) | |
137 | + | then { | |
138 | + | let newWinnersCount = (winnersCount + 1) | |
139 | + | [IntegerEntry(gameProcessedBetsLabel, nextBet), IntegerEntry(gameWinnersCounterLabel, (winnersCount + 1)), StringEntry(winnerDetailsLabel(newWinnersCount), toBase58String(i.caller.bytes))] | |
140 | + | } | |
141 | + | else [IntegerEntry(gameProcessedBetsLabel, nextBet)] | |
142 | + | case _ => | |
143 | + | throw("Game has not been initialized, total winners not found") | |
144 | + | } | |
145 | + | case _ => | |
146 | + | throw("Game has not been initialized, total games not found") | |
147 | + | } | |
109 | 148 | case _ => | |
110 | 149 | throw("Game has not been initialized, total processed bets not found") | |
111 | 150 | } | |
112 | 151 | case _ => | |
113 | 152 | throw("Game has not been initialized, total bets not found") | |
114 | 153 | } | |
115 | 154 | ||
116 | 155 | ||
156 | + | ||
157 | + | @Callable(i) | |
158 | + | func calculatePrize () = match gameWinnersCounter() { | |
159 | + | case winnersCount: Int => | |
160 | + | if ((winnersCount == 0)) | |
161 | + | then throw("There are no winners this round.") | |
162 | + | else match gamePrizePot() { | |
163 | + | case prizePotAmount: Int => | |
164 | + | let prizePot = gamePrizePot() | |
165 | + | let prizeShareAmount = (prizePotAmount / winnersCount) | |
166 | + | [IntegerEntry(gamePrizeShareAmountLabel, prizeShareAmount)] | |
167 | + | case _ => | |
168 | + | throw("Game has not been initialized, total games not found") | |
169 | + | } | |
170 | + | case _ => | |
171 | + | throw("Game has not been initialized, total winners not found") | |
172 | + | } | |
173 | + | ||
174 | + | ||
175 | + | ||
176 | + | @Callable(i) | |
177 | + | func processNextWinner () = match gameWinnersCounter() { | |
178 | + | case totalWinners: Int => | |
179 | + | if ((totalWinners == 0)) | |
180 | + | then throw("There are no winners this round.") | |
181 | + | else match gameProcessedWinners() { | |
182 | + | case lastProcessedWinner: Int => | |
183 | + | let nextWinner = (lastProcessedWinner + 1) | |
184 | + | if ((nextWinner > totalWinners)) | |
185 | + | then throw("No more winners to be processed.") | |
186 | + | else match gamePrizeShareAmount() { | |
187 | + | case prizeShareAmount: Int => | |
188 | + | let betPlacer = winnerDetails(nextWinner) | |
189 | + | let address = value(addressFromString(betPlacer)) | |
190 | + | let winnings = gamePrizeShareAmount() | |
191 | + | [ScriptTransfer(address, prizeShareAmount, gameToken())] | |
192 | + | case _ => | |
193 | + | throw("Game has not been initialized, prize share amount not found") | |
194 | + | } | |
195 | + | case _ => | |
196 | + | throw("Game has not been initialized, total processed winners not found") | |
197 | + | } | |
198 | + | case _ => | |
199 | + | throw("Game has not been initialized, total winners not found") | |
200 | + | } | |
201 | + | ||
202 | + |
github/deemru/w8io/169f3d6 29.46 ms ◑