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