tx · 3LznDyEZnroS5VU5YsA1EM8VP4seozQ42jUfKGmdFDu5

3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos:  -0.01400000 Waves

2024.05.20 20:14 [3114615] smart account 3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos > SELF 0.00000000 Waves

{ "type": 13, "id": "3LznDyEZnroS5VU5YsA1EM8VP4seozQ42jUfKGmdFDu5", "fee": 1400000, "feeAssetId": null, "timestamp": 1716225370018, "version": 2, "chainId": 84, "sender": "3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos", "senderPublicKey": "F7SLwr7RYVQpyocmVScFC6ooaAwewaGq6wNRDYvyiPj1", "proofs": [ "5b87tuvrhB7FJpToNeRxoNWU8FtZahbr8fqDtY9pPon4adaTxsHzjZssEByhn59PHcYwMT3u4HvgSWkFE8ArbSN7" ], "script": "base64:AAIFAAAAAAAAABIIAhIGCgQIGAgIEgQKAggIEgAAAAAGAAAAABRwcmVkaWN0aW9uTWF4Q291bnRlcgAAAAAAAAAAAwAAAAAKbWF4Q291bnRlcgAAAAAAAAAABgAAAAANZGVmYXVsdFJhdGluZwAAAAAAAAAAZAEAAAARc2VhcmNoRm9yQ291bnRlcnMAAAACAAAABml0ZW1JZAAAAAdjb3VudGVyBAAAABFzZWFyY2hGb3JDb3VudGVycwQAAAAHJG1hdGNoMAkABCIAAAABCQABLAAAAAIJAAEsAAAAAgUAAAAGaXRlbUlkAgAAAAFfCQABpAAAAAEFAAAAB2NvdW50ZXIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwIAAAAHTm8gVXNlcgUAAAARc2VhcmNoRm9yQ291bnRlcnMBAAAAGXNlYXJjaEZvckFkcmVzc1ByZWRpY3Rpb24AAAACAAAABml0ZW1JZAAAAAZhZHJlc3MEAAAAE3NlYXJjaEZvclByZWRpY3Rpb24EAAAAByRtYXRjaDAJAAQiAAAAAQkAASwAAAACCQABLA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AIJAAEsAAAAAgUAAAAGaXRlbUlkAgAAAAFfBQAAAAxjbGllbnRBZHJlc3MFAAAACnByZWRpY3Rpb24JAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAAGaXRlbUlkAgAAAAhfY291bnRlcgAAAAAAAAAAAQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACBQAAAAZpdGVtSWQCAAAAEl9wcmVkaWN0aW9uQ291bnRlcgAAAAAAAAAAAQUAAAADbmlsAAAAAWkBAAAADHJlZ2lzdGVyVXNlcgAAAAAEAAAADGNsaWVudEFkcmVzcwkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIEAAAADXNlYXJjaEZvclVzZXIEAAAAByRtYXRjaDAJAAQfAAAAAQUAAAAMY2xpZW50QWRyZXNzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXMFAAAAByRtYXRjaDAFAAAAAXMCAAAADU5vIHVzZXIgZm91bmQDCQEAAAACIT0AAAACBQAAAA1zZWFyY2hGb3JVc2VyAgAAAA1ObyB1c2VyIEZvdW5kCQAAAgAAAAECAAAAE1VzZXIgYWxyZWFkeSBleGlzdHMJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAADGNsaWVudEFkcmVzcwUAAAANZGVmYXVsdFJhdGluZwUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXl78AQm", "height": 3114615, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DSgTqxw9vomsU4KfLjjYLMDUdJW3rkYPafHn4q1sR39k Next: DiALfCc5dpcEZ9R5BeV8H2yK3w1n4NT6hyjMVwu3MxWK Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let maxCounter = 3
4+let predictionMaxCounter = 3
5+
6+let maxCounter = 6
57
68 let defaultRating = 100
79
8-func searchForPredictions (itemId,counter) = {
9- let searchForCounter = match getString(((itemId + "_") + toString(counter))) {
10+func searchForCounters (itemId,counter) = {
11+ let searchForCounters = match getString(((itemId + "_") + toString(counter))) {
1012 case s: String =>
1113 s
1214 case _ =>
1315 "No User"
1416 }
15- searchForCounter
17+ searchForCounters
18+ }
19+
20+
21+func searchForAdressPrediction (itemId,adress) = {
22+ let searchForPrediction = match getString(((itemId + "_") + adress)) {
23+ case s: String =>
24+ s
25+ case _ =>
26+ "Not Found"
27+ }
28+ searchForPrediction
1629 }
1730
1831
2033 let adressList = nil
2134 if ((counter >= 1))
2235 then {
23- let adress1 = searchForPredictions(itemId, 1)
36+ let adress1 = searchForCounters(itemId, 1)
2437 (adressList :+ adress1)
2538 }
2639 else if ((counter >= 2))
2740 then {
28- let adress1 = searchForPredictions(itemId, 1)
29- let adress2 = searchForPredictions(itemId, 2)
41+ let adress1 = searchForCounters(itemId, 1)
42+ let adress2 = searchForCounters(itemId, 2)
3043 ((adressList :+ adress1) :+ adress2)
3144 }
3245 else if ((counter >= 3))
3346 then {
34- let adress1 = searchForPredictions(itemId, 1)
35- let adress2 = searchForPredictions(itemId, 2)
36- let adress3 = searchForPredictions(itemId, 3)
47+ let adress1 = searchForCounters(itemId, 1)
48+ let adress2 = searchForCounters(itemId, 2)
49+ let adress3 = searchForCounters(itemId, 3)
3750 (((adressList :+ adress1) :+ adress2) :+ adress3)
3851 }
3952 else if ((counter >= 4))
4053 then {
41- let adress1 = searchForPredictions(itemId, 1)
42- let adress2 = searchForPredictions(itemId, 2)
43- let adress3 = searchForPredictions(itemId, 3)
44- let adress4 = searchForPredictions(itemId, 4)
54+ let adress1 = searchForCounters(itemId, 1)
55+ let adress2 = searchForCounters(itemId, 2)
56+ let adress3 = searchForCounters(itemId, 3)
57+ let adress4 = searchForCounters(itemId, 4)
4558 ((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4)
4659 }
4760 else {
48- let adress1 = searchForPredictions(itemId, 1)
49- let adress2 = searchForPredictions(itemId, 2)
50- let adress3 = searchForPredictions(itemId, 3)
51- let adress4 = searchForPredictions(itemId, 4)
52- let adress5 = searchForPredictions(itemId, 5)
61+ let adress1 = searchForCounters(itemId, 1)
62+ let adress2 = searchForCounters(itemId, 2)
63+ let adress3 = searchForCounters(itemId, 3)
64+ let adress4 = searchForCounters(itemId, 4)
65+ let adress5 = searchForCounters(itemId, 5)
5366 (((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) :+ adress5)
5467 }
5568 }
69+
70+
71+@Callable(i)
72+func adjustRatingsAndPayoutParticipants (itemId,adressList,lastCallerAdress,finalPrediction) = nil
73+
5674
5775
5876 @Callable(i)
102120 }
103121 let newCounter = (searchForCounter + 1)
104122 if ((lastPrediction == prediction))
105- then if (((predictionCounter + 1) == maxCounter))
106- 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)]
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+ }
107130 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)]
108- else if ((newCounter >= 6))
131+ else if ((newCounter >= maxCounter))
109132 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)]
110133 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)]
111134 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let maxCounter = 3
4+let predictionMaxCounter = 3
5+
6+let maxCounter = 6
57
68 let defaultRating = 100
79
8-func searchForPredictions (itemId,counter) = {
9- let searchForCounter = match getString(((itemId + "_") + toString(counter))) {
10+func searchForCounters (itemId,counter) = {
11+ let searchForCounters = match getString(((itemId + "_") + toString(counter))) {
1012 case s: String =>
1113 s
1214 case _ =>
1315 "No User"
1416 }
15- searchForCounter
17+ searchForCounters
18+ }
19+
20+
21+func searchForAdressPrediction (itemId,adress) = {
22+ let searchForPrediction = match getString(((itemId + "_") + adress)) {
23+ case s: String =>
24+ s
25+ case _ =>
26+ "Not Found"
27+ }
28+ searchForPrediction
1629 }
1730
1831
1932 func findPredictionAdresses (itemId,counter) = {
2033 let adressList = nil
2134 if ((counter >= 1))
2235 then {
23- let adress1 = searchForPredictions(itemId, 1)
36+ let adress1 = searchForCounters(itemId, 1)
2437 (adressList :+ adress1)
2538 }
2639 else if ((counter >= 2))
2740 then {
28- let adress1 = searchForPredictions(itemId, 1)
29- let adress2 = searchForPredictions(itemId, 2)
41+ let adress1 = searchForCounters(itemId, 1)
42+ let adress2 = searchForCounters(itemId, 2)
3043 ((adressList :+ adress1) :+ adress2)
3144 }
3245 else if ((counter >= 3))
3346 then {
34- let adress1 = searchForPredictions(itemId, 1)
35- let adress2 = searchForPredictions(itemId, 2)
36- let adress3 = searchForPredictions(itemId, 3)
47+ let adress1 = searchForCounters(itemId, 1)
48+ let adress2 = searchForCounters(itemId, 2)
49+ let adress3 = searchForCounters(itemId, 3)
3750 (((adressList :+ adress1) :+ adress2) :+ adress3)
3851 }
3952 else if ((counter >= 4))
4053 then {
41- let adress1 = searchForPredictions(itemId, 1)
42- let adress2 = searchForPredictions(itemId, 2)
43- let adress3 = searchForPredictions(itemId, 3)
44- let adress4 = searchForPredictions(itemId, 4)
54+ let adress1 = searchForCounters(itemId, 1)
55+ let adress2 = searchForCounters(itemId, 2)
56+ let adress3 = searchForCounters(itemId, 3)
57+ let adress4 = searchForCounters(itemId, 4)
4558 ((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4)
4659 }
4760 else {
48- let adress1 = searchForPredictions(itemId, 1)
49- let adress2 = searchForPredictions(itemId, 2)
50- let adress3 = searchForPredictions(itemId, 3)
51- let adress4 = searchForPredictions(itemId, 4)
52- let adress5 = searchForPredictions(itemId, 5)
61+ let adress1 = searchForCounters(itemId, 1)
62+ let adress2 = searchForCounters(itemId, 2)
63+ let adress3 = searchForCounters(itemId, 3)
64+ let adress4 = searchForCounters(itemId, 4)
65+ let adress5 = searchForCounters(itemId, 5)
5366 (((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) :+ adress5)
5467 }
5568 }
69+
70+
71+@Callable(i)
72+func adjustRatingsAndPayoutParticipants (itemId,adressList,lastCallerAdress,finalPrediction) = nil
73+
5674
5775
5876 @Callable(i)
5977 func savePrediction (itemId,prediction) = {
6078 let clientAdress = toString(i.caller)
6179 let searchForItem = match getString(itemId) {
6280 case s: String =>
6381 s
6482 case _ =>
6583 "no Data exists"
6684 }
6785 if ((searchForItem == "no Data exists"))
6886 then throw("This ItemID does not exist!")
6987 else {
7088 let searchForUser = match getInteger(clientAdress) {
7189 case s: Int =>
7290 s
7391 case _ =>
7492 "no User exists"
7593 }
7694 if ((searchForUser == "no User exists"))
7795 then throw("User does not exist")
7896 else {
7997 let searchForCounter = match getInteger((itemId + "_counter")) {
8098 case s: Int =>
8199 s
82100 case _ =>
83101 -1
84102 }
85103 let adressList = findPredictionAdresses(itemId, searchForCounter)
86104 if (containsElement(adressList, clientAdress))
87105 then throw("This User already gave a Prediction")
88106 else if ((searchForCounter >= 1))
89107 then {
90108 let predictionCounter = match getInteger((itemId + "_predictionCounter")) {
91109 case s: Int =>
92110 s
93111 case _ =>
94112 -1
95113 }
96114 let lastPredictionAdress = adressList[(size(adressList) - 1)]
97115 let lastPrediction = match getString(((itemId + "_") + lastPredictionAdress)) {
98116 case s: String =>
99117 s
100118 case _ =>
101119 "no Prediction Found"
102120 }
103121 let newCounter = (searchForCounter + 1)
104122 if ((lastPrediction == prediction))
105- then if (((predictionCounter + 1) == maxCounter))
106- 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)]
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+ }
107130 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)]
108- else if ((newCounter >= 6))
131+ else if ((newCounter >= maxCounter))
109132 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)]
110133 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)]
111134 }
112135 else [StringEntry(((itemId + "_") + toString(1)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), 1), IntegerEntry((itemId + "_predictionCounter"), 1)]
113136 }
114137 }
115138 }
116139
117140
118141
119142 @Callable(i)
120143 func registerUser () = {
121144 let clientAdress = toString(i.caller)
122145 let searchForUser = match getInteger(clientAdress) {
123146 case s: Int =>
124147 s
125148 case _ =>
126149 "No user found"
127150 }
128151 if ((searchForUser != "No user Found"))
129152 then throw("User already exists")
130153 else [IntegerEntry(clientAdress, defaultRating)]
131154 }
132155
133156
134157 @Verifier(tx)
135158 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
136159

github/deemru/w8io/026f985 
53.82 ms