tx · BojZK2d3u858GAovt2E22EQS2hqfc8FtnUBKwgPckYTN 3MxS2LBsPnEGA6AetWPqWTZjmQu8zUySd2c: -0.01000000 Waves 2021.07.06 17:39 [1601881] smart account 3MxS2LBsPnEGA6AetWPqWTZjmQu8zUySd2c > SELF 0.00000000 Waves
{ "type": 13, "id": "BojZK2d3u858GAovt2E22EQS2hqfc8FtnUBKwgPckYTN", "fee": 1000000, "feeAssetId": null, "timestamp": 1625582375296, "version": 2, "chainId": 84, "sender": "3MxS2LBsPnEGA6AetWPqWTZjmQu8zUySd2c", "senderPublicKey": "9dJbLdKrkcPAEacPHvgivaqbGgimy4WN2MRrE6XXWFQu", "proofs": [ "5t8PvyN9zTpyaYytjZkkMC1GRBbokrs3qPewoPHzg4YHPxFucxjoRtTTpjHTK2gK9kswY7SaMh6jLPSqJNVk94Bb" ], "script": "base64:AAIFAAAAAAAAAS0IAhIFCgMIAQgaCgoCYTESBE5PTkUaEQoCYTISC2dldFN0ckJ5S2V5GgkKAmEzEgNrZXkaCQoCYTQSA3N0choNCgJhNRIHJG1hdGNoMBoHCgJhNhIBYRoVCgJhNxIPZ2V0S2V5SXRlbVByaWNlGgoKAmE4EgRpdGVtGhAKAmE5EgpnZXRLZXlJdGVtGg4KAmIxEghzdXBwbGllchoLCgJiMhIFdGl0bGUaFAoCYjMSDmdldEtleUl0ZW1EYXRhGhgKAmI0EhJnZXRLZXlJdGVtU3VwcGxpZXIaGgoCYjUSFGdldFZhbHVlSXRlbVN1cHBsaWVyGgcKAmI2EgFpGgsKAmI3EgVwcmljZRoKCgJiOBIEZGF0YRoVCgJiORIPc3VwcGxpZXJBZGRyZXNzAAAABwAAAAACYTECAAAABG5vbmUBAAAAAmEyAAAAAQAAAAJhMwQAAAACYTQEAAAAAmE1CQAEHQAAAAIFAAAABHRoaXMFAAAAAmEzAwkAAAEAAAACBQAAAAJhNQIAAAAGU3RyaW5nBAAAAAJhNgUAAAACYTUFAAAAAmE2BQAAAAJhMQUAAAACYTQBAAAAAmE3AAAAAQAAAAJhOAkAASwAAAACBQAAAAJhOAIAAAAGX3ByaWNlAQAAAAJhOQAAAAIAAAACYjEAAAACYjIJAAEsAAAAAgIAAAAFaXRlbV8JAAJYAAAAAQkAAfcAAAABCQABmwAAAAEJAAEsAAAAAgUAAAACYjEFAAAAAmIyAQAAAAJiMwAAAAEAAAACYTgJAAEsAAAAAgUAAAACYTgCAAAABV9kYXRhAQAAAAJiNAAAAAEAAAACYTgJAAEsAAAAAgUAAAACYTgCAAAABl9vd25lcgEAAAACYjUAAAABAAAAAmE4CQEAAAACYTIAAAABCQEAAAACYjQAAAABBQAAAAJhOAAAAAEAAAACYjYBAAAAB2FkZEl0ZW0AAAADAAAAAmIyAAAAAmI3AAAAAmI4BAAAAAJiOQkAAlgAAAABCAgFAAAAAmI2AAAABmNhbGxlcgAAAAVieXRlcwQAAAACYTgJAQAAAAJhOQAAAAIFAAAAAmI5BQAAAAJiMgMJAABnAAAAAgAAAAAAAAAAAAUAAAACYjcJAAACAAAAAQIAAAAuUHVyY2hhc2UgYW1vdW50IGNhbm5vdCBiZSBsZXNzIHRoYW4gaXRlbSBwcmljZQMJAQAAAAIhPQAAAAIJAQAAAAJiNQAAAAEFAAAAAmE4BQAAAAJhMQkAAAIAAAABAgAAABZhbiBpdGVtIGFscmVhZHkgZXhpc3RzCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAAAJiNAAAAAEFAAAAAmE4BQAAAAJiOQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAAmE3AAAAAQUAAAACYTgFAAAAAmI3CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAAAJiMwAAAAEFAAAAAmE4BQAAAAJiOAUAAAADbmlsAAAAANcZ7K0=", "height": 1601881, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HiaxjgkBon59CX7NBhKuMdu6wXGxGEenUYX8JGcE3bsA 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 | + | func getStrByKey (key) = { | |
7 | + | let str = match getString(this, key) { | |
8 | + | case a: String => | |
9 | + | a | |
10 | + | case _ => | |
11 | + | NONE | |
12 | + | } | |
13 | + | str | |
14 | + | } | |
15 | + | ||
16 | + | ||
17 | + | func getKeyItemPrice (item) = (item + "_price") | |
18 | + | ||
19 | + | ||
20 | + | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
21 | + | ||
22 | + | ||
23 | + | func getKeyItemData (item) = (item + "_data") | |
24 | + | ||
25 | + | ||
26 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
27 | + | ||
28 | + | ||
29 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
30 | + | ||
31 | + | ||
32 | + | @Callable(i) | |
33 | + | func addItem (title,price,data) = { | |
34 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
35 | + | let item = getKeyItem(supplierAddress, title) | |
36 | + | if ((0 >= price)) | |
37 | + | then throw("Purchase amount cannot be less than item price") | |
38 | + | else if ((getValueItemSupplier(item) != NONE)) | |
39 | + | then throw("an item already exists") | |
40 | + | else [StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data)] | |
41 | + | } | |
42 | + | ||
43 | + |
github/deemru/w8io/026f985 14.89 ms ◑