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