tx · HiakAggJnP8W1ZyiBqPsTt9shW5xeHHT8CfZW2WjyjmZ 3MwfRv8DNH5LJGuytk2dFEWHvUw6zn2SKrW: -0.01400000 Waves 2019.07.08 21:27 [576994] smart account 3MwfRv8DNH5LJGuytk2dFEWHvUw6zn2SKrW > SELF 0.00000000 Waves
{ "type": 13, "id": "HiakAggJnP8W1ZyiBqPsTt9shW5xeHHT8CfZW2WjyjmZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1562610465815, "version": 1, "sender": "3MwfRv8DNH5LJGuytk2dFEWHvUw6zn2SKrW", "senderPublicKey": "CARR4oug3BCqWKiBJgeV4SUbMxta9iMbdvg3jRZpFf9f", "proofs": [ "5U2jEf9ZhJAtDNeiaVDco8uEashWKTdiQxXNorqkd1oWdd381EvrkLwtnFofPMtNyf5JTpQRy9EAuy8nkFTcQ9iT" ], "script": "base64:AAIDAAAAAAAAAAAAAAARAAAAAAtCTEFDS0xJU1RFRAIAAAAJYmxhY2tsaXN0AAAAAAROT05FAgAAAAROT05FAQAAABNnZXRFeHRBZGRyZXNzT3JhY2xlAAAAAAkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTXNNR2lVam9weGRMNnRjMVkxbWs1MUs2NXF0WDNpSGRNcAEAAAAcZ2V0RXh0S2V5SXRlbVdoaXRlTGlzdFN0YXR1cwAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAABBfdmVyaWZpZXJfc3RhdHVzAQAAAB5nZXRFeHRWYWx1ZUl0ZW1XaGl0ZUxpc3RTdGF0dXMAAAACAAAABm9yYWNsZQAAAAdhY2NvdW50BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAGb3JhY2xlCQEAAAAcZ2V0RXh0S2V5SXRlbVdoaXRlTGlzdFN0YXR1cwAAAAEFAAAAB2FjY291bnQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAA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AAQUAAAAEaXRlbQUAAAAETk9ORQkAAAIAAAABAgAAABhhbiBpdGVtIGlzIGFscmVhZHkgZXhpc3QDCQAAAAAAAAIFAAAAEXN1cHBsaWVyV2hpdGVMaXN0BQAAAAtCTEFDS0xJU1RFRAkAAAIAAAABAgAAAChzdXBwbGllcidzIGFjY291bnQgaGFzIGJlZW4gYmxhY2tsaWVzdGVkCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAPc3VwcGxpZXJBZGRyZXNzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQUAAAAEaXRlbQUAAAAFcHJpY2UJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABxnZXRFeHRLZXlJdGVtV2hpdGVMaXN0U3RhdHVzAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAAA9zdXBwbGllckFkZHJlc3MFAAAAA25pbAAAAABUHo2U", "chainId": 84, "height": 576994, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let BLACKLISTED = "blacklist" | |
5 | + | ||
6 | + | let NONE = "NONE" | |
7 | + | ||
8 | + | func getExtAddressOracle () = extract(addressFromString("3MsMGiUjopxdL6tc1Y1mk51K65qtX3iHdMp")) | |
9 | + | ||
10 | + | ||
11 | + | func getExtKeyItemWhiteListStatus (item) = (item + "_verifier_status") | |
12 | + | ||
13 | + | ||
14 | + | func getExtValueItemWhiteListStatus (oracle,account) = { | |
15 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { | |
16 | + | case a: String => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | NONE | |
20 | + | } | |
21 | + | str | |
22 | + | } | |
23 | + | ||
24 | + | ||
25 | + | func getNumberByKey (key) = { | |
26 | + | let num = match getInteger(this, key) { | |
27 | + | case a: Int => | |
28 | + | a | |
29 | + | case _ => | |
30 | + | 0 | |
31 | + | } | |
32 | + | num | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func getStrByKey (key) = { | |
37 | + | let str = match getString(this, key) { | |
38 | + | case a: String => | |
39 | + | a | |
40 | + | case _ => | |
41 | + | NONE | |
42 | + | } | |
43 | + | str | |
44 | + | } | |
45 | + | ||
46 | + | ||
47 | + | func getKeyItemPrice (item) = (item + "_price") | |
48 | + | ||
49 | + | ||
50 | + | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
51 | + | ||
52 | + | ||
53 | + | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
54 | + | ||
55 | + | ||
56 | + | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
57 | + | ||
58 | + | ||
59 | + | func getKeyItem (supplier,title) = ("Item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
60 | + | ||
61 | + | ||
62 | + | func getKeyItemData (item) = (item + "_data") | |
63 | + | ||
64 | + | ||
65 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
66 | + | ||
67 | + | ||
68 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
69 | + | ||
70 | + | ||
71 | + | func getKeyBalanceSupplier (account) = (account + "_balance") | |
72 | + | ||
73 | + | ||
74 | + | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
75 | + | ||
76 | + | ||
77 | + | @Callable(i) | |
78 | + | func addItem (title,price,data) = { | |
79 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
80 | + | let item = getKeyItem(supplierAddress, title) | |
81 | + | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
82 | + | if ((0 >= price)) | |
83 | + | then throw("purchase amount cannot be less than item price") | |
84 | + | else if ((getValueItemSupplier(item) != NONE)) | |
85 | + | then throw("an item is already exist") | |
86 | + | else if ((supplierWhiteList == BLACKLISTED)) | |
87 | + | then throw("supplier's account has been blackliested") | |
88 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierAddress)]) | |
89 | + | } | |
90 | + | ||
91 | + |
github/deemru/w8io/169f3d6 18.30 ms ◑