tx · GdbycGiuS7F3Quzzvh7eDaSKEVx37R1b3iDMVRAtDJ6S 3N1RM5X2PdS1vH3vmzRrdzQDjAUjMqk2RbJ: -0.01400000 Waves 2020.04.03 15:52 [938018] smart account 3N1RM5X2PdS1vH3vmzRrdzQDjAUjMqk2RbJ > SELF 0.00000000 Waves
{ "type": 13, "id": "GdbycGiuS7F3Quzzvh7eDaSKEVx37R1b3iDMVRAtDJ6S", "fee": 1400000, "feeAssetId": null, "timestamp": 1585918313211, "version": 1, "sender": "3N1RM5X2PdS1vH3vmzRrdzQDjAUjMqk2RbJ", "senderPublicKey": "5xkQSCjfQmc7gqQcXZtkcWTzv4TmPAWcc81im9ngfwK9", "proofs": [ "2E1wUCisx8Sk6izMbGpGrSzXmSN4JY1ZwohMehUg4YE2YUURQ13FKZgGPnvaTvvQv5dKEiREnBE5cZ9yoe5NEmnC" ], "script": "base64:AAIDAAAAAAAAAD0IARIGCgQICAEEEgcKBQgBCAEBEgYKBAgBAQgSAwoBCBIHCgUICAEIARIFCgMIAQESBgoECAEIARIDCgEIAAAAKgAAAAAHYWRkcmVzcwIAAAAjM04xUk01WDJQZFMxdkgzdm16UnJkelFEakFVak1xazJSYkoAAAAADmtleUV2ZW50UHJlZml4AgAAAAJlXwAAAAASa2V5RXZlbnREYXRhUHJlZml4AgAAAAVkYXRhXwAAAAAZa2V5RXZlbnRUaWNrZXRQcmljZVByZWZpeAIAAAAMdGlja2V0UHJpY2VfAAAAABJrZXlFdmVudERhdGVQcmVmaXgCAAAABWRhdGVfAAAAABZrZXlFdmVudEF0dGVuZGVlUHJlZml4AgAAAAJhXwAAAAAYa2V5UHJvZHVjZXJCYWxhbmNlUHJlZml4AgAAAAhiYWxhbmNlXwAAAAAaa2V5RXZlbnRBbW91bnRUaWNrZXRQcmVmaXgCAAAADXRpY2tldEFtb3VudF8AAAAAFmtleUV2ZW50Q2FuY2VsZWRQcmVmaXgCAAAACWNhbmNlbGVkXwAAAAAXa2V5RXZlbnRUaWNrZXR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TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAHYWRkcmVzcwkAAGkAAAACCQAAaAAAAAIFAAAAB2JhbGFuY2UFAAAACmNvbW1pc3Npb24AAAAAAAAAAGQFAAAABHVuaXQFAAAAA25pbAAAAAAC6RZw", "chainId": 84, "height": 938018, "spentComplexity": 0 } View: original | compacted Prev: none Next: HkhrRYJonHFhcs9yvcgcF5ZVuZnQJnLa4DHRgw1Pr9DR Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let address = "3N1RM5X2PdS1vH3vmzRrdzQDjAUjMqk2RbJ" | |
5 | + | ||
6 | + | let keyEventPrefix = "e_" | |
7 | + | ||
8 | + | let keyEventDataPrefix = "data_" | |
9 | + | ||
10 | + | let keyEventTicketPricePrefix = "ticketPrice_" | |
11 | + | ||
12 | + | let keyEventDatePrefix = "date_" | |
13 | + | ||
14 | + | let keyEventAttendeePrefix = "a_" | |
15 | + | ||
16 | + | let keyProducerBalancePrefix = "balance_" | |
17 | + | ||
18 | + | let keyEventAmountTicketPrefix = "ticketAmount_" | |
19 | + | ||
20 | + | let keyEventCanceledPrefix = "canceled_" | |
21 | + | ||
22 | + | let keyEventTicketMaxPrefix = "ticketMax_" | |
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 getEventTicketPriceKey (event,ticketId) = (((keyEventTicketPricePrefix + 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 getEventTicketAmountKey (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 getEventTicketMaxKey (event,ticketId) = (((keyEventTicketMaxPrefix + 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 getEventTicketPriceValue (event,ticketId) = getNumberByKey(getEventTicketPriceKey(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 getEventTicketAmountValue (event,ticketId) = getNumberByKey(getEventTicketAmountKey(event, ticketId)) | |
122 | + | ||
123 | + | ||
124 | + | func getEventCanceledValue (event) = getBoolByKey(getEventCanceledKey(event)) | |
125 | + | ||
126 | + | ||
127 | + | func getEventRequiresIdValue (event) = getBoolByKey(getEventRequiresIdKey(event)) | |
128 | + | ||
129 | + | ||
130 | + | func getEventTicketMaxValue (event,ticketId) = getNumberByKey(getEventTicketMaxKey(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), DataEntry(getEventTicketsKey(event), 0)]) | |
148 | + | } | |
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | @Callable(i) | |
153 | + | func createEventTicket (event,price,description,amountTickets,maxAmount) = { | |
154 | + | let callerAddress = toBase58String(i.caller.bytes) | |
155 | + | let producerAddress = getEventValueById(event) | |
156 | + | let ticketId = getEventTicketsValue(event) | |
157 | + | if ((producerAddress != callerAddress)) | |
158 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
159 | + | else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event))) | |
160 | + | then throw("This event has already happened") | |
161 | + | else if (getEventCanceledValue(event)) | |
162 | + | then throw("This event was canceled") | |
163 | + | else WriteSet([DataEntry(getEventTicketPriceKey(event, ticketId), price), DataEntry(getEventTicketAmountKey(event, ticketId), amountTickets), DataEntry(getEventTicketMaxKey(event, ticketId), maxAmount), DataEntry(getEventTicketDescriptionKey(event, ticketId), description), DataEntry(getEventTicketsKey(event), (getEventTicketsValue(event) + 1))]) | |
164 | + | } | |
165 | + | ||
166 | + | ||
167 | + | ||
168 | + | @Callable(i) | |
169 | + | func purchase (event,ticketId,amount,id) = { | |
170 | + | let pmt = extract(i.payment) | |
171 | + | let userAddress = toBase58String(i.caller.bytes) | |
172 | + | let price = getEventTicketPriceValue(event, ticketId) | |
173 | + | let producerAddress = getEventValueById(event) | |
174 | + | let ticketsLeft = getEventTicketAmountValue(event, ticketId) | |
175 | + | let attendeeKey = "" | |
176 | + | if (isDefined(pmt.assetId)) | |
177 | + | then throw("can use WAVES only at the moment") | |
178 | + | else 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 ((getEventTicketMaxValue(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(getEventTicketAmountKey(event, ticketId), (ticketsLeft - amount))]), TransferSet([ScriptTransfer(addressFromStringValue(address), pmt.amount, unit)])) | |
197 | + | } | |
198 | + | ||
199 | + | ||
200 | + | ||
201 | + | @Callable(i) | |
202 | + | func cancelEvent (event) = { | |
203 | + | let callerAddress = toBase58String(i.caller.bytes) | |
204 | + | if ((getEventValueById(event) != callerAddress)) | |
205 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
206 | + | else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event))) | |
207 | + | then throw("This event has already happened") | |
208 | + | else WriteSet([DataEntry(getEventCanceledKey(event), true)]) | |
209 | + | } | |
210 | + | ||
211 | + | ||
212 | + | ||
213 | + | @Callable(i) | |
214 | + | func checkin (event,attendeeAddress,amount,id,ticketId) = { | |
215 | + | let callerAddress = toBase58String(i.caller.bytes) | |
216 | + | if ((getEventValueById(event) != callerAddress)) | |
217 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
218 | + | else if ((amount > getEventAttendeeValue(attendeeAddress, id, ticketId, event))) | |
219 | + | then throw("You don't have enough tickets.") | |
220 | + | else if (getEventCanceledValue(event)) | |
221 | + | then throw("This event was canceled. You can redeem your ticket using refundTicket function") | |
222 | + | else WriteSet([DataEntry(getEventAttendeeKey(attendeeAddress, id, ticketId, event), (getEventAttendeeValue(attendeeAddress, id, ticketId, event) - amount))]) | |
223 | + | } | |
224 | + | ||
225 | + | ||
226 | + | ||
227 | + | @Callable(i) | |
228 | + | func editEventTickets (event,ticketId,newAmount) = { | |
229 | + | let callerAddress = toBase58String(i.caller.bytes) | |
230 | + | if ((getEventValueById(event) != callerAddress)) | |
231 | + | then throw("Event does not exist, or you don't have the credentials to perform this action") | |
232 | + | else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event))) | |
233 | + | then throw("This event has already happened") | |
234 | + | else if (getEventCanceledValue(event)) | |
235 | + | then throw("This event was already canceled") | |
236 | + | else WriteSet([DataEntry(getEventTicketAmountKey(event, ticketId), newAmount)]) | |
237 | + | } | |
238 | + | ||
239 | + | ||
240 | + | ||
241 | + | @Callable(i) | |
242 | + | func refundTicket (event,amount,id,ticketId) = { | |
243 | + | let attendeeAddress = toBase58String(i.caller.bytes) | |
244 | + | let attendeeValue = getEventAttendeeValue(attendeeAddress, id, ticketId, event) | |
245 | + | if ((getEventValueById(event) == NONE)) | |
246 | + | then throw("The event does not exist") | |
247 | + | else if ((amount > attendeeValue)) | |
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), (attendeeValue - amount))]), TransferSet([ScriptTransfer(addressFromStringValue(attendeeAddress), (amount * attendeeValue), 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/026f985 27.70 ms ◑