tx · DiALfCc5dpcEZ9R5BeV8H2yK3w1n4NT6hyjMVwu3MxWK

3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos:  -0.01400000 Waves

2024.05.21 16:22 [3115816] smart account 3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos > SELF 0.00000000 Waves

{ "type": 13, "id": "DiALfCc5dpcEZ9R5BeV8H2yK3w1n4NT6hyjMVwu3MxWK", "fee": 1400000, "feeAssetId": null, "timestamp": 1716297662048, "version": 2, "chainId": 84, "sender": "3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos", "senderPublicKey": "F7SLwr7RYVQpyocmVScFC6ooaAwewaGq6wNRDYvyiPj1", "proofs": [ "5Q6QJGUyS3MhSrS4z6Uj8z1LpvSe8et4Zu6VoKmznjj3K6VFSupSbQ8ym98pDQbPj7NMh4Q34xsJ6JW6LaRTADPU", "4qTgYR1BNiGvpihrCmj9auqXxgKLCkvx1u41B9zxY8VJkctE5bBBfzc7orFEouQqBvto6KBFbRrpqv3K2oZMR87k" ], "script": "base64:AAIFAAAAAAAAABIIAhIGCgQIGAgIEgQKAggIEgAAAAAGAAAAABRwcmVkaWN0aW9uTWF4Q291bnRlcgAAAAAAAAAAAwAAAAAKbWF4Q291bnRlcgAAAAAAAAAABgAAAAANZGVmYXVsdFJhdGluZwAAAAAAAAAAZAEAAAARc2VhcmNoRm9yQ291bnRlcnMAAAACAAAABml0ZW1JZAAAAAdjb3VudGVyBAAAABFzZWFyY2hGb3JDb3VudGVycwQAAAAHJG1hdGNoMAkABCIAAAABCQABLAAAAAIJAAEsAAAAAgUAAAAGaXRlbUlkAgAAAAFfCQABpAAAAAEFAAAAB2NvdW50ZXIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwIAAAAHTm8gVXNlcgUAAAARc2VhcmNoRm9yQ291bnRlcnMBAAAAGXNlYXJjaEZvckFkcmVzc1ByZWRpY3Rpb24AA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WJsaWNLZXmapnfJ", "height": 3115816, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3LznDyEZnroS5VU5YsA1EM8VP4seozQ42jUfKGmdFDu5 Next: HxNKxsgNGbQux9D7QJfjmTtfZ45fuVu8Qk4Hecd1aMBE Diff:
OldNewDifferences
7676 @Callable(i)
7777 func savePrediction (itemId,prediction) = {
7878 let clientAdress = toString(i.caller)
79- let searchForItem = match getString(itemId) {
80- case s: String =>
79+ let searchForUser = match getInteger(clientAdress) {
80+ case s: Int =>
8181 s
8282 case _ =>
83- "no Data exists"
83+ "no User exists"
8484 }
85- if ((searchForItem == "no Data exists"))
86- then throw("This ItemID does not exist!")
85+ if ((searchForUser == "no User exists"))
86+ then throw("User does not exist")
8787 else {
88- let searchForUser = match getInteger(clientAdress) {
88+ let searchForCounter = match getInteger((itemId + "_counter")) {
8989 case s: Int =>
9090 s
9191 case _ =>
92- "no User exists"
92+ -1
9393 }
94- if ((searchForUser == "no User exists"))
95- then throw("User does not exist")
96- else {
97- let searchForCounter = match getInteger((itemId + "_counter")) {
98- case s: Int =>
99- s
100- case _ =>
101- -1
102- }
94+ if ((searchForCounter >= 1))
95+ then {
10396 let adressList = findPredictionAdresses(itemId, searchForCounter)
10497 if (containsElement(adressList, clientAdress))
10598 then throw("This User already gave a Prediction")
106- else if ((searchForCounter >= 1))
107- then {
108- let predictionCounter = match getInteger((itemId + "_predictionCounter")) {
109- case s: Int =>
110- s
111- case _ =>
112- -1
113- }
114- let lastPredictionAdress = adressList[(size(adressList) - 1)]
115- let lastPrediction = match getString(((itemId + "_") + lastPredictionAdress)) {
116- case s: String =>
117- s
118- case _ =>
119- "no Prediction Found"
120- }
121- let newCounter = (searchForCounter + 1)
122- if ((lastPrediction == prediction))
123- then if (((predictionCounter + 1) == predictionMaxCounter))
124- then {
125- let invokeAdjustRating = invoke(this, "adjustRatingsAndPayoutParticipants", [itemId, adressList, clientAdress, prediction], nil)
126- if ((invokeAdjustRating != invokeAdjustRating))
127- then throw("Strict value is not equal to itself.")
128- else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), true), BooleanEntry((itemId + "_cancelled"), false)]
129- }
130- else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), false), BooleanEntry((itemId + "_cancelled"), false)]
131- else if ((newCounter >= maxCounter))
132- then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), true), BooleanEntry((itemId + "_final"), false)]
133- else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), false), BooleanEntry((itemId + "_final"), false)]
134- }
135- else [StringEntry(((itemId + "_") + toString(1)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), 1), IntegerEntry((itemId + "_predictionCounter"), 1)]
99+ else {
100+ let predictionCounter = match getInteger((itemId + "_predictionCounter")) {
101+ case s: Int =>
102+ s
103+ case _ =>
104+ -1
105+ }
106+ let lastPredictionAdress = adressList[(size(adressList) - 1)]
107+ let lastPrediction = match getString(((itemId + "_") + lastPredictionAdress)) {
108+ case s: String =>
109+ s
110+ case _ =>
111+ "no Prediction Found"
112+ }
113+ let newCounter = (searchForCounter + 1)
114+ if ((lastPrediction == prediction))
115+ then if (((predictionCounter + 1) == predictionMaxCounter))
116+ then {
117+ let invokeAdjustRating = invoke(this, "adjustRatingsAndPayoutParticipants", [itemId, adressList, clientAdress, prediction], nil)
118+ if ((invokeAdjustRating != invokeAdjustRating))
119+ then throw("Strict value is not equal to itself.")
120+ else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), true), BooleanEntry((itemId + "_cancelled"), false)]
121+ }
122+ else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), false), BooleanEntry((itemId + "_cancelled"), false)]
123+ else if ((newCounter >= maxCounter))
124+ then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), true), BooleanEntry((itemId + "_final"), false)]
125+ else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), false), BooleanEntry((itemId + "_final"), false)]
126+ }
127+ }
128+ else {
129+ let searchForNewItem = match getString(("new_" + itemId)) {
130+ case s: String =>
131+ s
132+ case _ =>
133+ "not Found"
134+ }
135+ if ((searchForNewItem != itemId))
136+ then throw("Item not Found")
137+ else [StringEntry(((itemId + "_") + toString(1)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), 1), IntegerEntry((itemId + "_predictionCounter"), 1), DeleteEntry(("new_" + itemId))]
136138 }
137139 }
138140 }
148150 case _ =>
149151 "No user found"
150152 }
151- if ((searchForUser != "No user Found"))
153+ if ((searchForUser == "No user Found"))
152154 then throw("User already exists")
153155 else [IntegerEntry(clientAdress, defaultRating)]
154156 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let predictionMaxCounter = 3
55
66 let maxCounter = 6
77
88 let defaultRating = 100
99
1010 func searchForCounters (itemId,counter) = {
1111 let searchForCounters = match getString(((itemId + "_") + toString(counter))) {
1212 case s: String =>
1313 s
1414 case _ =>
1515 "No User"
1616 }
1717 searchForCounters
1818 }
1919
2020
2121 func searchForAdressPrediction (itemId,adress) = {
2222 let searchForPrediction = match getString(((itemId + "_") + adress)) {
2323 case s: String =>
2424 s
2525 case _ =>
2626 "Not Found"
2727 }
2828 searchForPrediction
2929 }
3030
3131
3232 func findPredictionAdresses (itemId,counter) = {
3333 let adressList = nil
3434 if ((counter >= 1))
3535 then {
3636 let adress1 = searchForCounters(itemId, 1)
3737 (adressList :+ adress1)
3838 }
3939 else if ((counter >= 2))
4040 then {
4141 let adress1 = searchForCounters(itemId, 1)
4242 let adress2 = searchForCounters(itemId, 2)
4343 ((adressList :+ adress1) :+ adress2)
4444 }
4545 else if ((counter >= 3))
4646 then {
4747 let adress1 = searchForCounters(itemId, 1)
4848 let adress2 = searchForCounters(itemId, 2)
4949 let adress3 = searchForCounters(itemId, 3)
5050 (((adressList :+ adress1) :+ adress2) :+ adress3)
5151 }
5252 else if ((counter >= 4))
5353 then {
5454 let adress1 = searchForCounters(itemId, 1)
5555 let adress2 = searchForCounters(itemId, 2)
5656 let adress3 = searchForCounters(itemId, 3)
5757 let adress4 = searchForCounters(itemId, 4)
5858 ((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4)
5959 }
6060 else {
6161 let adress1 = searchForCounters(itemId, 1)
6262 let adress2 = searchForCounters(itemId, 2)
6363 let adress3 = searchForCounters(itemId, 3)
6464 let adress4 = searchForCounters(itemId, 4)
6565 let adress5 = searchForCounters(itemId, 5)
6666 (((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) :+ adress5)
6767 }
6868 }
6969
7070
7171 @Callable(i)
7272 func adjustRatingsAndPayoutParticipants (itemId,adressList,lastCallerAdress,finalPrediction) = nil
7373
7474
7575
7676 @Callable(i)
7777 func savePrediction (itemId,prediction) = {
7878 let clientAdress = toString(i.caller)
79- let searchForItem = match getString(itemId) {
80- case s: String =>
79+ let searchForUser = match getInteger(clientAdress) {
80+ case s: Int =>
8181 s
8282 case _ =>
83- "no Data exists"
83+ "no User exists"
8484 }
85- if ((searchForItem == "no Data exists"))
86- then throw("This ItemID does not exist!")
85+ if ((searchForUser == "no User exists"))
86+ then throw("User does not exist")
8787 else {
88- let searchForUser = match getInteger(clientAdress) {
88+ let searchForCounter = match getInteger((itemId + "_counter")) {
8989 case s: Int =>
9090 s
9191 case _ =>
92- "no User exists"
92+ -1
9393 }
94- if ((searchForUser == "no User exists"))
95- then throw("User does not exist")
96- else {
97- let searchForCounter = match getInteger((itemId + "_counter")) {
98- case s: Int =>
99- s
100- case _ =>
101- -1
102- }
94+ if ((searchForCounter >= 1))
95+ then {
10396 let adressList = findPredictionAdresses(itemId, searchForCounter)
10497 if (containsElement(adressList, clientAdress))
10598 then throw("This User already gave a Prediction")
106- else if ((searchForCounter >= 1))
107- then {
108- let predictionCounter = match getInteger((itemId + "_predictionCounter")) {
109- case s: Int =>
110- s
111- case _ =>
112- -1
113- }
114- let lastPredictionAdress = adressList[(size(adressList) - 1)]
115- let lastPrediction = match getString(((itemId + "_") + lastPredictionAdress)) {
116- case s: String =>
117- s
118- case _ =>
119- "no Prediction Found"
120- }
121- let newCounter = (searchForCounter + 1)
122- if ((lastPrediction == prediction))
123- then if (((predictionCounter + 1) == predictionMaxCounter))
124- then {
125- let invokeAdjustRating = invoke(this, "adjustRatingsAndPayoutParticipants", [itemId, adressList, clientAdress, prediction], nil)
126- if ((invokeAdjustRating != invokeAdjustRating))
127- then throw("Strict value is not equal to itself.")
128- else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), true), BooleanEntry((itemId + "_cancelled"), false)]
129- }
130- else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), false), BooleanEntry((itemId + "_cancelled"), false)]
131- else if ((newCounter >= maxCounter))
132- then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), true), BooleanEntry((itemId + "_final"), false)]
133- else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), false), BooleanEntry((itemId + "_final"), false)]
134- }
135- else [StringEntry(((itemId + "_") + toString(1)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), 1), IntegerEntry((itemId + "_predictionCounter"), 1)]
99+ else {
100+ let predictionCounter = match getInteger((itemId + "_predictionCounter")) {
101+ case s: Int =>
102+ s
103+ case _ =>
104+ -1
105+ }
106+ let lastPredictionAdress = adressList[(size(adressList) - 1)]
107+ let lastPrediction = match getString(((itemId + "_") + lastPredictionAdress)) {
108+ case s: String =>
109+ s
110+ case _ =>
111+ "no Prediction Found"
112+ }
113+ let newCounter = (searchForCounter + 1)
114+ if ((lastPrediction == prediction))
115+ then if (((predictionCounter + 1) == predictionMaxCounter))
116+ then {
117+ let invokeAdjustRating = invoke(this, "adjustRatingsAndPayoutParticipants", [itemId, adressList, clientAdress, prediction], nil)
118+ if ((invokeAdjustRating != invokeAdjustRating))
119+ then throw("Strict value is not equal to itself.")
120+ else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), true), BooleanEntry((itemId + "_cancelled"), false)]
121+ }
122+ else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter + 1)), BooleanEntry((itemId + "_final"), false), BooleanEntry((itemId + "_cancelled"), false)]
123+ else if ((newCounter >= maxCounter))
124+ then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), true), BooleanEntry((itemId + "_final"), false)]
125+ else [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), (predictionCounter - 1)), BooleanEntry((itemId + "_cancelled"), false), BooleanEntry((itemId + "_final"), false)]
126+ }
127+ }
128+ else {
129+ let searchForNewItem = match getString(("new_" + itemId)) {
130+ case s: String =>
131+ s
132+ case _ =>
133+ "not Found"
134+ }
135+ if ((searchForNewItem != itemId))
136+ then throw("Item not Found")
137+ else [StringEntry(((itemId + "_") + toString(1)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), 1), IntegerEntry((itemId + "_predictionCounter"), 1), DeleteEntry(("new_" + itemId))]
136138 }
137139 }
138140 }
139141
140142
141143
142144 @Callable(i)
143145 func registerUser () = {
144146 let clientAdress = toString(i.caller)
145147 let searchForUser = match getInteger(clientAdress) {
146148 case s: Int =>
147149 s
148150 case _ =>
149151 "No user found"
150152 }
151- if ((searchForUser != "No user Found"))
153+ if ((searchForUser == "No user Found"))
152154 then throw("User already exists")
153155 else [IntegerEntry(clientAdress, defaultRating)]
154156 }
155157
156158
157159 @Verifier(tx)
158160 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
159161

github/deemru/w8io/026f985 
45.60 ms