tx · JDv8NTaAuouY7c9iJ5x9qTPydF3tiBkyKuPAszhFUXzW 3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc: -0.05000000 Waves 2020.01.01 19:37 [834984] smart account 3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc > SELF 0.00000000 Waves
{ "type": 13, "id": "JDv8NTaAuouY7c9iJ5x9qTPydF3tiBkyKuPAszhFUXzW", "fee": 5000000, "feeAssetId": null, "timestamp": 1577896629568, "version": 1, "sender": "3MrdV3AP4zfU77ifesNStoDZmL1Cfx13eDc", "senderPublicKey": "5M79Anear5ntQk2bbDdFA2goiPXkv7Xy2UpV4n5RKRv", "proofs": [ "2Bz8AbkFFKNbS7JrY9nvZHnpJxZiwuSGgDbp4YfH2BeYDep31cbgirz86rYKFfunLR7cXSuQYZrqnWGuogqQmFRN" ], "script": "base64:AAIDAAAAAAAAAA4IARIECgIIARIECgIIAgAAACoAAAAACVJTQVBVQkxJQwkAAlsAAAABAgAAAY9iYXNlNjQ6TUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFuZEdHaTNtSzNlTmF6M1Vad0o2REF6ck1aSjJvd0hXT1kwbkdWbUIyL09aTHRMSXRtejI5T0hMTDFpQ1dKVTl6SkJWdEFYNHhjL3dNV3pTeWFxTlVlQVA3Z2duaUc4UTNDN0NrN3JBTC85ckFEZ0FHbjVVRmpuVFA1QXBZY1ErUkh6bFg4Mi9xQ1ZMLzdVU3JpNHJuSy9mbXAvZVRVczlrYk4rTEU2U3RuMWlEaWpKQ0FmclMvOXpUK1JRREgzVDZ5c1lDSEwwSTZ3a0hIR3gydzNxTjNiZW9ZNCtsb1MrWG5BZy8vMGdIdGtMOTNBVVBFUGVBTGo1MDhYcHZVSDdmRG5hVWJyUGNVeTVhMHQ1VlJJREY2ZllDRWFpa2NmbFdNOVdnM2hkbjhZeTVPU2Q4eEtvMkFyTGVvb1ZZZEpjTVZubXNkeG1mZ0lHZzF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chainId": 84, "height": 834984, "spentComplexity": 0 } View: original | compacted Prev: J1chDQThUWjWWQx5Kjxm1nfS42oiqJbstGPMQpT1AVDz Next: J6b6hntFFT6GYqdB6mfyLhYmopVcL9sbeSozUvS9YQzf Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAndGGi3mK3eNaz3UZwJ6DAzrMZJ2owHWOY0nGVmB2/OZLtLItmz29OHLL1iCWJU9zJBVtAX4xc/wMWzSyaqNUeAP7ggniG8Q3C7Ck7rAL/9rADgAGn5UFjnTP5ApYcQ+RHzlX82/qCVL/7USri4rnK/fmp/eTUs9kbN+LE6Stn1iDijJCAfrS/9zT+RQDH3T6ysYCHL0I6wkHHGx2w3qN3beoY4+loS+XnAg//0gHtkL93AUPEPeALj508XpvUH7fDnaUbrPcUy5a0t5VRIDF6fYCEaikcflWM9Wg3hdn8Yy5OSd8xKo2ArLeooVYdJcMVnmsdxmfgIGg1dDc4Vl7xwIDAQAB") | |
5 | 5 | ||
6 | - | let | |
6 | + | let GAMESCOUNTERKEY = "$GAME_NUM" | |
7 | 7 | ||
8 | - | let WALLETCOUNTERKEY = "$WALLET_NUM" | |
9 | - | ||
10 | - | let COMMUNITYFEEKEY = "$COMMUNITYFEE_AMOUNT" | |
8 | + | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
11 | 9 | ||
12 | 10 | let WBET = base58'A4q1mYKo11yuH9gmvDodeJoksagcyQzeFE9JtphMWddw' | |
13 | 11 | ||
14 | - | let | |
12 | + | let WALLETCOMMUNITY = Address(base58'3MtCy2PCFPyu8A9SRNL4qUo1V17SGLHftD8') | |
15 | 13 | ||
16 | - | let | |
14 | + | let WALLETWAVESBET = Address(base58'3MxK12u62zsu9xh3hU7p5iJncCLANd3zhTZ') | |
17 | 15 | ||
18 | - | let | |
16 | + | let WALLETMCAFEE = Address(base58'3MxK12u62zsu9xh3hU7p5iJncCLANd3zhTZ') | |
19 | 17 | ||
20 | - | let | |
18 | + | let WAVELET = 100000000 | |
21 | 19 | ||
22 | - | let | |
20 | + | let FEECOMMUNITY = 1 | |
23 | 21 | ||
24 | - | let | |
22 | + | let FEEWAVESBET = 3 | |
25 | 23 | ||
26 | - | let | |
24 | + | let FEEMCAFEE = 2 | |
27 | 25 | ||
28 | - | func IncrementWalletNum () = { | |
29 | - | let walletNum = match getInteger(this, WALLETCOUNTERKEY) { | |
26 | + | let STATESUBMITTED = "SUBMITTED" | |
27 | + | ||
28 | + | let STATEWON = "WON" | |
29 | + | ||
30 | + | let STATELOST = "LOST" | |
31 | + | ||
32 | + | let ROLLUNDER = "UNDER" | |
33 | + | ||
34 | + | let ROLLOVER = "OVER" | |
35 | + | ||
36 | + | let BETMIN = (1000 * WAVELET) | |
37 | + | ||
38 | + | let BETMAX = (20000000 * WAVELET) | |
39 | + | ||
40 | + | let PREDICTIONMIN = 1 | |
41 | + | ||
42 | + | let PREDICTIONMAX = 99 | |
43 | + | ||
44 | + | let IdxGameState = 0 | |
45 | + | ||
46 | + | let IdxPrediction = 1 | |
47 | + | ||
48 | + | let IdxType = 2 | |
49 | + | ||
50 | + | let IdxPlayerPubKey58 = 3 | |
51 | + | ||
52 | + | let IdxWinAmt = 4 | |
53 | + | ||
54 | + | let IdxRandOrEmpty = 5 | |
55 | + | ||
56 | + | func IncrementGameNum () = { | |
57 | + | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
30 | 58 | case num: Int => | |
31 | 59 | num | |
32 | 60 | case _ => | |
33 | 61 | 0 | |
34 | 62 | } | |
35 | - | ( | |
63 | + | (gameNum + 1) | |
36 | 64 | } | |
37 | 65 | ||
38 | 66 | ||
39 | - | func | |
67 | + | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
40 | 68 | case a: Int => | |
41 | 69 | a | |
42 | 70 | case _ => | |
44 | 72 | } | |
45 | 73 | ||
46 | 74 | ||
47 | - | func ExtractROYALReservedAmt () = match getInteger(this, LOCKEDROYALKEY) { | |
48 | - | case a: Int => | |
49 | - | a | |
50 | - | case _ => | |
51 | - | 0 | |
52 | - | } | |
53 | - | ||
54 | - | ||
55 | - | func ExtractFEEReservedAmt () = match getInteger(this, COMMUNITYFEEKEY) { | |
56 | - | case a: Int => | |
57 | - | a | |
58 | - | case _ => | |
59 | - | 0 | |
60 | - | } | |
61 | - | ||
62 | - | ||
63 | - | func ExtractPlayerAmt (wallet) = match getString(this, wallet) { | |
64 | - | case str: String => | |
65 | - | str | |
66 | - | case _ => | |
67 | - | "0_0_0_0_0" | |
68 | - | } | |
69 | - | ||
70 | - | ||
71 | - | func WalletExist (wallet) = match getString(this, wallet) { | |
72 | - | case str: String => | |
73 | - | true | |
74 | - | case _ => | |
75 | - | false | |
76 | - | } | |
77 | - | ||
78 | - | ||
79 | - | func FormatPlayerBalance (wbet,royal,wbetWithdraw,royalWithdraw,wavesWithdraw) = ((((((((toString(wbet) + "_") + toString(royal)) + "_") + toString(wbetWithdraw)) + "_") + toString(royalWithdraw)) + "_") + toString(wavesWithdraw)) | |
80 | - | ||
81 | - | ||
82 | - | func ParsePlayerBalance (wallet) = { | |
83 | - | let amounts = split(ExtractPlayerAmt(wallet), "_") | |
84 | - | let wbetAmount = parseIntValue(amounts[WBETLOCKED]) | |
85 | - | let royalAmount = parseIntValue(amounts[ROYALLOCKED]) | |
86 | - | let wbetWithdraw = parseIntValue(amounts[WBETWITHDRAW]) | |
87 | - | let royalWithdraw = parseIntValue(amounts[ROYALWITHDRAW]) | |
88 | - | let wavesWithdraw = parseIntValue(amounts[WAVESWITHDRAW]) | |
89 | - | [wbetAmount, royalAmount, wbetWithdraw, royalWithdraw, wavesWithdraw] | |
75 | + | func ValidateAndIncreaseReservedAmt (winAmt) = { | |
76 | + | let newReservedAmount = (ExtractReservedAmt() + winAmt) | |
77 | + | let balance = assetBalance(this, WBET) | |
78 | + | if ((newReservedAmount > balance)) | |
79 | + | then throw("Insufficient funds on Wavesbet Dice account. Transaction was rejected for your safety.") | |
80 | + | else newReservedAmount | |
90 | 81 | } | |
91 | 82 | ||
92 | 83 | ||
84 | + | func FormatGameDataParam (p) = { | |
85 | + | let s = size(p) | |
86 | + | if ((s == 0)) | |
87 | + | then throw("Parameter size must be greater then 0") | |
88 | + | else if ((s > 99)) | |
89 | + | then throw("Parameter size must be less then 100") | |
90 | + | else if ((10 > s)) | |
91 | + | then (("0" + toString(s)) + p) | |
92 | + | else (toString(s) + p) | |
93 | + | } | |
94 | + | ||
95 | + | ||
96 | + | func FormatGameDataStr (gameState,prediction,typeRoll,playerPubKey58,winAmt,randOrEmpty) = { | |
97 | + | let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(toString(prediction))) + "_") + FormatGameDataParam(typeRoll)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(winAmt))) | |
98 | + | if ((randOrEmpty == "")) | |
99 | + | then fullStateStr | |
100 | + | else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty)) | |
101 | + | } | |
102 | + | ||
103 | + | ||
104 | + | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
105 | + | then drop(remaining, 1) | |
106 | + | else remaining | |
107 | + | ||
108 | + | ||
109 | + | func ParseNextAttribute (remaining) = { | |
110 | + | let s = size(remaining) | |
111 | + | if ((s > 0)) | |
112 | + | then { | |
113 | + | let nn = parseIntValue(take(remaining, 2)) | |
114 | + | let v = take(drop(remaining, 2), nn) | |
115 | + | let tmpRemaining = drop(remaining, (nn + 2)) | |
116 | + | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
117 | + | [v, remainingState] | |
118 | + | } | |
119 | + | else throw("Empty string was passed into parseNextAttribute func") | |
120 | + | } | |
121 | + | ||
122 | + | ||
123 | + | func ParseGameRawDataStr (rawStateStr) = { | |
124 | + | let gameState = ParseNextAttribute(rawStateStr) | |
125 | + | let prediction = ParseNextAttribute(gameState[1]) | |
126 | + | let rollType = ParseNextAttribute(prediction[1]) | |
127 | + | let playerPubKey58 = ParseNextAttribute(rollType[1]) | |
128 | + | let winAmt = ParseNextAttribute(playerPubKey58[1]) | |
129 | + | [gameState[0], prediction[0], rollType[0], playerPubKey58[0], winAmt[0]] | |
130 | + | } | |
131 | + | ||
132 | + | ||
133 | + | func ExtractGameDataList (gameId) = { | |
134 | + | let rawDataStr = match getString(this, gameId) { | |
135 | + | case str: String => | |
136 | + | str | |
137 | + | case _ => | |
138 | + | throw(("Couldn't find game by " + gameId)) | |
139 | + | } | |
140 | + | ParseGameRawDataStr(rawDataStr) | |
141 | + | } | |
142 | + | ||
143 | + | ||
144 | + | func DecreaseReservedAmt (gameId,winAmt) = { | |
145 | + | let newReservedAmount = (ExtractReservedAmt() - winAmt) | |
146 | + | if ((0 > newReservedAmount)) | |
147 | + | then throw("Invalid Dice Roller account state - reserved amount is less than 0") | |
148 | + | else DataEntry(RESERVATIONKEY, newReservedAmount) | |
149 | + | } | |
150 | + | ||
151 | + | ||
152 | + | func GenerateRandInt (gameId,rsaSign) = { | |
153 | + | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
154 | + | if (rsaSigValid) | |
155 | + | then { | |
156 | + | let rand = (toInt(sha256(rsaSign)) % 100) | |
157 | + | if ((0 > rand)) | |
158 | + | then ((-1 * rand) + 1) | |
159 | + | else (rand + 1) | |
160 | + | } | |
161 | + | else throw("Invalid RSA signature") | |
162 | + | } | |
163 | + | ||
164 | + | ||
165 | + | func RandToStr (r) = if (if ((r >= 1)) | |
166 | + | then (100 >= r) | |
167 | + | else false) | |
168 | + | then toString(r) | |
169 | + | else throw(("Unsupported r parameter passed: expected=[1,...,100] actual=" + toString(r))) | |
170 | + | ||
171 | + | ||
172 | + | func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,decreasedReserves) = { | |
173 | + | let wSetCommonData = [decreasedReserves] | |
174 | + | let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, WBET)] | |
175 | + | let gameData = DataEntry(gameId, newGameDataStr) | |
176 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | func Multiplier (prediction,rollType) = if ((rollType == ROLLUNDER)) | |
181 | + | then if ((prediction == 1)) | |
182 | + | then 9850000 | |
183 | + | else if ((prediction == 2)) | |
184 | + | then 4925000 | |
185 | + | else if ((prediction == 3)) | |
186 | + | then 3283330 | |
187 | + | else if ((prediction == 4)) | |
188 | + | then 2462500 | |
189 | + | else if ((prediction == 5)) | |
190 | + | then 1970000 | |
191 | + | else if ((prediction == 6)) | |
192 | + | then 1641660 | |
193 | + | else if ((prediction == 7)) | |
194 | + | then 1407140 | |
195 | + | else if ((prediction == 8)) | |
196 | + | then 1231250 | |
197 | + | else if ((prediction == 9)) | |
198 | + | then 1094440 | |
199 | + | else if ((prediction == 10)) | |
200 | + | then 985000 | |
201 | + | else if ((prediction == 11)) | |
202 | + | then 895450 | |
203 | + | else if ((prediction == 12)) | |
204 | + | then 820830 | |
205 | + | else if ((prediction == 13)) | |
206 | + | then 757690 | |
207 | + | else if ((prediction == 14)) | |
208 | + | then 703570 | |
209 | + | else if ((prediction == 15)) | |
210 | + | then 656660 | |
211 | + | else if ((prediction == 16)) | |
212 | + | then 615620 | |
213 | + | else if ((prediction == 17)) | |
214 | + | then 579410 | |
215 | + | else if ((prediction == 18)) | |
216 | + | then 547220 | |
217 | + | else if ((prediction == 19)) | |
218 | + | then 518420 | |
219 | + | else if ((prediction == 20)) | |
220 | + | then 492500 | |
221 | + | else if ((prediction == 21)) | |
222 | + | then 469040 | |
223 | + | else if ((prediction == 22)) | |
224 | + | then 447720 | |
225 | + | else if ((prediction == 23)) | |
226 | + | then 428260 | |
227 | + | else if ((prediction == 24)) | |
228 | + | then 410410 | |
229 | + | else if ((prediction == 25)) | |
230 | + | then 394000 | |
231 | + | else if ((prediction == 26)) | |
232 | + | then 378840 | |
233 | + | else if ((prediction == 27)) | |
234 | + | then 364810 | |
235 | + | else if ((prediction == 28)) | |
236 | + | then 351780 | |
237 | + | else if ((prediction == 29)) | |
238 | + | then 339650 | |
239 | + | else if ((prediction == 30)) | |
240 | + | then 328330 | |
241 | + | else if ((prediction == 31)) | |
242 | + | then 317740 | |
243 | + | else if ((prediction == 32)) | |
244 | + | then 307810 | |
245 | + | else if ((prediction == 33)) | |
246 | + | then 298480 | |
247 | + | else if ((prediction == 34)) | |
248 | + | then 289700 | |
249 | + | else if ((prediction == 35)) | |
250 | + | then 281420 | |
251 | + | else if ((prediction == 36)) | |
252 | + | then 273610 | |
253 | + | else if ((prediction == 37)) | |
254 | + | then 259210 | |
255 | + | else if ((prediction == 38)) | |
256 | + | then 259210 | |
257 | + | else if ((prediction == 39)) | |
258 | + | then 252560 | |
259 | + | else if ((prediction == 40)) | |
260 | + | then 246250 | |
261 | + | else if ((prediction == 41)) | |
262 | + | then 240240 | |
263 | + | else if ((prediction == 42)) | |
264 | + | then 234520 | |
265 | + | else if ((prediction == 43)) | |
266 | + | then 229060 | |
267 | + | else if ((prediction == 44)) | |
268 | + | then 223860 | |
269 | + | else if ((prediction == 45)) | |
270 | + | then 218880 | |
271 | + | else if ((prediction == 46)) | |
272 | + | then 214130 | |
273 | + | else if ((prediction == 47)) | |
274 | + | then 209570 | |
275 | + | else if ((prediction == 48)) | |
276 | + | then 205200 | |
277 | + | else if ((prediction == 49)) | |
278 | + | then 201020 | |
279 | + | else if ((prediction == 50)) | |
280 | + | then 197000 | |
281 | + | else if ((prediction == 51)) | |
282 | + | then 193130 | |
283 | + | else if ((prediction == 52)) | |
284 | + | then 189420 | |
285 | + | else if ((prediction == 53)) | |
286 | + | then 185840 | |
287 | + | else if ((prediction == 54)) | |
288 | + | then 182400 | |
289 | + | else if ((prediction == 55)) | |
290 | + | then 179090 | |
291 | + | else if ((prediction == 56)) | |
292 | + | then 175890 | |
293 | + | else if ((prediction == 57)) | |
294 | + | then 172800 | |
295 | + | else if ((prediction == 58)) | |
296 | + | then 169820 | |
297 | + | else if ((prediction == 59)) | |
298 | + | then 166940 | |
299 | + | else if ((prediction == 60)) | |
300 | + | then 164160 | |
301 | + | else if ((prediction == 61)) | |
302 | + | then 161470 | |
303 | + | else if ((prediction == 62)) | |
304 | + | then 158870 | |
305 | + | else if ((prediction == 63)) | |
306 | + | then 156340 | |
307 | + | else if ((prediction == 64)) | |
308 | + | then 153900 | |
309 | + | else if ((prediction == 65)) | |
310 | + | then 151530 | |
311 | + | else if ((prediction == 66)) | |
312 | + | then 149240 | |
313 | + | else if ((prediction == 67)) | |
314 | + | then 147010 | |
315 | + | else if ((prediction == 68)) | |
316 | + | then 144850 | |
317 | + | else if ((prediction == 69)) | |
318 | + | then 142750 | |
319 | + | else if ((prediction == 70)) | |
320 | + | then 140710 | |
321 | + | else if ((prediction == 71)) | |
322 | + | then 138730 | |
323 | + | else if ((prediction == 72)) | |
324 | + | then 136800 | |
325 | + | else if ((prediction == 73)) | |
326 | + | then 134930 | |
327 | + | else if ((prediction == 74)) | |
328 | + | then 133100 | |
329 | + | else if ((prediction == 75)) | |
330 | + | then 131330 | |
331 | + | else if ((prediction == 76)) | |
332 | + | then 129600 | |
333 | + | else if ((prediction == 77)) | |
334 | + | then 127920 | |
335 | + | else if ((prediction == 78)) | |
336 | + | then 126280 | |
337 | + | else if ((prediction == 79)) | |
338 | + | then 124680 | |
339 | + | else if ((prediction == 80)) | |
340 | + | then 123120 | |
341 | + | else if ((prediction == 81)) | |
342 | + | then 121600 | |
343 | + | else if ((prediction == 82)) | |
344 | + | then 120120 | |
345 | + | else if ((prediction == 83)) | |
346 | + | then 118670 | |
347 | + | else if ((prediction == 84)) | |
348 | + | then 117260 | |
349 | + | else if ((prediction == 85)) | |
350 | + | then 115880 | |
351 | + | else if ((prediction == 86)) | |
352 | + | then 114530 | |
353 | + | else if ((prediction == 87)) | |
354 | + | then 113210 | |
355 | + | else if ((prediction == 88)) | |
356 | + | then 111930 | |
357 | + | else if ((prediction == 89)) | |
358 | + | then 110670 | |
359 | + | else if ((prediction == 90)) | |
360 | + | then 109440 | |
361 | + | else if ((prediction == 91)) | |
362 | + | then 108240 | |
363 | + | else if ((prediction == 92)) | |
364 | + | then 107060 | |
365 | + | else if ((prediction == 93)) | |
366 | + | then 105910 | |
367 | + | else if ((prediction == 94)) | |
368 | + | then 104780 | |
369 | + | else if ((prediction == 95)) | |
370 | + | then 103680 | |
371 | + | else if ((prediction == 96)) | |
372 | + | then 103680 | |
373 | + | else 100000 | |
374 | + | else if ((rollType == ROLLOVER)) | |
375 | + | then if ((prediction == 4)) | |
376 | + | then 103680 | |
377 | + | else if ((prediction == 5)) | |
378 | + | then 103680 | |
379 | + | else if ((prediction == 6)) | |
380 | + | then 104780 | |
381 | + | else if ((prediction == 7)) | |
382 | + | then 105910 | |
383 | + | else if ((prediction == 8)) | |
384 | + | then 107060 | |
385 | + | else if ((prediction == 9)) | |
386 | + | then 108240 | |
387 | + | else if ((prediction == 10)) | |
388 | + | then 109440 | |
389 | + | else if ((prediction == 11)) | |
390 | + | then 110670 | |
391 | + | else if ((prediction == 12)) | |
392 | + | then 111930 | |
393 | + | else if ((prediction == 13)) | |
394 | + | then 113210 | |
395 | + | else if ((prediction == 14)) | |
396 | + | then 114530 | |
397 | + | else if ((prediction == 15)) | |
398 | + | then 115880 | |
399 | + | else if ((prediction == 16)) | |
400 | + | then 117260 | |
401 | + | else if ((prediction == 17)) | |
402 | + | then 118670 | |
403 | + | else if ((prediction == 18)) | |
404 | + | then 120120 | |
405 | + | else if ((prediction == 19)) | |
406 | + | then 121600 | |
407 | + | else if ((prediction == 20)) | |
408 | + | then 123120 | |
409 | + | else if ((prediction == 21)) | |
410 | + | then 124680 | |
411 | + | else if ((prediction == 22)) | |
412 | + | then 126280 | |
413 | + | else if ((prediction == 23)) | |
414 | + | then 127920 | |
415 | + | else if ((prediction == 24)) | |
416 | + | then 129600 | |
417 | + | else if ((prediction == 25)) | |
418 | + | then 131330 | |
419 | + | else if ((prediction == 26)) | |
420 | + | then 133100 | |
421 | + | else if ((prediction == 27)) | |
422 | + | then 134930 | |
423 | + | else if ((prediction == 28)) | |
424 | + | then 136800 | |
425 | + | else if ((prediction == 29)) | |
426 | + | then 138730 | |
427 | + | else if ((prediction == 30)) | |
428 | + | then 140710 | |
429 | + | else if ((prediction == 31)) | |
430 | + | then 142750 | |
431 | + | else if ((prediction == 32)) | |
432 | + | then 144850 | |
433 | + | else if ((prediction == 33)) | |
434 | + | then 147010 | |
435 | + | else if ((prediction == 34)) | |
436 | + | then 149240 | |
437 | + | else if ((prediction == 35)) | |
438 | + | then 151530 | |
439 | + | else if ((prediction == 36)) | |
440 | + | then 153900 | |
441 | + | else if ((prediction == 37)) | |
442 | + | then 156340 | |
443 | + | else if ((prediction == 38)) | |
444 | + | then 158870 | |
445 | + | else if ((prediction == 39)) | |
446 | + | then 161470 | |
447 | + | else if ((prediction == 40)) | |
448 | + | then 164160 | |
449 | + | else if ((prediction == 41)) | |
450 | + | then 166940 | |
451 | + | else if ((prediction == 42)) | |
452 | + | then 169820 | |
453 | + | else if ((prediction == 43)) | |
454 | + | then 172800 | |
455 | + | else if ((prediction == 44)) | |
456 | + | then 175890 | |
457 | + | else if ((prediction == 45)) | |
458 | + | then 179090 | |
459 | + | else if ((prediction == 46)) | |
460 | + | then 185840 | |
461 | + | else if ((prediction == 47)) | |
462 | + | then 185840 | |
463 | + | else if ((prediction == 48)) | |
464 | + | then 189420 | |
465 | + | else if ((prediction == 49)) | |
466 | + | then 193130 | |
467 | + | else if ((prediction == 50)) | |
468 | + | then 197000 | |
469 | + | else if ((prediction == 51)) | |
470 | + | then 201020 | |
471 | + | else if ((prediction == 52)) | |
472 | + | then 205200 | |
473 | + | else if ((prediction == 53)) | |
474 | + | then 209570 | |
475 | + | else if ((prediction == 54)) | |
476 | + | then 214130 | |
477 | + | else if ((prediction == 55)) | |
478 | + | then 218880 | |
479 | + | else if ((prediction == 56)) | |
480 | + | then 223860 | |
481 | + | else if ((prediction == 57)) | |
482 | + | then 229060 | |
483 | + | else if ((prediction == 58)) | |
484 | + | then 234520 | |
485 | + | else if ((prediction == 59)) | |
486 | + | then 240240 | |
487 | + | else if ((prediction == 60)) | |
488 | + | then 246250 | |
489 | + | else if ((prediction == 61)) | |
490 | + | then 252560 | |
491 | + | else if ((prediction == 62)) | |
492 | + | then 259210 | |
493 | + | else if ((prediction == 63)) | |
494 | + | then 259210 | |
495 | + | else if ((prediction == 64)) | |
496 | + | then 273610 | |
497 | + | else if ((prediction == 65)) | |
498 | + | then 281420 | |
499 | + | else if ((prediction == 66)) | |
500 | + | then 289700 | |
501 | + | else if ((prediction == 67)) | |
502 | + | then 298480 | |
503 | + | else if ((prediction == 68)) | |
504 | + | then 307810 | |
505 | + | else if ((prediction == 69)) | |
506 | + | then 317740 | |
507 | + | else if ((prediction == 70)) | |
508 | + | then 328330 | |
509 | + | else if ((prediction == 71)) | |
510 | + | then 339650 | |
511 | + | else if ((prediction == 72)) | |
512 | + | then 351780 | |
513 | + | else if ((prediction == 73)) | |
514 | + | then 364810 | |
515 | + | else if ((prediction == 74)) | |
516 | + | then 378840 | |
517 | + | else if ((prediction == 75)) | |
518 | + | then 394000 | |
519 | + | else if ((prediction == 76)) | |
520 | + | then 410410 | |
521 | + | else if ((prediction == 77)) | |
522 | + | then 428260 | |
523 | + | else if ((prediction == 78)) | |
524 | + | then 447720 | |
525 | + | else if ((prediction == 79)) | |
526 | + | then 469040 | |
527 | + | else if ((prediction == 80)) | |
528 | + | then 492500 | |
529 | + | else if ((prediction == 81)) | |
530 | + | then 518420 | |
531 | + | else if ((prediction == 82)) | |
532 | + | then 547220 | |
533 | + | else if ((prediction == 83)) | |
534 | + | then 579410 | |
535 | + | else if ((prediction == 84)) | |
536 | + | then 615620 | |
537 | + | else if ((prediction == 85)) | |
538 | + | then 656660 | |
539 | + | else if ((prediction == 86)) | |
540 | + | then 703570 | |
541 | + | else if ((prediction == 87)) | |
542 | + | then 757690 | |
543 | + | else if ((prediction == 88)) | |
544 | + | then 820830 | |
545 | + | else if ((prediction == 89)) | |
546 | + | then 895450 | |
547 | + | else if ((prediction == 90)) | |
548 | + | then 985000 | |
549 | + | else if ((prediction == 91)) | |
550 | + | then 1094440 | |
551 | + | else if ((prediction == 92)) | |
552 | + | then 1231250 | |
553 | + | else if ((prediction == 93)) | |
554 | + | then 1407140 | |
555 | + | else if ((prediction == 94)) | |
556 | + | then 1641660 | |
557 | + | else if ((prediction == 95)) | |
558 | + | then 1970000 | |
559 | + | else if ((prediction == 96)) | |
560 | + | then 2462500 | |
561 | + | else if ((prediction == 97)) | |
562 | + | then 3283330 | |
563 | + | else if ((prediction == 98)) | |
564 | + | then 4925000 | |
565 | + | else if ((prediction == 99)) | |
566 | + | then 9850000 | |
567 | + | else 100000 | |
568 | + | else 100000 | |
569 | + | ||
570 | + | ||
571 | + | func diceWin (type,prediction,number) = if ((type == ROLLUNDER)) | |
572 | + | then if ((prediction >= number)) | |
573 | + | then true | |
574 | + | else false | |
575 | + | else if ((type == ROLLOVER)) | |
576 | + | then if ((number >= prediction)) | |
577 | + | then true | |
578 | + | else false | |
579 | + | else false | |
580 | + | ||
581 | + | ||
582 | + | func ValidateBetAndDefineWinAmt (amount,prediction,rollType) = if (if ((BETMIN > amount)) | |
583 | + | then true | |
584 | + | else (amount > BETMAX)) | |
585 | + | then throw(((("Bet amount is not in range: minBet=" + toString((BETMIN / WAVELET))) + " maxBet=") + toString((BETMAX / WAVELET)))) | |
586 | + | else if (if ((rollType != ROLLUNDER)) | |
587 | + | then (rollType != ROLLOVER) | |
588 | + | else false) | |
589 | + | then throw("Invalid Roll type, try with OVER or UNDER") | |
590 | + | else if (if (if ((rollType == ROLLUNDER)) | |
591 | + | then (1 > prediction) | |
592 | + | else false) | |
593 | + | then true | |
594 | + | else if ((rollType == ROLLUNDER)) | |
595 | + | then (prediction > 96) | |
596 | + | else false) | |
597 | + | then throw("Prediction is out of the range for ROLL UNDER: 1 <= PREDICTION <= 96") | |
598 | + | else if (if (if ((rollType == ROLLOVER)) | |
599 | + | then (4 > prediction) | |
600 | + | else false) | |
601 | + | then true | |
602 | + | else if ((rollType == ROLLOVER)) | |
603 | + | then (prediction > 99) | |
604 | + | else false) | |
605 | + | then throw("Prediction is out of the range for ROLL OVER: 4 <= PREDICTION <= 99") | |
606 | + | else { | |
607 | + | let multi = Multiplier(prediction, rollType) | |
608 | + | fraction(((amount / 100000) * multi), (((100 - FEEWAVESBET) - FEEMCAFEE) - FEECOMMUNITY), 100) | |
609 | + | } | |
610 | + | ||
611 | + | ||
93 | 612 | @Callable(i) | |
94 | - | func lock () = { | |
613 | + | func playDice (rollType,prediction) = { | |
614 | + | let gameId = toBase58String(i.transactionId) | |
95 | 615 | let payment = extract(i.payment) | |
96 | - | if (if ((payment.assetId != WBET)) | |
97 | - | then (payment.assetId != ROYAL) | |
98 | - | else false) | |
99 | - | then throw("The token should be in WBET or ROYAL.") | |
100 | - | else { | |
101 | - | let wallet = toString(i.caller) | |
102 | - | let balance = ParsePlayerBalance(wallet) | |
103 | - | if ((payment.assetId == WBET)) | |
104 | - | then { | |
105 | - | let newWBETReservedAmount = (ExtractWBETReservedAmt() + payment.amount) | |
106 | - | let newPlayerWBETAmount = (balance[WBETLOCKED] + payment.amount) | |
107 | - | if (WalletExist(wallet)) | |
108 | - | then ScriptResult(WriteSet([DataEntry(LOCKEDWBETKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
109 | - | else { | |
110 | - | let newWalletNum = IncrementWalletNum() | |
111 | - | ScriptResult(WriteSet([DataEntry(WALLETCOUNTERKEY, newWalletNum), DataEntry(LOCKEDWBETKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
112 | - | } | |
113 | - | } | |
114 | - | else if ((payment.assetId == ROYAL)) | |
115 | - | then { | |
116 | - | let newROYALReservedAmount = (ExtractROYALReservedAmt() + payment.amount) | |
117 | - | let newPlayerRoyalAmount = (balance[ROYALLOCKED] + payment.amount) | |
118 | - | if (WalletExist(wallet)) | |
119 | - | then ScriptResult(WriteSet([DataEntry(LOCKEDROYALKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], newPlayerRoyalAmount, balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
120 | - | else { | |
121 | - | let newWalletNum = IncrementWalletNum() | |
122 | - | ScriptResult(WriteSet([DataEntry(WALLETCOUNTERKEY, newWalletNum), DataEntry(LOCKEDROYALKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], newPlayerRoyalAmount, balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
123 | - | } | |
616 | + | let feeAssetId = isDefined(i.feeAssetId) | |
617 | + | let winAmt = ValidateBetAndDefineWinAmt(payment.amount, prediction, rollType) | |
618 | + | let playerBalance = wavesBalance(i.caller) | |
619 | + | let gameIdUsed = isDefined(getString(this, gameId)) | |
620 | + | if ((payment.assetId != WBET)) | |
621 | + | then throw("Payment should be in Wavesbet") | |
622 | + | else if ((1000000 > playerBalance)) | |
623 | + | then throw("There are not enough waves, it takes 0.01 Waves to bet. Game aborted.") | |
624 | + | else if (feeAssetId) | |
625 | + | then throw("Transaction's fee must be in Waves. Game aborted.") | |
626 | + | else if (gameIdUsed) | |
627 | + | then throw("Passed gameId had been used before. Game aborted.") | |
628 | + | else { | |
629 | + | let newGameNum = IncrementGameNum() | |
630 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
631 | + | let gameDataStr = FormatGameDataStr(STATESUBMITTED, prediction, rollType, playerPubKey58, winAmt, "") | |
632 | + | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet([ScriptTransfer(WALLETCOMMUNITY, fraction(payment.amount, FEECOMMUNITY, 100), WBET), ScriptTransfer(WALLETWAVESBET, fraction(payment.amount, FEEWAVESBET, 100), WBET), ScriptTransfer(WALLETMCAFEE, fraction(payment.amount, FEEMCAFEE, 100), WBET)])) | |
124 | 633 | } | |
125 | - | else throw("error") | |
126 | - | } | |
127 | 634 | } | |
128 | 635 | ||
129 | 636 | ||
130 | 637 | ||
131 | 638 | @Callable(i) | |
132 | - | func unlock (asset) = { | |
133 | - | let wallet = toString(i.caller) | |
134 | - | let balance = ParsePlayerBalance(wallet) | |
135 | - | if ((asset == "WBET")) | |
136 | - | then if ((0 >= balance[WBETLOCKED])) | |
137 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
138 | - | else { | |
139 | - | let newWBETReservedAmount = (ExtractWBETReservedAmt() - balance[WBETLOCKED]) | |
140 | - | ScriptResult(WriteSet([DataEntry(LOCKEDWBETKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(0, balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet([ScriptTransfer(i.caller, balance[WBETLOCKED], WBET)])) | |
141 | - | } | |
142 | - | else if ((asset == "ROYAL")) | |
143 | - | then if ((0 >= balance[ROYALLOCKED])) | |
144 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
639 | + | func withdraw (gameId,rsaSig) = { | |
640 | + | let gameDataList = ExtractGameDataList(gameId) | |
641 | + | let gameState = gameDataList[IdxGameState] | |
642 | + | let prediction = parseIntValue(gameDataList[IdxPrediction]) | |
643 | + | let rollType = gameDataList[IdxType] | |
644 | + | let winAmt = parseIntValue(gameDataList[IdxWinAmt]) | |
645 | + | let playerPubKey58 = gameDataList[IdxPlayerPubKey58] | |
646 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
647 | + | let decreasedReserves = DecreaseReservedAmt(gameId, winAmt) | |
648 | + | if ((gameState != STATESUBMITTED)) | |
649 | + | then throw("Invalid game state for passed gameId. Game aborted.") | |
650 | + | else { | |
651 | + | let rand = GenerateRandInt(gameId, rsaSig) | |
652 | + | let randStr = RandToStr(rand) | |
653 | + | if (diceWin(rollType, prediction, rand)) | |
654 | + | then { | |
655 | + | let newGameDataStr = FormatGameDataStr(STATEWON, prediction, rollType, playerPubKey58, winAmt, randStr) | |
656 | + | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, decreasedReserves) | |
657 | + | } | |
145 | 658 | else { | |
146 | - | let | |
147 | - | | |
659 | + | let newGameDataStr = FormatGameDataStr(STATELOST, prediction, rollType, playerPubKey58, winAmt, randStr) | |
660 | + | WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves]) | |
148 | 661 | } | |
149 | - | else throw("Invalid asset") | |
150 | - | } | |
151 | - | ||
152 | - | ||
153 | - | ||
154 | - | @Callable(i) | |
155 | - | func withdraw (asset) = { | |
156 | - | let wallet = toString(i.caller) | |
157 | - | let balance = ParsePlayerBalance(wallet) | |
158 | - | if ((asset == "WBET")) | |
159 | - | then if ((0 >= balance[WBETWITHDRAW])) | |
160 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
161 | - | else ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], 0, balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet([ScriptTransfer(i.caller, balance[WBETWITHDRAW], WBET)])) | |
162 | - | else if ((asset == "ROYAL")) | |
163 | - | then if ((0 >= balance[ROYALWITHDRAW])) | |
164 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
165 | - | else ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], balance[WBETWITHDRAW], 0, balance[WAVESWITHDRAW]))]), TransferSet([ScriptTransfer(i.caller, balance[ROYALWITHDRAW], ROYAL)])) | |
166 | - | else if ((asset == "WAVES")) | |
167 | - | then if ((0 >= balance[WAVESWITHDRAW])) | |
168 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
169 | - | else ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[WBETWITHDRAW], 0))]), TransferSet([ScriptTransfer(i.caller, balance[WAVESWITHDRAW], unit)])) | |
170 | - | else throw("Invalid asset") | |
171 | - | } | |
172 | - | ||
173 | - | ||
174 | - | ||
175 | - | @Callable(i) | |
176 | - | func addWithdraw (wallet) = if ((i.caller == COMMUNITYWALLET)) | |
177 | - | then { | |
178 | - | let payment = extract(i.payment) | |
179 | - | let balance = ParsePlayerBalance(wallet) | |
180 | - | if ((payment.assetId == WBET)) | |
181 | - | then { | |
182 | - | let newWbetAmount = (balance[WBETWITHDRAW] + payment.amount) | |
183 | - | ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], newWbetAmount, balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
184 | - | } | |
185 | - | else if ((payment.assetId == ROYAL)) | |
186 | - | then { | |
187 | - | let newRoyalAmount = (balance[ROYALWITHDRAW] + payment.amount) | |
188 | - | ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], balance[WBETWITHDRAW], newRoyalAmount, balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
189 | - | } | |
190 | - | else if ((payment.assetId == unit)) | |
191 | - | then { | |
192 | - | let newWavesAmount = (balance[WAVESWITHDRAW] + payment.amount) | |
193 | - | ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[ROYALWITHDRAW], newWavesAmount))]), TransferSet(nil)) | |
194 | - | } | |
195 | - | else throw("Invalid asset") | |
196 | - | } | |
197 | - | else throw("You do not have permission to perform this function.") | |
198 | - | ||
199 | - | ||
200 | - | ||
201 | - | @Callable(i) | |
202 | - | func addCommunityFee () = { | |
203 | - | let payment = extract(i.payment) | |
204 | - | if ((payment.assetId != assetInfo(base58'WAVES'))) | |
205 | - | then throw("Payment should be in WAVES.") | |
206 | - | else { | |
207 | - | let newFEEReservedAmount = (ExtractFEEReservedAmt() + payment.amount) | |
208 | - | ScriptResult(WriteSet([DataEntry(COMMUNITYFEEKEY, newFEEReservedAmount)]), TransferSet(nil)) | |
209 | 662 | } | |
210 | 663 | } | |
211 | 664 | ||
212 | 665 | ||
213 | - | ||
214 | - | @Callable(i) | |
215 | - | func getCommunityFee (amount) = if ((i.caller == COMMUNITYWALLET)) | |
216 | - | then { | |
217 | - | let payment = extract(i.payment) | |
218 | - | let FEEReservedAmount = ExtractFEEReservedAmt() | |
219 | - | if ((amount > FEEReservedAmount)) | |
220 | - | then throw("You dont have enough balance to transfer the amount requested.") | |
221 | - | else { | |
222 | - | let newFEEReservedAmount = (FEEReservedAmount - amount) | |
223 | - | ScriptResult(WriteSet([DataEntry(COMMUNITYFEEKEY, newFEEReservedAmount)]), TransferSet([ScriptTransfer(COMMUNITYWALLET, amount, unit)])) | |
224 | - | } | |
225 | - | } | |
226 | - | else throw("You do not have permission to perform this function.") | |
227 | - | ||
228 | - | ||
229 | - | ||
230 | - | @Callable(i) | |
231 | - | func test (amount) = ScriptResult(WriteSet([DataEntry("test", "000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000120000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500001333")]), TransferSet(nil)) | |
232 | - | ||
666 | + | @Verifier(tx) | |
667 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
668 | + | then match tx { | |
669 | + | case ttx: TransferTransaction => | |
670 | + | ((assetBalance(this, WBET) - ttx.amount) >= ExtractReservedAmt()) | |
671 | + | case stx: SetScriptTransaction => | |
672 | + | true | |
673 | + | case _ => | |
674 | + | false | |
675 | + | } | |
676 | + | else false | |
233 | 677 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAndGGi3mK3eNaz3UZwJ6DAzrMZJ2owHWOY0nGVmB2/OZLtLItmz29OHLL1iCWJU9zJBVtAX4xc/wMWzSyaqNUeAP7ggniG8Q3C7Ck7rAL/9rADgAGn5UFjnTP5ApYcQ+RHzlX82/qCVL/7USri4rnK/fmp/eTUs9kbN+LE6Stn1iDijJCAfrS/9zT+RQDH3T6ysYCHL0I6wkHHGx2w3qN3beoY4+loS+XnAg//0gHtkL93AUPEPeALj508XpvUH7fDnaUbrPcUy5a0t5VRIDF6fYCEaikcflWM9Wg3hdn8Yy5OSd8xKo2ArLeooVYdJcMVnmsdxmfgIGg1dDc4Vl7xwIDAQAB") | |
5 | 5 | ||
6 | - | let | |
6 | + | let GAMESCOUNTERKEY = "$GAME_NUM" | |
7 | 7 | ||
8 | - | let WALLETCOUNTERKEY = "$WALLET_NUM" | |
9 | - | ||
10 | - | let COMMUNITYFEEKEY = "$COMMUNITYFEE_AMOUNT" | |
8 | + | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
11 | 9 | ||
12 | 10 | let WBET = base58'A4q1mYKo11yuH9gmvDodeJoksagcyQzeFE9JtphMWddw' | |
13 | 11 | ||
14 | - | let | |
12 | + | let WALLETCOMMUNITY = Address(base58'3MtCy2PCFPyu8A9SRNL4qUo1V17SGLHftD8') | |
15 | 13 | ||
16 | - | let | |
14 | + | let WALLETWAVESBET = Address(base58'3MxK12u62zsu9xh3hU7p5iJncCLANd3zhTZ') | |
17 | 15 | ||
18 | - | let | |
16 | + | let WALLETMCAFEE = Address(base58'3MxK12u62zsu9xh3hU7p5iJncCLANd3zhTZ') | |
19 | 17 | ||
20 | - | let | |
18 | + | let WAVELET = 100000000 | |
21 | 19 | ||
22 | - | let | |
20 | + | let FEECOMMUNITY = 1 | |
23 | 21 | ||
24 | - | let | |
22 | + | let FEEWAVESBET = 3 | |
25 | 23 | ||
26 | - | let | |
24 | + | let FEEMCAFEE = 2 | |
27 | 25 | ||
28 | - | func IncrementWalletNum () = { | |
29 | - | let walletNum = match getInteger(this, WALLETCOUNTERKEY) { | |
26 | + | let STATESUBMITTED = "SUBMITTED" | |
27 | + | ||
28 | + | let STATEWON = "WON" | |
29 | + | ||
30 | + | let STATELOST = "LOST" | |
31 | + | ||
32 | + | let ROLLUNDER = "UNDER" | |
33 | + | ||
34 | + | let ROLLOVER = "OVER" | |
35 | + | ||
36 | + | let BETMIN = (1000 * WAVELET) | |
37 | + | ||
38 | + | let BETMAX = (20000000 * WAVELET) | |
39 | + | ||
40 | + | let PREDICTIONMIN = 1 | |
41 | + | ||
42 | + | let PREDICTIONMAX = 99 | |
43 | + | ||
44 | + | let IdxGameState = 0 | |
45 | + | ||
46 | + | let IdxPrediction = 1 | |
47 | + | ||
48 | + | let IdxType = 2 | |
49 | + | ||
50 | + | let IdxPlayerPubKey58 = 3 | |
51 | + | ||
52 | + | let IdxWinAmt = 4 | |
53 | + | ||
54 | + | let IdxRandOrEmpty = 5 | |
55 | + | ||
56 | + | func IncrementGameNum () = { | |
57 | + | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
30 | 58 | case num: Int => | |
31 | 59 | num | |
32 | 60 | case _ => | |
33 | 61 | 0 | |
34 | 62 | } | |
35 | - | ( | |
63 | + | (gameNum + 1) | |
36 | 64 | } | |
37 | 65 | ||
38 | 66 | ||
39 | - | func | |
67 | + | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
40 | 68 | case a: Int => | |
41 | 69 | a | |
42 | 70 | case _ => | |
43 | 71 | 0 | |
44 | 72 | } | |
45 | 73 | ||
46 | 74 | ||
47 | - | func ExtractROYALReservedAmt () = match getInteger(this, LOCKEDROYALKEY) { | |
48 | - | case a: Int => | |
49 | - | a | |
50 | - | case _ => | |
51 | - | 0 | |
52 | - | } | |
53 | - | ||
54 | - | ||
55 | - | func ExtractFEEReservedAmt () = match getInteger(this, COMMUNITYFEEKEY) { | |
56 | - | case a: Int => | |
57 | - | a | |
58 | - | case _ => | |
59 | - | 0 | |
60 | - | } | |
61 | - | ||
62 | - | ||
63 | - | func ExtractPlayerAmt (wallet) = match getString(this, wallet) { | |
64 | - | case str: String => | |
65 | - | str | |
66 | - | case _ => | |
67 | - | "0_0_0_0_0" | |
68 | - | } | |
69 | - | ||
70 | - | ||
71 | - | func WalletExist (wallet) = match getString(this, wallet) { | |
72 | - | case str: String => | |
73 | - | true | |
74 | - | case _ => | |
75 | - | false | |
76 | - | } | |
77 | - | ||
78 | - | ||
79 | - | func FormatPlayerBalance (wbet,royal,wbetWithdraw,royalWithdraw,wavesWithdraw) = ((((((((toString(wbet) + "_") + toString(royal)) + "_") + toString(wbetWithdraw)) + "_") + toString(royalWithdraw)) + "_") + toString(wavesWithdraw)) | |
80 | - | ||
81 | - | ||
82 | - | func ParsePlayerBalance (wallet) = { | |
83 | - | let amounts = split(ExtractPlayerAmt(wallet), "_") | |
84 | - | let wbetAmount = parseIntValue(amounts[WBETLOCKED]) | |
85 | - | let royalAmount = parseIntValue(amounts[ROYALLOCKED]) | |
86 | - | let wbetWithdraw = parseIntValue(amounts[WBETWITHDRAW]) | |
87 | - | let royalWithdraw = parseIntValue(amounts[ROYALWITHDRAW]) | |
88 | - | let wavesWithdraw = parseIntValue(amounts[WAVESWITHDRAW]) | |
89 | - | [wbetAmount, royalAmount, wbetWithdraw, royalWithdraw, wavesWithdraw] | |
75 | + | func ValidateAndIncreaseReservedAmt (winAmt) = { | |
76 | + | let newReservedAmount = (ExtractReservedAmt() + winAmt) | |
77 | + | let balance = assetBalance(this, WBET) | |
78 | + | if ((newReservedAmount > balance)) | |
79 | + | then throw("Insufficient funds on Wavesbet Dice account. Transaction was rejected for your safety.") | |
80 | + | else newReservedAmount | |
90 | 81 | } | |
91 | 82 | ||
92 | 83 | ||
84 | + | func FormatGameDataParam (p) = { | |
85 | + | let s = size(p) | |
86 | + | if ((s == 0)) | |
87 | + | then throw("Parameter size must be greater then 0") | |
88 | + | else if ((s > 99)) | |
89 | + | then throw("Parameter size must be less then 100") | |
90 | + | else if ((10 > s)) | |
91 | + | then (("0" + toString(s)) + p) | |
92 | + | else (toString(s) + p) | |
93 | + | } | |
94 | + | ||
95 | + | ||
96 | + | func FormatGameDataStr (gameState,prediction,typeRoll,playerPubKey58,winAmt,randOrEmpty) = { | |
97 | + | let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(toString(prediction))) + "_") + FormatGameDataParam(typeRoll)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(winAmt))) | |
98 | + | if ((randOrEmpty == "")) | |
99 | + | then fullStateStr | |
100 | + | else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty)) | |
101 | + | } | |
102 | + | ||
103 | + | ||
104 | + | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
105 | + | then drop(remaining, 1) | |
106 | + | else remaining | |
107 | + | ||
108 | + | ||
109 | + | func ParseNextAttribute (remaining) = { | |
110 | + | let s = size(remaining) | |
111 | + | if ((s > 0)) | |
112 | + | then { | |
113 | + | let nn = parseIntValue(take(remaining, 2)) | |
114 | + | let v = take(drop(remaining, 2), nn) | |
115 | + | let tmpRemaining = drop(remaining, (nn + 2)) | |
116 | + | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
117 | + | [v, remainingState] | |
118 | + | } | |
119 | + | else throw("Empty string was passed into parseNextAttribute func") | |
120 | + | } | |
121 | + | ||
122 | + | ||
123 | + | func ParseGameRawDataStr (rawStateStr) = { | |
124 | + | let gameState = ParseNextAttribute(rawStateStr) | |
125 | + | let prediction = ParseNextAttribute(gameState[1]) | |
126 | + | let rollType = ParseNextAttribute(prediction[1]) | |
127 | + | let playerPubKey58 = ParseNextAttribute(rollType[1]) | |
128 | + | let winAmt = ParseNextAttribute(playerPubKey58[1]) | |
129 | + | [gameState[0], prediction[0], rollType[0], playerPubKey58[0], winAmt[0]] | |
130 | + | } | |
131 | + | ||
132 | + | ||
133 | + | func ExtractGameDataList (gameId) = { | |
134 | + | let rawDataStr = match getString(this, gameId) { | |
135 | + | case str: String => | |
136 | + | str | |
137 | + | case _ => | |
138 | + | throw(("Couldn't find game by " + gameId)) | |
139 | + | } | |
140 | + | ParseGameRawDataStr(rawDataStr) | |
141 | + | } | |
142 | + | ||
143 | + | ||
144 | + | func DecreaseReservedAmt (gameId,winAmt) = { | |
145 | + | let newReservedAmount = (ExtractReservedAmt() - winAmt) | |
146 | + | if ((0 > newReservedAmount)) | |
147 | + | then throw("Invalid Dice Roller account state - reserved amount is less than 0") | |
148 | + | else DataEntry(RESERVATIONKEY, newReservedAmount) | |
149 | + | } | |
150 | + | ||
151 | + | ||
152 | + | func GenerateRandInt (gameId,rsaSign) = { | |
153 | + | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
154 | + | if (rsaSigValid) | |
155 | + | then { | |
156 | + | let rand = (toInt(sha256(rsaSign)) % 100) | |
157 | + | if ((0 > rand)) | |
158 | + | then ((-1 * rand) + 1) | |
159 | + | else (rand + 1) | |
160 | + | } | |
161 | + | else throw("Invalid RSA signature") | |
162 | + | } | |
163 | + | ||
164 | + | ||
165 | + | func RandToStr (r) = if (if ((r >= 1)) | |
166 | + | then (100 >= r) | |
167 | + | else false) | |
168 | + | then toString(r) | |
169 | + | else throw(("Unsupported r parameter passed: expected=[1,...,100] actual=" + toString(r))) | |
170 | + | ||
171 | + | ||
172 | + | func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,decreasedReserves) = { | |
173 | + | let wSetCommonData = [decreasedReserves] | |
174 | + | let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, WBET)] | |
175 | + | let gameData = DataEntry(gameId, newGameDataStr) | |
176 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | func Multiplier (prediction,rollType) = if ((rollType == ROLLUNDER)) | |
181 | + | then if ((prediction == 1)) | |
182 | + | then 9850000 | |
183 | + | else if ((prediction == 2)) | |
184 | + | then 4925000 | |
185 | + | else if ((prediction == 3)) | |
186 | + | then 3283330 | |
187 | + | else if ((prediction == 4)) | |
188 | + | then 2462500 | |
189 | + | else if ((prediction == 5)) | |
190 | + | then 1970000 | |
191 | + | else if ((prediction == 6)) | |
192 | + | then 1641660 | |
193 | + | else if ((prediction == 7)) | |
194 | + | then 1407140 | |
195 | + | else if ((prediction == 8)) | |
196 | + | then 1231250 | |
197 | + | else if ((prediction == 9)) | |
198 | + | then 1094440 | |
199 | + | else if ((prediction == 10)) | |
200 | + | then 985000 | |
201 | + | else if ((prediction == 11)) | |
202 | + | then 895450 | |
203 | + | else if ((prediction == 12)) | |
204 | + | then 820830 | |
205 | + | else if ((prediction == 13)) | |
206 | + | then 757690 | |
207 | + | else if ((prediction == 14)) | |
208 | + | then 703570 | |
209 | + | else if ((prediction == 15)) | |
210 | + | then 656660 | |
211 | + | else if ((prediction == 16)) | |
212 | + | then 615620 | |
213 | + | else if ((prediction == 17)) | |
214 | + | then 579410 | |
215 | + | else if ((prediction == 18)) | |
216 | + | then 547220 | |
217 | + | else if ((prediction == 19)) | |
218 | + | then 518420 | |
219 | + | else if ((prediction == 20)) | |
220 | + | then 492500 | |
221 | + | else if ((prediction == 21)) | |
222 | + | then 469040 | |
223 | + | else if ((prediction == 22)) | |
224 | + | then 447720 | |
225 | + | else if ((prediction == 23)) | |
226 | + | then 428260 | |
227 | + | else if ((prediction == 24)) | |
228 | + | then 410410 | |
229 | + | else if ((prediction == 25)) | |
230 | + | then 394000 | |
231 | + | else if ((prediction == 26)) | |
232 | + | then 378840 | |
233 | + | else if ((prediction == 27)) | |
234 | + | then 364810 | |
235 | + | else if ((prediction == 28)) | |
236 | + | then 351780 | |
237 | + | else if ((prediction == 29)) | |
238 | + | then 339650 | |
239 | + | else if ((prediction == 30)) | |
240 | + | then 328330 | |
241 | + | else if ((prediction == 31)) | |
242 | + | then 317740 | |
243 | + | else if ((prediction == 32)) | |
244 | + | then 307810 | |
245 | + | else if ((prediction == 33)) | |
246 | + | then 298480 | |
247 | + | else if ((prediction == 34)) | |
248 | + | then 289700 | |
249 | + | else if ((prediction == 35)) | |
250 | + | then 281420 | |
251 | + | else if ((prediction == 36)) | |
252 | + | then 273610 | |
253 | + | else if ((prediction == 37)) | |
254 | + | then 259210 | |
255 | + | else if ((prediction == 38)) | |
256 | + | then 259210 | |
257 | + | else if ((prediction == 39)) | |
258 | + | then 252560 | |
259 | + | else if ((prediction == 40)) | |
260 | + | then 246250 | |
261 | + | else if ((prediction == 41)) | |
262 | + | then 240240 | |
263 | + | else if ((prediction == 42)) | |
264 | + | then 234520 | |
265 | + | else if ((prediction == 43)) | |
266 | + | then 229060 | |
267 | + | else if ((prediction == 44)) | |
268 | + | then 223860 | |
269 | + | else if ((prediction == 45)) | |
270 | + | then 218880 | |
271 | + | else if ((prediction == 46)) | |
272 | + | then 214130 | |
273 | + | else if ((prediction == 47)) | |
274 | + | then 209570 | |
275 | + | else if ((prediction == 48)) | |
276 | + | then 205200 | |
277 | + | else if ((prediction == 49)) | |
278 | + | then 201020 | |
279 | + | else if ((prediction == 50)) | |
280 | + | then 197000 | |
281 | + | else if ((prediction == 51)) | |
282 | + | then 193130 | |
283 | + | else if ((prediction == 52)) | |
284 | + | then 189420 | |
285 | + | else if ((prediction == 53)) | |
286 | + | then 185840 | |
287 | + | else if ((prediction == 54)) | |
288 | + | then 182400 | |
289 | + | else if ((prediction == 55)) | |
290 | + | then 179090 | |
291 | + | else if ((prediction == 56)) | |
292 | + | then 175890 | |
293 | + | else if ((prediction == 57)) | |
294 | + | then 172800 | |
295 | + | else if ((prediction == 58)) | |
296 | + | then 169820 | |
297 | + | else if ((prediction == 59)) | |
298 | + | then 166940 | |
299 | + | else if ((prediction == 60)) | |
300 | + | then 164160 | |
301 | + | else if ((prediction == 61)) | |
302 | + | then 161470 | |
303 | + | else if ((prediction == 62)) | |
304 | + | then 158870 | |
305 | + | else if ((prediction == 63)) | |
306 | + | then 156340 | |
307 | + | else if ((prediction == 64)) | |
308 | + | then 153900 | |
309 | + | else if ((prediction == 65)) | |
310 | + | then 151530 | |
311 | + | else if ((prediction == 66)) | |
312 | + | then 149240 | |
313 | + | else if ((prediction == 67)) | |
314 | + | then 147010 | |
315 | + | else if ((prediction == 68)) | |
316 | + | then 144850 | |
317 | + | else if ((prediction == 69)) | |
318 | + | then 142750 | |
319 | + | else if ((prediction == 70)) | |
320 | + | then 140710 | |
321 | + | else if ((prediction == 71)) | |
322 | + | then 138730 | |
323 | + | else if ((prediction == 72)) | |
324 | + | then 136800 | |
325 | + | else if ((prediction == 73)) | |
326 | + | then 134930 | |
327 | + | else if ((prediction == 74)) | |
328 | + | then 133100 | |
329 | + | else if ((prediction == 75)) | |
330 | + | then 131330 | |
331 | + | else if ((prediction == 76)) | |
332 | + | then 129600 | |
333 | + | else if ((prediction == 77)) | |
334 | + | then 127920 | |
335 | + | else if ((prediction == 78)) | |
336 | + | then 126280 | |
337 | + | else if ((prediction == 79)) | |
338 | + | then 124680 | |
339 | + | else if ((prediction == 80)) | |
340 | + | then 123120 | |
341 | + | else if ((prediction == 81)) | |
342 | + | then 121600 | |
343 | + | else if ((prediction == 82)) | |
344 | + | then 120120 | |
345 | + | else if ((prediction == 83)) | |
346 | + | then 118670 | |
347 | + | else if ((prediction == 84)) | |
348 | + | then 117260 | |
349 | + | else if ((prediction == 85)) | |
350 | + | then 115880 | |
351 | + | else if ((prediction == 86)) | |
352 | + | then 114530 | |
353 | + | else if ((prediction == 87)) | |
354 | + | then 113210 | |
355 | + | else if ((prediction == 88)) | |
356 | + | then 111930 | |
357 | + | else if ((prediction == 89)) | |
358 | + | then 110670 | |
359 | + | else if ((prediction == 90)) | |
360 | + | then 109440 | |
361 | + | else if ((prediction == 91)) | |
362 | + | then 108240 | |
363 | + | else if ((prediction == 92)) | |
364 | + | then 107060 | |
365 | + | else if ((prediction == 93)) | |
366 | + | then 105910 | |
367 | + | else if ((prediction == 94)) | |
368 | + | then 104780 | |
369 | + | else if ((prediction == 95)) | |
370 | + | then 103680 | |
371 | + | else if ((prediction == 96)) | |
372 | + | then 103680 | |
373 | + | else 100000 | |
374 | + | else if ((rollType == ROLLOVER)) | |
375 | + | then if ((prediction == 4)) | |
376 | + | then 103680 | |
377 | + | else if ((prediction == 5)) | |
378 | + | then 103680 | |
379 | + | else if ((prediction == 6)) | |
380 | + | then 104780 | |
381 | + | else if ((prediction == 7)) | |
382 | + | then 105910 | |
383 | + | else if ((prediction == 8)) | |
384 | + | then 107060 | |
385 | + | else if ((prediction == 9)) | |
386 | + | then 108240 | |
387 | + | else if ((prediction == 10)) | |
388 | + | then 109440 | |
389 | + | else if ((prediction == 11)) | |
390 | + | then 110670 | |
391 | + | else if ((prediction == 12)) | |
392 | + | then 111930 | |
393 | + | else if ((prediction == 13)) | |
394 | + | then 113210 | |
395 | + | else if ((prediction == 14)) | |
396 | + | then 114530 | |
397 | + | else if ((prediction == 15)) | |
398 | + | then 115880 | |
399 | + | else if ((prediction == 16)) | |
400 | + | then 117260 | |
401 | + | else if ((prediction == 17)) | |
402 | + | then 118670 | |
403 | + | else if ((prediction == 18)) | |
404 | + | then 120120 | |
405 | + | else if ((prediction == 19)) | |
406 | + | then 121600 | |
407 | + | else if ((prediction == 20)) | |
408 | + | then 123120 | |
409 | + | else if ((prediction == 21)) | |
410 | + | then 124680 | |
411 | + | else if ((prediction == 22)) | |
412 | + | then 126280 | |
413 | + | else if ((prediction == 23)) | |
414 | + | then 127920 | |
415 | + | else if ((prediction == 24)) | |
416 | + | then 129600 | |
417 | + | else if ((prediction == 25)) | |
418 | + | then 131330 | |
419 | + | else if ((prediction == 26)) | |
420 | + | then 133100 | |
421 | + | else if ((prediction == 27)) | |
422 | + | then 134930 | |
423 | + | else if ((prediction == 28)) | |
424 | + | then 136800 | |
425 | + | else if ((prediction == 29)) | |
426 | + | then 138730 | |
427 | + | else if ((prediction == 30)) | |
428 | + | then 140710 | |
429 | + | else if ((prediction == 31)) | |
430 | + | then 142750 | |
431 | + | else if ((prediction == 32)) | |
432 | + | then 144850 | |
433 | + | else if ((prediction == 33)) | |
434 | + | then 147010 | |
435 | + | else if ((prediction == 34)) | |
436 | + | then 149240 | |
437 | + | else if ((prediction == 35)) | |
438 | + | then 151530 | |
439 | + | else if ((prediction == 36)) | |
440 | + | then 153900 | |
441 | + | else if ((prediction == 37)) | |
442 | + | then 156340 | |
443 | + | else if ((prediction == 38)) | |
444 | + | then 158870 | |
445 | + | else if ((prediction == 39)) | |
446 | + | then 161470 | |
447 | + | else if ((prediction == 40)) | |
448 | + | then 164160 | |
449 | + | else if ((prediction == 41)) | |
450 | + | then 166940 | |
451 | + | else if ((prediction == 42)) | |
452 | + | then 169820 | |
453 | + | else if ((prediction == 43)) | |
454 | + | then 172800 | |
455 | + | else if ((prediction == 44)) | |
456 | + | then 175890 | |
457 | + | else if ((prediction == 45)) | |
458 | + | then 179090 | |
459 | + | else if ((prediction == 46)) | |
460 | + | then 185840 | |
461 | + | else if ((prediction == 47)) | |
462 | + | then 185840 | |
463 | + | else if ((prediction == 48)) | |
464 | + | then 189420 | |
465 | + | else if ((prediction == 49)) | |
466 | + | then 193130 | |
467 | + | else if ((prediction == 50)) | |
468 | + | then 197000 | |
469 | + | else if ((prediction == 51)) | |
470 | + | then 201020 | |
471 | + | else if ((prediction == 52)) | |
472 | + | then 205200 | |
473 | + | else if ((prediction == 53)) | |
474 | + | then 209570 | |
475 | + | else if ((prediction == 54)) | |
476 | + | then 214130 | |
477 | + | else if ((prediction == 55)) | |
478 | + | then 218880 | |
479 | + | else if ((prediction == 56)) | |
480 | + | then 223860 | |
481 | + | else if ((prediction == 57)) | |
482 | + | then 229060 | |
483 | + | else if ((prediction == 58)) | |
484 | + | then 234520 | |
485 | + | else if ((prediction == 59)) | |
486 | + | then 240240 | |
487 | + | else if ((prediction == 60)) | |
488 | + | then 246250 | |
489 | + | else if ((prediction == 61)) | |
490 | + | then 252560 | |
491 | + | else if ((prediction == 62)) | |
492 | + | then 259210 | |
493 | + | else if ((prediction == 63)) | |
494 | + | then 259210 | |
495 | + | else if ((prediction == 64)) | |
496 | + | then 273610 | |
497 | + | else if ((prediction == 65)) | |
498 | + | then 281420 | |
499 | + | else if ((prediction == 66)) | |
500 | + | then 289700 | |
501 | + | else if ((prediction == 67)) | |
502 | + | then 298480 | |
503 | + | else if ((prediction == 68)) | |
504 | + | then 307810 | |
505 | + | else if ((prediction == 69)) | |
506 | + | then 317740 | |
507 | + | else if ((prediction == 70)) | |
508 | + | then 328330 | |
509 | + | else if ((prediction == 71)) | |
510 | + | then 339650 | |
511 | + | else if ((prediction == 72)) | |
512 | + | then 351780 | |
513 | + | else if ((prediction == 73)) | |
514 | + | then 364810 | |
515 | + | else if ((prediction == 74)) | |
516 | + | then 378840 | |
517 | + | else if ((prediction == 75)) | |
518 | + | then 394000 | |
519 | + | else if ((prediction == 76)) | |
520 | + | then 410410 | |
521 | + | else if ((prediction == 77)) | |
522 | + | then 428260 | |
523 | + | else if ((prediction == 78)) | |
524 | + | then 447720 | |
525 | + | else if ((prediction == 79)) | |
526 | + | then 469040 | |
527 | + | else if ((prediction == 80)) | |
528 | + | then 492500 | |
529 | + | else if ((prediction == 81)) | |
530 | + | then 518420 | |
531 | + | else if ((prediction == 82)) | |
532 | + | then 547220 | |
533 | + | else if ((prediction == 83)) | |
534 | + | then 579410 | |
535 | + | else if ((prediction == 84)) | |
536 | + | then 615620 | |
537 | + | else if ((prediction == 85)) | |
538 | + | then 656660 | |
539 | + | else if ((prediction == 86)) | |
540 | + | then 703570 | |
541 | + | else if ((prediction == 87)) | |
542 | + | then 757690 | |
543 | + | else if ((prediction == 88)) | |
544 | + | then 820830 | |
545 | + | else if ((prediction == 89)) | |
546 | + | then 895450 | |
547 | + | else if ((prediction == 90)) | |
548 | + | then 985000 | |
549 | + | else if ((prediction == 91)) | |
550 | + | then 1094440 | |
551 | + | else if ((prediction == 92)) | |
552 | + | then 1231250 | |
553 | + | else if ((prediction == 93)) | |
554 | + | then 1407140 | |
555 | + | else if ((prediction == 94)) | |
556 | + | then 1641660 | |
557 | + | else if ((prediction == 95)) | |
558 | + | then 1970000 | |
559 | + | else if ((prediction == 96)) | |
560 | + | then 2462500 | |
561 | + | else if ((prediction == 97)) | |
562 | + | then 3283330 | |
563 | + | else if ((prediction == 98)) | |
564 | + | then 4925000 | |
565 | + | else if ((prediction == 99)) | |
566 | + | then 9850000 | |
567 | + | else 100000 | |
568 | + | else 100000 | |
569 | + | ||
570 | + | ||
571 | + | func diceWin (type,prediction,number) = if ((type == ROLLUNDER)) | |
572 | + | then if ((prediction >= number)) | |
573 | + | then true | |
574 | + | else false | |
575 | + | else if ((type == ROLLOVER)) | |
576 | + | then if ((number >= prediction)) | |
577 | + | then true | |
578 | + | else false | |
579 | + | else false | |
580 | + | ||
581 | + | ||
582 | + | func ValidateBetAndDefineWinAmt (amount,prediction,rollType) = if (if ((BETMIN > amount)) | |
583 | + | then true | |
584 | + | else (amount > BETMAX)) | |
585 | + | then throw(((("Bet amount is not in range: minBet=" + toString((BETMIN / WAVELET))) + " maxBet=") + toString((BETMAX / WAVELET)))) | |
586 | + | else if (if ((rollType != ROLLUNDER)) | |
587 | + | then (rollType != ROLLOVER) | |
588 | + | else false) | |
589 | + | then throw("Invalid Roll type, try with OVER or UNDER") | |
590 | + | else if (if (if ((rollType == ROLLUNDER)) | |
591 | + | then (1 > prediction) | |
592 | + | else false) | |
593 | + | then true | |
594 | + | else if ((rollType == ROLLUNDER)) | |
595 | + | then (prediction > 96) | |
596 | + | else false) | |
597 | + | then throw("Prediction is out of the range for ROLL UNDER: 1 <= PREDICTION <= 96") | |
598 | + | else if (if (if ((rollType == ROLLOVER)) | |
599 | + | then (4 > prediction) | |
600 | + | else false) | |
601 | + | then true | |
602 | + | else if ((rollType == ROLLOVER)) | |
603 | + | then (prediction > 99) | |
604 | + | else false) | |
605 | + | then throw("Prediction is out of the range for ROLL OVER: 4 <= PREDICTION <= 99") | |
606 | + | else { | |
607 | + | let multi = Multiplier(prediction, rollType) | |
608 | + | fraction(((amount / 100000) * multi), (((100 - FEEWAVESBET) - FEEMCAFEE) - FEECOMMUNITY), 100) | |
609 | + | } | |
610 | + | ||
611 | + | ||
93 | 612 | @Callable(i) | |
94 | - | func lock () = { | |
613 | + | func playDice (rollType,prediction) = { | |
614 | + | let gameId = toBase58String(i.transactionId) | |
95 | 615 | let payment = extract(i.payment) | |
96 | - | if (if ((payment.assetId != WBET)) | |
97 | - | then (payment.assetId != ROYAL) | |
98 | - | else false) | |
99 | - | then throw("The token should be in WBET or ROYAL.") | |
100 | - | else { | |
101 | - | let wallet = toString(i.caller) | |
102 | - | let balance = ParsePlayerBalance(wallet) | |
103 | - | if ((payment.assetId == WBET)) | |
104 | - | then { | |
105 | - | let newWBETReservedAmount = (ExtractWBETReservedAmt() + payment.amount) | |
106 | - | let newPlayerWBETAmount = (balance[WBETLOCKED] + payment.amount) | |
107 | - | if (WalletExist(wallet)) | |
108 | - | then ScriptResult(WriteSet([DataEntry(LOCKEDWBETKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
109 | - | else { | |
110 | - | let newWalletNum = IncrementWalletNum() | |
111 | - | ScriptResult(WriteSet([DataEntry(WALLETCOUNTERKEY, newWalletNum), DataEntry(LOCKEDWBETKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(newPlayerWBETAmount, balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
112 | - | } | |
113 | - | } | |
114 | - | else if ((payment.assetId == ROYAL)) | |
115 | - | then { | |
116 | - | let newROYALReservedAmount = (ExtractROYALReservedAmt() + payment.amount) | |
117 | - | let newPlayerRoyalAmount = (balance[ROYALLOCKED] + payment.amount) | |
118 | - | if (WalletExist(wallet)) | |
119 | - | then ScriptResult(WriteSet([DataEntry(LOCKEDROYALKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], newPlayerRoyalAmount, balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
120 | - | else { | |
121 | - | let newWalletNum = IncrementWalletNum() | |
122 | - | ScriptResult(WriteSet([DataEntry(WALLETCOUNTERKEY, newWalletNum), DataEntry(LOCKEDROYALKEY, newROYALReservedAmount), DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], newPlayerRoyalAmount, balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
123 | - | } | |
616 | + | let feeAssetId = isDefined(i.feeAssetId) | |
617 | + | let winAmt = ValidateBetAndDefineWinAmt(payment.amount, prediction, rollType) | |
618 | + | let playerBalance = wavesBalance(i.caller) | |
619 | + | let gameIdUsed = isDefined(getString(this, gameId)) | |
620 | + | if ((payment.assetId != WBET)) | |
621 | + | then throw("Payment should be in Wavesbet") | |
622 | + | else if ((1000000 > playerBalance)) | |
623 | + | then throw("There are not enough waves, it takes 0.01 Waves to bet. Game aborted.") | |
624 | + | else if (feeAssetId) | |
625 | + | then throw("Transaction's fee must be in Waves. Game aborted.") | |
626 | + | else if (gameIdUsed) | |
627 | + | then throw("Passed gameId had been used before. Game aborted.") | |
628 | + | else { | |
629 | + | let newGameNum = IncrementGameNum() | |
630 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
631 | + | let gameDataStr = FormatGameDataStr(STATESUBMITTED, prediction, rollType, playerPubKey58, winAmt, "") | |
632 | + | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet([ScriptTransfer(WALLETCOMMUNITY, fraction(payment.amount, FEECOMMUNITY, 100), WBET), ScriptTransfer(WALLETWAVESBET, fraction(payment.amount, FEEWAVESBET, 100), WBET), ScriptTransfer(WALLETMCAFEE, fraction(payment.amount, FEEMCAFEE, 100), WBET)])) | |
124 | 633 | } | |
125 | - | else throw("error") | |
126 | - | } | |
127 | 634 | } | |
128 | 635 | ||
129 | 636 | ||
130 | 637 | ||
131 | 638 | @Callable(i) | |
132 | - | func unlock (asset) = { | |
133 | - | let wallet = toString(i.caller) | |
134 | - | let balance = ParsePlayerBalance(wallet) | |
135 | - | if ((asset == "WBET")) | |
136 | - | then if ((0 >= balance[WBETLOCKED])) | |
137 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
138 | - | else { | |
139 | - | let newWBETReservedAmount = (ExtractWBETReservedAmt() - balance[WBETLOCKED]) | |
140 | - | ScriptResult(WriteSet([DataEntry(LOCKEDWBETKEY, newWBETReservedAmount), DataEntry(wallet, FormatPlayerBalance(0, balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet([ScriptTransfer(i.caller, balance[WBETLOCKED], WBET)])) | |
141 | - | } | |
142 | - | else if ((asset == "ROYAL")) | |
143 | - | then if ((0 >= balance[ROYALLOCKED])) | |
144 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
639 | + | func withdraw (gameId,rsaSig) = { | |
640 | + | let gameDataList = ExtractGameDataList(gameId) | |
641 | + | let gameState = gameDataList[IdxGameState] | |
642 | + | let prediction = parseIntValue(gameDataList[IdxPrediction]) | |
643 | + | let rollType = gameDataList[IdxType] | |
644 | + | let winAmt = parseIntValue(gameDataList[IdxWinAmt]) | |
645 | + | let playerPubKey58 = gameDataList[IdxPlayerPubKey58] | |
646 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
647 | + | let decreasedReserves = DecreaseReservedAmt(gameId, winAmt) | |
648 | + | if ((gameState != STATESUBMITTED)) | |
649 | + | then throw("Invalid game state for passed gameId. Game aborted.") | |
650 | + | else { | |
651 | + | let rand = GenerateRandInt(gameId, rsaSig) | |
652 | + | let randStr = RandToStr(rand) | |
653 | + | if (diceWin(rollType, prediction, rand)) | |
654 | + | then { | |
655 | + | let newGameDataStr = FormatGameDataStr(STATEWON, prediction, rollType, playerPubKey58, winAmt, randStr) | |
656 | + | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, decreasedReserves) | |
657 | + | } | |
145 | 658 | else { | |
146 | - | let | |
147 | - | | |
659 | + | let newGameDataStr = FormatGameDataStr(STATELOST, prediction, rollType, playerPubKey58, winAmt, randStr) | |
660 | + | WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves]) | |
148 | 661 | } | |
149 | - | else throw("Invalid asset") | |
150 | - | } | |
151 | - | ||
152 | - | ||
153 | - | ||
154 | - | @Callable(i) | |
155 | - | func withdraw (asset) = { | |
156 | - | let wallet = toString(i.caller) | |
157 | - | let balance = ParsePlayerBalance(wallet) | |
158 | - | if ((asset == "WBET")) | |
159 | - | then if ((0 >= balance[WBETWITHDRAW])) | |
160 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
161 | - | else ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], 0, balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet([ScriptTransfer(i.caller, balance[WBETWITHDRAW], WBET)])) | |
162 | - | else if ((asset == "ROYAL")) | |
163 | - | then if ((0 >= balance[ROYALWITHDRAW])) | |
164 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
165 | - | else ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], balance[WBETWITHDRAW], 0, balance[WAVESWITHDRAW]))]), TransferSet([ScriptTransfer(i.caller, balance[ROYALWITHDRAW], ROYAL)])) | |
166 | - | else if ((asset == "WAVES")) | |
167 | - | then if ((0 >= balance[WAVESWITHDRAW])) | |
168 | - | then throw("You dont have enough balance to withdraw the amount requested.") | |
169 | - | else ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[WBETWITHDRAW], 0))]), TransferSet([ScriptTransfer(i.caller, balance[WAVESWITHDRAW], unit)])) | |
170 | - | else throw("Invalid asset") | |
171 | - | } | |
172 | - | ||
173 | - | ||
174 | - | ||
175 | - | @Callable(i) | |
176 | - | func addWithdraw (wallet) = if ((i.caller == COMMUNITYWALLET)) | |
177 | - | then { | |
178 | - | let payment = extract(i.payment) | |
179 | - | let balance = ParsePlayerBalance(wallet) | |
180 | - | if ((payment.assetId == WBET)) | |
181 | - | then { | |
182 | - | let newWbetAmount = (balance[WBETWITHDRAW] + payment.amount) | |
183 | - | ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], newWbetAmount, balance[ROYALWITHDRAW], balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
184 | - | } | |
185 | - | else if ((payment.assetId == ROYAL)) | |
186 | - | then { | |
187 | - | let newRoyalAmount = (balance[ROYALWITHDRAW] + payment.amount) | |
188 | - | ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], balance[WBETWITHDRAW], newRoyalAmount, balance[WAVESWITHDRAW]))]), TransferSet(nil)) | |
189 | - | } | |
190 | - | else if ((payment.assetId == unit)) | |
191 | - | then { | |
192 | - | let newWavesAmount = (balance[WAVESWITHDRAW] + payment.amount) | |
193 | - | ScriptResult(WriteSet([DataEntry(wallet, FormatPlayerBalance(balance[WBETLOCKED], balance[ROYALLOCKED], balance[WBETWITHDRAW], balance[ROYALWITHDRAW], newWavesAmount))]), TransferSet(nil)) | |
194 | - | } | |
195 | - | else throw("Invalid asset") | |
196 | - | } | |
197 | - | else throw("You do not have permission to perform this function.") | |
198 | - | ||
199 | - | ||
200 | - | ||
201 | - | @Callable(i) | |
202 | - | func addCommunityFee () = { | |
203 | - | let payment = extract(i.payment) | |
204 | - | if ((payment.assetId != assetInfo(base58'WAVES'))) | |
205 | - | then throw("Payment should be in WAVES.") | |
206 | - | else { | |
207 | - | let newFEEReservedAmount = (ExtractFEEReservedAmt() + payment.amount) | |
208 | - | ScriptResult(WriteSet([DataEntry(COMMUNITYFEEKEY, newFEEReservedAmount)]), TransferSet(nil)) | |
209 | 662 | } | |
210 | 663 | } | |
211 | 664 | ||
212 | 665 | ||
213 | - | ||
214 | - | @Callable(i) | |
215 | - | func getCommunityFee (amount) = if ((i.caller == COMMUNITYWALLET)) | |
216 | - | then { | |
217 | - | let payment = extract(i.payment) | |
218 | - | let FEEReservedAmount = ExtractFEEReservedAmt() | |
219 | - | if ((amount > FEEReservedAmount)) | |
220 | - | then throw("You dont have enough balance to transfer the amount requested.") | |
221 | - | else { | |
222 | - | let newFEEReservedAmount = (FEEReservedAmount - amount) | |
223 | - | ScriptResult(WriteSet([DataEntry(COMMUNITYFEEKEY, newFEEReservedAmount)]), TransferSet([ScriptTransfer(COMMUNITYWALLET, amount, unit)])) | |
224 | - | } | |
225 | - | } | |
226 | - | else throw("You do not have permission to perform this function.") | |
227 | - | ||
228 | - | ||
229 | - | ||
230 | - | @Callable(i) | |
231 | - | func test (amount) = ScriptResult(WriteSet([DataEntry("test", "000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000120000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500001333")]), TransferSet(nil)) | |
232 | - | ||
666 | + | @Verifier(tx) | |
667 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
668 | + | then match tx { | |
669 | + | case ttx: TransferTransaction => | |
670 | + | ((assetBalance(this, WBET) - ttx.amount) >= ExtractReservedAmt()) | |
671 | + | case stx: SetScriptTransaction => | |
672 | + | true | |
673 | + | case _ => | |
674 | + | false | |
675 | + | } | |
676 | + | else false | |
233 | 677 |
github/deemru/w8io/026f985 85.99 ms ◑