tx · HymfQyQYfauW4g7s6GCVPJpQRAFbXr2UeYmMEDHhDBby

3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV:  -0.01000000 Waves

2021.12.09 08:55 [1826314] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves

{ "type": 13, "id": "HymfQyQYfauW4g7s6GCVPJpQRAFbXr2UeYmMEDHhDBby", "fee": 1000000, "feeAssetId": null, "timestamp": 1639029348568, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "2Kb5AXN1Gk6i4e6qzYWamKnC7VvpMhTdJgbyrqBxJU8iJZTLoRgftrU9xXbTZyZK8PkjuDBGeugAaqT5Ri9TSP8G" ], "script": "base64:AAIFAAAAAAAAABoIAhIAEgUKAwgICBIDCgEIEgMKAQgSAwoBCAAAAAEAAAAABXNlcGFyAgAAAAF8AAAABQAAAAFpAQAAAAVyZXNldAAAAAAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAKbGFzdGdhbWVpZAIAAAABMAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAA9sYXN0Y2hhbGxlbmdlaWQCAAAAATAFAAAAA25pbAAAAAFpAQAAAARtb3ZlAAAAAwAAAAZnYW1laWQAAAAEZnJvbQAAAAJ0bwQAAAAEZ2FtZQkABLUAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1OCkAAAABCQABLAAAAAICAAAABWdhbWUtBQAAAAZnYW1laWQFAAAABXNlcGFyAwkAAAAAAAACBQAAAARnYW1lBQAAAARnYW1lBAAAAAxjYWxsZXJBZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAgUAAAAMY2FsbGVyQWRyZXNzBQAAAAxjYWxsZXJBZHJlc3MEAAAABm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kZ2VpZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwCQEAAAARQGV4dHJOYXRpdmUoMTA1OCkAAAABCQABLAAAAAICAAAACmNoYWxsZW5nZS0FAAAADGNoYWxsZW5kZ2VpZAIAAAAABAAAAAljaGFsbGVuZ2UJAAS1AAAAAgkBAAAADGdldGNoYWxsZW5nZQAAAAEFAAAADGNoYWxsZW5kZ2VpZAUAAAAFc2VwYXIDCQAAZgAAAAIJAAGQAAAAAQUAAAAJY2hhbGxlbmdlAAAAAAAAAAAAAwkAAAAAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAAIAAAAIYXdhaXRpbmcJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAApjaGFsbGVuZ2UtBQAAAAxjaGFsbGVuZGdlaWQJAAS5AAAAAgkABEwAAAACAgAAAAV1bnNldAkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAQkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAgkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAwUAAAADbmlsBQAAAAVzZXBhcgUAAAADbmlsCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzAAAAACGHhhY=", "height": 1826314, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 864xNvJnBUwTCzZirzdsRzE6TPcHiAWuqeka1L9W3xwp Next: 448Fi4XgqUcsuV9nLh91QhYQrMfBeRumHXyuBNj5fjFE Diff:
OldNewDifferences
4141 let cells = [split(situation[0], "|"), split(situation[1], "|"), split(situation[2], "|"), split(situation[3], "|"), split(situation[4], "|"), split(situation[5], "|"), split(situation[6], "|"), split(situation[7], "|")]
4242 if ((cells == cells))
4343 then {
44- let froms = split(from, "")
45- let tos = split(to, "")
46- let fromx = parseIntValue(froms[0])
47- let fromy = parseIntValue(froms[1])
48- let tox = parseIntValue(tos[0])
49- let toy = parseIntValue(tos[1])
44+ let fromx = parseIntValue(take(from, 1))
45+ let fromy = parseIntValue(takeRight(from, 1))
46+ let tox = parseIntValue(take(to, 1))
47+ let toy = parseIntValue(takeRight(to, 1))
5048 let iscorrect = if (if ((take(cells[fromx][fromy], 1) == side))
5149 then (take(cells[tox][toy], 1) != side)
5250 else false)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separ = "|"
55
66 @Callable(i)
77 func reset () = [StringEntry("lastgameid", "0"), StringEntry("lastchallengeid", "0")]
88
99
1010
1111 @Callable(i)
1212 func move (gameid,from,to) = {
1313 let game = split(getStringValue(("game-" + gameid)), separ)
1414 if ((game == game))
1515 then {
1616 let callerAdress = toBase58String(i.caller.bytes)
1717 if ((callerAdress == callerAdress))
1818 then {
1919 let isgame = if ((game[0] == "ongoing"))
2020 then true
2121 else throw("not ongoing game")
2222 if ((isgame == isgame))
2323 then {
2424 let side = if (if (isgame)
2525 then if ((game[1] == callerAdress))
2626 then true
2727 else (game[2] == callerAdress)
2828 else false)
2929 then if ((game[1] == callerAdress))
3030 then "w"
3131 else "b"
3232 else throw("not gamer")
3333 if ((side == side))
3434 then {
3535 let turn = if ((side == game[5]))
3636 then true
3737 else throw("not your turn")
3838 if ((turn == turn))
3939 then {
4040 let situation = split(game[8], "||")
4141 let cells = [split(situation[0], "|"), split(situation[1], "|"), split(situation[2], "|"), split(situation[3], "|"), split(situation[4], "|"), split(situation[5], "|"), split(situation[6], "|"), split(situation[7], "|")]
4242 if ((cells == cells))
4343 then {
44- let froms = split(from, "")
45- let tos = split(to, "")
46- let fromx = parseIntValue(froms[0])
47- let fromy = parseIntValue(froms[1])
48- let tox = parseIntValue(tos[0])
49- let toy = parseIntValue(tos[1])
44+ let fromx = parseIntValue(take(from, 1))
45+ let fromy = parseIntValue(takeRight(from, 1))
46+ let tox = parseIntValue(take(to, 1))
47+ let toy = parseIntValue(takeRight(to, 1))
5048 let iscorrect = if (if ((take(cells[fromx][fromy], 1) == side))
5149 then (take(cells[tox][toy], 1) != side)
5250 else false)
5351 then true
5452 else throw("wrong position")
5553 if ((iscorrect == iscorrect))
5654 then {
5755 let figure = cells[fromx][fromy]
5856 if (iscorrect)
5957 then [StringEntry("_", "figure")]
6058 else [StringEntry("_", "_")]
6159 }
6260 else throw("Strict value is not equal to itself.")
6361 }
6462 else throw("Strict value is not equal to itself.")
6563 }
6664 else throw("Strict value is not equal to itself.")
6765 }
6866 else throw("Strict value is not equal to itself.")
6967 }
7068 else throw("Strict value is not equal to itself.")
7169 }
7270 else throw("Strict value is not equal to itself.")
7371 }
7472 else throw("Strict value is not equal to itself.")
7573 }
7674
7775
7876
7977 @Callable(i)
8078 func startgame (challengeid) = {
8179 let pmt = if ((size(i.payments) == 1))
8280 then i.payments[0]
8381 else throw("must stake some waves")
8482 if (isDefined(pmt.assetId))
8583 then throw("works with waves only")
8684 else {
8785 let callerAdress = toBase58String(i.caller.bytes)
8886 let conditions = split(getStringValue(("challenge-" + challengeid)), separ)
8987 if ((size(conditions) > 0))
9088 then if ((pmt.amount >= parseIntValue(conditions[3])))
9189 then if ((conditions[0] == "awaiting"))
9290 then {
9391 let black = if ((conditions[2] == "b"))
9492 then conditions[1]
9593 else callerAdress
9694 let white = if ((conditions[2] == "w"))
9795 then conditions[1]
9896 else callerAdress
9997 let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1))
10098 [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), {
10199 let situation = "wl|wh|we|wf|wq|we|wh|wl||wp|wp|wp|wp|wp|wp|wp|wp||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||bp|bp|bp|bp|bp|bp|bp|bp||bl|bh|be|bf|bq|be|bh|bl"
102100 StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ))
103101 }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)]
104102 }
105103 else throw("no challenge awaiting")
106104 else throw("need more money")
107105 else throw("no challenge")
108106 }
109107 }
110108
111109
112110
113111 @Callable(i)
114112 func setchallenge (side) = if (if ((side == "b"))
115113 then true
116114 else (side == "w"))
117115 then {
118116 let pmt = if ((size(i.payments) == 1))
119117 then i.payments[0]
120118 else throw("must stake some waves")
121119 if (isDefined(pmt.assetId))
122120 then throw("works with waves only")
123121 else {
124122 let callerAdress = toBase58String(i.caller.bytes)
125123 let challengeid = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
126124 [StringEntry(("challenge-" + challengeid), makeString(["awaiting", callerAdress, side, toString(pmt.amount)], separ)), StringEntry("lastchallengeid", challengeid)]
127125 }
128126 }
129127 else throw("invalid side")
130128
131129
132130
133131 @Callable(i)
134132 func unsetchallenge (challendgeid) = {
135133 let callerAdress = toBase58String(i.caller.bytes)
136134 func getchallenge (challendgeid) = match getString(("challenge-" + challendgeid)) {
137135 case a: String =>
138136 getStringValue(("challenge-" + challendgeid))
139137 case _ =>
140138 ""
141139 }
142140
143141 let challenge = split(getchallenge(challendgeid), separ)
144142 if ((size(challenge) > 0))
145143 then if ((challenge[0] == "awaiting"))
146144 then [StringEntry(("challenge-" + challendgeid), makeString(["unset", challenge[1], challenge[2], challenge[3]], separ))]
147145 else throw("challenge not exists")
148146 else throw("challenge not exists")
149147 }
150148
151149

github/deemru/w8io/026f985 
279.24 ms