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