tx · J3TTFsQL5mMGDSTMv42VcAyPayB7x1tMDU78qoUo6ufE

3NBynfbXC2KastUxhukcMUaE58K9cBdB9UY:  -0.01400000 Waves

2020.12.01 12:16 [1289404] smart account 3NBynfbXC2KastUxhukcMUaE58K9cBdB9UY > SELF 0.00000000 Waves

{ "type": 13, "id": "J3TTFsQL5mMGDSTMv42VcAyPayB7x1tMDU78qoUo6ufE", "fee": 1400000, "feeAssetId": null, "timestamp": 1606814210893, "version": 2, "chainId": 84, "sender": "3NBynfbXC2KastUxhukcMUaE58K9cBdB9UY", "senderPublicKey": "J9DCtJJxJBWZdtDR12BA1U94Q3cZzMi4R6k5hYkAzmzC", "proofs": [ "5obqEjcZkTMJkntR3M8JEptMcyteieqm6fxB7s5WuEh2YCmojvgtXRBEpRZb56doJ4Y6zXpRYCiCQzvG5zcFjKNu" ], "script": "base64:AAIEAAAAAAAAAAgIAhIECgIIAQAAAAIAAAAABWNocmlzAgAAACMzTXNHNmpQTkNyVkpVdFlCN1hKQnhTN3V0V3NYQWY0bjlWcAAAAAAEam9lcAIAAAAjM016bTRWTHdzTjl1WndiVE16UGozWHV4VjZrRWZBUjhVRE4AAAABAAAAAWkBAAAACXdoaXRlbGlzdAAAAAIAAAAHYWRkcmVzcwAAAARkYXlzBAAAAAZjYWxsZXIJAAQlAAAAAQkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQgFAAAAAWkAAAAPY2FsbGVyUHVibGljS2V5BAAAAAJpZAkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkBAAAAAZleHBpcmUDCQAAAAAAAAIFAAAABGRheXMAAAAAAAAAAAAFAAAABGRheXMJAABkAAAAAgUAAAAGaGVpZ2h0CQAAaAAAAAIAAAAAAAAABaAFAAAABGRheXMDCQEAAAAPY29udGFpbnNFbGVtZW50AAAAAgkABEwAAAACBQAAAAVjaHJpcwkABEwAAAACBQAAAARqb2VwBQAAAANuaWwFAAAABmNhbGxlcgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAHYWRkcmVzcwUAAAAGZXhwaXJlBQAAAANuaWwJAAACAAAAAQIAAAAsWW91IGFyZSBhbm90IGF1dGhvcml6ZWQgdG8gd2hpdGVsaXN0IGFydGlzdHMAAAAAjtHyCw==", "height": 1289404, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HTKr2kYreHGDRjupRHQ12f2dWFce596ihSTeMwFJbogs Next: HKePwBfuT7fdiK7iyB1qno8ZB8ga45hUAj75jQahcoAe Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let oracleFee = value(addressFromString("3N2s5RtaHPBenCsx2ECcoFRbYHx3noZhXW1"))
5-
6-let signDapp = value(addressFromString("3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB"))
7-
8-let feeReceiver = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub"
9-
10-let userDapp = value(addressFromString("3N8xXaYjE27Aa79d5hHrhHu9HaFoTBmhDEj"))
11-
12-let whitelistDapp = value(addressFromString("3Mt6jj1WUYqd7DT7dHEubs9jETLUXMcAB8k"))
13-
14-let signAssetId = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a'
15-
16-let usdnAssetId = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'
17-
18-let wavesAssetId = base58''
19-
20-let signCut = 8
21-
22-let usdnCut = 10
23-
24-let wavesCut = 10
25-
264 let chris = "3MsG6jPNCrVJUtYB7XJBxS7utWsXAf4n9Vp"
275
286 let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN"
297
30-let WHITELISTEDONLY = true
31-
32-let dappRunning = true
33-
34-let maintenanceMSG = "SIGN Art is under maintenance"
35-
36-let userSuspended = "SUSPENDED"
37-
38-let userRemoved = "REMOVED"
39-
40-let userUnregistered = "UNREGISTERED"
41-
42-func getStringByKey (key) = match getString(this, key) {
43- case a: String =>
44- a
45- case _ =>
46- ""
47-}
48-
49-
50-func getIntegerByKeyFromOracle (key) = match getInteger(oracleFee, key) {
51- case a: Int =>
52- a
53- case _ =>
54- throw("Integer undefine or 0 in oracle")
55-}
56-
57-
58-func getIntegerByKey (key) = match getInteger(this, key) {
59- case i: Int =>
60- i
61- case _ =>
62- 0
63-}
64-
65-
66-func checkWhitelist (key) = match getInteger(whitelistDapp, key) {
67- case a: Int =>
68- if ((a >= height))
69- then 1
70- else 0
71- case _ =>
72- 0
73-}
74-
75-
76-func getBooleanByKey (key) = match getBoolean(this, key) {
77- case i: Boolean =>
78- i
79- case _ =>
80- false
81-}
82-
83-
84-func checkSignCertificate (signID,Owner,sha256Hash) = match getString(signDapp, ((("data_fc_" + signID) + "_") + Owner)) {
85- case a: String =>
86- if (contains(a, sha256Hash))
87- then true
88- else false
89- case _ =>
90- false
91-}
92-
93-
94-func validateCID (cid) = if (if ((75 > size(cid)))
95- then (60 > size(split(cid, "/")[0]))
96- else false)
97- then (16 > size(split(cid, "/")[1]))
98- else false
99-
100-
101-func validateHash (hash) = (65 > size(hash))
102-
103-
104-func keyUserStatus (caller) = ("user_status_" + caller)
105-
106-
107-func keyArtDate (caller,artId) = ((("art_date_" + artId) + "_") + caller)
108-
109-
110-func keyArtName (caller,artId) = ((("art_name_" + artId) + "_") + caller)
111-
112-
113-func keyArtDesc (caller,artId) = ((("art_desc_" + artId) + "_") + caller)
114-
115-
116-func keyArtDisplayCid (caller,artId) = ((("art_display_cid_" + artId) + "_") + caller)
117-
118-
119-func keyArtExportHash (caller,artId) = ((("art_export_hash_" + artId) + "_") + caller)
120-
121-
122-func keyArtExportCid (caller,artId) = ((("art_export_cid_" + artId) + "_") + caller)
123-
124-
125-func keyArtMaxMint (caller,artId) = ((("art_maxmint_" + artId) + "_") + caller)
126-
127-
128-func keyArtSignID (caller,artId) = ((("art_signid_" + artId) + "_") + caller)
129-
130-
131-func keyArtIssued (caller,artId) = ((("art_issued_" + artId) + "_") + caller)
132-
133-
134-func keyArtOnSale (caller,artId) = ((("art_onsale_" + artId) + "_") + caller)
135-
136-
137-func keyArtLicenceHash (caller,artId) = ((("art_licence_hash_" + artId) + "_") + caller)
138-
139-
140-func keyArtLicenceCid (caller,artId) = ((("art_licence_cid_" + artId) + "_") + caller)
141-
142-
143-func keyArtTags (caller,artId) = ((("art_tags_" + artId) + "_") + caller)
144-
145-
146-func keyArtType (caller,artId) = ((("art_type_" + artId) + "_") + caller)
147-
148-
149-func keyArtPrice (caller,artId) = ((("art_price_" + artId) + "_") + caller)
150-
151-
152-func keyArtAssetIdAccepted (caller,artId) = ((("art_assetAccepted_" + artId) + "_") + caller)
153-
154-
155-func keyArtFlag (caller,artId) = ((("art_flag_" + artId) + "_") + caller)
156-
157-
158-func keyArtHashByTxidAddr (caller,txid) = ((("get_hashbytxidaddr_" + txid) + "_") + caller)
159-
160-
161-func keyArtOwnerByHash (sha256Hash) = ("get_owner_by_hash_" + sha256Hash)
162-
163-
164-func keyArtArtidBySignid (caller,signId) = ((("get_artidbysignid_" + signId) + "_") + caller)
165-
166-
167-func keyArtTxidByHashOwner (sha256Hash,caller) = ("get_txid_by_hash_owner_" + toBase58String(sha256_16Kb(toBytes((sha256Hash + caller)))))
168-
169-
170-func validateAllCID (cidDisplay,cidExport,cidLicence) = if (if ((cidDisplay != ""))
171- then !(validateCID(cidDisplay))
172- else false)
173- then throw("Wrong Display CID")
174- else if (if ((cidExport != ""))
175- then !(validateCID(cidExport))
176- else false)
177- then throw("Wrong Export CID")
178- else if (if ((cidLicence != ""))
179- then !(validateCID(cidLicence))
180- else false)
181- then throw("Wrong Licence CID")
182- else true
183-
184-
185-func validateAllHash (sha256Export,sha256Licence) = if (if ((sha256Export != ""))
186- then !(validateHash(sha256Export))
187- else false)
188- then throw("Export Hash 64 char. max")
189- else if (if ((sha256Licence != ""))
190- then !(validateHash(sha256Licence))
191- else false)
192- then throw("Licence Hash 64 char. max")
193- else true
194-
195-
196-func validateString (str,max) = if ((size(str) == 0))
197- then throw("Field cannot be is empty")
198- else if ((size(str) > max))
199- then throw((str + " is too long"))
200- else true
201-
202-
203-@Callable(invoke)
204-func addArtwork (sha256Hash,signID,name,description,tags,type,maxmint,cidDisplay,sha256Export,cidExport,sha256Licence,cidLicence) = if (!(dappRunning))
205- then throw(maintenanceMSG)
206- else {
207- let artId = toBase58String(invoke.transactionId)
208- let caller = toBase58String(invoke.caller.bytes)
209- if (!(validateAllCID(cidDisplay, cidExport, cidLicence)))
210- then throw("Problem with CID")
211- else if (!(validateHash(sha256Hash)))
212- then throw("Hash should be 64 characters maximum")
213- else if (!(validateAllHash(sha256Export, sha256Licence)))
214- then throw("Problem with Hashes")
215- else if ((size(invoke.payments) == 0))
216- then throw("No payment attached")
217- else {
218- let payment = value(invoke.payments[0])
219- let amount = value(payment.amount)
220- let assetId = if (if (isDefined(payment.assetId))
221- then (payment.assetId == signAssetId)
222- else false)
223- then payment.assetId
224- else throw("Only SIGN token accepted at the moment")
225- let currentCertificationPrice = getIntegerByKeyFromOracle(("certification_fee_" + toBase58String(signAssetId)))
226- if ((amount != currentCertificationPrice))
227- then throw(("Payment amount should be " + toString(currentCertificationPrice)))
228- else {
229- let entryExist = getStringByKey(keyArtTxidByHashOwner(sha256Hash, caller))
230- if ((entryExist != ""))
231- then throw("You already added it")
232- else {
233- let hashExist = getStringByKey(keyArtOwnerByHash(sha256Hash))
234- if ((hashExist != ""))
235- then throw("Hash already registered")
236- else {
237- let isSignCertified = checkSignCertificate(signID, caller, sha256Hash)
238- if (!(isSignCertified))
239- then throw("Sign Certificate not found for this address.")
240- else if ((size(cidDisplay) == 0))
241- then throw("Display CID cannot be empty")
242- else if (!(validateString(name, 100)))
243- then throw("100 Char. max name")
244- else if (!(validateString(description, 1000)))
245- then throw("1000 Char. max description")
246- else if ((size(split(tags, ",")) > 5))
247- then throw("5 tags max.")
248- else {
249- let userIsRegistered = match getString(userDapp, ("user_status_" + caller)) {
250- case s: String =>
251- s
252- case _ =>
253- userUnregistered
254- }
255- let timestamp = lastBlock.timestamp
256- if (if (isDefined(userIsRegistered))
257- then (userIsRegistered == userUnregistered)
258- else false)
259- then throw("Register this account first with \"Account\" tab")
260- else if ((userIsRegistered == userSuspended))
261- then throw("Account suspended")
262- else if ((userIsRegistered == userRemoved))
263- then throw("Account removed")
264- else if ((maxmint > 10))
265- then throw("10 editions max")
266- else if ((size(sha256Hash) != 64))
267- then throw("Hash 64 char. max")
268- else [StringEntry(keyArtOwnerByHash(sha256Hash), caller), StringEntry(keyArtTxidByHashOwner(sha256Hash, caller), artId), IntegerEntry(keyArtDate(caller, artId), timestamp), StringEntry(keyArtName(caller, artId), name), StringEntry(keyArtDesc(caller, artId), description), StringEntry(keyArtDisplayCid(caller, artId), cidDisplay), StringEntry(keyArtExportCid(caller, artId), cidExport), StringEntry(keyArtExportHash(caller, artId), sha256Export), StringEntry(keyArtLicenceHash(caller, artId), sha256Licence), StringEntry(keyArtLicenceCid(caller, artId), cidLicence), StringEntry(keyArtType(caller, artId), type), StringEntry(keyArtTags(caller, artId), tags), IntegerEntry(keyArtMaxMint(caller, artId), maxmint), StringEntry(keyArtSignID(caller, artId), signID), IntegerEntry(keyArtIssued(caller, artId), 0), BooleanEntry(keyArtOnSale(caller, artId), false), StringEntry(keyArtArtidBySignid(caller, signID), artId), StringEntry(keyArtHashByTxidAddr(caller, artId), sha256Hash), ScriptTransfer(Address(fromBase58String(feeReceiver)), amount, assetId)]
269- }
270- }
271- }
272- }
273- }
274- }
275-
276-
277-
278-@Callable(invoke)
279-func updateArtwork (txid,name,description,tags,type,maxmint,cidDisplay,sha256Export,cidExport,sha256Licence,cidLicence) = if (!(dappRunning))
280- then throw(maintenanceMSG)
281- else {
282- let updateId = toBase58String(invoke.transactionId)
283- let caller = toBase58String(invoke.caller.bytes)
284- if (!(validateAllCID(cidDisplay, cidExport, cidLicence)))
285- then throw("Problem with CID")
286- else if (!(validateAllHash(sha256Export, sha256Licence)))
287- then throw("Problem with Hashes")
288- else {
289- let entryExist = getStringByKey(keyArtName(caller, txid))
290- if ((entryExist == ""))
291- then throw("Entry not found")
292- else if (!(validateString(name, 100)))
293- then throw("100 Char. max name")
294- else if (!(validateString(description, 1000)))
295- then throw("1000 Char. max description")
296- else {
297- let flag = getStringByKey(keyArtFlag(caller, txid))
298- if ((flag == "ILLEGAL"))
299- then throw("Cannot update")
300- else {
301- let artworkMinted = match getInteger(this, keyArtIssued(caller, txid)) {
302- case b: Int =>
303- if ((b == 0))
304- then false
305- else true
306- case _ =>
307- false
308- }
309- if ((size(split(tags, ",")) > 5))
310- then throw("5 tags max.")
311- else {
312- let userIsRegistered = match getString(userDapp, ("user_status_" + caller)) {
313- case s: String =>
314- s
315- case _ =>
316- userUnregistered
317- }
318- if (if (isDefined(userIsRegistered))
319- then (userIsRegistered == userUnregistered)
320- else false)
321- then throw("Register first with \"User infos\"")
322- else if ((userIsRegistered == userSuspended))
323- then throw("Account suspended")
324- else if ((userIsRegistered == userRemoved))
325- then throw("Account removed")
326- else if ((maxmint > 10))
327- then throw("10 editions max per artwork")
328- else if (!(artworkMinted))
329- then [StringEntry(keyArtName(caller, txid), name), StringEntry(keyArtDesc(caller, txid), description), StringEntry(keyArtDisplayCid(caller, txid), cidDisplay), StringEntry(keyArtExportCid(caller, txid), cidExport), StringEntry(keyArtExportHash(caller, txid), sha256Export), StringEntry(keyArtLicenceCid(caller, txid), cidLicence), StringEntry(keyArtLicenceHash(caller, txid), sha256Licence), IntegerEntry(keyArtMaxMint(caller, txid), maxmint), StringEntry(keyArtTags(caller, txid), tags), StringEntry(keyArtType(caller, txid), type)]
330- else throw("Already minted")
331- }
332- }
333- }
334- }
335- }
336-
337-
338-
3398 @Callable(i)
340-func flagArtwork (artId,addr,flag) = {
9+func whitelist (address,days) = {
34110 let caller = toString(addressFromPublicKey(i.callerPublicKey))
34211 let id = toBase58String(i.transactionId)
12+ let expire = if ((days == 0))
13+ then days
14+ else (height + (1440 * days))
34315 if (containsElement([chris, joep], caller))
344- then if ((flag == "CONSENT"))
345- then [StringEntry(keyArtFlag(addr, artId), flag)]
346- else if ((flag == ""))
347- then [StringEntry(keyArtFlag(addr, artId), flag)]
348- else if ((flag == "ILLEGAL"))
349- then [StringEntry(keyArtFlag(addr, artId), flag), StringEntry(keyArtName(addr, artId), "ILLEGAL CONTENT"), StringEntry(keyArtDesc(addr, artId), "ILLEGAL CONTENT"), StringEntry(keyArtDisplayCid(addr, artId), ""), StringEntry(keyArtExportCid(addr, artId), ""), StringEntry(keyArtLicenceCid(addr, artId), "")]
350- else throw(("Unknow status" + flag))
351- else throw("no")
352- }
353-
354-
355-
356-@Callable(i)
357-func deleteArtwork (artId,addr) = {
358- let caller = toString(addressFromPublicKey(i.callerPublicKey))
359- let id = toBase58String(i.transactionId)
360- let addressToUse = if (containsElement([chris, joep], caller))
361- then addr
362- else caller
363- let entryExist = match getString(this, keyArtName(addressToUse, artId)) {
364- case s: String =>
365- s
366- case _ =>
367- throw("No art matching")
368- }
369- let artworkMinted = match getInteger(this, keyArtIssued(addressToUse, artId)) {
370- case b: Int =>
371- if ((b != 0))
372- then true
373- else false
374- case _ =>
375- false
376- }
377- let maxMint = getIntegerByKey(keyArtMaxMint(addressToUse, artId))
378- let sha256Hash = match getString(this, keyArtHashByTxidAddr(addressToUse, artId)) {
379- case s: String =>
380- s
381- case _ =>
382- throw("No art hash matching")
383- }
384- let signID = match getString(this, keyArtSignID(addressToUse, artId)) {
385- case s: String =>
386- s
387- case _ =>
388- throw("No SIGN ID matching")
389- }
390- let dataToDelete = [DeleteEntry(keyArtDate(addressToUse, artId)), DeleteEntry(keyArtName(addressToUse, artId)), DeleteEntry(keyArtDesc(addressToUse, artId)), DeleteEntry(keyArtDisplayCid(addressToUse, artId)), DeleteEntry(keyArtExportCid(addressToUse, artId)), DeleteEntry(keyArtExportHash(addressToUse, artId)), DeleteEntry(keyArtLicenceHash(addressToUse, artId)), DeleteEntry(keyArtLicenceCid(addressToUse, artId)), DeleteEntry(keyArtType(addressToUse, artId)), DeleteEntry(keyArtTags(addressToUse, artId)), DeleteEntry(keyArtMaxMint(addressToUse, artId)), DeleteEntry(keyArtSignID(addressToUse, artId)), DeleteEntry(keyArtIssued(addressToUse, artId)), DeleteEntry(keyArtOnSale(addressToUse, artId)), DeleteEntry(keyArtFlag(addr, artId)), DeleteEntry(keyArtOwnerByHash(sha256Hash)), DeleteEntry(keyArtArtidBySignid(addressToUse, signID)), DeleteEntry(keyArtTxidByHashOwner(sha256Hash, addressToUse))]
391- if (!(artworkMinted))
392- then if (!(dappRunning))
393- then throw(maintenanceMSG)
394- else dataToDelete
395- else throw("Art already minted, cannot delete")
396- }
397-
398-
399-
400-@Callable(i)
401-func sellArtwork (artId,price,maxMint,assetId) = if (!(dappRunning))
402- then throw(maintenanceMSG)
403- else {
404- let id = toBase58String(i.transactionId)
405- let caller = toBase58String(i.caller.bytes)
406- let sellDate = lastBlock.timestamp
407- let exportCID = getStringByKey(keyArtExportCid(caller, artId))
408- if ((size(split(exportCID, "/")[0]) != 59))
409- then throw("You cannot sell art with no export file")
410- else {
411- let exportHash = getStringByKey(keyArtExportHash(caller, artId))
412- if ((size(exportHash) != 64))
413- then throw("You cannot sell art with no export hash")
414- else if (if (if ((assetId != toBase58String(signAssetId)))
415- then (assetId != toBase58String(wavesAssetId))
416- else false)
417- then (assetId != toBase58String(usdnAssetId))
418- else false)
419- then throw("Only SIGN, USDN or WAVES accepted")
420- else {
421- let minSellWaves = getIntegerByKeyFromOracle("waves_min_sell")
422- let minSellUsdn = 1000000
423- let minSellSign = (getIntegerByKeyFromOracle(("certification_fee_" + toBase58String(signAssetId))) * 2)
424- if (if (if (if (if ((assetId == toBase58String(usdnAssetId)))
425- then (minSellUsdn > price)
426- else false)
427- then (price != 0)
428- else false)
429- then true
430- else if (if ((assetId == toBase58String(signAssetId)))
431- then (minSellSign > price)
432- else false)
433- then (price != 0)
434- else false)
435- then true
436- else if (if ((assetId == toBase58String(wavesAssetId)))
437- then (minSellWaves > price)
438- else false)
439- then (price != 0)
440- else false)
441- then throw("Wrong minimum sell price")
442- else {
443- let artworkName = match getString(this, keyArtName(caller, artId)) {
444- case s: String =>
445- s
446- case _ =>
447- throw("This art doesn't match")
448- }
449- let userIsRegistered = match getString(userDapp, keyUserStatus(caller)) {
450- case s: String =>
451- s
452- case _ =>
453- throw("Register this account first")
454- }
455- let amountSold = getIntegerByKey(keyArtIssued(caller, artId))
456- let maxCanSell = getIntegerByKey(keyArtMaxMint(caller, artId))
457- if (if ((amountSold != 0))
458- then (amountSold == maxCanSell)
459- else false)
460- then throw("Max edition reached.")
461- else if (if ((amountSold > 0))
462- then (maxCanSell != maxMint)
463- else false)
464- then throw("Cannot change maximum issuable anymore")
465- else if ((userIsRegistered == userSuspended))
466- then throw("Account suspended")
467- else if ((userIsRegistered == userRemoved))
468- then throw("Account deleted")
469- else {
470- let sellStatus = if (if ((price > 0))
471- then (maxMint > 0)
472- else false)
473- then true
474- else false
475-[BooleanEntry(keyArtOnSale(caller, artId), sellStatus), IntegerEntry(keyArtPrice(caller, artId), price), IntegerEntry(keyArtMaxMint(caller, artId), maxMint), StringEntry(keyArtAssetIdAccepted(caller, artId), assetId)]
476- }
477- }
478- }
479- }
480- }
481-
482-
483-
484-@Callable(i)
485-func buyArtwork (artId,issuer) = if (!(dappRunning))
486- then throw(maintenanceMSG)
487- else {
488- let id = toBase58String(i.transactionId)
489- let caller = toBase58String(i.caller.bytes)
490- let totalNFT = getIntegerByKey("total_nft_issued")
491- let signID = getStringByKey(keyArtSignID(issuer, artId))
492- let artworkName = match getString(this, keyArtName(issuer, artId)) {
493- case s: String =>
494- s
495- case _ =>
496- throw("Art doesn't exist")
497- }
498- let displayCID = getStringByKey(keyArtDisplayCid(issuer, artId))
499- let exportCID = getStringByKey(keyArtExportCid(issuer, artId))
500- let exportHash = getStringByKey(keyArtExportHash(issuer, artId))
501- let licenceCID = getStringByKey(keyArtLicenceCid(issuer, artId))
502- let licenceHash = getStringByKey(keyArtLicenceHash(issuer, artId))
503- let description = take(getStringByKey(keyArtDesc(issuer, artId)), 50)
504- let amountSold = getIntegerByKey(keyArtIssued(issuer, artId))
505- let artworkPrice = getIntegerByKey(keyArtPrice(issuer, artId))
506- let isOnSale = getBooleanByKey(keyArtOnSale(issuer, artId))
507- let priceAssetId = getStringByKey(keyArtAssetIdAccepted(issuer, artId))
508- let sourceHash = getStringByKey(keyArtHashByTxidAddr(issuer, artId))
509- if ((artworkPrice == 0))
510- then throw("Art not for sell")
511- else if (!(isOnSale))
512- then throw("Art not for sale")
513- else {
514- let maxCanSell = getIntegerByKey(keyArtMaxMint(issuer, artId))
515- let payment = value(i.payments[0])
516- let amount = value(payment.amount)
517- let assetId = if (if (if (isDefined(payment.assetId))
518- then (size(fromBase58String(priceAssetId)) > 0)
519- else false)
520- then (payment.assetId == fromBase58String(priceAssetId))
521- else false)
522- then payment.assetId
523- else unit
524- let isWhitelisted = checkWhitelist(issuer)
525- let cut = if ((isWhitelisted == 1))
526- then 0
527- else if ((priceAssetId == toBase58String(signAssetId)))
528- then 8
529- else 10
530- let amountForSign = fraction(amount, cut, 100)
531- let amountForCreator = (amount - amountForSign)
532- if ((amountSold == maxCanSell))
533- then throw("Art sold out")
534- else if ((artworkPrice != amount))
535- then throw("Payment don't match")
536- else {
537- let newAmountSold = (amountSold + 1)
538- let entryDate = lastBlock.timestamp
539- let issueMeta = ((((((((((((((((((((((((((("Creator: " + issuer) + ",
540- ArtID: ") + artId) + ",
541- SignID: ") + signID) + ",
542- Artwork name: ") + artworkName) + ",
543- Artwork description: ") + description) + ",
544- Issue: ") + toString(newAmountSold)) + "/") + toString(maxCanSell)) + ",
545- Max issuable: ") + toString(maxCanSell)) + ",
546- Source hash: ") + sourceHash) + ",
547- Display cid: ") + displayCID) + ",
548- Export cid: ") + exportCID) + ",
549- Export hash: ") + exportHash) + ",
550- Licence cid: ") + licenceCID) + ",
551- Licence hash: ") + licenceHash)
552- let issueNFT = Issue(("SA_" + toString((totalNFT + 1))), issueMeta, 1, 0, false)
553- let idNFT = calculateAssetId(issueNFT)
554- let sellStatus = if ((newAmountSold == maxCanSell))
555- then false
556- else true
557-[IntegerEntry(keyArtIssued(issuer, artId), newAmountSold), StringEntry(("nft_" + toBase58String(idNFT)), ((((((("art_sold_" + toString(newAmountSold)) + "_of_") + toString(maxCanSell)) + "_") + artId) + "_") + issuer)), StringEntry(((((((("art_sold_" + toString(newAmountSold)) + "_of_") + toString(maxCanSell)) + "_") + artId) + "_") + issuer), ((((((((((caller + "_") + toString(entryDate)) + "_") + id) + "_") + toString(artworkPrice)) + "_") + priceAssetId) + "_") + toBase58String(idNFT))), IntegerEntry("total_nft_issued", (totalNFT + 1)), BooleanEntry(keyArtOnSale(issuer, artId), sellStatus), issueNFT, ScriptTransfer(Address(fromBase58String(issuer)), amountForCreator, assetId), ScriptTransfer(Address(fromBase58String(feeReceiver)), amountForSign, assetId), ScriptTransfer(i.caller, 1, idNFT)]
558- }
559- }
560- }
561-
562-
563-
564-@Callable(i)
565-func deleteEntry (entry) = {
566- let caller = toString(addressFromPublicKey(i.callerPublicKey))
567- if ((caller == chris))
568- then [DeleteEntry(entry)]
569- else throw("no")
16+ then [IntegerEntry(address, expire)]
17+ else throw("You are anot authorized to whitelist artists")
57018 }
57119
57220

github/deemru/w8io/169f3d6 
49.90 ms