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