tx · 9yz99oN4uNTxZAerFTwFSag9x17iKPRgKtJSeHJNesAM 3MzKq9FC8GAeYxYMGZqPZzrXmRwyyK9eRtU: -0.01400000 Waves 2020.03.23 15:29 [921997] smart account 3MzKq9FC8GAeYxYMGZqPZzrXmRwyyK9eRtU > SELF 0.00000000 Waves
{ "type": 13, "id": "9yz99oN4uNTxZAerFTwFSag9x17iKPRgKtJSeHJNesAM", "fee": 1400000, "feeAssetId": null, "timestamp": 1584966352193, "version": 1, "sender": "3MzKq9FC8GAeYxYMGZqPZzrXmRwyyK9eRtU", "senderPublicKey": "GXTgD3DifeMCqpyW2oL4fX2vdw49UtqWEesdZpaEuEFB", "proofs": [ "4Z56Ct9BpBgzbpLTgC1vdqoL7vnuw7Kk4yBEEWNHHJ9ohsSdmaRP3iePd9rBWoCW1BarfcoRdnX1oYRxLLyDvoN9" ], "script": "base64:AAIDAAAAAAAAAD4IARIGCgQICAEEEggKBggBAQgBARIGCgQIAQEIEgMKAQgSBwoFCAgBCAESBQoDCAEBEgYKBAgBCAESAwoBCAAAACoAAAAAB2FkZHJlc3MCAAAAIzNNektxOUZDOEdBZVl4WU1HWnFQWnpyWG1Sd3l5SzllUnRVAAAAAA5rZXlFdmVudFByZWZpeAIAAAACZV8AAAAAEmtleUV2ZW50RGF0YVByZWZpeAIAAAAFZGF0YV8AAAAAE2tleUV2ZW50UHJpY2VQcmVmaXgCAAAABnByaWNlXwAAAAASa2V5RXZlbnREYXRlUHJlZml4AgAAAAVkYXRlXwAAAAAWa2V5RXZlbnRBdHRlbmRlZVByZWZpeAIAAAACYV8AAAAAGGtleVByb2R1Y2VyQmFsYW5jZVByZWZpeAIAAAAIYmFsYW5jZV8AAAAAGmtleUV2ZW50QW1vdW50VGlja2V0UHJlZml4AgAAAA5hbW91bnRUaWNrZXRzXwAAAAAWa2V5RXZlbnRDYW5jZWxlZFByZWZpeAIAAAAJY2FuY2VsZWRfAAAAABhrZXlFdmVudE1heFRpY2tldHNQcmVmaXgCAAAABG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FZhbHVlQnlJZAAAAAEFAAAABWV2ZW50BQAAAA1jYWxsZXJBZGRyZXNzCQAAAgAAAAECAAAATkV2ZW50IGRvZXMgbm90IGV4aXN0LCBvciB5b3UgZG9uJ3QgaGF2ZSB0aGUgY3JlZGVudGlhbHMgdG8gcGVyZm9ybSB0aGlzIGFjdGlvbgMJAABnAAAAAgAAAAAAAAAAAAUAAAAHYmFsYW5jZQkAAAIAAAABAgAAABRJbnN1ZmZpY2llbnQgYmFsYW5jZQMJAQAAABVnZXRFdmVudENhbmNlbGVkVmFsdWUAAAABBQAAAAVldmVudAkAAAIAAAABAgAAABdFdmVudCBoYXMgYmVlbiBjYW5jZWxlZAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABJnZXRFdmVudEJhbGFuY2VLZXkAAAACBQAAAA1jYWxsZXJBZGRyZXNzBQAAAAVldmVudAAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAANY2FsbGVyQWRkcmVzcwkAAGUAAAACBQAAAAdiYWxhbmNlCQAAaQAAAAIJAABoAAAAAgUAAAAHYmFsYW5jZQUAAAAKY29tbWlzc2lvbgAAAAAAAAAAZAUAAAAEdW5pdAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAAB2FkZHJlc3MJAABpAAAAAgkAAGgAAAACBQAAAAdiYWxhbmNlBQAAAApjb21taXNzaW9uAAAAAAAAAABkBQAAAAR1bml0BQAAAANuaWwAAAAAFrCNvA==", "chainId": 84, "height": 921997, "spentComplexity": 0 } View: original | compacted Prev: none Next: 7e5kbaWoC53nzsaAzvo6h1k4Ns157s1jbtXbxauJG8Zf Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let address = "3MzKq9FC8GAeYxYMGZqPZzrXmRwyyK9eRtU" | |
5 | + | ||
6 | + | let keyEventPrefix = "e_" | |
7 | + | ||
8 | + | let keyEventDataPrefix = "data_" | |
9 | + | ||
10 | + | let keyEventPricePrefix = "price_" | |
11 | + | ||
12 | + | let keyEventDatePrefix = "date_" | |
13 | + | ||
14 | + | let keyEventAttendeePrefix = "a_" | |
15 | + | ||
16 | + | let keyProducerBalancePrefix = "balance_" | |
17 | + | ||
18 | + | let keyEventAmountTicketPrefix = "amountTickets_" | |
19 | + | ||
20 | + | let keyEventCanceledPrefix = "canceled_" | |
21 | + | ||
22 | + | let keyEventMaxTicketsPrefix = "max_" | |
23 | + | ||
24 | + | let keyEventRequiresIdPrefix = "requiresId_" | |
25 | + | ||
26 | + | let keyEventTicketDescriptionPrefix = "ticketDescription_" | |
27 | + | ||
28 | + | let keyEventTicketsPrefix = "tickets_" | |
29 | + | ||
30 | + | let NONE = "none" | |
31 | + | ||
32 | + | let commission = 5 | |
33 | + | ||
34 | + | func getNumberByKey (key) = { | |
35 | + | let num = match getInteger(this, key) { | |
36 | + | case a: Int => | |
37 | + | a | |
38 | + | case _ => | |
39 | + | 0 | |
40 | + | } | |
41 | + | num | |
42 | + | } | |
43 | + | ||
44 | + | ||
45 | + | func getStrByKey (key) = { | |
46 | + | let str = match getString(this, key) { | |
47 | + | case a: String => | |
48 | + | a | |
49 | + | case _ => | |
50 | + | NONE | |
51 | + | } | |
52 | + | str | |
53 | + | } | |
54 | + | ||
55 | + | ||
56 | + | func getBoolByKey (key) = { | |
57 | + | let bool = match getBoolean(this, key) { | |
58 | + | case a: Boolean => | |
59 | + | a | |
60 | + | case _ => | |
61 | + | false | |
62 | + | } | |
63 | + | bool | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | func getEventKey (producer,title) = (keyEventPrefix + toBase58String(sha256(toBytes((producer + title))))) | |
68 | + | ||
69 | + | ||
70 | + | func getEventDataKey (event) = (keyEventDataPrefix + event) | |
71 | + | ||
72 | + | ||
73 | + | func getEventPriceKey (event,ticketId) = (((keyEventPricePrefix + toString(ticketId)) + "_") + event) | |
74 | + | ||
75 | + | ||
76 | + | func getEventDateKey (event) = (keyEventDatePrefix + event) | |
77 | + | ||
78 | + | ||
79 | + | func getEventAttendeeKey (user,id,ticketId,event) = (((((keyEventAttendeePrefix + toBase58String(sha256(toBytes((user + id))))) + "_") + toString(ticketId)) + "_") + event) | |
80 | + | ||
81 | + | ||
82 | + | func getEventBalanceKey (account,event) = (((keyProducerBalancePrefix + account) + "_") + event) | |
83 | + | ||
84 | + | ||
85 | + | func getEventAmountTicketsKey (event,ticketId) = (((keyEventAmountTicketPrefix + toString(ticketId)) + "_") + event) | |
86 | + | ||
87 | + | ||
88 | + | func getEventCanceledKey (event) = (keyEventCanceledPrefix + event) | |
89 | + | ||
90 | + | ||
91 | + | func getEventRequiresIdKey (event) = (keyEventRequiresIdPrefix + event) | |
92 | + | ||
93 | + | ||
94 | + | func getEventMaxTicketsKey (event,ticketId) = (((keyEventMaxTicketsPrefix + toString(ticketId)) + "_") + event) | |
95 | + | ||
96 | + | ||
97 | + | func getEventTicketDescriptionKey (event,ticketId) = (((keyEventTicketDescriptionPrefix + toString(ticketId)) + "_") + event) | |
98 | + | ||
99 | + | ||
100 | + | func getEventTicketsKey (event) = (keyEventTicketsPrefix + event) | |
101 | + | ||
102 | + | ||
103 | + | func getEventValueById (item) = getStrByKey(item) | |
104 | + | ||
105 | + | ||
106 | + | func getEventValue (producer,title) = getStrByKey(getEventKey(producer, title)) | |
107 | + | ||
108 | + | ||
109 | + | func getEventPriceValue (event,ticketId) = getNumberByKey(getEventPriceKey(event, ticketId)) | |
110 | + | ||
111 | + | ||
112 | + | func getEventDateValue (event) = getNumberByKey(getEventDateKey(event)) | |
113 | + | ||
114 | + | ||
115 | + | func getEventAttendeeValue (user,id,ticketId,event) = getNumberByKey(getEventAttendeeKey(user, id, ticketId, event)) | |
116 | + | ||
117 | + | ||
118 | + | func getEventBalanceValue (account,event) = getNumberByKey(getEventBalanceKey(account, event)) | |
119 | + | ||
120 | + | ||
121 | + | func getEventAmountTicketsValue (event,ticketId) = getNumberByKey(getEventAmountTicketsKey(event, ticketId)) | |
122 | + | ||
123 | + | ||
124 | + | func getEventCanceledValue (event) = getBoolByKey(getEventCanceledKey(event)) | |
125 | + | ||
126 | + | ||
127 | + | func getEventRequiresIdValue (event) = getBoolByKey(getEventRequiresIdKey(event)) | |
128 | + | ||
129 | + | ||
130 | + | func getEventMaxTicketsValue (event,ticketId) = getNumberByKey(getEventMaxTicketsKey(event, ticketId)) | |
131 | + | ||
132 | + | ||
133 | + | func getEventTicketDescriptionValue (event,ticketId) = getStrByKey(getEventTicketDescriptionKey(event, ticketId)) | |
134 | + | ||
135 | + | ||
136 | + | func getEventTicketsValue (event) = getNumberByKey(getEventTicketsKey(event)) | |
137 | + | ||
138 | + | ||
139 | + | @Callable(i) | |
140 | + | func createEvent (title,data,date,requiresId) = { | |
141 | + | let producerAddress = toBase58String(i.caller.bytes) | |
142 | + | let event = getEventKey(producerAddress, title) | |
143 | + | if ((getEventValue(producerAddress, title) != NONE)) | |
144 | + | then throw("The event already exist") | |
145 | + | else if ((lastBlock.timestamp > date)) | |
146 | + | then throw("Date cannot be in the past") | |
147 | + | else WriteSet([DataEntry(getEventKey(producerAddress, title), producerAddress), DataEntry(getEventDataKey(event), data), DataEntry(getEventDateKey(event), date), DataEntry(getEventRequiresIdKey(event), requiresId)]) | |
148 | + | } | |
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | @Callable(i) | |
153 | + | func createEventTicket (event,ticketId,price,description,amountTickets,maxAmount) = { | |
154 | + | let callerAddress = toBase58String(i.caller.bytes) | |
155 | + | let producerAddress = getEventValueById(event) | |
156 | + | if ((producerAddress != callerAddress)) | |
157 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
158 | + | else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event))) | |
159 | + | then throw("This event has already happened") | |
160 | + | else if (getEventCanceledValue(event)) | |
161 | + | then throw("This event was canceled") | |
162 | + | else WriteSet([DataEntry(getEventPriceKey(event, ticketId), price), DataEntry(getEventAmountTicketsKey(event, ticketId), amountTickets), DataEntry(getEventMaxTicketsKey(event, ticketId), maxAmount), DataEntry(getEventTicketDescriptionKey(event, ticketId), description)]) | |
163 | + | } | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(i) | |
168 | + | func purchase (event,ticketId,amount,id) = { | |
169 | + | let pmt = extract(i.payment) | |
170 | + | if (isDefined(pmt.assetId)) | |
171 | + | then throw("can use WAVES only at the moment") | |
172 | + | else { | |
173 | + | let userAddress = toBase58String(i.caller.bytes) | |
174 | + | let price = getEventPriceValue(event, ticketId) | |
175 | + | let producerAddress = getEventValueById(event) | |
176 | + | let ticketsLeft = getEventAmountTicketsValue(event, ticketId) | |
177 | + | let attendeeKey = "" | |
178 | + | if ((producerAddress == NONE)) | |
179 | + | then throw("Event does not exist") | |
180 | + | else if (((price * amount) > pmt.amount)) | |
181 | + | then throw(((("You did not send enough money. You sent: " + toString(pmt.amount)) + ". Expected: ") + toString((amount * price)))) | |
182 | + | else if ((pmt.amount > (price * amount))) | |
183 | + | then throw(((("You send too much money. You sent: " + toString(pmt.amount)) + ". Total price: ") + toString((amount * price)))) | |
184 | + | else if ((0 > (ticketsLeft - amount))) | |
185 | + | then throw("Not enough tickets left") | |
186 | + | else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event))) | |
187 | + | then throw("This event has already happened") | |
188 | + | else if (getEventCanceledValue(event)) | |
189 | + | then throw("This event was canceled") | |
190 | + | else if (if (getEventRequiresIdValue(event)) | |
191 | + | then (id == "") | |
192 | + | else false) | |
193 | + | then throw("This event requires that you register with a personal ID") | |
194 | + | else if ((getEventMaxTicketsValue(event, ticketId) > (getEventAttendeeValue(userAddress, id, ticketId, event) + amount))) | |
195 | + | then throw("Amount of Tickets exceeds maximum amount per attendee") | |
196 | + | else ScriptResult(WriteSet([DataEntry(getEventAttendeeKey(userAddress, id, ticketId, event), (getEventAttendeeValue(userAddress, id, ticketId, event) + amount)), DataEntry(getEventBalanceKey(producerAddress, event), (getEventBalanceValue(producerAddress, event) + pmt.amount)), DataEntry(getEventAmountTicketsKey(event, ticketId), (ticketsLeft - amount))]), TransferSet([ScriptTransfer(addressFromStringValue(address), pmt.amount, unit)])) | |
197 | + | } | |
198 | + | } | |
199 | + | ||
200 | + | ||
201 | + | ||
202 | + | @Callable(i) | |
203 | + | func cancelEvent (event) = { | |
204 | + | let callerAddress = toBase58String(i.caller.bytes) | |
205 | + | if ((getEventValueById(event) != callerAddress)) | |
206 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
207 | + | else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event))) | |
208 | + | then throw("This event has already happened") | |
209 | + | else WriteSet([DataEntry(getEventCanceledKey(event), true)]) | |
210 | + | } | |
211 | + | ||
212 | + | ||
213 | + | ||
214 | + | @Callable(i) | |
215 | + | func checkin (event,attendeeAddress,amount,id,ticketId) = { | |
216 | + | let callerAddress = toBase58String(i.caller.bytes) | |
217 | + | if ((getEventValueById(event) != callerAddress)) | |
218 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
219 | + | else if ((amount > getEventAttendeeValue(attendeeAddress, id, ticketId, event))) | |
220 | + | then throw("You don't have enough tickets.") | |
221 | + | else if (getEventCanceledValue(event)) | |
222 | + | then throw("This event was canceled. You can redeem your ticket using refundTicket function") | |
223 | + | else WriteSet([DataEntry(getEventAttendeeKey(attendeeAddress, id, ticketId, event), (getEventAttendeeValue(attendeeAddress, id, ticketId, event) - amount))]) | |
224 | + | } | |
225 | + | ||
226 | + | ||
227 | + | ||
228 | + | @Callable(i) | |
229 | + | func editEventTickets (event,ticketId,newAmount) = { | |
230 | + | let callerAddress = toBase58String(i.caller.bytes) | |
231 | + | if ((getEventValueById(event) != callerAddress)) | |
232 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
233 | + | else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event))) | |
234 | + | then throw("This event has already happened") | |
235 | + | else if (getEventCanceledValue(event)) | |
236 | + | then throw("This event was already canceled") | |
237 | + | else WriteSet([DataEntry(getEventAmountTicketsKey(event, ticketId), newAmount)]) | |
238 | + | } | |
239 | + | ||
240 | + | ||
241 | + | ||
242 | + | @Callable(i) | |
243 | + | func refundTicket (event,amount,id,ticketId) = { | |
244 | + | let attendeeAddress = toBase58String(i.caller.bytes) | |
245 | + | if ((getEventValueById(event) == NONE)) | |
246 | + | then throw("The event does not exist") | |
247 | + | else if ((amount > getEventAttendeeValue(attendeeAddress, id, ticketId, event))) | |
248 | + | then throw("You don't have enough registered tickets with this address") | |
249 | + | else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event))) | |
250 | + | then throw("This event has already happened") | |
251 | + | else ScriptResult(WriteSet([DataEntry(getEventAttendeeKey(attendeeAddress, id, ticketId, event), (getEventAttendeeValue(attendeeAddress, id, ticketId, event) - amount))]), TransferSet([ScriptTransfer(addressFromStringValue(attendeeAddress), (amount * getEventAttendeeValue(attendeeAddress, id, ticketId, event)), unit)])) | |
252 | + | } | |
253 | + | ||
254 | + | ||
255 | + | ||
256 | + | @Callable(i) | |
257 | + | func withdraw (event) = { | |
258 | + | let callerAddress = toBase58String(i.caller.bytes) | |
259 | + | let balance = getEventBalanceValue(callerAddress, event) | |
260 | + | if ((getEventValueById(event) != callerAddress)) | |
261 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
262 | + | else if ((0 >= balance)) | |
263 | + | then throw("Insufficient balance") | |
264 | + | else if (getEventCanceledValue(event)) | |
265 | + | then throw("Event has been canceled") | |
266 | + | else ScriptResult(WriteSet([DataEntry(getEventBalanceKey(callerAddress, event), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(callerAddress), (balance - ((balance * commission) / 100)), unit), ScriptTransfer(addressFromStringValue(address), ((balance * commission) / 100), unit)])) | |
267 | + | } | |
268 | + | ||
269 | + |
github/deemru/w8io/169f3d6 48.01 ms ◑