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