tx · DJJFE6k83nSDLzHbsbHfStV2aCsxg92EUc3aAjKENj7u 3MvCLdwRiQSNrhgumfFunsbyUJUw6ViTMwB: -0.05000000 Waves 2021.08.21 17:16 [1668199] smart account 3MvCLdwRiQSNrhgumfFunsbyUJUw6ViTMwB > SELF 0.00000000 Waves
{ "type": 13, "id": "DJJFE6k83nSDLzHbsbHfStV2aCsxg92EUc3aAjKENj7u", "fee": 5000000, "feeAssetId": null, "timestamp": 1629555418390, "version": 2, "chainId": 84, "sender": "3MvCLdwRiQSNrhgumfFunsbyUJUw6ViTMwB", "senderPublicKey": "9Vbnf3b9hhuCerzPXf38mLo8mUGTPNVW3jtQRbymjaSw", "proofs": [ "XGDsBPGJ9WwQ97Z37AzupwGk43m9fCZcV6M9Qy2zKZa9UC1nreAho5Qzweah9J6uQVKA1ZrWotVkp8F97Svjjop" ], "script": "base64:AAIFAAAAAAAAADoIAhIGCgQBAQEBEgMKAQESAwoBARIDCgEBEgMKAQESAwoBARIECgIBCBIFCgMBCAgSAwoBARIDCgEBAAAALAAAAAAQaW5jdWJhdG9yQWRkcmVzcwEAAAAaAVQu1YzRxAHn1ekAzs1AJJ6xFAc06V7PK6oAAAAADmJyZWVkZXJBZGRyZXNzAQAAABoBVC7VjNHEAefV6QDOzUAknrEUBzTpXs8rqgAAAAAOZmFybWluZ0FkZHJlc3MBAAAAGgFU8jY5wCvKx9IdZ1jq9byeNi+peiAgajPTAAAAAAtlZ2dzQXNzZXRJZAEAAAAgJQJlzPcEaMi+AVmReOVYWjhmFBOtSkxKt/4FF0gXFoMAAAAACG1ha2VyRmVlAAAAAAAAAAABAAAAAAh0YWtlckZlZQAAAAAAAAAAAQAAAAAFU0xPVFMAAAAAAAAAAAoAAAAAB1dBSVRJTkcAAAAAAAAAAAUAAAAADHN0ZXBEdXJhdGlvbgAAAAAAAAAAAwEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMF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AZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleaEQ3do=", "height": 1668199, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: H8fveYRAvpgVBoWD9KnHuWeMZiDoQfVWno5VgwDQNYsi Next: Ae39177fymDncqfQLMk3ihgcN2fJaKWWCXHhfkfuM9v8 Diff:
Old | New | Differences | |
---|---|---|---|
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getNextGameId () = { | |
47 | - | let nextId = tryGetInteger(" | |
47 | + | let nextId = tryGetInteger("nextGameId") | |
48 | 48 | if ((nextId == 0)) | |
49 | 49 | then 1 | |
50 | 50 | else nextId | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | - | func | |
54 | + | func getPlayerCurrentGameKey (address) = ("currentGame_" + address) | |
55 | 55 | ||
56 | 56 | ||
57 | - | func | |
57 | + | func getPlayerCurrentGame (address) = tryGetInteger(getPlayerCurrentGameKey(address)) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getSlotKey (slot) = ("slot_" + toString(slot)) | |
63 | 63 | func getSlot (slot) = tryGetInteger(getSlotKey(slot)) | |
64 | 64 | ||
65 | 65 | ||
66 | - | func | |
66 | + | func getMakerKey (gameId) = (("game_" + toString(gameId)) + "_maker") | |
67 | 67 | ||
68 | 68 | ||
69 | - | func | |
69 | + | func getMaker (gameId) = tryGetString(getMakerKey(gameId)) | |
70 | 70 | ||
71 | 71 | ||
72 | - | func | |
72 | + | func getTakerKey (gameId) = (("game_" + toString(gameId)) + "_taker") | |
73 | 73 | ||
74 | 74 | ||
75 | - | func | |
75 | + | func getTaker (gameId) = tryGetString(getTakerKey(gameId)) | |
76 | 76 | ||
77 | 77 | ||
78 | - | func getBetEggsKey (gameId) = (("game_" + toString(gameId)) + "_ | |
78 | + | func getBetEggsKey (gameId) = (("game_" + toString(gameId)) + "_betEggs") | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func getBetEggs (gameId) = tryGetInteger(getBetEggsKey(gameId)) | |
82 | 82 | ||
83 | 83 | ||
84 | - | func | |
84 | + | func getWaitingExpirationHeightKey (gameId) = (("game_" + toString(gameId)) + "_waitingExpirationHeight") | |
85 | 85 | ||
86 | 86 | ||
87 | - | func | |
87 | + | func getWaitingExpirationHeight (gameId) = tryGetInteger(getWaitingExpirationHeightKey(gameId)) | |
88 | 88 | ||
89 | 89 | ||
90 | - | func | |
90 | + | func getExpirationHeightKey (gameId) = (("game_" + toString(gameId)) + "_expirationHeight") | |
91 | 91 | ||
92 | 92 | ||
93 | - | func | |
93 | + | func getExpirationHeight (gameId) = tryGetInteger(getExpirationHeightKey(gameId)) | |
94 | 94 | ||
95 | 95 | ||
96 | - | func | |
96 | + | func getRarityRangeKey (gameId,rangePosition) = ((("game_" + toString(gameId)) + "_rarityRange_") + rangePosition) | |
97 | 97 | ||
98 | 98 | ||
99 | - | func | |
99 | + | func getRarityRange (gameId,rangePosition) = tryGetInteger(getRarityRangeKey(gameId, rangePosition)) | |
100 | 100 | ||
101 | 101 | ||
102 | - | func | |
102 | + | func getStepKey (gameId) = (("game_" + toString(gameId)) + "_step") | |
103 | 103 | ||
104 | 104 | ||
105 | - | func | |
105 | + | func getStep (gameId) = tryGetInteger(getStepKey(gameId)) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getRarityKey (gameId,player,rangePosition) = (((((("game_" + toString(gameId)) + "_") + player) + "_") + rangePosition) + "Rarity") | |
117 | 117 | func getCommit (gameId,player) = tryGetString(getCommitKey(gameId, player)) | |
118 | 118 | ||
119 | 119 | ||
120 | - | func getDuckOrderKey (gameId, | |
120 | + | func getDuckOrderKey (gameId,playerRole) = (((("game_" + toString(gameId)) + "_") + playerRole) + "_duckOrder") | |
121 | 121 | ||
122 | 122 | ||
123 | - | func getDuckOrder (gameId, | |
123 | + | func getDuckOrder (gameId,playerRole) = tryGetString(getDuckOrderKey(gameId, playerRole)) | |
124 | 124 | ||
125 | 125 | ||
126 | - | func getPrizeSentKey (gameId, | |
126 | + | func getPrizeSentKey (gameId,playerRole) = (((("game_" + toString(gameId)) + "_") + playerRole) + "_withdrawStatus") | |
127 | 127 | ||
128 | 128 | ||
129 | - | func getPrizeSent (gameId, | |
129 | + | func getPrizeSent (gameId,playerRole) = tryGetBoolean(getPrizeSentKey(gameId, playerRole)) | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func pickDuck (gameId,playerRole,playerAddress,assetId,rarity,rangePosition,step) = { | |
133 | - | let rarityRange = | |
133 | + | let rarityRange = getRarityRange(gameId, rangePosition) | |
134 | 134 | if (if (if (if ((rarityRange == 5)) | |
135 | 135 | then (40 > rarity) | |
136 | 136 | else false) | |
139 | 139 | then true | |
140 | 140 | else (((rarityRange - 1) * 10) > rarity)) | |
141 | 141 | then throw("This duck doesn't fit the rarity range") | |
142 | - | else [IntegerEntry(getRarityKey(gameId, playerRole, rangePosition), rarity), IntegerEntry( | |
142 | + | else [IntegerEntry(getRarityKey(gameId, playerRole, rangePosition), rarity), IntegerEntry(getStepKey(gameId), (step + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration)), ScriptTransfer(playerAddress, 1, assetId)] | |
143 | 143 | } | |
144 | 144 | ||
145 | 145 | ||
192 | 192 | ||
193 | 193 | ||
194 | 194 | func sendPrize (gameId,playerAddress,playerRole,winner) = { | |
195 | - | let makerAddress = | |
196 | - | let takerAddress = | |
195 | + | let makerAddress = getMaker(gameId) | |
196 | + | let takerAddress = getTaker(gameId) | |
197 | 197 | if (getPrizeSent(gameId, playerRole)) | |
198 | 198 | then throw("You have already got the prize") | |
199 | 199 | else if ((winner == playerRole)) | |
200 | - | then [IntegerEntry( | |
200 | + | then [IntegerEntry(getPlayerCurrentGameKey(makerAddress), 0), IntegerEntry(getPlayerCurrentGameKey(takerAddress), 0), BooleanEntry(getPrizeSentKey(gameId, playerRole), true), ScriptTransfer(playerAddress, (getBetEggs(gameId) * 2), eggsAssetId)] | |
201 | 201 | else if ((winner == "draw")) | |
202 | 202 | then if ((playerRole == "maker")) | |
203 | - | then [IntegerEntry( | |
204 | - | else [IntegerEntry( | |
203 | + | then [IntegerEntry(getPlayerCurrentGameKey(makerAddress), 0), BooleanEntry(getPrizeSentKey(gameId, playerRole), true), ScriptTransfer(playerAddress, getBetEggs(gameId), eggsAssetId)] | |
204 | + | else [IntegerEntry(getPlayerCurrentGameKey(takerAddress), 0), BooleanEntry(getPrizeSentKey(gameId, playerRole), true), ScriptTransfer(playerAddress, getBetEggs(gameId), eggsAssetId)] | |
205 | 205 | else throw("You lose and don't have any prize") | |
206 | 206 | } | |
207 | 207 | ||
217 | 217 | then throw(("You can attach only EGGs with the following asset id: " + toBase58String(eggsAssetId))) | |
218 | 218 | else if ((0 >= eggs)) | |
219 | 219 | then throw("Not enough EGGs") | |
220 | - | else if (( | |
220 | + | else if ((getPlayerCurrentGame(callerAddress) != 0)) | |
221 | 221 | then throw("You already have an active game") | |
222 | 222 | else if (if ((0 > slot)) | |
223 | 223 | then true | |
241 | 241 | then throw("The medium duck must be better than the worst one") | |
242 | 242 | else if ((rarityRangeMedium >= rarityRangeBest)) | |
243 | 243 | then throw("The best duck must be better than the medium one") | |
244 | - | else [IntegerEntry( | |
244 | + | else [IntegerEntry(getPlayerCurrentGameKey(callerAddress), gameId), StringEntry(getMakerKey(gameId), callerAddress), IntegerEntry(getBetEggsKey(gameId), eggs), IntegerEntry(getRarityRangeKey(gameId, "worst"), rarityRangeWorst), IntegerEntry(getRarityRangeKey(gameId, "medium"), rarityRangeMedium), IntegerEntry(getRarityRangeKey(gameId, "best"), rarityRangeBest), IntegerEntry(getWaitingExpirationHeightKey(gameId), (height + WAITING)), IntegerEntry(getSlotKey(slot), gameId), IntegerEntry("next_game_id", (gameId + 1))] | |
245 | 245 | } | |
246 | 246 | ||
247 | 247 | ||
257 | 257 | then throw(("You can attach only EGG tokens with the following asset id: " + toBase58String(eggsAssetId))) | |
258 | 258 | else if ((payment.amount != (getBetEggs(gameId) + takerFee))) | |
259 | 259 | then throw("Insufficient eggs amount") | |
260 | - | else if (( | |
260 | + | else if ((getTaker(gameId) != "")) | |
261 | 261 | then throw("This game is already taken") | |
262 | - | else if ((height >= | |
262 | + | else if ((height >= getWaitingExpirationHeight(gameId))) | |
263 | 263 | then throw("This game is expired") | |
264 | - | else [IntegerEntry( | |
264 | + | else [IntegerEntry(getPlayerCurrentGameKey(callerAddress), gameId), StringEntry(getTakerKey(gameId), callerAddress), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration)), IntegerEntry(getSlotKey(slot), 0)] | |
265 | 265 | } | |
266 | 266 | ||
267 | 267 | ||
275 | 275 | then throw("Invalid slot") | |
276 | 276 | else if ((gameId == 0)) | |
277 | 277 | then throw("Slot is empty") | |
278 | - | else if (( | |
278 | + | else if ((getWaitingExpirationHeight(gameId) > height)) | |
279 | 279 | then throw("Waiting is not finished yet") | |
280 | - | else if (( | |
280 | + | else if ((getTaker(gameId) != "")) | |
281 | 281 | then throw("This game is started") | |
282 | 282 | else { | |
283 | - | let maker = | |
284 | - | [IntegerEntry( | |
283 | + | let maker = getMaker(gameId) | |
284 | + | [IntegerEntry(getPlayerCurrentGameKey(maker), 0), IntegerEntry(getSlotKey(slot), 0), ScriptTransfer(Address(fromBase58String(maker)), (getBetEggs(gameId) + makerFee), eggsAssetId)] | |
285 | 285 | } | |
286 | 286 | } | |
287 | 287 | ||
291 | 291 | func pickWorstDuck (gameId) = { | |
292 | 292 | let callerAddress = toBase58String(i.caller.bytes) | |
293 | 293 | let assetId = value(value(i.payments[0]).assetId) | |
294 | - | let gameStep = | |
294 | + | let gameStep = getStep(gameId) | |
295 | 295 | if (if ((value(assetInfo(assetId)).issuer != Address(breederAddress))) | |
296 | 296 | then (value(assetInfo(assetId)).issuer != Address(incubatorAddress)) | |
297 | 297 | else false) | |
298 | 298 | then throw("Invalid NFT") | |
299 | 299 | else if ((gameStep == 0)) | |
300 | - | then if ((callerAddress != | |
300 | + | then if ((callerAddress != getTaker(gameId))) | |
301 | 301 | then throw("It is the taker's turn to pick now") | |
302 | 302 | else { | |
303 | 303 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
314 | 314 | else throw("Strict value is not equal to itself.") | |
315 | 315 | } | |
316 | 316 | else if ((gameStep == 1)) | |
317 | - | then if ((callerAddress != | |
317 | + | then if ((callerAddress != getMaker(gameId))) | |
318 | 318 | then throw("It is the maker's turn to pick now") | |
319 | 319 | else { | |
320 | 320 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
339 | 339 | func pickMediumtDuck (gameId) = { | |
340 | 340 | let callerAddress = toBase58String(i.caller.bytes) | |
341 | 341 | let assetId = value(value(i.payments[0]).assetId) | |
342 | - | let gameStep = | |
342 | + | let gameStep = getStep(gameId) | |
343 | 343 | if (if ((value(assetInfo(assetId)).issuer != Address(breederAddress))) | |
344 | 344 | then (value(assetInfo(assetId)).issuer != Address(incubatorAddress)) | |
345 | 345 | else false) | |
347 | 347 | else if ((2 > gameStep)) | |
348 | 348 | then throw("The medium duck must be picked after the worst one") | |
349 | 349 | else if ((gameStep == 2)) | |
350 | - | then if ((callerAddress != | |
350 | + | then if ((callerAddress != getMaker(gameId))) | |
351 | 351 | then throw("It is the maker's turn to pick now") | |
352 | 352 | else { | |
353 | 353 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
364 | 364 | else throw("Strict value is not equal to itself.") | |
365 | 365 | } | |
366 | 366 | else if ((gameStep == 3)) | |
367 | - | then if ((callerAddress != | |
367 | + | then if ((callerAddress != getTaker(gameId))) | |
368 | 368 | then throw("It is the taker's turn to pick now") | |
369 | 369 | else { | |
370 | 370 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
389 | 389 | func pickBestDuck (gameId) = { | |
390 | 390 | let callerAddress = toBase58String(i.caller.bytes) | |
391 | 391 | let assetId = value(value(i.payments[0]).assetId) | |
392 | - | let gameStep = | |
392 | + | let gameStep = getStep(gameId) | |
393 | 393 | if (if ((value(assetInfo(assetId)).issuer != Address(breederAddress))) | |
394 | 394 | then (value(assetInfo(assetId)).issuer != Address(incubatorAddress)) | |
395 | 395 | else false) | |
397 | 397 | else if ((4 > gameStep)) | |
398 | 398 | then throw("The best duck must be picked after the worst and the medium ones") | |
399 | 399 | else if ((gameStep == 4)) | |
400 | - | then if ((callerAddress != | |
400 | + | then if ((callerAddress != getTaker(gameId))) | |
401 | 401 | then throw("It is the taker's turn to pick now") | |
402 | 402 | else { | |
403 | 403 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
414 | 414 | else throw("Strict value is not equal to itself.") | |
415 | 415 | } | |
416 | 416 | else if ((gameStep == 5)) | |
417 | - | then if ((callerAddress != | |
417 | + | then if ((callerAddress != getMaker(gameId))) | |
418 | 418 | then throw("It is the maker's turn to pick now") | |
419 | 419 | else { | |
420 | 420 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
438 | 438 | @Callable(i) | |
439 | 439 | func commit (gameId,hash) = { | |
440 | 440 | let callerAddress = toBase58String(i.caller.bytes) | |
441 | - | let gameStep = | |
441 | + | let gameStep = getStep(gameId) | |
442 | 442 | if ((6 > gameStep)) | |
443 | 443 | then throw("Ducks hasn't been picked yet") | |
444 | 444 | else if ((gameStep == 6)) | |
445 | - | then if ((callerAddress != | |
445 | + | then if ((callerAddress != getMaker(gameId))) | |
446 | 446 | then throw("It is the maker's turn to commit now") | |
447 | - | else [StringEntry(getCommitKey(gameId, "maker"), hash), IntegerEntry( | |
447 | + | else [StringEntry(getCommitKey(gameId, "maker"), hash), IntegerEntry(getStepKey(gameId), (gameStep + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration))] | |
448 | 448 | else if ((gameStep == 7)) | |
449 | - | then if ((callerAddress != | |
449 | + | then if ((callerAddress != getTaker(gameId))) | |
450 | 450 | then throw("It is the taker's turn to commit now") | |
451 | - | else [StringEntry(getCommitKey(gameId, "taker"), hash), IntegerEntry( | |
451 | + | else [StringEntry(getCommitKey(gameId, "taker"), hash), IntegerEntry(getStepKey(gameId), (gameStep + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration))] | |
452 | 452 | else throw("Commit is finished") | |
453 | 453 | } | |
454 | 454 | ||
457 | 457 | @Callable(i) | |
458 | 458 | func reveal (gameId,duckOrder,salt) = { | |
459 | 459 | let callerAddress = toBase58String(i.caller.bytes) | |
460 | - | let gameStep = | |
460 | + | let gameStep = getStep(gameId) | |
461 | 461 | if ((8 > gameStep)) | |
462 | 462 | then throw("Reveal is not started") | |
463 | 463 | else if (if (if (if (if (if ((duckOrder != "worst,medium,best")) | |
473 | 473 | else (duckOrder != "best,medium,worst")) | |
474 | 474 | then throw("Invalid duckOrder") | |
475 | 475 | else if ((gameStep == 8)) | |
476 | - | then if ((callerAddress != | |
476 | + | then if ((callerAddress != getMaker(gameId))) | |
477 | 477 | then throw("It is the maker's turn to reveal now") | |
478 | 478 | else if ((toBase58String(sha256(toBytes((duckOrder + salt)))) != getCommit(gameId, "maker"))) | |
479 | 479 | then throw("reveal data is not valid") | |
480 | - | else [StringEntry(getDuckOrderKey(gameId, "maker"), duckOrder), IntegerEntry( | |
480 | + | else [StringEntry(getDuckOrderKey(gameId, "maker"), duckOrder), IntegerEntry(getStepKey(gameId), (gameStep + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration))] | |
481 | 481 | else if ((gameStep == 9)) | |
482 | - | then if ((callerAddress != | |
482 | + | then if ((callerAddress != getTaker(gameId))) | |
483 | 483 | then throw("It is the taker's turn to reveal now") | |
484 | 484 | else if ((toBase58String(sha256(toBytes((duckOrder + salt)))) != getCommit(gameId, "taker"))) | |
485 | 485 | then throw("reveal data is not valid") | |
486 | - | else [StringEntry(getDuckOrderKey(gameId, "taker"), duckOrder), IntegerEntry( | |
486 | + | else [StringEntry(getDuckOrderKey(gameId, "taker"), duckOrder), IntegerEntry(getStepKey(gameId), (gameStep + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration))] | |
487 | 487 | else throw("Reveal is finished") | |
488 | 488 | } | |
489 | 489 | ||
492 | 492 | @Callable(i) | |
493 | 493 | func getPrize (gameId) = { | |
494 | 494 | let callerAddress = toBase58String(i.caller.bytes) | |
495 | - | let gameStep = | |
495 | + | let gameStep = getStep(gameId) | |
496 | 496 | if ((gameStep != 10)) | |
497 | 497 | then throw("Game is not finished") | |
498 | - | else if ((callerAddress == | |
498 | + | else if ((callerAddress == getMaker(gameId))) | |
499 | 499 | then sendPrize(gameId, i.caller, "maker", getWinner(gameId)) | |
500 | - | else if ((callerAddress == | |
500 | + | else if ((callerAddress == getTaker(gameId))) | |
501 | 501 | then sendPrize(gameId, i.caller, "taker", getWinner(gameId)) | |
502 | 502 | else throw("Invalid caller address") | |
503 | 503 | } | |
507 | 507 | @Callable(i) | |
508 | 508 | func getPrizeExpired (gameId) = { | |
509 | 509 | let callerAddress = toBase58String(i.caller.bytes) | |
510 | - | let gameStep = | |
510 | + | let gameStep = getStep(gameId) | |
511 | 511 | if ((gameStep == 10)) | |
512 | 512 | then throw("Game is finished, call getPrize instead") | |
513 | - | else if (( | |
513 | + | else if ((getExpirationHeight(gameId) > height)) | |
514 | 514 | then throw("Game is not expired") | |
515 | - | else if ((callerAddress == | |
515 | + | else if ((callerAddress == getMaker(gameId))) | |
516 | 516 | then sendPrize(gameId, i.caller, "maker", getWinnerExpired(gameStep)) | |
517 | - | else if ((callerAddress == | |
517 | + | else if ((callerAddress == getTaker(gameId))) | |
518 | 518 | then sendPrize(gameId, i.caller, "taker", getWinnerExpired(gameStep)) | |
519 | 519 | else throw("Invalid caller address") | |
520 | 520 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let incubatorAddress = base58'3MtBigTsaeevrcJAEwVcr4quwkqcrtnjoAh' | |
5 | 5 | ||
6 | 6 | let breederAddress = base58'3MtBigTsaeevrcJAEwVcr4quwkqcrtnjoAh' | |
7 | 7 | ||
8 | 8 | let farmingAddress = base58'3NBznG19rEYUAcnukTRTtwJHBVKQLbobVdC' | |
9 | 9 | ||
10 | 10 | let eggsAssetId = base58'3VUCuh9dWqe54SdzzNUkXhFXpc8UQynnJVh42B7MjNzN' | |
11 | 11 | ||
12 | 12 | let makerFee = 1 | |
13 | 13 | ||
14 | 14 | let takerFee = 1 | |
15 | 15 | ||
16 | 16 | let SLOTS = 10 | |
17 | 17 | ||
18 | 18 | let WAITING = 5 | |
19 | 19 | ||
20 | 20 | let stepDuration = 3 | |
21 | 21 | ||
22 | 22 | func tryGetInteger (key) = match getInteger(this, key) { | |
23 | 23 | case b: Int => | |
24 | 24 | b | |
25 | 25 | case _ => | |
26 | 26 | 0 | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func tryGetString (key) = match getString(this, key) { | |
31 | 31 | case a: String => | |
32 | 32 | a | |
33 | 33 | case _ => | |
34 | 34 | "" | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
39 | 39 | case b: Boolean => | |
40 | 40 | b | |
41 | 41 | case _ => | |
42 | 42 | false | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getNextGameId () = { | |
47 | - | let nextId = tryGetInteger(" | |
47 | + | let nextId = tryGetInteger("nextGameId") | |
48 | 48 | if ((nextId == 0)) | |
49 | 49 | then 1 | |
50 | 50 | else nextId | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | - | func | |
54 | + | func getPlayerCurrentGameKey (address) = ("currentGame_" + address) | |
55 | 55 | ||
56 | 56 | ||
57 | - | func | |
57 | + | func getPlayerCurrentGame (address) = tryGetInteger(getPlayerCurrentGameKey(address)) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getSlotKey (slot) = ("slot_" + toString(slot)) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func getSlot (slot) = tryGetInteger(getSlotKey(slot)) | |
64 | 64 | ||
65 | 65 | ||
66 | - | func | |
66 | + | func getMakerKey (gameId) = (("game_" + toString(gameId)) + "_maker") | |
67 | 67 | ||
68 | 68 | ||
69 | - | func | |
69 | + | func getMaker (gameId) = tryGetString(getMakerKey(gameId)) | |
70 | 70 | ||
71 | 71 | ||
72 | - | func | |
72 | + | func getTakerKey (gameId) = (("game_" + toString(gameId)) + "_taker") | |
73 | 73 | ||
74 | 74 | ||
75 | - | func | |
75 | + | func getTaker (gameId) = tryGetString(getTakerKey(gameId)) | |
76 | 76 | ||
77 | 77 | ||
78 | - | func getBetEggsKey (gameId) = (("game_" + toString(gameId)) + "_ | |
78 | + | func getBetEggsKey (gameId) = (("game_" + toString(gameId)) + "_betEggs") | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func getBetEggs (gameId) = tryGetInteger(getBetEggsKey(gameId)) | |
82 | 82 | ||
83 | 83 | ||
84 | - | func | |
84 | + | func getWaitingExpirationHeightKey (gameId) = (("game_" + toString(gameId)) + "_waitingExpirationHeight") | |
85 | 85 | ||
86 | 86 | ||
87 | - | func | |
87 | + | func getWaitingExpirationHeight (gameId) = tryGetInteger(getWaitingExpirationHeightKey(gameId)) | |
88 | 88 | ||
89 | 89 | ||
90 | - | func | |
90 | + | func getExpirationHeightKey (gameId) = (("game_" + toString(gameId)) + "_expirationHeight") | |
91 | 91 | ||
92 | 92 | ||
93 | - | func | |
93 | + | func getExpirationHeight (gameId) = tryGetInteger(getExpirationHeightKey(gameId)) | |
94 | 94 | ||
95 | 95 | ||
96 | - | func | |
96 | + | func getRarityRangeKey (gameId,rangePosition) = ((("game_" + toString(gameId)) + "_rarityRange_") + rangePosition) | |
97 | 97 | ||
98 | 98 | ||
99 | - | func | |
99 | + | func getRarityRange (gameId,rangePosition) = tryGetInteger(getRarityRangeKey(gameId, rangePosition)) | |
100 | 100 | ||
101 | 101 | ||
102 | - | func | |
102 | + | func getStepKey (gameId) = (("game_" + toString(gameId)) + "_step") | |
103 | 103 | ||
104 | 104 | ||
105 | - | func | |
105 | + | func getStep (gameId) = tryGetInteger(getStepKey(gameId)) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getRarityKey (gameId,player,rangePosition) = (((((("game_" + toString(gameId)) + "_") + player) + "_") + rangePosition) + "Rarity") | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func getRarity (gameId,player,rangePosition) = tryGetInteger(getRarityKey(gameId, player, rangePosition)) | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func getCommitKey (gameId,player) = (((("game_" + toString(gameId)) + "_") + player) + "_commit") | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func getCommit (gameId,player) = tryGetString(getCommitKey(gameId, player)) | |
118 | 118 | ||
119 | 119 | ||
120 | - | func getDuckOrderKey (gameId, | |
120 | + | func getDuckOrderKey (gameId,playerRole) = (((("game_" + toString(gameId)) + "_") + playerRole) + "_duckOrder") | |
121 | 121 | ||
122 | 122 | ||
123 | - | func getDuckOrder (gameId, | |
123 | + | func getDuckOrder (gameId,playerRole) = tryGetString(getDuckOrderKey(gameId, playerRole)) | |
124 | 124 | ||
125 | 125 | ||
126 | - | func getPrizeSentKey (gameId, | |
126 | + | func getPrizeSentKey (gameId,playerRole) = (((("game_" + toString(gameId)) + "_") + playerRole) + "_withdrawStatus") | |
127 | 127 | ||
128 | 128 | ||
129 | - | func getPrizeSent (gameId, | |
129 | + | func getPrizeSent (gameId,playerRole) = tryGetBoolean(getPrizeSentKey(gameId, playerRole)) | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func pickDuck (gameId,playerRole,playerAddress,assetId,rarity,rangePosition,step) = { | |
133 | - | let rarityRange = | |
133 | + | let rarityRange = getRarityRange(gameId, rangePosition) | |
134 | 134 | if (if (if (if ((rarityRange == 5)) | |
135 | 135 | then (40 > rarity) | |
136 | 136 | else false) | |
137 | 137 | then true | |
138 | 138 | else (rarity >= (rarityRange * 10))) | |
139 | 139 | then true | |
140 | 140 | else (((rarityRange - 1) * 10) > rarity)) | |
141 | 141 | then throw("This duck doesn't fit the rarity range") | |
142 | - | else [IntegerEntry(getRarityKey(gameId, playerRole, rangePosition), rarity), IntegerEntry( | |
142 | + | else [IntegerEntry(getRarityKey(gameId, playerRole, rangePosition), rarity), IntegerEntry(getStepKey(gameId), (step + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration)), ScriptTransfer(playerAddress, 1, assetId)] | |
143 | 143 | } | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func getScore (a,b) = if ((a > b)) | |
147 | 147 | then 1 | |
148 | 148 | else if ((b > a)) | |
149 | 149 | then -1 | |
150 | 150 | else 0 | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func getWinner (gameId) = { | |
154 | 154 | let makerDuckOrder = split(getDuckOrder(gameId, "maker"), ",") | |
155 | 155 | let takerDuckOrder = split(getDuckOrder(gameId, "taker"), ",") | |
156 | 156 | let makerRarity1 = getRarity(gameId, "maker", makerDuckOrder[0]) | |
157 | 157 | let makerRarity2 = getRarity(gameId, "maker", makerDuckOrder[1]) | |
158 | 158 | let makerRarity3 = getRarity(gameId, "maker", makerDuckOrder[2]) | |
159 | 159 | let takerRarity1 = getRarity(gameId, "taker", makerDuckOrder[0]) | |
160 | 160 | let takerRarity2 = getRarity(gameId, "taker", makerDuckOrder[1]) | |
161 | 161 | let takerRarity3 = getRarity(gameId, "taker", makerDuckOrder[2]) | |
162 | 162 | let makerScore = ((getScore(makerRarity1, takerRarity1) + getScore(makerRarity2, takerRarity2)) + getScore(makerRarity3, takerRarity3)) | |
163 | 163 | if ((makerScore > 0)) | |
164 | 164 | then "maker" | |
165 | 165 | else if ((0 > makerScore)) | |
166 | 166 | then "taker" | |
167 | 167 | else "draw" | |
168 | 168 | } | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func getWinnerExpired (gameStep) = if (if (if (if (if ((gameStep == 0)) | |
172 | 172 | then true | |
173 | 173 | else (gameStep == 3)) | |
174 | 174 | then true | |
175 | 175 | else (gameStep == 4)) | |
176 | 176 | then true | |
177 | 177 | else (gameStep == 7)) | |
178 | 178 | then true | |
179 | 179 | else (gameStep == 9)) | |
180 | 180 | then "maker" | |
181 | 181 | else if (if (if (if (if ((gameStep == 1)) | |
182 | 182 | then true | |
183 | 183 | else (gameStep == 2)) | |
184 | 184 | then true | |
185 | 185 | else (gameStep == 5)) | |
186 | 186 | then true | |
187 | 187 | else (gameStep == 6)) | |
188 | 188 | then true | |
189 | 189 | else (gameStep == 8)) | |
190 | 190 | then "taker" | |
191 | 191 | else "draw" | |
192 | 192 | ||
193 | 193 | ||
194 | 194 | func sendPrize (gameId,playerAddress,playerRole,winner) = { | |
195 | - | let makerAddress = | |
196 | - | let takerAddress = | |
195 | + | let makerAddress = getMaker(gameId) | |
196 | + | let takerAddress = getTaker(gameId) | |
197 | 197 | if (getPrizeSent(gameId, playerRole)) | |
198 | 198 | then throw("You have already got the prize") | |
199 | 199 | else if ((winner == playerRole)) | |
200 | - | then [IntegerEntry( | |
200 | + | then [IntegerEntry(getPlayerCurrentGameKey(makerAddress), 0), IntegerEntry(getPlayerCurrentGameKey(takerAddress), 0), BooleanEntry(getPrizeSentKey(gameId, playerRole), true), ScriptTransfer(playerAddress, (getBetEggs(gameId) * 2), eggsAssetId)] | |
201 | 201 | else if ((winner == "draw")) | |
202 | 202 | then if ((playerRole == "maker")) | |
203 | - | then [IntegerEntry( | |
204 | - | else [IntegerEntry( | |
203 | + | then [IntegerEntry(getPlayerCurrentGameKey(makerAddress), 0), BooleanEntry(getPrizeSentKey(gameId, playerRole), true), ScriptTransfer(playerAddress, getBetEggs(gameId), eggsAssetId)] | |
204 | + | else [IntegerEntry(getPlayerCurrentGameKey(takerAddress), 0), BooleanEntry(getPrizeSentKey(gameId, playerRole), true), ScriptTransfer(playerAddress, getBetEggs(gameId), eggsAssetId)] | |
205 | 205 | else throw("You lose and don't have any prize") | |
206 | 206 | } | |
207 | 207 | ||
208 | 208 | ||
209 | 209 | @Callable(i) | |
210 | 210 | func makeGame (slot,rarityRangeWorst,rarityRangeMedium,rarityRangeBest) = { | |
211 | 211 | let callerAddress = toBase58String(i.caller.bytes) | |
212 | 212 | let slotGameId = getSlot(slot) | |
213 | 213 | let payment = value(i.payments[0]) | |
214 | 214 | let eggs = (payment.amount - makerFee) | |
215 | 215 | let gameId = getNextGameId() | |
216 | 216 | if ((payment.assetId != eggsAssetId)) | |
217 | 217 | then throw(("You can attach only EGGs with the following asset id: " + toBase58String(eggsAssetId))) | |
218 | 218 | else if ((0 >= eggs)) | |
219 | 219 | then throw("Not enough EGGs") | |
220 | - | else if (( | |
220 | + | else if ((getPlayerCurrentGame(callerAddress) != 0)) | |
221 | 221 | then throw("You already have an active game") | |
222 | 222 | else if (if ((0 > slot)) | |
223 | 223 | then true | |
224 | 224 | else (slot >= SLOTS)) | |
225 | 225 | then throw("Invalid slot") | |
226 | 226 | else if ((slotGameId != 0)) | |
227 | 227 | then throw("This slot is busy") | |
228 | 228 | else if (if ((1 > rarityRangeWorst)) | |
229 | 229 | then true | |
230 | 230 | else (rarityRangeWorst > 5)) | |
231 | 231 | then throw("Invalid rarity range for the worst duck") | |
232 | 232 | else if (if ((1 > rarityRangeMedium)) | |
233 | 233 | then true | |
234 | 234 | else (rarityRangeMedium > 5)) | |
235 | 235 | then throw("Invalid rarity range for the medium duck") | |
236 | 236 | else if (if ((1 > rarityRangeBest)) | |
237 | 237 | then true | |
238 | 238 | else (rarityRangeBest > 5)) | |
239 | 239 | then throw("Invalid rarity range for the best duck") | |
240 | 240 | else if ((rarityRangeWorst >= rarityRangeMedium)) | |
241 | 241 | then throw("The medium duck must be better than the worst one") | |
242 | 242 | else if ((rarityRangeMedium >= rarityRangeBest)) | |
243 | 243 | then throw("The best duck must be better than the medium one") | |
244 | - | else [IntegerEntry( | |
244 | + | else [IntegerEntry(getPlayerCurrentGameKey(callerAddress), gameId), StringEntry(getMakerKey(gameId), callerAddress), IntegerEntry(getBetEggsKey(gameId), eggs), IntegerEntry(getRarityRangeKey(gameId, "worst"), rarityRangeWorst), IntegerEntry(getRarityRangeKey(gameId, "medium"), rarityRangeMedium), IntegerEntry(getRarityRangeKey(gameId, "best"), rarityRangeBest), IntegerEntry(getWaitingExpirationHeightKey(gameId), (height + WAITING)), IntegerEntry(getSlotKey(slot), gameId), IntegerEntry("next_game_id", (gameId + 1))] | |
245 | 245 | } | |
246 | 246 | ||
247 | 247 | ||
248 | 248 | ||
249 | 249 | @Callable(i) | |
250 | 250 | func takeGame (slot) = { | |
251 | 251 | let callerAddress = toBase58String(i.caller.bytes) | |
252 | 252 | let gameId = getSlot(slot) | |
253 | 253 | let payment = value(i.payments[0]) | |
254 | 254 | if ((getSlot(slot) == 0)) | |
255 | 255 | then throw("This slot is empty") | |
256 | 256 | else if ((payment.assetId != eggsAssetId)) | |
257 | 257 | then throw(("You can attach only EGG tokens with the following asset id: " + toBase58String(eggsAssetId))) | |
258 | 258 | else if ((payment.amount != (getBetEggs(gameId) + takerFee))) | |
259 | 259 | then throw("Insufficient eggs amount") | |
260 | - | else if (( | |
260 | + | else if ((getTaker(gameId) != "")) | |
261 | 261 | then throw("This game is already taken") | |
262 | - | else if ((height >= | |
262 | + | else if ((height >= getWaitingExpirationHeight(gameId))) | |
263 | 263 | then throw("This game is expired") | |
264 | - | else [IntegerEntry( | |
264 | + | else [IntegerEntry(getPlayerCurrentGameKey(callerAddress), gameId), StringEntry(getTakerKey(gameId), callerAddress), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration)), IntegerEntry(getSlotKey(slot), 0)] | |
265 | 265 | } | |
266 | 266 | ||
267 | 267 | ||
268 | 268 | ||
269 | 269 | @Callable(i) | |
270 | 270 | func kickGame (slot) = { | |
271 | 271 | let gameId = getSlot(slot) | |
272 | 272 | if (if ((0 > slot)) | |
273 | 273 | then true | |
274 | 274 | else (slot >= SLOTS)) | |
275 | 275 | then throw("Invalid slot") | |
276 | 276 | else if ((gameId == 0)) | |
277 | 277 | then throw("Slot is empty") | |
278 | - | else if (( | |
278 | + | else if ((getWaitingExpirationHeight(gameId) > height)) | |
279 | 279 | then throw("Waiting is not finished yet") | |
280 | - | else if (( | |
280 | + | else if ((getTaker(gameId) != "")) | |
281 | 281 | then throw("This game is started") | |
282 | 282 | else { | |
283 | - | let maker = | |
284 | - | [IntegerEntry( | |
283 | + | let maker = getMaker(gameId) | |
284 | + | [IntegerEntry(getPlayerCurrentGameKey(maker), 0), IntegerEntry(getSlotKey(slot), 0), ScriptTransfer(Address(fromBase58String(maker)), (getBetEggs(gameId) + makerFee), eggsAssetId)] | |
285 | 285 | } | |
286 | 286 | } | |
287 | 287 | ||
288 | 288 | ||
289 | 289 | ||
290 | 290 | @Callable(i) | |
291 | 291 | func pickWorstDuck (gameId) = { | |
292 | 292 | let callerAddress = toBase58String(i.caller.bytes) | |
293 | 293 | let assetId = value(value(i.payments[0]).assetId) | |
294 | - | let gameStep = | |
294 | + | let gameStep = getStep(gameId) | |
295 | 295 | if (if ((value(assetInfo(assetId)).issuer != Address(breederAddress))) | |
296 | 296 | then (value(assetInfo(assetId)).issuer != Address(incubatorAddress)) | |
297 | 297 | else false) | |
298 | 298 | then throw("Invalid NFT") | |
299 | 299 | else if ((gameStep == 0)) | |
300 | - | then if ((callerAddress != | |
300 | + | then if ((callerAddress != getTaker(gameId))) | |
301 | 301 | then throw("It is the taker's turn to pick now") | |
302 | 302 | else { | |
303 | 303 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
304 | 304 | if ((invokeRes == invokeRes)) | |
305 | 305 | then { | |
306 | 306 | let rarity = match invokeRes { | |
307 | 307 | case r: Int => | |
308 | 308 | r | |
309 | 309 | case _ => | |
310 | 310 | throw("Incorrect invoke result") | |
311 | 311 | } | |
312 | 312 | pickDuck(gameId, "taker", i.caller, assetId, rarity, "worst", 0) | |
313 | 313 | } | |
314 | 314 | else throw("Strict value is not equal to itself.") | |
315 | 315 | } | |
316 | 316 | else if ((gameStep == 1)) | |
317 | - | then if ((callerAddress != | |
317 | + | then if ((callerAddress != getMaker(gameId))) | |
318 | 318 | then throw("It is the maker's turn to pick now") | |
319 | 319 | else { | |
320 | 320 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
321 | 321 | if ((invokeRes == invokeRes)) | |
322 | 322 | then { | |
323 | 323 | let rarity = match invokeRes { | |
324 | 324 | case r: Int => | |
325 | 325 | r | |
326 | 326 | case _ => | |
327 | 327 | throw("Incorrect invoke result") | |
328 | 328 | } | |
329 | 329 | pickDuck(gameId, "maker", i.caller, assetId, rarity, "worst", 1) | |
330 | 330 | } | |
331 | 331 | else throw("Strict value is not equal to itself.") | |
332 | 332 | } | |
333 | 333 | else throw("The worst duck has already been picked") | |
334 | 334 | } | |
335 | 335 | ||
336 | 336 | ||
337 | 337 | ||
338 | 338 | @Callable(i) | |
339 | 339 | func pickMediumtDuck (gameId) = { | |
340 | 340 | let callerAddress = toBase58String(i.caller.bytes) | |
341 | 341 | let assetId = value(value(i.payments[0]).assetId) | |
342 | - | let gameStep = | |
342 | + | let gameStep = getStep(gameId) | |
343 | 343 | if (if ((value(assetInfo(assetId)).issuer != Address(breederAddress))) | |
344 | 344 | then (value(assetInfo(assetId)).issuer != Address(incubatorAddress)) | |
345 | 345 | else false) | |
346 | 346 | then throw("Invalid NFT") | |
347 | 347 | else if ((2 > gameStep)) | |
348 | 348 | then throw("The medium duck must be picked after the worst one") | |
349 | 349 | else if ((gameStep == 2)) | |
350 | - | then if ((callerAddress != | |
350 | + | then if ((callerAddress != getMaker(gameId))) | |
351 | 351 | then throw("It is the maker's turn to pick now") | |
352 | 352 | else { | |
353 | 353 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
354 | 354 | if ((invokeRes == invokeRes)) | |
355 | 355 | then { | |
356 | 356 | let rarity = match invokeRes { | |
357 | 357 | case r: Int => | |
358 | 358 | r | |
359 | 359 | case _ => | |
360 | 360 | throw("Incorrect invoke result") | |
361 | 361 | } | |
362 | 362 | pickDuck(gameId, "maker", i.caller, assetId, rarity, "medium", 2) | |
363 | 363 | } | |
364 | 364 | else throw("Strict value is not equal to itself.") | |
365 | 365 | } | |
366 | 366 | else if ((gameStep == 3)) | |
367 | - | then if ((callerAddress != | |
367 | + | then if ((callerAddress != getTaker(gameId))) | |
368 | 368 | then throw("It is the taker's turn to pick now") | |
369 | 369 | else { | |
370 | 370 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
371 | 371 | if ((invokeRes == invokeRes)) | |
372 | 372 | then { | |
373 | 373 | let rarity = match invokeRes { | |
374 | 374 | case r: Int => | |
375 | 375 | r | |
376 | 376 | case _ => | |
377 | 377 | throw("Incorrect invoke result") | |
378 | 378 | } | |
379 | 379 | pickDuck(gameId, "taker", i.caller, assetId, rarity, "medium", 3) | |
380 | 380 | } | |
381 | 381 | else throw("Strict value is not equal to itself.") | |
382 | 382 | } | |
383 | 383 | else throw("The medium duck has already been picked") | |
384 | 384 | } | |
385 | 385 | ||
386 | 386 | ||
387 | 387 | ||
388 | 388 | @Callable(i) | |
389 | 389 | func pickBestDuck (gameId) = { | |
390 | 390 | let callerAddress = toBase58String(i.caller.bytes) | |
391 | 391 | let assetId = value(value(i.payments[0]).assetId) | |
392 | - | let gameStep = | |
392 | + | let gameStep = getStep(gameId) | |
393 | 393 | if (if ((value(assetInfo(assetId)).issuer != Address(breederAddress))) | |
394 | 394 | then (value(assetInfo(assetId)).issuer != Address(incubatorAddress)) | |
395 | 395 | else false) | |
396 | 396 | then throw("Invalid NFT") | |
397 | 397 | else if ((4 > gameStep)) | |
398 | 398 | then throw("The best duck must be picked after the worst and the medium ones") | |
399 | 399 | else if ((gameStep == 4)) | |
400 | - | then if ((callerAddress != | |
400 | + | then if ((callerAddress != getTaker(gameId))) | |
401 | 401 | then throw("It is the taker's turn to pick now") | |
402 | 402 | else { | |
403 | 403 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
404 | 404 | if ((invokeRes == invokeRes)) | |
405 | 405 | then { | |
406 | 406 | let rarity = match invokeRes { | |
407 | 407 | case r: Int => | |
408 | 408 | r | |
409 | 409 | case _ => | |
410 | 410 | throw("Incorrect invoke result") | |
411 | 411 | } | |
412 | 412 | pickDuck(gameId, "taker", i.caller, assetId, rarity, "best", 4) | |
413 | 413 | } | |
414 | 414 | else throw("Strict value is not equal to itself.") | |
415 | 415 | } | |
416 | 416 | else if ((gameStep == 5)) | |
417 | - | then if ((callerAddress != | |
417 | + | then if ((callerAddress != getMaker(gameId))) | |
418 | 418 | then throw("It is the maker's turn to pick now") | |
419 | 419 | else { | |
420 | 420 | let invokeRes = invoke(Address(farmingAddress), "getAssetRarityCallable", [assetId], nil) | |
421 | 421 | if ((invokeRes == invokeRes)) | |
422 | 422 | then { | |
423 | 423 | let rarity = match invokeRes { | |
424 | 424 | case r: Int => | |
425 | 425 | r | |
426 | 426 | case _ => | |
427 | 427 | throw("Incorrect invoke result") | |
428 | 428 | } | |
429 | 429 | pickDuck(gameId, "maker", i.caller, assetId, rarity, "best", 5) | |
430 | 430 | } | |
431 | 431 | else throw("Strict value is not equal to itself.") | |
432 | 432 | } | |
433 | 433 | else throw("The best duck has already been picked") | |
434 | 434 | } | |
435 | 435 | ||
436 | 436 | ||
437 | 437 | ||
438 | 438 | @Callable(i) | |
439 | 439 | func commit (gameId,hash) = { | |
440 | 440 | let callerAddress = toBase58String(i.caller.bytes) | |
441 | - | let gameStep = | |
441 | + | let gameStep = getStep(gameId) | |
442 | 442 | if ((6 > gameStep)) | |
443 | 443 | then throw("Ducks hasn't been picked yet") | |
444 | 444 | else if ((gameStep == 6)) | |
445 | - | then if ((callerAddress != | |
445 | + | then if ((callerAddress != getMaker(gameId))) | |
446 | 446 | then throw("It is the maker's turn to commit now") | |
447 | - | else [StringEntry(getCommitKey(gameId, "maker"), hash), IntegerEntry( | |
447 | + | else [StringEntry(getCommitKey(gameId, "maker"), hash), IntegerEntry(getStepKey(gameId), (gameStep + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration))] | |
448 | 448 | else if ((gameStep == 7)) | |
449 | - | then if ((callerAddress != | |
449 | + | then if ((callerAddress != getTaker(gameId))) | |
450 | 450 | then throw("It is the taker's turn to commit now") | |
451 | - | else [StringEntry(getCommitKey(gameId, "taker"), hash), IntegerEntry( | |
451 | + | else [StringEntry(getCommitKey(gameId, "taker"), hash), IntegerEntry(getStepKey(gameId), (gameStep + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration))] | |
452 | 452 | else throw("Commit is finished") | |
453 | 453 | } | |
454 | 454 | ||
455 | 455 | ||
456 | 456 | ||
457 | 457 | @Callable(i) | |
458 | 458 | func reveal (gameId,duckOrder,salt) = { | |
459 | 459 | let callerAddress = toBase58String(i.caller.bytes) | |
460 | - | let gameStep = | |
460 | + | let gameStep = getStep(gameId) | |
461 | 461 | if ((8 > gameStep)) | |
462 | 462 | then throw("Reveal is not started") | |
463 | 463 | else if (if (if (if (if (if ((duckOrder != "worst,medium,best")) | |
464 | 464 | then true | |
465 | 465 | else (duckOrder != "worst,best,medium")) | |
466 | 466 | then true | |
467 | 467 | else (duckOrder != "medium,worst,best")) | |
468 | 468 | then true | |
469 | 469 | else (duckOrder != "medium,best,worst")) | |
470 | 470 | then true | |
471 | 471 | else (duckOrder != "best,worst,medium")) | |
472 | 472 | then true | |
473 | 473 | else (duckOrder != "best,medium,worst")) | |
474 | 474 | then throw("Invalid duckOrder") | |
475 | 475 | else if ((gameStep == 8)) | |
476 | - | then if ((callerAddress != | |
476 | + | then if ((callerAddress != getMaker(gameId))) | |
477 | 477 | then throw("It is the maker's turn to reveal now") | |
478 | 478 | else if ((toBase58String(sha256(toBytes((duckOrder + salt)))) != getCommit(gameId, "maker"))) | |
479 | 479 | then throw("reveal data is not valid") | |
480 | - | else [StringEntry(getDuckOrderKey(gameId, "maker"), duckOrder), IntegerEntry( | |
480 | + | else [StringEntry(getDuckOrderKey(gameId, "maker"), duckOrder), IntegerEntry(getStepKey(gameId), (gameStep + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration))] | |
481 | 481 | else if ((gameStep == 9)) | |
482 | - | then if ((callerAddress != | |
482 | + | then if ((callerAddress != getTaker(gameId))) | |
483 | 483 | then throw("It is the taker's turn to reveal now") | |
484 | 484 | else if ((toBase58String(sha256(toBytes((duckOrder + salt)))) != getCommit(gameId, "taker"))) | |
485 | 485 | then throw("reveal data is not valid") | |
486 | - | else [StringEntry(getDuckOrderKey(gameId, "taker"), duckOrder), IntegerEntry( | |
486 | + | else [StringEntry(getDuckOrderKey(gameId, "taker"), duckOrder), IntegerEntry(getStepKey(gameId), (gameStep + 1)), IntegerEntry(getExpirationHeightKey(gameId), (height + stepDuration))] | |
487 | 487 | else throw("Reveal is finished") | |
488 | 488 | } | |
489 | 489 | ||
490 | 490 | ||
491 | 491 | ||
492 | 492 | @Callable(i) | |
493 | 493 | func getPrize (gameId) = { | |
494 | 494 | let callerAddress = toBase58String(i.caller.bytes) | |
495 | - | let gameStep = | |
495 | + | let gameStep = getStep(gameId) | |
496 | 496 | if ((gameStep != 10)) | |
497 | 497 | then throw("Game is not finished") | |
498 | - | else if ((callerAddress == | |
498 | + | else if ((callerAddress == getMaker(gameId))) | |
499 | 499 | then sendPrize(gameId, i.caller, "maker", getWinner(gameId)) | |
500 | - | else if ((callerAddress == | |
500 | + | else if ((callerAddress == getTaker(gameId))) | |
501 | 501 | then sendPrize(gameId, i.caller, "taker", getWinner(gameId)) | |
502 | 502 | else throw("Invalid caller address") | |
503 | 503 | } | |
504 | 504 | ||
505 | 505 | ||
506 | 506 | ||
507 | 507 | @Callable(i) | |
508 | 508 | func getPrizeExpired (gameId) = { | |
509 | 509 | let callerAddress = toBase58String(i.caller.bytes) | |
510 | - | let gameStep = | |
510 | + | let gameStep = getStep(gameId) | |
511 | 511 | if ((gameStep == 10)) | |
512 | 512 | then throw("Game is finished, call getPrize instead") | |
513 | - | else if (( | |
513 | + | else if ((getExpirationHeight(gameId) > height)) | |
514 | 514 | then throw("Game is not expired") | |
515 | - | else if ((callerAddress == | |
515 | + | else if ((callerAddress == getMaker(gameId))) | |
516 | 516 | then sendPrize(gameId, i.caller, "maker", getWinnerExpired(gameStep)) | |
517 | - | else if ((callerAddress == | |
517 | + | else if ((callerAddress == getTaker(gameId))) | |
518 | 518 | then sendPrize(gameId, i.caller, "taker", getWinnerExpired(gameStep)) | |
519 | 519 | else throw("Invalid caller address") | |
520 | 520 | } | |
521 | 521 | ||
522 | 522 | ||
523 | 523 | @Verifier(tx) | |
524 | 524 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
525 | 525 |
github/deemru/w8io/026f985 98.14 ms ◑