tx · 7wWfLFQVgkcCUtNYnRRNeZhZym2S8PShAzLHUNgrf9X2 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89: -0.01400000 Waves 2019.08.22 20:33 [642635] smart account 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89 > SELF 0.00000000 Waves
{ "type": 13, "id": "7wWfLFQVgkcCUtNYnRRNeZhZym2S8PShAzLHUNgrf9X2", "fee": 1400000, "feeAssetId": null, "timestamp": 1566495153979, "version": 1, "sender": "3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89", "senderPublicKey": "FgbqvGasMMrXxbhwrsgEiCgJLjXPjgn8kHxsZiVmLrkb", "proofs": [ "4mCvHacMzG4jcwPLcnMEiGrBsi7gf9pNxVVEJD5e4qpxEbVh2ACK5fBJ8k2X9W62GPp5ZrwsrTWaZBmZnd5uip6" ], "script": "base64:AAIDAAAAAAAAAAAAAAAsAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbGVtcjk1SjFqWlVzN2NKbXJtbWxONHpvN1lWc0JKekllSmRrOExERkdoVUtTSTZ5ZnMyMFp5SmUyMSs2R0p3Tm5LVVUxVXlvYzE3d1NXTUtrclowTU12WUUrWjVBaWlqdkJLNHNTSjNJZ0dqZFU4L05oSThDQkR1MEYreFJNOXEzVEIzTExiRHk1c0JkdWRZZkhmc1VPYytNVHZBRDY5bjI3ZGIyUmg4K3laUU10dWJrdVRRTnA4OXNwaEhRYUxHeVFGYU5sSy9OYTNsRng2b21xemFhMWdqb3BsVXI2cnZZS2dmQUlDVUIzelZtSlNoaUVpN3c3UjBoV2xOUkQzcWNaakNVT05TcEZvNFdiemtuR09henc4NEIrSU1JRm5JcFhXelFMOFJYMHZOY2ZzQnZMRGZNNmsyWmFjcXd5TUthTExxaWdkQmlHZEo3VyswbE9TdE9RSURBUUFCAAAAAAZTRVJW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ld0dhbWVEYXRhU3RyCQEAAAARRm9ybWF0R2FtZURhdGFTdHIAAAAGBQAAAAlTVEFURUxPU1QFAAAADHBsYXllckNob2ljZQUAAAAOcGxheWVyUHViS2V5NTgFAAAADXN0YXJ0ZWRIZWlnaHQFAAAABndpbkFtdAUAAAAHcmFuZFN0cgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAGZ2FtZUlkBQAAAA5uZXdHYW1lRGF0YVN0cgkABEwAAAACBQAAABFkZWNyZWFzZWRSZXNlcnZlcwUAAAADbmlsAAAAANLcZ+k=", "chainId": 84, "height": 642635, "spentComplexity": 0 } View: original | compacted Prev: 9zWFdcVRiNFNjtxd2VtoHrbHnhBssAUn4bdKvqf9LDU7 Next: GFt3QFPVcNoFopSGc1RJpwDttK5LgcwTdFrUwovtJHuC Diff:
Old | New | Differences | |
---|---|---|---|
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlemr95J1jZUs7cJmrmmlN4zo7YVsBJzIeJdk8LDFGhUKSI6yfs20ZyJe21+6GJwNnKUU1Uyoc17wSWMKkrZ0MMvYE+Z5AiijvBK4sSJ3IgGjdU8/NhI8CBDu0F+xRM9q3TB3LLbDy5sBdudYfHfsUOc+MTvAD69n27db2Rh8+yZQMtubkuTQNp89sphHQaLGyQFaNlK/Na3lFx6omqzaa1gjoplUr6rvYKgfAICUB3zVmJShiEi7w7R0hWlNRD3qcZjCUONSpFo4WbzknGOazw84B+IMIFnIpXWzQL8RX0vNcfsBvLDfM6k2ZacqwyMKaLLqigdBiGdJ7W+0lOStOQIDAQAB") | |
5 | + | ||
6 | + | let SERVER = addressFromStringValue("3PMT9wun7BB7JABSuhTJpFgJoegRfYw2e6d") | |
5 | 7 | ||
6 | 8 | let RANDORACLETIMEFRAME = 4320 | |
7 | 9 | ||
296 | 298 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
297 | 299 | let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "") | |
298 | 300 | let readableGameData = ((((((((STATESUBMITTED + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(height)) + "_") + toString(winAmt)) | |
299 | - | let SERVER = addressFromPublicKey(i.callerPublicKey) | |
300 | 301 | let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)] | |
301 | 302 | let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry("Game Data", readableGameData), DataEntry(gameId, gameDataStr)] | |
302 | 303 | ScriptResult(WriteSet(betData), TransferSet(serverTransfer)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlemr95J1jZUs7cJmrmmlN4zo7YVsBJzIeJdk8LDFGhUKSI6yfs20ZyJe21+6GJwNnKUU1Uyoc17wSWMKkrZ0MMvYE+Z5AiijvBK4sSJ3IgGjdU8/NhI8CBDu0F+xRM9q3TB3LLbDy5sBdudYfHfsUOc+MTvAD69n27db2Rh8+yZQMtubkuTQNp89sphHQaLGyQFaNlK/Na3lFx6omqzaa1gjoplUr6rvYKgfAICUB3zVmJShiEi7w7R0hWlNRD3qcZjCUONSpFo4WbzknGOazw84B+IMIFnIpXWzQL8RX0vNcfsBvLDfM6k2ZacqwyMKaLLqigdBiGdJ7W+0lOStOQIDAQAB") | |
5 | + | ||
6 | + | let SERVER = addressFromStringValue("3PMT9wun7BB7JABSuhTJpFgJoegRfYw2e6d") | |
5 | 7 | ||
6 | 8 | let RANDORACLETIMEFRAME = 4320 | |
7 | 9 | ||
8 | 10 | let WAVELET = ((100 * 1000) * 1000) | |
9 | 11 | ||
10 | 12 | let COMMISSION = ((9 * WAVELET) / 1000) | |
11 | 13 | ||
12 | 14 | let BET1 = (1 * WAVELET) | |
13 | 15 | ||
14 | 16 | let BET2 = (2 * WAVELET) | |
15 | 17 | ||
16 | 18 | let BET4 = (4 * WAVELET) | |
17 | 19 | ||
18 | 20 | let BET8 = (8 * WAVELET) | |
19 | 21 | ||
20 | 22 | let BET14 = (14 * WAVELET) | |
21 | 23 | ||
22 | 24 | let RATEMULT = 10000 | |
23 | 25 | ||
24 | 26 | let RATE1 = 39655 | |
25 | 27 | ||
26 | 28 | let RATE2 = 24600 | |
27 | 29 | ||
28 | 30 | let RATE3 = 19000 | |
29 | 31 | ||
30 | 32 | let RATE4 = 14200 | |
31 | 33 | ||
32 | 34 | let RATE5 = 11400 | |
33 | 35 | ||
34 | 36 | let IdxGameState = 0 | |
35 | 37 | ||
36 | 38 | let IdxPlayerChoice = 1 | |
37 | 39 | ||
38 | 40 | let IdxPlayerPubKey58 = 2 | |
39 | 41 | ||
40 | 42 | let IdxStartedHeight = 3 | |
41 | 43 | ||
42 | 44 | let IdxWinAmt = 4 | |
43 | 45 | ||
44 | 46 | let IdxRandOrEmpty = 5 | |
45 | 47 | ||
46 | 48 | let GAMESCOUNTERKEY = "$GAME_NUM" | |
47 | 49 | ||
48 | 50 | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
49 | 51 | ||
50 | 52 | let STATESUBMITTED = "SUBMITTED" | |
51 | 53 | ||
52 | 54 | let STATEWON = "WON" | |
53 | 55 | ||
54 | 56 | let STATELOST = "LOST" | |
55 | 57 | ||
56 | 58 | func getAnswer (playerChoice) = BET14 | |
57 | 59 | ||
58 | 60 | ||
59 | 61 | func GenerateRandInt (gameId,rsaSign) = { | |
60 | 62 | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
61 | 63 | if (rsaSigValid) | |
62 | 64 | then { | |
63 | 65 | let rand = (toInt(sha256(rsaSign)) % 6) | |
64 | 66 | if ((0 > rand)) | |
65 | 67 | then ((-1 * rand) + 1) | |
66 | 68 | else (rand + 1) | |
67 | 69 | } | |
68 | 70 | else throw("Invalid RSA signature") | |
69 | 71 | } | |
70 | 72 | ||
71 | 73 | ||
72 | 74 | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
73 | 75 | then drop(remaining, 1) | |
74 | 76 | else remaining | |
75 | 77 | ||
76 | 78 | ||
77 | 79 | func ParseNextAttribute (remaining) = { | |
78 | 80 | let s = size(remaining) | |
79 | 81 | if ((s > 0)) | |
80 | 82 | then { | |
81 | 83 | let nn = parseIntValue(take(remaining, 2)) | |
82 | 84 | let v = take(drop(remaining, 2), nn) | |
83 | 85 | let tmpRemaining = drop(remaining, (nn + 2)) | |
84 | 86 | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
85 | 87 | [v, remainingState] | |
86 | 88 | } | |
87 | 89 | else throw("Empty string was passed into parseNextAttribute func") | |
88 | 90 | } | |
89 | 91 | ||
90 | 92 | ||
91 | 93 | func ParseGameRawDataStr (rawStateStr) = { | |
92 | 94 | let gameState = ParseNextAttribute(rawStateStr) | |
93 | 95 | let playerChoice = ParseNextAttribute(gameState[1]) | |
94 | 96 | let playerPubKey58 = ParseNextAttribute(playerChoice[1]) | |
95 | 97 | let startedHeight = ParseNextAttribute(playerPubKey58[1]) | |
96 | 98 | let winAmt = ParseNextAttribute(startedHeight[1]) | |
97 | 99 | [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]] | |
98 | 100 | } | |
99 | 101 | ||
100 | 102 | ||
101 | 103 | func ExtractGameDataList (gameId) = { | |
102 | 104 | let rawDataStr = match getString(this, gameId) { | |
103 | 105 | case str: String => | |
104 | 106 | str | |
105 | 107 | case _ => | |
106 | 108 | throw(("Couldn't find game by " + gameId)) | |
107 | 109 | } | |
108 | 110 | ParseGameRawDataStr(rawDataStr) | |
109 | 111 | } | |
110 | 112 | ||
111 | 113 | ||
112 | 114 | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
113 | 115 | case a: Int => | |
114 | 116 | a | |
115 | 117 | case _ => | |
116 | 118 | 0 | |
117 | 119 | } | |
118 | 120 | ||
119 | 121 | ||
120 | 122 | func ValidateAndIncreaseReservedAmt (winAmt) = { | |
121 | 123 | let newReservedAmount = (ExtractReservedAmt() + winAmt) | |
122 | 124 | let balance = wavesBalance(this) | |
123 | 125 | if ((newReservedAmount > balance)) | |
124 | 126 | then throw("Insufficient funds on Russian Roulette account. Transaction was rejected for your safety.") | |
125 | 127 | else newReservedAmount | |
126 | 128 | } | |
127 | 129 | ||
128 | 130 | ||
129 | 131 | func IncrementGameNum () = { | |
130 | 132 | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
131 | 133 | case num: Int => | |
132 | 134 | num | |
133 | 135 | case _ => | |
134 | 136 | 0 | |
135 | 137 | } | |
136 | 138 | (gameNum + 1) | |
137 | 139 | } | |
138 | 140 | ||
139 | 141 | ||
140 | 142 | func DecreaseReservedAmt (gameId,winAmt) = { | |
141 | 143 | let newReservedAmount = (ExtractReservedAmt() - winAmt) | |
142 | 144 | if ((0 > newReservedAmount)) | |
143 | 145 | then throw("Invalid Russian Roulette account state - reserved amount is less than 0") | |
144 | 146 | else DataEntry(RESERVATIONKEY, newReservedAmount) | |
145 | 147 | } | |
146 | 148 | ||
147 | 149 | ||
148 | 150 | func FormatGameDataParam (p) = { | |
149 | 151 | let s = size(p) | |
150 | 152 | if ((s == 0)) | |
151 | 153 | then throw("Parameter size must be greater then 0") | |
152 | 154 | else if ((s > 99)) | |
153 | 155 | then throw("Parameter size must be less then 100") | |
154 | 156 | else if ((10 > s)) | |
155 | 157 | then (("0" + toString(s)) + p) | |
156 | 158 | else (toString(s) + p) | |
157 | 159 | } | |
158 | 160 | ||
159 | 161 | ||
160 | 162 | func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = { | |
161 | 163 | let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt))) | |
162 | 164 | if ((randOrEmpty == "")) | |
163 | 165 | then fullStateStr | |
164 | 166 | else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty)) | |
165 | 167 | } | |
166 | 168 | ||
167 | 169 | ||
168 | 170 | func RandToStr (r) = if ((r == 1)) | |
169 | 171 | then "1" | |
170 | 172 | else if ((r == 2)) | |
171 | 173 | then "2" | |
172 | 174 | else if ((r == 3)) | |
173 | 175 | then "3" | |
174 | 176 | else if ((r == 4)) | |
175 | 177 | then "4" | |
176 | 178 | else if ((r == 5)) | |
177 | 179 | then "5" | |
178 | 180 | else if ((r == 6)) | |
179 | 181 | then "6" | |
180 | 182 | else throw(("Unsupported r parameter passed: expected=[1,...,6] actual=" + toString(r))) | |
181 | 183 | ||
182 | 184 | ||
183 | 185 | func ValidateBetAndDefineWinAmt (betAmt,playerChoice) = { | |
184 | 186 | let betAmtValid = if (if (if (if (if ((betAmt == (BET1 + COMMISSION))) | |
185 | 187 | then true | |
186 | 188 | else (betAmt == (BET2 + COMMISSION))) | |
187 | 189 | then true | |
188 | 190 | else (betAmt == (BET4 + COMMISSION))) | |
189 | 191 | then true | |
190 | 192 | else (betAmt == (BET8 + COMMISSION))) | |
191 | 193 | then true | |
192 | 194 | else (betAmt == (BET14 + COMMISSION))) | |
193 | 195 | then true | |
194 | 196 | else false | |
195 | 197 | if (betAmtValid) | |
196 | 198 | then { | |
197 | 199 | let bulletsCount = size(playerChoice) | |
198 | 200 | let bet = (betAmt - COMMISSION) | |
199 | 201 | let b1 = parseIntValue(take(playerChoice, 1)) | |
200 | 202 | let forB2 = drop(playerChoice, 1) | |
201 | 203 | let b2 = parseIntValue(take(forB2, 1)) | |
202 | 204 | let forB3 = drop(forB2, 1) | |
203 | 205 | let b3 = parseIntValue(take(forB3, 1)) | |
204 | 206 | let forB4 = drop(forB3, 1) | |
205 | 207 | let b4 = parseIntValue(take(forB4, 1)) | |
206 | 208 | let forB5 = drop(forB4, 1) | |
207 | 209 | let b5 = parseIntValue(take(forB5, 1)) | |
208 | 210 | let forB6 = drop(forB5, 1) | |
209 | 211 | let b6 = parseIntValue(take(forB6, 1)) | |
210 | 212 | let activeBullets = (((((b1 + b2) + b3) + b4) + b5) + b6) | |
211 | 213 | if ((activeBullets == 5)) | |
212 | 214 | then ((bet * RATE1) / RATEMULT) | |
213 | 215 | else if ((activeBullets == 4)) | |
214 | 216 | then ((bet * RATE2) / RATEMULT) | |
215 | 217 | else if ((activeBullets == 3)) | |
216 | 218 | then ((bet * RATE3) / RATEMULT) | |
217 | 219 | else if ((activeBullets == 2)) | |
218 | 220 | then ((bet * RATE4) / RATEMULT) | |
219 | 221 | else if ((activeBullets == 1)) | |
220 | 222 | then ((bet * RATE5) / RATEMULT) | |
221 | 223 | else throw(("Invalid player's choice, active bullets = " + toString(activeBullets))) | |
222 | 224 | } | |
223 | 225 | else throw("Bet amount is not in range") | |
224 | 226 | } | |
225 | 227 | ||
226 | 228 | ||
227 | 229 | func getWinStr (playerChoice) = { | |
228 | 230 | let b1 = parseIntValue(take(playerChoice, 1)) | |
229 | 231 | let forB2 = drop(playerChoice, 1) | |
230 | 232 | let b2 = parseIntValue(take(forB2, 1)) | |
231 | 233 | let forB3 = drop(playerChoice, 1) | |
232 | 234 | let b3 = parseIntValue(take(forB3, 1)) | |
233 | 235 | let forB4 = drop(playerChoice, 1) | |
234 | 236 | let b4 = parseIntValue(take(forB4, 1)) | |
235 | 237 | let forB5 = drop(playerChoice, 1) | |
236 | 238 | let b5 = parseIntValue(take(forB5, 1)) | |
237 | 239 | let forB6 = drop(playerChoice, 1) | |
238 | 240 | let b6 = parseIntValue(take(forB6, 1)) | |
239 | 241 | if ((b1 == 0)) | |
240 | 242 | then "1" | |
241 | 243 | else if ((b2 == 0)) | |
242 | 244 | then "2" | |
243 | 245 | else if ((b3 == 0)) | |
244 | 246 | then "3" | |
245 | 247 | else if ((b4 == 0)) | |
246 | 248 | then "4" | |
247 | 249 | else if ((b5 == 0)) | |
248 | 250 | then "5" | |
249 | 251 | else if ((b6 == 0)) | |
250 | 252 | then "6" | |
251 | 253 | else throw("Bet amount is not in range") | |
252 | 254 | } | |
253 | 255 | ||
254 | 256 | ||
255 | 257 | func IsPlayerWin (playerChoice,randStr) = { | |
256 | 258 | let randInt = parseIntValue(randStr) | |
257 | 259 | let choiceArray = split(playerChoice, "") | |
258 | 260 | if ((choiceArray[(randInt - 1)] == "0")) | |
259 | 261 | then true | |
260 | 262 | else false | |
261 | 263 | } | |
262 | 264 | ||
263 | 265 | ||
264 | 266 | func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,winByTimeout,decreasedReserves) = { | |
265 | 267 | let wSetCommonData = [decreasedReserves] | |
266 | 268 | let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, unit)] | |
267 | 269 | if (winByTimeout) | |
268 | 270 | then { | |
269 | 271 | let newGameDataStrAdjusted = ((newGameDataStr + "_") + FormatGameDataParam("TIMEOUT")) | |
270 | 272 | let gameData = DataEntry(gameId, newGameDataStrAdjusted) | |
271 | 273 | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
272 | 274 | } | |
273 | 275 | else { | |
274 | 276 | let gameData = DataEntry(gameId, newGameDataStr) | |
275 | 277 | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
276 | 278 | } | |
277 | 279 | } | |
278 | 280 | ||
279 | 281 | ||
280 | 282 | @Callable(i) | |
281 | 283 | func bet (playerChoice) = { | |
282 | 284 | let newGameNum = IncrementGameNum() | |
283 | 285 | let gameId = toBase58String(i.transactionId) | |
284 | 286 | let pmt = extract(i.payment) | |
285 | 287 | let betNotInWaves = isDefined(pmt.assetId) | |
286 | 288 | let feeNotInWaves = isDefined(pmt.assetId) | |
287 | 289 | let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice) | |
288 | 290 | let txIdUsed = isDefined(getString(this, gameId)) | |
289 | 291 | if (betNotInWaves) | |
290 | 292 | then throw("Bet amount must be in Waves") | |
291 | 293 | else if (feeNotInWaves) | |
292 | 294 | then throw("Transaction's fee must be in Waves") | |
293 | 295 | else if (txIdUsed) | |
294 | 296 | then throw("Passed txId had been used before. Game aborted.") | |
295 | 297 | else { | |
296 | 298 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
297 | 299 | let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "") | |
298 | 300 | let readableGameData = ((((((((STATESUBMITTED + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(height)) + "_") + toString(winAmt)) | |
299 | - | let SERVER = addressFromPublicKey(i.callerPublicKey) | |
300 | 301 | let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)] | |
301 | 302 | let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry("Game Data", readableGameData), DataEntry(gameId, gameDataStr)] | |
302 | 303 | ScriptResult(WriteSet(betData), TransferSet(serverTransfer)) | |
303 | 304 | } | |
304 | 305 | } | |
305 | 306 | ||
306 | 307 | ||
307 | 308 | ||
308 | 309 | @Callable(i) | |
309 | 310 | func withdraw (gameId,rsaSign) = { | |
310 | 311 | let gameDataList = ExtractGameDataList(gameId) | |
311 | 312 | let gameState = gameDataList[IdxGameState] | |
312 | 313 | let playerChoice = gameDataList[IdxPlayerChoice] | |
313 | 314 | let startedHeight = parseIntValue(gameDataList[IdxStartedHeight]) | |
314 | 315 | let winAmt = parseIntValue(gameDataList[IdxWinAmt]) | |
315 | 316 | let playerPubKey58 = gameDataList[IdxPlayerPubKey58] | |
316 | 317 | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
317 | 318 | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
318 | 319 | let decreasedReserves = DecreaseReservedAmt(gameId, winAmt) | |
319 | 320 | if ((gameState != STATESUBMITTED)) | |
320 | 321 | then throw("Invalid game state for passed gameId") | |
321 | 322 | else if (winByTimeout) | |
322 | 323 | then { | |
323 | 324 | let randStr = getWinStr(playerChoice) | |
324 | 325 | let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
325 | 326 | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves) | |
326 | 327 | } | |
327 | 328 | else { | |
328 | 329 | let randInt = GenerateRandInt(gameId, rsaSign) | |
329 | 330 | let randStr = RandToStr(randInt) | |
330 | 331 | if (IsPlayerWin(playerChoice, randStr)) | |
331 | 332 | then { | |
332 | 333 | let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
333 | 334 | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves) | |
334 | 335 | } | |
335 | 336 | else { | |
336 | 337 | let newGameDataStr = FormatGameDataStr(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
337 | 338 | WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves]) | |
338 | 339 | } | |
339 | 340 | } | |
340 | 341 | } | |
341 | 342 | ||
342 | 343 |
github/deemru/w8io/026f985 47.81 ms ◑