tx · 9U79GLngPrxAjh2DswhqT7pH9WPuSWNhdBYMRvagPRE6 3MwBfmVaMPjFur92U5EDgbHxJk1tVCBCm8c: -0.01500000 Waves 2020.06.16 17:36 [1046196] smart account 3MwBfmVaMPjFur92U5EDgbHxJk1tVCBCm8c > SELF 0.00000000 Waves
{ "type": 13, "id": "9U79GLngPrxAjh2DswhqT7pH9WPuSWNhdBYMRvagPRE6", "fee": 1500000, "feeAssetId": null, "timestamp": 1592318206134, "version": 1, "sender": "3MwBfmVaMPjFur92U5EDgbHxJk1tVCBCm8c", "senderPublicKey": "Dw6VyZcg2wVrzukmHr68JnEQVG2zQEYoQu7enniXaLZ4", "proofs": [ "c46mqa82LpLp1DzDLHEdS1NbYp5sQ6Bq5BddyrwsaN6iBsWqeufbMgUnBp36far8UAZBtN6j3uZxy7HsGKfkXfS" ], "script": "base64:AAIDAAAAAAAAAA0IARIDCgEIEgQKAggCAAAALAAAAAAGV0FWRVNEAAAAAAAF9eEAAAAAAAVVU0RORAAAAAAAAA9CQAAAAAAIREVDSU1BTFMJAARMAAAAAgUAAAAGV0FWRVNECQAETAAAAAIFAAAABVVTRE5EBQAAAANuaWwAAAAABkFTU0VUUwkABEwAAAACBQAAAAR1bml0CQAETAAAAAIJAAJZAAAAAQIAAAAsMjVGRXFFalJrcUs2eUNraVQ3THo2U0FZejdnVUZDdHhmQ0NobnJWRkQ1QVQFAAAAA25pbAAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQW1wdVhjSS9vNHBJQjV5d3Y5RE9PR2FwVEJVd1JWbE0vNitINmhGZWxPWHRrcndZL1lJdG1QeEVEcHo3ckFlclFQUWU5dERQRWFBdi9HbmxFenR5Yk9GWGd1OUR6RGU4WW9NUkQxdmFrZ29BY29nbWJZNThRRDZLTWo1SGtvVmoveVROSWM5c3pqNXFoSWxyQWRtYjNLTEw2aFFV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AAAAAN0dHgFAAAAByRtYXRjaDAEAAAAB2Fzc2V0SWQJAQAAABV2YWxpZGF0ZUFuZEdldEFzc2V0SWQAAAABCAUAAAADdHR4AAAAB2Fzc2V0SWQJAABnAAAAAgkAAGUAAAACCQAD6wAAAAIFAAAABHRoaXMIBQAAAAN0dHgAAAAHYXNzZXRJZAgFAAAAA3R0eAAAAAZhbW91bnQJAQAAAAhnZXRJbnRPcgAAAAIJAAGRAAAAAgUAAAAOUkVTRVJWQVRJT05LRVkFAAAAB2Fzc2V0SWQAAAAAAAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAANzdHgFAAAAByRtYXRjaDADCQAAAAAAAAIJAQAAAAhnZXRJbnRPcgAAAAIJAAGRAAAAAgUAAAAOUkVTRVJWQVRJT05LRVkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAgkBAAAACGdldEludE9yAAAAAgkAAZEAAAACBQAAAA5SRVNFUlZBVElPTktFWQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAcHB8qs9Po=", "chainId": 84, "height": 1046196, "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("25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT")] | |
11 | + | ||
12 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmpuXcI/o4pIB5ywv9DOOGapTBUwRVlM/6+H6hFelOXtkrwY/YItmPxEDpz7rAerQPQe9tDPEaAv/GnlEztybOFXgu9DzDe8YoMRD1vakgoAcogmbY58QD6KMj5HkoVj/yTNIc9szj5qhIlrAdmb3KLL6hQU7y8+Jj69BWVPsaQgkspSdeYtb1tHQc7t95n7OZ56r2A7G3+bQf6nSMkPkAhIrEpbCm58oiGBczdTd/LqFSVotZsbL7Yh6SHLfnHeD+QgcfJrnam8OHMGJEJTRXjILeHGjlRCP8oVpioHry1S2xPx5sVzIm2MM+CzYenAGlo0j26atBhiULoTulwD3pQIDAQAB") | |
13 | + | ||
14 | + | let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j") | |
15 | + | ||
16 | + | let RANDORACLETIMEFRAME = 4320 | |
17 | + | ||
18 | + | let BET1 = 1 | |
19 | + | ||
20 | + | let BET2 = 2 | |
21 | + | ||
22 | + | let BET4 = 4 | |
23 | + | ||
24 | + | let BET8 = 8 | |
25 | + | ||
26 | + | let BET14 = 14 | |
27 | + | ||
28 | + | let RATEMULT = 10000 | |
29 | + | ||
30 | + | let RATE1 = 39655 | |
31 | + | ||
32 | + | let RATE2 = 24600 | |
33 | + | ||
34 | + | let RATE3 = 19000 | |
35 | + | ||
36 | + | let RATE4 = 14200 | |
37 | + | ||
38 | + | let RATE5 = 11400 | |
39 | + | ||
40 | + | let RATES = [RATE1, RATE2, RATE3, RATE4, RATE5] | |
41 | + | ||
42 | + | let BETS = [BET1, BET2, BET4, BET8, BET14] | |
43 | + | ||
44 | + | let IdxGameState = 0 | |
45 | + | ||
46 | + | let IdxPlayerChoice = 1 | |
47 | + | ||
48 | + | let IdxPlayerPubKey58 = 2 | |
49 | + | ||
50 | + | let IdxStartedHeight = 3 | |
51 | + | ||
52 | + | let IdxWinAmount = 4 | |
53 | + | ||
54 | + | let IdxAssetId = 5 | |
55 | + | ||
56 | + | let RESERVATIONKEY = ["$RESERVED_AMOUNT_WAVES", "$RESERVED_AMOUNT_USDN"] | |
57 | + | ||
58 | + | let GAMESCOUNTERKEY = "$GAME_NUM" | |
59 | + | ||
60 | + | let STATESUBMITTED = "SUBMITTED" | |
61 | + | ||
62 | + | let STATEWON = "WON" | |
63 | + | ||
64 | + | let STATELOST = "LOST" | |
65 | + | ||
66 | + | func getIntOr (key,default) = if (isDefined(getInteger(this, key))) | |
67 | + | then getIntegerValue(this, key) | |
68 | + | else default | |
69 | + | ||
70 | + | ||
71 | + | func setInt (key,value) = DataEntry(key, value) | |
72 | + | ||
73 | + | ||
74 | + | func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1)) | |
75 | + | ||
76 | + | ||
77 | + | func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by)) | |
78 | + | ||
79 | + | ||
80 | + | func increaseReserveAmount (winAmount,assetId) = { | |
81 | + | let newReservedAmount = (getIntOr(RESERVATIONKEY[assetId], 0) + winAmount) | |
82 | + | if ((newReservedAmount > assetBalance(this, ASSETS[assetId]))) | |
83 | + | then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.") | |
84 | + | else newReservedAmount | |
85 | + | } | |
86 | + | ||
87 | + | ||
88 | + | func decreaseReservedAmount (gameId,assetId,winAmount) = if ((0 > (getIntOr(RESERVATIONKEY[assetId], 0) - winAmount))) | |
89 | + | then throw("Invalid Dice Roller account state - reserved amount is less than 0") | |
90 | + | else changeInt(RESERVATIONKEY[assetId], -(winAmount)) | |
91 | + | ||
92 | + | ||
93 | + | func validateAndGetAssetId (assetId) = if ((assetId == ASSETS[0])) | |
94 | + | then 0 | |
95 | + | else if ((assetId == ASSETS[1])) | |
96 | + | then 1 | |
97 | + | else throw("Invalid payment asset") | |
98 | + | ||
99 | + | ||
100 | + | func validateBetAndGetWinAmount (bet,assetId,playerChoice) = { | |
101 | + | let dicesCount = size(playerChoice) | |
102 | + | func checkAmount (a,x) = if (a) | |
103 | + | then true | |
104 | + | else (bet == (x * DECIMALS[assetId])) | |
105 | + | ||
106 | + | if (!({ | |
107 | + | let $list47494782 = BETS | |
108 | + | let $size47494782 = size($list47494782) | |
109 | + | let $acc047494782 = false | |
110 | + | if (($size47494782 == 0)) | |
111 | + | then $acc047494782 | |
112 | + | else { | |
113 | + | let $acc147494782 = checkAmount($acc047494782, $list47494782[0]) | |
114 | + | if (($size47494782 == 1)) | |
115 | + | then $acc147494782 | |
116 | + | else { | |
117 | + | let $acc247494782 = checkAmount($acc147494782, $list47494782[1]) | |
118 | + | if (($size47494782 == 2)) | |
119 | + | then $acc247494782 | |
120 | + | else { | |
121 | + | let $acc347494782 = checkAmount($acc247494782, $list47494782[2]) | |
122 | + | if (($size47494782 == 3)) | |
123 | + | then $acc347494782 | |
124 | + | else { | |
125 | + | let $acc447494782 = checkAmount($acc347494782, $list47494782[3]) | |
126 | + | if (($size47494782 == 4)) | |
127 | + | then $acc447494782 | |
128 | + | else { | |
129 | + | let $acc547494782 = checkAmount($acc447494782, $list47494782[4]) | |
130 | + | if (($size47494782 == 5)) | |
131 | + | then $acc547494782 | |
132 | + | else { | |
133 | + | let $acc647494782 = checkAmount($acc547494782, $list47494782[5]) | |
134 | + | throw("List size exceed 5") | |
135 | + | } | |
136 | + | } | |
137 | + | } | |
138 | + | } | |
139 | + | } | |
140 | + | } | |
141 | + | })) | |
142 | + | then throw("Bet amount is not valid") | |
143 | + | else if ((parseInt(playerChoice) == unit)) | |
144 | + | then throw("Invalid player's choice") | |
145 | + | else if (if ((1 > dicesCount)) | |
146 | + | then true | |
147 | + | else (dicesCount > 5)) | |
148 | + | then throw("Invalid dices count in player's choice") | |
149 | + | else ((bet * RATES[(dicesCount - 1)]) / RATEMULT) | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | func generateRandChoise (gameId,rsaSign) = { | |
154 | + | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
155 | + | if (!(rsaSigValid)) | |
156 | + | then throw("Invalid RSA signature") | |
157 | + | else { | |
158 | + | let rand = (toInt(sha256(rsaSign)) % 6) | |
159 | + | let result = if ((0 > rand)) | |
160 | + | then (-1 * rand) | |
161 | + | else rand | |
162 | + | toString((result + 1)) | |
163 | + | } | |
164 | + | } | |
165 | + | ||
166 | + | ||
167 | + | func isPlayerWin (playerChoice,randChoise) = { | |
168 | + | let s = size(playerChoice) | |
169 | + | func check (a,x) = if (a) | |
170 | + | then true | |
171 | + | else if ((s >= x)) | |
172 | + | then (take(drop(playerChoice, (x - 1)), 1) == randChoise) | |
173 | + | else false | |
174 | + | ||
175 | + | let $list56265660 = [1, 2, 3, 4, 5] | |
176 | + | let $size56265660 = size($list56265660) | |
177 | + | let $acc056265660 = false | |
178 | + | if (($size56265660 == 0)) | |
179 | + | then $acc056265660 | |
180 | + | else { | |
181 | + | let $acc156265660 = check($acc056265660, $list56265660[0]) | |
182 | + | if (($size56265660 == 1)) | |
183 | + | then $acc156265660 | |
184 | + | else { | |
185 | + | let $acc256265660 = check($acc156265660, $list56265660[1]) | |
186 | + | if (($size56265660 == 2)) | |
187 | + | then $acc256265660 | |
188 | + | else { | |
189 | + | let $acc356265660 = check($acc256265660, $list56265660[2]) | |
190 | + | if (($size56265660 == 3)) | |
191 | + | then $acc356265660 | |
192 | + | else { | |
193 | + | let $acc456265660 = check($acc356265660, $list56265660[3]) | |
194 | + | if (($size56265660 == 4)) | |
195 | + | then $acc456265660 | |
196 | + | else { | |
197 | + | let $acc556265660 = check($acc456265660, $list56265660[4]) | |
198 | + | if (($size56265660 == 5)) | |
199 | + | then $acc556265660 | |
200 | + | else { | |
201 | + | let $acc656265660 = check($acc556265660, $list56265660[5]) | |
202 | + | throw("List size exceed 5") | |
203 | + | } | |
204 | + | } | |
205 | + | } | |
206 | + | } | |
207 | + | } | |
208 | + | } | |
209 | + | } | |
210 | + | ||
211 | + | ||
212 | + | func formatGameData (gameState,playerChoice,playerPubKey58,startedHeight,winAmount,assetId,randOrEmpty) = (((((((((((gameState + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(startedHeight)) + "_") + toString(winAmount)) + "_") + toString(assetId)) + (if ((randOrEmpty == "")) | |
213 | + | then "" | |
214 | + | else ("_" + randOrEmpty))) | |
215 | + | ||
216 | + | ||
217 | + | func extractGameData (gameId) = split(match getString(this, gameId) { | |
218 | + | case str: String => | |
219 | + | str | |
220 | + | case _ => | |
221 | + | throw((("Game: " + gameId) + " not found.")) | |
222 | + | }, "_") | |
223 | + | ||
224 | + | ||
225 | + | func winScriptSet (gameId,playerAddress,winAmount,assetId,newgameData,winByTimeout,decreasedReserves) = { | |
226 | + | let wSetCommonData = [decreasedReserves] | |
227 | + | let tSetCommonData = [ScriptTransfer(playerAddress, winAmount, ASSETS[assetId])] | |
228 | + | if (winByTimeout) | |
229 | + | then { | |
230 | + | let newgameDataAdjusted = (newgameData + "_TIMEOUT") | |
231 | + | let gameData = DataEntry(gameId, newgameDataAdjusted) | |
232 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
233 | + | } | |
234 | + | else { | |
235 | + | let gameData = DataEntry(gameId, newgameData) | |
236 | + | ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData)) | |
237 | + | } | |
238 | + | } | |
239 | + | ||
240 | + | ||
241 | + | @Callable(i) | |
242 | + | func bet (playerChoice) = { | |
243 | + | let gameId = toBase58String(i.transactionId) | |
244 | + | if ((i.payment == unit)) | |
245 | + | then throw("No payment") | |
246 | + | else if (isDefined(getString(this, gameId))) | |
247 | + | then throw((("Bet for: " + gameId) + " was already made.")) | |
248 | + | else if (if ((i.feeAssetId != ASSETS[0])) | |
249 | + | then (i.feeAssetId != ASSETS[1]) | |
250 | + | else false) | |
251 | + | then throw("Invalid fee asset") | |
252 | + | else { | |
253 | + | let p = extract(i.payment) | |
254 | + | if ((i.feeAssetId != p.assetId)) | |
255 | + | then throw("Fee assetId and payment assetId should match") | |
256 | + | else { | |
257 | + | let assetId = validateAndGetAssetId(p.assetId) | |
258 | + | let commission = i.fee | |
259 | + | let winAmount = validateBetAndGetWinAmount((p.amount - i.fee), assetId, playerChoice) | |
260 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
261 | + | let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, assetId, "") | |
262 | + | ScriptResult(WriteSet([DataEntry(RESERVATIONKEY[assetId], increaseReserveAmount(winAmount, assetId)), incrementInt(GAMESCOUNTERKEY), DataEntry(gameId, gameData)]), TransferSet([ScriptTransfer(SERVER, commission, p.assetId)])) | |
263 | + | } | |
264 | + | } | |
265 | + | } | |
266 | + | ||
267 | + | ||
268 | + | ||
269 | + | @Callable(i) | |
270 | + | func withdraw (gameId,rsaSign) = { | |
271 | + | let gameData = extractGameData(gameId) | |
272 | + | let gameState = gameData[IdxGameState] | |
273 | + | let playerChoice = gameData[IdxPlayerChoice] | |
274 | + | let startedHeight = parseIntValue(gameData[IdxStartedHeight]) | |
275 | + | let winAmount = parseIntValue(gameData[IdxWinAmount]) | |
276 | + | let assetId = parseIntValue(gameData[IdxAssetId]) | |
277 | + | let playerPubKey58 = gameData[IdxPlayerPubKey58] | |
278 | + | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
279 | + | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
280 | + | let decreasedReserves = decreaseReservedAmount(gameId, assetId, winAmount) | |
281 | + | if ((gameState != STATESUBMITTED)) | |
282 | + | then throw("Invalid game state for passed gameId") | |
283 | + | else if (winByTimeout) | |
284 | + | then { | |
285 | + | let randChoise = take(playerChoice, 1) | |
286 | + | let newgameData = formatGameData(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randChoise) | |
287 | + | winScriptSet(gameId, playerAddress, winAmount, assetId, newgameData, winByTimeout, decreasedReserves) | |
288 | + | } | |
289 | + | else { | |
290 | + | let randChoise = generateRandChoise(gameId, rsaSign) | |
291 | + | if ((i.caller != SERVER)) | |
292 | + | then throw("Regular withdraw can be done by server only") | |
293 | + | else if (isPlayerWin(playerChoice, randChoise)) | |
294 | + | then { | |
295 | + | let newgameData = formatGameData(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randChoise) | |
296 | + | winScriptSet(gameId, playerAddress, winAmount, assetId, newgameData, winByTimeout, decreasedReserves) | |
297 | + | } | |
298 | + | else { | |
299 | + | let newgameData = formatGameData(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randChoise) | |
300 | + | WriteSet([DataEntry(gameId, newgameData), decreasedReserves]) | |
301 | + | } | |
302 | + | } | |
303 | + | } | |
304 | + | ||
305 | + | ||
306 | + | @Verifier(tx) | |
307 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
308 | + | then match tx { | |
309 | + | case ttx: TransferTransaction => | |
310 | + | let assetId = validateAndGetAssetId(ttx.assetId) | |
311 | + | ((assetBalance(this, ttx.assetId) - ttx.amount) >= getIntOr(RESERVATIONKEY[assetId], 0)) | |
312 | + | case stx: SetScriptTransaction => | |
313 | + | if ((getIntOr(RESERVATIONKEY[0], 0) == 0)) | |
314 | + | then (getIntOr(RESERVATIONKEY[1], 0) == 0) | |
315 | + | else false | |
316 | + | case _ => | |
317 | + | false | |
318 | + | } | |
319 | + | else false | |
320 | + |
github/deemru/w8io/026f985 25.00 ms ◑