tx · DSgTqxw9vomsU4KfLjjYLMDUdJW3rkYPafHn4q1sR39k

3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos:  -0.01100000 Waves

2024.05.14 15:34 [3105693] smart account 3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos > SELF 0.00000000 Waves

{ "type": 13, "id": "DSgTqxw9vomsU4KfLjjYLMDUdJW3rkYPafHn4q1sR39k", "fee": 1100000, "feeAssetId": null, "timestamp": 1715690012471, "version": 2, "chainId": 84, "sender": "3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos", "senderPublicKey": "F7SLwr7RYVQpyocmVScFC6ooaAwewaGq6wNRDYvyiPj1", "proofs": [ "S9S1jQY2n7VQqorZbqPVPSBAXFgSKuX3bRuUUjUnMdgwtY7GYsE9Madi8AZDZAB6UDqysEABxoCXb3PjSTb7UPh" ], "script": "base64:AAIFAAAAAAAAAAoIAhIECgIICBIAAAAABAAAAAAKbWF4Q291bnRlcgAAAAAAAAAAAwAAAAANZGVmYXVsdFJhdGluZwAAAAAAAAAAZAEAAAAUc2VhcmNoRm9yUHJlZGljdGlvbnMAAAACAAAABml0ZW1JZAAAAAdjb3VudGVyBAAAABBzZWFyY2hGb3JDb3VudGVyBAAAAAckbWF0Y2gwCQAEIgAAAAEJAAEsAAAAAgkAASwAAAACBQAAAAZpdGVtSWQCAAAAAV8JAAGkAAAAAQUAAAAHY291bnRlcgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAgAAAAdObyBVc2VyBQAAABBzZWFyY2hGb3JDb3VudGVyAQAAABZmaW5kUHJlZGljdGlvbkFkcmVzc2VzAAAAAgAAAAZpdGVtSWQAAAAHY291bnRlcgQAAAAKYWRyZXNzTGlzdAUAAAADbmlsAwkAAGcAAAACBQAAAAdjb3VudGVyAAAAAAAAAAABBAAAAAdhZHJlc3MxCQEAAAAUc2VhcmNoRm9yUHJlZGljdGlvbn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0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXl13gjJ", "height": 3105693, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CfPFMxDkvxFr4BNcWpW6bPkg8vErv18DZzvLyPdKLwaA Next: 3LznDyEZnroS5VU5YsA1EM8VP4seozQ42jUfKGmdFDu5 Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let maxCounter = 3
55
6+let defaultRating = 100
7+
68 func searchForPredictions (itemId,counter) = {
7- let searchForUser = match getString(((itemId + "_") + toString(counter))) {
9+ let searchForCounter = match getString(((itemId + "_") + toString(counter))) {
810 case s: String =>
911 s
1012 case _ =>
1113 "No User"
1214 }
13- searchForUser
15+ searchForCounter
1416 }
1517
1618
6567 if ((searchForItem == "no Data exists"))
6668 then throw("This ItemID does not exist!")
6769 else {
68- let searchForUser = match getString(clientAdress) {
69- case s: String =>
70+ let searchForUser = match getInteger(clientAdress) {
71+ case s: Int =>
7072 s
7173 case _ =>
7274 "no User exists"
113115 }
114116
115117
118+
119+@Callable(i)
120+func registerUser () = {
121+ let clientAdress = toString(i.caller)
122+ let searchForUser = match getInteger(clientAdress) {
123+ case s: Int =>
124+ s
125+ case _ =>
126+ "No user found"
127+ }
128+ if ((searchForUser != "No user Found"))
129+ then throw("User already exists")
130+ else [IntegerEntry(clientAdress, defaultRating)]
131+ }
132+
133+
116134 @Verifier(tx)
117135 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
118136
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let maxCounter = 3
55
6+let defaultRating = 100
7+
68 func searchForPredictions (itemId,counter) = {
7- let searchForUser = match getString(((itemId + "_") + toString(counter))) {
9+ let searchForCounter = match getString(((itemId + "_") + toString(counter))) {
810 case s: String =>
911 s
1012 case _ =>
1113 "No User"
1214 }
13- searchForUser
15+ searchForCounter
1416 }
1517
1618
1719 func findPredictionAdresses (itemId,counter) = {
1820 let adressList = nil
1921 if ((counter >= 1))
2022 then {
2123 let adress1 = searchForPredictions(itemId, 1)
2224 (adressList :+ adress1)
2325 }
2426 else if ((counter >= 2))
2527 then {
2628 let adress1 = searchForPredictions(itemId, 1)
2729 let adress2 = searchForPredictions(itemId, 2)
2830 ((adressList :+ adress1) :+ adress2)
2931 }
3032 else if ((counter >= 3))
3133 then {
3234 let adress1 = searchForPredictions(itemId, 1)
3335 let adress2 = searchForPredictions(itemId, 2)
3436 let adress3 = searchForPredictions(itemId, 3)
3537 (((adressList :+ adress1) :+ adress2) :+ adress3)
3638 }
3739 else if ((counter >= 4))
3840 then {
3941 let adress1 = searchForPredictions(itemId, 1)
4042 let adress2 = searchForPredictions(itemId, 2)
4143 let adress3 = searchForPredictions(itemId, 3)
4244 let adress4 = searchForPredictions(itemId, 4)
4345 ((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4)
4446 }
4547 else {
4648 let adress1 = searchForPredictions(itemId, 1)
4749 let adress2 = searchForPredictions(itemId, 2)
4850 let adress3 = searchForPredictions(itemId, 3)
4951 let adress4 = searchForPredictions(itemId, 4)
5052 let adress5 = searchForPredictions(itemId, 5)
5153 (((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) :+ adress5)
5254 }
5355 }
5456
5557
5658 @Callable(i)
5759 func savePrediction (itemId,prediction) = {
5860 let clientAdress = toString(i.caller)
5961 let searchForItem = match getString(itemId) {
6062 case s: String =>
6163 s
6264 case _ =>
6365 "no Data exists"
6466 }
6567 if ((searchForItem == "no Data exists"))
6668 then throw("This ItemID does not exist!")
6769 else {
68- let searchForUser = match getString(clientAdress) {
69- case s: String =>
70+ let searchForUser = match getInteger(clientAdress) {
71+ case s: Int =>
7072 s
7173 case _ =>
7274 "no User exists"
7375 }
7476 if ((searchForUser == "no User exists"))
7577 then throw("User does not exist")
7678 else {
7779 let searchForCounter = match getInteger((itemId + "_counter")) {
7880 case s: Int =>
7981 s
8082 case _ =>
8183 -1
8284 }
8385 let adressList = findPredictionAdresses(itemId, searchForCounter)
8486 if (containsElement(adressList, clientAdress))
8587 then throw("This User already gave a Prediction")
8688 else if ((searchForCounter >= 1))
8789 then {
8890 let predictionCounter = match getInteger((itemId + "_predictionCounter")) {
8991 case s: Int =>
9092 s
9193 case _ =>
9294 -1
9395 }
9496 let lastPredictionAdress = adressList[(size(adressList) - 1)]
9597 let lastPrediction = match getString(((itemId + "_") + lastPredictionAdress)) {
9698 case s: String =>
9799 s
98100 case _ =>
99101 "no Prediction Found"
100102 }
101103 let newCounter = (searchForCounter + 1)
102104 if ((lastPrediction == prediction))
103105 then if (((predictionCounter + 1) == maxCounter))
104106 then [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)]
105107 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)]
106108 else if ((newCounter >= 6))
107109 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)]
108110 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)]
109111 }
110112 else [StringEntry(((itemId + "_") + toString(1)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), 1), IntegerEntry((itemId + "_predictionCounter"), 1)]
111113 }
112114 }
113115 }
114116
115117
118+
119+@Callable(i)
120+func registerUser () = {
121+ let clientAdress = toString(i.caller)
122+ let searchForUser = match getInteger(clientAdress) {
123+ case s: Int =>
124+ s
125+ case _ =>
126+ "No user found"
127+ }
128+ if ((searchForUser != "No user Found"))
129+ then throw("User already exists")
130+ else [IntegerEntry(clientAdress, defaultRating)]
131+ }
132+
133+
116134 @Verifier(tx)
117135 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
118136

github/deemru/w8io/026f985 
41.74 ms