tx · 5o51ushF1W1CqvgAb6LRRcu86APcoS4PXu5uW4LxZ1KS 3Mz6zqqBMkE7DWq2qYjoc75jqXr4rADunfv: -0.01400000 Waves 2021.03.16 17:43 [1440404] smart account 3Mz6zqqBMkE7DWq2qYjoc75jqXr4rADunfv > SELF 0.00000000 Waves
{ "type": 13, "id": "5o51ushF1W1CqvgAb6LRRcu86APcoS4PXu5uW4LxZ1KS", "fee": 1400000, "feeAssetId": null, "timestamp": 1615905782185, "version": 2, "chainId": 84, "sender": "3Mz6zqqBMkE7DWq2qYjoc75jqXr4rADunfv", "senderPublicKey": "2vP8gqLvBxSiqzeDLEs1FTiL4V79GvhVT64PXEtTewFH", "proofs": [ "rHi4ghrGJQmaFCSWfmcV5wosb9MuYNdAsbgH7aUpSReYrwPaaePdE2ZxnYCV7C42P99scfR74VLbZ2gM6pyb8op" ], "script": "base64:AAIEAAAAAAAAAAkIAhIFCgMIAQgAAAANAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ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AABXRpdGxlAAAABXByaWNlAAAABGRhdGEEAAAAD3N1cHBsaWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAARpdGVtCQEAAAAKZ2V0S2V5SXRlbQAAAAIFAAAAD3N1cHBsaWVyQWRkcmVzcwUAAAAFdGl0bGUDCQAAZwAAAAIAAAAAAAAAAAAFAAAABXByaWNlCQAAAgAAAAECAAAAEVByaWNlIHNldCB0b28gbG93AwkBAAAAAiE9AAAAAgkBAAAAFGdldFZhbHVlSXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAETk9ORQkAAAIAAAABAgAAAA9BbHJlYWR5IGV4aXN0ICEJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAAD3N1cHBsaWVyQWRkcmVzcwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEFAAAABGl0ZW0FAAAABXByaWNlCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEFAAAAA25pbAAAAAB/3B7e", "height": 1440404, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ai4vsxJX4EWNS9Xc7d7XmGjX1hhgLn1ANRnS2QSgcnys Next: BBDYNtiuVbUYNJ9xqcvjisPch1parDCG32j5aMjDtRjF Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | - | {-# | |
3 | - | ||
4 | - | ||
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let NONE = "none" | |
5 | 5 | ||
6 | - | let var2 = say() | |
7 | - | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
6 | + | func getNumberByKey (key) = { | |
7 | + | let num = match getInteger(this, key) { | |
8 | + | case a: Int => | |
9 | + | a | |
10 | + | case _ => | |
11 | + | 0 | |
12 | + | } | |
13 | + | num | |
14 | + | } | |
15 | + | ||
16 | + | ||
17 | + | func getStrByKey (key) = { | |
18 | + | let str = match getString(this, key) { | |
19 | + | case a: String => | |
20 | + | a | |
21 | + | case _ => | |
22 | + | NONE | |
23 | + | } | |
24 | + | str | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func getKeyItemPrice (item) = (item + "_price") | |
29 | + | ||
30 | + | ||
31 | + | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
32 | + | ||
33 | + | ||
34 | + | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
35 | + | ||
36 | + | ||
37 | + | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
38 | + | ||
39 | + | ||
40 | + | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
41 | + | ||
42 | + | ||
43 | + | func getKeyItemData (item) = (item + "_data") | |
44 | + | ||
45 | + | ||
46 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
47 | + | ||
48 | + | ||
49 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
50 | + | ||
51 | + | ||
52 | + | func getKeyBalanceSupplierAccount (account) = (account + "_balance") | |
53 | + | ||
54 | + | ||
55 | + | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplierAccount(account)) | |
56 | + | ||
57 | + | ||
58 | + | @Callable(i) | |
59 | + | func addItem (title,price,data) = { | |
60 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
61 | + | let item = getKeyItem(supplierAddress, title) | |
62 | + | if ((0 >= price)) | |
63 | + | then throw("Price set too low") | |
64 | + | else if ((getValueItemSupplier(item) != NONE)) | |
65 | + | then throw("Already exist !") | |
66 | + | else [StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data)] | |
67 | + | } | |
68 | + | ||
69 | + |
github/deemru/w8io/026f985 41.13 ms ◑