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