tx · 5ehFhHmVg3aZJX7wthgQMpTNf9ctEcMYwXQzT5tbGrHS

3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os:  -0.01400000 Waves

2020.07.21 13:47 [1097127] smart account 3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os > SELF 0.00000000 Waves

{ "type": 13, "id": "5ehFhHmVg3aZJX7wthgQMpTNf9ctEcMYwXQzT5tbGrHS", "fee": 1400000, "feeAssetId": null, "timestamp": 1595328438900, "version": 1, "sender": "3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os", "senderPublicKey": "2H7prj9bMBS9xMv4iNhFyNLKx38JpRZ6tnf1GNHu9xUX", "proofs": [ "3aQTPssGpBiRS8qKLGRiDurXUDpAxjDPMc9Qw82ycGmmHHPtVJ5gDr1KmjZK8QKKpq38dmtVLmNMgi8hSbsG3ksd" ], "script": "base64:AAIDAAAAAAAAAA8IARIECgIBARIFCgMBAQEAAAAIAQAAAAlnZXRDb29yZHMAAAABAAAAA2tleQkABEwAAAACCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgIAAAAMcG9zaXRpb25MYXRfBQAAAANrZXkJAARMAAAAAgkABBoAAAACBQAAAAR0aGlzCQABLAAAAAICAAAADXBvc2l0aW9uTG9uZ18FAAAAA2tleQUAAAADbmlsAQAAAAlzZXRDb29yZHMAAAADAAAAA2tleQAAAAhsYXRpdHVkZQAAAAlsb25naXR1ZGUJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAMcG9zaXRpb25MYXRfBQAAAANrZXkFAAAACGxhdGl0dWRlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAADXBvc2l0aW9uTG9uZ18FAAAAA2tleQUAAAAJbG9uZ2l0dWRlBQAAAANuaWwBAAAAC3NldEdhbWVEYXRhAAAAAgAAAANpZDAAAAADaWQxBAAAAAZnYW1lSWQJAAEsAAAAAgkAASwAAAACBQAAAANpZDACAAAAAV8FA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AEJAQAAAAxjaGFuZ2VQbGF5ZXIAAAABBQAAAAZjYWxsZXIAAAAADA9bZA==", "chainId": 84, "height": 1097127, "spentComplexity": 0 } View: original | compacted Prev: 7kyXjvAqah74bzw8FGx31V31u1AxXisiwy4kJjRH1Mqr Next: 7T2Bq9cFUWZJ9CELsMRJySSchaA3yikK6iiNgD4EWBeW Diff:
OldNewDifferences
77 func setCoords (key,latitude,longitude) = [DataEntry(("positionLat_" + key), latitude), DataEntry(("positionLong_" + key), longitude)]
88
99
10+func setGameData (id0,id1) = {
11+ let gameId = ((id0 + "_") + id1)
12+[DataEntry(("gameId_" + id0), gameId), DataEntry(("opponent_" + id0), id1), DataEntry(("gameId_" + id1), gameId), DataEntry(("opponent_" + id1), id0), DataEntry(("game_" + gameId), true), DataEntry(("gameTurn_" + gameId), id0), DataEntry(("gameWinner_" + gameId), "")]
13+ }
14+
15+
16+func getGameId (key) = getStringValue(this, ("gameId_" + key))
17+
18+
19+func unsetGameData (id0) = {
20+ let gameId = getGameId(id0)
21+ let id1 = getStringValue(this, ("opponent_" + id0))
22+[DataEntry(("gameId_" + id0), ""), DataEntry(("gameId_" + id1), ""), DataEntry(("game_" + gameId), false), DataEntry(("gameTurn_" + gameId), "")]
23+ }
24+
25+
26+func isPlayerTurn (id0) = if ((getStringValue(this, ("gameTurn_" + getGameId(id0))) == id0))
27+ then true
28+ else false
29+
30+
31+func changePlayer (id0) = [DataEntry(("gameTurn_" + getGameId(id0)), getStringValue(this, ("opponent_" + id0)))]
32+
33+
34+func gotHit (pitch,yaw,force) = if ((pitch == yaw))
35+ then true
36+ else false
37+
38+
1039 @Callable(i)
1140 func startGame (latitude,longitude) = {
1241 let caller = toString(i.caller)
13- let ret = setCoords(caller, latitude, longitude)
42+ let coordinates = setCoords(caller, latitude, longitude)
1443 let openGame = getString(this, "openGame")
15- if (!(isDefined(openGame)))
16- then WriteSet(DataEntry("openGame", caller) :: ret)
17- else if (if ((openGame == ""))
18- then true
19- else (openGame == caller))
20- then WriteSet(DataEntry("openGame", caller) :: ret)
21- else WriteSet([DataEntry("openGame", ""), DataEntry(((("game_" + value(openGame)) + "_") + caller), true)] :: ret)
44+ if ((getGameId(caller) != ""))
45+ then throw("Please finish your current game, before starting another one")
46+ else if (!(isDefined(openGame)))
47+ then WriteSet(DataEntry("openGame", caller) :: coordinates)
48+ else if (if ((openGame == ""))
49+ then true
50+ else (openGame == caller))
51+ then WriteSet(DataEntry("openGame", caller) :: coordinates)
52+ else WriteSet([DataEntry("openGame", ""), coordinates[0], coordinates[1], setGameData(value(openGame), caller)])
53+ }
54+
55+
56+
57+@Callable(i)
58+func executeShot (pitch,yaw,force) = {
59+ let caller = toString(i.caller)
60+ if (!(isPlayerTurn(caller)))
61+ then throw("please wait for your turn")
62+ else if (gotHit(pitch, yaw, force))
63+ then WriteSet(unsetGameData(caller))
64+ else WriteSet(changePlayer(caller))
2265 }
2366
2467
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getCoords (key) = [getInteger(this, ("positionLat_" + key)), getInteger(this, ("positionLong_" + key))]
55
66
77 func setCoords (key,latitude,longitude) = [DataEntry(("positionLat_" + key), latitude), DataEntry(("positionLong_" + key), longitude)]
88
99
10+func setGameData (id0,id1) = {
11+ let gameId = ((id0 + "_") + id1)
12+[DataEntry(("gameId_" + id0), gameId), DataEntry(("opponent_" + id0), id1), DataEntry(("gameId_" + id1), gameId), DataEntry(("opponent_" + id1), id0), DataEntry(("game_" + gameId), true), DataEntry(("gameTurn_" + gameId), id0), DataEntry(("gameWinner_" + gameId), "")]
13+ }
14+
15+
16+func getGameId (key) = getStringValue(this, ("gameId_" + key))
17+
18+
19+func unsetGameData (id0) = {
20+ let gameId = getGameId(id0)
21+ let id1 = getStringValue(this, ("opponent_" + id0))
22+[DataEntry(("gameId_" + id0), ""), DataEntry(("gameId_" + id1), ""), DataEntry(("game_" + gameId), false), DataEntry(("gameTurn_" + gameId), "")]
23+ }
24+
25+
26+func isPlayerTurn (id0) = if ((getStringValue(this, ("gameTurn_" + getGameId(id0))) == id0))
27+ then true
28+ else false
29+
30+
31+func changePlayer (id0) = [DataEntry(("gameTurn_" + getGameId(id0)), getStringValue(this, ("opponent_" + id0)))]
32+
33+
34+func gotHit (pitch,yaw,force) = if ((pitch == yaw))
35+ then true
36+ else false
37+
38+
1039 @Callable(i)
1140 func startGame (latitude,longitude) = {
1241 let caller = toString(i.caller)
13- let ret = setCoords(caller, latitude, longitude)
42+ let coordinates = setCoords(caller, latitude, longitude)
1443 let openGame = getString(this, "openGame")
15- if (!(isDefined(openGame)))
16- then WriteSet(DataEntry("openGame", caller) :: ret)
17- else if (if ((openGame == ""))
18- then true
19- else (openGame == caller))
20- then WriteSet(DataEntry("openGame", caller) :: ret)
21- else WriteSet([DataEntry("openGame", ""), DataEntry(((("game_" + value(openGame)) + "_") + caller), true)] :: ret)
44+ if ((getGameId(caller) != ""))
45+ then throw("Please finish your current game, before starting another one")
46+ else if (!(isDefined(openGame)))
47+ then WriteSet(DataEntry("openGame", caller) :: coordinates)
48+ else if (if ((openGame == ""))
49+ then true
50+ else (openGame == caller))
51+ then WriteSet(DataEntry("openGame", caller) :: coordinates)
52+ else WriteSet([DataEntry("openGame", ""), coordinates[0], coordinates[1], setGameData(value(openGame), caller)])
53+ }
54+
55+
56+
57+@Callable(i)
58+func executeShot (pitch,yaw,force) = {
59+ let caller = toString(i.caller)
60+ if (!(isPlayerTurn(caller)))
61+ then throw("please wait for your turn")
62+ else if (gotHit(pitch, yaw, force))
63+ then WriteSet(unsetGameData(caller))
64+ else WriteSet(changePlayer(caller))
2265 }
2366
2467

github/deemru/w8io/026f985 
27.29 ms