tx · 27oWiqu31qw6PhgYKEt3iskg2NuFbxdp9hSFLzHjHJL5
3N81Dk1WuUv7UKt3inqWVYN81J8VHjoV3MC: -0.01400000 Waves
2022.02.17 18:25 [1927789] smart account 3N81Dk1WuUv7UKt3inqWVYN81J8VHjoV3MC > SELF 0.00000000 Waves
{
"type": 13,
"id": "27oWiqu31qw6PhgYKEt3iskg2NuFbxdp9hSFLzHjHJL5",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1645111575091,
"version": 2,
"chainId": 84,
"sender": "3N81Dk1WuUv7UKt3inqWVYN81J8VHjoV3MC",
"senderPublicKey": "5vXdNgZ1TR8AAzcnLumQTQYzcU3AwHj91bZTtiE3roBE",
"proofs": [
"51pvJ12NynQGKsNdD8gTus1fdJfAxi35TAF7cdGv9ae8SovKEheVyyZdTM4G8wBm8xuMwWgok3dt2YQ7SK8AnXHr"
],
"script": "base64:AAIDAAAAAAAAAAkIARIFCgMIAQgAAAAHAAAAAAROT05FAgAAAAROT05FAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAAAABAAAACmdldEtleUl0ZW0AAAACAAAACHN1cHBsaWVyAAAABXRpdGxlBAAAAA5zdXBwbGllclRpdHRsZQkAASwAAAACBQAAAAhzdXBwbGllcgUAAAAFdGl0bGUJAAEsAAAAAgIAAAAFaXRlbV8JAAJYAAAAAQkAAfcAAAABCQABmwAAAAEFAAAADnN1cHBsaWVyVGl0dGxlAQAAABJnZXRLZXlJdGVtU3VwcGxpZXIAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAGX293bmVyAQAAAA9nZXRLZXlJdGVtUHJpY2UAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAGX293bmVyAQ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bAAAAAA7hPO7",
"height": 1927789,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 6VL7wY7M7pfKXQMWAmES1pD1CAaSiLC5wyGzqRp1RfxR
Next: 68ihjaaAahY2XytQLUGTa8A7Ksjhtxhc2JnfGB9qaTsP
Diff:
Old | New | | Differences |
---|
26 | 26 | | func getKeyItemData (item) = (item + "_data") |
---|
27 | 27 | | |
---|
28 | 28 | | |
---|
29 | | - | func getValueItemSupplier (account) = account |
---|
| 29 | + | func getValueItemSupplier (account) = match getString(this, account) { |
---|
| 30 | + | case a: String => |
---|
| 31 | + | a |
---|
| 32 | + | case _ => |
---|
| 33 | + | "NONE" |
---|
| 34 | + | } |
---|
30 | 35 | | |
---|
31 | 36 | | |
---|
32 | 37 | | @Callable(i) |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let NONE = "NONE" |
---|
5 | 5 | | |
---|
6 | 6 | | func getStringByKey (key) = match getString(this, key) { |
---|
7 | 7 | | case a: String => |
---|
8 | 8 | | a |
---|
9 | 9 | | case _ => |
---|
10 | 10 | | "" |
---|
11 | 11 | | } |
---|
12 | 12 | | |
---|
13 | 13 | | |
---|
14 | 14 | | func getKeyItem (supplier,title) = { |
---|
15 | 15 | | let supplierTittle = (supplier + title) |
---|
16 | 16 | | ("item_" + toBase58String(sha256(toBytes(supplierTittle)))) |
---|
17 | 17 | | } |
---|
18 | 18 | | |
---|
19 | 19 | | |
---|
20 | 20 | | func getKeyItemSupplier (item) = (item + "_owner") |
---|
21 | 21 | | |
---|
22 | 22 | | |
---|
23 | 23 | | func getKeyItemPrice (item) = (item + "_owner") |
---|
24 | 24 | | |
---|
25 | 25 | | |
---|
26 | 26 | | func getKeyItemData (item) = (item + "_data") |
---|
27 | 27 | | |
---|
28 | 28 | | |
---|
29 | | - | func getValueItemSupplier (account) = account |
---|
| 29 | + | func getValueItemSupplier (account) = match getString(this, account) { |
---|
| 30 | + | case a: String => |
---|
| 31 | + | a |
---|
| 32 | + | case _ => |
---|
| 33 | + | "NONE" |
---|
| 34 | + | } |
---|
30 | 35 | | |
---|
31 | 36 | | |
---|
32 | 37 | | @Callable(i) |
---|
33 | 38 | | func addItem (title,price,data) = { |
---|
34 | 39 | | let supplierAddress = toBase58String(i.caller.bytes) |
---|
35 | 40 | | let item = getKeyItem(supplierAddress, title) |
---|
36 | 41 | | if ((0 >= price)) |
---|
37 | 42 | | then throw("Purchase amount cannot be less than item price") |
---|
38 | 43 | | else if ((getValueItemSupplier(item) != NONE)) |
---|
39 | 44 | | then throw("An item is already exists") |
---|
40 | 45 | | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) |
---|
41 | 46 | | } |
---|
42 | 47 | | |
---|
43 | 48 | | |
---|