tx · EH3rjfx3jQY3oymHJnWF263qfCuqGB6a9BsYjwNEikZv 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt: -0.01400000 Waves 2020.11.18 16:15 [1270836] smart account 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt > SELF 0.00000000 Waves
{ "type": 13, "id": "EH3rjfx3jQY3oymHJnWF263qfCuqGB6a9BsYjwNEikZv", "fee": 1400000, "feeAssetId": null, "timestamp": 1605705318587, "version": 2, "chainId": 84, "sender": "3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt", "senderPublicKey": "iRqJrgq4rS2ndNGFJoZtKcoTfskkxr3zfTesPWqtKzp", "proofs": [ "5TeZkmwSs9VrfnwmptXq618xRCzyjf5asgnpbFUhKmpzoEAdhEpK2edkNYuW3yg8totYCP13xM6c7ACWXue9ekxV" ], "script": "base64:AAIEAAAAAAAAAA4IAhIDCgEIEgUKAwgBCAAAAAAAAAACAAAAAWkBAAAACHB1cmNoYXNlAAAAAQAAAAhpdGVtTmFtZQQAAAAHcGF5bWVudAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAAHcGF5bWVudAAAAAdhc3NldElkCQAAAgAAAAECAAAAF09ubHkgV2F2ZXMgYXJlIGFjY2VwdGVkBAAAAA9jdXN0b21lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAFcHJpY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAhpdGVtTmFtZQIAAAANX2NvdXBvbl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwCQAAaAAAAAIFAAAAAWEAAAAAAAX14QAJAAACAAAAAQIAAAAOSXRlbSBub3QgZm91bmQDCQAAZgAAAAIFAAAABXByaWNl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ABl9wcmljZQUAAAAFcHJpY2UJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACBQAAAANrZXkCAAAABV9kYXRhBQAAAARkYXRhBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABnHXXVE=", "height": 1270836, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: b9niW7Wp4DXFaiyp3ZKavC26bKpupahBrbcUfu3TdVh Next: BzahxzYZFuNh5PvUKJKQGB4KxPVgrYQC937ZQE1sMCQM Diff:
Old | New | Differences | |
---|---|---|---|
29 | 29 | @Callable(i) | |
30 | 30 | func addItem (title,price,data) = { | |
31 | 31 | let supplierAddress = toBase58String(i.caller.bytes) | |
32 | - | let key = ("item_" + | |
32 | + | let key = ((("item_" + supplierAddress) + "_") + title) | |
33 | 33 | if ((0 >= price)) | |
34 | 34 | then throw("Price cannot be lower than 0") | |
35 | - | else if (isDefined( | |
35 | + | else if (isDefined(getString(this, key))) | |
36 | 36 | then throw("Item exists") | |
37 | 37 | else [StringEntry((key + "_supplier"), supplierAddress), IntegerEntry((key + "_price"), price), StringEntry((key + "_data"), data)] | |
38 | 38 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func purchase (itemName) = { | |
8 | 8 | let payment = value(i.payments[0]) | |
9 | 9 | if (isDefined(payment.assetId)) | |
10 | 10 | then throw("Only Waves are accepted") | |
11 | 11 | else { | |
12 | 12 | let customerAddress = toBase58String(i.caller.bytes) | |
13 | 13 | let price = match getInteger(this, (itemName + "_coupon_price")) { | |
14 | 14 | case a: Int => | |
15 | 15 | (a * 100000000) | |
16 | 16 | case _ => | |
17 | 17 | throw("Item not found") | |
18 | 18 | } | |
19 | 19 | if ((price > payment.amount)) | |
20 | 20 | then throw("Purchase amount is too low") | |
21 | 21 | else if ((payment.amount > price)) | |
22 | 22 | then throw("Purchase amount is too high") | |
23 | 23 | else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)] | |
24 | 24 | } | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | @Callable(i) | |
30 | 30 | func addItem (title,price,data) = { | |
31 | 31 | let supplierAddress = toBase58String(i.caller.bytes) | |
32 | - | let key = ("item_" + | |
32 | + | let key = ((("item_" + supplierAddress) + "_") + title) | |
33 | 33 | if ((0 >= price)) | |
34 | 34 | then throw("Price cannot be lower than 0") | |
35 | - | else if (isDefined( | |
35 | + | else if (isDefined(getString(this, key))) | |
36 | 36 | then throw("Item exists") | |
37 | 37 | else [StringEntry((key + "_supplier"), supplierAddress), IntegerEntry((key + "_price"), price), StringEntry((key + "_data"), data)] | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | @Verifier(tx) | |
42 | 42 | func verify () = true | |
43 | 43 |
github/deemru/w8io/026f985 20.71 ms ◑