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:AAIEAAAAAAAAADoIAhIDCgEIEgYKBAgBCAESBwoFCAgBCAESAwoBCBIDCgEIEgMKAQgSBAoCCAgSBAoCCAgSBQoDCAgIAAAAOAAAAAAETk9ORQIAAAAETk9ORQAAAAAGVk9URVJTAAAAAAAAAAADAAAAAAZRVU9SVU0AAAAAAAAAAAIAAAAACEZFQVRVUkVEAgAAAAhmZWF0dXJlZAAAAAAIREVMSVNURUQCAAAACGRlbGlzdGVkAAAAAAZWT1RJTkcCAAAABnZvdGluZwAAAAAGUkVWRUFMAgAAAAZyZXZlYWwAAAAACEFQUFJPVkFMAgAAAAhhcHByb3ZhbAAAAAAIUkVKRUNURUQCAAAACHJlamVjdGVkAAAAAAhBQ0NFUFRFRAIAAAAIYWNjZXB0ZWQBAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUBAAAAD2dldEludG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zQ291bnQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAA1uZXdWb3Rlc0NvdW50CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAABBnZXRLZXlJdGVtU3RhdHVzAAAAAQUAAAAEaXRlbQUAAAAJbmV3U3RhdHVzBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAXQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABBJc3N1ZVRyYW5zYWN0aW9uBAAAAAF0BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkH6PlXSg==", "height": 1640827, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ErLZKPsS2yFuuFFBBLKyibzhrzBoPbCigYLrABfrnhr9 Next: 8kE6jpJGwLU2848SwtVhDrXhMCa7K5mY6WUSpf98YY24 Diff:
OldNewDifferences
109109 func getKeyPurchaseTimestamp (purchase) = (purchase + "_timestamp")
110110
111111
112-func getKeyCoupon (assetId) = ("coupon_" + assetId)
112+func getKeyPurchaseAssetId (purchase) = (purchase + "_assetId")
113113
114114
115-func getKeyCouponItem (coupon) = (coupon + "_item")
115+func getKeyCouponPurchase (assetId) = (("coupon_" + assetId) + "_purchase")
116116
117117
118118 func getValueSupplierBalance (supplier) = getIntegerByKey(getKeySupplierBalance(supplier))
137137
138138
139139 func getValuePurchaseTimestamp (purchase) = getIntegerByKey(getKeyPurchaseTimestamp(purchase))
140+
141+
142+func getValuePurchaseAssetId (purchase) = getStringByKey(getKeyPurchaseAssetId(purchase))
140143
141144
142145 func getValueItemPrice (item) = getIntegerValue(this, getKeyItemPrice(item))
294297
295298
296299 @Callable(i)
297-func acceptPurchase (purchase) = {
300+func acceptPurchase (purchase,couponAssetId) = {
298301 let caller = toBase58String(i.caller.bytes)
299302 let status = getValuePurchaseStatus(purchase)
300303 let supplier = getValuePurchaseSupplier(purchase)
312315 then throw("Coupon expired")
313316 else {
314317 let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
318+ let keyPurchaseAssetId = getKeyPurchaseAssetId(purchase)
315319 let keySupplierBalance = getKeySupplierBalance(supplier)
316320 let keyItemSoldCounter = getKeyItemSoldCounter(item)
321+ let keyCouponPurchase = getKeyCouponPurchase(couponAssetId)
317322 let amount = getValuePurchaseAmount(purchase)
318323 let supplierBalance = (getValueSupplierBalance(supplier) + amount)
319324 let itemSoldCounter = (getValueItemSoldCounter(item) + 1)
320325 let user = getValuePurchaseUser(purchase)
321326 let address = addressFromStringValue(user)
322-[IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter)]
327+[StringEntry(keyCouponPurchase, purchase), StringEntry(keyPurchaseAssetId, couponAssetId), IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter)]
323328 }
324329 }
325330
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "NONE"
55
66 let VOTERS = 3
77
88 let QUORUM = 2
99
1010 let FEATURED = "featured"
1111
1212 let DELISTED = "delisted"
1313
1414 let VOTING = "voting"
1515
1616 let REVEAL = "reveal"
1717
1818 let APPROVAL = "approval"
1919
2020 let REJECTED = "rejected"
2121
2222 let ACCEPTED = "accepted"
2323
2424 func getStringByKey (key) = match getString(this, key) {
2525 case a: String =>
2626 a
2727 case _ =>
2828 NONE
2929 }
3030
3131
3232 func getIntegerByKey (key) = match getInteger(this, key) {
3333 case a: Int =>
3434 a
3535 case _ =>
3636 0
3737 }
3838
3939
4040 func getKeySupplierAccount (account) = (account + "_account")
4141
4242
4343 func getSupplierAccount (account) = getStringByKey(getKeySupplierAccount(account))
4444
4545
4646 func getKeyItem (supplier,title) = {
4747 let supplierTitle = (supplier + title)
4848 ("item_" + toBase58String(sha256(toBytes(supplierTitle))))
4949 }
5050
5151
5252 func getKeyItemSupplier (item) = (item + "_owner")
5353
5454
5555 func getKeyItemTitle (item) = (item + "_title")
5656
5757
5858 func getKeyItemPrice (item) = (item + "_price")
5959
6060
6161 func getKeyItemData (item) = (item + "_data")
6262
6363
6464 func getKeyItemExpireDate (item) = (item + "_expiredate")
6565
6666
6767 func getKeyItemSoldCounter (item) = (item + "_sold")
6868
6969
7070 func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
7171
7272
7373 func getKeyCommitsCount (item) = (item + "_cmtcnt")
7474
7575
7676 func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
7777
7878
7979 func getKeyItemStatus (item) = (item + "_status")
8080
8181
8282 func getKeyVotesCount (item,vote) = ((item + "_res:") + vote)
8383
8484
8585 func getKeySupplierBalance (supplier) = (supplier + "_balance")
8686
8787
8888 func getKeyUserItemCounter (user,item) = (((user + "_") + item) + "_counter")
8989
9090
9191 func genPurchaseKey (supplier,item,user,counter) = ("purchase_" + toBase58String(sha256(toBytes(((((((supplier + "_") + item) + "_") + user) + "_") + toString(counter))))))
9292
9393
9494 func getKeyPurchaseStatus (purchase) = (purchase + "_status")
9595
9696
9797 func getKeyPurchaseItem (purchase) = (purchase + "_item")
9898
9999
100100 func getKeyPurchaseSupplier (purchase) = (purchase + "_supplier")
101101
102102
103103 func getKeyPurchaseUser (purchase) = (purchase + "_user")
104104
105105
106106 func getKeyPurchaseAmount (purchase) = (purchase + "_amount")
107107
108108
109109 func getKeyPurchaseTimestamp (purchase) = (purchase + "_timestamp")
110110
111111
112-func getKeyCoupon (assetId) = ("coupon_" + assetId)
112+func getKeyPurchaseAssetId (purchase) = (purchase + "_assetId")
113113
114114
115-func getKeyCouponItem (coupon) = (coupon + "_item")
115+func getKeyCouponPurchase (assetId) = (("coupon_" + assetId) + "_purchase")
116116
117117
118118 func getValueSupplierBalance (supplier) = getIntegerByKey(getKeySupplierBalance(supplier))
119119
120120
121121 func getValueUserItemCounter (user,item) = getIntegerByKey(getKeyUserItemCounter(user, item))
122122
123123
124124 func getValuePurchaseStatus (purchase) = getStringByKey(getKeyPurchaseStatus(purchase))
125125
126126
127127 func getValuePurchaseItem (purchase) = getStringValue(this, getKeyPurchaseItem(purchase))
128128
129129
130130 func getValuePurchaseSupplier (purchase) = getStringValue(this, getKeyPurchaseSupplier(purchase))
131131
132132
133133 func getValuePurchaseUser (purchase) = getStringValue(this, getKeyPurchaseUser(purchase))
134134
135135
136136 func getValuePurchaseAmount (purchase) = getIntegerValue(this, getKeyPurchaseAmount(purchase))
137137
138138
139139 func getValuePurchaseTimestamp (purchase) = getIntegerByKey(getKeyPurchaseTimestamp(purchase))
140+
141+
142+func getValuePurchaseAssetId (purchase) = getStringByKey(getKeyPurchaseAssetId(purchase))
140143
141144
142145 func getValueItemPrice (item) = getIntegerValue(this, getKeyItemPrice(item))
143146
144147
145148 func getValueItemSupplier (item) = getStringByKey(getKeyItemSupplier(item))
146149
147150
148151 func getValueItemExpireTime (item) = getIntegerByKey(getKeyItemExpireDate(item))
149152
150153
151154 func getValueItemTitle (item) = getStringByKey(getKeyItemTitle(item))
152155
153156
154157 func getValueItemSoldCounter (item) = getIntegerByKey(getKeyItemSoldCounter(item))
155158
156159
157160 func getValueCommit (item,user) = getStringByKey(getKeyCommit(item, user))
158161
159162
160163 func getValueCommitsCount (item) = getIntegerByKey(getKeyCommitsCount(item))
161164
162165
163166 func getValueReveal (item,user) = getStringByKey(getKeyReveal(item, user))
164167
165168
166169 func getValueItemStatus (item) = getStringByKey(getKeyItemStatus(item))
167170
168171
169172 func getValueVotesCount (item,vote) = getIntegerByKey(getKeyVotesCount(item, vote))
170173
171174
172175 @Callable(i)
173176 func registerSupplier (data) = {
174177 let supplier = toBase58String(i.caller.bytes)
175178 let account = getSupplierAccount(supplier)
176179 if ((account != NONE))
177180 then throw("This address has already registred as supplier")
178181 else [StringEntry(getKeySupplierAccount(supplier), data)]
179182 }
180183
181184
182185
183186 @Callable(i)
184187 func addItem (title,price,data,expire) = {
185188 let supplier = toBase58String(i.caller.bytes)
186189 let account = getSupplierAccount(supplier)
187190 let item = getKeyItem(supplier, title)
188191 if ((account == NONE))
189192 then throw("You should register as supplier to add an item")
190193 else if ((0 >= price))
191194 then throw("Purchase amount cannot be less than item price")
192195 else if ((getValueItemSupplier(item) != NONE))
193196 then throw("An item already exists")
194197 else [StringEntry(getKeyItemSupplier(item), supplier), StringEntry(getKeyItemTitle(item), title), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), IntegerEntry(getKeyItemExpireDate(item), expire)]
195198 }
196199
197200
198201
199202 @Callable(i)
200203 func updateItem (item,title,price,data,expire) = {
201204 let supplier = toBase58String(i.caller.bytes)
202205 let account = getSupplierAccount(supplier)
203206 let itemSupplier = getValueItemSupplier(item)
204207 if ((account == NONE))
205208 then throw("You should register as supplier to remove an item")
206209 else if (if ((item == NONE))
207210 then true
208211 else (supplier != itemSupplier))
209212 then throw(("You don't owned item " + item))
210213 else [StringEntry(getKeyItemTitle(item), title), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), IntegerEntry(getKeyItemExpireDate(item), expire)]
211214 }
212215
213216
214217
215218 @Callable(i)
216219 func removeItem (item) = {
217220 let supplier = toBase58String(i.caller.bytes)
218221 let account = getSupplierAccount(supplier)
219222 let itemSupplier = getValueItemSupplier(item)
220223 if ((account == NONE))
221224 then throw("You should register as supplier to remove an item")
222225 else if (if ((item == NONE))
223226 then true
224227 else (supplier != itemSupplier))
225228 then throw(("You don't owned item " + item))
226229 else [DeleteEntry(getKeyItemSupplier(item)), DeleteEntry(getKeyItemTitle(item)), DeleteEntry(getKeyItemPrice(item)), DeleteEntry(getKeyItemData(item)), DeleteEntry(getKeyItemExpireDate(item))]
227230 }
228231
229232
230233
231234 @Callable(i)
232235 func purchase (item) = {
233236 let pmt = i.payments[0]
234237 if (isDefined(pmt.assetId))
235238 then throw("You can buy tokens only with Waves tokens")
236239 else {
237240 let user = toBase58String(i.caller.bytes)
238241 let price = getValueItemPrice(item)
239242 let supplier = getValueItemSupplier(item)
240243 let expire = getValueItemExpireTime(item)
241244 if (if ((expire > 0))
242245 then (lastBlock.timestamp >= expire)
243246 else false)
244247 then throw("Coupon expired")
245248 else if ((price > pmt.amount))
246249 then throw("Purchase amount cannot be less than item price")
247250 else if ((pmt.amount > price))
248251 then throw("Purchase amount cannot be higher than item price")
249252 else if ((supplier == NONE))
250253 then throw("Supplier does not exists")
251254 else {
252255 let keyUserItemCounter = getKeyUserItemCounter(user, item)
253256 let userItemCounter = (getValueUserItemCounter(user, item) + 1)
254257 let purchase = genPurchaseKey(supplier, item, user, userItemCounter)
255258 let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
256259 let keyPurchaseItem = getKeyPurchaseItem(purchase)
257260 let keyPurchaseSupplier = getKeyPurchaseSupplier(purchase)
258261 let keyPurchaseUser = getKeyPurchaseUser(purchase)
259262 let keyPurchaseAmount = getKeyPurchaseAmount(purchase)
260263 let keyPurchaseTimestamp = getKeyPurchaseTimestamp(purchase)
261264 [IntegerEntry(keyUserItemCounter, userItemCounter), StringEntry(keyPurchaseStatus, APPROVAL), StringEntry(keyPurchaseItem, item), StringEntry(keyPurchaseSupplier, supplier), StringEntry(keyPurchaseUser, user), IntegerEntry(keyPurchaseAmount, pmt.amount), IntegerEntry(keyPurchaseTimestamp, lastBlock.timestamp)]
262265 }
263266 }
264267 }
265268
266269
267270
268271 @Callable(i)
269272 func rejectPurchase (purchase) = {
270273 let caller = toBase58String(i.caller.bytes)
271274 let status = getValuePurchaseStatus(purchase)
272275 let supplier = getValuePurchaseSupplier(purchase)
273276 let item = getValuePurchaseItem(purchase)
274277 if (if ((supplier == NONE))
275278 then true
276279 else (caller != supplier))
277280 then throw("Your are not the owner of this item")
278281 else if ((status != APPROVAL))
279282 then throw("You cannot reject this purchased")
280283 else {
281284 let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
282285 let keyPurchaseAmount = getKeyPurchaseAmount(purchase)
283286 let keySupplierBalance = getKeySupplierBalance(supplier)
284287 let keyItemSoldCounter = getKeyItemSoldCounter(item)
285288 let user = getValuePurchaseUser(purchase)
286289 let amount = getValuePurchaseAmount(purchase)
287290 let supplierBalance = (getValueSupplierBalance(supplier) - amount)
288291 let itemSoldCounter = (getValueItemSoldCounter(item) - 1)
289292 let address = addressFromStringValue(user)
290293 [StringEntry(keyPurchaseStatus, REJECTED), IntegerEntry(keyPurchaseAmount, 0), ScriptTransfer(address, amount, unit)]
291294 }
292295 }
293296
294297
295298
296299 @Callable(i)
297-func acceptPurchase (purchase) = {
300+func acceptPurchase (purchase,couponAssetId) = {
298301 let caller = toBase58String(i.caller.bytes)
299302 let status = getValuePurchaseStatus(purchase)
300303 let supplier = getValuePurchaseSupplier(purchase)
301304 let item = getValuePurchaseItem(purchase)
302305 let expire = getValueItemExpireTime(item)
303306 if (if ((supplier == NONE))
304307 then true
305308 else (caller != supplier))
306309 then throw("Your are not the owner of this item")
307310 else if ((status != APPROVAL))
308311 then throw("You cannot reject this purchased")
309312 else if (if ((expire > 0))
310313 then (lastBlock.timestamp >= expire)
311314 else false)
312315 then throw("Coupon expired")
313316 else {
314317 let keyPurchaseStatus = getKeyPurchaseStatus(purchase)
318+ let keyPurchaseAssetId = getKeyPurchaseAssetId(purchase)
315319 let keySupplierBalance = getKeySupplierBalance(supplier)
316320 let keyItemSoldCounter = getKeyItemSoldCounter(item)
321+ let keyCouponPurchase = getKeyCouponPurchase(couponAssetId)
317322 let amount = getValuePurchaseAmount(purchase)
318323 let supplierBalance = (getValueSupplierBalance(supplier) + amount)
319324 let itemSoldCounter = (getValueItemSoldCounter(item) + 1)
320325 let user = getValuePurchaseUser(purchase)
321326 let address = addressFromStringValue(user)
322-[IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter)]
327+[StringEntry(keyCouponPurchase, purchase), StringEntry(keyPurchaseAssetId, couponAssetId), IntegerEntry(keySupplierBalance, supplierBalance), IntegerEntry(keyItemSoldCounter, itemSoldCounter)]
323328 }
324329 }
325330
326331
327332
328333 @Callable(i)
329334 func voteCommit (item,hash) = {
330335 let user = toBase58String(i.caller.bytes)
331336 let commitsCount = getValueCommitsCount(item)
332337 let status = getValueItemStatus(item)
333338 if ((commitsCount >= VOTERS))
334339 then throw("Reached max number of voters")
335340 else if ((getValueCommit(item, user) != NONE))
336341 then throw("You voted already")
337342 else if ((getKeyItemSupplier(item) == NONE))
338343 then throw("Item does not exists")
339344 else if (if ((status != NONE))
340345 then (status != VOTING)
341346 else false)
342347 then throw("Voting is not active for this item now")
343348 else {
344349 let newStatus = if ((commitsCount == VOTERS))
345350 then REVEAL
346351 else VOTING
347352 [StringEntry(getKeyCommit(item, user), hash), IntegerEntry(getKeyCommitsCount(item), (commitsCount + 1)), StringEntry(getKeyItemStatus(item), newStatus)]
348353 }
349354 }
350355
351356
352357
353358 @Callable(i)
354359 func voteReveal (item,vote,salt) = {
355360 let user = toBase58String(i.caller.bytes)
356361 let status = getValueItemStatus(item)
357362 let newVotesCount = (getValueVotesCount(item, vote) + 1)
358363 let saltedVote = toBase58String(sha256(toBytes(((item + vote) + salt))))
359364 if ((saltedVote != getValueCommit(item, user)))
360365 then throw("Reveal data is not valid")
361366 else if ((VOTERS > getValueCommitsCount(item)))
362367 then throw("Max number of voters not reached")
363368 else if ((getValueReveal(item, user) != NONE))
364369 then throw("You voted already")
365370 else if (if ((status != VOTING))
366371 then (status != REVEAL)
367372 else false)
368373 then throw("Voting is not active for this item now")
369374 else if (if ((vote != FEATURED))
370375 then (vote != DELISTED)
371376 else false)
372377 then throw("Provided voting option is incorrect")
373378 else {
374379 let newStatus = if ((newVotesCount >= QUORUM))
375380 then vote
376381 else REVEAL
377382 [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVotesCount(item, user), newVotesCount), StringEntry(getKeyItemStatus(item), newStatus)]
378383 }
379384 }
380385
381386
382387 @Verifier(tx)
383388 func verify () = match tx {
384389 case t: SetScriptTransaction =>
385390 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
386391 case t: IssueTransaction =>
387392 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
388393 case t: TransferTransaction =>
389394 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
390395 case _ =>
391396 false
392397 }
393398

github/deemru/w8io/026f985 
61.90 ms