tx · 4gToKbsJEKEGMMreUjCt2doApnvAthjzUwF6aT8tw6YC 3MovmZoJtqutkf49oGXHzABSMUQ7HU5Dcg7: -0.01400000 Waves 2021.08.02 17:19 [1640827] smart account 3MovmZoJtqutkf49oGXHzABSMUQ7HU5Dcg7 > SELF 0.00000000 Waves
{ "type": 13, "id": "4gToKbsJEKEGMMreUjCt2doApnvAthjzUwF6aT8tw6YC", "fee": 1400000, "feeAssetId": null, "timestamp": 1627914095300, "version": 2, "chainId": 84, "sender": "3MovmZoJtqutkf49oGXHzABSMUQ7HU5Dcg7", "senderPublicKey": "3tp5fNYyPi4jMnkf6s1k4kBqvJ7nm57SxzvLyi8RkxT2", "proofs": [ "4LEDjjYgMoEj3UdEbqKeT36dnxa9faPkbD5iRkPcdoiA9MhU7ojxXHCqBW7TC4jRvmyrd6anja79s1PgEx6B8EjX" ], "script": "base64:AAIEAAAAAAAAADoIAhIDCgEIEgYKBAgBCAESBwoFCAgBCAESAwoBCBIDCgEIEgMKAQgSBAoCCAgSBAoCCAgSBQoDCAgIAAAAOAAAAAAETk9ORQIAAAAETk9ORQAAAAAGVk9URVJTAAAAAAAAAAADAAAAAAZRVU9SVU0AAAAAAAAAAAIAAAAACEZFQVRVUkVEAgAAAAhmZWF0dXJlZAAAAAAIREVMSVNURUQCAAAACGRlbGlzdGVkAAAAAAZWT1RJTkcCAAAABnZvdGluZwAAAAAGUkVWRUFMAgAAAAZyZXZlYWwAAAAACEFQUFJPVkFMAgAAAAhhcHByb3ZhbAAAAAAIUkVKRUNURUQCAAAACHJlamVjdGVkAAAAAAhBQ0NFUFRFRAIAAAAIYWNjZXB0ZWQBAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUBAAAAD2dldEludGV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Q291bnQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAA1uZXdWb3Rlc0NvdW50CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAABBnZXRLZXlJdGVtU3RhdHVzAAAAAQUAAAAEaXRlbQUAAAAJbmV3U3RhdHVzBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAXQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABBJc3N1ZVRyYW5zYWN0aW9uBAAAAAF0BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkH6PlXSg==", "height": 1640827, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ErLZKPsS2yFuuFFBBLKyibzhrzBoPbCigYLrABfrnhr9 Next: 8kE6jpJGwLU2848SwtVhDrXhMCa7K5mY6WUSpf98YY24 Diff:
Old | New | Differences | |
---|---|---|---|
109 | 109 | func getKeyPurchaseTimestamp (purchase) = (purchase + "_timestamp") | |
110 | 110 | ||
111 | 111 | ||
112 | - | func | |
112 | + | func getKeyPurchaseAssetId (purchase) = (purchase + "_assetId") | |
113 | 113 | ||
114 | 114 | ||
115 | - | func | |
115 | + | func getKeyCouponPurchase (assetId) = (("coupon_" + assetId) + "_purchase") | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func getValueSupplierBalance (supplier) = getIntegerByKey(getKeySupplierBalance(supplier)) | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func getValuePurchaseTimestamp (purchase) = getIntegerByKey(getKeyPurchaseTimestamp(purchase)) | |
140 | + | ||
141 | + | ||
142 | + | func getValuePurchaseAssetId (purchase) = getStringByKey(getKeyPurchaseAssetId(purchase)) | |
140 | 143 | ||
141 | 144 | ||
142 | 145 | func getValueItemPrice (item) = getIntegerValue(this, getKeyItemPrice(item)) | |
294 | 297 | ||
295 | 298 | ||
296 | 299 | @Callable(i) | |
297 | - | func acceptPurchase (purchase) = { | |
300 | + | func acceptPurchase (purchase,couponAssetId) = { | |
298 | 301 | let caller = toBase58String(i.caller.bytes) | |
299 | 302 | let status = getValuePurchaseStatus(purchase) | |
300 | 303 | let supplier = getValuePurchaseSupplier(purchase) | |
312 | 315 | then throw("Coupon expired") | |
313 | 316 | else { | |
314 | 317 | let keyPurchaseStatus = getKeyPurchaseStatus(purchase) | |
318 | + | let keyPurchaseAssetId = getKeyPurchaseAssetId(purchase) | |
315 | 319 | let keySupplierBalance = getKeySupplierBalance(supplier) | |
316 | 320 | let keyItemSoldCounter = getKeyItemSoldCounter(item) | |
321 | + | let keyCouponPurchase = getKeyCouponPurchase(couponAssetId) | |
317 | 322 | let amount = getValuePurchaseAmount(purchase) | |
318 | 323 | let supplierBalance = (getValueSupplierBalance(supplier) + amount) | |
319 | 324 | let itemSoldCounter = (getValueItemSoldCounter(item) + 1) | |
320 | 325 | let user = getValuePurchaseUser(purchase) | |
321 | 326 | let address = addressFromStringValue(user) | |
322 | - | [IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter)] | |
327 | + | [StringEntry(keyCouponPurchase, purchase), StringEntry(keyPurchaseAssetId, couponAssetId), IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter)] | |
323 | 328 | } | |
324 | 329 | } | |
325 | 330 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let NONE = "NONE" | |
5 | 5 | ||
6 | 6 | let VOTERS = 3 | |
7 | 7 | ||
8 | 8 | let QUORUM = 2 | |
9 | 9 | ||
10 | 10 | let FEATURED = "featured" | |
11 | 11 | ||
12 | 12 | let DELISTED = "delisted" | |
13 | 13 | ||
14 | 14 | let VOTING = "voting" | |
15 | 15 | ||
16 | 16 | let REVEAL = "reveal" | |
17 | 17 | ||
18 | 18 | let APPROVAL = "approval" | |
19 | 19 | ||
20 | 20 | let REJECTED = "rejected" | |
21 | 21 | ||
22 | 22 | let ACCEPTED = "accepted" | |
23 | 23 | ||
24 | 24 | func getStringByKey (key) = match getString(this, key) { | |
25 | 25 | case a: String => | |
26 | 26 | a | |
27 | 27 | case _ => | |
28 | 28 | NONE | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func getIntegerByKey (key) = match getInteger(this, key) { | |
33 | 33 | case a: Int => | |
34 | 34 | a | |
35 | 35 | case _ => | |
36 | 36 | 0 | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getKeySupplierAccount (account) = (account + "_account") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getSupplierAccount (account) = getStringByKey(getKeySupplierAccount(account)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getKeyItem (supplier,title) = { | |
47 | 47 | let supplierTitle = (supplier + title) | |
48 | 48 | ("item_" + toBase58String(sha256(toBytes(supplierTitle)))) | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getKeyItemSupplier (item) = (item + "_owner") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getKeyItemTitle (item) = (item + "_title") | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func getKeyItemPrice (item) = (item + "_price") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func getKeyItemData (item) = (item + "_data") | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func getKeyItemExpireDate (item) = (item + "_expiredate") | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func getKeyItemSoldCounter (item) = (item + "_sold") | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getKeyCommitsCount (item) = (item + "_cmtcnt") | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func getKeyItemStatus (item) = (item + "_status") | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func getKeyVotesCount (item,vote) = ((item + "_res:") + vote) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func getKeySupplierBalance (supplier) = (supplier + "_balance") | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func getKeyUserItemCounter (user,item) = (((user + "_") + item) + "_counter") | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func genPurchaseKey (supplier,item,user,counter) = ("purchase_" + toBase58String(sha256(toBytes(((((((supplier + "_") + item) + "_") + user) + "_") + toString(counter)))))) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func getKeyPurchaseStatus (purchase) = (purchase + "_status") | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func getKeyPurchaseItem (purchase) = (purchase + "_item") | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func getKeyPurchaseSupplier (purchase) = (purchase + "_supplier") | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func getKeyPurchaseUser (purchase) = (purchase + "_user") | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func getKeyPurchaseAmount (purchase) = (purchase + "_amount") | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func getKeyPurchaseTimestamp (purchase) = (purchase + "_timestamp") | |
110 | 110 | ||
111 | 111 | ||
112 | - | func | |
112 | + | func getKeyPurchaseAssetId (purchase) = (purchase + "_assetId") | |
113 | 113 | ||
114 | 114 | ||
115 | - | func | |
115 | + | func getKeyCouponPurchase (assetId) = (("coupon_" + assetId) + "_purchase") | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func getValueSupplierBalance (supplier) = getIntegerByKey(getKeySupplierBalance(supplier)) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func getValueUserItemCounter (user,item) = getIntegerByKey(getKeyUserItemCounter(user, item)) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func getValuePurchaseStatus (purchase) = getStringByKey(getKeyPurchaseStatus(purchase)) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func getValuePurchaseItem (purchase) = getStringValue(this, getKeyPurchaseItem(purchase)) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func getValuePurchaseSupplier (purchase) = getStringValue(this, getKeyPurchaseSupplier(purchase)) | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func getValuePurchaseUser (purchase) = getStringValue(this, getKeyPurchaseUser(purchase)) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func getValuePurchaseAmount (purchase) = getIntegerValue(this, getKeyPurchaseAmount(purchase)) | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func getValuePurchaseTimestamp (purchase) = getIntegerByKey(getKeyPurchaseTimestamp(purchase)) | |
140 | + | ||
141 | + | ||
142 | + | func getValuePurchaseAssetId (purchase) = getStringByKey(getKeyPurchaseAssetId(purchase)) | |
140 | 143 | ||
141 | 144 | ||
142 | 145 | func getValueItemPrice (item) = getIntegerValue(this, getKeyItemPrice(item)) | |
143 | 146 | ||
144 | 147 | ||
145 | 148 | func getValueItemSupplier (item) = getStringByKey(getKeyItemSupplier(item)) | |
146 | 149 | ||
147 | 150 | ||
148 | 151 | func getValueItemExpireTime (item) = getIntegerByKey(getKeyItemExpireDate(item)) | |
149 | 152 | ||
150 | 153 | ||
151 | 154 | func getValueItemTitle (item) = getStringByKey(getKeyItemTitle(item)) | |
152 | 155 | ||
153 | 156 | ||
154 | 157 | func getValueItemSoldCounter (item) = getIntegerByKey(getKeyItemSoldCounter(item)) | |
155 | 158 | ||
156 | 159 | ||
157 | 160 | func getValueCommit (item,user) = getStringByKey(getKeyCommit(item, user)) | |
158 | 161 | ||
159 | 162 | ||
160 | 163 | func getValueCommitsCount (item) = getIntegerByKey(getKeyCommitsCount(item)) | |
161 | 164 | ||
162 | 165 | ||
163 | 166 | func getValueReveal (item,user) = getStringByKey(getKeyReveal(item, user)) | |
164 | 167 | ||
165 | 168 | ||
166 | 169 | func getValueItemStatus (item) = getStringByKey(getKeyItemStatus(item)) | |
167 | 170 | ||
168 | 171 | ||
169 | 172 | func getValueVotesCount (item,vote) = getIntegerByKey(getKeyVotesCount(item, vote)) | |
170 | 173 | ||
171 | 174 | ||
172 | 175 | @Callable(i) | |
173 | 176 | func registerSupplier (data) = { | |
174 | 177 | let supplier = toBase58String(i.caller.bytes) | |
175 | 178 | let account = getSupplierAccount(supplier) | |
176 | 179 | if ((account != NONE)) | |
177 | 180 | then throw("This address has already registred as supplier") | |
178 | 181 | else [StringEntry(getKeySupplierAccount(supplier), data)] | |
179 | 182 | } | |
180 | 183 | ||
181 | 184 | ||
182 | 185 | ||
183 | 186 | @Callable(i) | |
184 | 187 | func addItem (title,price,data,expire) = { | |
185 | 188 | let supplier = toBase58String(i.caller.bytes) | |
186 | 189 | let account = getSupplierAccount(supplier) | |
187 | 190 | let item = getKeyItem(supplier, title) | |
188 | 191 | if ((account == NONE)) | |
189 | 192 | then throw("You should register as supplier to add an item") | |
190 | 193 | else if ((0 >= price)) | |
191 | 194 | then throw("Purchase amount cannot be less than item price") | |
192 | 195 | else if ((getValueItemSupplier(item) != NONE)) | |
193 | 196 | then throw("An item already exists") | |
194 | 197 | else [StringEntry(getKeyItemSupplier(item), supplier), StringEntry(getKeyItemTitle(item), title), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), IntegerEntry(getKeyItemExpireDate(item), expire)] | |
195 | 198 | } | |
196 | 199 | ||
197 | 200 | ||
198 | 201 | ||
199 | 202 | @Callable(i) | |
200 | 203 | func updateItem (item,title,price,data,expire) = { | |
201 | 204 | let supplier = toBase58String(i.caller.bytes) | |
202 | 205 | let account = getSupplierAccount(supplier) | |
203 | 206 | let itemSupplier = getValueItemSupplier(item) | |
204 | 207 | if ((account == NONE)) | |
205 | 208 | then throw("You should register as supplier to remove an item") | |
206 | 209 | else if (if ((item == NONE)) | |
207 | 210 | then true | |
208 | 211 | else (supplier != itemSupplier)) | |
209 | 212 | then throw(("You don't owned item " + item)) | |
210 | 213 | else [StringEntry(getKeyItemTitle(item), title), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), IntegerEntry(getKeyItemExpireDate(item), expire)] | |
211 | 214 | } | |
212 | 215 | ||
213 | 216 | ||
214 | 217 | ||
215 | 218 | @Callable(i) | |
216 | 219 | func removeItem (item) = { | |
217 | 220 | let supplier = toBase58String(i.caller.bytes) | |
218 | 221 | let account = getSupplierAccount(supplier) | |
219 | 222 | let itemSupplier = getValueItemSupplier(item) | |
220 | 223 | if ((account == NONE)) | |
221 | 224 | then throw("You should register as supplier to remove an item") | |
222 | 225 | else if (if ((item == NONE)) | |
223 | 226 | then true | |
224 | 227 | else (supplier != itemSupplier)) | |
225 | 228 | then throw(("You don't owned item " + item)) | |
226 | 229 | else [DeleteEntry(getKeyItemSupplier(item)), DeleteEntry(getKeyItemTitle(item)), DeleteEntry(getKeyItemPrice(item)), DeleteEntry(getKeyItemData(item)), DeleteEntry(getKeyItemExpireDate(item))] | |
227 | 230 | } | |
228 | 231 | ||
229 | 232 | ||
230 | 233 | ||
231 | 234 | @Callable(i) | |
232 | 235 | func purchase (item) = { | |
233 | 236 | let pmt = i.payments[0] | |
234 | 237 | if (isDefined(pmt.assetId)) | |
235 | 238 | then throw("You can buy tokens only with Waves tokens") | |
236 | 239 | else { | |
237 | 240 | let user = toBase58String(i.caller.bytes) | |
238 | 241 | let price = getValueItemPrice(item) | |
239 | 242 | let supplier = getValueItemSupplier(item) | |
240 | 243 | let expire = getValueItemExpireTime(item) | |
241 | 244 | if (if ((expire > 0)) | |
242 | 245 | then (lastBlock.timestamp >= expire) | |
243 | 246 | else false) | |
244 | 247 | then throw("Coupon expired") | |
245 | 248 | else if ((price > pmt.amount)) | |
246 | 249 | then throw("Purchase amount cannot be less than item price") | |
247 | 250 | else if ((pmt.amount > price)) | |
248 | 251 | then throw("Purchase amount cannot be higher than item price") | |
249 | 252 | else if ((supplier == NONE)) | |
250 | 253 | then throw("Supplier does not exists") | |
251 | 254 | else { | |
252 | 255 | let keyUserItemCounter = getKeyUserItemCounter(user, item) | |
253 | 256 | let userItemCounter = (getValueUserItemCounter(user, item) + 1) | |
254 | 257 | let purchase = genPurchaseKey(supplier, item, user, userItemCounter) | |
255 | 258 | let keyPurchaseStatus = getKeyPurchaseStatus(purchase) | |
256 | 259 | let keyPurchaseItem = getKeyPurchaseItem(purchase) | |
257 | 260 | let keyPurchaseSupplier = getKeyPurchaseSupplier(purchase) | |
258 | 261 | let keyPurchaseUser = getKeyPurchaseUser(purchase) | |
259 | 262 | let keyPurchaseAmount = getKeyPurchaseAmount(purchase) | |
260 | 263 | let keyPurchaseTimestamp = getKeyPurchaseTimestamp(purchase) | |
261 | 264 | [IntegerEntry(keyUserItemCounter, userItemCounter), StringEntry(keyPurchaseStatus, APPROVAL), StringEntry(keyPurchaseItem, item), StringEntry(keyPurchaseSupplier, supplier), StringEntry(keyPurchaseUser, user), IntegerEntry(keyPurchaseAmount, pmt.amount), IntegerEntry(keyPurchaseTimestamp, lastBlock.timestamp)] | |
262 | 265 | } | |
263 | 266 | } | |
264 | 267 | } | |
265 | 268 | ||
266 | 269 | ||
267 | 270 | ||
268 | 271 | @Callable(i) | |
269 | 272 | func rejectPurchase (purchase) = { | |
270 | 273 | let caller = toBase58String(i.caller.bytes) | |
271 | 274 | let status = getValuePurchaseStatus(purchase) | |
272 | 275 | let supplier = getValuePurchaseSupplier(purchase) | |
273 | 276 | let item = getValuePurchaseItem(purchase) | |
274 | 277 | if (if ((supplier == NONE)) | |
275 | 278 | then true | |
276 | 279 | else (caller != supplier)) | |
277 | 280 | then throw("Your are not the owner of this item") | |
278 | 281 | else if ((status != APPROVAL)) | |
279 | 282 | then throw("You cannot reject this purchased") | |
280 | 283 | else { | |
281 | 284 | let keyPurchaseStatus = getKeyPurchaseStatus(purchase) | |
282 | 285 | let keyPurchaseAmount = getKeyPurchaseAmount(purchase) | |
283 | 286 | let keySupplierBalance = getKeySupplierBalance(supplier) | |
284 | 287 | let keyItemSoldCounter = getKeyItemSoldCounter(item) | |
285 | 288 | let user = getValuePurchaseUser(purchase) | |
286 | 289 | let amount = getValuePurchaseAmount(purchase) | |
287 | 290 | let supplierBalance = (getValueSupplierBalance(supplier) - amount) | |
288 | 291 | let itemSoldCounter = (getValueItemSoldCounter(item) - 1) | |
289 | 292 | let address = addressFromStringValue(user) | |
290 | 293 | [StringEntry(keyPurchaseStatus, REJECTED), IntegerEntry(keyPurchaseAmount, 0), ScriptTransfer(address, amount, unit)] | |
291 | 294 | } | |
292 | 295 | } | |
293 | 296 | ||
294 | 297 | ||
295 | 298 | ||
296 | 299 | @Callable(i) | |
297 | - | func acceptPurchase (purchase) = { | |
300 | + | func acceptPurchase (purchase,couponAssetId) = { | |
298 | 301 | let caller = toBase58String(i.caller.bytes) | |
299 | 302 | let status = getValuePurchaseStatus(purchase) | |
300 | 303 | let supplier = getValuePurchaseSupplier(purchase) | |
301 | 304 | let item = getValuePurchaseItem(purchase) | |
302 | 305 | let expire = getValueItemExpireTime(item) | |
303 | 306 | if (if ((supplier == NONE)) | |
304 | 307 | then true | |
305 | 308 | else (caller != supplier)) | |
306 | 309 | then throw("Your are not the owner of this item") | |
307 | 310 | else if ((status != APPROVAL)) | |
308 | 311 | then throw("You cannot reject this purchased") | |
309 | 312 | else if (if ((expire > 0)) | |
310 | 313 | then (lastBlock.timestamp >= expire) | |
311 | 314 | else false) | |
312 | 315 | then throw("Coupon expired") | |
313 | 316 | else { | |
314 | 317 | let keyPurchaseStatus = getKeyPurchaseStatus(purchase) | |
318 | + | let keyPurchaseAssetId = getKeyPurchaseAssetId(purchase) | |
315 | 319 | let keySupplierBalance = getKeySupplierBalance(supplier) | |
316 | 320 | let keyItemSoldCounter = getKeyItemSoldCounter(item) | |
321 | + | let keyCouponPurchase = getKeyCouponPurchase(couponAssetId) | |
317 | 322 | let amount = getValuePurchaseAmount(purchase) | |
318 | 323 | let supplierBalance = (getValueSupplierBalance(supplier) + amount) | |
319 | 324 | let itemSoldCounter = (getValueItemSoldCounter(item) + 1) | |
320 | 325 | let user = getValuePurchaseUser(purchase) | |
321 | 326 | let address = addressFromStringValue(user) | |
322 | - | [IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter)] | |
327 | + | [StringEntry(keyCouponPurchase, purchase), StringEntry(keyPurchaseAssetId, couponAssetId), IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter)] | |
323 | 328 | } | |
324 | 329 | } | |
325 | 330 | ||
326 | 331 | ||
327 | 332 | ||
328 | 333 | @Callable(i) | |
329 | 334 | func voteCommit (item,hash) = { | |
330 | 335 | let user = toBase58String(i.caller.bytes) | |
331 | 336 | let commitsCount = getValueCommitsCount(item) | |
332 | 337 | let status = getValueItemStatus(item) | |
333 | 338 | if ((commitsCount >= VOTERS)) | |
334 | 339 | then throw("Reached max number of voters") | |
335 | 340 | else if ((getValueCommit(item, user) != NONE)) | |
336 | 341 | then throw("You voted already") | |
337 | 342 | else if ((getKeyItemSupplier(item) == NONE)) | |
338 | 343 | then throw("Item does not exists") | |
339 | 344 | else if (if ((status != NONE)) | |
340 | 345 | then (status != VOTING) | |
341 | 346 | else false) | |
342 | 347 | then throw("Voting is not active for this item now") | |
343 | 348 | else { | |
344 | 349 | let newStatus = if ((commitsCount == VOTERS)) | |
345 | 350 | then REVEAL | |
346 | 351 | else VOTING | |
347 | 352 | [StringEntry(getKeyCommit(item, user), hash), IntegerEntry(getKeyCommitsCount(item), (commitsCount + 1)), StringEntry(getKeyItemStatus(item), newStatus)] | |
348 | 353 | } | |
349 | 354 | } | |
350 | 355 | ||
351 | 356 | ||
352 | 357 | ||
353 | 358 | @Callable(i) | |
354 | 359 | func voteReveal (item,vote,salt) = { | |
355 | 360 | let user = toBase58String(i.caller.bytes) | |
356 | 361 | let status = getValueItemStatus(item) | |
357 | 362 | let newVotesCount = (getValueVotesCount(item, vote) + 1) | |
358 | 363 | let saltedVote = toBase58String(sha256(toBytes(((item + vote) + salt)))) | |
359 | 364 | if ((saltedVote != getValueCommit(item, user))) | |
360 | 365 | then throw("Reveal data is not valid") | |
361 | 366 | else if ((VOTERS > getValueCommitsCount(item))) | |
362 | 367 | then throw("Max number of voters not reached") | |
363 | 368 | else if ((getValueReveal(item, user) != NONE)) | |
364 | 369 | then throw("You voted already") | |
365 | 370 | else if (if ((status != VOTING)) | |
366 | 371 | then (status != REVEAL) | |
367 | 372 | else false) | |
368 | 373 | then throw("Voting is not active for this item now") | |
369 | 374 | else if (if ((vote != FEATURED)) | |
370 | 375 | then (vote != DELISTED) | |
371 | 376 | else false) | |
372 | 377 | then throw("Provided voting option is incorrect") | |
373 | 378 | else { | |
374 | 379 | let newStatus = if ((newVotesCount >= QUORUM)) | |
375 | 380 | then vote | |
376 | 381 | else REVEAL | |
377 | 382 | [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVotesCount(item, user), newVotesCount), StringEntry(getKeyItemStatus(item), newStatus)] | |
378 | 383 | } | |
379 | 384 | } | |
380 | 385 | ||
381 | 386 | ||
382 | 387 | @Verifier(tx) | |
383 | 388 | func verify () = match tx { | |
384 | 389 | case t: SetScriptTransaction => | |
385 | 390 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
386 | 391 | case t: IssueTransaction => | |
387 | 392 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
388 | 393 | case t: TransferTransaction => | |
389 | 394 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
390 | 395 | case _ => | |
391 | 396 | false | |
392 | 397 | } | |
393 | 398 |
github/deemru/w8io/026f985 61.90 ms ◑