tx · Db4PnE5XGWNjgATGPUxpWim8cvEq5MBDEFiqL9UPAxay 3N8vbCi8fbBq4cY8L3AWqQeq7VJR5FxvR7J: -0.01000000 Waves 2021.09.26 19:13 [1720150] smart account 3N8vbCi8fbBq4cY8L3AWqQeq7VJR5FxvR7J > SELF 0.00000000 Waves
{ "type": 13, "id": "Db4PnE5XGWNjgATGPUxpWim8cvEq5MBDEFiqL9UPAxay", "fee": 1000000, "feeAssetId": null, "timestamp": 1632672890020, "version": 2, "chainId": 84, "sender": "3N8vbCi8fbBq4cY8L3AWqQeq7VJR5FxvR7J", "senderPublicKey": "EkHiMGjZnobhmra42ocG6pxLtFnuq8oPJw2cR7hVSTM1", "proofs": [ "rsEQC6SZ2fLbdwnBgWeqNFnbBfYXeqmRGijbQ3m4eojsxzkxRr6sCJMtcF4R1zvaPvwjh5pJBnbF9C1HkWhwEFx" ], "script": "base64:AAIFAAAAAAAAAKoIAhIAGhAKAmExEgpyYW5kb21pemVyGgkKAmEyEgNpbnYaDgoCYTMSCGxhc3RQbGF5Gg0KAmE0EgckbWF0Y2gwGgcKAmE1EgFzGgoKAmE2EgRyYW5kGg4KAmE3EghyYW5kaGFzaBoKCgJhOBIEdHlwZRoPCgJhORIJY2FyZEluZGV4GgoKAmIxEgRjYXJkGgsKAmIyEgVhc3NldBoNCgJiMxIHYXNzZXRJZAAAAAEBAAAAAmExAAAAAQAAAAJhMgQAAAACYTMEAAAAAmE0CQAEHAAAAAIFAAAABHRoaXMCAAAACGxhc3RQbGF5AwkAAAEAAAACBQAAAAJhNAIAAAAKQnl0ZVZlY3RvcgQAAAACYTUFAAAAAmE0BQAAAAJhNQMJAAABAAAAAgUAAAACYTQCAAAABFVuaXQBAAAADFdhdmVzTG90dG9WMgkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgQAAAACYTYJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACBQAAAAJhMwgFAAAAAmEyAAAADXRyYW5zYWN0aW9u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hOAUAAAADbmlsAgAAAAEgCQAEuQAAAAIJAARMAAAAAgIAAAAEQ2FyZAkABEwAAAACBQAAAAJiMQkABEwAAAACBQAAAAJhOAUAAAADbmlsAgAAAAEgAAAAAAAAAAABAAAAAAAAAAAABwUAAAAEdW5pdAUAAAAGaGVpZ2h0BAAAAAJiMwkABDgAAAABBQAAAAJiMgkABEwAAAACCQEAAAALQmluYXJ5RW50cnkAAAACAgAAAAhsYXN0UGxheQUAAAACYTcJAARMAAAAAgUAAAACYjIJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAmEyAAAABmNhbGxlcgAAAAAAAAAAAQUAAAACYjMFAAAAA25pbAAAAAC7Y7Ix", "height": 1720150, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Bygu5BMVAKYsdUETsm2JFCArtJcigMp9X5GK6Uo9zmiB Next: none Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | then throw("Should be with Payment in Waves") | |
23 | 23 | else { | |
24 | 24 | let randhash = randomizer(inv) | |
25 | - | if ((500 > (toInt(randhash) % 1000))) | |
26 | - | then { | |
27 | - | let asset = Issue("Unique Asset", "10 ♣ ♤ ♥ ♦", 1, 0, false, unit, height) | |
28 | - | let assetId = calculateAssetId(asset) | |
25 | + | let type = match ((toInt(randhash) / 13) % 4) { | |
26 | + | case _ => | |
27 | + | if ((0 == $match0)) | |
28 | + | then "♣" | |
29 | + | else if ((1 == $match0)) | |
30 | + | then "♥" | |
31 | + | else if ((2 == $match0)) | |
32 | + | then "♦" | |
33 | + | else "♤" | |
34 | + | } | |
35 | + | let cardIndex = ((toInt(randhash) % 13) + 1) | |
36 | + | let card = match cardIndex { | |
37 | + | case _ => | |
38 | + | if ((1 == $match0)) | |
39 | + | then "A" | |
40 | + | else if ((11 == $match0)) | |
41 | + | then "J" | |
42 | + | else if ((12 == $match0)) | |
43 | + | then "D" | |
44 | + | else if ((13 == $match0)) | |
45 | + | then "K" | |
46 | + | else toString(cardIndex) | |
47 | + | } | |
48 | + | let asset = Issue(makeString([card, type], " "), makeString(["Card", card, type], " "), 1, 0, false, unit, height) | |
49 | + | let assetId = calculateAssetId(asset) | |
29 | 50 | [BinaryEntry("lastPlay", randhash), asset, ScriptTransfer(inv.caller, 1, assetId)] | |
30 | - | } | |
31 | - | else [BinaryEntry("lastPlay", randhash)] | |
32 | 51 | } | |
33 | 52 | ||
34 | 53 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func randomizer (inv) = { | |
5 | 5 | let lastPlay = match getBinary(this, "lastPlay") { | |
6 | 6 | case s: ByteVector => | |
7 | 7 | s | |
8 | 8 | case _: Unit => | |
9 | 9 | base58'2ee4oFDYriWJ9EMeR' | |
10 | 10 | case _ => | |
11 | 11 | throw("Match error") | |
12 | 12 | } | |
13 | 13 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
14 | 14 | sha256(rand) | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | @Callable(inv) | |
19 | 19 | func default () = if (if ((size(inv.payments) == 0)) | |
20 | 20 | then true | |
21 | 21 | else isDefined(inv.payments[0].assetId)) | |
22 | 22 | then throw("Should be with Payment in Waves") | |
23 | 23 | else { | |
24 | 24 | let randhash = randomizer(inv) | |
25 | - | if ((500 > (toInt(randhash) % 1000))) | |
26 | - | then { | |
27 | - | let asset = Issue("Unique Asset", "10 ♣ ♤ ♥ ♦", 1, 0, false, unit, height) | |
28 | - | let assetId = calculateAssetId(asset) | |
25 | + | let type = match ((toInt(randhash) / 13) % 4) { | |
26 | + | case _ => | |
27 | + | if ((0 == $match0)) | |
28 | + | then "♣" | |
29 | + | else if ((1 == $match0)) | |
30 | + | then "♥" | |
31 | + | else if ((2 == $match0)) | |
32 | + | then "♦" | |
33 | + | else "♤" | |
34 | + | } | |
35 | + | let cardIndex = ((toInt(randhash) % 13) + 1) | |
36 | + | let card = match cardIndex { | |
37 | + | case _ => | |
38 | + | if ((1 == $match0)) | |
39 | + | then "A" | |
40 | + | else if ((11 == $match0)) | |
41 | + | then "J" | |
42 | + | else if ((12 == $match0)) | |
43 | + | then "D" | |
44 | + | else if ((13 == $match0)) | |
45 | + | then "K" | |
46 | + | else toString(cardIndex) | |
47 | + | } | |
48 | + | let asset = Issue(makeString([card, type], " "), makeString(["Card", card, type], " "), 1, 0, false, unit, height) | |
49 | + | let assetId = calculateAssetId(asset) | |
29 | 50 | [BinaryEntry("lastPlay", randhash), asset, ScriptTransfer(inv.caller, 1, assetId)] | |
30 | - | } | |
31 | - | else [BinaryEntry("lastPlay", randhash)] | |
32 | 51 | } | |
33 | 52 | ||
34 | 53 |
github/deemru/w8io/026f985 27.83 ms ◑