tx · 4bV5LY9LgHAEZJMd3CXeH8PHLq81Jow8McJCcpm7sa6x 3MvEkw2C78pz2dKAppkhh1mRH6HuJGwRCSk: -0.01000000 Waves 2023.05.29 20:01 [2599533] smart account 3MvEkw2C78pz2dKAppkhh1mRH6HuJGwRCSk > SELF 0.00000000 Waves
{ "type": 13, "id": "4bV5LY9LgHAEZJMd3CXeH8PHLq81Jow8McJCcpm7sa6x", "fee": 1000000, "feeAssetId": null, "timestamp": 1685379694214, "version": 2, "chainId": 84, "sender": "3MvEkw2C78pz2dKAppkhh1mRH6HuJGwRCSk", "senderPublicKey": "9s6e65tKERrhVTka26nUspCZX3GsFZJ6zko3rgnryQqg", "proofs": [ "3BMcQ4huVVoK3mimNfu2rbhPLm5gCeHRLWJe4PGmDNkGFV8Yc23QQTTU8Qeh6R4XHe6Goye4juSbwh3xQfe3CcRo" ], "script": "base64:AAIEAAAAAAAAAAcIAhIDCgEIAAAAAwEAAAAUZ2VuZXJhdGVSYW5kb21OdW1iZXIAAAADAAAAAWkAAAADbWluAAAAA21heAQAAAAKcmFuZG9tU2VlZAkABLEAAAABCQAB9QAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQEAAAADHJhbmRvbU51bWJlcgkAAGQAAAACCQAAagAAAAIFAAAACnJhbmRvbVNlZWQJAABkAAAAAgkAAGUAAAACBQAAAANtYXgFAAAAA21pbgAAAAAAAAAAAQUAAAADbWluBQAAAAxyYW5kb21OdW1iZXIBAAAAC2lzUGF5bWVudE9rAAAAAQAAAAFpBAAAABFhY2NlcHRhYmxlQXNzZXRJZAEAAAAgIkSm54hUfVEormpXug9p+nbhDnc37ahHq1IfaU2UQkcDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAUUGF5bWVudCBub3QgYXR0YWNoZWQEAAAAAXAJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAAByRtYXRja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AAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADXdpbm5pbmdBbW91bnQFAAAABHVuaXQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAGIWdhbWVfBQAAAAJpZAUAAAANd2lubmluZ0Ftb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAABghdGVzdF9nYW1lX3JhbmRvbU51bWJlcl8FAAAAAmlkBQAAAAxyYW5kb21OdW1iZXIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAZIXRlc3RfZ2FtZV93aW5uaW5nQW1vdW50XwUAAAACaWQFAAAADXdpbm5pbmdBbW91bnQFAAAAA25pbAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAAAVnYW1lXwUAAAACaWQFAAAADXdpbm5pbmdBbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAXdGVzdF9nYW1lX3JhbmRvbU51bWJlcl8FAAAAAmlkBQAAAAxyYW5kb21OdW1iZXIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAYdGVzdF9nYW1lX3dpbm5pbmdBbW91bnRfBQAAAAJpZAUAAAANd2lubmluZ0Ftb3VudAUAAAADbmlsAAAAABdgLCQ=", "height": 2599533, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BiE1ZnrYataDZu31XvXQT1QDmi3wDULSqfaUgFzjnfJ2 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
51 | 51 | let randomNumber = generateRandomNumber(i, 1, 12) | |
52 | 52 | let winningAmount = gameLuckyWheelWhatUserWon(randomNumber) | |
53 | 53 | if ((winningAmount > 0)) | |
54 | - | then [ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(("game_" + id), winningAmount), IntegerEntry(("test_game_randomNumber_" + id), randomNumber), IntegerEntry(("test_game_winningAmount_" + id), winningAmount)] | |
54 | + | then [ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(("!game_" + id), winningAmount), IntegerEntry(("!test_game_randomNumber_" + id), randomNumber), IntegerEntry(("!test_game_winningAmount_" + id), winningAmount)] | |
55 | 55 | else [IntegerEntry(("game_" + id), winningAmount), IntegerEntry(("test_game_randomNumber_" + id), randomNumber), IntegerEntry(("test_game_winningAmount_" + id), winningAmount)] | |
56 | 56 | } | |
57 | 57 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func generateRandomNumber (i,min,max) = { | |
5 | 5 | let randomSeed = toInt(keccak256(i.transactionId)) | |
6 | 6 | let randomNumber = ((randomSeed % ((max - min) + 1)) + min) | |
7 | 7 | randomNumber | |
8 | 8 | } | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func isPaymentOk (i) = { | |
12 | 12 | let acceptableAssetId = base58'3JmaWyFqWo8YSA8x3DXCBUW7veesxacvKx19dMv7wTMg' | |
13 | 13 | if ((size(i.payments) == 0)) | |
14 | 14 | then throw("Payment not attached") | |
15 | 15 | else { | |
16 | 16 | let p = i.payments[0] | |
17 | 17 | match p.assetId { | |
18 | 18 | case assetId: ByteVector => | |
19 | 19 | if ((assetId == acceptableAssetId)) | |
20 | 20 | then (p.amount >= 10000000) | |
21 | 21 | else false | |
22 | 22 | case _ => | |
23 | 23 | (p.amount >= 10000000) | |
24 | 24 | } | |
25 | 25 | } | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func gameLuckyWheelWhatUserWon (value) = match value { | |
30 | 30 | case _ => | |
31 | 31 | if ((1 == $match0)) | |
32 | 32 | then 20000000 | |
33 | 33 | else if ((3 == $match0)) | |
34 | 34 | then 10000000 | |
35 | 35 | else if ((5 == $match0)) | |
36 | 36 | then 10000000 | |
37 | 37 | else if ((7 == $match0)) | |
38 | 38 | then 30000000 | |
39 | 39 | else if ((8 == $match0)) | |
40 | 40 | then 10000000 | |
41 | 41 | else if ((11 == $match0)) | |
42 | 42 | then 10000000 | |
43 | 43 | else 0 | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func gameLuckyWheel (id) = if (!(isPaymentOk(i))) | |
49 | 49 | then throw("Wrong payment amount or asset") | |
50 | 50 | else { | |
51 | 51 | let randomNumber = generateRandomNumber(i, 1, 12) | |
52 | 52 | let winningAmount = gameLuckyWheelWhatUserWon(randomNumber) | |
53 | 53 | if ((winningAmount > 0)) | |
54 | - | then [ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(("game_" + id), winningAmount), IntegerEntry(("test_game_randomNumber_" + id), randomNumber), IntegerEntry(("test_game_winningAmount_" + id), winningAmount)] | |
54 | + | then [ScriptTransfer(i.caller, winningAmount, unit), IntegerEntry(("!game_" + id), winningAmount), IntegerEntry(("!test_game_randomNumber_" + id), randomNumber), IntegerEntry(("!test_game_winningAmount_" + id), winningAmount)] | |
55 | 55 | else [IntegerEntry(("game_" + id), winningAmount), IntegerEntry(("test_game_randomNumber_" + id), randomNumber), IntegerEntry(("test_game_winningAmount_" + id), winningAmount)] | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 |
github/deemru/w8io/169f3d6 25.92 ms ◑