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