tx · 8nTUXMKYZd4syjUQi9pV5DoWQQqr8oAeuPfFHipXNykP 3MtitUb7hujjfA5WCWrpUnmhqD2x4SzJTHa: -0.01500000 Waves 2020.04.29 15:07 [976031] smart account 3MtitUb7hujjfA5WCWrpUnmhqD2x4SzJTHa > SELF 0.00000000 Waves
{ "type": 13, "id": "8nTUXMKYZd4syjUQi9pV5DoWQQqr8oAeuPfFHipXNykP", "fee": 1500000, "feeAssetId": null, "timestamp": 1588162153868, "version": 1, "sender": "3MtitUb7hujjfA5WCWrpUnmhqD2x4SzJTHa", "senderPublicKey": "CTYQkT6K3sz36oewPNcnqYn59iaCj6U19wj1r1ri4z4h", "proofs": [ "2MYtpF7TTqWGjUByYLtep6wCTaWQd7uQdgWAYrQaDtxJBHZvWx7eTi95zrLvvb7VPUDw4hWXPaz7mRrpBd5jH2rp" ], "script": "base64:AAIDAAAAAAAAABIIARIDCgEEEgMKAQgSBAoCCAIAAAAyAAAAAAZXQVZFU0QAAAAAAAX14QAAAAAABVVTRE5EAAAAAAAAD0JAAAAAAAhERUNJTUFMUwkABEwAAAACBQAAAAZXQVZFU0QJAARMAAAAAgUAAAAFVVNETkQFAAAAA25pbAAAAAAGQVNTRVRTCQAETAAAAAIFAAAABHVuaXQJAARMAAAAAgkAAlkAAAABAgAAACwzS0ZYQkdHTENqQTVaMkR1VzREcTlmRERySGpKSlAxWkVrYW9halN6dUtzQwUAAAADbmlsAQAAAA1nZXRDb21taXNzaW9uAAAAAQAAAAdhc3NldElkCQAAaQAAAAIJAABoAAAAAgAAAAAAAAAABQkAAZEAAAACBQAAAAhERUNJTUFMUwUAAAAHYXNzZXRJZAAAAAAAAAAD6AAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQW1wdVhjSS9vNHBJQjV5d3Y5RE9PR2FwVEJVd1JWbE0vNitINmhGZWxPWHRrcndZL1lJdG1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zZXJ2ZXMFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAA3R0eAUAAAAHJG1hdGNoMAQAAAAHYXNzZXRJZAkBAAAAFXZhbGlkYXRlQW5kR2V0QXNzZXRJZAAAAAEIBQAAAAN0dHgAAAAHYXNzZXRJZAkAAGcAAAACCQAAZQAAAAIJAQAAAAx3YXZlc0JhbGFuY2UAAAABBQAAAAR0aGlzCAUAAAADdHR4AAAABmFtb3VudAkBAAAACGdldEludE9yAAAAAgkAAZEAAAACBQAAAA5SRVNFUlZBVElPTktFWQUAAAAHYXNzZXRJZAAAAAAAAAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAA3N0eAUAAAAHJG1hdGNoMAMDCQAAAAAAAAIJAQAAAAhpc0RBcHBVcAAAAAAHCQAAAAAAAAIJAQAAAAhnZXRJbnRPcgAAAAIJAAGRAAAAAgUAAAAOUkVTRVJWQVRJT05LRVkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHCQAAAAAAAAIJAQAAAAhnZXRJbnRPcgAAAAIJAAGRAAAAAgUAAAAOUkVTRVJWQVRJT05LRVkAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAHBweJJ4fV", "chainId": 84, "height": 976031, "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 WAVESD = 100000000 | |
5 | + | ||
6 | + | let USDND = 1000000 | |
7 | + | ||
8 | + | let DECIMALS = [WAVESD, USDND] | |
9 | + | ||
10 | + | let ASSETS = [unit, fromBase58String("3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC")] | |
11 | + | ||
12 | + | func getCommission (assetId) = ((5 * DECIMALS[assetId]) / 1000) | |
13 | + | ||
14 | + | ||
15 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmpuXcI/o4pIB5ywv9DOOGapTBUwRVlM/6+H6hFelOXtkrwY/YItmPxEDpz7rAerQPQe9tDPEaAv/GnlEztybOFXgu9DzDe8YoMRD1vakgoAcogmbY58QD6KMj5HkoVj/yTNIc9szj5qhIlrAdmb3KLL6hQU7y8+Jj69BWVPsaQgkspSdeYtb1tHQc7t95n7OZ56r2A7G3+bQf6nSMkPkAhIrEpbCm58oiGBczdTd/LqFSVotZsbL7Yh6SHLfnHeD+QgcfJrnam8OHMGJEJTRXjILeHGjlRCP8oVpioHry1S2xPx5sVzIm2MM+CzYenAGlo0j26atBhiULoTulwD3pQIDAQAB") | |
16 | + | ||
17 | + | let SERVER = addressFromStringValue("3N4Aib5iubWiGMzdTh6wWiVDVbo32oeVUmH") | |
18 | + | ||
19 | + | let RANDORACLETIMEFRAME = 4320 | |
20 | + | ||
21 | + | let MAXBALANCEDIFF = (70 * WAVESD) | |
22 | + | ||
23 | + | let BET1 = 1 | |
24 | + | ||
25 | + | let BET2 = 2 | |
26 | + | ||
27 | + | let BET4 = 4 | |
28 | + | ||
29 | + | let BET8 = 8 | |
30 | + | ||
31 | + | let BET14 = 14 | |
32 | + | ||
33 | + | let RATEMULT = 10000 | |
34 | + | ||
35 | + | let RATE1 = 39655 | |
36 | + | ||
37 | + | let RATE2 = 24600 | |
38 | + | ||
39 | + | let RATE3 = 19000 | |
40 | + | ||
41 | + | let RATE4 = 14200 | |
42 | + | ||
43 | + | let RATE5 = 11400 | |
44 | + | ||
45 | + | let RATES = [RATE1, RATE2, RATE3, RATE4, RATE5] | |
46 | + | ||
47 | + | let BETS = [BET1, BET2, BET4, BET8, BET14] | |
48 | + | ||
49 | + | let IdxGameState = 0 | |
50 | + | ||
51 | + | let IdxPlayerChoice = 1 | |
52 | + | ||
53 | + | let IdxPlayerPubKey58 = 2 | |
54 | + | ||
55 | + | let IdxStartedHeight = 3 | |
56 | + | ||
57 | + | let IdxWinAmount = 4 | |
58 | + | ||
59 | + | let IdxAssetId = 5 | |
60 | + | ||
61 | + | let RESERVATIONKEY = ["$RESERVED_AMOUNT_WAVES", "$RESERVED_AMOUNT_USDN"] | |
62 | + | ||
63 | + | let GAMESCOUNTERKEY = "$GAME_NUM" | |
64 | + | ||
65 | + | let DAPPUPKEY = "$DAPP_UP" | |
66 | + | ||
67 | + | let MAXBALANCEKEY = "$MAX_BALANCE" | |
68 | + | ||
69 | + | let STATESUBMITTED = "SUBMITTED" | |
70 | + | ||
71 | + | let STATEWON = "WON" | |
72 | + | ||
73 | + | let STATELOST = "LOST" | |
74 | + | ||
75 | + | func getIntOr (key,default) = if (isDefined(getInteger(this, key))) | |
76 | + | then getIntegerValue(this, key) | |
77 | + | else default | |
78 | + | ||
79 | + | ||
80 | + | func setInt (key,value) = DataEntry(key, value) | |
81 | + | ||
82 | + | ||
83 | + | func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1)) | |
84 | + | ||
85 | + | ||
86 | + | func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by)) | |
87 | + | ||
88 | + | ||
89 | + | func increaseReserveAmount (winAmount,assetId) = { | |
90 | + | let newReservedAmount = (getIntOr(RESERVATIONKEY[assetId], 0) + winAmount) | |
91 | + | if ((newReservedAmount > wavesBalance(this))) | |
92 | + | then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.") | |
93 | + | else newReservedAmount | |
94 | + | } | |
95 | + | ||
96 | + | ||
97 | + | func decreaseReservedAmount (gameId,assetId,winAmount) = if ((0 > (getIntOr(RESERVATIONKEY[assetId], 0) - winAmount))) | |
98 | + | then throw("Invalid Dice Roller account state - reserved amount is less than 0") | |
99 | + | else changeInt(RESERVATIONKEY[assetId], -(winAmount)) | |
100 | + | ||
101 | + | ||
102 | + | func validateAndGetAssetId (assetId) = if ((assetId == ASSETS[0])) | |
103 | + | then 0 | |
104 | + | else if ((assetId == ASSETS[1])) | |
105 | + | then 1 | |
106 | + | else throw("Invalid payment asset") | |
107 | + | ||
108 | + | ||
109 | + | func validateBetAndGetWinAmount (betAmount,assetId,playerChoice) = { | |
110 | + | let dicesCount = size(playerChoice) | |
111 | + | let commission = getCommission(assetId) | |
112 | + | func checkAmount (a,x) = if (a) | |
113 | + | then true | |
114 | + | else (betAmount == ((x * DECIMALS[assetId]) + commission)) | |
115 | + | ||
116 | + | if (!({ | |
117 | + | let $list46834716 = BETS | |
118 | + | let $size46834716 = size($list46834716) | |
119 | + | let $acc046834716 = false | |
120 | + | if (($size46834716 == 0)) | |
121 | + | then $acc046834716 | |
122 | + | else { | |
123 | + | let $acc146834716 = checkAmount($acc046834716, $list46834716[0]) | |
124 | + | if (($size46834716 == 1)) | |
125 | + | then $acc146834716 | |
126 | + | else { | |
127 | + | let $acc246834716 = checkAmount($acc146834716, $list46834716[1]) | |
128 | + | if (($size46834716 == 2)) | |
129 | + | then $acc246834716 | |
130 | + | else { | |
131 | + | let $acc346834716 = checkAmount($acc246834716, $list46834716[2]) | |
132 | + | if (($size46834716 == 3)) | |
133 | + | then $acc346834716 | |
134 | + | else { | |
135 | + | let $acc446834716 = checkAmount($acc346834716, $list46834716[3]) | |
136 | + | if (($size46834716 == 4)) | |
137 | + | then $acc446834716 | |
138 | + | else { | |
139 | + | let $acc546834716 = checkAmount($acc446834716, $list46834716[4]) | |
140 | + | if (($size46834716 == 5)) | |
141 | + | then $acc546834716 | |
142 | + | else { | |
143 | + | let $acc646834716 = checkAmount($acc546834716, $list46834716[5]) | |
144 | + | throw("List size exceed 5") | |
145 | + | } | |
146 | + | } | |
147 | + | } | |
148 | + | } | |
149 | + | } | |
150 | + | } | |
151 | + | })) | |
152 | + | then throw("Bet amount is not valid") | |
153 | + | else if ((parseInt(playerChoice) == unit)) | |
154 | + | then throw("Invalid player's choice") | |
155 | + | else if (if ((1 > dicesCount)) | |
156 | + | then true | |
157 | + | else (dicesCount > 5)) | |
158 | + | then throw("Invalid dices count in player's choice") | |
159 | + | else { | |
160 | + | let bet = (betAmount - commission) | |
161 | + | ((bet * RATES[(dicesCount - 1)]) / RATEMULT) | |
162 | + | } | |
163 | + | } | |
164 | + | ||
165 | + | ||
166 | + | func generateRandChoise (gameId,rsaSign) = { | |
167 | + | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
168 | + | if (!(rsaSigValid)) | |
169 | + | then throw("Invalid RSA signature") | |
170 | + | else { | |
171 | + | let rand = (toInt(sha256(rsaSign)) % 6) | |
172 | + | let result = if ((0 > rand)) | |
173 | + | then (-1 * rand) | |
174 | + | else rand | |
175 | + | toString(result) | |
176 | + | } | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | func isPlayerWin (playerChoice,randChoise) = { | |
181 | + | let s = size(playerChoice) | |
182 | + | func check (a,x) = if (a) | |
183 | + | then true | |
184 | + | else if ((s >= x)) | |
185 | + | then (take(drop(playerChoice, (x - 1)), 1) == randChoise) | |
186 | + | else false | |
187 | + | ||
188 | + | let $list56005634 = [1, 2, 3, 4, 5] | |
189 | + | let $size56005634 = size($list56005634) | |
190 | + | let $acc056005634 = false | |
191 | + | if (($size56005634 == 0)) | |
192 | + | then $acc056005634 | |
193 | + | else { | |
194 | + | let $acc156005634 = check($acc056005634, $list56005634[0]) | |
195 | + | if (($size56005634 == 1)) | |
196 | + | then $acc156005634 | |
197 | + | else { | |
198 | + | let $acc256005634 = check($acc156005634, $list56005634[1]) | |
199 | + | if (($size56005634 == 2)) | |
200 | + | then $acc256005634 | |
201 | + | else { | |
202 | + | let $acc356005634 = check($acc256005634, $list56005634[2]) | |
203 | + | if (($size56005634 == 3)) | |
204 | + | then $acc356005634 | |
205 | + | else { | |
206 | + | let $acc456005634 = check($acc356005634, $list56005634[3]) | |
207 | + | if (($size56005634 == 4)) | |
208 | + | then $acc456005634 | |
209 | + | else { | |
210 | + | let $acc556005634 = check($acc456005634, $list56005634[4]) | |
211 | + | if (($size56005634 == 5)) | |
212 | + | then $acc556005634 | |
213 | + | else { | |
214 | + | let $acc656005634 = check($acc556005634, $list56005634[5]) | |
215 | + | throw("List size exceed 5") | |
216 | + | } | |
217 | + | } | |
218 | + | } | |
219 | + | } | |
220 | + | } | |
221 | + | } | |
222 | + | } | |
223 | + | ||
224 | + | ||
225 | + | func formatGameData (gameState,playerChoice,playerPubKey58,startedHeight,winAmount,assetId,randOrEmpty) = (((((((((((gameState + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(startedHeight)) + "_") + toString(winAmount)) + "_") + toString(assetId)) + (if ((randOrEmpty == "")) | |
226 | + | then "" | |
227 | + | else ("_" + randOrEmpty))) | |
228 | + | ||
229 | + | ||
230 | + | func extractGameData (gameId) = split(match getString(this, gameId) { | |
231 | + | case str: String => | |
232 | + | str | |
233 | + | case _ => | |
234 | + | throw((("Game: " + gameId) + " not found.")) | |
235 | + | }, "_") | |
236 | + | ||
237 | + | ||
238 | + | func winScriptSet (gameId,playerAddress,winAmount,assetId,newgameData,winByTimeout,decreasedReserves) = { | |
239 | + | let wSetCommonData = [decreasedReserves] | |
240 | + | let tSetCommonData = [ScriptTransfer(playerAddress, winAmount, ASSETS[assetId])] | |
241 | + | if (winByTimeout) | |
242 | + | then { | |
243 | + | let newgameDataAdjusted = (newgameData + "_TIMEOUT") | |
244 | + | let gameData = DataEntry(gameId, newgameDataAdjusted) | |
245 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
246 | + | } | |
247 | + | else { | |
248 | + | let gameData = DataEntry(gameId, newgameData) | |
249 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
250 | + | } | |
251 | + | } | |
252 | + | ||
253 | + | ||
254 | + | func isDAppUp () = { | |
255 | + | let dAppUpOpt = getBoolean(this, DAPPUPKEY) | |
256 | + | if (isDefined(dAppUpOpt)) | |
257 | + | then extract(dAppUpOpt) | |
258 | + | else false | |
259 | + | } | |
260 | + | ||
261 | + | ||
262 | + | func monitorMaxBalance () = { | |
263 | + | let maxBalanceOpt = getInteger(this, MAXBALANCEKEY) | |
264 | + | let maxBalance = if (isDefined(maxBalanceOpt)) | |
265 | + | then extract(maxBalanceOpt) | |
266 | + | else 0 | |
267 | + | let currBalance = wavesBalance(this) | |
268 | + | if ((currBalance > maxBalance)) | |
269 | + | then currBalance | |
270 | + | else { | |
271 | + | let diff = (maxBalance - currBalance) | |
272 | + | if ((diff > MAXBALANCEDIFF)) | |
273 | + | then throw("dApp is temporary disabled") | |
274 | + | else maxBalance | |
275 | + | } | |
276 | + | } | |
277 | + | ||
278 | + | ||
279 | + | @Callable(i) | |
280 | + | func dAppUp (dAppUp) = if ((i.caller != SERVER)) | |
281 | + | then throw("Only Server can manage dAppUp attribute") | |
282 | + | else if ((isDAppUp() == dAppUp)) | |
283 | + | then throw("dAppUp must be different with actual value") | |
284 | + | else WriteSet([DataEntry(DAPPUPKEY, dAppUp)]) | |
285 | + | ||
286 | + | ||
287 | + | ||
288 | + | @Callable(i) | |
289 | + | func bet (playerChoice) = { | |
290 | + | let gameId = toBase58String(i.transactionId) | |
291 | + | if (!(isDAppUp())) | |
292 | + | then throw("DApp is under maintenance") | |
293 | + | else if ((i.payment == unit)) | |
294 | + | then throw("No payment") | |
295 | + | else if (isDefined(getString(this, gameId))) | |
296 | + | then throw((("Bet for: " + gameId) + " was already made.")) | |
297 | + | else { | |
298 | + | let p = extract(i.payment) | |
299 | + | let assetId = validateAndGetAssetId(p.assetId) | |
300 | + | let commission = getCommission(assetId) | |
301 | + | let winAmount = validateBetAndGetWinAmount(p.amount, assetId, playerChoice) | |
302 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
303 | + | let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, assetId, "") | |
304 | + | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY[assetId], increaseReserveAmount(winAmount, assetId)), incrementInt(GAMESCOUNTERKEY), DataEntry(MAXBALANCEKEY, monitorMaxBalance()), DataEntry(gameId, gameData)]), TransferSet([ScriptTransfer(SERVER, commission, p.assetId)])) | |
305 | + | } | |
306 | + | } | |
307 | + | ||
308 | + | ||
309 | + | ||
310 | + | @Callable(i) | |
311 | + | func withdraw (gameId,rsaSign) = { | |
312 | + | let gameData = extractGameData(gameId) | |
313 | + | let gameState = gameData[IdxGameState] | |
314 | + | let playerChoice = gameData[IdxPlayerChoice] | |
315 | + | let startedHeight = parseIntValue(gameData[IdxStartedHeight]) | |
316 | + | let winAmount = parseIntValue(gameData[IdxWinAmount]) | |
317 | + | let assetId = parseIntValue(gameData[IdxAssetId]) | |
318 | + | let playerPubKey58 = gameData[IdxPlayerPubKey58] | |
319 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
320 | + | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
321 | + | let decreasedReserves = decreaseReservedAmount(gameId, assetId, winAmount) | |
322 | + | if ((gameState != STATESUBMITTED)) | |
323 | + | then throw("Invalid game state for passed gameId") | |
324 | + | else if (winByTimeout) | |
325 | + | then { | |
326 | + | let randChoise = take(playerChoice, 1) | |
327 | + | let newgameData = formatGameData(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randChoise) | |
328 | + | winScriptSet(gameId, playerAddress, winAmount, assetId, newgameData, winByTimeout, decreasedReserves) | |
329 | + | } | |
330 | + | else { | |
331 | + | let randChoise = generateRandChoise(gameId, rsaSign) | |
332 | + | if ((i.caller != SERVER)) | |
333 | + | then throw("Regular withdraw can be done by server only") | |
334 | + | else if (isPlayerWin(playerChoice, randChoise)) | |
335 | + | then { | |
336 | + | let newgameData = formatGameData(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randChoise) | |
337 | + | winScriptSet(gameId, playerAddress, winAmount, assetId, newgameData, winByTimeout, decreasedReserves) | |
338 | + | } | |
339 | + | else { | |
340 | + | let newgameData = formatGameData(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randChoise) | |
341 | + | WriteSet([DataEntry(gameId, newgameData), decreasedReserves]) | |
342 | + | } | |
343 | + | } | |
344 | + | } | |
345 | + | ||
346 | + | ||
347 | + | @Verifier(tx) | |
348 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
349 | + | then match tx { | |
350 | + | case ttx: TransferTransaction => | |
351 | + | let assetId = validateAndGetAssetId(ttx.assetId) | |
352 | + | ((wavesBalance(this) - ttx.amount) >= getIntOr(RESERVATIONKEY[assetId], 0)) | |
353 | + | case stx: SetScriptTransaction => | |
354 | + | if (if ((isDAppUp() == false)) | |
355 | + | then (getIntOr(RESERVATIONKEY[0], 0) == 0) | |
356 | + | else false) | |
357 | + | then (getIntOr(RESERVATIONKEY[1], 0) == 0) | |
358 | + | else false | |
359 | + | case _ => | |
360 | + | false | |
361 | + | } | |
362 | + | else false | |
363 | + |
github/deemru/w8io/026f985 30.39 ms ◑