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