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