tx · 2NhTUvnShbYNEwiBVgKoXmUwSn7j8XUckLfayKdUgZty 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV: -0.01000000 Waves 2021.12.08 18:09 [1825441] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves
{ "type": 13, "id": "2NhTUvnShbYNEwiBVgKoXmUwSn7j8XUckLfayKdUgZty", "fee": 1000000, "feeAssetId": null, "timestamp": 1638976235147, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "24Y3Fek68w7jgiG1YQUZHTzpWJYqYPFcPUeATAeXyaxoCcv2PcvwBG1cuNNyErMV4sUL3tqAYeA8vkhXMgLND281" ], "script": "base64:AAIFAAAAAAAAAA4IAhIDCgEIEgMKAQgSAAAAAAEAAAAABXNlcGFyAgAAAAF8AAAAAwAAAAFpAQAAAAlzdGFydGdhbWUAAAABAAAACmNoYWxsZW5nZXIEAAAAA3BtdAMJAAAAAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABAgAAABVtdXN0IHN0YWtlIHNvbWUgd2F2ZXMDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAFXdvcmtzIHdpdGggd2F2ZXMgb25seQQAAAAMY2FsbGVyQWRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAACmNvbmRpdGlvbnMJAAS1AAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTgpAAAAAQkAASwAAAACAgAAAApjaGFsbGVuZ2UtBQAAAApjaGFsbGVuZ2VyBQAAAAVzZXBhcgMJAABmAAAAAgkAAZAAAAABB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AACmNoYWxsZW5nZS0FAAAAC2NoYWxsZW5kZ2VyAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAJAQAAABFAZXh0ck5hdGl2ZSgxMDU4KQAAAAEJAAEsAAAAAgIAAAAKY2hhbGxlbmdlLQUAAAALY2hhbGxlbmRnZXICAAAAAAQAAAAJY2hhbGxlbmdlCQAEtQAAAAIJAQAAAAxnZXRjaGFsbGVuZ2UAAAABBQAAAAxjYWxsZXJBZHJlc3MFAAAABXNlcGFyAwkAAGYAAAACCQABkAAAAAEFAAAACWNoYWxsZW5nZQAAAAAAAAAAAAMJAAAAAAAAAgkAAZEAAAACBQAAAAljaGFsbGVuZ2UAAAAAAAAAAAACAAAACGF3YWl0aW5nCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgIAAAAKY2hhbGxlbmdlLQUAAAAMY2FsbGVyQWRyZXNzCQAEuQAAAAIJAARMAAAAAgIAAAAFdW5zZXQJAARMAAAAAgkAAZEAAAACBQAAAAljaGFsbGVuZ2UAAAAAAAAAAAEJAARMAAAAAgkAAZEAAAACBQAAAAljaGFsbGVuZ2UAAAAAAAAAAAIFAAAAA25pbAUAAAAFc2VwYXIFAAAAA25pbAkAAAIAAAABAgAAABRjaGFsbGVuZ2Ugbm90IGV4aXN0cwkAAAIAAAABAgAAABRjaGFsbGVuZ2Ugbm90IGV4aXN0cwAAAACSRGlu", "height": 1825441, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GADQ7j3qvGAxyzVnLkvy99DgkX6UrHwKGm3tutoprxTy Next: 97rfNZydsLbvHeat7BUXFAB6XyGvw5mXvWZy78mxr7uU Diff:
Old | New | Differences | |
---|---|---|---|
28 | 28 | case _ => | |
29 | 29 | 1 | |
30 | 30 | } | |
31 | - | ||
31 | + | [StringEntry(("challenge-" + challenger), makeString(["answered", conditions[1], conditions[2], callerAdress], separ)), StringEntry(toString(gameid), makeString(["ongoing", white, black, conditions[2], "0", "white", "startblock", "laststepblock"], separ))] | |
32 | 32 | } | |
33 | 33 | else throw("no challenge awaiting") | |
34 | 34 | else throw("no challenge") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separ = "|" | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func startgame (challenger) = { | |
8 | 8 | let pmt = if ((size(i.payments) == 1)) | |
9 | 9 | then i.payments[0] | |
10 | 10 | else throw("must stake some waves") | |
11 | 11 | if (isDefined(pmt.assetId)) | |
12 | 12 | then throw("works with waves only") | |
13 | 13 | else { | |
14 | 14 | let callerAdress = toBase58String(i.caller.bytes) | |
15 | 15 | let conditions = split(getStringValue(("challenge-" + challenger)), separ) | |
16 | 16 | if ((size(conditions) > 0)) | |
17 | 17 | then if ((conditions[0] == "awaiting")) | |
18 | 18 | then { | |
19 | 19 | let black = if ((conditions[1] == "black")) | |
20 | 20 | then challenger | |
21 | 21 | else callerAdress | |
22 | 22 | let white = if ((conditions[1] == "white")) | |
23 | 23 | then challenger | |
24 | 24 | else callerAdress | |
25 | 25 | let gameid = match getInteger("lastgameid") { | |
26 | 26 | case a: Int => | |
27 | 27 | getIntegerValue("lastgameid") | |
28 | 28 | case _ => | |
29 | 29 | 1 | |
30 | 30 | } | |
31 | - | ||
31 | + | [StringEntry(("challenge-" + challenger), makeString(["answered", conditions[1], conditions[2], callerAdress], separ)), StringEntry(toString(gameid), makeString(["ongoing", white, black, conditions[2], "0", "white", "startblock", "laststepblock"], separ))] | |
32 | 32 | } | |
33 | 33 | else throw("no challenge awaiting") | |
34 | 34 | else throw("no challenge") | |
35 | 35 | } | |
36 | 36 | } | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | @Callable(i) | |
41 | 41 | func setchallenge (side) = if (if ((side == "black")) | |
42 | 42 | then true | |
43 | 43 | else (side == "white")) | |
44 | 44 | then { | |
45 | 45 | let pmt = if ((size(i.payments) == 1)) | |
46 | 46 | then i.payments[0] | |
47 | 47 | else throw("must stake some waves") | |
48 | 48 | if (isDefined(pmt.assetId)) | |
49 | 49 | then throw("works with waves only") | |
50 | 50 | else { | |
51 | 51 | let callerAdress = toBase58String(i.caller.bytes) | |
52 | 52 | [StringEntry(("challenge-" + callerAdress), makeString(["awaiting", side, toString(pmt.amount)], separ))] | |
53 | 53 | } | |
54 | 54 | } | |
55 | 55 | else throw("invalid side") | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(i) | |
60 | 60 | func unsetchallenge () = { | |
61 | 61 | let callerAdress = toBase58String(i.caller.bytes) | |
62 | 62 | func getchallenge (challendger) = match getString(("challenge-" + challendger)) { | |
63 | 63 | case a: String => | |
64 | 64 | getStringValue(("challenge-" + challendger)) | |
65 | 65 | case _ => | |
66 | 66 | "" | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | let challenge = split(getchallenge(callerAdress), separ) | |
70 | 70 | if ((size(challenge) > 0)) | |
71 | 71 | then if ((challenge[0] == "awaiting")) | |
72 | 72 | then [StringEntry(("challenge-" + callerAdress), makeString(["unset", challenge[1], challenge[2]], separ))] | |
73 | 73 | else throw("challenge not exists") | |
74 | 74 | else throw("challenge not exists") | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 |
github/deemru/w8io/026f985 25.52 ms ◑