tx · 7e5kbaWoC53nzsaAzvo6h1k4Ns157s1jbtXbxauJG8Zf

3MzKq9FC8GAeYxYMGZqPZzrXmRwyyK9eRtU:  -0.01400000 Waves

2020.03.23 15:36 [922004] smart account 3MzKq9FC8GAeYxYMGZqPZzrXmRwyyK9eRtU > SELF 0.00000000 Waves

{ "type": 13, "id": "7e5kbaWoC53nzsaAzvo6h1k4Ns157s1jbtXbxauJG8Zf", "fee": 1400000, "feeAssetId": null, "timestamp": 1584966949567, "version": 1, "sender": "3MzKq9FC8GAeYxYMGZqPZzrXmRwyyK9eRtU", "senderPublicKey": "GXTgD3DifeMCqpyW2oL4fX2vdw49UtqWEesdZpaEuEFB", "proofs": [ "6rCCQmeNphwBrwgBSVeixVcYr1q1H5qqbhJy3sJkrhsfbPzEHPizwuyMzPgdDodkC9T7JSd1uZcp5fJhMALTGjG" ], "script": "base64:AAIDAAAAAAAAAD4IARIGCgQICAEEEggKBggBAQgBARIGCgQIAQEIEgMKAQgSBwoFCAgBCAESBQoDCAEBEgYKBAgBCAESAwoBCAAAACoAAAAAB2FkZHJlc3MCAAAAIzNNektxOUZDOEdBZVl4WU1HWnFQWnpyWG1Sd3l5SzllUnRVAAAAAA5rZXlFdmVudFByZWZpeAIAAAACZV8AAAAAEmtleUV2ZW50RGF0YVByZWZpeAIAAAAFZGF0YV8AAAAAE2tleUV2ZW50UHJpY2VQcmVmaXgCAAAABnByaWNlXwAAAAASa2V5RXZlbnREYXRlUHJlZml4AgAAAAVkYXRlXwAAAAAWa2V5RXZlbnRBdHRlbmRlZVByZWZpeAIAAAACYV8AAAAAGGtleVByb2R1Y2VyQmFsYW5jZVByZWZpeAIAAAAIYmFsYW5jZV8AAAAAGmtleUV2ZW50QW1vdW50VGlja2V0UHJlZml4AgAAAA5hbW91bnRUaWNrZXRzXwAAAAAWa2V5RXZlbnRDYW5jZWxlZFByZWZpeAIAAAAJY2FuY2VsZWRfAAAAABhrZXlFdmVudE1heFRpY2tldHNQcmVmaXgCAAAABG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JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAdhZGRyZXNzCQAAaQAAAAIJAABoAAAAAgUAAAAHYmFsYW5jZQUAAAAKY29tbWlzc2lvbgAAAAAAAAAAZAUAAAAEdW5pdAUAAAADbmlsAAAAALoXCmo=", "chainId": 84, "height": 922004, "spentComplexity": 0 } View: original | compacted Prev: 9yz99oN4uNTxZAerFTwFSag9x17iKPRgKtJSeHJNesAM Next: N6HWQwhxADhAAsekrL8yauRrcuxYmeX2pSCu2FfqDTA Diff:
OldNewDifferences
144144 then throw("The event already exist")
145145 else if ((lastBlock.timestamp > date))
146146 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)])
147+ else WriteSet([DataEntry(getEventKey(producerAddress, title), producerAddress), DataEntry(getEventDataKey(event), data), DataEntry(getEventDateKey(event), date), DataEntry(getEventRequiresIdKey(event), requiresId), DataEntry(getEventTicketsKey(event), 0)])
148148 }
149149
150150
159159 then throw("This event has already happened")
160160 else if (getEventCanceledValue(event))
161161 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)])
162+ else WriteSet([DataEntry(getEventPriceKey(event, ticketId), price), DataEntry(getEventAmountTicketsKey(event, ticketId), amountTickets), DataEntry(getEventMaxTicketsKey(event, ticketId), maxAmount), DataEntry(getEventTicketDescriptionKey(event, ticketId), description), DataEntry(getEventTicketsKey(event), (getEventTicketsValue(event) + 1))])
163163 }
164164
165165
167167 @Callable(i)
168168 func purchase (event,ticketId,amount,id) = {
169169 let pmt = extract(i.payment)
170+ let userAddress = toBase58String(i.caller.bytes)
171+ let price = getEventPriceValue(event, ticketId)
172+ let producerAddress = getEventValueById(event)
173+ let ticketsLeft = getEventAmountTicketsValue(event, ticketId)
174+ let attendeeKey = ""
170175 if (isDefined(pmt.assetId))
171176 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- }
177+ else if ((producerAddress == NONE))
178+ then throw("Event does not exist")
179+ else if (((price * amount) > pmt.amount))
180+ then throw(((("You did not send enough money. You sent: " + toString(pmt.amount)) + ". Expected: ") + toString((amount * price))))
181+ else if ((pmt.amount > (price * amount)))
182+ then throw(((("You send too much money. You sent: " + toString(pmt.amount)) + ". Total price: ") + toString((amount * price))))
183+ else if ((0 > (ticketsLeft - amount)))
184+ then throw("Not enough tickets left")
185+ else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event)))
186+ then throw("This event has already happened")
187+ else if (getEventCanceledValue(event))
188+ then throw("This event was canceled")
189+ else if (if (getEventRequiresIdValue(event))
190+ then (id == "")
191+ else false)
192+ then throw("This event requires that you register with a personal ID")
193+ else if ((getEventMaxTicketsValue(event, ticketId) > (getEventAttendeeValue(userAddress, id, ticketId, event) + amount)))
194+ then throw("Amount of Tickets exceeds maximum amount per attendee")
195+ 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)]))
198196 }
199197
200198
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let address = "3MzKq9FC8GAeYxYMGZqPZzrXmRwyyK9eRtU"
55
66 let keyEventPrefix = "e_"
77
88 let keyEventDataPrefix = "data_"
99
1010 let keyEventPricePrefix = "price_"
1111
1212 let keyEventDatePrefix = "date_"
1313
1414 let keyEventAttendeePrefix = "a_"
1515
1616 let keyProducerBalancePrefix = "balance_"
1717
1818 let keyEventAmountTicketPrefix = "amountTickets_"
1919
2020 let keyEventCanceledPrefix = "canceled_"
2121
2222 let keyEventMaxTicketsPrefix = "max_"
2323
2424 let keyEventRequiresIdPrefix = "requiresId_"
2525
2626 let keyEventTicketDescriptionPrefix = "ticketDescription_"
2727
2828 let keyEventTicketsPrefix = "tickets_"
2929
3030 let NONE = "none"
3131
3232 let commission = 5
3333
3434 func getNumberByKey (key) = {
3535 let num = match getInteger(this, key) {
3636 case a: Int =>
3737 a
3838 case _ =>
3939 0
4040 }
4141 num
4242 }
4343
4444
4545 func getStrByKey (key) = {
4646 let str = match getString(this, key) {
4747 case a: String =>
4848 a
4949 case _ =>
5050 NONE
5151 }
5252 str
5353 }
5454
5555
5656 func getBoolByKey (key) = {
5757 let bool = match getBoolean(this, key) {
5858 case a: Boolean =>
5959 a
6060 case _ =>
6161 false
6262 }
6363 bool
6464 }
6565
6666
6767 func getEventKey (producer,title) = (keyEventPrefix + toBase58String(sha256(toBytes((producer + title)))))
6868
6969
7070 func getEventDataKey (event) = (keyEventDataPrefix + event)
7171
7272
7373 func getEventPriceKey (event,ticketId) = (((keyEventPricePrefix + toString(ticketId)) + "_") + event)
7474
7575
7676 func getEventDateKey (event) = (keyEventDatePrefix + event)
7777
7878
7979 func getEventAttendeeKey (user,id,ticketId,event) = (((((keyEventAttendeePrefix + toBase58String(sha256(toBytes((user + id))))) + "_") + toString(ticketId)) + "_") + event)
8080
8181
8282 func getEventBalanceKey (account,event) = (((keyProducerBalancePrefix + account) + "_") + event)
8383
8484
8585 func getEventAmountTicketsKey (event,ticketId) = (((keyEventAmountTicketPrefix + toString(ticketId)) + "_") + event)
8686
8787
8888 func getEventCanceledKey (event) = (keyEventCanceledPrefix + event)
8989
9090
9191 func getEventRequiresIdKey (event) = (keyEventRequiresIdPrefix + event)
9292
9393
9494 func getEventMaxTicketsKey (event,ticketId) = (((keyEventMaxTicketsPrefix + toString(ticketId)) + "_") + event)
9595
9696
9797 func getEventTicketDescriptionKey (event,ticketId) = (((keyEventTicketDescriptionPrefix + toString(ticketId)) + "_") + event)
9898
9999
100100 func getEventTicketsKey (event) = (keyEventTicketsPrefix + event)
101101
102102
103103 func getEventValueById (item) = getStrByKey(item)
104104
105105
106106 func getEventValue (producer,title) = getStrByKey(getEventKey(producer, title))
107107
108108
109109 func getEventPriceValue (event,ticketId) = getNumberByKey(getEventPriceKey(event, ticketId))
110110
111111
112112 func getEventDateValue (event) = getNumberByKey(getEventDateKey(event))
113113
114114
115115 func getEventAttendeeValue (user,id,ticketId,event) = getNumberByKey(getEventAttendeeKey(user, id, ticketId, event))
116116
117117
118118 func getEventBalanceValue (account,event) = getNumberByKey(getEventBalanceKey(account, event))
119119
120120
121121 func getEventAmountTicketsValue (event,ticketId) = getNumberByKey(getEventAmountTicketsKey(event, ticketId))
122122
123123
124124 func getEventCanceledValue (event) = getBoolByKey(getEventCanceledKey(event))
125125
126126
127127 func getEventRequiresIdValue (event) = getBoolByKey(getEventRequiresIdKey(event))
128128
129129
130130 func getEventMaxTicketsValue (event,ticketId) = getNumberByKey(getEventMaxTicketsKey(event, ticketId))
131131
132132
133133 func getEventTicketDescriptionValue (event,ticketId) = getStrByKey(getEventTicketDescriptionKey(event, ticketId))
134134
135135
136136 func getEventTicketsValue (event) = getNumberByKey(getEventTicketsKey(event))
137137
138138
139139 @Callable(i)
140140 func createEvent (title,data,date,requiresId) = {
141141 let producerAddress = toBase58String(i.caller.bytes)
142142 let event = getEventKey(producerAddress, title)
143143 if ((getEventValue(producerAddress, title) != NONE))
144144 then throw("The event already exist")
145145 else if ((lastBlock.timestamp > date))
146146 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)])
147+ else WriteSet([DataEntry(getEventKey(producerAddress, title), producerAddress), DataEntry(getEventDataKey(event), data), DataEntry(getEventDateKey(event), date), DataEntry(getEventRequiresIdKey(event), requiresId), DataEntry(getEventTicketsKey(event), 0)])
148148 }
149149
150150
151151
152152 @Callable(i)
153153 func createEventTicket (event,ticketId,price,description,amountTickets,maxAmount) = {
154154 let callerAddress = toBase58String(i.caller.bytes)
155155 let producerAddress = getEventValueById(event)
156156 if ((producerAddress != callerAddress))
157157 then throw("Event does not exist, or you don't have the credentials to perform this action")
158158 else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event)))
159159 then throw("This event has already happened")
160160 else if (getEventCanceledValue(event))
161161 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)])
162+ else WriteSet([DataEntry(getEventPriceKey(event, ticketId), price), DataEntry(getEventAmountTicketsKey(event, ticketId), amountTickets), DataEntry(getEventMaxTicketsKey(event, ticketId), maxAmount), DataEntry(getEventTicketDescriptionKey(event, ticketId), description), DataEntry(getEventTicketsKey(event), (getEventTicketsValue(event) + 1))])
163163 }
164164
165165
166166
167167 @Callable(i)
168168 func purchase (event,ticketId,amount,id) = {
169169 let pmt = extract(i.payment)
170+ let userAddress = toBase58String(i.caller.bytes)
171+ let price = getEventPriceValue(event, ticketId)
172+ let producerAddress = getEventValueById(event)
173+ let ticketsLeft = getEventAmountTicketsValue(event, ticketId)
174+ let attendeeKey = ""
170175 if (isDefined(pmt.assetId))
171176 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- }
177+ else if ((producerAddress == NONE))
178+ then throw("Event does not exist")
179+ else if (((price * amount) > pmt.amount))
180+ then throw(((("You did not send enough money. You sent: " + toString(pmt.amount)) + ". Expected: ") + toString((amount * price))))
181+ else if ((pmt.amount > (price * amount)))
182+ then throw(((("You send too much money. You sent: " + toString(pmt.amount)) + ". Total price: ") + toString((amount * price))))
183+ else if ((0 > (ticketsLeft - amount)))
184+ then throw("Not enough tickets left")
185+ else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event)))
186+ then throw("This event has already happened")
187+ else if (getEventCanceledValue(event))
188+ then throw("This event was canceled")
189+ else if (if (getEventRequiresIdValue(event))
190+ then (id == "")
191+ else false)
192+ then throw("This event requires that you register with a personal ID")
193+ else if ((getEventMaxTicketsValue(event, ticketId) > (getEventAttendeeValue(userAddress, id, ticketId, event) + amount)))
194+ then throw("Amount of Tickets exceeds maximum amount per attendee")
195+ 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)]))
198196 }
199197
200198
201199
202200 @Callable(i)
203201 func cancelEvent (event) = {
204202 let callerAddress = toBase58String(i.caller.bytes)
205203 if ((getEventValueById(event) != callerAddress))
206204 then throw("Event does not exist, or you don't have the credentials to perform this action")
207205 else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event)))
208206 then throw("This event has already happened")
209207 else WriteSet([DataEntry(getEventCanceledKey(event), true)])
210208 }
211209
212210
213211
214212 @Callable(i)
215213 func checkin (event,attendeeAddress,amount,id,ticketId) = {
216214 let callerAddress = toBase58String(i.caller.bytes)
217215 if ((getEventValueById(event) != callerAddress))
218216 then throw("Event does not exist, or you don't have the credentials to perform this action")
219217 else if ((amount > getEventAttendeeValue(attendeeAddress, id, ticketId, event)))
220218 then throw("You don't have enough tickets.")
221219 else if (getEventCanceledValue(event))
222220 then throw("This event was canceled. You can redeem your ticket using refundTicket function")
223221 else WriteSet([DataEntry(getEventAttendeeKey(attendeeAddress, id, ticketId, event), (getEventAttendeeValue(attendeeAddress, id, ticketId, event) - amount))])
224222 }
225223
226224
227225
228226 @Callable(i)
229227 func editEventTickets (event,ticketId,newAmount) = {
230228 let callerAddress = toBase58String(i.caller.bytes)
231229 if ((getEventValueById(event) != callerAddress))
232230 then throw("Event does not exist, or you don't have the credentials to perform this action")
233231 else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event)))
234232 then throw("This event has already happened")
235233 else if (getEventCanceledValue(event))
236234 then throw("This event was already canceled")
237235 else WriteSet([DataEntry(getEventAmountTicketsKey(event, ticketId), newAmount)])
238236 }
239237
240238
241239
242240 @Callable(i)
243241 func refundTicket (event,amount,id,ticketId) = {
244242 let attendeeAddress = toBase58String(i.caller.bytes)
245243 if ((getEventValueById(event) == NONE))
246244 then throw("The event does not exist")
247245 else if ((amount > getEventAttendeeValue(attendeeAddress, id, ticketId, event)))
248246 then throw("You don't have enough registered tickets with this address")
249247 else if (((lastBlock.timestamp + 15000000) > getEventDateValue(event)))
250248 then throw("This event has already happened")
251249 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)]))
252250 }
253251
254252
255253
256254 @Callable(i)
257255 func withdraw (event) = {
258256 let callerAddress = toBase58String(i.caller.bytes)
259257 let balance = getEventBalanceValue(callerAddress, event)
260258 if ((getEventValueById(event) != callerAddress))
261259 then throw("Event does not exist, or you don't have the credentials to perform this action")
262260 else if ((0 >= balance))
263261 then throw("Insufficient balance")
264262 else if (getEventCanceledValue(event))
265263 then throw("Event has been canceled")
266264 else ScriptResult(WriteSet([DataEntry(getEventBalanceKey(callerAddress, event), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(callerAddress), (balance - ((balance * commission) / 100)), unit), ScriptTransfer(addressFromStringValue(address), ((balance * commission) / 100), unit)]))
267265 }
268266
269267

github/deemru/w8io/169f3d6 
46.59 ms