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