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:AAIFAAAAAAAAABIIAhIGCgQIGAgIEgQKAggIEgAAAAAGAAAAABRwcmVkaWN0aW9uTWF4Q291bnRlcgAAAAAAAAAAAwAAAAAKbWF4Q291bnRlcgAAAAAAAAAABgAAAAANZGVmYXVsdFJhdGluZwAAAAAAAAAAZAEAAAARc2VhcmNoRm9yQ291bnRlcnMAAAACAAAABml0ZW1JZAAAAAdjb3VudGVyBAAAABFzZWFyY2hGb3JDb3VudGVycwQAAAAHJG1hdGNoMAkABCIAAAABCQABLAAAAAIJAAEsAAAAAgUAAAAGaXRlbUlkAgAAAAFfCQABpAAAAAEFAAAAB2NvdW50ZXIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwIAAAAHTm8gVXNlcgUAAAARc2VhcmNoRm9yQ291bnRlcnMBAAAAGXNlYXJjaEZvckFkcmVzc1ByZWRpY3Rpb24AAA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JsaWNLZXmapnfJ", "height": 3115816, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3LznDyEZnroS5VU5YsA1EM8VP4seozQ42jUfKGmdFDu5 Next: HxNKxsgNGbQux9D7QJfjmTtfZ45fuVu8Qk4Hecd1aMBE Diff:
Old | New | Differences | |
---|---|---|---|
76 | 76 | @Callable(i) | |
77 | 77 | func savePrediction (itemId,prediction) = { | |
78 | 78 | let clientAdress = toString(i.caller) | |
79 | - | let | |
80 | - | case s: | |
79 | + | let searchForUser = match getInteger(clientAdress) { | |
80 | + | case s: Int => | |
81 | 81 | s | |
82 | 82 | case _ => | |
83 | - | "no | |
83 | + | "no User exists" | |
84 | 84 | } | |
85 | - | if (( | |
86 | - | then throw(" | |
85 | + | if ((searchForUser == "no User exists")) | |
86 | + | then throw("User does not exist") | |
87 | 87 | else { | |
88 | - | let | |
88 | + | let searchForCounter = match getInteger((itemId + "_counter")) { | |
89 | 89 | case s: Int => | |
90 | 90 | s | |
91 | 91 | case _ => | |
92 | - | | |
92 | + | -1 | |
93 | 93 | } | |
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 { | |
103 | 96 | let adressList = findPredictionAdresses(itemId, searchForCounter) | |
104 | 97 | if (containsElement(adressList, clientAdress)) | |
105 | 98 | 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))] | |
136 | 138 | } | |
137 | 139 | } | |
138 | 140 | } | |
148 | 150 | case _ => | |
149 | 151 | "No user found" | |
150 | 152 | } | |
151 | - | if ((searchForUser | |
153 | + | if ((searchForUser == "No user Found")) | |
152 | 154 | then throw("User already exists") | |
153 | 155 | else [IntegerEntry(clientAdress, defaultRating)] | |
154 | 156 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let predictionMaxCounter = 3 | |
5 | 5 | ||
6 | 6 | let maxCounter = 6 | |
7 | 7 | ||
8 | 8 | let defaultRating = 100 | |
9 | 9 | ||
10 | 10 | func searchForCounters (itemId,counter) = { | |
11 | 11 | let searchForCounters = match getString(((itemId + "_") + toString(counter))) { | |
12 | 12 | case s: String => | |
13 | 13 | s | |
14 | 14 | case _ => | |
15 | 15 | "No User" | |
16 | 16 | } | |
17 | 17 | searchForCounters | |
18 | 18 | } | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func searchForAdressPrediction (itemId,adress) = { | |
22 | 22 | let searchForPrediction = match getString(((itemId + "_") + adress)) { | |
23 | 23 | case s: String => | |
24 | 24 | s | |
25 | 25 | case _ => | |
26 | 26 | "Not Found" | |
27 | 27 | } | |
28 | 28 | searchForPrediction | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func findPredictionAdresses (itemId,counter) = { | |
33 | 33 | let adressList = nil | |
34 | 34 | if ((counter >= 1)) | |
35 | 35 | then { | |
36 | 36 | let adress1 = searchForCounters(itemId, 1) | |
37 | 37 | (adressList :+ adress1) | |
38 | 38 | } | |
39 | 39 | else if ((counter >= 2)) | |
40 | 40 | then { | |
41 | 41 | let adress1 = searchForCounters(itemId, 1) | |
42 | 42 | let adress2 = searchForCounters(itemId, 2) | |
43 | 43 | ((adressList :+ adress1) :+ adress2) | |
44 | 44 | } | |
45 | 45 | else if ((counter >= 3)) | |
46 | 46 | then { | |
47 | 47 | let adress1 = searchForCounters(itemId, 1) | |
48 | 48 | let adress2 = searchForCounters(itemId, 2) | |
49 | 49 | let adress3 = searchForCounters(itemId, 3) | |
50 | 50 | (((adressList :+ adress1) :+ adress2) :+ adress3) | |
51 | 51 | } | |
52 | 52 | else if ((counter >= 4)) | |
53 | 53 | then { | |
54 | 54 | let adress1 = searchForCounters(itemId, 1) | |
55 | 55 | let adress2 = searchForCounters(itemId, 2) | |
56 | 56 | let adress3 = searchForCounters(itemId, 3) | |
57 | 57 | let adress4 = searchForCounters(itemId, 4) | |
58 | 58 | ((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) | |
59 | 59 | } | |
60 | 60 | else { | |
61 | 61 | let adress1 = searchForCounters(itemId, 1) | |
62 | 62 | let adress2 = searchForCounters(itemId, 2) | |
63 | 63 | let adress3 = searchForCounters(itemId, 3) | |
64 | 64 | let adress4 = searchForCounters(itemId, 4) | |
65 | 65 | let adress5 = searchForCounters(itemId, 5) | |
66 | 66 | (((((adressList :+ adress1) :+ adress2) :+ adress3) :+ adress4) :+ adress5) | |
67 | 67 | } | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | @Callable(i) | |
72 | 72 | func adjustRatingsAndPayoutParticipants (itemId,adressList,lastCallerAdress,finalPrediction) = nil | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | ||
76 | 76 | @Callable(i) | |
77 | 77 | func savePrediction (itemId,prediction) = { | |
78 | 78 | let clientAdress = toString(i.caller) | |
79 | - | let | |
80 | - | case s: | |
79 | + | let searchForUser = match getInteger(clientAdress) { | |
80 | + | case s: Int => | |
81 | 81 | s | |
82 | 82 | case _ => | |
83 | - | "no | |
83 | + | "no User exists" | |
84 | 84 | } | |
85 | - | if (( | |
86 | - | then throw(" | |
85 | + | if ((searchForUser == "no User exists")) | |
86 | + | then throw("User does not exist") | |
87 | 87 | else { | |
88 | - | let | |
88 | + | let searchForCounter = match getInteger((itemId + "_counter")) { | |
89 | 89 | case s: Int => | |
90 | 90 | s | |
91 | 91 | case _ => | |
92 | - | | |
92 | + | -1 | |
93 | 93 | } | |
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 { | |
103 | 96 | let adressList = findPredictionAdresses(itemId, searchForCounter) | |
104 | 97 | if (containsElement(adressList, clientAdress)) | |
105 | 98 | 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))] | |
136 | 138 | } | |
137 | 139 | } | |
138 | 140 | } | |
139 | 141 | ||
140 | 142 | ||
141 | 143 | ||
142 | 144 | @Callable(i) | |
143 | 145 | func registerUser () = { | |
144 | 146 | let clientAdress = toString(i.caller) | |
145 | 147 | let searchForUser = match getInteger(clientAdress) { | |
146 | 148 | case s: Int => | |
147 | 149 | s | |
148 | 150 | case _ => | |
149 | 151 | "No user found" | |
150 | 152 | } | |
151 | - | if ((searchForUser | |
153 | + | if ((searchForUser == "No user Found")) | |
152 | 154 | then throw("User already exists") | |
153 | 155 | else [IntegerEntry(clientAdress, defaultRating)] | |
154 | 156 | } | |
155 | 157 | ||
156 | 158 | ||
157 | 159 | @Verifier(tx) | |
158 | 160 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
159 | 161 |
github/deemru/w8io/026f985 45.60 ms ◑