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