tx · 7MNNQHXVM5mXEWKoFQTJGZ2egQFhsWnE2yYTqUaFECxq 3N8xXaYjE27Aa79d5hHrhHu9HaFoTBmhDEj: -0.01200000 Waves 2023.01.22 05:01 [2415532] smart account 3N8xXaYjE27Aa79d5hHrhHu9HaFoTBmhDEj > SELF 0.00000000 Waves
{ "type": 13, "id": "7MNNQHXVM5mXEWKoFQTJGZ2egQFhsWnE2yYTqUaFECxq", "fee": 1200000, "feeAssetId": null, "timestamp": 1674352904729, "version": 2, "chainId": 84, "sender": "3N8xXaYjE27Aa79d5hHrhHu9HaFoTBmhDEj", "senderPublicKey": "A2m227AHcq7gWfSU59Q3UJaqkEa7SccFYmJuWHbFrrKE", "proofs": [ "2ecpbffsMMNo1fjLJ95yz68TJ3XNU71sM8TK6jdZNu2Kuih2YUAzcBGYiRTjbUamj4kJ8kCkcY1dyGqtM7mY1poE" ], "script": "base64:BgJNCAISBAoCCAgSBAoCBAgSAwoBBBIICgYICAgIAQgSCAoGCAgICAEIEgQKAggIEgYKBAgICAgSAwoBCBIGCgQICAEBEgQKAggIEgMKAQgqAAdWRVJTSU9OAgMxLjUBDmdldFN0cmluZ0J5S2V5AQNrZXkJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUEdGhpcwUDa2V5AgABD2dldEJvb2xlYW5CeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCbCAIFBHRoaXMFA2tleQcBD2dldEludGVnZXJCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFA2tleQAAAAVjaHJpcwkBDmdldFN0cmluZ0J5S2V5AQIMY29uZl9hZG1pbl8xAA5kYXBwUnVubmluZ0tleQIUY29uZl9kYXBwX2lzX3J1bm5pbmcAEW1haW50ZW5hbmNlTVNHS2V5AhRjb25mX21haW50ZW5hbmNlX21zZwASd2hpdGVsaXN0ZWRvbmx5S2V5AhVjb25mX3doaXRlbGlzdGVkX29ubHkAC2RhcHBSdW5uaW5nCQELdmFsdWVPckVsc2UCCQC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FwcAUEdGhpcwcJAAACCAUDaW52A2ZlZQCgwh4HCQAAAggFA2ludgpmZWVBc3NldElkBQR1bml0BwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAkA2QQBCQEIYXNTdHJpbmcBCQCRAwIIBQNpbnYEYXJncwAFAwMDAwkAAAIIBQNpbnYIZnVuY3Rpb24CCnVwZGF0ZVVzZXIJAAACCAUDaW52BGRBcHAFBHRoaXMHCQAAAggFA2ludgNmZWUAoMIeBwkAAAIIBQNpbnYKZmVlQXNzZXRJZAUEdW5pdAcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJANkEAQkBCGFzU3RyaW5nAQkAkQMCCAUDaW52BGFyZ3MABQMDAwMJAAACCAUDaW52CGZ1bmN0aW9uAgxzZXRFUkMyMFVzZXIJAAACCAUDaW52BGRBcHAFBHRoaXMHCQAAAggFA2ludgNmZWUAoMIeBwkAAAIIBQNpbnYKZmVlQXNzZXRJZAUEdW5pdAcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJANkEAQkBCGFzU3RyaW5nAQkAkQMCCAUDaW52BGFyZ3MAAgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleX4wfw0=", "height": 2415532, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6JFcVEWo1PbA3P5YrPgfZgsSM9LtjLBdu3JJHDTdALoD Next: 9k4EuFxvBSvXY4PAitq9h8L8TQAv67BRyCqttdd2SL4R Diff:
Old | New | Differences | |
---|---|---|---|
325 | 325 | let caller = toString(invoke.caller) | |
326 | 326 | if (containsElement([chris, toString(this)], caller)) | |
327 | 327 | then if ((size(status) == 0)) | |
328 | - | then [StringEntry(keyUserNote(address), note), StringEntry(keyUserLabel(address), label)] | |
328 | + | then { | |
329 | + | let currentStatus = getStringByKey(keyUserStatus(address)) | |
330 | + | if ((currentStatus == "")) | |
331 | + | then throw("User have no status yet") | |
332 | + | else [StringEntry(keyUserNote(address), note), StringEntry(keyUserLabel(address), label)] | |
333 | + | } | |
329 | 334 | else { | |
330 | 335 | let currentStatus = getStringByKey(keyUserStatus(address)) | |
331 | 336 | let statusToSet = validateNewStatus(status, address, currentStatus) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let VERSION = "1.5" | |
5 | 5 | ||
6 | 6 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | let chris = getStringByKey("conf_admin_1") | |
16 | 16 | ||
17 | 17 | let dappRunningKey = "conf_dapp_is_running" | |
18 | 18 | ||
19 | 19 | let maintenanceMSGKey = "conf_maintenance_msg" | |
20 | 20 | ||
21 | 21 | let whitelistedonlyKey = "conf_whitelisted_only" | |
22 | 22 | ||
23 | 23 | let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true) | |
24 | 24 | ||
25 | 25 | let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "") | |
26 | 26 | ||
27 | 27 | let whitelistedonly = valueOrElse(getBoolean(this, whitelistedonlyKey), true) | |
28 | 28 | ||
29 | 29 | let whitelistDapp = value(addressFromString(getStringByKey("conf_whitelist_dapp"))) | |
30 | 30 | ||
31 | 31 | let userAllowed = "ALLOWED" | |
32 | 32 | ||
33 | 33 | let userRegistered = "REGISTERED" | |
34 | 34 | ||
35 | 35 | let userVerified = "VERIFIED" | |
36 | 36 | ||
37 | 37 | let userSuspended = "SUSPENDED" | |
38 | 38 | ||
39 | 39 | let userRemoved = "REMOVED" | |
40 | 40 | ||
41 | 41 | let userChangeRequired = "CHANGE_REQUIRED" | |
42 | 42 | ||
43 | 43 | let userUnregistered = "UNREGISTERED" | |
44 | 44 | ||
45 | 45 | let userReset = "RESET" | |
46 | 46 | ||
47 | 47 | func keyUserAddr (caller) = ("user_" + caller) | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func keyUserName (caller) = ("user_name_" + caller) | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func keyUserDesc (caller) = ("user_desc_" + caller) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func keyUserSocial (caller) = ("user_social_" + caller) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func keyUserThumb (caller) = ("user_thumb_" + caller) | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyUserStatus (caller) = ("user_status_" + caller) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func keyUserRoyalties (caller) = ("user_royalties_" + caller) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func keyUserDate (caller) = ("user_date_" + caller) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func keyUserERC20 (caller) = ("user_ERC20_" + caller) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func keyUserNote (caller) = ("user_note_" + caller) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func keyUserLabel (caller) = ("user_label_" + caller) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func keyArtistAgentAddr (artistAddr) = ("artist_agent_" + artistAddr) | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func keyAgentArtistAddr (agentAddr,artistAddr) = ((("agent_" + agentAddr) + "_") + artistAddr) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func keyPrimaryShare (artistAddr) = ("artist_agent_primary_" + artistAddr) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func keySecondaryShare (artistAddr) = ("artist_agent_secondary_" + artistAddr) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func checkWhitelist (key) = valueOrElse(getInteger(whitelistDapp, key), 0) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func validateCID (cid) = if (contains(cid, "/")) | |
96 | 96 | then if (if ((76 > size(cid))) | |
97 | 97 | then (size(split(cid, "/")[0]) == 59) | |
98 | 98 | else false) | |
99 | 99 | then (16 > size(split(cid, "/")[1])) | |
100 | 100 | else false | |
101 | 101 | else false | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func validUserData (caller,name,description,thumb,isAnUpdate) = { | |
105 | 105 | let validCID = if ((size(thumb) != 0)) | |
106 | 106 | then validateCID(thumb) | |
107 | 107 | else true | |
108 | 108 | if (!(validCID)) | |
109 | 109 | then throw("CID don't match requirement!") | |
110 | 110 | else if (if ((name == "")) | |
111 | 111 | then true | |
112 | 112 | else (description == "")) | |
113 | 113 | then throw("Name and description cannot be empty") | |
114 | 114 | else if ((size(description) > 600)) | |
115 | 115 | then throw("600 Char. max description") | |
116 | 116 | else if ((size(name) > 45)) | |
117 | 117 | then throw("45 Char. max name") | |
118 | 118 | else { | |
119 | 119 | let status = getStringByKey(keyUserStatus(caller)) | |
120 | 120 | if (if ((status == userSuspended)) | |
121 | 121 | then true | |
122 | 122 | else (status == userRemoved)) | |
123 | 123 | then throw("Account suspended/ removed.") | |
124 | 124 | else if (if (!(isAnUpdate)) | |
125 | 125 | then (status == userRegistered) | |
126 | 126 | else false) | |
127 | 127 | then throw("Already registered") | |
128 | 128 | else if (if (if (!(isAnUpdate)) | |
129 | 129 | then (status == "") | |
130 | 130 | else false) | |
131 | 131 | then whitelistedonly | |
132 | 132 | else false) | |
133 | 133 | then throw("Can't register, get approved first.") | |
134 | 134 | else if (if (if (isAnUpdate) | |
135 | 135 | then (status == "") | |
136 | 136 | else false) | |
137 | 137 | then true | |
138 | 138 | else if (isAnUpdate) | |
139 | 139 | then (status == userAllowed) | |
140 | 140 | else false) | |
141 | 141 | then throw("Register first") | |
142 | 142 | else true | |
143 | 143 | } | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func validateNewStatus (status,address,currentStatus) = { | |
148 | 148 | let allStatus = [userVerified, userRegistered, userSuspended, userRemoved, userAllowed, userChangeRequired] | |
149 | 149 | let statusToSet = if (containsElement(allStatus, status)) | |
150 | 150 | then status | |
151 | 151 | else if (if ((status == userReset)) | |
152 | 152 | then (currentStatus == userAllowed) | |
153 | 153 | else false) | |
154 | 154 | then "" | |
155 | 155 | else throw("Unknown status") | |
156 | 156 | let userIsRegistered = getIntegerByKey(keyUserDate(address)) | |
157 | 157 | if (if ((userIsRegistered == 0)) | |
158 | 158 | then (statusToSet != userAllowed) | |
159 | 159 | else false) | |
160 | 160 | then throw("You cant set this status, user is not registered.") | |
161 | 161 | else if (if ((currentStatus == userAllowed)) | |
162 | 162 | then (statusToSet == userAllowed) | |
163 | 163 | else false) | |
164 | 164 | then throw("User already allowed") | |
165 | 165 | else if (if ((currentStatus == userRegistered)) | |
166 | 166 | then (statusToSet == userAllowed) | |
167 | 167 | else false) | |
168 | 168 | then throw("User already allowed & registered") | |
169 | 169 | else if (if ((currentStatus == userVerified)) | |
170 | 170 | then (statusToSet == userAllowed) | |
171 | 171 | else false) | |
172 | 172 | then throw("User already allowed & verified") | |
173 | 173 | else statusToSet | |
174 | 174 | } | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func makeJSON (name,thumb,date) = (((((("{\"user_name\": \"" + name) + "\", \"user_thumb\":\"") + thumb) + "\",\"user_date\":\"") + date) + "\"}") | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func asString (bv) = match bv { | |
181 | 181 | case bv0: String => | |
182 | 182 | bv0 | |
183 | 183 | case _ => | |
184 | 184 | throw("Sponsored Public Key String expected") | |
185 | 185 | } | |
186 | 186 | ||
187 | 187 | ||
188 | 188 | func getCaller (i,pubKey) = { | |
189 | 189 | let isSponsored = if ((pubKey != "")) | |
190 | 190 | then valueOrElse(checkWhitelist((toString(addressFromPublicKey(fromBase58String(pubKey))) + "_free_txs")), 0) | |
191 | 191 | else 0 | |
192 | 192 | let caller = if (if ((toBase58String(i.caller.bytes) == toString(this))) | |
193 | 193 | then (isSponsored > 0) | |
194 | 194 | else false) | |
195 | 195 | then toString(addressFromPublicKey(fromBase58String(pubKey))) | |
196 | 196 | else toBase58String(i.caller.bytes) | |
197 | 197 | let get_sponsored_waves = if ((pubKey != "")) | |
198 | 198 | then invoke(whitelistDapp, "useFreeTx", [toString(addressFromPublicKey(fromBase58String(pubKey)))], nil) | |
199 | 199 | else unit | |
200 | 200 | if ((get_sponsored_waves == get_sponsored_waves)) | |
201 | 201 | then $Tuple2(caller, (isSponsored > 0)) | |
202 | 202 | else throw("Strict value is not equal to itself.") | |
203 | 203 | } | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | @Callable(invoke) | |
207 | 207 | func setConf (key,val) = { | |
208 | 208 | let caller = toString(invoke.caller) | |
209 | 209 | if (containsElement([chris, toString(this)], caller)) | |
210 | 210 | then [StringEntry(key, val)] | |
211 | 211 | else throw("You are not allowed to change this") | |
212 | 212 | } | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | ||
216 | 216 | @Callable(invoke) | |
217 | 217 | func appRunning (isLive,message) = { | |
218 | 218 | let caller = toString(invoke.caller) | |
219 | 219 | if (containsElement([chris, toString(this)], caller)) | |
220 | 220 | then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)] | |
221 | 221 | else throw("You are not allowed to change this") | |
222 | 222 | } | |
223 | 223 | ||
224 | 224 | ||
225 | 225 | ||
226 | 226 | @Callable(invoke) | |
227 | 227 | func registrationMode (WLonly) = { | |
228 | 228 | let caller = toString(invoke.caller) | |
229 | 229 | if (containsElement([chris, toString(this)], caller)) | |
230 | 230 | then [BooleanEntry(whitelistedonlyKey, WLonly)] | |
231 | 231 | else throw("You are not allowed to change this") | |
232 | 232 | } | |
233 | 233 | ||
234 | 234 | ||
235 | 235 | ||
236 | 236 | @Callable(invoke) | |
237 | 237 | func registerUser (name,description,thumb,social,royalties,pubKey) = if (!(dappRunning)) | |
238 | 238 | then throw(maintenanceMSG) | |
239 | 239 | else { | |
240 | 240 | let $t073197371 = getCaller(invoke, pubKey) | |
241 | 241 | let caller = $t073197371._1 | |
242 | 242 | let isSponsored = $t073197371._2 | |
243 | 243 | let id = toBase58String(invoke.transactionId) | |
244 | 244 | let timestamp = lastBlock.timestamp | |
245 | 245 | let note = getStringByKey(keyUserNote(caller)) | |
246 | 246 | let label = getStringByKey(keyUserLabel(caller)) | |
247 | 247 | if (!(validUserData(caller, name, description, thumb, false))) | |
248 | 248 | then throw("Something went wrong") | |
249 | 249 | else { | |
250 | 250 | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp)) | |
251 | 251 | if (if ((0 > royalties)) | |
252 | 252 | then true | |
253 | 253 | else (royalties > 1000)) | |
254 | 254 | then throw("Royalties cannot be less than 0% or higher than 10%") | |
255 | 255 | else { | |
256 | 256 | let txToCaller = if (isSponsored) | |
257 | 257 | then [ScriptTransfer(Address(fromBase58String(caller)), 0, unit)] | |
258 | 258 | else nil | |
259 | 259 | ([IntegerEntry(keyUserDate(caller), timestamp), StringEntry(keyUserAddr(caller), ((id + "_") + toString(timestamp))), StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb), StringEntry(keyUserStatus(caller), userRegistered), IntegerEntry(keyUserRoyalties(caller), royalties), DeleteEntry(("ALLOWED_" + caller)), StringEntry(((userRegistered + "_") + caller), json), StringEntry(keyUserNote(caller), note), StringEntry(keyUserLabel(caller), label)] ++ txToCaller) | |
260 | 260 | } | |
261 | 261 | } | |
262 | 262 | } | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | ||
266 | 266 | @Callable(invoke) | |
267 | 267 | func updateUser (name,description,thumb,social,royalties,pubKey) = if (!(dappRunning)) | |
268 | 268 | then throw(maintenanceMSG) | |
269 | 269 | else { | |
270 | 270 | let $t090179121 = getCaller(invoke, pubKey) | |
271 | 271 | let caller = $t090179121._1 | |
272 | 272 | let isSponsored = $t090179121._2 | |
273 | 273 | let status = getStringByKey(keyUserStatus(caller)) | |
274 | 274 | if (!(validUserData(caller, name, description, thumb, true))) | |
275 | 275 | then throw("Something went wrong") | |
276 | 276 | else { | |
277 | 277 | let date = getIntegerByKey(keyUserDate(caller)) | |
278 | 278 | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date)) | |
279 | 279 | if (if ((0 > royalties)) | |
280 | 280 | then true | |
281 | 281 | else (royalties > 1000)) | |
282 | 282 | then throw("Royalties cannot be less than 0% or higher than 10%") | |
283 | 283 | else { | |
284 | 284 | let txToCaller = if (isSponsored) | |
285 | 285 | then [ScriptTransfer(Address(fromBase58String(caller)), 0, unit)] | |
286 | 286 | else nil | |
287 | 287 | ([StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb), IntegerEntry(keyUserRoyalties(caller), royalties), StringEntry(((status + "_") + caller), json)] ++ txToCaller) | |
288 | 288 | } | |
289 | 289 | } | |
290 | 290 | } | |
291 | 291 | ||
292 | 292 | ||
293 | 293 | ||
294 | 294 | @Callable(invoke) | |
295 | 295 | func setERC20User (erc20,pubKey) = if (!(dappRunning)) | |
296 | 296 | then throw(maintenanceMSG) | |
297 | 297 | else { | |
298 | 298 | let $t01030810411 = getCaller(invoke, pubKey) | |
299 | 299 | let caller = $t01030810411._1 | |
300 | 300 | let isSponsored = $t01030810411._2 | |
301 | 301 | let status = getStringByKey(keyUserStatus(caller)) | |
302 | 302 | if (if ((status != userRegistered)) | |
303 | 303 | then (status != userVerified) | |
304 | 304 | else false) | |
305 | 305 | then throw("Not allowed to set ERC20 address") | |
306 | 306 | else { | |
307 | 307 | let firstTwo = take(erc20, 2) | |
308 | 308 | if (if ((firstTwo != "0x")) | |
309 | 309 | then true | |
310 | 310 | else (size(erc20) != 42)) | |
311 | 311 | then throw("This is not an erc20 address") | |
312 | 312 | else { | |
313 | 313 | let txToCaller = if (isSponsored) | |
314 | 314 | then [ScriptTransfer(Address(fromBase58String(caller)), 0, unit)] | |
315 | 315 | else nil | |
316 | 316 | ([StringEntry(keyUserERC20(caller), erc20)] ++ txToCaller) | |
317 | 317 | } | |
318 | 318 | } | |
319 | 319 | } | |
320 | 320 | ||
321 | 321 | ||
322 | 322 | ||
323 | 323 | @Callable(invoke) | |
324 | 324 | func changeUserStatus (address,status,note,label) = { | |
325 | 325 | let caller = toString(invoke.caller) | |
326 | 326 | if (containsElement([chris, toString(this)], caller)) | |
327 | 327 | then if ((size(status) == 0)) | |
328 | - | then [StringEntry(keyUserNote(address), note), StringEntry(keyUserLabel(address), label)] | |
328 | + | then { | |
329 | + | let currentStatus = getStringByKey(keyUserStatus(address)) | |
330 | + | if ((currentStatus == "")) | |
331 | + | then throw("User have no status yet") | |
332 | + | else [StringEntry(keyUserNote(address), note), StringEntry(keyUserLabel(address), label)] | |
333 | + | } | |
329 | 334 | else { | |
330 | 335 | let currentStatus = getStringByKey(keyUserStatus(address)) | |
331 | 336 | let statusToSet = validateNewStatus(status, address, currentStatus) | |
332 | 337 | let name = toBase64String(toBytes(getStringByKey(keyUserName(address)))) | |
333 | 338 | let thumb = toBase64String(toBytes(getStringByKey(keyUserThumb(address)))) | |
334 | 339 | let date = getIntegerByKey(keyUserDate(address)) | |
335 | 340 | let json = makeJSON(name, thumb, toString(date)) | |
336 | 341 | [StringEntry(keyUserStatus(address), statusToSet), DeleteEntry(((currentStatus + "_") + address)), StringEntry(((statusToSet + "_") + address), json), StringEntry(keyUserNote(address), note), StringEntry(keyUserLabel(address), label)] | |
337 | 342 | } | |
338 | 343 | else throw("Not allowed to change user status") | |
339 | 344 | } | |
340 | 345 | ||
341 | 346 | ||
342 | 347 | ||
343 | 348 | @Callable(invoke) | |
344 | 349 | func deleteUser (address) = { | |
345 | 350 | let caller = toString(invoke.caller) | |
346 | 351 | let currentStatus = getStringByKey(keyUserStatus(address)) | |
347 | 352 | if (containsElement([chris, toString(this)], caller)) | |
348 | 353 | then [DeleteEntry(keyUserDate(address)), DeleteEntry(keyUserAddr(address)), DeleteEntry(keyUserName(address)), DeleteEntry(keyUserDesc(address)), DeleteEntry(keyUserSocial(address)), DeleteEntry(keyUserThumb(address)), DeleteEntry(("user_note_" + address)), DeleteEntry(((currentStatus + "_") + address)), DeleteEntry(keyUserRoyalties(address)), StringEntry(keyUserStatus(address), userRemoved)] | |
349 | 354 | else throw("Not allowed") | |
350 | 355 | } | |
351 | 356 | ||
352 | 357 | ||
353 | 358 | ||
354 | 359 | @Callable(i) | |
355 | 360 | func setAgent (artistAddr,agentAddr,primaryShare,secondaryShare) = if (!(dappRunning)) | |
356 | 361 | then throw(maintenanceMSG) | |
357 | 362 | else { | |
358 | 363 | let caller = toString(i.caller) | |
359 | 364 | if (containsElement([chris, toString(this)], caller)) | |
360 | 365 | then if (if ((size(artistAddr) != 35)) | |
361 | 366 | then true | |
362 | 367 | else (size(agentAddr) != 35)) | |
363 | 368 | then throw("Wrong address") | |
364 | 369 | else [StringEntry(keyArtistAgentAddr(artistAddr), agentAddr), StringEntry(keyAgentArtistAddr(agentAddr, artistAddr), artistAddr), IntegerEntry(keyPrimaryShare(artistAddr), primaryShare), IntegerEntry(keySecondaryShare(artistAddr), secondaryShare)] | |
365 | 370 | else throw("You are not allowed") | |
366 | 371 | } | |
367 | 372 | ||
368 | 373 | ||
369 | 374 | ||
370 | 375 | @Callable(i) | |
371 | 376 | func unsetAgent (artistAddr,agentAddr) = if (!(dappRunning)) | |
372 | 377 | then throw(maintenanceMSG) | |
373 | 378 | else { | |
374 | 379 | let caller = toString(i.caller) | |
375 | 380 | if (containsElement([chris, toString(this)], caller)) | |
376 | 381 | then if (if ((size(artistAddr) != 35)) | |
377 | 382 | then true | |
378 | 383 | else (size(agentAddr) != 35)) | |
379 | 384 | then throw("Wrong address") | |
380 | 385 | else [DeleteEntry(keyArtistAgentAddr(artistAddr)), DeleteEntry(keyAgentArtistAddr(agentAddr, artistAddr)), DeleteEntry(keyPrimaryShare(artistAddr)), DeleteEntry(keySecondaryShare(artistAddr))] | |
381 | 386 | else throw("You are not allowed") | |
382 | 387 | } | |
383 | 388 | ||
384 | 389 | ||
385 | 390 | ||
386 | 391 | @Callable(i) | |
387 | 392 | func deleteEntry (entry) = { | |
388 | 393 | let caller = toString(i.caller) | |
389 | 394 | if ((caller == chris)) | |
390 | 395 | then [DeleteEntry(entry)] | |
391 | 396 | else throw("no") | |
392 | 397 | } | |
393 | 398 | ||
394 | 399 | ||
395 | 400 | @Verifier(tx) | |
396 | 401 | func verifier () = match tx { | |
397 | 402 | case inv: InvokeScriptTransaction => | |
398 | 403 | if (if (if (if ((inv.function == "registerUser")) | |
399 | 404 | then (inv.dApp == this) | |
400 | 405 | else false) | |
401 | 406 | then (inv.fee == 500000) | |
402 | 407 | else false) | |
403 | 408 | then (inv.feeAssetId == unit) | |
404 | 409 | else false) | |
405 | 410 | then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[5]))) | |
406 | 411 | else if (if (if (if ((inv.function == "updateUser")) | |
407 | 412 | then (inv.dApp == this) | |
408 | 413 | else false) | |
409 | 414 | then (inv.fee == 500000) | |
410 | 415 | else false) | |
411 | 416 | then (inv.feeAssetId == unit) | |
412 | 417 | else false) | |
413 | 418 | then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[5]))) | |
414 | 419 | else if (if (if (if ((inv.function == "setERC20User")) | |
415 | 420 | then (inv.dApp == this) | |
416 | 421 | else false) | |
417 | 422 | then (inv.fee == 500000) | |
418 | 423 | else false) | |
419 | 424 | then (inv.feeAssetId == unit) | |
420 | 425 | else false) | |
421 | 426 | then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[2]))) | |
422 | 427 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
423 | 428 | case _ => | |
424 | 429 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
425 | 430 | } | |
426 | 431 |
github/deemru/w8io/026f985 50.81 ms ◑