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:AAIDAAAAAAAAAAAAAAAmAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBcWxBaUFOU21CcERIWUtQOXNLZ2VOL2wxYkFiMjhnL3RHbGdEa3dUNUZpTU40WDNwd2R2ZHhFN212U1I4LzQxZFU5cng0akcrNnRacGIxVUxWRFBzNDMxdFIySVJhVFh3NUNqK0FjMnZoTCs1SmFtQ2VyR0QxVVcrYmgvRUdRdHhvOFczWUxEcm9mWEI1UUhKeDRQa3oyS2dmK29TL0M4aEh1Qi9VNGtyTzc2VTA1MDdHVGpaUFA5a1JRMHVMU01lcVFYdDh3WFMrbk1wNXdhanF4UHBETE1hU1JFZ3NLd3YvQUVrUDRkenBUWWJpa0xCWWw0cXRkSnNEODRITEZTa2l3ZDNCaGNPclBqb0lZbUx4UXVCRDVUSU1LVEtEM3NkWmdhWTlyc3lxeDNBMDBpbm55eEQ2enAzYjRnRnBVT1g4SnhLWmRFQzJteUVxbGVOZ2c3R3p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HgAAAAGYW1vdW50CQEAAAASRXh0cmFjdFJlc2VydmVkQW10AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAA3N0eAUAAAAHJG1hdGNoMAYHBw5ZV5I=", "chainId": 84, "height": 572173, "spentComplexity": 0 } View: original | compacted Prev: 2dFEzpMAwGH2fj8g6WdUDbnKrfSrepgfhn6fQTk5Ug5G Next: AJy3WoVPhPodeF8TsZGEnTtMS9yvD2LzLMFLRwQxz1nh Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqlAiANSmBpDHYKP9sKgeN/l1bAb28g/tGlgDkwT5FiMN4X3pwdvdxE7mvSR8/41dU9rx4jG+6tZpb1ULVDPs431tR2IRaTXw5Cj+Ac2vhL+5JamCerGD1UW+bh/EGQtxo8W3YLDrofXB5QHJx4Pkz2Kgf+oS/C8hHuB/U4krO76U0507GTjZPP9kRQ0uLSMeqQXt8wXS+nMp5wajqxPpDLMaSREgsKwv/AEkP4dzpTYbikLBYl4qtdJsD84HLFSkiwd3BhcOrPjoIYmLxQuBD5TIMKTKD3sdZgaY9rsyqx3A00innyxD6zp3b4gFpUOX8JxKZdEC2myEqleNgg7GzwIDAQAB")
55
6-let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j")
6+let SERVER = addressFromStringValue("3N4Aib5iubWiGMzdTh6wWiVDVbo32oeVUmH")
77
88 let RANDORACLETIMEFRAME = 2880
99
1111
1212 let COMMISSION = ((5 * WAVELET) / 1000)
1313
14-let BETMIN = ((1 * WAVELET) / 2)
14+let BET1 = (1 * WAVELET)
1515
16-let BETMAX = (6 * WAVELET)
16+let BET2 = (2 * WAVELET)
1717
18-let BETSTEP = ((1 * WAVELET) / 10)
18+let BET4 = (4 * WAVELET)
1919
20-let PRECISION = 10000
20+let BET8 = (8 * WAVELET)
2121
22-let R1MAX = 96
22+let BET14 = (14 * WAVELET)
2323
24-let R1MIN = 94
24+let RATEMULT = 10000
2525
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
8127
8228 let IdxGameState = 0
8329
12470 let newReservedAmount = (ExtractReservedAmt() + winAmt)
12571 let balance = wavesBalance(this)
12672 if ((newReservedAmount > balance))
127- then throw("Insufficient funds on Waves Rider account. Transaction was rejected for your safety.")
73+ then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.")
12874 else newReservedAmount
12975 }
13076
13884
13985
14086 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))
14796 if (betAmtValid)
14897 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")
198103 }
199- else throw(((((("Bet amount is not in range: minBet=" + toString(BETMIN)) + " maxBet=") + toString(BETMAX)) + " betStep=") + toString(BETSTEP)))
104+ else throw("Bet amount is not in range")
200105 }
201106
202107
203-func RandToStr (r) = if (if ((r >= 1))
204- then (100 >= r)
205- else false)
206- then toString(r)
207- else throw(("Unsupported r parameter passed: expected=[1,...,100] actual=" + toString(r)))
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)))
208113
209114
210115 func GenerateRandInt (gameId,rsaSign) = {
211116 let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
212117 if (rsaSigValid)
213118 then {
214- let rand = (toInt(sha256(rsaSign)) % 100)
119+ let rand = (toInt(sha256(rsaSign)) % 2)
215120 if ((0 > rand))
216- then ((-1 * rand) + 1)
217- else (rand + 1)
121+ then (-1 * rand)
122+ else rand
218123 }
219124 else throw("Invalid RSA signature")
220125 }
221126
222127
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
226133 }
227134
228135
303210
304211
305212 @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)
330213 func withdraw (gameId,rsaSign) = {
331214 let gameDataList = ExtractGameDataList(gameId)
332215 let gameState = gameDataList[IdxGameState]
341224 then throw("Invalid game state for passed gameId")
342225 else if (winByTimeout)
343226 then {
344- let randStr = playerChoice
227+ let randStr = take(playerChoice, 1)
345228 let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
346229 WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves)
347230 }
348231 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))
352234 then {
353235 let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
354236 WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqlAiANSmBpDHYKP9sKgeN/l1bAb28g/tGlgDkwT5FiMN4X3pwdvdxE7mvSR8/41dU9rx4jG+6tZpb1ULVDPs431tR2IRaTXw5Cj+Ac2vhL+5JamCerGD1UW+bh/EGQtxo8W3YLDrofXB5QHJx4Pkz2Kgf+oS/C8hHuB/U4krO76U0507GTjZPP9kRQ0uLSMeqQXt8wXS+nMp5wajqxPpDLMaSREgsKwv/AEkP4dzpTYbikLBYl4qtdJsD84HLFSkiwd3BhcOrPjoIYmLxQuBD5TIMKTKD3sdZgaY9rsyqx3A00innyxD6zp3b4gFpUOX8JxKZdEC2myEqleNgg7GzwIDAQAB")
55
6-let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j")
6+let SERVER = addressFromStringValue("3N4Aib5iubWiGMzdTh6wWiVDVbo32oeVUmH")
77
88 let RANDORACLETIMEFRAME = 2880
99
1010 let WAVELET = ((100 * 1000) * 1000)
1111
1212 let COMMISSION = ((5 * WAVELET) / 1000)
1313
14-let BETMIN = ((1 * WAVELET) / 2)
14+let BET1 = (1 * WAVELET)
1515
16-let BETMAX = (6 * WAVELET)
16+let BET2 = (2 * WAVELET)
1717
18-let BETSTEP = ((1 * WAVELET) / 10)
18+let BET4 = (4 * WAVELET)
1919
20-let PRECISION = 10000
20+let BET8 = (8 * WAVELET)
2121
22-let R1MAX = 96
22+let BET14 = (14 * WAVELET)
2323
24-let R1MIN = 94
24+let RATEMULT = 10000
2525
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
8127
8228 let IdxGameState = 0
8329
8430 let IdxPlayerChoice = 1
8531
8632 let IdxPlayerPubKey58 = 2
8733
8834 let IdxStartedHeight = 3
8935
9036 let IdxWinAmt = 4
9137
9238 let IdxRandOrEmpty = 5
9339
9440 let RESERVATIONKEY = "$RESERVED_AMOUNT"
9541
9642 let GAMESCOUNTERKEY = "$GAME_NUM"
9743
9844 let STATESUBMITTED = "SUBMITTED"
9945
10046 let STATEWON = "WON"
10147
10248 let STATELOST = "LOST"
10349
10450 func IncrementGameNum () = {
10551 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
10652 case num: Int =>
10753 num
10854 case _ =>
10955 0
11056 }
11157 (gameNum + 1)
11258 }
11359
11460
11561 func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) {
11662 case a: Int =>
11763 a
11864 case _ =>
11965 0
12066 }
12167
12268
12369 func ValidateAndIncreaseReservedAmt (winAmt) = {
12470 let newReservedAmount = (ExtractReservedAmt() + winAmt)
12571 let balance = wavesBalance(this)
12672 if ((newReservedAmount > balance))
127- then throw("Insufficient funds on Waves Rider account. Transaction was rejected for your safety.")
73+ then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.")
12874 else newReservedAmount
12975 }
13076
13177
13278 func DecreaseReservedAmt (gameId,winAmt) = {
13379 let newReservedAmount = (ExtractReservedAmt() - winAmt)
13480 if ((0 > newReservedAmount))
13581 then throw("Invalid Dice Roller account state - reserved amount is less than 0")
13682 else DataEntry(RESERVATIONKEY, newReservedAmount)
13783 }
13884
13985
14086 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))
14796 if (betAmtValid)
14897 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")
198103 }
199- else throw(((((("Bet amount is not in range: minBet=" + toString(BETMIN)) + " maxBet=") + toString(BETMAX)) + " betStep=") + toString(BETSTEP)))
104+ else throw("Bet amount is not in range")
200105 }
201106
202107
203-func RandToStr (r) = if (if ((r >= 1))
204- then (100 >= r)
205- else false)
206- then toString(r)
207- else throw(("Unsupported r parameter passed: expected=[1,...,100] actual=" + toString(r)))
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)))
208113
209114
210115 func GenerateRandInt (gameId,rsaSign) = {
211116 let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
212117 if (rsaSigValid)
213118 then {
214- let rand = (toInt(sha256(rsaSign)) % 100)
119+ let rand = (toInt(sha256(rsaSign)) % 2)
215120 if ((0 > rand))
216- then ((-1 * rand) + 1)
217- else (rand + 1)
121+ then (-1 * rand)
122+ else rand
218123 }
219124 else throw("Invalid RSA signature")
220125 }
221126
222127
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
226133 }
227134
228135
229136 func FormatGameDataParam (p) = {
230137 let s = size(p)
231138 if ((s == 0))
232139 then throw("Parameter size must be greater then 0")
233140 else if ((s > 99))
234141 then throw("Parameter size must be less then 100")
235142 else if ((10 > s))
236143 then (("0" + toString(s)) + p)
237144 else (toString(s) + p)
238145 }
239146
240147
241148 func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = {
242149 let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt)))
243150 if ((randOrEmpty == ""))
244151 then fullStateStr
245152 else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty))
246153 }
247154
248155
249156 func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0))
250157 then drop(remaining, 1)
251158 else remaining
252159
253160
254161 func ParseNextAttribute (remaining) = {
255162 let s = size(remaining)
256163 if ((s > 0))
257164 then {
258165 let nn = parseIntValue(take(remaining, 2))
259166 let v = take(drop(remaining, 2), nn)
260167 let tmpRemaining = drop(remaining, (nn + 2))
261168 let remainingState = RemoveUnderscoreIfPresent(tmpRemaining)
262169 [v, remainingState]
263170 }
264171 else throw("Empty string was passed into parseNextAttribute func")
265172 }
266173
267174
268175 func ParseGameRawDataStr (rawStateStr) = {
269176 let gameState = ParseNextAttribute(rawStateStr)
270177 let playerChoice = ParseNextAttribute(gameState[1])
271178 let playerPubKey58 = ParseNextAttribute(playerChoice[1])
272179 let startedHeight = ParseNextAttribute(playerPubKey58[1])
273180 let winAmt = ParseNextAttribute(startedHeight[1])
274181 [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]]
275182 }
276183
277184
278185 func ExtractGameDataList (gameId) = {
279186 let rawDataStr = match getString(this, gameId) {
280187 case str: String =>
281188 str
282189 case _ =>
283190 throw(("Couldn't find game by " + gameId))
284191 }
285192 ParseGameRawDataStr(rawDataStr)
286193 }
287194
288195
289196 func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,winByTimeout,decreasedReserves) = {
290197 let wSetCommonData = [decreasedReserves]
291198 let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, unit)]
292199 if (winByTimeout)
293200 then {
294201 let newGameDataStrAdjusted = ((newGameDataStr + "_") + FormatGameDataParam("TIMEOUT"))
295202 let gameData = DataEntry(gameId, newGameDataStrAdjusted)
296203 ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData))
297204 }
298205 else {
299206 let gameData = DataEntry(gameId, newGameDataStr)
300207 ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData))
301208 }
302209 }
303210
304211
305212 @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)
330213 func withdraw (gameId,rsaSign) = {
331214 let gameDataList = ExtractGameDataList(gameId)
332215 let gameState = gameDataList[IdxGameState]
333216 let playerChoice = gameDataList[IdxPlayerChoice]
334217 let startedHeight = parseIntValue(gameDataList[IdxStartedHeight])
335218 let winAmt = parseIntValue(gameDataList[IdxWinAmt])
336219 let playerPubKey58 = gameDataList[IdxPlayerPubKey58]
337220 let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
338221 let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME)
339222 let decreasedReserves = DecreaseReservedAmt(gameId, winAmt)
340223 if ((gameState != STATESUBMITTED))
341224 then throw("Invalid game state for passed gameId")
342225 else if (winByTimeout)
343226 then {
344- let randStr = playerChoice
227+ let randStr = take(playerChoice, 1)
345228 let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
346229 WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves)
347230 }
348231 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))
352234 then {
353235 let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
354236 WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves)
355237 }
356238 else {
357239 let newGameDataStr = FormatGameDataStr(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmt, randStr)
358240 WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves])
359241 }
360242 }
361243 }
362244
363245
364246 @Verifier(tx)
365247 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
366248 then match tx {
367249 case ttx: TransferTransaction =>
368250 ((wavesBalance(this) - ttx.amount) >= ExtractReservedAmt())
369251 case stx: SetScriptTransaction =>
370252 true
371253 case _ =>
372254 false
373255 }
374256 else false
375257

github/deemru/w8io/026f985 
46.38 ms