tx · T3pgitk5qfkFgr89Fgr1BaPw5u3tE4XqAEo9eSUoVvk 3MyhMcrCuBoTaov5Z2BiSsXVzS6z2bkvNm1: -0.01500000 Waves 2020.04.29 16:32 [976115] smart account 3MyhMcrCuBoTaov5Z2BiSsXVzS6z2bkvNm1 > SELF 0.00000000 Waves
{ "type": 13, "id": "T3pgitk5qfkFgr89Fgr1BaPw5u3tE4XqAEo9eSUoVvk", "fee": 1500000, "feeAssetId": null, "timestamp": 1588167200143, "version": 1, "sender": "3MyhMcrCuBoTaov5Z2BiSsXVzS6z2bkvNm1", "senderPublicKey": "AiHiuEsvDvRfZatZXdcoM2CsZAWp4A39Wqh77nUDTCJB", "proofs": [ "5RKC5gh6mNCoqsVPJSbsdZr2QsfET3atxxQQJjFsDz1cJSYzSEhvEtuj2BuAho9HsQfx3dPVBnZZe8X8eACKr7QL" ], "script": "base64:AAIDAAAAAAAAAA0IARIDCgEIEgQKAggCAAAASAAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQW1wdVhjSS9vNHBJQjV5d3Y5RE9PR2FwVEJVd1JWbE0vNitINmhGZWxPWHRrcndZL1lJdG1QeEVEcHo3ckFlclFQUWU5dERQRWFBdi9HbmxFenR5Yk9GWGd1OUR6RGU4WW9NUkQxdmFrZ29BY29nbWJZNThRRDZLTWo1SGtvVmoveVROSWM5c3pqNXFoSWxyQWRtYjNLTEw2aFFVN3k4K0pqNjlCV1ZQc2FRZ2tzcFNkZVl0YjF0SFFjN3Q5NW43T1o1NnIyQTdHMytiUWY2blNNa1BrQWhJckVwYkNtNThvaUdCY3pkVGQvTHFGU1ZvdFpzYkw3WWg2U0hMZm5IZUQrUWdjZkpybmFtOE9ITUdKRUpUUlhqSUxlSEdqbFJDUDhvVnBpb0hyeTFTMnhQeDVzVnpJbTJNTStDelllbkFHbG8wajI2YXRCaGlVTG9UdWx3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GF0YUVudHJ5AAAAAgUAAAAGZ2FtZUlkBQAAAA5uZXdHYW1lRGF0YVN0cgkABEwAAAACBQAAABFkZWNyZWFzZWRSZXNlcnZlcwUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAMJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAADdHR4BQAAAAckbWF0Y2gwBAAAAAdhc3NldElkCQEAAAAVdmFsaWRhdGVBbmRHZXRBc3NldElkAAAAAQgFAAAAA3R0eAAAAAdhc3NldElkCQAAZwAAAAIJAABlAAAAAgkBAAAADHdhdmVzQmFsYW5jZQAAAAEFAAAABHRoaXMIBQAAAAN0dHgAAAAGYW1vdW50CQEAAAAIZ2V0SW50T3IAAAACCQABkQAAAAIFAAAADlJFU0VSVkFUSU9OS0VZBQAAAAdhc3NldElkAAAAAAAAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwAwkAAAAAAAACCQEAAAAIZ2V0SW50T3IAAAACCQABkQAAAAIFAAAADlJFU0VSVkFUSU9OS0VZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAIJAQAAAAhnZXRJbnRPcgAAAAIJAAGRAAAAAgUAAAAOUkVTRVJWQVRJT05LRVkAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAHBwe3ECbH", "chainId": 84, "height": 976115, "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 WAVESD = 100000000 | |
11 | + | ||
12 | + | let USDND = 1000000 | |
13 | + | ||
14 | + | let DECIMALS = [WAVESD, USDND] | |
15 | + | ||
16 | + | let ASSETS = [unit, fromBase58String("3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC")] | |
17 | + | ||
18 | + | func getCommission (assetId) = ((5 * DECIMALS[assetId]) / 1000) | |
19 | + | ||
20 | + | ||
21 | + | func getBetMin (assetId) = ((1 * DECIMALS[assetId]) / 2) | |
22 | + | ||
23 | + | ||
24 | + | func getBetMax (assetId) = (6 * DECIMALS[assetId]) | |
25 | + | ||
26 | + | ||
27 | + | func getBetStep (assetId) = ((1 * DECIMALS[assetId]) / 10) | |
28 | + | ||
29 | + | ||
30 | + | func getIntOr (key,default) = if (isDefined(getInteger(this, key))) | |
31 | + | then getIntegerValue(this, key) | |
32 | + | else default | |
33 | + | ||
34 | + | ||
35 | + | func setInt (key,value) = DataEntry(key, value) | |
36 | + | ||
37 | + | ||
38 | + | func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1)) | |
39 | + | ||
40 | + | ||
41 | + | func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by)) | |
42 | + | ||
43 | + | ||
44 | + | let PRECISION = 10000 | |
45 | + | ||
46 | + | let R1MAX = 96 | |
47 | + | ||
48 | + | let R1MIN = 94 | |
49 | + | ||
50 | + | let R1K = 9860 | |
51 | + | ||
52 | + | let R2MAX = 93 | |
53 | + | ||
54 | + | let R2MIN = 87 | |
55 | + | ||
56 | + | let R2K = 9800 | |
57 | + | ||
58 | + | let R3MAX = 86 | |
59 | + | ||
60 | + | let R3MIN = 86 | |
61 | + | ||
62 | + | let R3K = 9750 | |
63 | + | ||
64 | + | let R4MAX = 85 | |
65 | + | ||
66 | + | let R4MIN = 84 | |
67 | + | ||
68 | + | let R4K = 9670 | |
69 | + | ||
70 | + | let R5MAX = 83 | |
71 | + | ||
72 | + | let R5MIN = 83 | |
73 | + | ||
74 | + | let R5K = 9630 | |
75 | + | ||
76 | + | let R6MAX = 82 | |
77 | + | ||
78 | + | let R6MIN = 67 | |
79 | + | ||
80 | + | let R6K = 9610 | |
81 | + | ||
82 | + | let R7MAX = 66 | |
83 | + | ||
84 | + | let R7MIN = 56 | |
85 | + | ||
86 | + | let R7K = 9560 | |
87 | + | ||
88 | + | let R8MAX = 55 | |
89 | + | ||
90 | + | let R8MIN = 38 | |
91 | + | ||
92 | + | let R8K = 9500 | |
93 | + | ||
94 | + | let R9MAX = 37 | |
95 | + | ||
96 | + | let R9MIN = 3 | |
97 | + | ||
98 | + | let R9K = 9290 | |
99 | + | ||
100 | + | let R10MAX = 2 | |
101 | + | ||
102 | + | let R10MIN = 1 | |
103 | + | ||
104 | + | let R10K = 9860 | |
105 | + | ||
106 | + | let IdxGameState = 0 | |
107 | + | ||
108 | + | let IdxPlayerChoice = 1 | |
109 | + | ||
110 | + | let IdxPlayerPubKey58 = 2 | |
111 | + | ||
112 | + | let IdxStartedHeight = 3 | |
113 | + | ||
114 | + | let IdxWinAmount = 4 | |
115 | + | ||
116 | + | let IdxAssetId = 5 | |
117 | + | ||
118 | + | let RESERVATIONKEY = ["$RESERVED_AMOUNT_WAVES", "$RESERVED_AMOUNT_USDN"] | |
119 | + | ||
120 | + | let GAMESCOUNTERKEY = "$GAME_NUM" | |
121 | + | ||
122 | + | let MAXBALANCEKEY = "$MAX_BALANCE" | |
123 | + | ||
124 | + | let STATESUBMITTED = "SUBMITTED" | |
125 | + | ||
126 | + | let STATEWON = "WON" | |
127 | + | ||
128 | + | let STATELOST = "LOST" | |
129 | + | ||
130 | + | func incrementGameNum () = { | |
131 | + | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
132 | + | case num: Int => | |
133 | + | num | |
134 | + | case _ => | |
135 | + | 0 | |
136 | + | } | |
137 | + | (gameNum + 1) | |
138 | + | } | |
139 | + | ||
140 | + | ||
141 | + | func extractReservedAmount (assetId) = match getInteger(this, RESERVATIONKEY[assetId]) { | |
142 | + | case a: Int => | |
143 | + | a | |
144 | + | case _ => | |
145 | + | 0 | |
146 | + | } | |
147 | + | ||
148 | + | ||
149 | + | func increaseReserveAmount (winAmount,assetId) = { | |
150 | + | let newReservedAmount = (getIntOr(RESERVATIONKEY[assetId], 0) + winAmount) | |
151 | + | if ((newReservedAmount > wavesBalance(this))) | |
152 | + | then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.") | |
153 | + | else newReservedAmount | |
154 | + | } | |
155 | + | ||
156 | + | ||
157 | + | func decreaseReservedAmount (gameId,assetId,winAmount) = if ((0 > (getIntOr(RESERVATIONKEY[assetId], 0) - winAmount))) | |
158 | + | then throw("Invalid Dice Roller account state - reserved amount is less than 0") | |
159 | + | else changeInt(RESERVATIONKEY[assetId], -(winAmount)) | |
160 | + | ||
161 | + | ||
162 | + | func validateAndGetAssetId (assetId) = if ((assetId == ASSETS[0])) | |
163 | + | then 0 | |
164 | + | else if ((assetId == ASSETS[1])) | |
165 | + | then 1 | |
166 | + | else throw("Invalid payment asset") | |
167 | + | ||
168 | + | ||
169 | + | func validateBetAndGetWinAmount (betAmount,assetId,playerChoice) = { | |
170 | + | let bet = (betAmount - getCommission(assetId)) | |
171 | + | let BETMIN = getBetMin(assetId) | |
172 | + | let BETMAX = getBetMax(assetId) | |
173 | + | let BETSTEP = getBetStep(assetId) | |
174 | + | let betAmountValid = if (if ((bet >= BETMIN)) | |
175 | + | then (BETMAX >= bet) | |
176 | + | else false) | |
177 | + | then ((bet % BETSTEP) == 0) | |
178 | + | else false | |
179 | + | if (betAmountValid) | |
180 | + | then { | |
181 | + | let playerChoiceInt = parseIntValue(playerChoice) | |
182 | + | if (if ((playerChoiceInt >= 1)) | |
183 | + | then (96 >= playerChoiceInt) | |
184 | + | else false) | |
185 | + | then { | |
186 | + | let RKxPrecision = if (if ((R1MAX >= playerChoiceInt)) | |
187 | + | then (playerChoiceInt >= R1MIN) | |
188 | + | else false) | |
189 | + | then R1K | |
190 | + | else if (if ((R2MAX >= playerChoiceInt)) | |
191 | + | then (playerChoiceInt >= R2MIN) | |
192 | + | else false) | |
193 | + | then R2K | |
194 | + | else if (if ((R3MAX >= playerChoiceInt)) | |
195 | + | then (playerChoiceInt >= R3MIN) | |
196 | + | else false) | |
197 | + | then R3K | |
198 | + | else if (if ((R4MAX >= playerChoiceInt)) | |
199 | + | then (playerChoiceInt >= R4MIN) | |
200 | + | else false) | |
201 | + | then R4K | |
202 | + | else if (if ((R5MAX >= playerChoiceInt)) | |
203 | + | then (playerChoiceInt >= R5MIN) | |
204 | + | else false) | |
205 | + | then R5K | |
206 | + | else if (if ((R6MAX >= playerChoiceInt)) | |
207 | + | then (playerChoiceInt >= R6MIN) | |
208 | + | else false) | |
209 | + | then R6K | |
210 | + | else if (if ((R7MAX >= playerChoiceInt)) | |
211 | + | then (playerChoiceInt >= R7MIN) | |
212 | + | else false) | |
213 | + | then R7K | |
214 | + | else if (if ((R8MAX >= playerChoiceInt)) | |
215 | + | then (playerChoiceInt >= R8MIN) | |
216 | + | else false) | |
217 | + | then R8K | |
218 | + | else if (if ((R9MAX >= playerChoiceInt)) | |
219 | + | then (playerChoiceInt >= R9MIN) | |
220 | + | else false) | |
221 | + | then R9K | |
222 | + | else if (if ((R10MAX >= playerChoiceInt)) | |
223 | + | then (playerChoiceInt >= R10MIN) | |
224 | + | else false) | |
225 | + | then R10K | |
226 | + | else throw(("Couldn't define range: playerChoice=" + playerChoice)) | |
227 | + | ((((100 * RKxPrecision) / playerChoiceInt) * bet) / PRECISION) | |
228 | + | } | |
229 | + | else throw("Player choice is out of the condition below: 1 <= choice <= 96") | |
230 | + | } | |
231 | + | else throw(((((("Bet amount is not in range: minBet=" + toString(BETMIN)) + " maxBet=") + toString(BETMAX)) + " betStep=") + toString(BETSTEP))) | |
232 | + | } | |
233 | + | ||
234 | + | ||
235 | + | func randToStr (r) = if (if ((r >= 1)) | |
236 | + | then (100 >= r) | |
237 | + | else false) | |
238 | + | then toString(r) | |
239 | + | else throw(("Unsupported r parameter passed: expected=[1,...,100] actual=" + toString(r))) | |
240 | + | ||
241 | + | ||
242 | + | func generateRandInt (gameId,rsaSign) = { | |
243 | + | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
244 | + | if (rsaSigValid) | |
245 | + | then { | |
246 | + | let rand = (toInt(sha256(rsaSign)) % 100) | |
247 | + | if ((0 > rand)) | |
248 | + | then ((-1 * rand) + 1) | |
249 | + | else (rand + 1) | |
250 | + | } | |
251 | + | else throw("Invalid RSA signature") | |
252 | + | } | |
253 | + | ||
254 | + | ||
255 | + | func isPlayerWin (playerChoice,rand) = { | |
256 | + | let playerChoiceInt = parseIntValue(playerChoice) | |
257 | + | (playerChoiceInt >= rand) | |
258 | + | } | |
259 | + | ||
260 | + | ||
261 | + | func formatGameDataParam (p) = { | |
262 | + | let s = size(p) | |
263 | + | if ((s == 0)) | |
264 | + | then throw("Parameter size must be greater then 0") | |
265 | + | else if ((s > 99)) | |
266 | + | then throw("Parameter size must be less then 100") | |
267 | + | else if ((10 > s)) | |
268 | + | then (("0" + toString(s)) + p) | |
269 | + | else (toString(s) + p) | |
270 | + | } | |
271 | + | ||
272 | + | ||
273 | + | func formatGameData (gameState,playerChoice,playerPubKey58,startedHeight,winAmount,assetId,randOrEmpty) = (((((((((((gameState + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(startedHeight)) + "_") + toString(winAmount)) + "_") + toString(assetId)) + (if ((randOrEmpty == "")) | |
274 | + | then "" | |
275 | + | else ("_" + randOrEmpty))) | |
276 | + | ||
277 | + | ||
278 | + | func removeUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
279 | + | then drop(remaining, 1) | |
280 | + | else remaining | |
281 | + | ||
282 | + | ||
283 | + | func extractGameData (gameId) = split(match getString(this, gameId) { | |
284 | + | case str: String => | |
285 | + | str | |
286 | + | case _ => | |
287 | + | throw((("Game: " + gameId) + " not found.")) | |
288 | + | }, "_") | |
289 | + | ||
290 | + | ||
291 | + | func winScriptSet (gameId,playerAddress,winAmount,assetId,newGameDataStr,winByTimeout,decreasedReserves) = { | |
292 | + | let wSetCommonData = [decreasedReserves] | |
293 | + | let tSetCommonData = [ScriptTransfer(playerAddress, winAmount, ASSETS[assetId])] | |
294 | + | if (winByTimeout) | |
295 | + | then { | |
296 | + | let newGameDataStrAdjusted = (newGameDataStr + "_TIMEOUT") | |
297 | + | let gameData = DataEntry(gameId, newGameDataStrAdjusted) | |
298 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
299 | + | } | |
300 | + | else { | |
301 | + | let gameData = DataEntry(gameId, newGameDataStr) | |
302 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
303 | + | } | |
304 | + | } | |
305 | + | ||
306 | + | ||
307 | + | @Callable(i) | |
308 | + | func bet (playerChoice) = { | |
309 | + | let gameId = toBase58String(i.transactionId) | |
310 | + | if ((i.payment == unit)) | |
311 | + | then throw("No payment") | |
312 | + | else if (isDefined(getString(this, gameId))) | |
313 | + | then throw((("Bet for: " + gameId) + " was already made.")) | |
314 | + | else { | |
315 | + | let p = extract(i.payment) | |
316 | + | let assetId = validateAndGetAssetId(p.assetId) | |
317 | + | let commission = getCommission(assetId) | |
318 | + | let winAmount = validateBetAndGetWinAmount(p.amount, assetId, playerChoice) | |
319 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
320 | + | let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, assetId, "") | |
321 | + | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY[assetId], increaseReserveAmount(winAmount, assetId)), incrementInt(GAMESCOUNTERKEY), DataEntry(gameId, gameData)]), TransferSet([ScriptTransfer(SERVER, commission, p.assetId)])) | |
322 | + | } | |
323 | + | } | |
324 | + | ||
325 | + | ||
326 | + | ||
327 | + | @Callable(i) | |
328 | + | func withdraw (gameId,rsaSign) = { | |
329 | + | let gameData = extractGameData(gameId) | |
330 | + | let gameState = gameData[IdxGameState] | |
331 | + | let playerChoice = gameData[IdxPlayerChoice] | |
332 | + | let startedHeight = parseIntValue(gameData[IdxStartedHeight]) | |
333 | + | let winAmount = parseIntValue(gameData[IdxWinAmount]) | |
334 | + | let assetId = parseIntValue(gameData[IdxAssetId]) | |
335 | + | let playerPubKey58 = gameData[IdxPlayerPubKey58] | |
336 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
337 | + | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
338 | + | let decreasedReserves = decreaseReservedAmount(gameId, assetId, winAmount) | |
339 | + | if ((gameState != STATESUBMITTED)) | |
340 | + | then throw("Invalid game state for passed gameId") | |
341 | + | else if (winByTimeout) | |
342 | + | then { | |
343 | + | let randStr = playerChoice | |
344 | + | let newGameDataStr = formatGameData(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randStr) | |
345 | + | winScriptSet(gameId, playerAddress, winAmount, assetId, newGameDataStr, winByTimeout, decreasedReserves) | |
346 | + | } | |
347 | + | else { | |
348 | + | let rand = generateRandInt(gameId, rsaSign) | |
349 | + | let randStr = randToStr(rand) | |
350 | + | if (isPlayerWin(playerChoice, rand)) | |
351 | + | then { | |
352 | + | let newGameDataStr = formatGameData(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randStr) | |
353 | + | winScriptSet(gameId, playerAddress, winAmount, assetId, newGameDataStr, winByTimeout, decreasedReserves) | |
354 | + | } | |
355 | + | else { | |
356 | + | let newGameDataStr = formatGameData(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randStr) | |
357 | + | WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves]) | |
358 | + | } | |
359 | + | } | |
360 | + | } | |
361 | + | ||
362 | + | ||
363 | + | @Verifier(tx) | |
364 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
365 | + | then match tx { | |
366 | + | case ttx: TransferTransaction => | |
367 | + | let assetId = validateAndGetAssetId(ttx.assetId) | |
368 | + | ((wavesBalance(this) - ttx.amount) >= getIntOr(RESERVATIONKEY[assetId], 0)) | |
369 | + | case stx: SetScriptTransaction => | |
370 | + | if ((getIntOr(RESERVATIONKEY[0], 0) == 0)) | |
371 | + | then (getIntOr(RESERVATIONKEY[1], 0) == 0) | |
372 | + | else false | |
373 | + | case _ => | |
374 | + | false | |
375 | + | } | |
376 | + | else false | |
377 | + |
github/deemru/w8io/026f985 27.06 ms ◑