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