tx · 3t6nwNCUtoKAnLsmFiEFAaR4VXsNf3GbBh75aNBj28i5 3MtHYn3dDpoVUf6FNzwXU8k1cqH3KMxgNFP: -0.01400000 Waves 2021.12.27 05:41 [1852075] smart account 3MtHYn3dDpoVUf6FNzwXU8k1cqH3KMxgNFP > SELF 0.00000000 Waves
{ "type": 13, "id": "3t6nwNCUtoKAnLsmFiEFAaR4VXsNf3GbBh75aNBj28i5", "fee": 1400000, "feeAssetId": null, "timestamp": 1640572935328, "version": 2, "chainId": 84, "sender": "3MtHYn3dDpoVUf6FNzwXU8k1cqH3KMxgNFP", "senderPublicKey": "CERNwqnHFnGf66rmS4s5mpWEPxv5RMqg2rSKPJCCgTbQ", "proofs": [ "fKtaLArom8VxjtLYM7MCWNHGhEPXPvtwhonti1GuXfptZxgnwq6mzMTWKruvX2nTfjTsuaTWpQSPhTX2BNc95Qt" ], "script": "base64:AAIFAAAAAAAAABwIAhIMCgoICAEBAQEYCAgIEgMKAQgSBQoDCAgIAAAAGQAAAAASc3lzdGVtQXNzZXRJZEJ5dGVzAQAAACBl2/7IbWHpVuwmUYs5w8vx8CJaoK7/XpSEcwFpn5187QAAAAAbZmFjdG9yeUNvbnRyYWN0QWRkcmVzc0J5dGVzAQAAABoBVKSIz4/LrUrKgYcmdcl3OfutIPleSLVTRQAAAAAiY3JlYXRlRXZlbnRNaW5pbWFsU2VydmljZUZlZUFtb3VudAAAAAAAAAAACgAAAAAgZWRpdEV2ZW50TWluaW1hbFNlcnZpY2VGZWVBbW91bnQAAAAAAAAAABQAAAAAEGtleURhdGFTZXBhcmF0b3ICAAAAAToAAAAAEnZhbHVlRGF0YVNlcGFyYXRvcgIAAAACX18BAAAAEnVuc2FmZUdldEFzc2V0QnlJZAAAAAEAAAAHYXNzZXRJZAQAAAAHJG1hdGNoMAkAA+wAAAABBQAAAAdhc3NldElkAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAVBc3NldAQAAAAFYXNzZXQFAAAAByRtYXRjaDAFAAAAB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TdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tledfA9Kg=", "height": 1852075, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BYeDwbUtqHoSEJiGELua9fcbtxzLq4PHc6rQGsNkjeW8 Next: 3zk2Wuz5T6cJzBPxtXF52Jfq6jSnT6B14SpXR2V87M7G Diff:
Old | New | Differences | |
---|---|---|---|
63 | 63 | func generateEventDataKey (eventId) = makeString(["event", eventId, "data"], keyDataSeparator) | |
64 | 64 | ||
65 | 65 | ||
66 | - | func serializeEventData (creatorAddress,title,description,startHeight,ticketPrice,tags,durationOrUnit,pictureOrUnit,linkOrUnit,locationOrUnit,ticketCountOrUnit) = { | |
67 | - | let duration = match durationOrUnit { | |
68 | - | case duration: Int => | |
69 | - | toString(duration) | |
70 | - | case _ => | |
71 | - | "" | |
72 | - | } | |
66 | + | func serializeEventData (creatorAddress,title,description,startHeight,duration,ticketPrice,ticketCount,tags,pictureOrUnit,linkOrUnit,locationOrUnit) = { | |
73 | 67 | let picture = match pictureOrUnit { | |
74 | 68 | case picture: String => | |
75 | 69 | picture | |
88 | 82 | case _ => | |
89 | 83 | "" | |
90 | 84 | } | |
91 | - | let ticketCount = match ticketCountOrUnit { | |
92 | - | case ticketCount: Int => | |
93 | - | toString(ticketCount) | |
94 | - | case _ => | |
95 | - | "" | |
96 | - | } | |
97 | - | makeString([toString(creatorAddress), title, description, toString(startHeight), toString(ticketPrice), makeString(tags, ","), duration, picture, link, location, ticketCount], valueDataSeparator) | |
85 | + | makeString([toString(creatorAddress), title, description, toString(startHeight), toString(duration), toString(ticketPrice), toString(ticketCount), makeString(tags, ","), picture, link, location], valueDataSeparator) | |
98 | 86 | } | |
99 | 87 | ||
100 | 88 | ||
104 | 92 | let title = eventData[1] | |
105 | 93 | let description = eventData[2] | |
106 | 94 | let startHeight = parseIntValue(eventData[3]) | |
107 | - | let ticketPrice = parseIntValue(eventData[4]) | |
108 | - | let tags = split(eventData[5], ",") | |
109 | - | let durationOrUnit = parseInt(eventData[6]) | |
110 | - | let pictureOrUnit = if ((eventData[7] == "")) | |
111 | - | then unit | |
112 | - | else eventData[7] | |
113 | - | let linkOrUnit = if ((eventData[8] == "")) | |
95 | + | let duration = parseInt(eventData[4]) | |
96 | + | let ticketPrice = parseIntValue(eventData[5]) | |
97 | + | let ticketCount = parseIntValue(eventData[6]) | |
98 | + | let tags = split(eventData[7], ",") | |
99 | + | let pictureOrUnit = if ((eventData[8] == "")) | |
114 | 100 | then unit | |
115 | 101 | else eventData[8] | |
116 | - | let | |
102 | + | let linkOrUnit = if ((eventData[9] == "")) | |
117 | 103 | then unit | |
118 | 104 | else eventData[9] | |
119 | - | let ticketCountOrUnit = parseInt(eventData[10]) | |
120 | - | $Tuple11(creatorAddress, title, description, startHeight, ticketPrice, tags, durationOrUnit, pictureOrUnit, linkOrUnit, locationOrUnit, ticketCountOrUnit) | |
105 | + | let locationOrUnit = if ((eventData[10] == "")) | |
106 | + | then unit | |
107 | + | else eventData[10] | |
108 | + | $Tuple11(creatorAddress, title, description, startHeight, duration, ticketPrice, ticketCount, tags, pictureOrUnit, linkOrUnit, locationOrUnit) | |
121 | 109 | } | |
122 | 110 | ||
123 | 111 | ||
195 | 183 | ||
196 | 184 | ||
197 | 185 | @Callable(i) | |
198 | - | func createEvent (title,description,startHeight,ticketPrice,tags | |
186 | + | func createEvent (title,description,startHeight,durationInSecs,ticketPrice,ticketCount,tags,picture,link,location) = { | |
199 | 187 | let systemAsset = unsafeGetAssetById(systemAssetIdBytes) | |
200 | 188 | if ((1 > size(i.payments))) | |
201 | 189 | then throw("You have to send service fee as payment") | |
208 | 196 | let newEventId = generateEventId(i.caller, newEventIdx) | |
209 | 197 | if ((startHeight > height)) | |
210 | 198 | then throw("Event start height has to be from the future") | |
211 | - | else if ((0 > ticketPrice)) | |
212 | - | then throw("Ticket price has to be zero or positive number") | |
213 | - | else { | |
214 | - | let eventDuration = match durationInSecs { | |
215 | - | case d: Int => | |
216 | - | if ((1 > d)) | |
217 | - | then throw("Event duration has to be positive number") | |
218 | - | else d | |
219 | - | case _ => | |
220 | - | unit | |
221 | - | } | |
222 | - | let eventTicketCount = match ticketCount { | |
223 | - | case tc: Int => | |
224 | - | if ((1 > tc)) | |
225 | - | then throw("Event ticket count has to be positive number") | |
226 | - | else tc | |
227 | - | case _ => | |
228 | - | unit | |
229 | - | } | |
230 | - | [IntegerEntry(lastEventIdxKey(i.caller), newEventIdx), StringEntry(generateEventDataKey(newEventId), serializeEventData(i.caller, title, description, startHeight, ticketPrice, tags, eventDuration, picture, link, location, eventTicketCount))] | |
231 | - | } | |
199 | + | else if ((1 > durationInSecs)) | |
200 | + | then throw("Event duration has to be positive number") | |
201 | + | else if ((0 > ticketPrice)) | |
202 | + | then throw("Ticket price has to be zero or positive number") | |
203 | + | else if ((1 > ticketCount)) | |
204 | + | then throw("Ticket count has to be positive number") | |
205 | + | else [IntegerEntry(lastEventIdxKey(i.caller), newEventIdx), StringEntry(generateEventDataKey(newEventId), serializeEventData(i.caller, title, description, startHeight, durationInSecs, ticketPrice, ticketCount, tags, picture, link, location))] | |
232 | 206 | } | |
233 | 207 | } | |
234 | 208 | } | |
254 | 228 | case _ => | |
255 | 229 | 0 | |
256 | 230 | } | |
257 | - | let ticketCountOrUnit = eventData._11 | |
258 | - | if (if (isDefined(ticketCountOrUnit)) | |
259 | - | then (boughtTicketCount >= value(ticketCountOrUnit)) | |
260 | - | else false) | |
231 | + | let ticketCount = eventData._7 | |
232 | + | if ((boughtTicketCount >= ticketCount)) | |
261 | 233 | then throw("All the tickets are sold out") | |
262 | 234 | else { | |
263 | 235 | let userTicketKey = generateTicketKey(eventId, i.caller) | |
264 | 236 | if (isDefined(getString(userTicketKey))) | |
265 | 237 | then throw("You already have a ticket") | |
266 | 238 | else { | |
267 | - | let eventTicketPrice = eventData._ | |
239 | + | let eventTicketPrice = eventData._6 | |
268 | 240 | if ((eventTicketPrice > ticketPayment.amount)) | |
269 | 241 | then throw(("Attached ticket payment amount is less then event ticket price " + toString(eventTicketPrice))) | |
270 | 242 | else [IntegerEntry(boughtTicketCountKey, (boughtTicketCount + 1)), StringEntry(userTicketKey, serializeTicketData(i.transactionId, ticketPayment.amount, unit, unit))] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let systemAssetIdBytes = base58'7rck4P88F6QZEjJdU5uN56xCudCSAPYhoQJ4PJ9Wrnkc' | |
5 | 5 | ||
6 | 6 | let factoryContractAddressBytes = base58'3N4v4VAHbK5das4wB5QGripYbQFJ3PaB75e' | |
7 | 7 | ||
8 | 8 | let createEventMinimalServiceFeeAmount = 10 | |
9 | 9 | ||
10 | 10 | let editEventMinimalServiceFeeAmount = 20 | |
11 | 11 | ||
12 | 12 | let keyDataSeparator = ":" | |
13 | 13 | ||
14 | 14 | let valueDataSeparator = "__" | |
15 | 15 | ||
16 | 16 | func unsafeGetAssetById (assetId) = match assetInfo(assetId) { | |
17 | 17 | case asset: Asset => | |
18 | 18 | asset | |
19 | 19 | case _ => | |
20 | 20 | throw("Specified asset does not exist") | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func validateAssetId (sourceAssetIdOrUnit,requiredAssetId) = { | |
25 | 25 | let sourceAssetId = if (isDefined(sourceAssetIdOrUnit)) | |
26 | 26 | then toBase58String(value(sourceAssetIdOrUnit)) | |
27 | 27 | else "WAVES" | |
28 | 28 | if ((sourceAssetId != requiredAssetId)) | |
29 | 29 | then false | |
30 | 30 | else true | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func checkServiceFeePayment (operationTag,serviceFeePayment,requiredServiceFeeAmount) = { | |
35 | 35 | let systemAssetId = toBase58String(systemAssetIdBytes) | |
36 | 36 | if (!(validateAssetId(serviceFeePayment.assetId, systemAssetId))) | |
37 | 37 | then throw(((operationTag + " requires service fee payment in the system asset ") + systemAssetId)) | |
38 | 38 | else if (if ((requiredServiceFeeAmount > serviceFeePayment.amount)) | |
39 | 39 | then true | |
40 | 40 | else (serviceFeePayment.amount > requiredServiceFeeAmount)) | |
41 | 41 | then throw((("Attached service fee payment amount is not equal to required service fee (" + toString(requiredServiceFeeAmount)) + ")")) | |
42 | 42 | else unit | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func lastEventIdxKey (addr) = makeString([toString(addr), "last_event_idx"], keyDataSeparator) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func lastEventRequestIdx (addr) = match getInteger(this, lastEventIdxKey(addr)) { | |
50 | 50 | case i: Int => | |
51 | 51 | i | |
52 | 52 | case _ => | |
53 | 53 | 1 | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func generateNewEventIdx (addr) = (lastEventRequestIdx(addr) + 1) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func generateEventId (addr,idx) = makeString([toString(addr), toString(idx)], keyDataSeparator) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func generateEventDataKey (eventId) = makeString(["event", eventId, "data"], keyDataSeparator) | |
64 | 64 | ||
65 | 65 | ||
66 | - | func serializeEventData (creatorAddress,title,description,startHeight,ticketPrice,tags,durationOrUnit,pictureOrUnit,linkOrUnit,locationOrUnit,ticketCountOrUnit) = { | |
67 | - | let duration = match durationOrUnit { | |
68 | - | case duration: Int => | |
69 | - | toString(duration) | |
70 | - | case _ => | |
71 | - | "" | |
72 | - | } | |
66 | + | func serializeEventData (creatorAddress,title,description,startHeight,duration,ticketPrice,ticketCount,tags,pictureOrUnit,linkOrUnit,locationOrUnit) = { | |
73 | 67 | let picture = match pictureOrUnit { | |
74 | 68 | case picture: String => | |
75 | 69 | picture | |
76 | 70 | case _ => | |
77 | 71 | "" | |
78 | 72 | } | |
79 | 73 | let link = match linkOrUnit { | |
80 | 74 | case link: String => | |
81 | 75 | link | |
82 | 76 | case _ => | |
83 | 77 | "" | |
84 | 78 | } | |
85 | 79 | let location = match locationOrUnit { | |
86 | 80 | case location: String => | |
87 | 81 | location | |
88 | 82 | case _ => | |
89 | 83 | "" | |
90 | 84 | } | |
91 | - | let ticketCount = match ticketCountOrUnit { | |
92 | - | case ticketCount: Int => | |
93 | - | toString(ticketCount) | |
94 | - | case _ => | |
95 | - | "" | |
96 | - | } | |
97 | - | makeString([toString(creatorAddress), title, description, toString(startHeight), toString(ticketPrice), makeString(tags, ","), duration, picture, link, location, ticketCount], valueDataSeparator) | |
85 | + | makeString([toString(creatorAddress), title, description, toString(startHeight), toString(duration), toString(ticketPrice), toString(ticketCount), makeString(tags, ","), picture, link, location], valueDataSeparator) | |
98 | 86 | } | |
99 | 87 | ||
100 | 88 | ||
101 | 89 | func deserializeEventData (value) = { | |
102 | 90 | let eventData = split(value, valueDataSeparator) | |
103 | 91 | let creatorAddress = addressFromString(eventData[0]) | |
104 | 92 | let title = eventData[1] | |
105 | 93 | let description = eventData[2] | |
106 | 94 | let startHeight = parseIntValue(eventData[3]) | |
107 | - | let ticketPrice = parseIntValue(eventData[4]) | |
108 | - | let tags = split(eventData[5], ",") | |
109 | - | let durationOrUnit = parseInt(eventData[6]) | |
110 | - | let pictureOrUnit = if ((eventData[7] == "")) | |
111 | - | then unit | |
112 | - | else eventData[7] | |
113 | - | let linkOrUnit = if ((eventData[8] == "")) | |
95 | + | let duration = parseInt(eventData[4]) | |
96 | + | let ticketPrice = parseIntValue(eventData[5]) | |
97 | + | let ticketCount = parseIntValue(eventData[6]) | |
98 | + | let tags = split(eventData[7], ",") | |
99 | + | let pictureOrUnit = if ((eventData[8] == "")) | |
114 | 100 | then unit | |
115 | 101 | else eventData[8] | |
116 | - | let | |
102 | + | let linkOrUnit = if ((eventData[9] == "")) | |
117 | 103 | then unit | |
118 | 104 | else eventData[9] | |
119 | - | let ticketCountOrUnit = parseInt(eventData[10]) | |
120 | - | $Tuple11(creatorAddress, title, description, startHeight, ticketPrice, tags, durationOrUnit, pictureOrUnit, linkOrUnit, locationOrUnit, ticketCountOrUnit) | |
105 | + | let locationOrUnit = if ((eventData[10] == "")) | |
106 | + | then unit | |
107 | + | else eventData[10] | |
108 | + | $Tuple11(creatorAddress, title, description, startHeight, duration, ticketPrice, ticketCount, tags, pictureOrUnit, linkOrUnit, locationOrUnit) | |
121 | 109 | } | |
122 | 110 | ||
123 | 111 | ||
124 | 112 | func unsafeGetEventData (eventId) = { | |
125 | 113 | let eventDataKey = generateEventDataKey(eventId) | |
126 | 114 | let eventData = match getString(eventDataKey) { | |
127 | 115 | case s: String => | |
128 | 116 | s | |
129 | 117 | case _ => | |
130 | 118 | throw("Specified event not found") | |
131 | 119 | } | |
132 | 120 | deserializeEventData(eventData) | |
133 | 121 | } | |
134 | 122 | ||
135 | 123 | ||
136 | 124 | func generateBoughtTicketCountKey (eventId) = makeString(["event", eventId, "ticket_count"], keyDataSeparator) | |
137 | 125 | ||
138 | 126 | ||
139 | 127 | func generateTicketKey (eventId,userAddress) = makeString(["ticket", eventId, toString(userAddress)], keyDataSeparator) | |
140 | 128 | ||
141 | 129 | ||
142 | 130 | func generateTicketDataKey (ticketId) = makeString(["ticket", ticketId, "data"], valueDataSeparator) | |
143 | 131 | ||
144 | 132 | ||
145 | 133 | func serializeTicketData (buyTxId,buyPrice,swapTxId,bitographId) = makeString([toBase58String(buyTxId), toString(buyPrice), if (isDefined(swapTxId)) | |
146 | 134 | then toBase58String(value(swapTxId)) | |
147 | 135 | else "", if (isDefined(bitographId)) | |
148 | 136 | then toBase58String(value(bitographId)) | |
149 | 137 | else ""], valueDataSeparator) | |
150 | 138 | ||
151 | 139 | ||
152 | 140 | func deserializeTicketData (value) = { | |
153 | 141 | let ticketData = split(value, valueDataSeparator) | |
154 | 142 | let buyTxId = fromBase58String(ticketData[0]) | |
155 | 143 | let buyPrice = parseIntValue(ticketData[1]) | |
156 | 144 | let swapTxIdOrUnit = match ticketData[2] { | |
157 | 145 | case s: String => | |
158 | 146 | fromBase58String(s) | |
159 | 147 | case _ => | |
160 | 148 | unit | |
161 | 149 | } | |
162 | 150 | let bitographIdOrUnit = match ticketData[3] { | |
163 | 151 | case s: String => | |
164 | 152 | fromBase58String(s) | |
165 | 153 | case _ => | |
166 | 154 | unit | |
167 | 155 | } | |
168 | 156 | $Tuple4(buyTxId, buyPrice, swapTxIdOrUnit, bitographIdOrUnit) | |
169 | 157 | } | |
170 | 158 | ||
171 | 159 | ||
172 | 160 | func unsafeGetTicketData (ticketId) = { | |
173 | 161 | let ticketDataKey = generateTicketDataKey(ticketId) | |
174 | 162 | let ticketData = match getString(ticketDataKey) { | |
175 | 163 | case s: String => | |
176 | 164 | s | |
177 | 165 | case _ => | |
178 | 166 | throw("Specified ticket not found") | |
179 | 167 | } | |
180 | 168 | deserializeTicketData(ticketData) | |
181 | 169 | } | |
182 | 170 | ||
183 | 171 | ||
184 | 172 | func unsafeExtractTicketOwner (ticketId) = { | |
185 | 173 | let keyData = split(ticketId, keyDataSeparator) | |
186 | 174 | addressFromStringValue(keyData[3]) | |
187 | 175 | } | |
188 | 176 | ||
189 | 177 | ||
190 | 178 | func isNFT (asset) = if (if ((asset.decimals == 0)) | |
191 | 179 | then true | |
192 | 180 | else (asset.quantity == 1)) | |
193 | 181 | then true | |
194 | 182 | else !(asset.reissuable) | |
195 | 183 | ||
196 | 184 | ||
197 | 185 | @Callable(i) | |
198 | - | func createEvent (title,description,startHeight,ticketPrice,tags | |
186 | + | func createEvent (title,description,startHeight,durationInSecs,ticketPrice,ticketCount,tags,picture,link,location) = { | |
199 | 187 | let systemAsset = unsafeGetAssetById(systemAssetIdBytes) | |
200 | 188 | if ((1 > size(i.payments))) | |
201 | 189 | then throw("You have to send service fee as payment") | |
202 | 190 | else { | |
203 | 191 | let serviceFeePayment = i.payments[1] | |
204 | 192 | if (isDefined(checkServiceFeePayment("Create event", serviceFeePayment, createEventMinimalServiceFeeAmount))) | |
205 | 193 | then throw("Reached unreachable state") | |
206 | 194 | else { | |
207 | 195 | let newEventIdx = generateNewEventIdx(i.caller) | |
208 | 196 | let newEventId = generateEventId(i.caller, newEventIdx) | |
209 | 197 | if ((startHeight > height)) | |
210 | 198 | then throw("Event start height has to be from the future") | |
211 | - | else if ((0 > ticketPrice)) | |
212 | - | then throw("Ticket price has to be zero or positive number") | |
213 | - | else { | |
214 | - | let eventDuration = match durationInSecs { | |
215 | - | case d: Int => | |
216 | - | if ((1 > d)) | |
217 | - | then throw("Event duration has to be positive number") | |
218 | - | else d | |
219 | - | case _ => | |
220 | - | unit | |
221 | - | } | |
222 | - | let eventTicketCount = match ticketCount { | |
223 | - | case tc: Int => | |
224 | - | if ((1 > tc)) | |
225 | - | then throw("Event ticket count has to be positive number") | |
226 | - | else tc | |
227 | - | case _ => | |
228 | - | unit | |
229 | - | } | |
230 | - | [IntegerEntry(lastEventIdxKey(i.caller), newEventIdx), StringEntry(generateEventDataKey(newEventId), serializeEventData(i.caller, title, description, startHeight, ticketPrice, tags, eventDuration, picture, link, location, eventTicketCount))] | |
231 | - | } | |
199 | + | else if ((1 > durationInSecs)) | |
200 | + | then throw("Event duration has to be positive number") | |
201 | + | else if ((0 > ticketPrice)) | |
202 | + | then throw("Ticket price has to be zero or positive number") | |
203 | + | else if ((1 > ticketCount)) | |
204 | + | then throw("Ticket count has to be positive number") | |
205 | + | else [IntegerEntry(lastEventIdxKey(i.caller), newEventIdx), StringEntry(generateEventDataKey(newEventId), serializeEventData(i.caller, title, description, startHeight, durationInSecs, ticketPrice, ticketCount, tags, picture, link, location))] | |
232 | 206 | } | |
233 | 207 | } | |
234 | 208 | } | |
235 | 209 | ||
236 | 210 | ||
237 | 211 | ||
238 | 212 | @Callable(i) | |
239 | 213 | func buyTicket (eventId) = { | |
240 | 214 | let systemAsset = unsafeGetAssetById(systemAssetIdBytes) | |
241 | 215 | if ((1 > size(i.payments))) | |
242 | 216 | then throw("You have to attach the ticket payment") | |
243 | 217 | else { | |
244 | 218 | let ticketPayment = i.payments[0] | |
245 | 219 | let systemAssetId = toBase58String(systemAsset.id) | |
246 | 220 | if (!(validateAssetId(ticketPayment.assetId, systemAssetId))) | |
247 | 221 | then throw(("Ticket payment has to be in system asset " + systemAssetId)) | |
248 | 222 | else { | |
249 | 223 | let eventData = unsafeGetEventData(eventId) | |
250 | 224 | let boughtTicketCountKey = generateBoughtTicketCountKey(eventId) | |
251 | 225 | let boughtTicketCount = match getInteger(boughtTicketCountKey) { | |
252 | 226 | case count: Int => | |
253 | 227 | count | |
254 | 228 | case _ => | |
255 | 229 | 0 | |
256 | 230 | } | |
257 | - | let ticketCountOrUnit = eventData._11 | |
258 | - | if (if (isDefined(ticketCountOrUnit)) | |
259 | - | then (boughtTicketCount >= value(ticketCountOrUnit)) | |
260 | - | else false) | |
231 | + | let ticketCount = eventData._7 | |
232 | + | if ((boughtTicketCount >= ticketCount)) | |
261 | 233 | then throw("All the tickets are sold out") | |
262 | 234 | else { | |
263 | 235 | let userTicketKey = generateTicketKey(eventId, i.caller) | |
264 | 236 | if (isDefined(getString(userTicketKey))) | |
265 | 237 | then throw("You already have a ticket") | |
266 | 238 | else { | |
267 | - | let eventTicketPrice = eventData._ | |
239 | + | let eventTicketPrice = eventData._6 | |
268 | 240 | if ((eventTicketPrice > ticketPayment.amount)) | |
269 | 241 | then throw(("Attached ticket payment amount is less then event ticket price " + toString(eventTicketPrice))) | |
270 | 242 | else [IntegerEntry(boughtTicketCountKey, (boughtTicketCount + 1)), StringEntry(userTicketKey, serializeTicketData(i.transactionId, ticketPayment.amount, unit, unit))] | |
271 | 243 | } | |
272 | 244 | } | |
273 | 245 | } | |
274 | 246 | } | |
275 | 247 | } | |
276 | 248 | ||
277 | 249 | ||
278 | 250 | ||
279 | 251 | @Callable(i) | |
280 | 252 | func giveBitographForTicket (ticketId,bitographName,bitographMetadata) = if (!(isDefined(getString(ticketId)))) | |
281 | 253 | then throw("Ticket does not exists") | |
282 | 254 | else { | |
283 | 255 | let ticketData = unsafeGetTicketData(ticketId) | |
284 | 256 | let bitographIdOrUnit = ticketData._4 | |
285 | 257 | if (isDefined(bitographIdOrUnit)) | |
286 | 258 | then throw((("There is bitograph " + toBase58String(value(bitographIdOrUnit))) + " that has already been given for the ticket")) | |
287 | 259 | else { | |
288 | 260 | let ticketOwner = unsafeExtractTicketOwner(ticketId) | |
289 | 261 | let createBitographResult = invoke(Address(factoryContractAddressBytes), "createBitograph", [bitographName, bitographMetadata], nil) | |
290 | 262 | if ((createBitographResult == createBitographResult)) | |
291 | 263 | then { | |
292 | 264 | let bitographAssetId = match createBitographResult { | |
293 | 265 | case r: ByteVector => | |
294 | 266 | r | |
295 | 267 | case _ => | |
296 | 268 | throw("Error occurred while creating a bitograph") | |
297 | 269 | } | |
298 | 270 | [ScriptTransfer(ticketOwner, 1, bitographAssetId), StringEntry(ticketId, serializeTicketData(ticketData._1, ticketData._2, i.transactionId, bitographAssetId))] | |
299 | 271 | } | |
300 | 272 | else throw("Strict value is not equal to itself.") | |
301 | 273 | } | |
302 | 274 | } | |
303 | 275 | ||
304 | 276 | ||
305 | 277 | @Verifier(tx) | |
306 | 278 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
307 | 279 |
github/deemru/w8io/026f985 51.33 ms ◑