tx · 96BqBFtCuvvoBsrSkUJtVztBZRrk36dX1xtRdWYKJ9af 3MpLAJF7RnmS7KMtgynbCH1gUBs4tdk2hjC: -0.01500000 Waves 2019.07.17 19:08 [590060] smart account 3MpLAJF7RnmS7KMtgynbCH1gUBs4tdk2hjC > SELF 0.00000000 Waves
{ "type": 13, "id": "96BqBFtCuvvoBsrSkUJtVztBZRrk36dX1xtRdWYKJ9af", "fee": 1500000, "feeAssetId": null, "timestamp": 1563379710347, "version": 1, "sender": "3MpLAJF7RnmS7KMtgynbCH1gUBs4tdk2hjC", "senderPublicKey": "CrKVunQZ8KvoZ9UU65xZ4S4bRQV6a6HfEcP4J3fFzhwU", "proofs": [ "5GEFuQYy4mAVpCV3323XHP3DnZ195883jd1zgaDppVieqASfLQ8cQux5ZTUYrWw8vBf8sSn1AvWxcPuG9rGQZg3A" ], "script": "base64:AAIDAAAAAAAAAAAAAABBAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbXB1WGNJL280cElCNXl3djlET09HYXBUQlV3UlZsTS82K0g2aEZlbE9YdGtyd1kvWUl0bVB4RURwejdyQWVyUVBRZTl0RFBFYUF2L0dubEV6dHliT0ZYZ3U5RHpEZThZb01SRDF2YWtnb0Fjb2dtYlk1OFFENktNajVIa29Wai95VE5JYzlzemo1cWhJbHJBZG1iM0tMTDZoUVU3eTgrSmo2OUJXVlBzYVFna3NwU2RlWXRiMXRIUWM3dDk1bjdPWjU2cjJBN0czK2JRZjZuU01rUGtBaElyRXBiQ201OG9pR0JjemRUZC9McUZTVm90WnNiTDdZaDZTSExmbkhlRCtRZ2NmSnJuYW04T0hNR0pFSlRSWGpJTGVIR2psUkNQOG9WcGlvSHJ5MVMyeFB4NXNWekltMk1NK0N6WWVuQUdsbzBqMjZhdEJoaVVMb1R1bHdEM3BRSURBUUFCAAAAAAZTRVJWRVIJAQAA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AAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABmdhbWVJZAUAAAAObmV3R2FtZURhdGFTdHIJAARMAAAAAgUAAAARZGVjcmVhc2VkUmVzZXJ2ZXMFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAA3R0eAUAAAAHJG1hdGNoMAkAAGcAAAACCQAAZQAAAAIJAQAAAAx3YXZlc0JhbGFuY2UAAAABBQAAAAR0aGlzCAUAAAADdHR4AAAABmFtb3VudAkBAAAAEkV4dHJhY3RSZXNlcnZlZEFtdAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAANzdHgFAAAAByRtYXRjaDAGBwfwJ9/f", "chainId": 84, "height": 590060, "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 RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmpuXcI/o4pIB5ywv9DOOGapTBUwRVlM/6+H6hFelOXtkrwY/YItmPxEDpz7rAerQPQe9tDPEaAv/GnlEztybOFXgu9DzDe8YoMRD1vakgoAcogmbY58QD6KMj5HkoVj/yTNIc9szj5qhIlrAdmb3KLL6hQU7y8+Jj69BWVPsaQgkspSdeYtb1tHQc7t95n7OZ56r2A7G3+bQf6nSMkPkAhIrEpbCm58oiGBczdTd/LqFSVotZsbL7Yh6SHLfnHeD+QgcfJrnam8OHMGJEJTRXjILeHGjlRCP8oVpioHry1S2xPx5sVzIm2MM+CzYenAGlo0j26atBhiULoTulwD3pQIDAQAB") | |
5 | + | ||
6 | + | let SERVER = addressFromStringValue("3N4Aib5iubWiGMzdTh6wWiVDVbo32oeVUmH") | |
7 | + | ||
8 | + | let RANDORACLETIMEFRAME = 4320 | |
9 | + | ||
10 | + | let WAVELET = ((100 * 1000) * 1000) | |
11 | + | ||
12 | + | let COMMISSION = ((5 * WAVELET) / 1000) | |
13 | + | ||
14 | + | let BETMIN = ((1 * WAVELET) / 2) | |
15 | + | ||
16 | + | let BETMAX = (6 * WAVELET) | |
17 | + | ||
18 | + | let BETSTEP = ((1 * WAVELET) / 10) | |
19 | + | ||
20 | + | let PRECISION = 10000 | |
21 | + | ||
22 | + | let R1MAX = 96 | |
23 | + | ||
24 | + | let R1MIN = 94 | |
25 | + | ||
26 | + | let R1K = 9860 | |
27 | + | ||
28 | + | let R2MAX = 93 | |
29 | + | ||
30 | + | let R2MIN = 87 | |
31 | + | ||
32 | + | let R2K = 9800 | |
33 | + | ||
34 | + | let R3MAX = 86 | |
35 | + | ||
36 | + | let R3MIN = 86 | |
37 | + | ||
38 | + | let R3K = 9750 | |
39 | + | ||
40 | + | let R4MAX = 85 | |
41 | + | ||
42 | + | let R4MIN = 84 | |
43 | + | ||
44 | + | let R4K = 9670 | |
45 | + | ||
46 | + | let R5MAX = 83 | |
47 | + | ||
48 | + | let R5MIN = 83 | |
49 | + | ||
50 | + | let R5K = 9630 | |
51 | + | ||
52 | + | let R6MAX = 82 | |
53 | + | ||
54 | + | let R6MIN = 67 | |
55 | + | ||
56 | + | let R6K = 9610 | |
57 | + | ||
58 | + | let R7MAX = 66 | |
59 | + | ||
60 | + | let R7MIN = 56 | |
61 | + | ||
62 | + | let R7K = 9560 | |
63 | + | ||
64 | + | let R8MAX = 55 | |
65 | + | ||
66 | + | let R8MIN = 38 | |
67 | + | ||
68 | + | let R8K = 9500 | |
69 | + | ||
70 | + | let R9MAX = 37 | |
71 | + | ||
72 | + | let R9MIN = 3 | |
73 | + | ||
74 | + | let R9K = 9290 | |
75 | + | ||
76 | + | let R10MAX = 2 | |
77 | + | ||
78 | + | let R10MIN = 1 | |
79 | + | ||
80 | + | let R10K = 9860 | |
81 | + | ||
82 | + | let IdxGameState = 0 | |
83 | + | ||
84 | + | let IdxPlayerChoice = 1 | |
85 | + | ||
86 | + | let IdxPlayerPubKey58 = 2 | |
87 | + | ||
88 | + | let IdxStartedHeight = 3 | |
89 | + | ||
90 | + | let IdxWinAmt = 4 | |
91 | + | ||
92 | + | let IdxRandOrEmpty = 5 | |
93 | + | ||
94 | + | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
95 | + | ||
96 | + | let GAMESCOUNTERKEY = "$GAME_NUM" | |
97 | + | ||
98 | + | let STATESUBMITTED = "SUBMITTED" | |
99 | + | ||
100 | + | let STATEWON = "WON" | |
101 | + | ||
102 | + | let STATELOST = "LOST" | |
103 | + | ||
104 | + | func IncrementGameNum () = { | |
105 | + | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
106 | + | case num: Int => | |
107 | + | num | |
108 | + | case _ => | |
109 | + | 0 | |
110 | + | } | |
111 | + | (gameNum + 1) | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
116 | + | case a: Int => | |
117 | + | a | |
118 | + | case _ => | |
119 | + | 0 | |
120 | + | } | |
121 | + | ||
122 | + | ||
123 | + | func ValidateAndIncreaseReservedAmt (winAmt) = { | |
124 | + | let newReservedAmount = (ExtractReservedAmt() + winAmt) | |
125 | + | let balance = wavesBalance(this) | |
126 | + | if ((newReservedAmount > balance)) | |
127 | + | then throw("Insufficient funds on Waves Rider account. Transaction was rejected for your safety.") | |
128 | + | else newReservedAmount | |
129 | + | } | |
130 | + | ||
131 | + | ||
132 | + | func DecreaseReservedAmt (gameId,winAmt) = { | |
133 | + | let newReservedAmount = (ExtractReservedAmt() - winAmt) | |
134 | + | if ((0 > newReservedAmount)) | |
135 | + | then throw("Invalid Dice Roller account state - reserved amount is less than 0") | |
136 | + | else DataEntry(RESERVATIONKEY, newReservedAmount) | |
137 | + | } | |
138 | + | ||
139 | + | ||
140 | + | 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 | |
147 | + | if (betAmtValid) | |
148 | + | 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") | |
198 | + | } | |
199 | + | else throw(((((("Bet amount is not in range: minBet=" + toString(BETMIN)) + " maxBet=") + toString(BETMAX)) + " betStep=") + toString(BETSTEP))) | |
200 | + | } | |
201 | + | ||
202 | + | ||
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))) | |
208 | + | ||
209 | + | ||
210 | + | func GenerateRandInt (gameId,rsaSign) = { | |
211 | + | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
212 | + | if (rsaSigValid) | |
213 | + | then { | |
214 | + | let rand = (toInt(sha256(rsaSign)) % 100) | |
215 | + | if ((0 > rand)) | |
216 | + | then ((-1 * rand) + 1) | |
217 | + | else (rand + 1) | |
218 | + | } | |
219 | + | else throw("Invalid RSA signature") | |
220 | + | } | |
221 | + | ||
222 | + | ||
223 | + | func IsPlayerWin (playerChoice,rand) = { | |
224 | + | let playerChoiceInt = parseIntValue(playerChoice) | |
225 | + | (playerChoiceInt >= rand) | |
226 | + | } | |
227 | + | ||
228 | + | ||
229 | + | func FormatGameDataParam (p) = { | |
230 | + | let s = size(p) | |
231 | + | if ((s == 0)) | |
232 | + | then throw("Parameter size must be greater then 0") | |
233 | + | else if ((s > 99)) | |
234 | + | then throw("Parameter size must be less then 100") | |
235 | + | else if ((10 > s)) | |
236 | + | then (("0" + toString(s)) + p) | |
237 | + | else (toString(s) + p) | |
238 | + | } | |
239 | + | ||
240 | + | ||
241 | + | func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = { | |
242 | + | let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt))) | |
243 | + | if ((randOrEmpty == "")) | |
244 | + | then fullStateStr | |
245 | + | else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty)) | |
246 | + | } | |
247 | + | ||
248 | + | ||
249 | + | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
250 | + | then drop(remaining, 1) | |
251 | + | else remaining | |
252 | + | ||
253 | + | ||
254 | + | func ParseNextAttribute (remaining) = { | |
255 | + | let s = size(remaining) | |
256 | + | if ((s > 0)) | |
257 | + | then { | |
258 | + | let nn = parseIntValue(take(remaining, 2)) | |
259 | + | let v = take(drop(remaining, 2), nn) | |
260 | + | let tmpRemaining = drop(remaining, (nn + 2)) | |
261 | + | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
262 | + | [v, remainingState] | |
263 | + | } | |
264 | + | else throw("Empty string was passed into parseNextAttribute func") | |
265 | + | } | |
266 | + | ||
267 | + | ||
268 | + | func ParseGameRawDataStr (rawStateStr) = { | |
269 | + | let gameState = ParseNextAttribute(rawStateStr) | |
270 | + | let playerChoice = ParseNextAttribute(gameState[1]) | |
271 | + | let playerPubKey58 = ParseNextAttribute(playerChoice[1]) | |
272 | + | let startedHeight = ParseNextAttribute(playerPubKey58[1]) | |
273 | + | let winAmt = ParseNextAttribute(startedHeight[1]) | |
274 | + | [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]] | |
275 | + | } | |
276 | + | ||
277 | + | ||
278 | + | func ExtractGameDataList (gameId) = { | |
279 | + | let rawDataStr = match getString(this, gameId) { | |
280 | + | case str: String => | |
281 | + | str | |
282 | + | case _ => | |
283 | + | throw(("Couldn't find game by " + gameId)) | |
284 | + | } | |
285 | + | ParseGameRawDataStr(rawDataStr) | |
286 | + | } | |
287 | + | ||
288 | + | ||
289 | + | func WinScriptSet (gameId,playerAddress,winAmt,newGameDataStr,winByTimeout,decreasedReserves) = { | |
290 | + | let wSetCommonData = [decreasedReserves] | |
291 | + | let tSetCommonData = [ScriptTransfer(playerAddress, winAmt, unit)] | |
292 | + | if (winByTimeout) | |
293 | + | then { | |
294 | + | let newGameDataStrAdjusted = ((newGameDataStr + "_") + FormatGameDataParam("TIMEOUT")) | |
295 | + | let gameData = DataEntry(gameId, newGameDataStrAdjusted) | |
296 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
297 | + | } | |
298 | + | else { | |
299 | + | let gameData = DataEntry(gameId, newGameDataStr) | |
300 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
301 | + | } | |
302 | + | } | |
303 | + | ||
304 | + | ||
305 | + | @Callable(i) | |
306 | + | func bet (playerChoice) = { | |
307 | + | let newGameNum = IncrementGameNum() | |
308 | + | let gameId = toBase58String(i.transactionId) | |
309 | + | let pmt = extract(i.payment) | |
310 | + | let betNotInWaves = isDefined(pmt.assetId) | |
311 | + | let feeNotInWaves = isDefined(pmt.assetId) | |
312 | + | let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice) | |
313 | + | let txIdUsed = isDefined(getString(this, gameId)) | |
314 | + | if (betNotInWaves) | |
315 | + | then throw("Bet amount must be in Waves") | |
316 | + | else if (feeNotInWaves) | |
317 | + | then throw("Transaction's fee must be in Waves") | |
318 | + | else if (txIdUsed) | |
319 | + | then throw("Passed txId had been used before. Game aborted.") | |
320 | + | else { | |
321 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
322 | + | let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "") | |
323 | + | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet([ScriptTransfer(SERVER, COMMISSION, unit)])) | |
324 | + | } | |
325 | + | } | |
326 | + | ||
327 | + | ||
328 | + | ||
329 | + | @Callable(i) | |
330 | + | func withdraw (gameId,rsaSign) = { | |
331 | + | let gameDataList = ExtractGameDataList(gameId) | |
332 | + | let gameState = gameDataList[IdxGameState] | |
333 | + | let playerChoice = gameDataList[IdxPlayerChoice] | |
334 | + | let startedHeight = parseIntValue(gameDataList[IdxStartedHeight]) | |
335 | + | let winAmt = parseIntValue(gameDataList[IdxWinAmt]) | |
336 | + | let playerPubKey58 = gameDataList[IdxPlayerPubKey58] | |
337 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
338 | + | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
339 | + | let decreasedReserves = DecreaseReservedAmt(gameId, winAmt) | |
340 | + | if ((gameState != STATESUBMITTED)) | |
341 | + | then throw("Invalid game state for passed gameId") | |
342 | + | else if (winByTimeout) | |
343 | + | then { | |
344 | + | let randStr = playerChoice | |
345 | + | let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
346 | + | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves) | |
347 | + | } | |
348 | + | else { | |
349 | + | let rand = GenerateRandInt(gameId, rsaSign) | |
350 | + | let randStr = RandToStr(rand) | |
351 | + | if (IsPlayerWin(playerChoice, rand)) | |
352 | + | then { | |
353 | + | let newGameDataStr = FormatGameDataStr(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
354 | + | WinScriptSet(gameId, playerAddress, winAmt, newGameDataStr, winByTimeout, decreasedReserves) | |
355 | + | } | |
356 | + | else { | |
357 | + | let newGameDataStr = FormatGameDataStr(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmt, randStr) | |
358 | + | WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves]) | |
359 | + | } | |
360 | + | } | |
361 | + | } | |
362 | + | ||
363 | + | ||
364 | + | @Verifier(tx) | |
365 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
366 | + | then match tx { | |
367 | + | case ttx: TransferTransaction => | |
368 | + | ((wavesBalance(this) - ttx.amount) >= ExtractReservedAmt()) | |
369 | + | case stx: SetScriptTransaction => | |
370 | + | true | |
371 | + | case _ => | |
372 | + | false | |
373 | + | } | |
374 | + | else false | |
375 | + |
github/deemru/w8io/026f985 22.17 ms ◑