8 | | - | let c = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub" |
---|
9 | | - | |
---|
10 | | - | let d = value(addressFromString("3N8xXaYjE27Aa79d5hHrhHu9HaFoTBmhDEj")) |
---|
11 | | - | |
---|
12 | | - | let e = value(addressFromString("3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k")) |
---|
13 | | - | |
---|
14 | | - | let f = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a' |
---|
15 | | - | |
---|
16 | | - | let g = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' |
---|
17 | | - | |
---|
18 | | - | let h = base58'' |
---|
19 | | - | |
---|
20 | | - | let i = 8 |
---|
21 | | - | |
---|
22 | | - | let j = 10 |
---|
23 | | - | |
---|
24 | | - | let k = 10 |
---|
25 | | - | |
---|
26 | | - | let l = "3MsG6jPNCrVJUtYB7XJBxS7utWsXAf4n9Vp" |
---|
27 | | - | |
---|
28 | | - | let m = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN" |
---|
29 | | - | |
---|
30 | | - | let n = true |
---|
31 | | - | |
---|
32 | | - | let o = true |
---|
33 | | - | |
---|
34 | | - | let p = "SIGN Art is under maintenance" |
---|
35 | | - | |
---|
36 | | - | let q = "SUSPENDED" |
---|
37 | | - | |
---|
38 | | - | let r = "REMOVED" |
---|
39 | | - | |
---|
40 | | - | let s = "UNREGISTERED" |
---|
41 | | - | |
---|
42 | | - | func t (u) = { |
---|
43 | | - | let v = getString(this, u) |
---|
44 | | - | if ($isInstanceOf(v, "String")) |
---|
45 | | - | then { |
---|
46 | | - | let w = v |
---|
47 | | - | w |
---|
48 | | - | } |
---|
49 | | - | else "" |
---|
50 | | - | } |
---|
51 | | - | |
---|
52 | | - | |
---|
53 | | - | func x (u) = { |
---|
54 | | - | let v = getInteger(a, u) |
---|
55 | | - | if ($isInstanceOf(v, "Int")) |
---|
56 | | - | then { |
---|
57 | | - | let w = v |
---|
58 | | - | w |
---|
59 | | - | } |
---|
60 | | - | else throw("Integer undefine or 0 in oracle") |
---|
61 | | - | } |
---|
62 | | - | |
---|
63 | | - | |
---|
64 | | - | func y (u) = { |
---|
65 | | - | let v = getInteger(this, u) |
---|
66 | | - | if ($isInstanceOf(v, "Int")) |
---|
67 | | - | then { |
---|
68 | | - | let z = v |
---|
69 | | - | z |
---|
70 | | - | } |
---|
71 | | - | else 0 |
---|
72 | | - | } |
---|
73 | | - | |
---|
74 | | - | |
---|
75 | | - | func A (u) = { |
---|
76 | | - | let v = getInteger(e, u) |
---|
77 | | - | if ($isInstanceOf(v, "Int")) |
---|
78 | | - | then { |
---|
79 | | - | let w = v |
---|
80 | | - | if ((w >= height)) |
---|
81 | | - | then 1 |
---|
82 | | - | else 0 |
---|
83 | | - | } |
---|
84 | | - | else 0 |
---|
85 | | - | } |
---|
86 | | - | |
---|
87 | | - | |
---|
88 | | - | func B (u) = { |
---|
89 | | - | let v = getBoolean(this, u) |
---|
90 | | - | if ($isInstanceOf(v, "Boolean")) |
---|
91 | | - | then { |
---|
92 | | - | let z = v |
---|
93 | | - | z |
---|
94 | | - | } |
---|
95 | | - | else false |
---|
96 | | - | } |
---|
97 | | - | |
---|
98 | | - | |
---|
99 | | - | func C (D,E,F) = { |
---|
100 | | - | let v = getString(b, ((("data_fc_" + D) + "_") + E)) |
---|
101 | | - | if ($isInstanceOf(v, "String")) |
---|
102 | | - | then { |
---|
103 | | - | let w = v |
---|
104 | | - | if (contains(w, F)) |
---|
105 | | - | then true |
---|
106 | | - | else false |
---|
107 | | - | } |
---|
108 | | - | else false |
---|
109 | | - | } |
---|
110 | | - | |
---|
111 | | - | |
---|
112 | | - | func G (H) = if (if ((75 > size(H))) |
---|
113 | | - | then (60 > size(split(H, "/")[0])) |
---|
114 | | - | else false) |
---|
115 | | - | then (16 > size(split(H, "/")[1])) |
---|
116 | | - | else false |
---|
117 | | - | |
---|
118 | | - | |
---|
119 | | - | func I (J) = (65 > size(J)) |
---|
120 | | - | |
---|
121 | | - | |
---|
122 | | - | func K (L) = ("user_status_" + L) |
---|
123 | | - | |
---|
124 | | - | |
---|
125 | | - | func M (L,N) = ((("art_date_" + N) + "_") + L) |
---|
126 | | - | |
---|
127 | | - | |
---|
128 | | - | func O (L,N) = ((("art_name_" + N) + "_") + L) |
---|
129 | | - | |
---|
130 | | - | |
---|
131 | | - | func P (L,N) = ((("art_desc_" + N) + "_") + L) |
---|
132 | | - | |
---|
133 | | - | |
---|
134 | | - | func Q (L,N) = ((("art_display_cid_" + N) + "_") + L) |
---|
135 | | - | |
---|
136 | | - | |
---|
137 | | - | func R (L,N) = ((("art_export_hash_" + N) + "_") + L) |
---|
138 | | - | |
---|
139 | | - | |
---|
140 | | - | func S (L,N) = ((("art_export_cid_" + N) + "_") + L) |
---|
141 | | - | |
---|
142 | | - | |
---|
143 | | - | func T (L,N) = ((("art_maxmint_" + N) + "_") + L) |
---|
144 | | - | |
---|
145 | | - | |
---|
146 | | - | func U (L,N) = ((("art_signid_" + N) + "_") + L) |
---|
147 | | - | |
---|
148 | | - | |
---|
149 | | - | func V (L,N) = ((("art_issued_" + N) + "_") + L) |
---|
150 | | - | |
---|
151 | | - | |
---|
152 | | - | func W (L,N) = ((("art_onsale_" + N) + "_") + L) |
---|
153 | | - | |
---|
154 | | - | |
---|
155 | | - | func X (L,N) = ((("art_licence_hash_" + N) + "_") + L) |
---|
156 | | - | |
---|
157 | | - | |
---|
158 | | - | func Y (L,N) = ((("art_licence_cid_" + N) + "_") + L) |
---|
159 | | - | |
---|
160 | | - | |
---|
161 | | - | func Z (L,N) = ((("art_tags_" + N) + "_") + L) |
---|
162 | | - | |
---|
163 | | - | |
---|
164 | | - | func aa (L,N) = ((("art_type_" + N) + "_") + L) |
---|
165 | | - | |
---|
166 | | - | |
---|
167 | | - | func ab (L,N) = ((("art_price_" + N) + "_") + L) |
---|
168 | | - | |
---|
169 | | - | |
---|
170 | | - | func ac (L,N) = ((("art_assetAccepted_" + N) + "_") + L) |
---|
171 | | - | |
---|
172 | | - | |
---|
173 | | - | func ad (L,N) = ((("art_flag_" + N) + "_") + L) |
---|
174 | | - | |
---|
175 | | - | |
---|
176 | | - | func ae (L,af) = ((("get_hashbytxidaddr_" + af) + "_") + L) |
---|
177 | | - | |
---|
178 | | - | |
---|
179 | | - | func ag (F) = ("get_owner_by_hash_" + F) |
---|
180 | | - | |
---|
181 | | - | |
---|
182 | | - | func ah (L,ai) = ((("get_artidbysignid_" + ai) + "_") + L) |
---|
183 | | - | |
---|
184 | | - | |
---|
185 | | - | func aj (F,L) = ("get_txid_by_hash_owner_" + toBase58String(sha256_16Kb(toBytes((F + L))))) |
---|
186 | | - | |
---|
187 | | - | |
---|
188 | | - | func ak (al,am,an) = if (if ((al != "")) |
---|
189 | | - | then !(G(al)) |
---|
190 | | - | else false) |
---|
191 | | - | then throw("Wrong Display CID") |
---|
192 | | - | else if (if ((am != "")) |
---|
193 | | - | then !(G(am)) |
---|
194 | | - | else false) |
---|
195 | | - | then throw("Wrong Export CID") |
---|
196 | | - | else if (if ((an != "")) |
---|
197 | | - | then !(G(an)) |
---|
198 | | - | else false) |
---|
199 | | - | then throw("Wrong Licence CID") |
---|
200 | | - | else true |
---|
201 | | - | |
---|
202 | | - | |
---|
203 | | - | func ao (ap,aq) = if (if ((ap != "")) |
---|
204 | | - | then !(I(ap)) |
---|
205 | | - | else false) |
---|
206 | | - | then throw("Export Hash 64 char. max") |
---|
207 | | - | else if (if ((aq != "")) |
---|
208 | | - | then !(I(aq)) |
---|
209 | | - | else false) |
---|
210 | | - | then throw("Licence Hash 64 char. max") |
---|
211 | | - | else true |
---|
212 | | - | |
---|
213 | | - | |
---|
214 | | - | func ar (as,at) = if ((size(as) == 0)) |
---|
215 | | - | then throw("Field cannot be is empty") |
---|
216 | | - | else if ((size(as) > at)) |
---|
217 | | - | then throw((as + " is too long")) |
---|
218 | | - | else true |
---|
219 | | - | |
---|
220 | | - | |
---|
221 | | - | @Callable(au) |
---|
222 | | - | func addArtwork (F,D,av,aw,ax,ay,az,al,ap,am,aq,an) = if (!(o)) |
---|
223 | | - | then throw(p) |
---|
224 | | - | else { |
---|
225 | | - | let N = toBase58String(au.transactionId) |
---|
226 | | - | let L = toBase58String(au.caller.bytes) |
---|
227 | | - | if (!(ak(al, am, an))) |
---|
228 | | - | then throw("Problem with CID") |
---|
229 | | - | else if (!(I(F))) |
---|
230 | | - | then throw("Hash should be 64 characters maximum") |
---|
231 | | - | else if (!(ao(ap, aq))) |
---|
232 | | - | then throw("Problem with Hashes") |
---|
233 | | - | else if ((size(au.payments) == 0)) |
---|
234 | | - | then throw("No payment attached") |
---|
235 | | - | else { |
---|
236 | | - | let aA = value(au.payments[0]) |
---|
237 | | - | let aB = value(aA.amount) |
---|
238 | | - | let aC = if (if (isDefined(aA.assetId)) |
---|
239 | | - | then (aA.assetId == f) |
---|
240 | | - | else false) |
---|
241 | | - | then aA.assetId |
---|
242 | | - | else throw("Only SIGN token accepted at the moment") |
---|
243 | | - | let aD = x(("certification_fee_" + toBase58String(f))) |
---|
244 | | - | if ((aB != aD)) |
---|
245 | | - | then throw(("Payment amount should be " + toString(aD))) |
---|
246 | | - | else { |
---|
247 | | - | let aE = t(aj(F, L)) |
---|
248 | | - | if ((aE != "")) |
---|
249 | | - | then throw("You already added it") |
---|
250 | | - | else { |
---|
251 | | - | let aF = t(ag(F)) |
---|
252 | | - | if ((aF != "")) |
---|
253 | | - | then throw("Hash already registered") |
---|
254 | | - | else { |
---|
255 | | - | let aG = C(D, L, F) |
---|
256 | | - | if (!(aG)) |
---|
257 | | - | then throw("Sign Certificate not found for this address.") |
---|
258 | | - | else if ((size(al) == 0)) |
---|
259 | | - | then throw("Display CID cannot be empty") |
---|
260 | | - | else if (!(ar(av, 100))) |
---|
261 | | - | then throw("100 Char. max name") |
---|
262 | | - | else if (!(ar(aw, 1000))) |
---|
263 | | - | then throw("1000 Char. max description") |
---|
264 | | - | else if ((size(split(ax, ",")) > 5)) |
---|
265 | | - | then throw("5 tags max.") |
---|
266 | | - | else { |
---|
267 | | - | let aH = { |
---|
268 | | - | let v = getString(d, ("user_status_" + L)) |
---|
269 | | - | if ($isInstanceOf(v, "String")) |
---|
270 | | - | then { |
---|
271 | | - | let aI = v |
---|
272 | | - | aI |
---|
273 | | - | } |
---|
274 | | - | else s |
---|
275 | | - | } |
---|
276 | | - | let aJ = lastBlock.timestamp |
---|
277 | | - | if (if (isDefined(aH)) |
---|
278 | | - | then (aH == s) |
---|
279 | | - | else false) |
---|
280 | | - | then throw("Register this account first with \"Account\" tab") |
---|
281 | | - | else if ((aH == q)) |
---|
282 | | - | then throw("Account suspended") |
---|
283 | | - | else if ((aH == r)) |
---|
284 | | - | then throw("Account removed") |
---|
285 | | - | else if ((az > 10)) |
---|
286 | | - | then throw("10 editions max") |
---|
287 | | - | else if ((size(F) != 64)) |
---|
288 | | - | then throw("Hash 64 char. max") |
---|
289 | | - | else [StringEntry(ag(F), L), StringEntry(aj(F, L), N), IntegerEntry(M(L, N), aJ), StringEntry(O(L, N), av), StringEntry(P(L, N), aw), StringEntry(Q(L, N), al), StringEntry(S(L, N), am), StringEntry(R(L, N), ap), StringEntry(X(L, N), aq), StringEntry(Y(L, N), an), StringEntry(aa(L, N), ay), StringEntry(Z(L, N), ax), IntegerEntry(T(L, N), az), StringEntry(U(L, N), D), IntegerEntry(V(L, N), 0), BooleanEntry(W(L, N), false), StringEntry(ah(L, D), N), StringEntry(ae(L, N), F), ScriptTransfer(Address(fromBase58String(c)), aB, aC)] |
---|
290 | | - | } |
---|
291 | | - | } |
---|
292 | | - | } |
---|
293 | | - | } |
---|
294 | | - | } |
---|
295 | | - | } |
---|
296 | | - | |
---|
297 | | - | |
---|
298 | | - | |
---|
299 | | - | @Callable(au) |
---|
300 | | - | func updateArtwork (af,av,aw,ax,ay,az,al,ap,am,aq,an) = if (!(o)) |
---|
301 | | - | then throw(p) |
---|
302 | | - | else { |
---|
303 | | - | let aK = toBase58String(au.transactionId) |
---|
304 | | - | let L = toBase58String(au.caller.bytes) |
---|
305 | | - | if (!(ak(al, am, an))) |
---|
306 | | - | then throw("Problem with CID") |
---|
307 | | - | else if (!(ao(ap, aq))) |
---|
308 | | - | then throw("Problem with Hashes") |
---|
309 | | - | else { |
---|
310 | | - | let aE = t(O(L, af)) |
---|
311 | | - | if ((aE == "")) |
---|
312 | | - | then throw("Entry not found") |
---|
313 | | - | else if (!(ar(av, 100))) |
---|
314 | | - | then throw("100 Char. max name") |
---|
315 | | - | else if (!(ar(aw, 1000))) |
---|
316 | | - | then throw("1000 Char. max description") |
---|
317 | | - | else { |
---|
318 | | - | let aL = t(ad(L, af)) |
---|
319 | | - | if ((aL == "ILLEGAL")) |
---|
320 | | - | then throw("Cannot update") |
---|
321 | | - | else { |
---|
322 | | - | let aM = { |
---|
323 | | - | let v = getInteger(this, V(L, af)) |
---|
324 | | - | if ($isInstanceOf(v, "Int")) |
---|
325 | | - | then { |
---|
326 | | - | let aN = v |
---|
327 | | - | if ((aN == 0)) |
---|
328 | | - | then false |
---|
329 | | - | else true |
---|
330 | | - | } |
---|
331 | | - | else false |
---|
332 | | - | } |
---|
333 | | - | if ((size(split(ax, ",")) > 5)) |
---|
334 | | - | then throw("5 tags max.") |
---|
335 | | - | else { |
---|
336 | | - | let aH = { |
---|
337 | | - | let v = getString(d, ("user_status_" + L)) |
---|
338 | | - | if ($isInstanceOf(v, "String")) |
---|
339 | | - | then { |
---|
340 | | - | let aI = v |
---|
341 | | - | aI |
---|
342 | | - | } |
---|
343 | | - | else s |
---|
344 | | - | } |
---|
345 | | - | if (if (isDefined(aH)) |
---|
346 | | - | then (aH == s) |
---|
347 | | - | else false) |
---|
348 | | - | then throw("Register first with \"User infos\"") |
---|
349 | | - | else if ((aH == q)) |
---|
350 | | - | then throw("Account suspended") |
---|
351 | | - | else if ((aH == r)) |
---|
352 | | - | then throw("Account removed") |
---|
353 | | - | else if ((az > 10)) |
---|
354 | | - | then throw("10 editions max per artwork") |
---|
355 | | - | else if (!(aM)) |
---|
356 | | - | then [StringEntry(O(L, af), av), StringEntry(P(L, af), aw), StringEntry(Q(L, af), al), StringEntry(S(L, af), am), StringEntry(R(L, af), ap), StringEntry(Y(L, af), an), StringEntry(X(L, af), aq), IntegerEntry(T(L, af), az), StringEntry(Z(L, af), ax), StringEntry(aa(L, af), ay)] |
---|
357 | | - | else throw("Already minted") |
---|
358 | | - | } |
---|
359 | | - | } |
---|
360 | | - | } |
---|
361 | | - | } |
---|
362 | | - | } |
---|
363 | | - | |
---|
364 | | - | |
---|
365 | | - | |
---|
366 | | - | @Callable(z) |
---|
367 | | - | func flagArtwork (N,aO,aL) = { |
---|
368 | | - | let L = toString(addressFromPublicKey(z.callerPublicKey)) |
---|
369 | | - | let aP = toBase58String(z.transactionId) |
---|
370 | | - | if (containsElement([l, m], L)) |
---|
371 | | - | then if ((aL == "CONSENT")) |
---|
372 | | - | then [StringEntry(ad(aO, N), aL)] |
---|
373 | | - | else if ((aL == "")) |
---|
374 | | - | then [StringEntry(ad(aO, N), aL)] |
---|
375 | | - | else if ((aL == "ILLEGAL")) |
---|
376 | | - | then [StringEntry(ad(aO, N), aL), StringEntry(O(aO, N), "ILLEGAL CONTENT"), StringEntry(P(aO, N), "ILLEGAL CONTENT"), StringEntry(Q(aO, N), ""), StringEntry(S(aO, N), ""), StringEntry(Y(aO, N), "")] |
---|
377 | | - | else throw(("Unknow status" + aL)) |
---|
378 | | - | else throw("no") |
---|
379 | | - | } |
---|
380 | | - | |
---|
381 | | - | |
---|
382 | | - | |
---|
383 | | - | @Callable(z) |
---|
384 | | - | func deleteArtwork (N,aO) = { |
---|
385 | | - | let L = toString(addressFromPublicKey(z.callerPublicKey)) |
---|
386 | | - | let aP = toBase58String(z.transactionId) |
---|
387 | | - | let aQ = if (containsElement([l, m], L)) |
---|
388 | | - | then aO |
---|
389 | | - | else L |
---|
390 | | - | let aE = { |
---|
391 | | - | let v = getString(this, O(aQ, N)) |
---|
392 | | - | if ($isInstanceOf(v, "String")) |
---|
393 | | - | then { |
---|
394 | | - | let aI = v |
---|
395 | | - | aI |
---|
396 | | - | } |
---|
397 | | - | else throw("No art matching") |
---|
398 | | - | } |
---|
399 | | - | let aM = { |
---|
400 | | - | let v = getInteger(this, V(aQ, N)) |
---|
401 | | - | if ($isInstanceOf(v, "Int")) |
---|
402 | | - | then { |
---|
403 | | - | let aN = v |
---|
404 | | - | if ((aN != 0)) |
---|
405 | | - | then true |
---|
406 | | - | else false |
---|
407 | | - | } |
---|
408 | | - | else false |
---|
409 | | - | } |
---|
410 | | - | let aR = y(T(aQ, N)) |
---|
411 | | - | let F = { |
---|
412 | | - | let v = getString(this, ae(aQ, N)) |
---|
413 | | - | if ($isInstanceOf(v, "String")) |
---|
414 | | - | then { |
---|
415 | | - | let aI = v |
---|
416 | | - | aI |
---|
417 | | - | } |
---|
418 | | - | else throw("No art hash matching") |
---|
419 | | - | } |
---|
420 | | - | let D = { |
---|
421 | | - | let v = getString(this, U(aQ, N)) |
---|
422 | | - | if ($isInstanceOf(v, "String")) |
---|
423 | | - | then { |
---|
424 | | - | let aI = v |
---|
425 | | - | aI |
---|
426 | | - | } |
---|
427 | | - | else throw("No SIGN ID matching") |
---|
428 | | - | } |
---|
429 | | - | let aS = [DeleteEntry(M(aQ, N)), DeleteEntry(O(aQ, N)), DeleteEntry(P(aQ, N)), DeleteEntry(Q(aQ, N)), DeleteEntry(S(aQ, N)), DeleteEntry(R(aQ, N)), DeleteEntry(X(aQ, N)), DeleteEntry(Y(aQ, N)), DeleteEntry(aa(aQ, N)), DeleteEntry(Z(aQ, N)), DeleteEntry(T(aQ, N)), DeleteEntry(U(aQ, N)), DeleteEntry(V(aQ, N)), DeleteEntry(W(aQ, N)), DeleteEntry(ad(aO, N)), DeleteEntry(ag(F)), DeleteEntry(ah(aQ, D)), DeleteEntry(aj(F, aQ))] |
---|
430 | | - | if (!(aM)) |
---|
431 | | - | then if (!(o)) |
---|
432 | | - | then throw(p) |
---|
433 | | - | else aS |
---|
434 | | - | else throw("Art already minted, cannot delete") |
---|
435 | | - | } |
---|
436 | | - | |
---|
437 | | - | |
---|
438 | | - | |
---|
439 | | - | @Callable(z) |
---|
440 | | - | func sellArtwork (N,aT,aR,aC) = if (!(o)) |
---|
441 | | - | then throw(p) |
---|
442 | | - | else { |
---|
443 | | - | let aP = toBase58String(z.transactionId) |
---|
444 | | - | let L = toBase58String(z.caller.bytes) |
---|
445 | | - | let aU = lastBlock.timestamp |
---|
446 | | - | let aV = t(S(L, N)) |
---|
447 | | - | if ((size(split(aV, "/")[0]) != 59)) |
---|
448 | | - | then throw("You cannot sell art with no export file") |
---|
449 | | - | else { |
---|
450 | | - | let aW = t(R(L, N)) |
---|
451 | | - | if ((size(aW) != 64)) |
---|
452 | | - | then throw("You cannot sell art with no export hash") |
---|
453 | | - | else if (if (if ((aC != toBase58String(f))) |
---|
454 | | - | then (aC != toBase58String(h)) |
---|
455 | | - | else false) |
---|
456 | | - | then (aC != toBase58String(g)) |
---|
457 | | - | else false) |
---|
458 | | - | then throw("Only SIGN, USDN or WAVES accepted") |
---|
459 | | - | else { |
---|
460 | | - | let aX = x("waves_min_sell") |
---|
461 | | - | let aY = 1000000 |
---|
462 | | - | let aZ = (x(("certification_fee_" + toBase58String(f))) * 2) |
---|
463 | | - | if (if (if (if (if ((aC == toBase58String(g))) |
---|
464 | | - | then (aY > aT) |
---|
465 | | - | else false) |
---|
466 | | - | then (aT != 0) |
---|
467 | | - | else false) |
---|
468 | | - | then true |
---|
469 | | - | else if (if ((aC == toBase58String(f))) |
---|
470 | | - | then (aZ > aT) |
---|
471 | | - | else false) |
---|
472 | | - | then (aT != 0) |
---|
473 | | - | else false) |
---|
474 | | - | then true |
---|
475 | | - | else if (if ((aC == toBase58String(h))) |
---|
476 | | - | then (aX > aT) |
---|
477 | | - | else false) |
---|
478 | | - | then (aT != 0) |
---|
479 | | - | else false) |
---|
480 | | - | then throw("Wrong minimum sell price") |
---|
481 | | - | else { |
---|
482 | | - | let ba = { |
---|
483 | | - | let v = getString(this, O(L, N)) |
---|
484 | | - | if ($isInstanceOf(v, "String")) |
---|
485 | | - | then { |
---|
486 | | - | let aI = v |
---|
487 | | - | aI |
---|
488 | | - | } |
---|
489 | | - | else throw("This art doesn't match") |
---|
490 | | - | } |
---|
491 | | - | let aH = { |
---|
492 | | - | let v = getString(d, K(L)) |
---|
493 | | - | if ($isInstanceOf(v, "String")) |
---|
494 | | - | then { |
---|
495 | | - | let aI = v |
---|
496 | | - | aI |
---|
497 | | - | } |
---|
498 | | - | else throw("Register this account first") |
---|
499 | | - | } |
---|
500 | | - | let bb = y(V(L, N)) |
---|
501 | | - | let bc = y(T(L, N)) |
---|
502 | | - | if (if ((bb != 0)) |
---|
503 | | - | then (bb == bc) |
---|
504 | | - | else false) |
---|
505 | | - | then throw("Max edition reached.") |
---|
506 | | - | else if (if ((bb > 0)) |
---|
507 | | - | then (bc != aR) |
---|
508 | | - | else false) |
---|
509 | | - | then throw("Cannot change maximum issuable anymore") |
---|
510 | | - | else if ((aH == q)) |
---|
511 | | - | then throw("Account suspended") |
---|
512 | | - | else if ((aH == r)) |
---|
513 | | - | then throw("Account deleted") |
---|
514 | | - | else { |
---|
515 | | - | let bd = if (if ((aT > 0)) |
---|
516 | | - | then (aR > 0) |
---|
517 | | - | else false) |
---|
518 | | - | then true |
---|
519 | | - | else false |
---|
520 | | - | [BooleanEntry(W(L, N), bd), IntegerEntry(ab(L, N), aT), IntegerEntry(T(L, N), aR), StringEntry(ac(L, N), aC)] |
---|
521 | | - | } |
---|
522 | | - | } |
---|
523 | | - | } |
---|
524 | | - | } |
---|
525 | | - | } |
---|
526 | | - | |
---|
527 | | - | |
---|
528 | | - | |
---|
529 | | - | @Callable(z) |
---|
530 | | - | func buyArtwork (N,be) = if (!(o)) |
---|
531 | | - | then throw(p) |
---|
532 | | - | else { |
---|
533 | | - | let aP = toBase58String(z.transactionId) |
---|
534 | | - | let L = toBase58String(z.caller.bytes) |
---|
535 | | - | let bf = y("total_nft_issued") |
---|
536 | | - | let D = t(U(be, N)) |
---|
537 | | - | let ba = { |
---|
538 | | - | let v = getString(this, O(be, N)) |
---|
539 | | - | if ($isInstanceOf(v, "String")) |
---|
540 | | - | then { |
---|
541 | | - | let aI = v |
---|
542 | | - | aI |
---|
543 | | - | } |
---|
544 | | - | else throw("Art doesn't exist") |
---|
545 | | - | } |
---|
546 | | - | let bg = t(Q(be, N)) |
---|
547 | | - | let aV = t(S(be, N)) |
---|
548 | | - | let aW = t(R(be, N)) |
---|
549 | | - | let bh = t(Y(be, N)) |
---|
550 | | - | let bi = t(X(be, N)) |
---|
551 | | - | let aw = take(t(P(be, N)), 50) |
---|
552 | | - | let bb = y(V(be, N)) |
---|
553 | | - | let bj = y(ab(be, N)) |
---|
554 | | - | let bk = B(W(be, N)) |
---|
555 | | - | let bl = t(ac(be, N)) |
---|
556 | | - | let bm = t(ae(be, N)) |
---|
557 | | - | if ((bj == 0)) |
---|
558 | | - | then throw("Art not for sell") |
---|
559 | | - | else if (!(bk)) |
---|
560 | | - | then throw("Art not for sale") |
---|
561 | | - | else { |
---|
562 | | - | let bc = y(T(be, N)) |
---|
563 | | - | let aA = value(z.payments[0]) |
---|
564 | | - | let aB = value(aA.amount) |
---|
565 | | - | let aC = if (if (if (isDefined(aA.assetId)) |
---|
566 | | - | then (size(fromBase58String(bl)) > 0) |
---|
567 | | - | else false) |
---|
568 | | - | then (aA.assetId == fromBase58String(bl)) |
---|
569 | | - | else false) |
---|
570 | | - | then aA.assetId |
---|
571 | | - | else unit |
---|
572 | | - | let bn = A(be) |
---|
573 | | - | let bo = if ((bn == 1)) |
---|
574 | | - | then 0 |
---|
575 | | - | else if ((bl == toBase58String(f))) |
---|
576 | | - | then 8 |
---|
577 | | - | else 10 |
---|
578 | | - | let bp = fraction(aB, bo, 100) |
---|
579 | | - | let bq = (aB - bp) |
---|
580 | | - | if ((bb == bc)) |
---|
581 | | - | then throw("Art sold out") |
---|
582 | | - | else if ((bj != aB)) |
---|
583 | | - | then throw("Payment don't match") |
---|
584 | | - | else { |
---|
585 | | - | let br = (bb + 1) |
---|
586 | | - | let bs = lastBlock.timestamp |
---|
587 | | - | let bt = ((((((((((((((((((((((((((("Creator: " + be) + ", |
---|
588 | | - | ArtID: ") + N) + ", |
---|
589 | | - | SignID: ") + D) + ", |
---|
590 | | - | Artwork name: ") + ba) + ", |
---|
591 | | - | Artwork description: ") + aw) + ", |
---|
592 | | - | Issue: ") + toString(br)) + "/") + toString(bc)) + ", |
---|
593 | | - | Max issuable: ") + toString(bc)) + ", |
---|
594 | | - | Source hash: ") + bm) + ", |
---|
595 | | - | Display cid: ") + bg) + ", |
---|
596 | | - | Export cid: ") + aV) + ", |
---|
597 | | - | Export hash: ") + aW) + ", |
---|
598 | | - | Licence cid: ") + bh) + ", |
---|
599 | | - | Licence hash: ") + bi) |
---|
600 | | - | let bu = Issue(("SA_" + toString((bf + 1))), bt, 1, 0, false) |
---|
601 | | - | let bv = calculateAssetId(bu) |
---|
602 | | - | let bd = if ((br == bc)) |
---|
603 | | - | then false |
---|
604 | | - | else true |
---|
605 | | - | [IntegerEntry(V(be, N), br), StringEntry(("nft_" + toBase58String(bv)), ((((((("art_sold_" + toString(br)) + "_of_") + toString(bc)) + "_") + N) + "_") + be)), StringEntry(((((((("art_sold_" + toString(br)) + "_of_") + toString(bc)) + "_") + N) + "_") + be), ((((((((((L + "_") + toString(bs)) + "_") + aP) + "_") + toString(bj)) + "_") + bl) + "_") + toBase58String(bv))), IntegerEntry("total_nft_issued", (bf + 1)), BooleanEntry(W(be, N), bd), bu, ScriptTransfer(Address(fromBase58String(be)), bq, aC), ScriptTransfer(Address(fromBase58String(c)), bp, aC), ScriptTransfer(z.caller, 1, bv)] |
---|
606 | | - | } |
---|
607 | | - | } |
---|
608 | | - | } |
---|
609 | | - | |
---|
610 | | - | |
---|
611 | | - | |
---|
612 | | - | @Callable(z) |
---|
613 | | - | func deleteEntry (bw) = { |
---|
614 | | - | let L = toString(addressFromPublicKey(z.callerPublicKey)) |
---|
615 | | - | if ((L == l)) |
---|
616 | | - | then [DeleteEntry(bw)] |
---|
617 | | - | else throw("no") |
---|
| 8 | + | @Callable(c) |
---|
| 9 | + | func whitelist (d,e) = { |
---|
| 10 | + | let f = toString(addressFromPublicKey(c.callerPublicKey)) |
---|
| 11 | + | let g = toBase58String(c.transactionId) |
---|
| 12 | + | let h = if ((e == 0)) |
---|
| 13 | + | then e |
---|
| 14 | + | else (height + (1440 * e)) |
---|
| 15 | + | if (containsElement([a, b], f)) |
---|
| 16 | + | then [IntegerEntry(d, h)] |
---|
| 17 | + | else throw("You are anot authorized to whitelist artists") |
---|