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