tx · CX9YSC8TWoA2Mk2nXvFEjDzpaJQ8hVwww45gWQCpKi8r

3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV:  -0.01000000 Waves

2021.12.09 11:38 [1826470] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves

{ "type": 13, "id": "CX9YSC8TWoA2Mk2nXvFEjDzpaJQ8hVwww45gWQCpKi8r", "fee": 1000000, "feeAssetId": null, "timestamp": 1639039084492, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "6FryTMEsWU9M9Z5oZNTfcGSsLMswZtw89dqJsaf1DxpGYwH8RtiXyu1a8Xxsc7z7XCUyiUetwkprAw8fEWQcKyB" ], "script": "base64:AAIFAAAAAAAAAB4IAhIAEgASBwoFCAEBAQESAwoBCBIDCgEIEgMKAQgAAAABAAAAAAVzZXBhcgIAAAABfAAAAAYAAAABaQEAAAAFcmVzZXQAAAAACQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAACmxhc3RnYW1laWQCAAAAATAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAPbGFzdGNoYWxsZW5nZWlkAgAAAAEwBQAAAANuaWwAAAABaQEAAAAIc2V0cnVsZXMAAAAACQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABG1iZisCAAAACi0xLC0xfDEsLTEJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAEbWJmLQIAAAAACQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABG13ZisCAAAACC0xLDF8MSwxCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABG13Zi0CAAAAAAUAAAADbmlsAAAAAWkBAAAABG1vdmUAAAAFAAAABmdhbWVpZAAAAA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BhcgUAAAADbmlsCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzAAAAAMRQS2A=", "height": 1826470, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GZMrG7JyroYqqGmd9FjGxe9S8JVQQzSqJHRAXCeKw5Us Next: 5sv9ucnRAzefm9EEyL1Emjd6cSjY97qtJduPTRhZnNpA Diff:
OldNewDifferences
4646 if ((turn == turn))
4747 then {
4848 let situation = split(game[8], "!")
49- 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], "|")]
49+ 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], "-")]
5050 if ((cells == cells))
5151 then {
5252 let figure = takeRight(cells[fromx][fromy], 1)
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 setrules () = [StringEntry("mbf+", "-1,-1|1,-1"), StringEntry("mbf-", ""), StringEntry("mwf+", "-1,1|1,1"), StringEntry("mwf-", "")]
1313
1414
1515
1616 @Callable(i)
1717 func move (gameid,fromx,fromy,tox,toy) = {
1818 let game = split(getStringValue(("game-" + gameid)), separ)
1919 if ((game == game))
2020 then {
2121 let callerAdress = toBase58String(i.caller.bytes)
2222 if ((callerAdress == callerAdress))
2323 then {
2424 let isgame = if ((game[0] == "ongoing"))
2525 then true
2626 else throw("not ongoing game")
2727 if ((isgame == isgame))
2828 then {
2929 let side = if (if (isgame)
3030 then if ((game[1] == callerAdress))
3131 then true
3232 else (game[2] == callerAdress)
3333 else false)
3434 then if ((game[1] == callerAdress))
3535 then "w"
3636 else "b"
3737 else throw("not gamer")
3838 if ((side == side))
3939 then {
4040 let otherside = if ((side == "w"))
4141 then "b"
4242 else "w"
4343 let turn = if ((side == game[5]))
4444 then true
4545 else throw("not your turn")
4646 if ((turn == turn))
4747 then {
4848 let situation = split(game[8], "!")
49- 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], "|")]
49+ 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], "-")]
5050 if ((cells == cells))
5151 then {
5252 let figure = takeRight(cells[fromx][fromy], 1)
5353 let movetype = if ((take(cells[tox][toy], 1) == "0"))
5454 then "m"
5555 else if ((take(cells[tox][toy], 1) == otherside))
5656 then "e"
5757 else throw("can not eat himself")
5858 let movement = ((toString((fromx - tox)) + ",") + toString((fromy - toy)))
5959 let possible = split(getStringValue(((movetype + side) + figure)), "|")
6060 let iscorrect = if (containsElement(possible, movement))
6161 then true
6262 else throw("incorrect movement")
6363 if (iscorrect)
6464 then [StringEntry("_", "possible")]
6565 else throw("impossible movement")
6666 }
6767 else throw("Strict value is not equal to itself.")
6868 }
6969 else throw("Strict value is not equal to itself.")
7070 }
7171 else throw("Strict value is not equal to itself.")
7272 }
7373 else throw("Strict value is not equal to itself.")
7474 }
7575 else throw("Strict value is not equal to itself.")
7676 }
7777 else throw("Strict value is not equal to itself.")
7878 }
7979
8080
8181
8282 @Callable(i)
8383 func startgame (challengeid) = {
8484 let pmt = if ((size(i.payments) == 1))
8585 then i.payments[0]
8686 else throw("must stake some waves")
8787 if (isDefined(pmt.assetId))
8888 then throw("works with waves only")
8989 else {
9090 let callerAdress = toBase58String(i.caller.bytes)
9191 let conditions = split(getStringValue(("challenge-" + challengeid)), separ)
9292 if ((size(conditions) > 0))
9393 then if ((pmt.amount >= parseIntValue(conditions[3])))
9494 then if ((conditions[0] == "awaiting"))
9595 then {
9696 let black = if ((conditions[2] == "b"))
9797 then conditions[1]
9898 else callerAdress
9999 let white = if ((conditions[2] == "w"))
100100 then conditions[1]
101101 else callerAdress
102102 let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1))
103103 [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), {
104104 let situation = "wf-00-wf-00-wf-00-wf-00!00-wf-00-wf-00-wf-00-wf!wf-00-wf-00-wf-00-wf-00!00-00-00-00-00-00-00-00!00-00-00-00-00-00-00-00!00-bf-00-bf-00-bf-00-bf!bf-00-bf-00-bf-00-bf-00!00-bf-00-bf-00-bf-00-bf"
105105 StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ))
106106 }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)]
107107 }
108108 else throw("no challenge awaiting")
109109 else throw("need more money")
110110 else throw("no challenge")
111111 }
112112 }
113113
114114
115115
116116 @Callable(i)
117117 func setchallenge (side) = if (if ((side == "b"))
118118 then true
119119 else (side == "w"))
120120 then {
121121 let pmt = if ((size(i.payments) == 1))
122122 then i.payments[0]
123123 else throw("must stake some waves")
124124 if (isDefined(pmt.assetId))
125125 then throw("works with waves only")
126126 else {
127127 let callerAdress = toBase58String(i.caller.bytes)
128128 let challengeid = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
129129 [StringEntry(("challenge-" + challengeid), makeString(["awaiting", callerAdress, side, toString(pmt.amount)], separ)), StringEntry("lastchallengeid", challengeid)]
130130 }
131131 }
132132 else throw("invalid side")
133133
134134
135135
136136 @Callable(i)
137137 func unsetchallenge (challendgeid) = {
138138 let callerAdress = toBase58String(i.caller.bytes)
139139 func getchallenge (challendgeid) = match getString(("challenge-" + challendgeid)) {
140140 case a: String =>
141141 getStringValue(("challenge-" + challendgeid))
142142 case _ =>
143143 ""
144144 }
145145
146146 let challenge = split(getchallenge(challendgeid), separ)
147147 if ((size(challenge) > 0))
148148 then if ((challenge[0] == "awaiting"))
149149 then [StringEntry(("challenge-" + challendgeid), makeString(["unset", challenge[1], challenge[2], challenge[3]], separ))]
150150 else throw("challenge not exists")
151151 else throw("challenge not exists")
152152 }
153153
154154

github/deemru/w8io/026f985 
33.48 ms