tx · 2GPEYKwJvnr9nZBjfsZmnWakXDFFHfq7Y5rBFinzZfJs 3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV: -0.01400000 Waves 2022.02.03 21:21 [1907775] smart account 3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV > SELF 0.00000000 Waves
{ "type": 13, "id": "2GPEYKwJvnr9nZBjfsZmnWakXDFFHfq7Y5rBFinzZfJs", "fee": 1400000, "feeAssetId": null, "timestamp": 1643912493580, "version": 2, "chainId": 84, "sender": "3Muxd5JEAQz655DDi2yiZxSQ63jVJJHrQyV", "senderPublicKey": "7ycxALbgfzht9z36iWCgRauBfWzQGSgkc3HMwu7wDwNX", "proofs": [ "3pvtjEi3Rh6ygLeZdZU4EDbtv3PxDtT2TM3YoDs1NkN1BxnTFT9qDyT1yzekKTiLhSw7pdoAduQvSC2AVoc42PMh" ], "script": "base64:AAIFAAAAAAAAAb8IAhIDCgEIEgcKBQgBAQgIEgMKAQgSAwoBCBIDCgEIGgcKAUESAnR4GgsKAUISBnZlcmlmeRoJCgFhEgROT05FGg0KAWISCGN1c3RvbWVyGg0KAWMSCHN1cHBsaWVyGg8KAWQSCmVyaWNQdWJLZXkaEwoBZRIOZ2V0U3RyaW5nQnlLZXkaCAoBZhIDa2V5GgwKAWcSByRtYXRjaDAaBgoBaBIBYRoQCgFpEgtnZXRJdGVtSGFzaBoKCgFqEgV0aXRsZRoPCgFrEgpjb21ib1RpdGxlGg8KAWwSCmdldE5hbWVLZXkaCQoBbRIEdHlwZRoJCgFuEgRhZGRyGhcKAW8SEmdldEl0ZW1TdXBwbGllcktleRoJCgFwEgRpdGVtGhQKAXESD2dldEl0ZW1QcmljZUtleRoTCgFyEg5nZXRJdGVtRGF0YUtleRoZCgFzEhRnZXRWYWx1ZUl0ZW1TdXBwbGllchoMCgF0EgdpdGVtS2V5GgYKAXUSAWkaCgoBdhIFcHJpY2UaCgoBdxIFY291bnQaCQoBeBIEZGF0YRoKCgF5EgVvd25lchoUC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wkAAAAAAAACCAUAAAABdQAAAA9jYWxsZXJQdWJsaWNLZXkFAAAAAWQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAABZgUAAAADbmlsCQAAAgAAAAECAAAAHE9ubHkgRXJpYyBjYW4gZGVsZXRlIGVudHJpZXMAAAABdQEAAAAKdW5yZWdpc3RlcgAAAAEAAAABbQMDCQAAAAAAAAIFAAAAAW0FAAAAAWMGCQAAAAAAAAIFAAAAAW0FAAAAAWIEAAAAAW4JAAJYAAAAAQgIBQAAAAF1AAAABmNhbGxlcgAAAAVieXRlcwkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAABbAAAAAIFAAAAAW0FAAAAAW4FAAAAA25pbAkAAAIAAAABAgAAABBJbGxlZ2FsIGFyZ3VtZW50AAAAAQAAAAFBAQAAAAFCAAAAAAkAAfQAAAADCAUAAAABQQAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAUEAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAABQQAAAA9zZW5kZXJQdWJsaWNLZXk58UtS", "height": 1907775, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5n4L4P4mEvQbREkk8V4orvgL9nubYxLRWDsLTaNboMJg Next: 3t9wnpqUSTFHACaADAqJ1z8KsbnJbUMEScAXipZFGj8i Diff:
Old | New | Differences | |
---|---|---|---|
56 | 56 | ||
57 | 57 | ||
58 | 58 | @Callable(i) | |
59 | - | func createItem (title,price,data) = { | |
59 | + | func createItem (title,price,count,data,owner) = { | |
60 | 60 | let supplierAddress = toBase58String(i.caller.bytes) | |
61 | 61 | let item = getItemHash(supplierAddress, title) | |
62 | 62 | if ((0 >= price)) | |
63 | - | then throw("Price can not be negative value") | |
63 | + | then throw("Price can not be negative value or zero") | |
64 | 64 | else if ((getValueItemSupplier(item) != NONE)) | |
65 | 65 | then throw("Item already exists") | |
66 | - | else [StringEntry(getItemSupplierKey(item), supplierAddress), IntegerEntry(getItemPriceKey(item), price), StringEntry(getItemDataKey(item), data)] | |
66 | + | else [StringEntry(getItemSupplierKey(item), supplierAddress), IntegerEntry(getItemPriceKey(item), price), IntegerEntry(getItemPriceKey(item), count), StringEntry(getItemDataKey(item), data)] | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let NONE = "NONE" | |
5 | 5 | ||
6 | 6 | let customer = "CUSTOMER" | |
7 | 7 | ||
8 | 8 | let supplier = "SUPPLIER" | |
9 | 9 | ||
10 | 10 | let ericPubKey = base58'8haEN2a7ZmkzawLmnr5rFX14X1oHi5kjt8NQUDNjSDLG' | |
11 | 11 | ||
12 | 12 | func getStringByKey (key) = match getString(key) { | |
13 | 13 | case a: String => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | NONE | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getItemHash (supplier,title) = { | |
21 | 21 | let comboTitle = (supplier + title) | |
22 | 22 | ("item_" + toBase58String(sha256(toBytes(comboTitle)))) | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func getNameKey (type,addr) = (((type + "_") + addr) + "_name") | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func getItemSupplierKey (item) = (item + "_owner") | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func getItemPriceKey (item) = (item + "_price") | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func getItemDataKey (item) = (item + "_data") | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func getValueItemSupplier (item) = { | |
39 | 39 | let itemKey = getItemSupplierKey(item) | |
40 | 40 | getStringByKey(itemKey) | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | @Callable(i) | |
45 | 45 | func register (type) = { | |
46 | 46 | let addr = toBase58String(i.caller.bytes) | |
47 | 47 | if (if (isDefined(type)) | |
48 | 48 | then if ((type == customer)) | |
49 | 49 | then true | |
50 | 50 | else (type == supplier) | |
51 | 51 | else false) | |
52 | 52 | then [StringEntry(getNameKey(type, addr), addr)] | |
53 | 53 | else throw("Invalid func parameters") | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | ||
58 | 58 | @Callable(i) | |
59 | - | func createItem (title,price,data) = { | |
59 | + | func createItem (title,price,count,data,owner) = { | |
60 | 60 | let supplierAddress = toBase58String(i.caller.bytes) | |
61 | 61 | let item = getItemHash(supplierAddress, title) | |
62 | 62 | if ((0 >= price)) | |
63 | - | then throw("Price can not be negative value") | |
63 | + | then throw("Price can not be negative value or zero") | |
64 | 64 | else if ((getValueItemSupplier(item) != NONE)) | |
65 | 65 | then throw("Item already exists") | |
66 | - | else [StringEntry(getItemSupplierKey(item), supplierAddress), IntegerEntry(getItemPriceKey(item), price), StringEntry(getItemDataKey(item), data)] | |
66 | + | else [StringEntry(getItemSupplierKey(item), supplierAddress), IntegerEntry(getItemPriceKey(item), price), IntegerEntry(getItemPriceKey(item), count), StringEntry(getItemDataKey(item), data)] | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | ||
71 | 71 | @Callable(i) | |
72 | 72 | func deleteItem (title) = { | |
73 | 73 | let supplierAddress = toBase58String(i.caller.bytes) | |
74 | 74 | let item = getItemHash(supplierAddress, title) | |
75 | 75 | if ((getValueItemSupplier(item) != NONE)) | |
76 | 76 | then [DeleteEntry(getItemSupplierKey(item)), DeleteEntry(getItemPriceKey(item)), DeleteEntry(getItemDataKey(item))] | |
77 | 77 | else throw("No such item present") | |
78 | 78 | } | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | 82 | @Callable(i) | |
83 | 83 | func deleteEntry (key) = if ((i.callerPublicKey == ericPubKey)) | |
84 | 84 | then [DeleteEntry(key)] | |
85 | 85 | else throw("Only Eric can delete entries") | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(i) | |
90 | 90 | func unregister (type) = if (if ((type == supplier)) | |
91 | 91 | then true | |
92 | 92 | else (type == customer)) | |
93 | 93 | then { | |
94 | 94 | let addr = toBase58String(i.caller.bytes) | |
95 | 95 | [DeleteEntry(getNameKey(type, addr))] | |
96 | 96 | } | |
97 | 97 | else throw("Illegal argument") | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | @Verifier(tx) | |
101 | 101 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
102 | 102 |
github/deemru/w8io/169f3d6 43.11 ms ◑