tx · CG4LMwoRBTcQHvB95Nkr8qdzqZvHtDhShHnwfg2HLLwK 3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos: -0.01500000 Waves 2024.06.03 17:00 [3134595] smart account 3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos > SELF 0.00000000 Waves
{ "type": 13, "id": "CG4LMwoRBTcQHvB95Nkr8qdzqZvHtDhShHnwfg2HLLwK", "fee": 1500000, "feeAssetId": null, "timestamp": 1717423234359, "version": 2, "chainId": 84, "sender": "3N8YkRZsgDVNAxtmwU1F65EpcYMb8f7QPos", "senderPublicKey": "F7SLwr7RYVQpyocmVScFC6ooaAwewaGq6wNRDYvyiPj1", "proofs": [ "2Ye2WejVeJLhke8vdMdXYSLew91eWZKfhXCYBAhBZ68SNvZzVmzSjishHdFqkDpbrNN4TY8PWCKrLvwohaeJnaLa" ], "script": "base64:AAIFAAAAAAAAABIIAhIGCgQIGAgIEgQKAggIEgAAAAAPAAAAABRwcmVkaWN0aW9uTWF4Q291bnRlcgAAAAAAAAAAAwAAAAAKbWF4Q291bnRlcgAAAAAAAAAABgAAAAANZGVmYXVsdFJhdGluZwAAAAAAAAAAZAAAAAAOcmF0ZUFkanVzdG1lbnQAAAAAAAAAABQAAAAAB3Rva2VuSWQBAAAAIG33eiemmz/8i1OVqeOeBVscIi9bTehRMFsBoQapAMYYAAAAAAxwYXlvdXRBbW91bnQAAAAAAAX14QAAAAAADHJhdGluZ0N1dG9mZgAAAAAAAAAAMgAAAAAJcl9hdmVyYWdlAAAAAAAAAABkAQAAABFzZWFyY2hGb3JDb3VudGVycwAAAAIAAAAGaXRlbUlkAAAAB2NvdW50ZXIEAAAAEXNlYXJjaEZvckNvdW50ZXJzBAAAAAckbWF0Y2gwCQAEIgAAAAEJAAEsAAAAAgkAASwAAAACBQAAAAZpdGVtSWQCAAAAAV8JAAGkAAAAAQUAAAAHY291bnRlcgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAA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UmF0aW5nBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleWP9Pgk=", "height": 3134595, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8GKfovNdPx94daFZHUpSV8YKdY2AmNHq2XXKvpzkh1eo Next: 4JAZrZeJ6BDKXU99bBXkcwG4ss36BbYyWNUqtRLBqifM Diff:
Old | New | Differences | |
---|---|---|---|
14 | 14 | let payoutAmount = 100000000 | |
15 | 15 | ||
16 | 16 | let ratingCutoff = 50 | |
17 | + | ||
18 | + | let r_average = 100 | |
17 | 19 | ||
18 | 20 | func searchForCounters (itemId,counter) = { | |
19 | 21 | let searchForCounters = match getString(((itemId + "_") + toString(counter))) { | |
87 | 89 | } | |
88 | 90 | ||
89 | 91 | ||
92 | + | func calculateExpectedScore (r_player,r_average) = { | |
93 | + | let diff = (r_average - r_player) | |
94 | + | let exponent = (diff / r_average) | |
95 | + | let powerOfTen = pow(10, 0, exponent, 0, 0, HALFUP) | |
96 | + | let denominator = (1 + powerOfTen) | |
97 | + | (1 / denominator) | |
98 | + | } | |
99 | + | ||
100 | + | ||
101 | + | func calculatePayout (r_player,r_average) = { | |
102 | + | let ratio = ((r_player * 100) / r_average) | |
103 | + | let payout = ((payoutAmount * ratio) / 100) | |
104 | + | payout | |
105 | + | } | |
106 | + | ||
107 | + | ||
108 | + | func calculateNewRating (r_player,r_average,k,actualScore) = { | |
109 | + | let expectedScore = calculateExpectedScore(r_player, r_average) | |
110 | + | let delta_r = (k * (actualScore - expectedScore)) | |
111 | + | (r_player + delta_r) | |
112 | + | } | |
113 | + | ||
114 | + | ||
90 | 115 | @Callable(i) | |
91 | 116 | func adjustRatingsAndPayoutParticipants (itemId,addressList,lastCallerAddress,finalPrediction) = { | |
92 | 117 | let caller = toString(i.caller) | |
96 | 121 | func updateRatingsFunc (accum,address) = { | |
97 | 122 | let rating = searchForRating(address) | |
98 | 123 | let prediction = searchForAddressPrediction(itemId, address) | |
99 | - | let updatedRating = if ((prediction == finalPrediction)) | |
100 | - | then (rating + rateAdjustment) | |
101 | - | else (rating - rateAdjustment) | |
124 | + | let actualScore = if ((prediction == finalPrediction)) | |
125 | + | then 1 | |
126 | + | else 0 | |
127 | + | let newRating = calculateNewRating(rating, r_average, rateAdjustment, actualScore) | |
102 | 128 | let payout = if ((prediction == finalPrediction)) | |
103 | - | then payoutAmount | |
104 | - | else 0 | |
105 | - | let updatedEntries = (accum :+ IntegerEntry(address, updatedRating)) | |
106 | - | if ((payout > 0)) | |
107 | - | then (updatedEntries :+ ScriptTransfer(Address(fromBase58String(address)), payout, tokenId)) | |
129 | + | then true | |
130 | + | else false | |
131 | + | let updatedEntries = (accum :+ IntegerEntry((address + "_rating"), newRating)) | |
132 | + | let calculatedAmount = calculatePayout(newRating, r_average) | |
133 | + | if (payout) | |
134 | + | then (updatedEntries :+ ScriptTransfer(Address(fromBase58String(address)), calculatedAmount, tokenId)) | |
108 | 135 | else updatedEntries | |
109 | 136 | } | |
110 | 137 | ||
191 | 218 | if ((lastPrediction == prediction)) | |
192 | 219 | then if (((predictionCounter + 1) == predictionMaxCounter)) | |
193 | 220 | then { | |
221 | + | let newRating = calculateNewRating(clientRating, r_average, rateAdjustment, 1) | |
222 | + | let calculatedAmount = calculatePayout(newRating, r_average) | |
194 | 223 | let invokeAdjustRating = invoke(this, "adjustRatingsAndPayoutParticipants", [itemId, adressList, clientAdress, prediction], nil) | |
195 | 224 | if ((invokeAdjustRating != invokeAdjustRating)) | |
196 | 225 | then throw("Strict value is not equal to itself.") | |
197 | - | 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), ScriptTransfer(Address(fromBase58String(clientAdress)), | |
226 | + | 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), ScriptTransfer(Address(fromBase58String(clientAdress)), calculatedAmount, tokenId), IntegerEntry((clientAdress + "_rating"), newRating)] | |
198 | 227 | } | |
199 | 228 | 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)] | |
200 | 229 | else if ((newCounter >= maxCounter)) | |
226 | 255 | @Callable(i) | |
227 | 256 | func registerUser () = { | |
228 | 257 | let clientAdress = toString(i.caller) | |
229 | - | let searchForUser = match getInteger(clientAdress) { | |
258 | + | let searchForUser = match getInteger((clientAdress + "_rating")) { | |
230 | 259 | case s: Int => | |
231 | 260 | s | |
232 | 261 | case _ => | |
234 | 263 | } | |
235 | 264 | if ((searchForUser != -1)) | |
236 | 265 | then throw("User already exists") | |
237 | - | else [IntegerEntry(clientAdress, defaultRating)] | |
266 | + | else [IntegerEntry((clientAdress + "_rating"), defaultRating)] | |
238 | 267 | } | |
239 | 268 | ||
240 | 269 |
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 | let rateAdjustment = 20 | |
11 | 11 | ||
12 | 12 | let tokenId = base58'8QGJvsXqJ43q5ksFymoPKF1NWWhwUfr2F7h52oeWgVhH' | |
13 | 13 | ||
14 | 14 | let payoutAmount = 100000000 | |
15 | 15 | ||
16 | 16 | let ratingCutoff = 50 | |
17 | + | ||
18 | + | let r_average = 100 | |
17 | 19 | ||
18 | 20 | func searchForCounters (itemId,counter) = { | |
19 | 21 | let searchForCounters = match getString(((itemId + "_") + toString(counter))) { | |
20 | 22 | case s: String => | |
21 | 23 | s | |
22 | 24 | case _ => | |
23 | 25 | "No User" | |
24 | 26 | } | |
25 | 27 | searchForCounters | |
26 | 28 | } | |
27 | 29 | ||
28 | 30 | ||
29 | 31 | func searchForRating (address) = { | |
30 | 32 | let rating = match getInteger(address) { | |
31 | 33 | case r: Int => | |
32 | 34 | r | |
33 | 35 | case _ => | |
34 | 36 | defaultRating | |
35 | 37 | } | |
36 | 38 | rating | |
37 | 39 | } | |
38 | 40 | ||
39 | 41 | ||
40 | 42 | func searchForAddressPrediction (itemId,adress) = { | |
41 | 43 | let searchForPrediction = match getString(((itemId + "_") + adress)) { | |
42 | 44 | case s: String => | |
43 | 45 | s | |
44 | 46 | case _ => | |
45 | 47 | "Not Found" | |
46 | 48 | } | |
47 | 49 | searchForPrediction | |
48 | 50 | } | |
49 | 51 | ||
50 | 52 | ||
51 | 53 | func findPredictionAdresses (itemId,counter) = { | |
52 | 54 | let adressList = if ((counter >= 5)) | |
53 | 55 | then { | |
54 | 56 | let adress1 = searchForCounters(itemId, 1) | |
55 | 57 | let adress2 = searchForCounters(itemId, 2) | |
56 | 58 | let adress3 = searchForCounters(itemId, 3) | |
57 | 59 | let adress4 = searchForCounters(itemId, 4) | |
58 | 60 | let adress5 = searchForCounters(itemId, 5) | |
59 | 61 | (((((nil :+ adress1) :+ adress2) :+ adress3) :+ adress4) :+ adress5) | |
60 | 62 | } | |
61 | 63 | else if ((counter >= 4)) | |
62 | 64 | then { | |
63 | 65 | let adress1 = searchForCounters(itemId, 1) | |
64 | 66 | let adress2 = searchForCounters(itemId, 2) | |
65 | 67 | let adress3 = searchForCounters(itemId, 3) | |
66 | 68 | let adress4 = searchForCounters(itemId, 4) | |
67 | 69 | ((((nil :+ adress1) :+ adress2) :+ adress3) :+ adress4) | |
68 | 70 | } | |
69 | 71 | else if ((counter >= 3)) | |
70 | 72 | then { | |
71 | 73 | let adress1 = searchForCounters(itemId, 1) | |
72 | 74 | let adress2 = searchForCounters(itemId, 2) | |
73 | 75 | let adress3 = searchForCounters(itemId, 3) | |
74 | 76 | (((nil :+ adress1) :+ adress2) :+ adress3) | |
75 | 77 | } | |
76 | 78 | else if ((counter >= 2)) | |
77 | 79 | then { | |
78 | 80 | let adress1 = searchForCounters(itemId, 1) | |
79 | 81 | let adress2 = searchForCounters(itemId, 2) | |
80 | 82 | ((nil :+ adress1) :+ adress2) | |
81 | 83 | } | |
82 | 84 | else { | |
83 | 85 | let adress1 = searchForCounters(itemId, 1) | |
84 | 86 | (nil :+ adress1) | |
85 | 87 | } | |
86 | 88 | adressList | |
87 | 89 | } | |
88 | 90 | ||
89 | 91 | ||
92 | + | func calculateExpectedScore (r_player,r_average) = { | |
93 | + | let diff = (r_average - r_player) | |
94 | + | let exponent = (diff / r_average) | |
95 | + | let powerOfTen = pow(10, 0, exponent, 0, 0, HALFUP) | |
96 | + | let denominator = (1 + powerOfTen) | |
97 | + | (1 / denominator) | |
98 | + | } | |
99 | + | ||
100 | + | ||
101 | + | func calculatePayout (r_player,r_average) = { | |
102 | + | let ratio = ((r_player * 100) / r_average) | |
103 | + | let payout = ((payoutAmount * ratio) / 100) | |
104 | + | payout | |
105 | + | } | |
106 | + | ||
107 | + | ||
108 | + | func calculateNewRating (r_player,r_average,k,actualScore) = { | |
109 | + | let expectedScore = calculateExpectedScore(r_player, r_average) | |
110 | + | let delta_r = (k * (actualScore - expectedScore)) | |
111 | + | (r_player + delta_r) | |
112 | + | } | |
113 | + | ||
114 | + | ||
90 | 115 | @Callable(i) | |
91 | 116 | func adjustRatingsAndPayoutParticipants (itemId,addressList,lastCallerAddress,finalPrediction) = { | |
92 | 117 | let caller = toString(i.caller) | |
93 | 118 | if ((caller != toString(this))) | |
94 | 119 | then throw("You are not allowed to call this function") | |
95 | 120 | else { | |
96 | 121 | func updateRatingsFunc (accum,address) = { | |
97 | 122 | let rating = searchForRating(address) | |
98 | 123 | let prediction = searchForAddressPrediction(itemId, address) | |
99 | - | let updatedRating = if ((prediction == finalPrediction)) | |
100 | - | then (rating + rateAdjustment) | |
101 | - | else (rating - rateAdjustment) | |
124 | + | let actualScore = if ((prediction == finalPrediction)) | |
125 | + | then 1 | |
126 | + | else 0 | |
127 | + | let newRating = calculateNewRating(rating, r_average, rateAdjustment, actualScore) | |
102 | 128 | let payout = if ((prediction == finalPrediction)) | |
103 | - | then payoutAmount | |
104 | - | else 0 | |
105 | - | let updatedEntries = (accum :+ IntegerEntry(address, updatedRating)) | |
106 | - | if ((payout > 0)) | |
107 | - | then (updatedEntries :+ ScriptTransfer(Address(fromBase58String(address)), payout, tokenId)) | |
129 | + | then true | |
130 | + | else false | |
131 | + | let updatedEntries = (accum :+ IntegerEntry((address + "_rating"), newRating)) | |
132 | + | let calculatedAmount = calculatePayout(newRating, r_average) | |
133 | + | if (payout) | |
134 | + | then (updatedEntries :+ ScriptTransfer(Address(fromBase58String(address)), calculatedAmount, tokenId)) | |
108 | 135 | else updatedEntries | |
109 | 136 | } | |
110 | 137 | ||
111 | 138 | let updatedRatings = { | |
112 | 139 | let $l = addressList | |
113 | 140 | let $s = size($l) | |
114 | 141 | let $acc0 = nil | |
115 | 142 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
116 | 143 | then $a | |
117 | 144 | else updateRatingsFunc($a, $l[$i]) | |
118 | 145 | ||
119 | 146 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
120 | 147 | then $a | |
121 | 148 | else throw("List size exceeds 5") | |
122 | 149 | ||
123 | 150 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
124 | 151 | } | |
125 | 152 | (updatedRatings :+ BooleanEntry((itemId + "_adjusted"), true)) | |
126 | 153 | } | |
127 | 154 | } | |
128 | 155 | ||
129 | 156 | ||
130 | 157 | ||
131 | 158 | @Callable(i) | |
132 | 159 | func savePrediction (itemId,prediction) = { | |
133 | 160 | let clientAdress = toString(i.caller) | |
134 | 161 | let searchForUser = match getInteger(clientAdress) { | |
135 | 162 | case s: Int => | |
136 | 163 | s | |
137 | 164 | case _ => | |
138 | 165 | "User does not exist" | |
139 | 166 | } | |
140 | 167 | if ((searchForUser == "User does not exist")) | |
141 | 168 | then throw("User does not exist") | |
142 | 169 | else { | |
143 | 170 | let isFinal = match getBoolean((itemId + "_final")) { | |
144 | 171 | case s: Boolean => | |
145 | 172 | s | |
146 | 173 | case _ => | |
147 | 174 | false | |
148 | 175 | } | |
149 | 176 | if (isFinal) | |
150 | 177 | then throw("Final prediction already made") | |
151 | 178 | else { | |
152 | 179 | let isCanceled = match getBoolean((itemId + "_cancelled")) { | |
153 | 180 | case s: Boolean => | |
154 | 181 | s | |
155 | 182 | case _ => | |
156 | 183 | false | |
157 | 184 | } | |
158 | 185 | if (isCanceled) | |
159 | 186 | then throw("Final prediction already made") | |
160 | 187 | else { | |
161 | 188 | let clientRating = searchForRating(clientAdress) | |
162 | 189 | if ((ratingCutoff >= clientRating)) | |
163 | 190 | then throw("You are not allowed to participate anymore") | |
164 | 191 | else { | |
165 | 192 | let searchForCounter = match getInteger((itemId + "_counter")) { | |
166 | 193 | case s: Int => | |
167 | 194 | s | |
168 | 195 | case _ => | |
169 | 196 | -1 | |
170 | 197 | } | |
171 | 198 | if ((searchForCounter >= 1)) | |
172 | 199 | then { | |
173 | 200 | let adressList = findPredictionAdresses(itemId, searchForCounter) | |
174 | 201 | if (containsElement(adressList, clientAdress)) | |
175 | 202 | then throw("This User already gave a Prediction") | |
176 | 203 | else { | |
177 | 204 | let predictionCounter = match getInteger((itemId + "_predictionCounter")) { | |
178 | 205 | case s: Int => | |
179 | 206 | s | |
180 | 207 | case _ => | |
181 | 208 | -1 | |
182 | 209 | } | |
183 | 210 | let lastPredictionAdress = adressList[(size(adressList) - 1)] | |
184 | 211 | let lastPrediction = match getString(((itemId + "_") + lastPredictionAdress)) { | |
185 | 212 | case s: String => | |
186 | 213 | s | |
187 | 214 | case _ => | |
188 | 215 | "no Prediction Found" | |
189 | 216 | } | |
190 | 217 | let newCounter = (searchForCounter + 1) | |
191 | 218 | if ((lastPrediction == prediction)) | |
192 | 219 | then if (((predictionCounter + 1) == predictionMaxCounter)) | |
193 | 220 | then { | |
221 | + | let newRating = calculateNewRating(clientRating, r_average, rateAdjustment, 1) | |
222 | + | let calculatedAmount = calculatePayout(newRating, r_average) | |
194 | 223 | let invokeAdjustRating = invoke(this, "adjustRatingsAndPayoutParticipants", [itemId, adressList, clientAdress, prediction], nil) | |
195 | 224 | if ((invokeAdjustRating != invokeAdjustRating)) | |
196 | 225 | then throw("Strict value is not equal to itself.") | |
197 | - | 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), ScriptTransfer(Address(fromBase58String(clientAdress)), | |
226 | + | 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), ScriptTransfer(Address(fromBase58String(clientAdress)), calculatedAmount, tokenId), IntegerEntry((clientAdress + "_rating"), newRating)] | |
198 | 227 | } | |
199 | 228 | 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)] | |
200 | 229 | else if ((newCounter >= maxCounter)) | |
201 | 230 | 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)] | |
202 | 231 | else if (((predictionCounter - 1) == 0)) | |
203 | 232 | then [StringEntry(((itemId + "_") + toString(newCounter)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), newCounter), IntegerEntry((itemId + "_predictionCounter"), 1), BooleanEntry((itemId + "_cancelled"), false), BooleanEntry((itemId + "_final"), false), StringEntry("test", lastPrediction), IntegerEntry("test2", size(adressList))] | |
204 | 233 | 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), StringEntry("test", lastPrediction), IntegerEntry("test2", size(adressList))] | |
205 | 234 | } | |
206 | 235 | } | |
207 | 236 | else { | |
208 | 237 | let searchForNewItem = match getString(("new_" + itemId)) { | |
209 | 238 | case s: String => | |
210 | 239 | s | |
211 | 240 | case _ => | |
212 | 241 | "Item not Found" | |
213 | 242 | } | |
214 | 243 | if ((searchForNewItem == "Item not Found")) | |
215 | 244 | then throw("Item not found") | |
216 | 245 | else [StringEntry(((itemId + "_") + toString(1)), clientAdress), StringEntry(((itemId + "_") + clientAdress), prediction), IntegerEntry((itemId + "_counter"), 1), IntegerEntry((itemId + "_predictionCounter"), 1), DeleteEntry(("new_" + itemId)), StringEntry(("updated_" + itemId), itemId)] | |
217 | 246 | } | |
218 | 247 | } | |
219 | 248 | } | |
220 | 249 | } | |
221 | 250 | } | |
222 | 251 | } | |
223 | 252 | ||
224 | 253 | ||
225 | 254 | ||
226 | 255 | @Callable(i) | |
227 | 256 | func registerUser () = { | |
228 | 257 | let clientAdress = toString(i.caller) | |
229 | - | let searchForUser = match getInteger(clientAdress) { | |
258 | + | let searchForUser = match getInteger((clientAdress + "_rating")) { | |
230 | 259 | case s: Int => | |
231 | 260 | s | |
232 | 261 | case _ => | |
233 | 262 | -1 | |
234 | 263 | } | |
235 | 264 | if ((searchForUser != -1)) | |
236 | 265 | then throw("User already exists") | |
237 | - | else [IntegerEntry(clientAdress, defaultRating)] | |
266 | + | else [IntegerEntry((clientAdress + "_rating"), defaultRating)] | |
238 | 267 | } | |
239 | 268 | ||
240 | 269 | ||
241 | 270 | @Verifier(tx) | |
242 | 271 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
243 | 272 |
github/deemru/w8io/026f985 39.54 ms ◑