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