tx · 38PrUFiT1pKYmiPUM2zVKa2YKxdz69eJorT8BmCzEXLw

3N1Dhq5ZZyoojQisuTLusYjnGisqrxDwGLy:  -0.01000000 Waves

2022.04.11 18:29 [2004110] smart account 3N1Dhq5ZZyoojQisuTLusYjnGisqrxDwGLy > SELF 0.00000000 Waves

{ "type": 13, "id": "38PrUFiT1pKYmiPUM2zVKa2YKxdz69eJorT8BmCzEXLw", "fee": 1000000, "feeAssetId": null, "timestamp": 1649690985884, "version": 2, "chainId": 84, "sender": "3N1Dhq5ZZyoojQisuTLusYjnGisqrxDwGLy", "senderPublicKey": "4ogfEQE7KGDWQR7Vd5VThqBebZ47NxrMLmAApR3sFuXW", "proofs": [ "5nRXDK6VTacKwgAjBUR4X1auFtDjbTMWp21a7VHQRBthn2uMqkfLDxtoU6J2gaiFEjZutDn8xfiZoGdXzaywwkwj" ], "script": "base64:AAIFAAAAAAAAACkIAhIDCgEIEgkKBwgICAgBAQESCQoHCAgICAEBARIECgIICBIECgIICAAAAAgAAAAACW9yYWNsZUtleQIAAAAJb3JhY2xlS2V5AQAAAAZnZXRTdHIAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAAAQAAAAZnZXRJbnQAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAAAAAAGb3JhY2xlCQEAAAAGZ2V0U3RyAAAAAQUAAAAJb3JhY2xlS2V5AAAAAAlvcmFjbGVGZWUJAQAAAAV2YWx1ZQAAAAEJAAQmAAAAAQUAAAAGb3JhY2xlAAAAAApzY29uZXhEYXBwCQAEJgAAAAEJAQAAABN2YWx1ZU9yRXJy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tUmV3YXJkBQAAABJhZGRyZXNzMlRlYW1SZXdhcmQFAAAAEmFkZHJlc3MzVGVhbVJld2FyZAQAAAAUc2NyaXB0VHJhbnNmZXJTZWxsZXIDCQAAAAAAAAIFAAAABnNlbGxlcgIAAAAABQAAAANuaWwJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAGc2VsbGVyBQAAAAxzZWxsZXJSZXdhcmQICQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAAAAB2Fzc2V0SWQFAAAAA25pbAkABE4AAAACCQAETgAAAAIJAAROAAAAAgkABE4AAAACCQAETgAAAAIJAAROAAAAAgUAAAAac2NyaXB0VHJhbnNmZXJBZGRyZXNzVGVhbTEFAAAAGnNjcmlwdFRyYW5zZmVyQWRkcmVzc1RlYW0yBQAAABpzY3JpcHRUcmFuc2ZlckFkZHJlc3NUZWFtMwUAAAAWc2NyaXB0VHJhbnNmZXJBZGRyZXNzMQUAAAAWc2NyaXB0VHJhbnNmZXJBZGRyZXNzMgUAAAAWc2NyaXB0VHJhbnNmZXJBZGRyZXNzMwUAAAAUc2NyaXB0VHJhbnNmZXJTZWxsZXIAAAAA5zd+YQ==", "height": 2004110, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5UFuuoyDANnumqRwF9KQXxQgkb3b1jJrPfsbF7XZm4TY Next: BNGMkPZLkhYECYhGHcco6G5vXRcKNeH2ZUBre3LhVGVF Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let unitTest = false
5-
64 let oracleKey = "oracleKey"
75
86 func getStr (key) = match getString(this, key) {
1311 }
1412
1513
14+func getInt (key) = match getInteger(this, key) {
15+ case b: Int =>
16+ b
17+ case _ =>
18+ 0
19+}
20+
21+
1622 let oracle = getStr(oracleKey)
1723
1824 let oracleFee = value(addressFromString(oracle))
1925
20-let owners = [getString(oracleFee, "owner1"), getString(oracleFee, "owner2")]
21-
22-let collectionsDapp = valueOrErrorMessage(getString(oracleFee, "collectionsDapp"), "collectionDapp not found")
26+let sconexDapp = addressFromString(valueOrErrorMessage(getString(oracleFee, "sconexDapp"), "sconexDapp not found"))
2327
2428 let feeReceiver = valueOrErrorMessage(getString(oracleFee, "feeReceiver"), "feeReceiver not found")
2529
26-let certDapp = valueOrErrorMessage(getString(oracleFee, "certDapp"), "certDapp not found")
27-
28-let feeDapp = valueOrErrorMessage(getString(oracleFee, "feeDapp"), "feeDapp not found")
29-
30-let userDapp = value(addressFromString(valueOrErrorMessage(getString(oracleFee, "userDapp"), "userdapp not found")))
31-
32-let USDNAssetId = fromBase58String(getStringValue(oracleFee, "USDNAssetId"))
33-
34-let SconexAssetId = fromBase58String(getStringValue(oracleFee, "SconexAssetId"))
35-
36-let types = ["IMAGE", "PDF", "VIDEO"]
37-
38-let Previewtypes = ["PDF"]
39-
40-let dappRunning = valueOrElse(getBoolean(userDapp, "conf_dapp_is_running"), true)
41-
42-let maintenanceMSG = valueOrElse(getString(userDapp, "conf_maintenance_msg"), "")
43-
44-let userSuspended = "SUSPENDED"
45-
46-let userRemoved = "REMOVED"
47-
48-let userUnregistered = "UNREGISTERED"
49-
50-let auctionType1 = "BIDTYPE"
51-
52-let auctionType2 = "TRADITIONAL"
53-
54-let auctionType3 = "DIRECT"
55-
56-func getStringByKeyFromUsers (key) = valueOrElse(getString(userDapp, key), "")
57-
58-
59-func getStringByKey (key) = valueOrElse(getString(this, key), "")
60-
61-
62-func getStringByKeyOrError (key,error) = valueOrErrorMessage(getString(this, key), error)
63-
64-
65-func getIntegerByKeyFromOracle (key) = valueOrErrorMessage(getInteger(oracleFee, key), "Integer undefine or 0 in oracle")
66-
67-
68-func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0)
69-
70-
71-func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false)
72-
73-
74-func validateHash (hash) = (size(hash) == 64)
75-
76-
77-func keyUserStatus (caller) = ("user_status_" + caller)
78-
79-
80-func keyDate (caller,artId) = ((("art_date_" + artId) + "_") + caller)
81-
82-
83-func keyName (caller,artId) = ((("art_name_" + artId) + "_") + caller)
84-
85-
86-func keyDesc (caller,artId) = ((("art_desc_" + artId) + "_") + caller)
87-
88-
89-func keyDisplayCid (caller,artId) = ((("art_display_cid_" + artId) + "_") + caller)
90-
91-
92-func keyPreviewCid (caller,artId) = ((("art_preview_cid_" + artId) + "_") + caller)
93-
94-
95-func keyMaxMint (caller,artId) = ((("art_maxmint_" + artId) + "_") + caller)
96-
97-
98-func keyHighestBidBidId (artId) = ("art_highestBidBidId_" + artId)
99-
100-
101-func keyBidId (bidId) = ("bid_" + bidId)
102-
103-
104-func keyDuration (caller,artId) = ((("art_duration_" + artId) + "_") + caller)
105-
106-
107-func keyEndHeight (caller,artId) = ((("art_endheight_" + artId) + "_") + caller)
108-
109-
110-func keyAuctionType (caller,artId) = ((("art_auctiontype_" + artId) + "_") + caller)
111-
112-
113-func keyIssued (caller,artId) = ((("art_issued_" + artId) + "_") + caller)
114-
115-
116-func KeyNftIssuer (nftId) = ("nft_issued_" + nftId)
117-
118-
119-func KeyNftArtId (nftId) = ("nft_artId_" + nftId)
120-
121-
122-func keyOnSale (caller,artId) = ((("art_onsale_" + artId) + "_") + caller)
123-
124-
125-func keyEntitlement (caller,artId) = ((("art_entitlement_" + artId) + "_") + caller)
126-
127-
128-func keyTags (caller,artId) = ((("art_tags_" + artId) + "_") + caller)
129-
130-
131-func keyType (caller,artId) = ((("art_type_" + artId) + "_") + caller)
132-
133-
134-func keyPrice (caller,artId) = ((("art_price_" + artId) + "_") + caller)
135-
136-
137-func keyAssetIdAccepted (caller,artId) = ((("art_assetAccepted_" + artId) + "_") + caller)
138-
139-
140-func keyHashByTxidAddr (caller,txid) = ((("get_hashbytxidaddr_" + txid) + "_") + caller)
141-
142-
143-func keyOwnerByHash (sha256Hash) = ("get_owner_by_hash_" + sha256Hash)
144-
145-
146-func keyTxidByHashOwner (sha256Hash,caller) = ("get_txid_by_hash_owner_" + toBase58String(sha256_16Kb(toBytes((sha256Hash + caller)))))
147-
148-
149-func keyCollection (caller,artId) = ((("collection_" + artId) + "_") + caller)
150-
151-
152-let minUSDNPrice = getIntegerByKeyFromOracle(("min_" + toBase58String(USDNAssetId)))
153-
154-let currentFeeSconex = getIntegerByKeyFromOracle(("fee_" + toBase58String(SconexAssetId)))
155-
156-func getAmountByBidId (bidId) = valueOrElse(getIntegerByKey(keyBidId(bidId)), 0)
157-
158-
159-func getAmountHighestBidByArtId (artId) = {
160- let bidId = getStringByKey(keyHighestBidBidId(artId))
161- if ((bidId == ""))
162- then 0
163- else getAmountByBidId(bidId)
164- }
165-
166-
167-func validateString (str,max) = if ((size(str) == 0))
168- then throw("Field cannot be is empty")
169- else if ((size(str) > max))
170- then throw((str + " is too long"))
171- else true
172-
173-
174-func validateUser (caller) = {
175- let userStatus = valueOrElse(getString(userDapp, keyUserStatus(caller)), userUnregistered)
176- if ((userStatus == userUnregistered))
177- then "Register this account first with 'Account' tab"
178- else if ((userStatus == userSuspended))
179- then "Account suspended"
180- else if ((userStatus == userRemoved))
181- then "Account removed"
182- else ""
183- }
184-
185-
186-func validateArtworkData (caller,cidDisplay,name,description,tags) = {
187- let checkUser = validateUser(caller)
188- if ((checkUser != ""))
189- then throw(checkUser)
190- else if ((size(cidDisplay) == 0))
191- then throw("Display CID cannot be empty")
192- else if ((size(cidDisplay) != 46))
193- then throw("This doesn't seem a valid CID!")
194- else if (!(validateString(name, 100)))
195- then throw("100 Char. max name")
196- else if (!(validateString(description, 1000)))
197- then throw("1000 Char. max description")
198- else if ((size(split(tags, ",")) > 5))
199- then throw("5 tags max.")
200- else ""
201- }
202-
203-
204-func isPayment (i) = if ((size(i.payments) == 0))
205- then throw("No payment attached")
206- else {
207- let payment = value(i.payments[0])
208- let amount = value(payment.amount)
209- $Tuple2(payment, amount)
210- }
211-
212-
213-func validatePayment (i) = {
214- let t089829018 = isPayment(i)
215- let payment = t089829018._1
216- let amount = t089829018._2
217- let assetId = if (if (isDefined(payment.assetId))
218- then (payment.assetId == SconexAssetId)
219- else false)
220- then payment.assetId
221- else throw((("Only " + toBase58String(SconexAssetId)) + " token accepted as transaction fee"))
222- if ((amount != currentFeeSconex))
223- then throw(((("Payment amount should be " + toString(currentFeeSconex)) + " but is: ") + toString(amount)))
224- else $Tuple2(amount, assetId)
225- }
226-
227-
228-func isArtMinted (addrToUse,artId) = match getInteger(this, keyIssued(addrToUse, artId)) {
229- case b: Int =>
230- if ((b != 0))
231- then true
232- else false
233- case _ =>
234- false
235-}
236-
237-
238-func validatePriceAssetId (i,priceAssetId,artworkPrice) = {
239- let t096119647 = isPayment(i)
240- let payment = t096119647._1
241- let amount = t096119647._2
242- let assetId = if (!(isDefined(payment.assetId)))
243- then throw("Wrong asset id")
244- else if (if ((size(priceAssetId) > 0))
245- then (toBase58String(value(payment.assetId)) == priceAssetId)
246- else false)
247- then payment.assetId
248- else throw("Wrong asset id")
249- if (if ((assetId == unit))
250- then (priceAssetId != "")
251- else false)
252- then throw("Wrong asset id")
253- else if ((artworkPrice != amount))
254- then throw(((("Payment don't match " + toString(artworkPrice)) + " ") + toString(amount)))
255- else $Tuple2(amount, assetId)
256- }
257-
258-
259-func acceptedAssetIds (assetId) = if ((assetId != toBase58String(USDNAssetId)))
260- then throw("Only USDN accepted")
261- else true
262-
263-
264-func validateMinSell (assetId,price) = {
265- let minSellSconex = minUSDNPrice
266- if (if ((minSellSconex > price))
267- then true
268- else (assetId != toBase58String(USDNAssetId)))
269- then throw(("Wrong minimum sell price " + toString(minSellSconex)))
270- else true
271- }
272-
273-
274-func getBidAssetId (assetId) = if ((assetId == "WAVES"))
275- then throw("Only USDN is accepted!")
276- else fromBase58String(assetId)
277-
278-
279-func getPriceAssetIdFromBid (bidDataKey) = {
280- let bidData = getStringByKey((bidDataKey + "_OPEN"))
281- if ((bidData == ""))
282- then throw("Bid not found")
283- else {
284- let bidDataArr = split(bidData, "_")
285- let bidAmount = parseIntValue(bidDataArr[1])
286- let bidAssetId = getBidAssetId(bidDataArr[0])
287- if ((0 >= bidAmount))
288- then throw("Wrong amount")
289- else $Tuple2(bidAmount, bidAssetId)
290- }
291- }
292-
293-
294-func idCallerDate (i) = if (!(dappRunning))
295- then throw(maintenanceMSG)
296- else $Tuple3(toBase58String(i.transactionId), toBase58String(i.caller.bytes), lastBlock.timestamp)
297-
298-
299-func getArtData (i,issuer,artId,isBid) = {
300- let callerIsIssuer = (toBase58String(i.caller.bytes) == issuer)
301- let totalNFT = getIntegerByKey("total_nft_issued")
302- let artworkName = getStringByKey(keyName(issuer, artId))
303- if ((artworkName == ""))
304- then throw("Art doesn't exist")
305- else {
306- let isOnSale = getBooleanByKey(keyOnSale(issuer, artId))
307- let amountSold = getIntegerByKey(keyIssued(issuer, artId))
308- let artworkPrice = valueOrElse(getIntegerByKey(keyPrice(issuer, artId)), minUSDNPrice)
309- let priceAssetId = if (callerIsIssuer)
310- then toBase58String(USDNAssetId)
311- else getStringByKey(keyAssetIdAccepted(issuer, artId))
312- let maxCanSell = getIntegerByKey(keyMaxMint(issuer, artId))
313- if (if (if (!(isBid))
314- then !(callerIsIssuer)
315- else false)
316- then if (if ((0 >= artworkPrice))
317- then true
318- else !(isOnSale))
319- then true
320- else (0 >= maxCanSell)
321- else false)
322- then throw("Art not for sale")
323- else if (if (if (!(isBid))
324- then callerIsIssuer
325- else false)
326- then (0 >= maxCanSell)
327- else false)
328- then throw("Max issuable not set")
329- else $Tuple7(totalNFT, artworkName, amountSold, artworkPrice, priceAssetId, maxCanSell, isOnSale)
330- }
331- }
332-
333-
334-func getBidData (i,caller,issuer,artId,bidOwner,bidId,priceAssetId,artworkPrice,isBid) = {
335- let checkUser = validateUser(issuer)
336- if (if (isBid)
337- then (checkUser != "")
338- else false)
339- then throw(checkUser)
340- else {
341- let bidDataKey = ((((((("bid_" + artId) + "_") + issuer) + "_") + bidOwner) + "_") + bidId)
342- let t01351913648 = if (isBid)
343- then getPriceAssetIdFromBid(bidDataKey)
344- else validatePriceAssetId(i, priceAssetId, artworkPrice)
345- let amount = t01351913648._1
346- let assetId = t01351913648._2
347- $Tuple3(bidDataKey, amount, assetId)
348- }
349- }
350-
351-
352-func getIssueData (issuer,artId,artworkName,newAmountSold,maxCanSell,totalNFT,caller,bidOwner,bidId,i,isOnSale) = {
353- let issueMeta = ((((((((("Creator: " + issuer) + ",ArtID: ") + artId) + ",Artwork name: ") + artworkName) + ",Issue: ") + toString(newAmountSold)) + "/") + toString(maxCanSell))
354- let sellStatus = if (if ((newAmountSold == maxCanSell))
355- then true
356- else !(isOnSale))
357- then false
358- else true
359- let receiveNFT = if ((bidOwner != ""))
360- then addressFromStringValue(bidOwner)
361- else i.caller
362- $Tuple3(sellStatus, receiveNFT, issueMeta)
363- }
364-
365-
366-func getBidKeyVal (assetId,bidDataKey,date) = {
367- let assetIdBid = if (!(isDefined(assetId)))
368- then throw("Only USDN is accepted")
369- else toBase58String(value(assetId))
370- let bidData = getStringByKey((bidDataKey + "_OPEN"))
371- let bidDelOld = DeleteEntry((bidDataKey + "_OPEN"))
372- let bidUpdate = StringEntry((bidDataKey + "_CLOSED"), ((bidData + "_") + toString(date)))
373- $Tuple3(assetIdBid, bidDelOld, bidUpdate)
374- }
375-
376-
377-func buyMint (i,artId,issuer,bidId,bidOwner,isBid) = {
378- let callerData = idCallerDate(i)
379- let id = callerData._1
380- let caller = callerData._2
381- let date = callerData._3
382- let artData = getArtData(i, issuer, artId, isBid)
383- let totalNFT = artData._1
384- let artworkName = artData._2
385- let amountSold = artData._3
386- let artworkPrice = artData._4
387- let priceAssetId = artData._5
388- let maxCanSell = artData._6
389- let isOnSale = artData._7
390- let bidData = getBidData(i, caller, issuer, artId, bidOwner, bidId, priceAssetId, artworkPrice, isBid)
391- let bidDataKey = bidData._1
392- let amount = bidData._2
393- let assetId = bidData._3
394- let newAmountSold = if ((amountSold == maxCanSell))
395- then throw("Max items sold")
396- else (amountSold + 1)
397- let issuerData = getIssueData(issuer, artId, artworkName, newAmountSold, maxCanSell, totalNFT, caller, bidOwner, bidId, i, isOnSale)
398- let sellStatus = issuerData._1
399- let receiveNFT = issuerData._2
400- let issueMeta = issuerData._3
401- let idNFTInvoke = invoke(this, "mintNft", [totalNFT, issueMeta, toString(receiveNFT)], nil)
402- if ((idNFTInvoke == idNFTInvoke))
403- then {
404- let idNFT = match idNFTInvoke {
405- case r: String =>
406- r
407- case _ =>
408- throw("Incorrect invoke result")
409- }
410- let bidKeyValue = getBidKeyVal(assetId, bidDataKey, date)
411- let assetIdBid = bidKeyValue._1
412- let bidDelOld = bidKeyValue._2
413- let bidUpdate = bidKeyValue._3
414- let soldKey = ((((((("art_sold_" + toString(newAmountSold)) + "_of_") + toString(maxCanSell)) + "_") + artId) + "_") + issuer)
415- let soldValue = if (!(isBid))
416- then ((((((((((caller + "_") + toString(date)) + "_") + id) + "_") + toString(artworkPrice)) + "_") + priceAssetId) + "_") + idNFT)
417- else ((((((((((toString(receiveNFT) + "_") + toString(date)) + "_") + id) + "_") + toString(amount)) + "_") + assetIdBid) + "_") + idNFT)
418- let invokeTeamFeeSplit = invoke(valueOrErrorMessage(addressFromString(feeDapp), (feeDapp + " not found")), "payFee", [artId, issuer], [AttachedPayment(assetId, amount)])
419- if ((invokeTeamFeeSplit == invokeTeamFeeSplit))
420- then {
421- let soldData = StringEntry(soldKey, soldValue)
422- let buyRes = [IntegerEntry(keyIssued(issuer, artId), newAmountSold), StringEntry(("nft_" + idNFT), soldKey), IntegerEntry("total_nft_issued", (totalNFT + 1)), BooleanEntry(keyOnSale(issuer, artId), sellStatus), StringEntry(KeyNftIssuer(idNFT), issuer), StringEntry(KeyNftArtId(idNFT), artId)]
423- let res = invoke(addressFromStringValue(certDapp), "createCert", [toString(receiveNFT), idNFT, issuer], nil)
424- if ((res == res))
425- then if (isBid)
426- then (((buyRes :+ soldData) :+ bidUpdate) :+ bidDelOld)
427- else soldData :: buyRes
428- else throw("Strict value is not equal to itself.")
429- }
430- else throw("Strict value is not equal to itself.")
431- }
432- else throw("Strict value is not equal to itself.")
433- }
434-
435-
436-func setBidNonTraditional (i,artId,issuer) = {
437- let t02770927747 = idCallerDate(i)
438- let id = t02770927747._1
439- let caller = t02770927747._2
440- let date = t02770927747._3
441- let t02775227788 = isPayment(i)
442- let payment = t02775227788._1
443- let amount = t02775227788._2
444- let assetId = if (!(isDefined(payment.assetId)))
445- then throw("Only USDN is accepted!")
446- else toBase58String(value(payment.assetId))
447- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
448- if (!(acceptedAssetIds(assetId)))
449- then throw("asset not accepted")
450- else {
451- let amountSold = getIntegerByKey(keyIssued(issuer, artId))
452- let maxCanSell = getIntegerByKey(keyMaxMint(issuer, artId))
453- if ((0 >= maxCanSell))
454- then throw("No max edition set for this artwork")
455- else if ((amountSold >= maxCanSell))
456- then throw("Sold out, you cannot bid")
457- else [StringEntry((((((((("bid_" + artId) + "_") + issuer) + "_") + caller) + "_") + id) + "_OPEN"), ((((assetId + "_") + toString(amount)) + "_") + toString(date))), IntegerEntry(("current_bidamount_" + artId), (bidNbr + 1))]
458- }
459- }
460-
461-
462-func setBidTraditional (i,artId,issuer) = {
463- let endHeight = getIntegerByKey(keyEndHeight(issuer, artId))
464- let highestBid = getAmountHighestBidByArtId(artId)
465- if ((height > endHeight))
466- then throw("This auction is finished already!")
467- else {
468- let callderData = idCallerDate(i)
469- let id = callderData._1
470- let caller = callderData._2
471- let date = callderData._3
472- let isPaymentVar = isPayment(i)
473- let payment = isPaymentVar._1
474- let amount = isPaymentVar._2
475- if ((highestBid >= amount))
476- then throw(("Please place a bid higher than: " + toString(highestBid)))
477- else {
478- let assetId = if (!(isDefined(payment.assetId)))
479- then throw("Only USDN is accepted!")
480- else toBase58String(value(payment.assetId))
481- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
482- let minArtworkPrice = valueOrElse(getIntegerByKey(keyPrice(issuer, artId)), minUSDNPrice)
483- if (!(acceptedAssetIds(assetId)))
484- then throw("asset not accepted")
485- else if ((minArtworkPrice > amount))
486- then throw("Bid is below min price!")
487- else {
488- let amountSold = getIntegerByKey(keyIssued(issuer, artId))
489- let maxCanSell = getIntegerByKey(keyMaxMint(issuer, artId))
490- if ((0 >= maxCanSell))
491- then throw("No max edition set for this artwork")
492- else if ((amountSold >= maxCanSell))
493- then throw("Sold out, you cannot bid")
494- else [StringEntry((((((((("bid_" + artId) + "_") + issuer) + "_") + caller) + "_") + id) + "_OPEN"), ((((assetId + "_") + toString(amount)) + "_") + toString(date))), IntegerEntry(("current_bidamount_" + artId), (bidNbr + 1)), StringEntry(keyHighestBidBidId(artId), toBase58String(i.transactionId)), IntegerEntry(keyBidId(toBase58String(i.transactionId)), amount)]
495- }
496- }
497- }
498- }
499-
500-
501-func acceptBidNonTraditional (i,artId,issuer,bidId,bidOwner) = {
502- let caller = toBase58String(i.caller.bytes)
503- if ((caller != issuer))
504- then throw("You cannot do this action")
505- else buyMint(i, artId, issuer, bidId, bidOwner, true)
506- }
507-
508-
509-func restartAuction (artId,issuer) = {
510- let amountSold = getIntegerByKey(keyIssued(issuer, artId))
511- let maxCanSell = getIntegerByKey(keyMaxMint(issuer, artId))
512- let oldEndHeight = getIntegerByKey(keyEndHeight(issuer, artId))
513- let duration = getIntegerByKey(keyDuration(issuer, artId))
514- let endHeight = (duration + height)
515- if ((height > oldEndHeight))
516- then if ((amountSold == maxCanSell))
517- then throw("Can't restart auction, max amount sold")
518- else [IntegerEntry(keyEndHeight(issuer, artId), endHeight), DeleteEntry(keyHighestBidBidId(artId))]
519- else throw("Previous auction isn't completed yet")
520- }
521-
522-
523-func acceptBidTraditional (i,artId,issuer,bidId,bidOwner) = {
524- let endHeight = getIntegerByKey(keyEndHeight(issuer, artId))
525- let highestBidId = getStringByKey(keyHighestBidBidId(artId))
526- if ((height > endHeight))
527- then if ((bidId == highestBidId))
528- then {
529- let buyMintData = buyMint(i, artId, issuer, bidId, bidOwner, true)
530- let restartAuctionData = restartAuction(artId, issuer)
531- (restartAuctionData ++ buyMintData)
532- }
533- else throw("This is not the winning bid!")
534- else throw("This auction is not yet finished!")
535- }
536-
537-
538-func cancelBidImpl (i,artId,issuer,bidId) = {
539- let t02894229094 = idCallerDate(i)
540- let id = t02894229094._1
541- let caller = t02894229094._2
542- let date = t02894229094._3
543- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
544- let bidDataKey = ((((((("bid_" + artId) + "_") + issuer) + "_") + caller) + "_") + bidId)
545- let bidData = getStringByKeyOrError((bidDataKey + "_OPEN"), "Bid not found")
546- let bidDataArr = split(bidData, "_")
547- let assetId = getBidAssetId(bidDataArr[0])
548- let bidStatus = "CANCELED"
549-[DeleteEntry((bidDataKey + "_OPEN")), StringEntry(((bidDataKey + "_") + bidStatus), ((bidData + "_") + toString(date))), IntegerEntry(("current_bidamount_" + artId), (bidNbr - 1)), ScriptTransfer(Address(fromBase58String(caller)), parseIntValue(bidDataArr[1]), assetId)]
550- }
551-
552-
553-func cancelBidImplTraditional (i,artId,issuer,bidId) = {
554- let t02894229094 = idCallerDate(i)
555- let id = t02894229094._1
556- let caller = t02894229094._2
557- let date = t02894229094._3
558- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
559- let bidDataKey = ((((((("bid_" + artId) + "_") + issuer) + "_") + caller) + "_") + bidId)
560- let bidData = getStringByKeyOrError((bidDataKey + "_OPEN"), "Bid not found")
561- let bidDataArr = split(bidData, "_")
562- let assetId = getBidAssetId(bidDataArr[0])
563- let bidStatus = "CANCELED"
564- let bidAmount = parseIntValue(bidDataArr[1])
565- let highestBidId = getStringByKey(keyHighestBidBidId(artId))
566- if ((bidId == highestBidId))
567- then throw("You can't cancel the highest bid!")
568- else [DeleteEntry((bidDataKey + "_OPEN")), StringEntry(((bidDataKey + "_") + bidStatus), ((bidData + "_") + toString(date))), IntegerEntry(("current_bidamount_" + artId), (bidNbr - 1)), ScriptTransfer(Address(fromBase58String(caller)), bidAmount, assetId)]
569- }
570-
30+let allowedDapps = [sconexDapp]
57131
57232 @Callable(i)
57333 func initDapp (dappKey) = if ((i.caller != this))
57939
58040
58141 @Callable(i)
582-func restartAuctionManual (artId) = if ((getAmountHighestBidByArtId(artId) != 0))
583- then throw("Please accept the highest bid!")
584- else restartAuction(artId, toBase58String(i.caller.bytes))
42+func teamSplitFee (artId,address1,address2,address3,address1Share,address2Share,address3Share) = if (!(containsElement(allowedDapps, i.caller)))
43+ then throw("Not allowed")
44+ else if ((0 > address1Share))
45+ then throw("Share 1 can't be negative")
46+ else if (if (if ((address1Share != 0))
47+ then true
48+ else (address1 != ""))
49+ then !(isDefined(addressFromString(address1)))
50+ else false)
51+ then throw("Address 1 is invalid")
52+ else if ((0 > address2Share))
53+ then throw("Share 2 can't be negative")
54+ else if (if (if ((address2Share != 0))
55+ then true
56+ else (address2 != ""))
57+ then !(isDefined(addressFromString(address2)))
58+ else false)
59+ then throw("Address 2 is invalid")
60+ else if ((0 > address3Share))
61+ then throw("Share 3 can't be negative")
62+ else if (if (if ((address3Share != 0))
63+ then true
64+ else (address3 != ""))
65+ then !(isDefined(addressFromString(address3)))
66+ else false)
67+ then throw("Address 3 is invalid")
68+ else if ((((address1Share + address2Share) + address3Share) != 15))
69+ then throw("Sum of shares should be equal to 15")
70+ else [StringEntry((artId + "_team_address1"), address1), StringEntry((artId + "_team_address2"), address2), StringEntry((artId + "_team_address3"), address3), IntegerEntry((artId + "_team_share1"), address1Share), IntegerEntry((artId + "_team_share2"), address2Share), IntegerEntry((artId + "_team_share3"), address3Share)]
58571
58672
58773
58874 @Callable(i)
589-func mintNft (totalNFT,issueMeta,receiveNFT) = if ((i.caller == this))
590- then {
591- let receiveNFTAddy = Address(fromBase58String(receiveNFT))
592- let issueNFT = Issue(("SCONEX_" + toString((totalNFT + 1))), issueMeta, 1, 0, false)
593- let idNFT = calculateAssetId(issueNFT)
594- $Tuple2([issueNFT, ScriptTransfer(receiveNFTAddy, 1, idNFT)], toBase58String(idNFT))
595- }
596- else throw("Only the dApp can mint NFT's")
75+func creatorSplitFee (artId,address1,address2,address3,address1Share,address2Share,address3Share) = if (!(containsElement(allowedDapps, i.caller)))
76+ then throw("Not allowed")
77+ else if ((0 > address1Share))
78+ then throw("Share 1 can't be negative")
79+ else if (if (if ((address1Share != 0))
80+ then true
81+ else (address1 != ""))
82+ then !(isDefined(addressFromString(address1)))
83+ else false)
84+ then throw("Address 1 is invalid")
85+ else if ((0 > address2Share))
86+ then throw("Share 2 can't be negative")
87+ else if (if (if ((address2Share != 0))
88+ then true
89+ else (address2 != ""))
90+ then !(isDefined(addressFromString(address2)))
91+ else false)
92+ then throw("Address 2 is invalid")
93+ else if ((0 > address3Share))
94+ then throw("Share 3 can't be negative")
95+ else if (if (if ((address3Share != 0))
96+ then true
97+ else (address3 != ""))
98+ then !(isDefined(addressFromString(address3)))
99+ else false)
100+ then throw("Address 3 is invalid")
101+ else if ((((address1Share + address2Share) + address3Share) > 85))
102+ then throw("Sum of shares should be smaller or equal then 85")
103+ else [StringEntry((artId + "_creator_address1"), address1), StringEntry((artId + "_creator_address2"), address2), StringEntry((artId + "_creator_address3"), address3), IntegerEntry((artId + "_creator_share1"), address1Share), IntegerEntry((artId + "_creator_share2"), address2Share), IntegerEntry((artId + "_creator_share3"), address3Share)]
597104
598105
599106
600107 @Callable(i)
601-func addArtwork (sha256Hash,name,description,tags,type,cidDisplay,entitlement,preview,collection,subcollection) = {
602- let t01774017781 = idCallerDate(i)
603- let artId = t01774017781._1
604- let caller = t01774017781._2
605- let date = t01774017781._3
606- if (containsElement(types, type))
607- then {
608- let validateArtwork = validateArtworkData(caller, cidDisplay, name, description, tags)
609- if ((validateArtwork != ""))
610- then throw("Something went wrong!")
611- else {
612- let t01817018212 = validatePayment(i)
613- let amount = t01817018212._1
614- let assetId = t01817018212._2
615- if (!(isDefined(amount)))
616- then throw("Something went wrong")
617- else {
618- let previewData = if (containsElement(Previewtypes, type))
619- then [StringEntry(keyPreviewCid(caller, artId), preview)]
620- else nil
621- let invokeCollectionCreate = invoke(valueOrErrorMessage(addressFromString(collectionsDapp), (collectionsDapp + " not found")), "collectionProcess", [collection, subcollection, caller], nil)
622- if ((invokeCollectionCreate == invokeCollectionCreate))
623- then {
624- let idCollection = match invokeCollectionCreate {
625- case r: String =>
626- r
627- case _ =>
628- throw("Incorrect invoke result")
629- }
630- let entryExist = getStringByKey(keyTxidByHashOwner(sha256Hash, caller))
631- if ((entryExist != ""))
632- then throw("You already added it")
633- else {
634- let hashExist = getStringByKey(keyOwnerByHash(sha256Hash))
635- if ((hashExist != ""))
636- then throw("This hash is already registered")
637- else (previewData ++ [StringEntry(keyOwnerByHash(sha256Hash), caller), StringEntry(keyTxidByHashOwner(sha256Hash, caller), artId), IntegerEntry(keyDate(caller, artId), date), StringEntry(keyName(caller, artId), name), StringEntry(keyDesc(caller, artId), description), StringEntry(keyDisplayCid(caller, artId), cidDisplay), StringEntry(keyType(caller, artId), type), StringEntry(keyTags(caller, artId), tags), IntegerEntry(keyMaxMint(caller, artId), 0), IntegerEntry(keyIssued(caller, artId), 0), BooleanEntry(keyOnSale(caller, artId), false), StringEntry(keyHashByTxidAddr(caller, artId), sha256Hash), StringEntry(keyEntitlement(caller, artId), entitlement), ScriptTransfer(Address(fromBase58String(feeReceiver)), amount, assetId)])
638- }
639- }
640- else throw("Strict value is not equal to itself.")
641- }
642- }
643- }
644- else throw("Unknown type")
645- }
108+func payFeeResell (txId,seller) = if (!(containsElement(allowedDapps, i.caller)))
109+ then throw("Not allowed")
110+ else {
111+ let sconexFeePercentage = 3
112+ let amount = value(i.payments[0].amount)
113+ let assetId = value(i.payments[0].assetId)
114+ let address1ShareCreator = getInt((txId + "_creator_share1"))
115+ let address2ShareCreator = getInt((txId + "_creator_share2"))
116+ let address3ShareCreator = getInt((txId + "_creator_share3"))
117+ let address1Creator = getStr((txId + "_creator_address1"))
118+ let address2Creator = getStr((txId + "_creator_address2"))
119+ let address3Creator = getStr((txId + "_creator_address3"))
120+ let address1CreatorReward = if ((address1Creator == ""))
121+ then 0
122+ else fraction(amount, address1ShareCreator, 100)
123+ let address2CreatorReward = if ((address2Creator == ""))
124+ then 0
125+ else fraction(amount, address2ShareCreator, 100)
126+ let address3CreatorReward = if ((address3Creator == ""))
127+ then 0
128+ else fraction(amount, address3ShareCreator, 100)
129+ let sconexFeeReward = fraction(amount, sconexFeePercentage, 100)
130+ let sellerReward = ((((amount - address1CreatorReward) - address2CreatorReward) - address3CreatorReward) - sconexFeeReward)
131+ let scriptTransferFeeReceiver = [ScriptTransfer(addressFromStringValue(feeReceiver), sconexFeeReward, i.payments[0].assetId)]
132+ let scriptTransferAddress1 = if ((address1Creator == ""))
133+ then nil
134+ else [ScriptTransfer(addressFromStringValue(address1Creator), address1CreatorReward, i.payments[0].assetId)]
135+ let scriptTransferAddress2 = if ((address2Creator == ""))
136+ then nil
137+ else [ScriptTransfer(addressFromStringValue(address2Creator), address2CreatorReward, i.payments[0].assetId)]
138+ let scriptTransferAddress3 = if ((address3Creator == ""))
139+ then nil
140+ else [ScriptTransfer(addressFromStringValue(address3Creator), address3CreatorReward, i.payments[0].assetId)]
141+ let scriptTransferSeller = if ((seller == ""))
142+ then nil
143+ else [ScriptTransfer(addressFromStringValue(seller), sellerReward, i.payments[0].assetId)]
144+ ((((scriptTransferAddress1 ++ scriptTransferAddress2) ++ scriptTransferAddress3) ++ scriptTransferFeeReceiver) ++ scriptTransferSeller)
145+ }
646146
647147
648148
649149 @Callable(i)
650-func sellArtwork (artId,price,maxMint,assetId,auctionType,duration,add1,add2,add3,add1Sh,add2Sh,add3Sh) = {
651- let invokeTeamFeeSplit = invoke(valueOrErrorMessage(addressFromString(feeDapp), (feeDapp + " not found")), "teamSplitFee", [artId, feeReceiver, "", "", 15, 0, 0], nil)
652- if ((invokeTeamFeeSplit == invokeTeamFeeSplit))
653- then {
654- let invokeCreatorFeeSplit = invoke(valueOrErrorMessage(addressFromString(feeDapp), (feeDapp + " not found")), "creatorSplitFee", [artId, add1, add2, add3, add1Sh, add2Sh, add3Sh], nil)
655- if ((invokeCreatorFeeSplit == invokeCreatorFeeSplit))
656- then {
657- let t02571425747 = idCallerDate(i)
658- let id = t02571425747._1
659- let caller = t02571425747._2
660- let artworkName = getStringByKey(keyName(caller, artId))
661- if (!(containsElement([auctionType1, auctionType2, auctionType3], auctionType)))
662- then throw("We don't know this auction type")
663- else if ((artworkName == ""))
664- then throw("This art doesn't match your account")
665- else {
666- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
667- if (!(acceptedAssetIds(assetId)))
668- then throw("Something went wrong!")
669- else if (!(validateMinSell(assetId, price)))
670- then throw("Something went wrong!")
671- else {
672- let checkUser = validateUser(caller)
673- if ((checkUser != ""))
674- then throw(checkUser)
675- else {
676- let amountSold = getIntegerByKey(keyIssued(caller, artId))
677- let maxCanSell = getIntegerByKey(keyMaxMint(caller, artId))
678- if ((maxMint > 10000))
679- then throw("10000 editions max per artwork")
680- else if (if ((amountSold != 0))
681- then (amountSold == maxCanSell)
682- else false)
683- then throw("Max edition reached.")
684- else if (if ((amountSold > 0))
685- then (maxCanSell != maxMint)
686- else false)
687- then throw("Cannot change maximum issuable anymore")
688- else if (if ((bidNbr > 0))
689- then (maxCanSell != maxMint)
690- else false)
691- then throw("Cannot change maximum issuable with active orders")
692- else {
693- let sellStatus = if (if ((price > 0))
694- then (maxMint > 0)
695- else false)
696- then true
697- else false
698- let endHeight = (duration + height)
699-[BooleanEntry(keyOnSale(caller, artId), sellStatus), IntegerEntry(keyPrice(caller, artId), price), IntegerEntry(keyMaxMint(caller, artId), maxMint), IntegerEntry(keyDuration(caller, artId), duration), IntegerEntry(keyEndHeight(caller, artId), endHeight), StringEntry(keyAssetIdAccepted(caller, artId), assetId), StringEntry(keyAuctionType(caller, artId), auctionType)]
700- }
701- }
702- }
703- }
704- }
705- else throw("Strict value is not equal to itself.")
706- }
707- else throw("Strict value is not equal to itself.")
708- }
709-
710-
711-
712-@Callable(i)
713-func buyArtwork (artId,issuer) = {
714- let auctionType = getStringByKey(keyAuctionType(issuer, artId))
715- if ((auctionType == auctionType3))
716- then buyMint(i, artId, issuer, "", "", false)
717- else throw("Direct buy only allowed when no auction type is set!")
718- }
719-
720-
721-
722-@Callable(i)
723-func updateTags (artist,artId,tags) = {
724- let caller = toString(addressFromPublicKey(i.callerPublicKey))
725- if (containsElement(owners, caller))
726- then if ((size(split(tags, ",")) > 5))
727- then throw("5 tags max.")
728- else {
729- let tagsOld = getStringByKeyOrError(keyTags(artist, artId), "No tags created with this key, so can't update!")
730- if ((tags == tagsOld))
731- then throw("Tags are the same as old tags!")
732- else [StringEntry(keyTags(artist, artId), tags)]
733- }
734- else throw("no")
735- }
736-
737-
738-
739-@Callable(i)
740-func deleteEntry (entry) = {
741- let caller = toString(addressFromPublicKey(i.callerPublicKey))
742- if (containsElement(owners, caller))
743- then [DeleteEntry(entry)]
744- else throw("no")
745- }
746-
747-
748-
749-@Callable(i)
750-func setBid (artId,issuer) = {
751- let auctionType = getStringByKey(keyAuctionType(issuer, artId))
752- if ((auctionType == auctionType1))
753- then setBidNonTraditional(i, artId, issuer)
754- else if ((auctionType == auctionType2))
755- then setBidTraditional(i, artId, issuer)
756- else throw((("Unknown auction type :" + auctionType) + ", please contact the admins"))
757- }
758-
759-
760-
761-@Callable(i)
762-func acceptBid (artId,issuer,bidId,bidOwner) = {
763- let auctionType = getStringByKey(keyAuctionType(issuer, artId))
764- if ((auctionType == auctionType1))
765- then acceptBidNonTraditional(i, artId, issuer, bidId, bidOwner)
766- else if ((auctionType == auctionType2))
767- then acceptBidTraditional(i, artId, issuer, bidId, bidOwner)
768- else throw((("Unknown auction type :" + auctionType) + ", please contact the admins"))
769- }
770-
771-
772-
773-@Callable(i)
774-func cancelBid (artId,issuer,bidId) = {
775- let auctionType = getStringByKey(keyAuctionType(issuer, artId))
776- if ((auctionType == auctionType1))
777- then cancelBidImpl(i, artId, issuer, bidId)
778- else cancelBidImplTraditional(i, artId, issuer, bidId)
779- }
150+func payFee (txId,seller) = if (!(containsElement(allowedDapps, i.caller)))
151+ then throw("Not allowed")
152+ else {
153+ let amount = value(i.payments[0].amount)
154+ let assetId = value(i.payments[0].assetId)
155+ let address1ShareTeam = getInt((txId + "_team_share1"))
156+ let address2ShareTeam = getInt((txId + "_team_share2"))
157+ let address3ShareTeam = getInt((txId + "_team_share3"))
158+ let address1Team = getStr((txId + "_team_address1"))
159+ let address2Team = getStr((txId + "_team_address2"))
160+ let address3Team = getStr((txId + "_team_address3"))
161+ let address1ShareCreator = getInt((txId + "_creator_address1"))
162+ let address2ShareCreator = getInt((txId + "_creator_address2"))
163+ let address3ShareCreator = getInt((txId + "_creator_address3"))
164+ let address1Creator = getStr((txId + "_creator_address1"))
165+ let address2Creator = getStr((txId + "_creator_address2"))
166+ let address3Creator = getStr((txId + "_creator_address3"))
167+ let address1TeamReward = if ((address1Team == ""))
168+ then 0
169+ else fraction(amount, address1ShareTeam, 100)
170+ let address2TeamReward = if ((address2Team == ""))
171+ then 0
172+ else fraction(amount, address2ShareTeam, 100)
173+ let address3TeamReward = if ((address3Team == ""))
174+ then 0
175+ else fraction(amount, address3ShareTeam, 100)
176+ let address1CreatorReward = if ((address1Creator == ""))
177+ then 0
178+ else fraction(amount, address1ShareCreator, 100)
179+ let address2CreatorReward = if ((address2Creator == ""))
180+ then 0
181+ else fraction(amount, address2ShareCreator, 100)
182+ let address3CreatorReward = if ((address3Creator == ""))
183+ then 0
184+ else fraction(amount, address3ShareCreator, 100)
185+ let scriptTransferAddressTeam1 = if ((address1Team == ""))
186+ then nil
187+ else [ScriptTransfer(addressFromStringValue(address1Team), address1TeamReward, i.payments[0].assetId)]
188+ let scriptTransferAddressTeam2 = if ((address2Team == ""))
189+ then nil
190+ else [ScriptTransfer(addressFromStringValue(address2Team), address2TeamReward, i.payments[0].assetId)]
191+ let scriptTransferAddressTeam3 = if ((address3Team == ""))
192+ then nil
193+ else [ScriptTransfer(addressFromStringValue(address3Team), address3TeamReward, i.payments[0].assetId)]
194+ let scriptTransferAddress1 = if ((address1Creator == ""))
195+ then nil
196+ else [ScriptTransfer(addressFromStringValue(address1Creator), address1CreatorReward, i.payments[0].assetId)]
197+ let scriptTransferAddress2 = if ((address2Creator == ""))
198+ then nil
199+ else [ScriptTransfer(addressFromStringValue(address2Creator), address2CreatorReward, i.payments[0].assetId)]
200+ let scriptTransferAddress3 = if ((address3Creator == ""))
201+ then nil
202+ else [ScriptTransfer(addressFromStringValue(address3Creator), address3CreatorReward, i.payments[0].assetId)]
203+ let sellerReward = ((((((amount - address1CreatorReward) - address2CreatorReward) - address3CreatorReward) - address1TeamReward) - address2TeamReward) - address3TeamReward)
204+ let scriptTransferSeller = if ((seller == ""))
205+ then nil
206+ else [ScriptTransfer(addressFromStringValue(seller), sellerReward, i.payments[0].assetId)]
207+ ((((((scriptTransferAddressTeam1 ++ scriptTransferAddressTeam2) ++ scriptTransferAddressTeam3) ++ scriptTransferAddress1) ++ scriptTransferAddress2) ++ scriptTransferAddress3) ++ scriptTransferSeller)
208+ }
780209
781210
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let unitTest = false
5-
64 let oracleKey = "oracleKey"
75
86 func getStr (key) = match getString(this, key) {
97 case b: String =>
108 b
119 case _ =>
1210 ""
1311 }
1412
1513
14+func getInt (key) = match getInteger(this, key) {
15+ case b: Int =>
16+ b
17+ case _ =>
18+ 0
19+}
20+
21+
1622 let oracle = getStr(oracleKey)
1723
1824 let oracleFee = value(addressFromString(oracle))
1925
20-let owners = [getString(oracleFee, "owner1"), getString(oracleFee, "owner2")]
21-
22-let collectionsDapp = valueOrErrorMessage(getString(oracleFee, "collectionsDapp"), "collectionDapp not found")
26+let sconexDapp = addressFromString(valueOrErrorMessage(getString(oracleFee, "sconexDapp"), "sconexDapp not found"))
2327
2428 let feeReceiver = valueOrErrorMessage(getString(oracleFee, "feeReceiver"), "feeReceiver not found")
2529
26-let certDapp = valueOrErrorMessage(getString(oracleFee, "certDapp"), "certDapp not found")
27-
28-let feeDapp = valueOrErrorMessage(getString(oracleFee, "feeDapp"), "feeDapp not found")
29-
30-let userDapp = value(addressFromString(valueOrErrorMessage(getString(oracleFee, "userDapp"), "userdapp not found")))
31-
32-let USDNAssetId = fromBase58String(getStringValue(oracleFee, "USDNAssetId"))
33-
34-let SconexAssetId = fromBase58String(getStringValue(oracleFee, "SconexAssetId"))
35-
36-let types = ["IMAGE", "PDF", "VIDEO"]
37-
38-let Previewtypes = ["PDF"]
39-
40-let dappRunning = valueOrElse(getBoolean(userDapp, "conf_dapp_is_running"), true)
41-
42-let maintenanceMSG = valueOrElse(getString(userDapp, "conf_maintenance_msg"), "")
43-
44-let userSuspended = "SUSPENDED"
45-
46-let userRemoved = "REMOVED"
47-
48-let userUnregistered = "UNREGISTERED"
49-
50-let auctionType1 = "BIDTYPE"
51-
52-let auctionType2 = "TRADITIONAL"
53-
54-let auctionType3 = "DIRECT"
55-
56-func getStringByKeyFromUsers (key) = valueOrElse(getString(userDapp, key), "")
57-
58-
59-func getStringByKey (key) = valueOrElse(getString(this, key), "")
60-
61-
62-func getStringByKeyOrError (key,error) = valueOrErrorMessage(getString(this, key), error)
63-
64-
65-func getIntegerByKeyFromOracle (key) = valueOrErrorMessage(getInteger(oracleFee, key), "Integer undefine or 0 in oracle")
66-
67-
68-func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0)
69-
70-
71-func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false)
72-
73-
74-func validateHash (hash) = (size(hash) == 64)
75-
76-
77-func keyUserStatus (caller) = ("user_status_" + caller)
78-
79-
80-func keyDate (caller,artId) = ((("art_date_" + artId) + "_") + caller)
81-
82-
83-func keyName (caller,artId) = ((("art_name_" + artId) + "_") + caller)
84-
85-
86-func keyDesc (caller,artId) = ((("art_desc_" + artId) + "_") + caller)
87-
88-
89-func keyDisplayCid (caller,artId) = ((("art_display_cid_" + artId) + "_") + caller)
90-
91-
92-func keyPreviewCid (caller,artId) = ((("art_preview_cid_" + artId) + "_") + caller)
93-
94-
95-func keyMaxMint (caller,artId) = ((("art_maxmint_" + artId) + "_") + caller)
96-
97-
98-func keyHighestBidBidId (artId) = ("art_highestBidBidId_" + artId)
99-
100-
101-func keyBidId (bidId) = ("bid_" + bidId)
102-
103-
104-func keyDuration (caller,artId) = ((("art_duration_" + artId) + "_") + caller)
105-
106-
107-func keyEndHeight (caller,artId) = ((("art_endheight_" + artId) + "_") + caller)
108-
109-
110-func keyAuctionType (caller,artId) = ((("art_auctiontype_" + artId) + "_") + caller)
111-
112-
113-func keyIssued (caller,artId) = ((("art_issued_" + artId) + "_") + caller)
114-
115-
116-func KeyNftIssuer (nftId) = ("nft_issued_" + nftId)
117-
118-
119-func KeyNftArtId (nftId) = ("nft_artId_" + nftId)
120-
121-
122-func keyOnSale (caller,artId) = ((("art_onsale_" + artId) + "_") + caller)
123-
124-
125-func keyEntitlement (caller,artId) = ((("art_entitlement_" + artId) + "_") + caller)
126-
127-
128-func keyTags (caller,artId) = ((("art_tags_" + artId) + "_") + caller)
129-
130-
131-func keyType (caller,artId) = ((("art_type_" + artId) + "_") + caller)
132-
133-
134-func keyPrice (caller,artId) = ((("art_price_" + artId) + "_") + caller)
135-
136-
137-func keyAssetIdAccepted (caller,artId) = ((("art_assetAccepted_" + artId) + "_") + caller)
138-
139-
140-func keyHashByTxidAddr (caller,txid) = ((("get_hashbytxidaddr_" + txid) + "_") + caller)
141-
142-
143-func keyOwnerByHash (sha256Hash) = ("get_owner_by_hash_" + sha256Hash)
144-
145-
146-func keyTxidByHashOwner (sha256Hash,caller) = ("get_txid_by_hash_owner_" + toBase58String(sha256_16Kb(toBytes((sha256Hash + caller)))))
147-
148-
149-func keyCollection (caller,artId) = ((("collection_" + artId) + "_") + caller)
150-
151-
152-let minUSDNPrice = getIntegerByKeyFromOracle(("min_" + toBase58String(USDNAssetId)))
153-
154-let currentFeeSconex = getIntegerByKeyFromOracle(("fee_" + toBase58String(SconexAssetId)))
155-
156-func getAmountByBidId (bidId) = valueOrElse(getIntegerByKey(keyBidId(bidId)), 0)
157-
158-
159-func getAmountHighestBidByArtId (artId) = {
160- let bidId = getStringByKey(keyHighestBidBidId(artId))
161- if ((bidId == ""))
162- then 0
163- else getAmountByBidId(bidId)
164- }
165-
166-
167-func validateString (str,max) = if ((size(str) == 0))
168- then throw("Field cannot be is empty")
169- else if ((size(str) > max))
170- then throw((str + " is too long"))
171- else true
172-
173-
174-func validateUser (caller) = {
175- let userStatus = valueOrElse(getString(userDapp, keyUserStatus(caller)), userUnregistered)
176- if ((userStatus == userUnregistered))
177- then "Register this account first with 'Account' tab"
178- else if ((userStatus == userSuspended))
179- then "Account suspended"
180- else if ((userStatus == userRemoved))
181- then "Account removed"
182- else ""
183- }
184-
185-
186-func validateArtworkData (caller,cidDisplay,name,description,tags) = {
187- let checkUser = validateUser(caller)
188- if ((checkUser != ""))
189- then throw(checkUser)
190- else if ((size(cidDisplay) == 0))
191- then throw("Display CID cannot be empty")
192- else if ((size(cidDisplay) != 46))
193- then throw("This doesn't seem a valid CID!")
194- else if (!(validateString(name, 100)))
195- then throw("100 Char. max name")
196- else if (!(validateString(description, 1000)))
197- then throw("1000 Char. max description")
198- else if ((size(split(tags, ",")) > 5))
199- then throw("5 tags max.")
200- else ""
201- }
202-
203-
204-func isPayment (i) = if ((size(i.payments) == 0))
205- then throw("No payment attached")
206- else {
207- let payment = value(i.payments[0])
208- let amount = value(payment.amount)
209- $Tuple2(payment, amount)
210- }
211-
212-
213-func validatePayment (i) = {
214- let t089829018 = isPayment(i)
215- let payment = t089829018._1
216- let amount = t089829018._2
217- let assetId = if (if (isDefined(payment.assetId))
218- then (payment.assetId == SconexAssetId)
219- else false)
220- then payment.assetId
221- else throw((("Only " + toBase58String(SconexAssetId)) + " token accepted as transaction fee"))
222- if ((amount != currentFeeSconex))
223- then throw(((("Payment amount should be " + toString(currentFeeSconex)) + " but is: ") + toString(amount)))
224- else $Tuple2(amount, assetId)
225- }
226-
227-
228-func isArtMinted (addrToUse,artId) = match getInteger(this, keyIssued(addrToUse, artId)) {
229- case b: Int =>
230- if ((b != 0))
231- then true
232- else false
233- case _ =>
234- false
235-}
236-
237-
238-func validatePriceAssetId (i,priceAssetId,artworkPrice) = {
239- let t096119647 = isPayment(i)
240- let payment = t096119647._1
241- let amount = t096119647._2
242- let assetId = if (!(isDefined(payment.assetId)))
243- then throw("Wrong asset id")
244- else if (if ((size(priceAssetId) > 0))
245- then (toBase58String(value(payment.assetId)) == priceAssetId)
246- else false)
247- then payment.assetId
248- else throw("Wrong asset id")
249- if (if ((assetId == unit))
250- then (priceAssetId != "")
251- else false)
252- then throw("Wrong asset id")
253- else if ((artworkPrice != amount))
254- then throw(((("Payment don't match " + toString(artworkPrice)) + " ") + toString(amount)))
255- else $Tuple2(amount, assetId)
256- }
257-
258-
259-func acceptedAssetIds (assetId) = if ((assetId != toBase58String(USDNAssetId)))
260- then throw("Only USDN accepted")
261- else true
262-
263-
264-func validateMinSell (assetId,price) = {
265- let minSellSconex = minUSDNPrice
266- if (if ((minSellSconex > price))
267- then true
268- else (assetId != toBase58String(USDNAssetId)))
269- then throw(("Wrong minimum sell price " + toString(minSellSconex)))
270- else true
271- }
272-
273-
274-func getBidAssetId (assetId) = if ((assetId == "WAVES"))
275- then throw("Only USDN is accepted!")
276- else fromBase58String(assetId)
277-
278-
279-func getPriceAssetIdFromBid (bidDataKey) = {
280- let bidData = getStringByKey((bidDataKey + "_OPEN"))
281- if ((bidData == ""))
282- then throw("Bid not found")
283- else {
284- let bidDataArr = split(bidData, "_")
285- let bidAmount = parseIntValue(bidDataArr[1])
286- let bidAssetId = getBidAssetId(bidDataArr[0])
287- if ((0 >= bidAmount))
288- then throw("Wrong amount")
289- else $Tuple2(bidAmount, bidAssetId)
290- }
291- }
292-
293-
294-func idCallerDate (i) = if (!(dappRunning))
295- then throw(maintenanceMSG)
296- else $Tuple3(toBase58String(i.transactionId), toBase58String(i.caller.bytes), lastBlock.timestamp)
297-
298-
299-func getArtData (i,issuer,artId,isBid) = {
300- let callerIsIssuer = (toBase58String(i.caller.bytes) == issuer)
301- let totalNFT = getIntegerByKey("total_nft_issued")
302- let artworkName = getStringByKey(keyName(issuer, artId))
303- if ((artworkName == ""))
304- then throw("Art doesn't exist")
305- else {
306- let isOnSale = getBooleanByKey(keyOnSale(issuer, artId))
307- let amountSold = getIntegerByKey(keyIssued(issuer, artId))
308- let artworkPrice = valueOrElse(getIntegerByKey(keyPrice(issuer, artId)), minUSDNPrice)
309- let priceAssetId = if (callerIsIssuer)
310- then toBase58String(USDNAssetId)
311- else getStringByKey(keyAssetIdAccepted(issuer, artId))
312- let maxCanSell = getIntegerByKey(keyMaxMint(issuer, artId))
313- if (if (if (!(isBid))
314- then !(callerIsIssuer)
315- else false)
316- then if (if ((0 >= artworkPrice))
317- then true
318- else !(isOnSale))
319- then true
320- else (0 >= maxCanSell)
321- else false)
322- then throw("Art not for sale")
323- else if (if (if (!(isBid))
324- then callerIsIssuer
325- else false)
326- then (0 >= maxCanSell)
327- else false)
328- then throw("Max issuable not set")
329- else $Tuple7(totalNFT, artworkName, amountSold, artworkPrice, priceAssetId, maxCanSell, isOnSale)
330- }
331- }
332-
333-
334-func getBidData (i,caller,issuer,artId,bidOwner,bidId,priceAssetId,artworkPrice,isBid) = {
335- let checkUser = validateUser(issuer)
336- if (if (isBid)
337- then (checkUser != "")
338- else false)
339- then throw(checkUser)
340- else {
341- let bidDataKey = ((((((("bid_" + artId) + "_") + issuer) + "_") + bidOwner) + "_") + bidId)
342- let t01351913648 = if (isBid)
343- then getPriceAssetIdFromBid(bidDataKey)
344- else validatePriceAssetId(i, priceAssetId, artworkPrice)
345- let amount = t01351913648._1
346- let assetId = t01351913648._2
347- $Tuple3(bidDataKey, amount, assetId)
348- }
349- }
350-
351-
352-func getIssueData (issuer,artId,artworkName,newAmountSold,maxCanSell,totalNFT,caller,bidOwner,bidId,i,isOnSale) = {
353- let issueMeta = ((((((((("Creator: " + issuer) + ",ArtID: ") + artId) + ",Artwork name: ") + artworkName) + ",Issue: ") + toString(newAmountSold)) + "/") + toString(maxCanSell))
354- let sellStatus = if (if ((newAmountSold == maxCanSell))
355- then true
356- else !(isOnSale))
357- then false
358- else true
359- let receiveNFT = if ((bidOwner != ""))
360- then addressFromStringValue(bidOwner)
361- else i.caller
362- $Tuple3(sellStatus, receiveNFT, issueMeta)
363- }
364-
365-
366-func getBidKeyVal (assetId,bidDataKey,date) = {
367- let assetIdBid = if (!(isDefined(assetId)))
368- then throw("Only USDN is accepted")
369- else toBase58String(value(assetId))
370- let bidData = getStringByKey((bidDataKey + "_OPEN"))
371- let bidDelOld = DeleteEntry((bidDataKey + "_OPEN"))
372- let bidUpdate = StringEntry((bidDataKey + "_CLOSED"), ((bidData + "_") + toString(date)))
373- $Tuple3(assetIdBid, bidDelOld, bidUpdate)
374- }
375-
376-
377-func buyMint (i,artId,issuer,bidId,bidOwner,isBid) = {
378- let callerData = idCallerDate(i)
379- let id = callerData._1
380- let caller = callerData._2
381- let date = callerData._3
382- let artData = getArtData(i, issuer, artId, isBid)
383- let totalNFT = artData._1
384- let artworkName = artData._2
385- let amountSold = artData._3
386- let artworkPrice = artData._4
387- let priceAssetId = artData._5
388- let maxCanSell = artData._6
389- let isOnSale = artData._7
390- let bidData = getBidData(i, caller, issuer, artId, bidOwner, bidId, priceAssetId, artworkPrice, isBid)
391- let bidDataKey = bidData._1
392- let amount = bidData._2
393- let assetId = bidData._3
394- let newAmountSold = if ((amountSold == maxCanSell))
395- then throw("Max items sold")
396- else (amountSold + 1)
397- let issuerData = getIssueData(issuer, artId, artworkName, newAmountSold, maxCanSell, totalNFT, caller, bidOwner, bidId, i, isOnSale)
398- let sellStatus = issuerData._1
399- let receiveNFT = issuerData._2
400- let issueMeta = issuerData._3
401- let idNFTInvoke = invoke(this, "mintNft", [totalNFT, issueMeta, toString(receiveNFT)], nil)
402- if ((idNFTInvoke == idNFTInvoke))
403- then {
404- let idNFT = match idNFTInvoke {
405- case r: String =>
406- r
407- case _ =>
408- throw("Incorrect invoke result")
409- }
410- let bidKeyValue = getBidKeyVal(assetId, bidDataKey, date)
411- let assetIdBid = bidKeyValue._1
412- let bidDelOld = bidKeyValue._2
413- let bidUpdate = bidKeyValue._3
414- let soldKey = ((((((("art_sold_" + toString(newAmountSold)) + "_of_") + toString(maxCanSell)) + "_") + artId) + "_") + issuer)
415- let soldValue = if (!(isBid))
416- then ((((((((((caller + "_") + toString(date)) + "_") + id) + "_") + toString(artworkPrice)) + "_") + priceAssetId) + "_") + idNFT)
417- else ((((((((((toString(receiveNFT) + "_") + toString(date)) + "_") + id) + "_") + toString(amount)) + "_") + assetIdBid) + "_") + idNFT)
418- let invokeTeamFeeSplit = invoke(valueOrErrorMessage(addressFromString(feeDapp), (feeDapp + " not found")), "payFee", [artId, issuer], [AttachedPayment(assetId, amount)])
419- if ((invokeTeamFeeSplit == invokeTeamFeeSplit))
420- then {
421- let soldData = StringEntry(soldKey, soldValue)
422- let buyRes = [IntegerEntry(keyIssued(issuer, artId), newAmountSold), StringEntry(("nft_" + idNFT), soldKey), IntegerEntry("total_nft_issued", (totalNFT + 1)), BooleanEntry(keyOnSale(issuer, artId), sellStatus), StringEntry(KeyNftIssuer(idNFT), issuer), StringEntry(KeyNftArtId(idNFT), artId)]
423- let res = invoke(addressFromStringValue(certDapp), "createCert", [toString(receiveNFT), idNFT, issuer], nil)
424- if ((res == res))
425- then if (isBid)
426- then (((buyRes :+ soldData) :+ bidUpdate) :+ bidDelOld)
427- else soldData :: buyRes
428- else throw("Strict value is not equal to itself.")
429- }
430- else throw("Strict value is not equal to itself.")
431- }
432- else throw("Strict value is not equal to itself.")
433- }
434-
435-
436-func setBidNonTraditional (i,artId,issuer) = {
437- let t02770927747 = idCallerDate(i)
438- let id = t02770927747._1
439- let caller = t02770927747._2
440- let date = t02770927747._3
441- let t02775227788 = isPayment(i)
442- let payment = t02775227788._1
443- let amount = t02775227788._2
444- let assetId = if (!(isDefined(payment.assetId)))
445- then throw("Only USDN is accepted!")
446- else toBase58String(value(payment.assetId))
447- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
448- if (!(acceptedAssetIds(assetId)))
449- then throw("asset not accepted")
450- else {
451- let amountSold = getIntegerByKey(keyIssued(issuer, artId))
452- let maxCanSell = getIntegerByKey(keyMaxMint(issuer, artId))
453- if ((0 >= maxCanSell))
454- then throw("No max edition set for this artwork")
455- else if ((amountSold >= maxCanSell))
456- then throw("Sold out, you cannot bid")
457- else [StringEntry((((((((("bid_" + artId) + "_") + issuer) + "_") + caller) + "_") + id) + "_OPEN"), ((((assetId + "_") + toString(amount)) + "_") + toString(date))), IntegerEntry(("current_bidamount_" + artId), (bidNbr + 1))]
458- }
459- }
460-
461-
462-func setBidTraditional (i,artId,issuer) = {
463- let endHeight = getIntegerByKey(keyEndHeight(issuer, artId))
464- let highestBid = getAmountHighestBidByArtId(artId)
465- if ((height > endHeight))
466- then throw("This auction is finished already!")
467- else {
468- let callderData = idCallerDate(i)
469- let id = callderData._1
470- let caller = callderData._2
471- let date = callderData._3
472- let isPaymentVar = isPayment(i)
473- let payment = isPaymentVar._1
474- let amount = isPaymentVar._2
475- if ((highestBid >= amount))
476- then throw(("Please place a bid higher than: " + toString(highestBid)))
477- else {
478- let assetId = if (!(isDefined(payment.assetId)))
479- then throw("Only USDN is accepted!")
480- else toBase58String(value(payment.assetId))
481- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
482- let minArtworkPrice = valueOrElse(getIntegerByKey(keyPrice(issuer, artId)), minUSDNPrice)
483- if (!(acceptedAssetIds(assetId)))
484- then throw("asset not accepted")
485- else if ((minArtworkPrice > amount))
486- then throw("Bid is below min price!")
487- else {
488- let amountSold = getIntegerByKey(keyIssued(issuer, artId))
489- let maxCanSell = getIntegerByKey(keyMaxMint(issuer, artId))
490- if ((0 >= maxCanSell))
491- then throw("No max edition set for this artwork")
492- else if ((amountSold >= maxCanSell))
493- then throw("Sold out, you cannot bid")
494- else [StringEntry((((((((("bid_" + artId) + "_") + issuer) + "_") + caller) + "_") + id) + "_OPEN"), ((((assetId + "_") + toString(amount)) + "_") + toString(date))), IntegerEntry(("current_bidamount_" + artId), (bidNbr + 1)), StringEntry(keyHighestBidBidId(artId), toBase58String(i.transactionId)), IntegerEntry(keyBidId(toBase58String(i.transactionId)), amount)]
495- }
496- }
497- }
498- }
499-
500-
501-func acceptBidNonTraditional (i,artId,issuer,bidId,bidOwner) = {
502- let caller = toBase58String(i.caller.bytes)
503- if ((caller != issuer))
504- then throw("You cannot do this action")
505- else buyMint(i, artId, issuer, bidId, bidOwner, true)
506- }
507-
508-
509-func restartAuction (artId,issuer) = {
510- let amountSold = getIntegerByKey(keyIssued(issuer, artId))
511- let maxCanSell = getIntegerByKey(keyMaxMint(issuer, artId))
512- let oldEndHeight = getIntegerByKey(keyEndHeight(issuer, artId))
513- let duration = getIntegerByKey(keyDuration(issuer, artId))
514- let endHeight = (duration + height)
515- if ((height > oldEndHeight))
516- then if ((amountSold == maxCanSell))
517- then throw("Can't restart auction, max amount sold")
518- else [IntegerEntry(keyEndHeight(issuer, artId), endHeight), DeleteEntry(keyHighestBidBidId(artId))]
519- else throw("Previous auction isn't completed yet")
520- }
521-
522-
523-func acceptBidTraditional (i,artId,issuer,bidId,bidOwner) = {
524- let endHeight = getIntegerByKey(keyEndHeight(issuer, artId))
525- let highestBidId = getStringByKey(keyHighestBidBidId(artId))
526- if ((height > endHeight))
527- then if ((bidId == highestBidId))
528- then {
529- let buyMintData = buyMint(i, artId, issuer, bidId, bidOwner, true)
530- let restartAuctionData = restartAuction(artId, issuer)
531- (restartAuctionData ++ buyMintData)
532- }
533- else throw("This is not the winning bid!")
534- else throw("This auction is not yet finished!")
535- }
536-
537-
538-func cancelBidImpl (i,artId,issuer,bidId) = {
539- let t02894229094 = idCallerDate(i)
540- let id = t02894229094._1
541- let caller = t02894229094._2
542- let date = t02894229094._3
543- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
544- let bidDataKey = ((((((("bid_" + artId) + "_") + issuer) + "_") + caller) + "_") + bidId)
545- let bidData = getStringByKeyOrError((bidDataKey + "_OPEN"), "Bid not found")
546- let bidDataArr = split(bidData, "_")
547- let assetId = getBidAssetId(bidDataArr[0])
548- let bidStatus = "CANCELED"
549-[DeleteEntry((bidDataKey + "_OPEN")), StringEntry(((bidDataKey + "_") + bidStatus), ((bidData + "_") + toString(date))), IntegerEntry(("current_bidamount_" + artId), (bidNbr - 1)), ScriptTransfer(Address(fromBase58String(caller)), parseIntValue(bidDataArr[1]), assetId)]
550- }
551-
552-
553-func cancelBidImplTraditional (i,artId,issuer,bidId) = {
554- let t02894229094 = idCallerDate(i)
555- let id = t02894229094._1
556- let caller = t02894229094._2
557- let date = t02894229094._3
558- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
559- let bidDataKey = ((((((("bid_" + artId) + "_") + issuer) + "_") + caller) + "_") + bidId)
560- let bidData = getStringByKeyOrError((bidDataKey + "_OPEN"), "Bid not found")
561- let bidDataArr = split(bidData, "_")
562- let assetId = getBidAssetId(bidDataArr[0])
563- let bidStatus = "CANCELED"
564- let bidAmount = parseIntValue(bidDataArr[1])
565- let highestBidId = getStringByKey(keyHighestBidBidId(artId))
566- if ((bidId == highestBidId))
567- then throw("You can't cancel the highest bid!")
568- else [DeleteEntry((bidDataKey + "_OPEN")), StringEntry(((bidDataKey + "_") + bidStatus), ((bidData + "_") + toString(date))), IntegerEntry(("current_bidamount_" + artId), (bidNbr - 1)), ScriptTransfer(Address(fromBase58String(caller)), bidAmount, assetId)]
569- }
570-
30+let allowedDapps = [sconexDapp]
57131
57232 @Callable(i)
57333 func initDapp (dappKey) = if ((i.caller != this))
57434 then throw("You cannot do this action")
57535 else if ((oracle != ""))
57636 then throw("oracle already set, you can't override!")
57737 else [StringEntry(oracleKey, dappKey)]
57838
57939
58040
58141 @Callable(i)
582-func restartAuctionManual (artId) = if ((getAmountHighestBidByArtId(artId) != 0))
583- then throw("Please accept the highest bid!")
584- else restartAuction(artId, toBase58String(i.caller.bytes))
42+func teamSplitFee (artId,address1,address2,address3,address1Share,address2Share,address3Share) = if (!(containsElement(allowedDapps, i.caller)))
43+ then throw("Not allowed")
44+ else if ((0 > address1Share))
45+ then throw("Share 1 can't be negative")
46+ else if (if (if ((address1Share != 0))
47+ then true
48+ else (address1 != ""))
49+ then !(isDefined(addressFromString(address1)))
50+ else false)
51+ then throw("Address 1 is invalid")
52+ else if ((0 > address2Share))
53+ then throw("Share 2 can't be negative")
54+ else if (if (if ((address2Share != 0))
55+ then true
56+ else (address2 != ""))
57+ then !(isDefined(addressFromString(address2)))
58+ else false)
59+ then throw("Address 2 is invalid")
60+ else if ((0 > address3Share))
61+ then throw("Share 3 can't be negative")
62+ else if (if (if ((address3Share != 0))
63+ then true
64+ else (address3 != ""))
65+ then !(isDefined(addressFromString(address3)))
66+ else false)
67+ then throw("Address 3 is invalid")
68+ else if ((((address1Share + address2Share) + address3Share) != 15))
69+ then throw("Sum of shares should be equal to 15")
70+ else [StringEntry((artId + "_team_address1"), address1), StringEntry((artId + "_team_address2"), address2), StringEntry((artId + "_team_address3"), address3), IntegerEntry((artId + "_team_share1"), address1Share), IntegerEntry((artId + "_team_share2"), address2Share), IntegerEntry((artId + "_team_share3"), address3Share)]
58571
58672
58773
58874 @Callable(i)
589-func mintNft (totalNFT,issueMeta,receiveNFT) = if ((i.caller == this))
590- then {
591- let receiveNFTAddy = Address(fromBase58String(receiveNFT))
592- let issueNFT = Issue(("SCONEX_" + toString((totalNFT + 1))), issueMeta, 1, 0, false)
593- let idNFT = calculateAssetId(issueNFT)
594- $Tuple2([issueNFT, ScriptTransfer(receiveNFTAddy, 1, idNFT)], toBase58String(idNFT))
595- }
596- else throw("Only the dApp can mint NFT's")
75+func creatorSplitFee (artId,address1,address2,address3,address1Share,address2Share,address3Share) = if (!(containsElement(allowedDapps, i.caller)))
76+ then throw("Not allowed")
77+ else if ((0 > address1Share))
78+ then throw("Share 1 can't be negative")
79+ else if (if (if ((address1Share != 0))
80+ then true
81+ else (address1 != ""))
82+ then !(isDefined(addressFromString(address1)))
83+ else false)
84+ then throw("Address 1 is invalid")
85+ else if ((0 > address2Share))
86+ then throw("Share 2 can't be negative")
87+ else if (if (if ((address2Share != 0))
88+ then true
89+ else (address2 != ""))
90+ then !(isDefined(addressFromString(address2)))
91+ else false)
92+ then throw("Address 2 is invalid")
93+ else if ((0 > address3Share))
94+ then throw("Share 3 can't be negative")
95+ else if (if (if ((address3Share != 0))
96+ then true
97+ else (address3 != ""))
98+ then !(isDefined(addressFromString(address3)))
99+ else false)
100+ then throw("Address 3 is invalid")
101+ else if ((((address1Share + address2Share) + address3Share) > 85))
102+ then throw("Sum of shares should be smaller or equal then 85")
103+ else [StringEntry((artId + "_creator_address1"), address1), StringEntry((artId + "_creator_address2"), address2), StringEntry((artId + "_creator_address3"), address3), IntegerEntry((artId + "_creator_share1"), address1Share), IntegerEntry((artId + "_creator_share2"), address2Share), IntegerEntry((artId + "_creator_share3"), address3Share)]
597104
598105
599106
600107 @Callable(i)
601-func addArtwork (sha256Hash,name,description,tags,type,cidDisplay,entitlement,preview,collection,subcollection) = {
602- let t01774017781 = idCallerDate(i)
603- let artId = t01774017781._1
604- let caller = t01774017781._2
605- let date = t01774017781._3
606- if (containsElement(types, type))
607- then {
608- let validateArtwork = validateArtworkData(caller, cidDisplay, name, description, tags)
609- if ((validateArtwork != ""))
610- then throw("Something went wrong!")
611- else {
612- let t01817018212 = validatePayment(i)
613- let amount = t01817018212._1
614- let assetId = t01817018212._2
615- if (!(isDefined(amount)))
616- then throw("Something went wrong")
617- else {
618- let previewData = if (containsElement(Previewtypes, type))
619- then [StringEntry(keyPreviewCid(caller, artId), preview)]
620- else nil
621- let invokeCollectionCreate = invoke(valueOrErrorMessage(addressFromString(collectionsDapp), (collectionsDapp + " not found")), "collectionProcess", [collection, subcollection, caller], nil)
622- if ((invokeCollectionCreate == invokeCollectionCreate))
623- then {
624- let idCollection = match invokeCollectionCreate {
625- case r: String =>
626- r
627- case _ =>
628- throw("Incorrect invoke result")
629- }
630- let entryExist = getStringByKey(keyTxidByHashOwner(sha256Hash, caller))
631- if ((entryExist != ""))
632- then throw("You already added it")
633- else {
634- let hashExist = getStringByKey(keyOwnerByHash(sha256Hash))
635- if ((hashExist != ""))
636- then throw("This hash is already registered")
637- else (previewData ++ [StringEntry(keyOwnerByHash(sha256Hash), caller), StringEntry(keyTxidByHashOwner(sha256Hash, caller), artId), IntegerEntry(keyDate(caller, artId), date), StringEntry(keyName(caller, artId), name), StringEntry(keyDesc(caller, artId), description), StringEntry(keyDisplayCid(caller, artId), cidDisplay), StringEntry(keyType(caller, artId), type), StringEntry(keyTags(caller, artId), tags), IntegerEntry(keyMaxMint(caller, artId), 0), IntegerEntry(keyIssued(caller, artId), 0), BooleanEntry(keyOnSale(caller, artId), false), StringEntry(keyHashByTxidAddr(caller, artId), sha256Hash), StringEntry(keyEntitlement(caller, artId), entitlement), ScriptTransfer(Address(fromBase58String(feeReceiver)), amount, assetId)])
638- }
639- }
640- else throw("Strict value is not equal to itself.")
641- }
642- }
643- }
644- else throw("Unknown type")
645- }
108+func payFeeResell (txId,seller) = if (!(containsElement(allowedDapps, i.caller)))
109+ then throw("Not allowed")
110+ else {
111+ let sconexFeePercentage = 3
112+ let amount = value(i.payments[0].amount)
113+ let assetId = value(i.payments[0].assetId)
114+ let address1ShareCreator = getInt((txId + "_creator_share1"))
115+ let address2ShareCreator = getInt((txId + "_creator_share2"))
116+ let address3ShareCreator = getInt((txId + "_creator_share3"))
117+ let address1Creator = getStr((txId + "_creator_address1"))
118+ let address2Creator = getStr((txId + "_creator_address2"))
119+ let address3Creator = getStr((txId + "_creator_address3"))
120+ let address1CreatorReward = if ((address1Creator == ""))
121+ then 0
122+ else fraction(amount, address1ShareCreator, 100)
123+ let address2CreatorReward = if ((address2Creator == ""))
124+ then 0
125+ else fraction(amount, address2ShareCreator, 100)
126+ let address3CreatorReward = if ((address3Creator == ""))
127+ then 0
128+ else fraction(amount, address3ShareCreator, 100)
129+ let sconexFeeReward = fraction(amount, sconexFeePercentage, 100)
130+ let sellerReward = ((((amount - address1CreatorReward) - address2CreatorReward) - address3CreatorReward) - sconexFeeReward)
131+ let scriptTransferFeeReceiver = [ScriptTransfer(addressFromStringValue(feeReceiver), sconexFeeReward, i.payments[0].assetId)]
132+ let scriptTransferAddress1 = if ((address1Creator == ""))
133+ then nil
134+ else [ScriptTransfer(addressFromStringValue(address1Creator), address1CreatorReward, i.payments[0].assetId)]
135+ let scriptTransferAddress2 = if ((address2Creator == ""))
136+ then nil
137+ else [ScriptTransfer(addressFromStringValue(address2Creator), address2CreatorReward, i.payments[0].assetId)]
138+ let scriptTransferAddress3 = if ((address3Creator == ""))
139+ then nil
140+ else [ScriptTransfer(addressFromStringValue(address3Creator), address3CreatorReward, i.payments[0].assetId)]
141+ let scriptTransferSeller = if ((seller == ""))
142+ then nil
143+ else [ScriptTransfer(addressFromStringValue(seller), sellerReward, i.payments[0].assetId)]
144+ ((((scriptTransferAddress1 ++ scriptTransferAddress2) ++ scriptTransferAddress3) ++ scriptTransferFeeReceiver) ++ scriptTransferSeller)
145+ }
646146
647147
648148
649149 @Callable(i)
650-func sellArtwork (artId,price,maxMint,assetId,auctionType,duration,add1,add2,add3,add1Sh,add2Sh,add3Sh) = {
651- let invokeTeamFeeSplit = invoke(valueOrErrorMessage(addressFromString(feeDapp), (feeDapp + " not found")), "teamSplitFee", [artId, feeReceiver, "", "", 15, 0, 0], nil)
652- if ((invokeTeamFeeSplit == invokeTeamFeeSplit))
653- then {
654- let invokeCreatorFeeSplit = invoke(valueOrErrorMessage(addressFromString(feeDapp), (feeDapp + " not found")), "creatorSplitFee", [artId, add1, add2, add3, add1Sh, add2Sh, add3Sh], nil)
655- if ((invokeCreatorFeeSplit == invokeCreatorFeeSplit))
656- then {
657- let t02571425747 = idCallerDate(i)
658- let id = t02571425747._1
659- let caller = t02571425747._2
660- let artworkName = getStringByKey(keyName(caller, artId))
661- if (!(containsElement([auctionType1, auctionType2, auctionType3], auctionType)))
662- then throw("We don't know this auction type")
663- else if ((artworkName == ""))
664- then throw("This art doesn't match your account")
665- else {
666- let bidNbr = getIntegerByKey(("current_bidamount_" + artId))
667- if (!(acceptedAssetIds(assetId)))
668- then throw("Something went wrong!")
669- else if (!(validateMinSell(assetId, price)))
670- then throw("Something went wrong!")
671- else {
672- let checkUser = validateUser(caller)
673- if ((checkUser != ""))
674- then throw(checkUser)
675- else {
676- let amountSold = getIntegerByKey(keyIssued(caller, artId))
677- let maxCanSell = getIntegerByKey(keyMaxMint(caller, artId))
678- if ((maxMint > 10000))
679- then throw("10000 editions max per artwork")
680- else if (if ((amountSold != 0))
681- then (amountSold == maxCanSell)
682- else false)
683- then throw("Max edition reached.")
684- else if (if ((amountSold > 0))
685- then (maxCanSell != maxMint)
686- else false)
687- then throw("Cannot change maximum issuable anymore")
688- else if (if ((bidNbr > 0))
689- then (maxCanSell != maxMint)
690- else false)
691- then throw("Cannot change maximum issuable with active orders")
692- else {
693- let sellStatus = if (if ((price > 0))
694- then (maxMint > 0)
695- else false)
696- then true
697- else false
698- let endHeight = (duration + height)
699-[BooleanEntry(keyOnSale(caller, artId), sellStatus), IntegerEntry(keyPrice(caller, artId), price), IntegerEntry(keyMaxMint(caller, artId), maxMint), IntegerEntry(keyDuration(caller, artId), duration), IntegerEntry(keyEndHeight(caller, artId), endHeight), StringEntry(keyAssetIdAccepted(caller, artId), assetId), StringEntry(keyAuctionType(caller, artId), auctionType)]
700- }
701- }
702- }
703- }
704- }
705- else throw("Strict value is not equal to itself.")
706- }
707- else throw("Strict value is not equal to itself.")
708- }
709-
710-
711-
712-@Callable(i)
713-func buyArtwork (artId,issuer) = {
714- let auctionType = getStringByKey(keyAuctionType(issuer, artId))
715- if ((auctionType == auctionType3))
716- then buyMint(i, artId, issuer, "", "", false)
717- else throw("Direct buy only allowed when no auction type is set!")
718- }
719-
720-
721-
722-@Callable(i)
723-func updateTags (artist,artId,tags) = {
724- let caller = toString(addressFromPublicKey(i.callerPublicKey))
725- if (containsElement(owners, caller))
726- then if ((size(split(tags, ",")) > 5))
727- then throw("5 tags max.")
728- else {
729- let tagsOld = getStringByKeyOrError(keyTags(artist, artId), "No tags created with this key, so can't update!")
730- if ((tags == tagsOld))
731- then throw("Tags are the same as old tags!")
732- else [StringEntry(keyTags(artist, artId), tags)]
733- }
734- else throw("no")
735- }
736-
737-
738-
739-@Callable(i)
740-func deleteEntry (entry) = {
741- let caller = toString(addressFromPublicKey(i.callerPublicKey))
742- if (containsElement(owners, caller))
743- then [DeleteEntry(entry)]
744- else throw("no")
745- }
746-
747-
748-
749-@Callable(i)
750-func setBid (artId,issuer) = {
751- let auctionType = getStringByKey(keyAuctionType(issuer, artId))
752- if ((auctionType == auctionType1))
753- then setBidNonTraditional(i, artId, issuer)
754- else if ((auctionType == auctionType2))
755- then setBidTraditional(i, artId, issuer)
756- else throw((("Unknown auction type :" + auctionType) + ", please contact the admins"))
757- }
758-
759-
760-
761-@Callable(i)
762-func acceptBid (artId,issuer,bidId,bidOwner) = {
763- let auctionType = getStringByKey(keyAuctionType(issuer, artId))
764- if ((auctionType == auctionType1))
765- then acceptBidNonTraditional(i, artId, issuer, bidId, bidOwner)
766- else if ((auctionType == auctionType2))
767- then acceptBidTraditional(i, artId, issuer, bidId, bidOwner)
768- else throw((("Unknown auction type :" + auctionType) + ", please contact the admins"))
769- }
770-
771-
772-
773-@Callable(i)
774-func cancelBid (artId,issuer,bidId) = {
775- let auctionType = getStringByKey(keyAuctionType(issuer, artId))
776- if ((auctionType == auctionType1))
777- then cancelBidImpl(i, artId, issuer, bidId)
778- else cancelBidImplTraditional(i, artId, issuer, bidId)
779- }
150+func payFee (txId,seller) = if (!(containsElement(allowedDapps, i.caller)))
151+ then throw("Not allowed")
152+ else {
153+ let amount = value(i.payments[0].amount)
154+ let assetId = value(i.payments[0].assetId)
155+ let address1ShareTeam = getInt((txId + "_team_share1"))
156+ let address2ShareTeam = getInt((txId + "_team_share2"))
157+ let address3ShareTeam = getInt((txId + "_team_share3"))
158+ let address1Team = getStr((txId + "_team_address1"))
159+ let address2Team = getStr((txId + "_team_address2"))
160+ let address3Team = getStr((txId + "_team_address3"))
161+ let address1ShareCreator = getInt((txId + "_creator_address1"))
162+ let address2ShareCreator = getInt((txId + "_creator_address2"))
163+ let address3ShareCreator = getInt((txId + "_creator_address3"))
164+ let address1Creator = getStr((txId + "_creator_address1"))
165+ let address2Creator = getStr((txId + "_creator_address2"))
166+ let address3Creator = getStr((txId + "_creator_address3"))
167+ let address1TeamReward = if ((address1Team == ""))
168+ then 0
169+ else fraction(amount, address1ShareTeam, 100)
170+ let address2TeamReward = if ((address2Team == ""))
171+ then 0
172+ else fraction(amount, address2ShareTeam, 100)
173+ let address3TeamReward = if ((address3Team == ""))
174+ then 0
175+ else fraction(amount, address3ShareTeam, 100)
176+ let address1CreatorReward = if ((address1Creator == ""))
177+ then 0
178+ else fraction(amount, address1ShareCreator, 100)
179+ let address2CreatorReward = if ((address2Creator == ""))
180+ then 0
181+ else fraction(amount, address2ShareCreator, 100)
182+ let address3CreatorReward = if ((address3Creator == ""))
183+ then 0
184+ else fraction(amount, address3ShareCreator, 100)
185+ let scriptTransferAddressTeam1 = if ((address1Team == ""))
186+ then nil
187+ else [ScriptTransfer(addressFromStringValue(address1Team), address1TeamReward, i.payments[0].assetId)]
188+ let scriptTransferAddressTeam2 = if ((address2Team == ""))
189+ then nil
190+ else [ScriptTransfer(addressFromStringValue(address2Team), address2TeamReward, i.payments[0].assetId)]
191+ let scriptTransferAddressTeam3 = if ((address3Team == ""))
192+ then nil
193+ else [ScriptTransfer(addressFromStringValue(address3Team), address3TeamReward, i.payments[0].assetId)]
194+ let scriptTransferAddress1 = if ((address1Creator == ""))
195+ then nil
196+ else [ScriptTransfer(addressFromStringValue(address1Creator), address1CreatorReward, i.payments[0].assetId)]
197+ let scriptTransferAddress2 = if ((address2Creator == ""))
198+ then nil
199+ else [ScriptTransfer(addressFromStringValue(address2Creator), address2CreatorReward, i.payments[0].assetId)]
200+ let scriptTransferAddress3 = if ((address3Creator == ""))
201+ then nil
202+ else [ScriptTransfer(addressFromStringValue(address3Creator), address3CreatorReward, i.payments[0].assetId)]
203+ let sellerReward = ((((((amount - address1CreatorReward) - address2CreatorReward) - address3CreatorReward) - address1TeamReward) - address2TeamReward) - address3TeamReward)
204+ let scriptTransferSeller = if ((seller == ""))
205+ then nil
206+ else [ScriptTransfer(addressFromStringValue(seller), sellerReward, i.payments[0].assetId)]
207+ ((((((scriptTransferAddressTeam1 ++ scriptTransferAddressTeam2) ++ scriptTransferAddressTeam3) ++ scriptTransferAddress1) ++ scriptTransferAddress2) ++ scriptTransferAddress3) ++ scriptTransferSeller)
208+ }
780209
781210

github/deemru/w8io/169f3d6 
64.37 ms