tx · 1r85ZdPxzXD3HFd2ookZ2weXP2xL2X7Ep93MPLgqecz 3MuUX82xyULepVCWFG2TfkTDN55b1BVP6k2: -0.01900000 Waves 2022.11.03 14:07 [2300856] smart account 3MuUX82xyULepVCWFG2TfkTDN55b1BVP6k2 > SELF 0.00000000 Waves
{ "type": 13, "id": "1r85ZdPxzXD3HFd2ookZ2weXP2xL2X7Ep93MPLgqecz", "fee": 1900000, "feeAssetId": null, "timestamp": 1667473705796, "version": 2, "chainId": 84, "sender": "3MuUX82xyULepVCWFG2TfkTDN55b1BVP6k2", "senderPublicKey": "FnsRT7dPTyP4iE8WcdhA2hdnaAv31CwhetpiFYgKBtoQ", "proofs": [ "2tHS8ZdCtaPqKWmFNRHLzDZC3nSguNvXQJ13YDdJwe6o72kNLYTea1G24VUgjysKbXuVtTUMaaQsZVkQJgW7vBhA" ], "script": "base64:BgJgCAISBAoCCAgSCAoGCAgICAgIEgkKBwgICAgICAgSAwoBCBIECgIICBIGCgQICAgIEggKBggICAEBARIJCgcICAgIAQEBEgUKAwgIBBIECgIICBIFCgMICAgSABIDCgEINAAHVkVSU0lPTgIFMS4wLjABDmdldFN0cmluZ0J5S2V5AQNrZXkJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUEdGhpcwUDa2V5AgAACHVzZXJEYXBwCQEFdmFsdWUBCQCmCAEJAQ5nZXRTdHJpbmdCeUtleQECD2NvbmZfdXNlcnNfZGFwcAALZmVlUmVjZWl2ZXIJAQ5nZXRTdHJpbmdCeUtleQECEWNvbmZfZmVlX3JlY2VpdmVyAAtzaWduQXNzZXRJZAkA2QQBCQEOZ2V0U3RyaW5nQnlLZXkBAhhjb25mX2FjY2VwdGVkX2Fzc2V0X1NJR04ABWNocmlzCQEOZ2V0U3RyaW5nQnlLZXkBAgxjb25mX2FkbWluXzEBD2dldEludGVnZXJCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFA2tleQAAAQ9nZXRCb29sZWFuQnlLZXkBA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B3BheW1lbnQHYXNzZXRJZAkAZAIFCmFtb3VudFVzZWQAAQkAzAgCCQELU3RyaW5nRW50cnkCCQEUa2V5VGlja2V0SGlzdG9yeVVzZWQFBQZpc3N1ZXIFB2V2ZW50SWQFCHRpY2tldElkCQDYBAEJAQV2YWx1ZQEIBQdwYXltZW50B2Fzc2V0SWQJAKQDAQkAZAIFCmFtb3VudFVzZWQAAQkArAICCQCsAgIJAKwCAgkArAICCQCsAgIJAKwCAgUCaWQCAV8FBmNhbGxlcgIBXwkApAMBBQRkYXRlAgFfCQCkAwEJAGQCBQphbW91bnRVc2VkAAEJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBCQDZBAEFBmNhbGxlcgABCAUHcGF5bWVudAdhc3NldElkBQNuaWwBaQELZGVsZXRlRW50cnkBBWVudHJ5BAZjYWxsZXIJAKUIAQgFAWkGY2FsbGVyAwkAAAIFBmNhbGxlcgUFY2hyaXMJAMwIAgkBC0RlbGV0ZUVudHJ5AQUFZW50cnkFA25pbAkAAgECAm5vACGKgZg=", "height": 2300856, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GYeSviPVup7Meq2ejbZbXeZaTJkNuNQ1a6YLayvisEfz Next: none Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let VERSION = "1.0.0" | |
5 | 5 | ||
6 | - | func | |
6 | + | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
7 | 7 | ||
8 | 8 | ||
9 | - | let | |
9 | + | let userDapp = value(addressFromString(getStringByKey("conf_users_dapp"))) | |
10 | 10 | ||
11 | - | let | |
11 | + | let feeReceiver = getStringByKey("conf_fee_receiver") | |
12 | 12 | ||
13 | - | let | |
13 | + | let signAssetId = fromBase58String(getStringByKey("conf_accepted_asset_SIGN")) | |
14 | 14 | ||
15 | - | let | |
15 | + | let chris = getStringByKey("conf_admin_1") | |
16 | 16 | ||
17 | - | ||
17 | + | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
18 | 18 | ||
19 | - | let signCut = 3 | |
20 | 19 | ||
21 | - | let organizerCut = 10 | |
20 | + | func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false) | |
21 | + | ||
22 | + | ||
23 | + | let dappRunning = valueOrElse(getBoolean(userDapp, "conf_dapp_is_running"), true) | |
24 | + | ||
25 | + | let maintenanceMSG = valueOrElse(getString(userDapp, "conf_maintenance_msg"), "") | |
22 | 26 | ||
23 | 27 | let userSuspended = "SUSPENDED" | |
24 | 28 | ||
25 | - | let | |
29 | + | let userUnregistered = "UNREGISTERED" | |
26 | 30 | ||
27 | - | let eventSuspended = "SUSPENDED" | |
28 | - | ||
29 | - | let dappRunningKey = "conf_dapp_is_running" | |
30 | - | ||
31 | - | let maintenanceMSGKey = "conf_maintenance_msg" | |
32 | - | ||
33 | - | let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true) | |
34 | - | ||
35 | - | let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "") | |
36 | - | ||
37 | - | let numSalesK = "num_sales" | |
38 | - | ||
39 | - | func getUserStrByK (key) = valueOrElse(getString(userDapp, key), "Error") | |
31 | + | func validateCID (cid) = if (contains(cid, "/")) | |
32 | + | then if (if ((76 > size(cid))) | |
33 | + | then (size(split(cid, "/")[0]) == 59) | |
34 | + | else false) | |
35 | + | then (16 > size(split(cid, "/")[1])) | |
36 | + | else false | |
37 | + | else false | |
40 | 38 | ||
41 | 39 | ||
42 | - | func getEventStrByK (key) = valueOrElse(getString(eventsDapp, key), "") | |
40 | + | let signCut = 2 | |
41 | + | ||
42 | + | func keyUserStatus (caller) = ("user_status_" + caller) | |
43 | 43 | ||
44 | 44 | ||
45 | - | func | |
45 | + | func keyEventOwnerByEventId (eventId) = ("get_event_owner_" + eventId) | |
46 | 46 | ||
47 | 47 | ||
48 | - | func | |
48 | + | func keyEventAddedDate (caller,eventId) = ((("event_addedDate_" + eventId) + "_") + caller) | |
49 | 49 | ||
50 | 50 | ||
51 | - | func | |
51 | + | func keyEventDate (caller,eventId) = ((("event_date_" + eventId) + "_") + caller) | |
52 | 52 | ||
53 | 53 | ||
54 | - | func | |
54 | + | func keyEventName (caller,eventId) = ((("event_name_" + eventId) + "_") + caller) | |
55 | 55 | ||
56 | 56 | ||
57 | - | func | |
57 | + | func keyEventDesc (caller,eventId) = ((("event_desc_" + eventId) + "_") + caller) | |
58 | 58 | ||
59 | 59 | ||
60 | - | func getBidKey (offerOwner,ticketId,saleOwner,offerId) = ((((((("offer2nd_" + offerOwner) + "_") + ticketId) + "_") + saleOwner) + "_") + offerId) | |
60 | + | func keyEventDisplayCid (caller,eventId) = ((("event_displayCid_" + eventId) + "_") + caller) | |
61 | + | ||
62 | + | ||
63 | + | func keyEventTags (caller,eventId) = ((("event_tags_" + eventId) + "_") + caller) | |
64 | + | ||
65 | + | ||
66 | + | func keyEventFlag (caller,eventId) = ((("event_flag_" + eventId) + "_") + caller) | |
67 | + | ||
68 | + | ||
69 | + | func keyEventNote (caller,eventId) = ((("event_note_" + eventId) + "_") + caller) | |
70 | + | ||
71 | + | ||
72 | + | func keyEventCrawler (caller,eventId) = ((("event_crawlerCid_" + eventId) + "_") + caller) | |
73 | + | ||
74 | + | ||
75 | + | func keyEventTotalTicketTypes (caller,eventId) = ((("event_totalTicketTypes_" + eventId) + "_") + caller) | |
76 | + | ||
77 | + | ||
78 | + | func keyEventTotalTicketsIssued (caller,eventId) = ((("event_totalIssued_" + eventId) + "_") + caller) | |
79 | + | ||
80 | + | ||
81 | + | func keyEventCanceled (caller,eventId) = ((("event_canceled_" + eventId) + "_") + caller) | |
82 | + | ||
83 | + | ||
84 | + | func keyEventCanceledReason (caller,eventId) = ((("event_canceledReason_" + eventId) + "_") + caller) | |
85 | + | ||
86 | + | ||
87 | + | func keyTicketName (caller,eventId,ticketId) = ((((("ticket_name_" + eventId) + "_") + caller) + "_") + ticketId) | |
88 | + | ||
89 | + | ||
90 | + | func keyTicketDesc (caller,eventId,ticketId) = ((((("ticket_desc_" + eventId) + "_") + caller) + "_") + ticketId) | |
91 | + | ||
92 | + | ||
93 | + | func keyTicketPrice (caller,eventId,ticketId) = ((((("ticket_price_" + eventId) + "_") + caller) + "_") + ticketId) | |
94 | + | ||
95 | + | ||
96 | + | func keyTicketDate (caller,eventId,ticketId) = ((((("ticket_date_" + eventId) + "_") + caller) + "_") + ticketId) | |
97 | + | ||
98 | + | ||
99 | + | func keyTicketMaxAvailable (caller,eventId,ticketId) = ((((("ticket_maxAvailable_" + eventId) + "_") + caller) + "_") + ticketId) | |
100 | + | ||
101 | + | ||
102 | + | func keyTicketSold (caller,eventId,ticketId) = ((((("ticket_sold_" + eventId) + "_") + caller) + "_") + ticketId) | |
103 | + | ||
104 | + | ||
105 | + | func keyTicketOnSale (caller,eventId,ticketId) = ((((("ticket_onSale_" + eventId) + "_") + caller) + "_") + ticketId) | |
106 | + | ||
107 | + | ||
108 | + | func keyTicketAmountUsed (caller,eventId,ticketId,nftId) = ((((((("ticket_amountUsed_" + eventId) + "_") + caller) + "_") + ticketId) + "_") + nftId) | |
109 | + | ||
110 | + | ||
111 | + | func keyTicketHistoryUsed (caller,eventId,ticketId,nftId,usageIndex) = ((((((((("ticket_historyUsed_" + eventId) + "_") + caller) + "_") + ticketId) + "_") + nftId) + "_") + usageIndex) | |
112 | + | ||
113 | + | ||
114 | + | func keyTicketMaxUse (caller,eventId,ticketId) = ((((("ticket_maxUse_" + eventId) + "_") + caller) + "_") + ticketId) | |
115 | + | ||
116 | + | ||
117 | + | func keyTicketTotalIssued (caller,eventId,ticketId) = ((((("ticket_totalIssued_" + eventId) + "_") + caller) + "_") + ticketId) | |
118 | + | ||
119 | + | ||
120 | + | func validateString (str,max) = if ((size(str) == 0)) | |
121 | + | then throw("Field cannot be is empty") | |
122 | + | else if ((size(str) > max)) | |
123 | + | then throw((str + " is too long")) | |
124 | + | else true | |
125 | + | ||
126 | + | ||
127 | + | func validateInt (num) = (0 > num) | |
128 | + | ||
129 | + | ||
130 | + | func getEventOwnerByEventId (eventId) = valueOrElse(getString(this, keyEventOwnerByEventId(eventId)), "") | |
131 | + | ||
132 | + | ||
133 | + | func validateUser (caller) = { | |
134 | + | let userStatus = valueOrElse(getString(userDapp, keyUserStatus(caller)), userUnregistered) | |
135 | + | if ((userStatus == userUnregistered)) | |
136 | + | then "Register this account first with \"Account\" tab" | |
137 | + | else if ((userStatus == userSuspended)) | |
138 | + | then "Account suspended" | |
139 | + | else "" | |
140 | + | } | |
141 | + | ||
142 | + | ||
143 | + | func validateEventData (caller,cidDisplay,name,description,tags,date) = { | |
144 | + | let checkUser = validateUser(caller) | |
145 | + | if ((checkUser != "")) | |
146 | + | then throw(checkUser) | |
147 | + | else if ((size(cidDisplay) == 0)) | |
148 | + | then throw("Display CID cannot be empty") | |
149 | + | else if (!(validateCID(cidDisplay))) | |
150 | + | then throw("Problem with CID") | |
151 | + | else if (!(validateString(name, 300))) | |
152 | + | then throw("300 Char. max name") | |
153 | + | else if (!(validateString(description, 3000))) | |
154 | + | then throw("3000 Char. max description") | |
155 | + | else if (!(validateString(date, 1000))) | |
156 | + | then throw("1000 Char. max date") | |
157 | + | else if ((size(split(tags, ",")) > 5)) | |
158 | + | then throw("5 tags max.") | |
159 | + | else "" | |
160 | + | } | |
161 | + | ||
162 | + | ||
163 | + | func validateTicketData (eventId,caller,name,description,price,maxAvailable,maxUse) = { | |
164 | + | let checkUser = validateUser(caller) | |
165 | + | if ((checkUser != "")) | |
166 | + | then throw(checkUser) | |
167 | + | else if (!(validateString(name, 200))) | |
168 | + | then throw("100 Char. max name") | |
169 | + | else if (!(validateString(description, 1000))) | |
170 | + | then throw("1000 Char. max description") | |
171 | + | else if (if (if (validateInt(price)) | |
172 | + | then true | |
173 | + | else validateInt(maxUse)) | |
174 | + | then true | |
175 | + | else validateInt(maxAvailable)) | |
176 | + | then throw("Positive amount only") | |
177 | + | else if (!(validateString(description, 1000))) | |
178 | + | then throw("1000 Char. max description") | |
179 | + | else "" | |
180 | + | } | |
61 | 181 | ||
62 | 182 | ||
63 | 183 | func idCallerDate (i) = if (!(dappRunning)) | |
74 | 194 | } | |
75 | 195 | ||
76 | 196 | ||
77 | - | func assetIsValid (assetDetails) = if (if (if ((assetDetails.quantity == 1)) | |
78 | - | then (assetDetails.decimals == 0) | |
79 | - | else false) | |
80 | - | then (assetDetails.reissuable == false) | |
81 | - | else false) | |
82 | - | then (assetDetails.issuer == eventsDapp) | |
83 | - | else false | |
84 | - | ||
85 | - | ||
86 | - | func isSignEventNFT (id) = { | |
87 | - | let assetDetails = value(assetInfo(id)) | |
88 | - | assetIsValid(assetDetails) | |
89 | - | } | |
90 | - | ||
91 | - | ||
92 | - | func acceptedAssetIds (assetId) = if ((assetId != toBase58String(signAssetId))) | |
93 | - | then false | |
94 | - | else true | |
95 | - | ||
96 | - | ||
97 | - | func getBidAssetId (assetId) = fromBase58String(assetId) | |
98 | - | ||
99 | - | ||
100 | - | func getSaleOwnerAndStatus (ticketId) = { | |
101 | - | let saleOwner = getStrByK(("current_owner_on_dapp_" + ticketId)) | |
102 | - | if ((size(saleOwner) == 0)) | |
103 | - | then throw("Ticket not found") | |
197 | + | func validatePriceAssetId (i,priceAssetId,artworkPrice) = { | |
198 | + | let $t067016737 = isPayment(i) | |
199 | + | let payment = $t067016737._1 | |
200 | + | let amount = $t067016737._2 | |
201 | + | if (!(isDefined(payment.assetId))) | |
202 | + | then throw("Wrong asset attached") | |
104 | 203 | else { | |
105 | - | let saleStatus = getStrByK(((("sale2nd_status_" + saleOwner) + "_") + ticketId)) | |
106 | - | if ((saleStatus != "OPEN")) | |
107 | - | then throw("Ticket not for sale") | |
108 | - | else saleOwner | |
204 | + | let assetId = if (if ((size(priceAssetId) > 0)) | |
205 | + | then (toBase58String(value(payment.assetId)) == priceAssetId) | |
206 | + | else false) | |
207 | + | then payment.assetId | |
208 | + | else throw("Wrong asset attached") | |
209 | + | if ((artworkPrice != amount)) | |
210 | + | then throw("Payment amount don't match") | |
211 | + | else $Tuple2(amount, assetId) | |
109 | 212 | } | |
110 | 213 | } | |
111 | 214 | ||
112 | 215 | ||
113 | - | func getBidData (key) = { | |
114 | - | let bidData = getStrByK((key + "_OPEN")) | |
115 | - | if ((bidData == "")) | |
116 | - | then throw("Offer not found") | |
117 | - | else { | |
118 | - | let bidDataArr = split(bidData, "_") | |
119 | - | let assetId = getBidAssetId(bidDataArr[2]) | |
120 | - | $Tuple3(bidDataArr, assetId, bidData) | |
121 | - | } | |
216 | + | func isEventOwner (eventId,caller) = { | |
217 | + | let eventOwner = getEventOwnerByEventId(eventId) | |
218 | + | if ((eventOwner == "")) | |
219 | + | then throw("Event not found") | |
220 | + | else (eventOwner == caller) | |
122 | 221 | } | |
123 | 222 | ||
124 | 223 | ||
125 | - | func eventIsValid (eventStatus) = if ((eventStatus != eventIllegal)) | |
126 | - | then (eventStatus != eventSuspended) | |
127 | - | else false | |
128 | - | ||
129 | - | ||
130 | - | func checkEventStatus (addr,id) = { | |
131 | - | let eventStatus = getEventStrByK(keyFlag(addr, id)) | |
132 | - | if (eventIsValid(eventStatus)) | |
133 | - | then true | |
134 | - | else throw(("Original event flagged as " + eventStatus)) | |
224 | + | func ticketExist (caller,eventId,ticketId) = { | |
225 | + | let ticket = getStringByKey(keyTicketName(caller, eventId, ticketId)) | |
226 | + | (size(ticket) != 0) | |
135 | 227 | } | |
136 | 228 | ||
137 | 229 | ||
138 | - | func checkOrganizerStatus (addr) = { | |
139 | - | let organizerStatus = getUserStrByK(keyUserStatus(addr)) | |
140 | - | if (containsElement([userSuspended], organizerStatus)) | |
141 | - | then throw(("Original organizer " + organizerStatus)) | |
142 | - | else true | |
143 | - | } | |
144 | - | ||
145 | - | ||
146 | - | func checkNFTInfo (assetId) = { | |
147 | - | let nftData = split(getEventStrByK(keyNFTData(assetId)), "_") | |
148 | - | if (if (!(checkEventStatus(nftData[6], nftData[5]))) | |
149 | - | then !(checkOrganizerStatus(nftData[6])) | |
150 | - | else false) | |
151 | - | then $Tuple3(false, nftData[5], nftData[6]) | |
152 | - | else $Tuple3(true, nftData[5], nftData[6]) | |
153 | - | } | |
154 | - | ||
155 | - | ||
156 | - | func checkEVENTExist (artId,creatorAddr) = if (if (!(checkEventStatus(creatorAddr, artId))) | |
157 | - | then !(checkOrganizerStatus(creatorAddr)) | |
158 | - | else false) | |
159 | - | then false | |
160 | - | else true | |
161 | - | ||
162 | - | ||
163 | - | func setTransfers (amount,assetId,ticketId,organizerAddr,saleOwner,caller) = { | |
164 | - | let amountForSign = fraction(amount, signCut, 100) | |
165 | - | let amountForOrganizer = fraction(amount, organizerCut, 100) | |
166 | - | let amountForOwner = (amount - (amountForSign + amountForOrganizer)) | |
167 | - | let commissions = [ScriptTransfer(Address(fromBase58String(feeReceiver)), amountForSign, assetId)] | |
168 | - | let organizerFee = ScriptTransfer(Address(fromBase58String(organizerAddr)), amountForOrganizer, assetId) | |
169 | - | let ownerFee = ScriptTransfer(Address(fromBase58String(saleOwner)), amountForOwner, assetId) | |
170 | - | let collectorNFT = ScriptTransfer(Address(fromBase58String(caller)), 1, fromBase58String(ticketId)) | |
171 | - | $Tuple4(commissions, organizerFee, ownerFee, collectorNFT) | |
172 | - | } | |
173 | - | ||
174 | - | ||
175 | - | func provideBaseData (i,ticketId) = { | |
176 | - | let $t057605799 = idCallerDate(i) | |
177 | - | let id = $t057605799._1 | |
178 | - | let caller = $t057605799._2 | |
179 | - | let date = $t057605799._3 | |
180 | - | let $t058025863 = checkNFTInfo(ticketId) | |
181 | - | let isValidNFT = $t058025863._1 | |
182 | - | let artId = $t058025863._2 | |
183 | - | let creatorAddr = $t058025863._3 | |
184 | - | $Tuple6(id, caller, date, isValidNFT, artId, creatorAddr) | |
185 | - | } | |
186 | - | ||
187 | - | ||
188 | - | func updateNumSales () = { | |
189 | - | let numSales = getIntByK(numSalesK) | |
190 | - | IntegerEntry(numSalesK, (numSales + 1)) | |
191 | - | } | |
230 | + | func eventIsCanceled (issuer,eventId) = getBooleanByKey(keyEventCanceled(issuer, eventId)) | |
192 | 231 | ||
193 | 232 | ||
194 | 233 | @Callable(invoke) | |
203 | 242 | ||
204 | 243 | ||
205 | 244 | ||
206 | - | @Callable(invoke) | |
207 | - | func appRunning (isLive,message) = { | |
208 | - | let caller = toString(invoke.caller) | |
209 | - | let id = toBase58String(invoke.transactionId) | |
210 | - | if (containsElement([chris, toString(this)], caller)) | |
211 | - | then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)] | |
212 | - | else throw("You are not allowed to change this") | |
213 | - | } | |
214 | - | ||
215 | - | ||
216 | - | ||
217 | 245 | @Callable(i) | |
218 | - | func sellNFT (price) = { | |
219 | - | let $t069026938 = isPayment(i) | |
220 | - | let payment = $t069026938._1 | |
221 | - | let amount = $t069026938._2 | |
222 | - | if ((amount != 1)) | |
223 | - | then throw("No Ticket attached") | |
246 | + | func addEvent (name,description,tags,cidDisplay,crawler,date) = { | |
247 | + | let $t080668115 = idCallerDate(i) | |
248 | + | let eventId = $t080668115._1 | |
249 | + | let caller = $t080668115._2 | |
250 | + | let addedDate = $t080668115._3 | |
251 | + | let checkUser = validateUser(caller) | |
252 | + | if ((checkUser != "")) | |
253 | + | then throw(checkUser) | |
224 | 254 | else { | |
225 | - | let ticketId = if (if (isDefined(payment.assetId)) | |
226 | - | then isSignEventNFT(value(payment.assetId)) | |
227 | - | else false) | |
228 | - | then toBase58String(value(payment.assetId)) | |
229 | - | else throw("Only SIGN Event NFT accepted.") | |
230 | - | let $t071827268 = provideBaseData(i, ticketId) | |
231 | - | let id = $t071827268._1 | |
232 | - | let caller = $t071827268._2 | |
233 | - | let date = $t071827268._3 | |
234 | - | let isValidNFT = $t071827268._4 | |
235 | - | let eventId = $t071827268._5 | |
236 | - | let creatorAddr = $t071827268._6 | |
237 | - | if (!(isValidNFT)) | |
238 | - | then throw("Not a valid ticket") | |
239 | - | else [StringEntry((getSaleKey(caller, ticketId, eventId, creatorAddr) + "_OPEN"), ((((((((((((toString(date) + "_") + toString(price)) + "_") + toBase58String(signAssetId)) + "_") + ticketId) + "_") + eventId) + "_") + creatorAddr) + "_") + id)), StringEntry(((("sale2nd_status_" + caller) + "_") + ticketId), "OPEN"), StringEntry(("current_owner_on_dapp_" + ticketId), caller)] | |
255 | + | let validateEvent = validateEventData(caller, cidDisplay, name, description, tags, date) | |
256 | + | if ((validateEvent != "")) | |
257 | + | then throw("Something went wrong!") | |
258 | + | else [IntegerEntry(keyEventAddedDate(caller, eventId), addedDate), StringEntry(keyEventDate(caller, eventId), date), StringEntry(keyEventName(caller, eventId), name), StringEntry(keyEventDesc(caller, eventId), description), StringEntry(keyEventDisplayCid(caller, eventId), cidDisplay), StringEntry(keyEventTags(caller, eventId), tags), StringEntry(keyEventCrawler(caller, eventId), crawler), IntegerEntry(keyEventTotalTicketsIssued(caller, eventId), 0), BooleanEntry(keyEventCanceled(caller, eventId), false), StringEntry(keyEventOwnerByEventId(eventId), caller)] | |
240 | 259 | } | |
241 | 260 | } | |
242 | 261 | ||
243 | 262 | ||
244 | 263 | ||
245 | 264 | @Callable(i) | |
246 | - | func updateSalePrice (ticketId,price) = { | |
247 | - | let $t077957881 = provideBaseData(i, ticketId) | |
248 | - | let id = $t077957881._1 | |
249 | - | let caller = $t077957881._2 | |
250 | - | let date = $t077957881._3 | |
251 | - | let isValidNFT = $t077957881._4 | |
252 | - | let eventId = $t077957881._5 | |
253 | - | let creatorAddr = $t077957881._6 | |
254 | - | if (!(isValidNFT)) | |
255 | - | then throw("Not a valid ticket") | |
265 | + | func editEvent (eventId,name,description,tags,cidDisplay,crawler,date) = if (!(dappRunning)) | |
266 | + | then throw(maintenanceMSG) | |
267 | + | else { | |
268 | + | let caller = toBase58String(i.caller.bytes) | |
269 | + | let checkUser = validateUser(caller) | |
270 | + | if ((checkUser != "")) | |
271 | + | then throw(checkUser) | |
272 | + | else { | |
273 | + | let validateEvent = validateEventData(caller, cidDisplay, name, description, tags, date) | |
274 | + | if ((validateEvent != "")) | |
275 | + | then throw("Something went wrong!") | |
276 | + | else { | |
277 | + | let entryExist = getStringByKey(keyEventName(caller, eventId)) | |
278 | + | if ((entryExist == "")) | |
279 | + | then throw("Entry not found") | |
280 | + | else { | |
281 | + | let flag = getStringByKey(keyEventFlag(caller, eventId)) | |
282 | + | if ((flag == "ILLEGAL")) | |
283 | + | then throw("Cannot update ILLEGAL Event") | |
284 | + | else [StringEntry(keyEventName(caller, eventId), name), StringEntry(keyEventDate(caller, eventId), date), StringEntry(keyEventDesc(caller, eventId), description), StringEntry(keyEventTags(caller, eventId), tags), StringEntry(keyEventCrawler(caller, eventId), crawler)] | |
285 | + | } | |
286 | + | } | |
287 | + | } | |
288 | + | } | |
289 | + | ||
290 | + | ||
291 | + | ||
292 | + | @Callable(i) | |
293 | + | func deleteEvent (eventId) = { | |
294 | + | let $t01033510379 = idCallerDate(i) | |
295 | + | let id = $t01033510379._1 | |
296 | + | let caller = $t01033510379._2 | |
297 | + | let addedDate = $t01033510379._3 | |
298 | + | let checkUser = validateUser(caller) | |
299 | + | if ((checkUser != "")) | |
300 | + | then throw(checkUser) | |
301 | + | else if (!(isEventOwner(eventId, caller))) | |
302 | + | then throw("You are not the owner of this event") | |
303 | + | else { | |
304 | + | let eventTotalNFT = getIntegerByKey(keyEventTotalTicketsIssued(caller, eventId)) | |
305 | + | if ((eventTotalNFT != 0)) | |
306 | + | then throw("Cannot delete event with already sold tickets") | |
307 | + | else { | |
308 | + | let totalTicketTypeForEvent = getIntegerByKey(keyEventTotalTicketTypes(caller, eventId)) | |
309 | + | if ((totalTicketTypeForEvent > 0)) | |
310 | + | then throw("Delete all tickets first") | |
311 | + | else [DeleteEntry(keyEventAddedDate(caller, eventId)), DeleteEntry(keyEventDate(caller, eventId)), DeleteEntry(keyEventName(caller, eventId)), DeleteEntry(keyEventDesc(caller, eventId)), DeleteEntry(keyEventDisplayCid(caller, eventId)), DeleteEntry(keyEventTags(caller, eventId)), DeleteEntry(keyEventCrawler(caller, eventId)), DeleteEntry(keyEventTotalTicketsIssued(caller, eventId)), DeleteEntry(keyEventCanceled(caller, eventId)), DeleteEntry(keyEventOwnerByEventId(eventId)), DeleteEntry(keyEventTotalTicketTypes(caller, eventId))] | |
312 | + | } | |
313 | + | } | |
314 | + | } | |
315 | + | ||
316 | + | ||
317 | + | ||
318 | + | @Callable(i) | |
319 | + | func cancelEvent (eventId,reason) = { | |
320 | + | let $t01172011764 = idCallerDate(i) | |
321 | + | let id = $t01172011764._1 | |
322 | + | let caller = $t01172011764._2 | |
323 | + | let addedDate = $t01172011764._3 | |
324 | + | let checkUser = validateUser(caller) | |
325 | + | if ((checkUser != "")) | |
326 | + | then throw(checkUser) | |
327 | + | else if (!(isEventOwner(eventId, caller))) | |
328 | + | then throw("You are not the owner of this event") | |
329 | + | else [BooleanEntry(keyEventCanceled(caller, eventId), true), StringEntry(keyEventCanceledReason(caller, eventId), reason)] | |
330 | + | } | |
331 | + | ||
332 | + | ||
333 | + | ||
334 | + | @Callable(i) | |
335 | + | func flagEvent (eventId,addr,flag,note) = { | |
336 | + | let $t01219912232 = idCallerDate(i) | |
337 | + | let id = $t01219912232._1 | |
338 | + | let caller = $t01219912232._2 | |
339 | + | if (containsElement([chris, toString(this)], caller)) | |
340 | + | then if (containsElement(["", "CHANGE_REQUIRED", "FLAGGED", "ILLEGAL"], flag)) | |
341 | + | then [StringEntry(keyEventFlag(addr, eventId), flag), StringEntry(keyEventNote(addr, eventId), note)] | |
342 | + | else throw(("Unknow status " + flag)) | |
343 | + | else throw("You are not allowed") | |
344 | + | } | |
345 | + | ||
346 | + | ||
347 | + | ||
348 | + | @Callable(i) | |
349 | + | func addTicket (eventId,name,description,price,maxAvailable,MaxUse) = { | |
350 | + | let $t01273312773 = idCallerDate(i) | |
351 | + | let id = $t01273312773._1 | |
352 | + | let caller = $t01273312773._2 | |
353 | + | let date = $t01273312773._3 | |
354 | + | let checkUser = validateUser(caller) | |
355 | + | if ((checkUser != "")) | |
356 | + | then throw(checkUser) | |
357 | + | else if (eventIsCanceled(caller, eventId)) | |
358 | + | then throw("Event have been canceled") | |
359 | + | else if (!(isEventOwner(eventId, caller))) | |
360 | + | then throw("You are not the owner of this event") | |
361 | + | else { | |
362 | + | let validateTicket = validateTicketData(eventId, caller, name, description, price, maxAvailable, MaxUse) | |
363 | + | if ((validateTicket != "")) | |
364 | + | then throw("Something went wrong!") | |
365 | + | else { | |
366 | + | let totalTicketTypeForEvent = getIntegerByKey(keyEventTotalTicketTypes(caller, eventId)) | |
367 | + | [StringEntry(keyTicketName(caller, eventId, id), name), IntegerEntry(keyTicketDate(caller, eventId, id), date), StringEntry(keyTicketDesc(caller, eventId, id), description), IntegerEntry(keyTicketPrice(caller, eventId, id), price), IntegerEntry(keyTicketMaxAvailable(caller, eventId, id), maxAvailable), BooleanEntry(keyTicketOnSale(caller, eventId, id), true), IntegerEntry(keyTicketMaxUse(caller, eventId, id), MaxUse), IntegerEntry(keyTicketTotalIssued(caller, eventId, id), 0), IntegerEntry(keyEventTotalTicketTypes(caller, eventId), (totalTicketTypeForEvent + 1))] | |
368 | + | } | |
369 | + | } | |
370 | + | } | |
371 | + | ||
372 | + | ||
373 | + | ||
374 | + | @Callable(i) | |
375 | + | func editTicket (ticketId,eventId,name,description,price,maxAvailable,maxUse) = { | |
376 | + | let $t01428514325 = idCallerDate(i) | |
377 | + | let id = $t01428514325._1 | |
378 | + | let caller = $t01428514325._2 | |
379 | + | let date = $t01428514325._3 | |
380 | + | let checkUser = validateUser(caller) | |
381 | + | if ((checkUser != "")) | |
382 | + | then throw(checkUser) | |
383 | + | else if (!(isEventOwner(eventId, caller))) | |
384 | + | then throw("You are not the owner of this event") | |
385 | + | else if (!(ticketExist(caller, eventId, ticketId))) | |
386 | + | then throw("Ticket not found") | |
387 | + | else { | |
388 | + | let validateTicket = validateTicketData(eventId, caller, name, description, price, maxAvailable, maxUse) | |
389 | + | if ((validateTicket != "")) | |
390 | + | then throw("Something went wrong!") | |
391 | + | else { | |
392 | + | let ticketSold = valueOrElse(getInteger(keyTicketSold(caller, eventId, ticketId)), 0) | |
393 | + | if ((ticketSold > maxAvailable)) | |
394 | + | then throw("Max tickets available cannot be lower than amount already sold") | |
395 | + | else [StringEntry(keyTicketName(caller, eventId, ticketId), name), StringEntry(keyTicketDesc(caller, eventId, ticketId), description), IntegerEntry(keyTicketPrice(caller, eventId, ticketId), price), IntegerEntry(keyTicketMaxAvailable(caller, eventId, ticketId), maxAvailable), IntegerEntry(keyTicketMaxUse(caller, eventId, ticketId), maxUse)] | |
396 | + | } | |
397 | + | } | |
398 | + | } | |
399 | + | ||
400 | + | ||
401 | + | ||
402 | + | @Callable(i) | |
403 | + | func pauseTicketSale (eventId,ticketId,status) = { | |
404 | + | let $t01546315503 = idCallerDate(i) | |
405 | + | let id = $t01546315503._1 | |
406 | + | let caller = $t01546315503._2 | |
407 | + | let date = $t01546315503._3 | |
408 | + | let checkUser = validateUser(caller) | |
409 | + | if ((checkUser != "")) | |
410 | + | then throw(checkUser) | |
411 | + | else if (!(isEventOwner(eventId, caller))) | |
412 | + | then throw("You are not the owner of this event") | |
413 | + | else if (!(ticketExist(caller, eventId, ticketId))) | |
414 | + | then throw("Ticket not found") | |
415 | + | else [BooleanEntry(keyTicketOnSale(caller, eventId, ticketId), status)] | |
416 | + | } | |
417 | + | ||
418 | + | ||
419 | + | ||
420 | + | @Callable(i) | |
421 | + | func deleteTicket (ticketId,eventId) = { | |
422 | + | let $t01596616006 = idCallerDate(i) | |
423 | + | let id = $t01596616006._1 | |
424 | + | let caller = $t01596616006._2 | |
425 | + | let date = $t01596616006._3 | |
426 | + | let checkUser = validateUser(caller) | |
427 | + | if ((checkUser != "")) | |
428 | + | then throw(checkUser) | |
429 | + | else if (!(isEventOwner(eventId, caller))) | |
430 | + | then throw("You are not the owner of this event") | |
431 | + | else if (!(ticketExist(caller, eventId, ticketId))) | |
432 | + | then throw("Ticket not found") | |
433 | + | else { | |
434 | + | let amountSold = getIntegerByKey(keyTicketSold(caller, eventId, ticketId)) | |
435 | + | if ((amountSold != 0)) | |
436 | + | then throw("Cannot delete ticket that sold already") | |
437 | + | else { | |
438 | + | let totalTicketTypeForEvent = getIntegerByKey(keyEventTotalTicketTypes(caller, eventId)) | |
439 | + | [DeleteEntry(keyTicketName(caller, eventId, ticketId)), DeleteEntry(keyTicketDate(caller, eventId, ticketId)), DeleteEntry(keyTicketDesc(caller, eventId, ticketId)), DeleteEntry(keyTicketPrice(caller, eventId, ticketId)), DeleteEntry(keyTicketMaxAvailable(caller, eventId, ticketId)), DeleteEntry(keyTicketOnSale(caller, eventId, ticketId)), DeleteEntry(keyTicketMaxUse(caller, eventId, ticketId)), DeleteEntry(keyTicketTotalIssued(caller, eventId, ticketId)), IntegerEntry(keyEventTotalTicketTypes(caller, eventId), (totalTicketTypeForEvent - 1))] | |
440 | + | } | |
441 | + | } | |
442 | + | } | |
443 | + | ||
444 | + | ||
445 | + | ||
446 | + | @Callable(i) | |
447 | + | func buyTicket (ticketId,eventId,issuer) = { | |
448 | + | let $t01723017268 = idCallerDate(i) | |
449 | + | let id = $t01723017268._1 | |
450 | + | let caller = $t01723017268._2 | |
451 | + | let date = $t01723017268._3 | |
452 | + | let totalNFT = valueOrElse(getIntegerByKey("total_tickets_issued"), 0) | |
453 | + | if (!(isEventOwner(eventId, issuer))) | |
454 | + | then throw("Event ID and Issuer don't match") | |
455 | + | else if (!(ticketExist(issuer, eventId, ticketId))) | |
456 | + | then throw("Ticket not found") | |
457 | + | else { | |
458 | + | let eventName = getStringByKey(keyEventName(issuer, eventId)) | |
459 | + | if ((eventName == "")) | |
460 | + | then throw("Art doesn't exist") | |
461 | + | else if (eventIsCanceled(issuer, eventId)) | |
462 | + | then throw("Event have been canceled") | |
463 | + | else { | |
464 | + | let isOnSale = getBooleanByKey(keyTicketOnSale(issuer, eventId, ticketId)) | |
465 | + | if (!(isOnSale)) | |
466 | + | then throw("Tickets not for sale") | |
467 | + | else { | |
468 | + | let amountSold = getIntegerByKey(keyTicketSold(issuer, eventId, ticketId)) | |
469 | + | let ticketPrice = getIntegerByKey(keyTicketPrice(issuer, eventId, ticketId)) | |
470 | + | let priceAssetId = toBase58String(signAssetId) | |
471 | + | let $t01811418188 = validatePriceAssetId(i, priceAssetId, ticketPrice) | |
472 | + | let amount = $t01811418188._1 | |
473 | + | let assetId = $t01811418188._2 | |
474 | + | let maxCanSell = getIntegerByKey(keyTicketMaxAvailable(issuer, eventId, ticketId)) | |
475 | + | let amountForSign = fraction(amount, signCut, 100) | |
476 | + | let amountForOrganizer = (amount - amountForSign) | |
477 | + | if ((amountSold == maxCanSell)) | |
478 | + | then throw("Art sold out") | |
479 | + | else { | |
480 | + | let newAmountSold = (amountSold + 1) | |
481 | + | let issueMeta = ((((((((((("Organizer: " + issuer) + ", | |
482 | + | EventID: ") + eventId) + ", | |
483 | + | TicketID: ") + ticketId) + ", | |
484 | + | EventName: ") + eventName) + ", | |
485 | + | Issue: ") + toString(newAmountSold)) + "/") + toString(maxCanSell)) | |
486 | + | let issueNFT = Issue(("ST_" + toString((totalNFT + 1))), issueMeta, 1, 0, false) | |
487 | + | let idNFT = calculateAssetId(issueNFT) | |
488 | + | let sellStatus = if ((newAmountSold == maxCanSell)) | |
489 | + | then false | |
490 | + | else true | |
491 | + | let receiveNFT = i.caller | |
492 | + | let soldKey = ((((((((("ticket_sold_" + toString(newAmountSold)) + "_of_") + toString(maxCanSell)) + "_") + eventId) + "_") + issuer) + "_") + ticketId) | |
493 | + | let soldValue = ((((((((toString(receiveNFT) + "_") + toString(date)) + "_") + id) + "_") + toString(amount)) + "_") + toBase58String(idNFT)) | |
494 | + | let soldData = StringEntry(soldKey, soldValue) | |
495 | + | let eventTotalNFT = getIntegerByKey(keyEventTotalTicketsIssued(issuer, eventId)) | |
496 | + | let ticketTotalNFT = getIntegerByKey(keyTicketTotalIssued(issuer, eventId, ticketId)) | |
497 | + | let buyRes = [IntegerEntry(keyTicketSold(issuer, eventId, ticketId), newAmountSold), StringEntry(("nft_" + toBase58String(idNFT)), soldKey), IntegerEntry("total_tickets_issued", (totalNFT + 1)), IntegerEntry(keyEventTotalTicketsIssued(issuer, eventId), (eventTotalNFT + 1)), IntegerEntry(keyTicketTotalIssued(issuer, eventId, ticketId), (ticketTotalNFT + 1)), StringEntry((("ST_" + toString((totalNFT + 1))) + "_assetId"), ((ticketId + "_") + toBase58String(idNFT))), BooleanEntry(keyTicketOnSale(issuer, eventId, ticketId), sellStatus), IntegerEntry(keyTicketAmountUsed(issuer, eventId, ticketId, toBase58String(idNFT)), 0), issueNFT, ScriptTransfer(Address(fromBase58String(issuer)), amountForOrganizer, assetId), ScriptTransfer(receiveNFT, 1, idNFT), ScriptTransfer(Address(fromBase58String(feeReceiver)), amountForSign, assetId)] | |
498 | + | soldData :: buyRes | |
499 | + | } | |
500 | + | } | |
501 | + | } | |
502 | + | } | |
503 | + | } | |
504 | + | ||
505 | + | ||
506 | + | ||
507 | + | @Callable(i) | |
508 | + | func useTicket () = { | |
509 | + | let $t02046120499 = idCallerDate(i) | |
510 | + | let id = $t02046120499._1 | |
511 | + | let caller = $t02046120499._2 | |
512 | + | let date = $t02046120499._3 | |
513 | + | let $t02050520541 = isPayment(i) | |
514 | + | let payment = $t02050520541._1 | |
515 | + | let amount = $t02050520541._2 | |
516 | + | if (!(isDefined(payment.assetId))) | |
517 | + | then throw("Wrong asset attached") | |
256 | 518 | else { | |
257 | - | let | |
258 | - | if (( | |
259 | - | then throw(" | |
519 | + | let eventData = getStringByKey(("nft_" + toBase58String(value(payment.assetId)))) | |
520 | + | if ((size(eventData) == 0)) | |
521 | + | then throw("Something went wrong") | |
260 | 522 | else { | |
261 | - | let saleStatus = getStrByK(((("sale2nd_status_" + caller) + "_") + ticketId)) | |
262 | - | if ((saleStatus != "OPEN")) | |
263 | - | then throw("Sale not active") | |
523 | + | let eventDataArr = split(eventData, "_") | |
524 | + | let issuer = eventDataArr[6] | |
525 | + | let eventId = eventDataArr[5] | |
526 | + | let ticketId = eventDataArr[7] | |
527 | + | if (!(ticketExist(issuer, eventId, ticketId))) | |
528 | + | then throw("Ticket not found") | |
264 | 529 | else { | |
265 | - | let saleKey = getSaleKey(caller, ticketId, eventId, creatorAddr) | |
266 | - | let saleInfo = split(getStrByK((saleKey + "_OPEN")), "_") | |
267 | - | [StringEntry((saleKey + "_OPEN"), ((((((((((((saleInfo[0] + "_") + toString(price)) + "_") + toBase58String(signAssetId)) + "_") + saleInfo[3]) + "_") + saleInfo[4]) + "_") + saleInfo[5]) + "_") + saleInfo[6]))] | |
530 | + | let amountUsed = getIntegerByKey(keyTicketAmountUsed(issuer, eventId, ticketId, toBase58String(value(payment.assetId)))) | |
531 | + | let maxUsingTime = getIntegerByKey(keyTicketMaxUse(issuer, eventId, ticketId)) | |
532 | + | if ((maxUsingTime == amountUsed)) | |
533 | + | then throw((("Ticket used " + toString(amountUsed)) + " times already")) | |
534 | + | else [IntegerEntry(keyTicketAmountUsed(issuer, eventId, ticketId, toBase58String(value(payment.assetId))), (amountUsed + 1)), StringEntry(keyTicketHistoryUsed(issuer, eventId, ticketId, toBase58String(value(payment.assetId)), toString((amountUsed + 1))), ((((((id + "_") + caller) + "_") + toString(date)) + "_") + toString((amountUsed + 1)))), ScriptTransfer(Address(fromBase58String(caller)), 1, payment.assetId)] | |
268 | 535 | } | |
269 | 536 | } | |
270 | 537 | } | |
273 | 540 | ||
274 | 541 | ||
275 | 542 | @Callable(i) | |
276 | - | func cancelSale (ticketId) = { | |
277 | - | let $t087989032 = provideBaseData(i, ticketId) | |
278 | - | let id = $t087989032._1 | |
279 | - | let caller = $t087989032._2 | |
280 | - | let date = $t087989032._3 | |
281 | - | let isValidNFT = $t087989032._4 | |
282 | - | let eventId = $t087989032._5 | |
283 | - | let creatorAddr = $t087989032._6 | |
284 | - | let saleOwner = getStrByK(("current_owner_on_dapp_" + ticketId)) | |
285 | - | if ((saleOwner != caller)) | |
286 | - | then throw("You don't own this ticket") | |
287 | - | else { | |
288 | - | let saleStatus = getStrByK(((("sale2nd_status_" + caller) + "_") + ticketId)) | |
289 | - | if ((saleStatus != "OPEN")) | |
290 | - | then throw("Sale not active") | |
291 | - | else { | |
292 | - | let saleKey = getSaleKey(caller, ticketId, eventId, creatorAddr) | |
293 | - | let saleInfo = getStrByK((saleKey + "_OPEN")) | |
294 | - | [DeleteEntry((saleKey + "_OPEN")), DeleteEntry(((("sale2nd_status_" + caller) + "_") + ticketId)), DeleteEntry(("current_owner_on_dapp_" + ticketId)), StringEntry((((saleKey + "_") + id) + "_CANCELLED"), ((((saleInfo + "_CANCELLED_") + toString(date)) + "_") + id)), ScriptTransfer(Address(fromBase58String(caller)), 1, fromBase58String(ticketId))] | |
295 | - | } | |
296 | - | } | |
297 | - | } | |
298 | - | ||
299 | - | ||
300 | - | ||
301 | - | @Callable(i) | |
302 | - | func buyNFT (ticketId) = { | |
303 | - | let $t0988910004 = provideBaseData(i, ticketId) | |
304 | - | let id = $t0988910004._1 | |
305 | - | let caller = $t0988910004._2 | |
306 | - | let date = $t0988910004._3 | |
307 | - | let isValidNFT = $t0988910004._4 | |
308 | - | let eventId = $t0988910004._5 | |
309 | - | let creatorAddr = $t0988910004._6 | |
310 | - | if (!(isValidNFT)) | |
311 | - | then throw("Not a valid ticket") | |
312 | - | else { | |
313 | - | let saleOwner = getSaleOwnerAndStatus(ticketId) | |
314 | - | let saleKey = getSaleKey(saleOwner, ticketId, eventId, creatorAddr) | |
315 | - | let saleInfo = getStrByK((saleKey + "_OPEN")) | |
316 | - | if ((size(saleInfo) == 0)) | |
317 | - | then throw("Sale Not found!") | |
318 | - | else { | |
319 | - | let saleInfoArray = split(saleInfo, "_") | |
320 | - | if ((parseInt(saleInfoArray[1]) == 0)) | |
321 | - | then throw("Offer only") | |
322 | - | else { | |
323 | - | let $t01041410450 = isPayment(i) | |
324 | - | let payment = $t01041410450._1 | |
325 | - | let amount = $t01041410450._2 | |
326 | - | let paymentAssetStr = if (isDefined(payment.assetId)) | |
327 | - | then toBase58String(value(payment.assetId)) | |
328 | - | else "" | |
329 | - | if (if ((saleInfoArray[1] != toString(amount))) | |
330 | - | then true | |
331 | - | else (saleInfoArray[2] != paymentAssetStr)) | |
332 | - | then throw("Payment infos don't match.") | |
333 | - | else { | |
334 | - | let $t01069410829 = setTransfers(amount, payment.assetId, ticketId, creatorAddr, saleOwner, caller) | |
335 | - | let commissions = $t01069410829._1 | |
336 | - | let creatorFee = $t01069410829._2 | |
337 | - | let ownerFee = $t01069410829._3 | |
338 | - | let collectorNFT = $t01069410829._4 | |
339 | - | ([DeleteEntry((saleKey + "_OPEN")), DeleteEntry(((("sale2nd_status_" + saleOwner) + "_") + ticketId)), DeleteEntry(("current_owner_on_dapp_" + ticketId)), StringEntry((((saleKey + "_") + id) + "_CLOSED"), ((((((saleInfo + "_CLOSED_") + toString(date)) + "_") + id) + "_") + caller)), updateNumSales(), creatorFee, ownerFee, collectorNFT] ++ commissions) | |
340 | - | } | |
341 | - | } | |
342 | - | } | |
343 | - | } | |
344 | - | } | |
345 | - | ||
346 | - | ||
347 | - | ||
348 | - | @Callable(i) | |
349 | - | func setOffer (ticketId) = { | |
350 | - | let $t01124911339 = provideBaseData(i, ticketId) | |
351 | - | let id = $t01124911339._1 | |
352 | - | let offerOwner = $t01124911339._2 | |
353 | - | let date = $t01124911339._3 | |
354 | - | let isValidNFT = $t01124911339._4 | |
355 | - | let eventId = $t01124911339._5 | |
356 | - | let creatorAddr = $t01124911339._6 | |
357 | - | if (!(isValidNFT)) | |
358 | - | then throw("Not a valid ticket") | |
359 | - | else { | |
360 | - | let $t01140311439 = isPayment(i) | |
361 | - | let payment = $t01140311439._1 | |
362 | - | let amount = $t01140311439._2 | |
363 | - | let assetId = toBase58String(value(payment.assetId)) | |
364 | - | if (!(acceptedAssetIds(assetId))) | |
365 | - | then throw("asset not accepted") | |
366 | - | else if ((amount == 0)) | |
367 | - | then throw("Offer of 0 not allowed") | |
368 | - | else { | |
369 | - | let saleOwner = getSaleOwnerAndStatus(ticketId) | |
370 | - | [StringEntry((getBidKey(offerOwner, ticketId, saleOwner, id) + "_OPEN"), ((((((((((((((toString(date) + "_") + toString(amount)) + "_") + assetId) + "_") + ticketId) + "_") + eventId) + "_") + creatorAddr) + "_") + offerOwner) + "_") + id))] | |
371 | - | } | |
372 | - | } | |
373 | - | } | |
374 | - | ||
375 | - | ||
376 | - | ||
377 | - | @Callable(i) | |
378 | - | func acceptOffer (ticketId,offerId,offerOwner) = { | |
379 | - | let $t01211912205 = provideBaseData(i, ticketId) | |
380 | - | let id = $t01211912205._1 | |
381 | - | let caller = $t01211912205._2 | |
382 | - | let date = $t01211912205._3 | |
383 | - | let isValidNFT = $t01211912205._4 | |
384 | - | let eventId = $t01211912205._5 | |
385 | - | let creatorAddr = $t01211912205._6 | |
386 | - | if (!(isValidNFT)) | |
387 | - | then throw("Not a valid ticket") | |
388 | - | else { | |
389 | - | let saleOwner = getSaleOwnerAndStatus(ticketId) | |
390 | - | if ((caller != saleOwner)) | |
391 | - | then throw("Only sale owner can accept offer") | |
392 | - | else { | |
393 | - | let bidKey = getBidKey(offerOwner, ticketId, saleOwner, offerId) | |
394 | - | let $t01246812523 = getBidData(bidKey) | |
395 | - | let bidDataArr = $t01246812523._1 | |
396 | - | let assetId = $t01246812523._2 | |
397 | - | let bidData = $t01246812523._3 | |
398 | - | let saleKey = getSaleKey(saleOwner, ticketId, eventId, creatorAddr) | |
399 | - | let saleInfo = getStrByK((saleKey + "_OPEN")) | |
400 | - | if ((size(saleInfo) == 0)) | |
401 | - | then throw("Sale Not found!") | |
402 | - | else { | |
403 | - | let amount = value(parseInt(bidDataArr[1])) | |
404 | - | let $t01276412898 = setTransfers(amount, assetId, ticketId, creatorAddr, saleOwner, bidDataArr[6]) | |
405 | - | let commissions = $t01276412898._1 | |
406 | - | let creatorFee = $t01276412898._2 | |
407 | - | let ownerFee = $t01276412898._3 | |
408 | - | let collectorNFT = $t01276412898._4 | |
409 | - | let assetIdStr = toBase58String(value(assetId)) | |
410 | - | ([DeleteEntry((saleKey + "_OPEN")), DeleteEntry((bidKey + "_OPEN")), DeleteEntry(((("sale2nd_status_" + saleOwner) + "_") + ticketId)), DeleteEntry(("current_owner_on_dapp_" + ticketId)), StringEntry((bidKey + "_CLOSED"), ((((bidData + "_CLOSED_") + toString(date)) + "_") + id)), StringEntry((((saleKey + "_") + id) + "_CLOSED"), ((((((((((saleInfo + "_CLOSED-OFFER_") + toString(date)) + "_") + id) + "_") + offerOwner) + "_") + toString(amount)) + "_") + assetIdStr)), updateNumSales(), creatorFee, ownerFee, collectorNFT] ++ commissions) | |
411 | - | } | |
412 | - | } | |
413 | - | } | |
414 | - | } | |
415 | - | ||
416 | - | ||
417 | - | ||
418 | - | @Callable(i) | |
419 | - | func cancelOffer (ticketId,offerId,offerOwner,saleOwner) = { | |
420 | - | let $t01366713739 = idCallerDate(i) | |
421 | - | let id = $t01366713739._1 | |
422 | - | let caller = $t01366713739._2 | |
423 | - | let date = $t01366713739._3 | |
424 | - | if (if ((caller != offerOwner)) | |
425 | - | then (caller != saleOwner) | |
426 | - | else false) | |
427 | - | then throw("You cannot cancel this offer.") | |
428 | - | else { | |
429 | - | let bidKey = getBidKey(offerOwner, ticketId, saleOwner, offerId) | |
430 | - | let $t01391413969 = getBidData(bidKey) | |
431 | - | let bidDataArr = $t01391413969._1 | |
432 | - | let assetId = $t01391413969._2 | |
433 | - | let bidData = $t01391413969._3 | |
434 | - | [DeleteEntry((bidKey + "_OPEN")), StringEntry((bidKey + "_CANCELLED"), ((((bidData + "_CANCELLED_") + toString(date)) + "_") + id)), ScriptTransfer(Address(fromBase58String(caller)), parseIntValue(bidDataArr[1]), assetId)] | |
435 | - | } | |
543 | + | func deleteEntry (entry) = { | |
544 | + | let caller = toString(i.caller) | |
545 | + | if ((caller == chris)) | |
546 | + | then [DeleteEntry(entry)] | |
547 | + | else throw("no") | |
436 | 548 | } | |
437 | 549 | ||
438 | 550 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let VERSION = "1.0.0" | |
5 | 5 | ||
6 | - | func | |
6 | + | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
7 | 7 | ||
8 | 8 | ||
9 | - | let | |
9 | + | let userDapp = value(addressFromString(getStringByKey("conf_users_dapp"))) | |
10 | 10 | ||
11 | - | let | |
11 | + | let feeReceiver = getStringByKey("conf_fee_receiver") | |
12 | 12 | ||
13 | - | let | |
13 | + | let signAssetId = fromBase58String(getStringByKey("conf_accepted_asset_SIGN")) | |
14 | 14 | ||
15 | - | let | |
15 | + | let chris = getStringByKey("conf_admin_1") | |
16 | 16 | ||
17 | - | ||
17 | + | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
18 | 18 | ||
19 | - | let signCut = 3 | |
20 | 19 | ||
21 | - | let organizerCut = 10 | |
20 | + | func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false) | |
21 | + | ||
22 | + | ||
23 | + | let dappRunning = valueOrElse(getBoolean(userDapp, "conf_dapp_is_running"), true) | |
24 | + | ||
25 | + | let maintenanceMSG = valueOrElse(getString(userDapp, "conf_maintenance_msg"), "") | |
22 | 26 | ||
23 | 27 | let userSuspended = "SUSPENDED" | |
24 | 28 | ||
25 | - | let | |
29 | + | let userUnregistered = "UNREGISTERED" | |
26 | 30 | ||
27 | - | let eventSuspended = "SUSPENDED" | |
28 | - | ||
29 | - | let dappRunningKey = "conf_dapp_is_running" | |
30 | - | ||
31 | - | let maintenanceMSGKey = "conf_maintenance_msg" | |
32 | - | ||
33 | - | let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true) | |
34 | - | ||
35 | - | let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "") | |
36 | - | ||
37 | - | let numSalesK = "num_sales" | |
38 | - | ||
39 | - | func getUserStrByK (key) = valueOrElse(getString(userDapp, key), "Error") | |
31 | + | func validateCID (cid) = if (contains(cid, "/")) | |
32 | + | then if (if ((76 > size(cid))) | |
33 | + | then (size(split(cid, "/")[0]) == 59) | |
34 | + | else false) | |
35 | + | then (16 > size(split(cid, "/")[1])) | |
36 | + | else false | |
37 | + | else false | |
40 | 38 | ||
41 | 39 | ||
42 | - | func getEventStrByK (key) = valueOrElse(getString(eventsDapp, key), "") | |
40 | + | let signCut = 2 | |
41 | + | ||
42 | + | func keyUserStatus (caller) = ("user_status_" + caller) | |
43 | 43 | ||
44 | 44 | ||
45 | - | func | |
45 | + | func keyEventOwnerByEventId (eventId) = ("get_event_owner_" + eventId) | |
46 | 46 | ||
47 | 47 | ||
48 | - | func | |
48 | + | func keyEventAddedDate (caller,eventId) = ((("event_addedDate_" + eventId) + "_") + caller) | |
49 | 49 | ||
50 | 50 | ||
51 | - | func | |
51 | + | func keyEventDate (caller,eventId) = ((("event_date_" + eventId) + "_") + caller) | |
52 | 52 | ||
53 | 53 | ||
54 | - | func | |
54 | + | func keyEventName (caller,eventId) = ((("event_name_" + eventId) + "_") + caller) | |
55 | 55 | ||
56 | 56 | ||
57 | - | func | |
57 | + | func keyEventDesc (caller,eventId) = ((("event_desc_" + eventId) + "_") + caller) | |
58 | 58 | ||
59 | 59 | ||
60 | - | func getBidKey (offerOwner,ticketId,saleOwner,offerId) = ((((((("offer2nd_" + offerOwner) + "_") + ticketId) + "_") + saleOwner) + "_") + offerId) | |
60 | + | func keyEventDisplayCid (caller,eventId) = ((("event_displayCid_" + eventId) + "_") + caller) | |
61 | + | ||
62 | + | ||
63 | + | func keyEventTags (caller,eventId) = ((("event_tags_" + eventId) + "_") + caller) | |
64 | + | ||
65 | + | ||
66 | + | func keyEventFlag (caller,eventId) = ((("event_flag_" + eventId) + "_") + caller) | |
67 | + | ||
68 | + | ||
69 | + | func keyEventNote (caller,eventId) = ((("event_note_" + eventId) + "_") + caller) | |
70 | + | ||
71 | + | ||
72 | + | func keyEventCrawler (caller,eventId) = ((("event_crawlerCid_" + eventId) + "_") + caller) | |
73 | + | ||
74 | + | ||
75 | + | func keyEventTotalTicketTypes (caller,eventId) = ((("event_totalTicketTypes_" + eventId) + "_") + caller) | |
76 | + | ||
77 | + | ||
78 | + | func keyEventTotalTicketsIssued (caller,eventId) = ((("event_totalIssued_" + eventId) + "_") + caller) | |
79 | + | ||
80 | + | ||
81 | + | func keyEventCanceled (caller,eventId) = ((("event_canceled_" + eventId) + "_") + caller) | |
82 | + | ||
83 | + | ||
84 | + | func keyEventCanceledReason (caller,eventId) = ((("event_canceledReason_" + eventId) + "_") + caller) | |
85 | + | ||
86 | + | ||
87 | + | func keyTicketName (caller,eventId,ticketId) = ((((("ticket_name_" + eventId) + "_") + caller) + "_") + ticketId) | |
88 | + | ||
89 | + | ||
90 | + | func keyTicketDesc (caller,eventId,ticketId) = ((((("ticket_desc_" + eventId) + "_") + caller) + "_") + ticketId) | |
91 | + | ||
92 | + | ||
93 | + | func keyTicketPrice (caller,eventId,ticketId) = ((((("ticket_price_" + eventId) + "_") + caller) + "_") + ticketId) | |
94 | + | ||
95 | + | ||
96 | + | func keyTicketDate (caller,eventId,ticketId) = ((((("ticket_date_" + eventId) + "_") + caller) + "_") + ticketId) | |
97 | + | ||
98 | + | ||
99 | + | func keyTicketMaxAvailable (caller,eventId,ticketId) = ((((("ticket_maxAvailable_" + eventId) + "_") + caller) + "_") + ticketId) | |
100 | + | ||
101 | + | ||
102 | + | func keyTicketSold (caller,eventId,ticketId) = ((((("ticket_sold_" + eventId) + "_") + caller) + "_") + ticketId) | |
103 | + | ||
104 | + | ||
105 | + | func keyTicketOnSale (caller,eventId,ticketId) = ((((("ticket_onSale_" + eventId) + "_") + caller) + "_") + ticketId) | |
106 | + | ||
107 | + | ||
108 | + | func keyTicketAmountUsed (caller,eventId,ticketId,nftId) = ((((((("ticket_amountUsed_" + eventId) + "_") + caller) + "_") + ticketId) + "_") + nftId) | |
109 | + | ||
110 | + | ||
111 | + | func keyTicketHistoryUsed (caller,eventId,ticketId,nftId,usageIndex) = ((((((((("ticket_historyUsed_" + eventId) + "_") + caller) + "_") + ticketId) + "_") + nftId) + "_") + usageIndex) | |
112 | + | ||
113 | + | ||
114 | + | func keyTicketMaxUse (caller,eventId,ticketId) = ((((("ticket_maxUse_" + eventId) + "_") + caller) + "_") + ticketId) | |
115 | + | ||
116 | + | ||
117 | + | func keyTicketTotalIssued (caller,eventId,ticketId) = ((((("ticket_totalIssued_" + eventId) + "_") + caller) + "_") + ticketId) | |
118 | + | ||
119 | + | ||
120 | + | func validateString (str,max) = if ((size(str) == 0)) | |
121 | + | then throw("Field cannot be is empty") | |
122 | + | else if ((size(str) > max)) | |
123 | + | then throw((str + " is too long")) | |
124 | + | else true | |
125 | + | ||
126 | + | ||
127 | + | func validateInt (num) = (0 > num) | |
128 | + | ||
129 | + | ||
130 | + | func getEventOwnerByEventId (eventId) = valueOrElse(getString(this, keyEventOwnerByEventId(eventId)), "") | |
131 | + | ||
132 | + | ||
133 | + | func validateUser (caller) = { | |
134 | + | let userStatus = valueOrElse(getString(userDapp, keyUserStatus(caller)), userUnregistered) | |
135 | + | if ((userStatus == userUnregistered)) | |
136 | + | then "Register this account first with \"Account\" tab" | |
137 | + | else if ((userStatus == userSuspended)) | |
138 | + | then "Account suspended" | |
139 | + | else "" | |
140 | + | } | |
141 | + | ||
142 | + | ||
143 | + | func validateEventData (caller,cidDisplay,name,description,tags,date) = { | |
144 | + | let checkUser = validateUser(caller) | |
145 | + | if ((checkUser != "")) | |
146 | + | then throw(checkUser) | |
147 | + | else if ((size(cidDisplay) == 0)) | |
148 | + | then throw("Display CID cannot be empty") | |
149 | + | else if (!(validateCID(cidDisplay))) | |
150 | + | then throw("Problem with CID") | |
151 | + | else if (!(validateString(name, 300))) | |
152 | + | then throw("300 Char. max name") | |
153 | + | else if (!(validateString(description, 3000))) | |
154 | + | then throw("3000 Char. max description") | |
155 | + | else if (!(validateString(date, 1000))) | |
156 | + | then throw("1000 Char. max date") | |
157 | + | else if ((size(split(tags, ",")) > 5)) | |
158 | + | then throw("5 tags max.") | |
159 | + | else "" | |
160 | + | } | |
161 | + | ||
162 | + | ||
163 | + | func validateTicketData (eventId,caller,name,description,price,maxAvailable,maxUse) = { | |
164 | + | let checkUser = validateUser(caller) | |
165 | + | if ((checkUser != "")) | |
166 | + | then throw(checkUser) | |
167 | + | else if (!(validateString(name, 200))) | |
168 | + | then throw("100 Char. max name") | |
169 | + | else if (!(validateString(description, 1000))) | |
170 | + | then throw("1000 Char. max description") | |
171 | + | else if (if (if (validateInt(price)) | |
172 | + | then true | |
173 | + | else validateInt(maxUse)) | |
174 | + | then true | |
175 | + | else validateInt(maxAvailable)) | |
176 | + | then throw("Positive amount only") | |
177 | + | else if (!(validateString(description, 1000))) | |
178 | + | then throw("1000 Char. max description") | |
179 | + | else "" | |
180 | + | } | |
61 | 181 | ||
62 | 182 | ||
63 | 183 | func idCallerDate (i) = if (!(dappRunning)) | |
64 | 184 | then throw(maintenanceMSG) | |
65 | 185 | else $Tuple3(toBase58String(i.transactionId), toBase58String(i.caller.bytes), lastBlock.timestamp) | |
66 | 186 | ||
67 | 187 | ||
68 | 188 | func isPayment (i) = if ((size(i.payments) == 0)) | |
69 | 189 | then throw("No payment attached") | |
70 | 190 | else { | |
71 | 191 | let payment = value(i.payments[0]) | |
72 | 192 | let amount = value(payment.amount) | |
73 | 193 | $Tuple2(payment, amount) | |
74 | 194 | } | |
75 | 195 | ||
76 | 196 | ||
77 | - | func assetIsValid (assetDetails) = if (if (if ((assetDetails.quantity == 1)) | |
78 | - | then (assetDetails.decimals == 0) | |
79 | - | else false) | |
80 | - | then (assetDetails.reissuable == false) | |
81 | - | else false) | |
82 | - | then (assetDetails.issuer == eventsDapp) | |
83 | - | else false | |
84 | - | ||
85 | - | ||
86 | - | func isSignEventNFT (id) = { | |
87 | - | let assetDetails = value(assetInfo(id)) | |
88 | - | assetIsValid(assetDetails) | |
89 | - | } | |
90 | - | ||
91 | - | ||
92 | - | func acceptedAssetIds (assetId) = if ((assetId != toBase58String(signAssetId))) | |
93 | - | then false | |
94 | - | else true | |
95 | - | ||
96 | - | ||
97 | - | func getBidAssetId (assetId) = fromBase58String(assetId) | |
98 | - | ||
99 | - | ||
100 | - | func getSaleOwnerAndStatus (ticketId) = { | |
101 | - | let saleOwner = getStrByK(("current_owner_on_dapp_" + ticketId)) | |
102 | - | if ((size(saleOwner) == 0)) | |
103 | - | then throw("Ticket not found") | |
197 | + | func validatePriceAssetId (i,priceAssetId,artworkPrice) = { | |
198 | + | let $t067016737 = isPayment(i) | |
199 | + | let payment = $t067016737._1 | |
200 | + | let amount = $t067016737._2 | |
201 | + | if (!(isDefined(payment.assetId))) | |
202 | + | then throw("Wrong asset attached") | |
104 | 203 | else { | |
105 | - | let saleStatus = getStrByK(((("sale2nd_status_" + saleOwner) + "_") + ticketId)) | |
106 | - | if ((saleStatus != "OPEN")) | |
107 | - | then throw("Ticket not for sale") | |
108 | - | else saleOwner | |
204 | + | let assetId = if (if ((size(priceAssetId) > 0)) | |
205 | + | then (toBase58String(value(payment.assetId)) == priceAssetId) | |
206 | + | else false) | |
207 | + | then payment.assetId | |
208 | + | else throw("Wrong asset attached") | |
209 | + | if ((artworkPrice != amount)) | |
210 | + | then throw("Payment amount don't match") | |
211 | + | else $Tuple2(amount, assetId) | |
109 | 212 | } | |
110 | 213 | } | |
111 | 214 | ||
112 | 215 | ||
113 | - | func getBidData (key) = { | |
114 | - | let bidData = getStrByK((key + "_OPEN")) | |
115 | - | if ((bidData == "")) | |
116 | - | then throw("Offer not found") | |
117 | - | else { | |
118 | - | let bidDataArr = split(bidData, "_") | |
119 | - | let assetId = getBidAssetId(bidDataArr[2]) | |
120 | - | $Tuple3(bidDataArr, assetId, bidData) | |
121 | - | } | |
216 | + | func isEventOwner (eventId,caller) = { | |
217 | + | let eventOwner = getEventOwnerByEventId(eventId) | |
218 | + | if ((eventOwner == "")) | |
219 | + | then throw("Event not found") | |
220 | + | else (eventOwner == caller) | |
122 | 221 | } | |
123 | 222 | ||
124 | 223 | ||
125 | - | func eventIsValid (eventStatus) = if ((eventStatus != eventIllegal)) | |
126 | - | then (eventStatus != eventSuspended) | |
127 | - | else false | |
128 | - | ||
129 | - | ||
130 | - | func checkEventStatus (addr,id) = { | |
131 | - | let eventStatus = getEventStrByK(keyFlag(addr, id)) | |
132 | - | if (eventIsValid(eventStatus)) | |
133 | - | then true | |
134 | - | else throw(("Original event flagged as " + eventStatus)) | |
224 | + | func ticketExist (caller,eventId,ticketId) = { | |
225 | + | let ticket = getStringByKey(keyTicketName(caller, eventId, ticketId)) | |
226 | + | (size(ticket) != 0) | |
135 | 227 | } | |
136 | 228 | ||
137 | 229 | ||
138 | - | func checkOrganizerStatus (addr) = { | |
139 | - | let organizerStatus = getUserStrByK(keyUserStatus(addr)) | |
140 | - | if (containsElement([userSuspended], organizerStatus)) | |
141 | - | then throw(("Original organizer " + organizerStatus)) | |
142 | - | else true | |
143 | - | } | |
144 | - | ||
145 | - | ||
146 | - | func checkNFTInfo (assetId) = { | |
147 | - | let nftData = split(getEventStrByK(keyNFTData(assetId)), "_") | |
148 | - | if (if (!(checkEventStatus(nftData[6], nftData[5]))) | |
149 | - | then !(checkOrganizerStatus(nftData[6])) | |
150 | - | else false) | |
151 | - | then $Tuple3(false, nftData[5], nftData[6]) | |
152 | - | else $Tuple3(true, nftData[5], nftData[6]) | |
153 | - | } | |
154 | - | ||
155 | - | ||
156 | - | func checkEVENTExist (artId,creatorAddr) = if (if (!(checkEventStatus(creatorAddr, artId))) | |
157 | - | then !(checkOrganizerStatus(creatorAddr)) | |
158 | - | else false) | |
159 | - | then false | |
160 | - | else true | |
161 | - | ||
162 | - | ||
163 | - | func setTransfers (amount,assetId,ticketId,organizerAddr,saleOwner,caller) = { | |
164 | - | let amountForSign = fraction(amount, signCut, 100) | |
165 | - | let amountForOrganizer = fraction(amount, organizerCut, 100) | |
166 | - | let amountForOwner = (amount - (amountForSign + amountForOrganizer)) | |
167 | - | let commissions = [ScriptTransfer(Address(fromBase58String(feeReceiver)), amountForSign, assetId)] | |
168 | - | let organizerFee = ScriptTransfer(Address(fromBase58String(organizerAddr)), amountForOrganizer, assetId) | |
169 | - | let ownerFee = ScriptTransfer(Address(fromBase58String(saleOwner)), amountForOwner, assetId) | |
170 | - | let collectorNFT = ScriptTransfer(Address(fromBase58String(caller)), 1, fromBase58String(ticketId)) | |
171 | - | $Tuple4(commissions, organizerFee, ownerFee, collectorNFT) | |
172 | - | } | |
173 | - | ||
174 | - | ||
175 | - | func provideBaseData (i,ticketId) = { | |
176 | - | let $t057605799 = idCallerDate(i) | |
177 | - | let id = $t057605799._1 | |
178 | - | let caller = $t057605799._2 | |
179 | - | let date = $t057605799._3 | |
180 | - | let $t058025863 = checkNFTInfo(ticketId) | |
181 | - | let isValidNFT = $t058025863._1 | |
182 | - | let artId = $t058025863._2 | |
183 | - | let creatorAddr = $t058025863._3 | |
184 | - | $Tuple6(id, caller, date, isValidNFT, artId, creatorAddr) | |
185 | - | } | |
186 | - | ||
187 | - | ||
188 | - | func updateNumSales () = { | |
189 | - | let numSales = getIntByK(numSalesK) | |
190 | - | IntegerEntry(numSalesK, (numSales + 1)) | |
191 | - | } | |
230 | + | func eventIsCanceled (issuer,eventId) = getBooleanByKey(keyEventCanceled(issuer, eventId)) | |
192 | 231 | ||
193 | 232 | ||
194 | 233 | @Callable(invoke) | |
195 | 234 | func setConf (key,val) = { | |
196 | 235 | let caller = toString(invoke.caller) | |
197 | 236 | if (containsElement([chris, toString(this)], caller)) | |
198 | 237 | then if (contains(key, "conf_")) | |
199 | 238 | then [StringEntry(key, val)] | |
200 | 239 | else throw("Entries starting with conf_ only") | |
201 | 240 | else throw("You are not allowed to change this") | |
202 | 241 | } | |
203 | 242 | ||
204 | 243 | ||
205 | 244 | ||
206 | - | @Callable(invoke) | |
207 | - | func appRunning (isLive,message) = { | |
208 | - | let caller = toString(invoke.caller) | |
209 | - | let id = toBase58String(invoke.transactionId) | |
210 | - | if (containsElement([chris, toString(this)], caller)) | |
211 | - | then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)] | |
212 | - | else throw("You are not allowed to change this") | |
213 | - | } | |
214 | - | ||
215 | - | ||
216 | - | ||
217 | 245 | @Callable(i) | |
218 | - | func sellNFT (price) = { | |
219 | - | let $t069026938 = isPayment(i) | |
220 | - | let payment = $t069026938._1 | |
221 | - | let amount = $t069026938._2 | |
222 | - | if ((amount != 1)) | |
223 | - | then throw("No Ticket attached") | |
246 | + | func addEvent (name,description,tags,cidDisplay,crawler,date) = { | |
247 | + | let $t080668115 = idCallerDate(i) | |
248 | + | let eventId = $t080668115._1 | |
249 | + | let caller = $t080668115._2 | |
250 | + | let addedDate = $t080668115._3 | |
251 | + | let checkUser = validateUser(caller) | |
252 | + | if ((checkUser != "")) | |
253 | + | then throw(checkUser) | |
224 | 254 | else { | |
225 | - | let ticketId = if (if (isDefined(payment.assetId)) | |
226 | - | then isSignEventNFT(value(payment.assetId)) | |
227 | - | else false) | |
228 | - | then toBase58String(value(payment.assetId)) | |
229 | - | else throw("Only SIGN Event NFT accepted.") | |
230 | - | let $t071827268 = provideBaseData(i, ticketId) | |
231 | - | let id = $t071827268._1 | |
232 | - | let caller = $t071827268._2 | |
233 | - | let date = $t071827268._3 | |
234 | - | let isValidNFT = $t071827268._4 | |
235 | - | let eventId = $t071827268._5 | |
236 | - | let creatorAddr = $t071827268._6 | |
237 | - | if (!(isValidNFT)) | |
238 | - | then throw("Not a valid ticket") | |
239 | - | else [StringEntry((getSaleKey(caller, ticketId, eventId, creatorAddr) + "_OPEN"), ((((((((((((toString(date) + "_") + toString(price)) + "_") + toBase58String(signAssetId)) + "_") + ticketId) + "_") + eventId) + "_") + creatorAddr) + "_") + id)), StringEntry(((("sale2nd_status_" + caller) + "_") + ticketId), "OPEN"), StringEntry(("current_owner_on_dapp_" + ticketId), caller)] | |
255 | + | let validateEvent = validateEventData(caller, cidDisplay, name, description, tags, date) | |
256 | + | if ((validateEvent != "")) | |
257 | + | then throw("Something went wrong!") | |
258 | + | else [IntegerEntry(keyEventAddedDate(caller, eventId), addedDate), StringEntry(keyEventDate(caller, eventId), date), StringEntry(keyEventName(caller, eventId), name), StringEntry(keyEventDesc(caller, eventId), description), StringEntry(keyEventDisplayCid(caller, eventId), cidDisplay), StringEntry(keyEventTags(caller, eventId), tags), StringEntry(keyEventCrawler(caller, eventId), crawler), IntegerEntry(keyEventTotalTicketsIssued(caller, eventId), 0), BooleanEntry(keyEventCanceled(caller, eventId), false), StringEntry(keyEventOwnerByEventId(eventId), caller)] | |
240 | 259 | } | |
241 | 260 | } | |
242 | 261 | ||
243 | 262 | ||
244 | 263 | ||
245 | 264 | @Callable(i) | |
246 | - | func updateSalePrice (ticketId,price) = { | |
247 | - | let $t077957881 = provideBaseData(i, ticketId) | |
248 | - | let id = $t077957881._1 | |
249 | - | let caller = $t077957881._2 | |
250 | - | let date = $t077957881._3 | |
251 | - | let isValidNFT = $t077957881._4 | |
252 | - | let eventId = $t077957881._5 | |
253 | - | let creatorAddr = $t077957881._6 | |
254 | - | if (!(isValidNFT)) | |
255 | - | then throw("Not a valid ticket") | |
265 | + | func editEvent (eventId,name,description,tags,cidDisplay,crawler,date) = if (!(dappRunning)) | |
266 | + | then throw(maintenanceMSG) | |
267 | + | else { | |
268 | + | let caller = toBase58String(i.caller.bytes) | |
269 | + | let checkUser = validateUser(caller) | |
270 | + | if ((checkUser != "")) | |
271 | + | then throw(checkUser) | |
272 | + | else { | |
273 | + | let validateEvent = validateEventData(caller, cidDisplay, name, description, tags, date) | |
274 | + | if ((validateEvent != "")) | |
275 | + | then throw("Something went wrong!") | |
276 | + | else { | |
277 | + | let entryExist = getStringByKey(keyEventName(caller, eventId)) | |
278 | + | if ((entryExist == "")) | |
279 | + | then throw("Entry not found") | |
280 | + | else { | |
281 | + | let flag = getStringByKey(keyEventFlag(caller, eventId)) | |
282 | + | if ((flag == "ILLEGAL")) | |
283 | + | then throw("Cannot update ILLEGAL Event") | |
284 | + | else [StringEntry(keyEventName(caller, eventId), name), StringEntry(keyEventDate(caller, eventId), date), StringEntry(keyEventDesc(caller, eventId), description), StringEntry(keyEventTags(caller, eventId), tags), StringEntry(keyEventCrawler(caller, eventId), crawler)] | |
285 | + | } | |
286 | + | } | |
287 | + | } | |
288 | + | } | |
289 | + | ||
290 | + | ||
291 | + | ||
292 | + | @Callable(i) | |
293 | + | func deleteEvent (eventId) = { | |
294 | + | let $t01033510379 = idCallerDate(i) | |
295 | + | let id = $t01033510379._1 | |
296 | + | let caller = $t01033510379._2 | |
297 | + | let addedDate = $t01033510379._3 | |
298 | + | let checkUser = validateUser(caller) | |
299 | + | if ((checkUser != "")) | |
300 | + | then throw(checkUser) | |
301 | + | else if (!(isEventOwner(eventId, caller))) | |
302 | + | then throw("You are not the owner of this event") | |
303 | + | else { | |
304 | + | let eventTotalNFT = getIntegerByKey(keyEventTotalTicketsIssued(caller, eventId)) | |
305 | + | if ((eventTotalNFT != 0)) | |
306 | + | then throw("Cannot delete event with already sold tickets") | |
307 | + | else { | |
308 | + | let totalTicketTypeForEvent = getIntegerByKey(keyEventTotalTicketTypes(caller, eventId)) | |
309 | + | if ((totalTicketTypeForEvent > 0)) | |
310 | + | then throw("Delete all tickets first") | |
311 | + | else [DeleteEntry(keyEventAddedDate(caller, eventId)), DeleteEntry(keyEventDate(caller, eventId)), DeleteEntry(keyEventName(caller, eventId)), DeleteEntry(keyEventDesc(caller, eventId)), DeleteEntry(keyEventDisplayCid(caller, eventId)), DeleteEntry(keyEventTags(caller, eventId)), DeleteEntry(keyEventCrawler(caller, eventId)), DeleteEntry(keyEventTotalTicketsIssued(caller, eventId)), DeleteEntry(keyEventCanceled(caller, eventId)), DeleteEntry(keyEventOwnerByEventId(eventId)), DeleteEntry(keyEventTotalTicketTypes(caller, eventId))] | |
312 | + | } | |
313 | + | } | |
314 | + | } | |
315 | + | ||
316 | + | ||
317 | + | ||
318 | + | @Callable(i) | |
319 | + | func cancelEvent (eventId,reason) = { | |
320 | + | let $t01172011764 = idCallerDate(i) | |
321 | + | let id = $t01172011764._1 | |
322 | + | let caller = $t01172011764._2 | |
323 | + | let addedDate = $t01172011764._3 | |
324 | + | let checkUser = validateUser(caller) | |
325 | + | if ((checkUser != "")) | |
326 | + | then throw(checkUser) | |
327 | + | else if (!(isEventOwner(eventId, caller))) | |
328 | + | then throw("You are not the owner of this event") | |
329 | + | else [BooleanEntry(keyEventCanceled(caller, eventId), true), StringEntry(keyEventCanceledReason(caller, eventId), reason)] | |
330 | + | } | |
331 | + | ||
332 | + | ||
333 | + | ||
334 | + | @Callable(i) | |
335 | + | func flagEvent (eventId,addr,flag,note) = { | |
336 | + | let $t01219912232 = idCallerDate(i) | |
337 | + | let id = $t01219912232._1 | |
338 | + | let caller = $t01219912232._2 | |
339 | + | if (containsElement([chris, toString(this)], caller)) | |
340 | + | then if (containsElement(["", "CHANGE_REQUIRED", "FLAGGED", "ILLEGAL"], flag)) | |
341 | + | then [StringEntry(keyEventFlag(addr, eventId), flag), StringEntry(keyEventNote(addr, eventId), note)] | |
342 | + | else throw(("Unknow status " + flag)) | |
343 | + | else throw("You are not allowed") | |
344 | + | } | |
345 | + | ||
346 | + | ||
347 | + | ||
348 | + | @Callable(i) | |
349 | + | func addTicket (eventId,name,description,price,maxAvailable,MaxUse) = { | |
350 | + | let $t01273312773 = idCallerDate(i) | |
351 | + | let id = $t01273312773._1 | |
352 | + | let caller = $t01273312773._2 | |
353 | + | let date = $t01273312773._3 | |
354 | + | let checkUser = validateUser(caller) | |
355 | + | if ((checkUser != "")) | |
356 | + | then throw(checkUser) | |
357 | + | else if (eventIsCanceled(caller, eventId)) | |
358 | + | then throw("Event have been canceled") | |
359 | + | else if (!(isEventOwner(eventId, caller))) | |
360 | + | then throw("You are not the owner of this event") | |
361 | + | else { | |
362 | + | let validateTicket = validateTicketData(eventId, caller, name, description, price, maxAvailable, MaxUse) | |
363 | + | if ((validateTicket != "")) | |
364 | + | then throw("Something went wrong!") | |
365 | + | else { | |
366 | + | let totalTicketTypeForEvent = getIntegerByKey(keyEventTotalTicketTypes(caller, eventId)) | |
367 | + | [StringEntry(keyTicketName(caller, eventId, id), name), IntegerEntry(keyTicketDate(caller, eventId, id), date), StringEntry(keyTicketDesc(caller, eventId, id), description), IntegerEntry(keyTicketPrice(caller, eventId, id), price), IntegerEntry(keyTicketMaxAvailable(caller, eventId, id), maxAvailable), BooleanEntry(keyTicketOnSale(caller, eventId, id), true), IntegerEntry(keyTicketMaxUse(caller, eventId, id), MaxUse), IntegerEntry(keyTicketTotalIssued(caller, eventId, id), 0), IntegerEntry(keyEventTotalTicketTypes(caller, eventId), (totalTicketTypeForEvent + 1))] | |
368 | + | } | |
369 | + | } | |
370 | + | } | |
371 | + | ||
372 | + | ||
373 | + | ||
374 | + | @Callable(i) | |
375 | + | func editTicket (ticketId,eventId,name,description,price,maxAvailable,maxUse) = { | |
376 | + | let $t01428514325 = idCallerDate(i) | |
377 | + | let id = $t01428514325._1 | |
378 | + | let caller = $t01428514325._2 | |
379 | + | let date = $t01428514325._3 | |
380 | + | let checkUser = validateUser(caller) | |
381 | + | if ((checkUser != "")) | |
382 | + | then throw(checkUser) | |
383 | + | else if (!(isEventOwner(eventId, caller))) | |
384 | + | then throw("You are not the owner of this event") | |
385 | + | else if (!(ticketExist(caller, eventId, ticketId))) | |
386 | + | then throw("Ticket not found") | |
387 | + | else { | |
388 | + | let validateTicket = validateTicketData(eventId, caller, name, description, price, maxAvailable, maxUse) | |
389 | + | if ((validateTicket != "")) | |
390 | + | then throw("Something went wrong!") | |
391 | + | else { | |
392 | + | let ticketSold = valueOrElse(getInteger(keyTicketSold(caller, eventId, ticketId)), 0) | |
393 | + | if ((ticketSold > maxAvailable)) | |
394 | + | then throw("Max tickets available cannot be lower than amount already sold") | |
395 | + | else [StringEntry(keyTicketName(caller, eventId, ticketId), name), StringEntry(keyTicketDesc(caller, eventId, ticketId), description), IntegerEntry(keyTicketPrice(caller, eventId, ticketId), price), IntegerEntry(keyTicketMaxAvailable(caller, eventId, ticketId), maxAvailable), IntegerEntry(keyTicketMaxUse(caller, eventId, ticketId), maxUse)] | |
396 | + | } | |
397 | + | } | |
398 | + | } | |
399 | + | ||
400 | + | ||
401 | + | ||
402 | + | @Callable(i) | |
403 | + | func pauseTicketSale (eventId,ticketId,status) = { | |
404 | + | let $t01546315503 = idCallerDate(i) | |
405 | + | let id = $t01546315503._1 | |
406 | + | let caller = $t01546315503._2 | |
407 | + | let date = $t01546315503._3 | |
408 | + | let checkUser = validateUser(caller) | |
409 | + | if ((checkUser != "")) | |
410 | + | then throw(checkUser) | |
411 | + | else if (!(isEventOwner(eventId, caller))) | |
412 | + | then throw("You are not the owner of this event") | |
413 | + | else if (!(ticketExist(caller, eventId, ticketId))) | |
414 | + | then throw("Ticket not found") | |
415 | + | else [BooleanEntry(keyTicketOnSale(caller, eventId, ticketId), status)] | |
416 | + | } | |
417 | + | ||
418 | + | ||
419 | + | ||
420 | + | @Callable(i) | |
421 | + | func deleteTicket (ticketId,eventId) = { | |
422 | + | let $t01596616006 = idCallerDate(i) | |
423 | + | let id = $t01596616006._1 | |
424 | + | let caller = $t01596616006._2 | |
425 | + | let date = $t01596616006._3 | |
426 | + | let checkUser = validateUser(caller) | |
427 | + | if ((checkUser != "")) | |
428 | + | then throw(checkUser) | |
429 | + | else if (!(isEventOwner(eventId, caller))) | |
430 | + | then throw("You are not the owner of this event") | |
431 | + | else if (!(ticketExist(caller, eventId, ticketId))) | |
432 | + | then throw("Ticket not found") | |
433 | + | else { | |
434 | + | let amountSold = getIntegerByKey(keyTicketSold(caller, eventId, ticketId)) | |
435 | + | if ((amountSold != 0)) | |
436 | + | then throw("Cannot delete ticket that sold already") | |
437 | + | else { | |
438 | + | let totalTicketTypeForEvent = getIntegerByKey(keyEventTotalTicketTypes(caller, eventId)) | |
439 | + | [DeleteEntry(keyTicketName(caller, eventId, ticketId)), DeleteEntry(keyTicketDate(caller, eventId, ticketId)), DeleteEntry(keyTicketDesc(caller, eventId, ticketId)), DeleteEntry(keyTicketPrice(caller, eventId, ticketId)), DeleteEntry(keyTicketMaxAvailable(caller, eventId, ticketId)), DeleteEntry(keyTicketOnSale(caller, eventId, ticketId)), DeleteEntry(keyTicketMaxUse(caller, eventId, ticketId)), DeleteEntry(keyTicketTotalIssued(caller, eventId, ticketId)), IntegerEntry(keyEventTotalTicketTypes(caller, eventId), (totalTicketTypeForEvent - 1))] | |
440 | + | } | |
441 | + | } | |
442 | + | } | |
443 | + | ||
444 | + | ||
445 | + | ||
446 | + | @Callable(i) | |
447 | + | func buyTicket (ticketId,eventId,issuer) = { | |
448 | + | let $t01723017268 = idCallerDate(i) | |
449 | + | let id = $t01723017268._1 | |
450 | + | let caller = $t01723017268._2 | |
451 | + | let date = $t01723017268._3 | |
452 | + | let totalNFT = valueOrElse(getIntegerByKey("total_tickets_issued"), 0) | |
453 | + | if (!(isEventOwner(eventId, issuer))) | |
454 | + | then throw("Event ID and Issuer don't match") | |
455 | + | else if (!(ticketExist(issuer, eventId, ticketId))) | |
456 | + | then throw("Ticket not found") | |
457 | + | else { | |
458 | + | let eventName = getStringByKey(keyEventName(issuer, eventId)) | |
459 | + | if ((eventName == "")) | |
460 | + | then throw("Art doesn't exist") | |
461 | + | else if (eventIsCanceled(issuer, eventId)) | |
462 | + | then throw("Event have been canceled") | |
463 | + | else { | |
464 | + | let isOnSale = getBooleanByKey(keyTicketOnSale(issuer, eventId, ticketId)) | |
465 | + | if (!(isOnSale)) | |
466 | + | then throw("Tickets not for sale") | |
467 | + | else { | |
468 | + | let amountSold = getIntegerByKey(keyTicketSold(issuer, eventId, ticketId)) | |
469 | + | let ticketPrice = getIntegerByKey(keyTicketPrice(issuer, eventId, ticketId)) | |
470 | + | let priceAssetId = toBase58String(signAssetId) | |
471 | + | let $t01811418188 = validatePriceAssetId(i, priceAssetId, ticketPrice) | |
472 | + | let amount = $t01811418188._1 | |
473 | + | let assetId = $t01811418188._2 | |
474 | + | let maxCanSell = getIntegerByKey(keyTicketMaxAvailable(issuer, eventId, ticketId)) | |
475 | + | let amountForSign = fraction(amount, signCut, 100) | |
476 | + | let amountForOrganizer = (amount - amountForSign) | |
477 | + | if ((amountSold == maxCanSell)) | |
478 | + | then throw("Art sold out") | |
479 | + | else { | |
480 | + | let newAmountSold = (amountSold + 1) | |
481 | + | let issueMeta = ((((((((((("Organizer: " + issuer) + ", | |
482 | + | EventID: ") + eventId) + ", | |
483 | + | TicketID: ") + ticketId) + ", | |
484 | + | EventName: ") + eventName) + ", | |
485 | + | Issue: ") + toString(newAmountSold)) + "/") + toString(maxCanSell)) | |
486 | + | let issueNFT = Issue(("ST_" + toString((totalNFT + 1))), issueMeta, 1, 0, false) | |
487 | + | let idNFT = calculateAssetId(issueNFT) | |
488 | + | let sellStatus = if ((newAmountSold == maxCanSell)) | |
489 | + | then false | |
490 | + | else true | |
491 | + | let receiveNFT = i.caller | |
492 | + | let soldKey = ((((((((("ticket_sold_" + toString(newAmountSold)) + "_of_") + toString(maxCanSell)) + "_") + eventId) + "_") + issuer) + "_") + ticketId) | |
493 | + | let soldValue = ((((((((toString(receiveNFT) + "_") + toString(date)) + "_") + id) + "_") + toString(amount)) + "_") + toBase58String(idNFT)) | |
494 | + | let soldData = StringEntry(soldKey, soldValue) | |
495 | + | let eventTotalNFT = getIntegerByKey(keyEventTotalTicketsIssued(issuer, eventId)) | |
496 | + | let ticketTotalNFT = getIntegerByKey(keyTicketTotalIssued(issuer, eventId, ticketId)) | |
497 | + | let buyRes = [IntegerEntry(keyTicketSold(issuer, eventId, ticketId), newAmountSold), StringEntry(("nft_" + toBase58String(idNFT)), soldKey), IntegerEntry("total_tickets_issued", (totalNFT + 1)), IntegerEntry(keyEventTotalTicketsIssued(issuer, eventId), (eventTotalNFT + 1)), IntegerEntry(keyTicketTotalIssued(issuer, eventId, ticketId), (ticketTotalNFT + 1)), StringEntry((("ST_" + toString((totalNFT + 1))) + "_assetId"), ((ticketId + "_") + toBase58String(idNFT))), BooleanEntry(keyTicketOnSale(issuer, eventId, ticketId), sellStatus), IntegerEntry(keyTicketAmountUsed(issuer, eventId, ticketId, toBase58String(idNFT)), 0), issueNFT, ScriptTransfer(Address(fromBase58String(issuer)), amountForOrganizer, assetId), ScriptTransfer(receiveNFT, 1, idNFT), ScriptTransfer(Address(fromBase58String(feeReceiver)), amountForSign, assetId)] | |
498 | + | soldData :: buyRes | |
499 | + | } | |
500 | + | } | |
501 | + | } | |
502 | + | } | |
503 | + | } | |
504 | + | ||
505 | + | ||
506 | + | ||
507 | + | @Callable(i) | |
508 | + | func useTicket () = { | |
509 | + | let $t02046120499 = idCallerDate(i) | |
510 | + | let id = $t02046120499._1 | |
511 | + | let caller = $t02046120499._2 | |
512 | + | let date = $t02046120499._3 | |
513 | + | let $t02050520541 = isPayment(i) | |
514 | + | let payment = $t02050520541._1 | |
515 | + | let amount = $t02050520541._2 | |
516 | + | if (!(isDefined(payment.assetId))) | |
517 | + | then throw("Wrong asset attached") | |
256 | 518 | else { | |
257 | - | let | |
258 | - | if (( | |
259 | - | then throw(" | |
519 | + | let eventData = getStringByKey(("nft_" + toBase58String(value(payment.assetId)))) | |
520 | + | if ((size(eventData) == 0)) | |
521 | + | then throw("Something went wrong") | |
260 | 522 | else { | |
261 | - | let saleStatus = getStrByK(((("sale2nd_status_" + caller) + "_") + ticketId)) | |
262 | - | if ((saleStatus != "OPEN")) | |
263 | - | then throw("Sale not active") | |
523 | + | let eventDataArr = split(eventData, "_") | |
524 | + | let issuer = eventDataArr[6] | |
525 | + | let eventId = eventDataArr[5] | |
526 | + | let ticketId = eventDataArr[7] | |
527 | + | if (!(ticketExist(issuer, eventId, ticketId))) | |
528 | + | then throw("Ticket not found") | |
264 | 529 | else { | |
265 | - | let saleKey = getSaleKey(caller, ticketId, eventId, creatorAddr) | |
266 | - | let saleInfo = split(getStrByK((saleKey + "_OPEN")), "_") | |
267 | - | [StringEntry((saleKey + "_OPEN"), ((((((((((((saleInfo[0] + "_") + toString(price)) + "_") + toBase58String(signAssetId)) + "_") + saleInfo[3]) + "_") + saleInfo[4]) + "_") + saleInfo[5]) + "_") + saleInfo[6]))] | |
530 | + | let amountUsed = getIntegerByKey(keyTicketAmountUsed(issuer, eventId, ticketId, toBase58String(value(payment.assetId)))) | |
531 | + | let maxUsingTime = getIntegerByKey(keyTicketMaxUse(issuer, eventId, ticketId)) | |
532 | + | if ((maxUsingTime == amountUsed)) | |
533 | + | then throw((("Ticket used " + toString(amountUsed)) + " times already")) | |
534 | + | else [IntegerEntry(keyTicketAmountUsed(issuer, eventId, ticketId, toBase58String(value(payment.assetId))), (amountUsed + 1)), StringEntry(keyTicketHistoryUsed(issuer, eventId, ticketId, toBase58String(value(payment.assetId)), toString((amountUsed + 1))), ((((((id + "_") + caller) + "_") + toString(date)) + "_") + toString((amountUsed + 1)))), ScriptTransfer(Address(fromBase58String(caller)), 1, payment.assetId)] | |
268 | 535 | } | |
269 | 536 | } | |
270 | 537 | } | |
271 | 538 | } | |
272 | 539 | ||
273 | 540 | ||
274 | 541 | ||
275 | 542 | @Callable(i) | |
276 | - | func cancelSale (ticketId) = { | |
277 | - | let $t087989032 = provideBaseData(i, ticketId) | |
278 | - | let id = $t087989032._1 | |
279 | - | let caller = $t087989032._2 | |
280 | - | let date = $t087989032._3 | |
281 | - | let isValidNFT = $t087989032._4 | |
282 | - | let eventId = $t087989032._5 | |
283 | - | let creatorAddr = $t087989032._6 | |
284 | - | let saleOwner = getStrByK(("current_owner_on_dapp_" + ticketId)) | |
285 | - | if ((saleOwner != caller)) | |
286 | - | then throw("You don't own this ticket") | |
287 | - | else { | |
288 | - | let saleStatus = getStrByK(((("sale2nd_status_" + caller) + "_") + ticketId)) | |
289 | - | if ((saleStatus != "OPEN")) | |
290 | - | then throw("Sale not active") | |
291 | - | else { | |
292 | - | let saleKey = getSaleKey(caller, ticketId, eventId, creatorAddr) | |
293 | - | let saleInfo = getStrByK((saleKey + "_OPEN")) | |
294 | - | [DeleteEntry((saleKey + "_OPEN")), DeleteEntry(((("sale2nd_status_" + caller) + "_") + ticketId)), DeleteEntry(("current_owner_on_dapp_" + ticketId)), StringEntry((((saleKey + "_") + id) + "_CANCELLED"), ((((saleInfo + "_CANCELLED_") + toString(date)) + "_") + id)), ScriptTransfer(Address(fromBase58String(caller)), 1, fromBase58String(ticketId))] | |
295 | - | } | |
296 | - | } | |
297 | - | } | |
298 | - | ||
299 | - | ||
300 | - | ||
301 | - | @Callable(i) | |
302 | - | func buyNFT (ticketId) = { | |
303 | - | let $t0988910004 = provideBaseData(i, ticketId) | |
304 | - | let id = $t0988910004._1 | |
305 | - | let caller = $t0988910004._2 | |
306 | - | let date = $t0988910004._3 | |
307 | - | let isValidNFT = $t0988910004._4 | |
308 | - | let eventId = $t0988910004._5 | |
309 | - | let creatorAddr = $t0988910004._6 | |
310 | - | if (!(isValidNFT)) | |
311 | - | then throw("Not a valid ticket") | |
312 | - | else { | |
313 | - | let saleOwner = getSaleOwnerAndStatus(ticketId) | |
314 | - | let saleKey = getSaleKey(saleOwner, ticketId, eventId, creatorAddr) | |
315 | - | let saleInfo = getStrByK((saleKey + "_OPEN")) | |
316 | - | if ((size(saleInfo) == 0)) | |
317 | - | then throw("Sale Not found!") | |
318 | - | else { | |
319 | - | let saleInfoArray = split(saleInfo, "_") | |
320 | - | if ((parseInt(saleInfoArray[1]) == 0)) | |
321 | - | then throw("Offer only") | |
322 | - | else { | |
323 | - | let $t01041410450 = isPayment(i) | |
324 | - | let payment = $t01041410450._1 | |
325 | - | let amount = $t01041410450._2 | |
326 | - | let paymentAssetStr = if (isDefined(payment.assetId)) | |
327 | - | then toBase58String(value(payment.assetId)) | |
328 | - | else "" | |
329 | - | if (if ((saleInfoArray[1] != toString(amount))) | |
330 | - | then true | |
331 | - | else (saleInfoArray[2] != paymentAssetStr)) | |
332 | - | then throw("Payment infos don't match.") | |
333 | - | else { | |
334 | - | let $t01069410829 = setTransfers(amount, payment.assetId, ticketId, creatorAddr, saleOwner, caller) | |
335 | - | let commissions = $t01069410829._1 | |
336 | - | let creatorFee = $t01069410829._2 | |
337 | - | let ownerFee = $t01069410829._3 | |
338 | - | let collectorNFT = $t01069410829._4 | |
339 | - | ([DeleteEntry((saleKey + "_OPEN")), DeleteEntry(((("sale2nd_status_" + saleOwner) + "_") + ticketId)), DeleteEntry(("current_owner_on_dapp_" + ticketId)), StringEntry((((saleKey + "_") + id) + "_CLOSED"), ((((((saleInfo + "_CLOSED_") + toString(date)) + "_") + id) + "_") + caller)), updateNumSales(), creatorFee, ownerFee, collectorNFT] ++ commissions) | |
340 | - | } | |
341 | - | } | |
342 | - | } | |
343 | - | } | |
344 | - | } | |
345 | - | ||
346 | - | ||
347 | - | ||
348 | - | @Callable(i) | |
349 | - | func setOffer (ticketId) = { | |
350 | - | let $t01124911339 = provideBaseData(i, ticketId) | |
351 | - | let id = $t01124911339._1 | |
352 | - | let offerOwner = $t01124911339._2 | |
353 | - | let date = $t01124911339._3 | |
354 | - | let isValidNFT = $t01124911339._4 | |
355 | - | let eventId = $t01124911339._5 | |
356 | - | let creatorAddr = $t01124911339._6 | |
357 | - | if (!(isValidNFT)) | |
358 | - | then throw("Not a valid ticket") | |
359 | - | else { | |
360 | - | let $t01140311439 = isPayment(i) | |
361 | - | let payment = $t01140311439._1 | |
362 | - | let amount = $t01140311439._2 | |
363 | - | let assetId = toBase58String(value(payment.assetId)) | |
364 | - | if (!(acceptedAssetIds(assetId))) | |
365 | - | then throw("asset not accepted") | |
366 | - | else if ((amount == 0)) | |
367 | - | then throw("Offer of 0 not allowed") | |
368 | - | else { | |
369 | - | let saleOwner = getSaleOwnerAndStatus(ticketId) | |
370 | - | [StringEntry((getBidKey(offerOwner, ticketId, saleOwner, id) + "_OPEN"), ((((((((((((((toString(date) + "_") + toString(amount)) + "_") + assetId) + "_") + ticketId) + "_") + eventId) + "_") + creatorAddr) + "_") + offerOwner) + "_") + id))] | |
371 | - | } | |
372 | - | } | |
373 | - | } | |
374 | - | ||
375 | - | ||
376 | - | ||
377 | - | @Callable(i) | |
378 | - | func acceptOffer (ticketId,offerId,offerOwner) = { | |
379 | - | let $t01211912205 = provideBaseData(i, ticketId) | |
380 | - | let id = $t01211912205._1 | |
381 | - | let caller = $t01211912205._2 | |
382 | - | let date = $t01211912205._3 | |
383 | - | let isValidNFT = $t01211912205._4 | |
384 | - | let eventId = $t01211912205._5 | |
385 | - | let creatorAddr = $t01211912205._6 | |
386 | - | if (!(isValidNFT)) | |
387 | - | then throw("Not a valid ticket") | |
388 | - | else { | |
389 | - | let saleOwner = getSaleOwnerAndStatus(ticketId) | |
390 | - | if ((caller != saleOwner)) | |
391 | - | then throw("Only sale owner can accept offer") | |
392 | - | else { | |
393 | - | let bidKey = getBidKey(offerOwner, ticketId, saleOwner, offerId) | |
394 | - | let $t01246812523 = getBidData(bidKey) | |
395 | - | let bidDataArr = $t01246812523._1 | |
396 | - | let assetId = $t01246812523._2 | |
397 | - | let bidData = $t01246812523._3 | |
398 | - | let saleKey = getSaleKey(saleOwner, ticketId, eventId, creatorAddr) | |
399 | - | let saleInfo = getStrByK((saleKey + "_OPEN")) | |
400 | - | if ((size(saleInfo) == 0)) | |
401 | - | then throw("Sale Not found!") | |
402 | - | else { | |
403 | - | let amount = value(parseInt(bidDataArr[1])) | |
404 | - | let $t01276412898 = setTransfers(amount, assetId, ticketId, creatorAddr, saleOwner, bidDataArr[6]) | |
405 | - | let commissions = $t01276412898._1 | |
406 | - | let creatorFee = $t01276412898._2 | |
407 | - | let ownerFee = $t01276412898._3 | |
408 | - | let collectorNFT = $t01276412898._4 | |
409 | - | let assetIdStr = toBase58String(value(assetId)) | |
410 | - | ([DeleteEntry((saleKey + "_OPEN")), DeleteEntry((bidKey + "_OPEN")), DeleteEntry(((("sale2nd_status_" + saleOwner) + "_") + ticketId)), DeleteEntry(("current_owner_on_dapp_" + ticketId)), StringEntry((bidKey + "_CLOSED"), ((((bidData + "_CLOSED_") + toString(date)) + "_") + id)), StringEntry((((saleKey + "_") + id) + "_CLOSED"), ((((((((((saleInfo + "_CLOSED-OFFER_") + toString(date)) + "_") + id) + "_") + offerOwner) + "_") + toString(amount)) + "_") + assetIdStr)), updateNumSales(), creatorFee, ownerFee, collectorNFT] ++ commissions) | |
411 | - | } | |
412 | - | } | |
413 | - | } | |
414 | - | } | |
415 | - | ||
416 | - | ||
417 | - | ||
418 | - | @Callable(i) | |
419 | - | func cancelOffer (ticketId,offerId,offerOwner,saleOwner) = { | |
420 | - | let $t01366713739 = idCallerDate(i) | |
421 | - | let id = $t01366713739._1 | |
422 | - | let caller = $t01366713739._2 | |
423 | - | let date = $t01366713739._3 | |
424 | - | if (if ((caller != offerOwner)) | |
425 | - | then (caller != saleOwner) | |
426 | - | else false) | |
427 | - | then throw("You cannot cancel this offer.") | |
428 | - | else { | |
429 | - | let bidKey = getBidKey(offerOwner, ticketId, saleOwner, offerId) | |
430 | - | let $t01391413969 = getBidData(bidKey) | |
431 | - | let bidDataArr = $t01391413969._1 | |
432 | - | let assetId = $t01391413969._2 | |
433 | - | let bidData = $t01391413969._3 | |
434 | - | [DeleteEntry((bidKey + "_OPEN")), StringEntry((bidKey + "_CANCELLED"), ((((bidData + "_CANCELLED_") + toString(date)) + "_") + id)), ScriptTransfer(Address(fromBase58String(caller)), parseIntValue(bidDataArr[1]), assetId)] | |
435 | - | } | |
543 | + | func deleteEntry (entry) = { | |
544 | + | let caller = toString(i.caller) | |
545 | + | if ((caller == chris)) | |
546 | + | then [DeleteEntry(entry)] | |
547 | + | else throw("no") | |
436 | 548 | } | |
437 | 549 | ||
438 | 550 |
github/deemru/w8io/169f3d6 78.70 ms ◑