tx · CQfmQUMaVRoA9ce4mFyzTwctbKk1EYxSEvKw6oyEfV3M
3NBGebxfi8arSFesWFZmHiZbUTaL1LN3K2n: -0.01400000 Waves
2019.07.03 06:36 [568699] smart account 3NBGebxfi8arSFesWFZmHiZbUTaL1LN3K2n > SELF 0.00000000 Waves
{
"type": 13,
"id": "CQfmQUMaVRoA9ce4mFyzTwctbKk1EYxSEvKw6oyEfV3M",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1562124996784,
"version": 1,
"sender": "3NBGebxfi8arSFesWFZmHiZbUTaL1LN3K2n",
"senderPublicKey": "GQuxeXLbjWe44XSJX8GXHEfPmd7e97QeNz3uvV5CVddH",
"proofs": [
"55xcuAiEYyu5u4mBV8RgLXvh4E2aQpFFaFhUFAuz4vzwyCwx67kvtp1iThRx9VahbvxFZcQX7V99En1LifiiHopw"
],
"script": "base64:AAIDAAAAAAAAAAAAAAALAAAAAAROT05FAgAAAARub25lAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAKZ2V0S2V5SXRlbQAAAAIAAAAIc3VwcGxpZXIAAAAFdGl0bGUJAAEsAAAAAgIAAAAFaXRlbV8JAAJYAAAAAQkAAfcAAAABCQABmwAAAAEJAAEsAAAAAgUAAAAIc3VwcGxpZXIFAAAABXRpdGxlAQAAABJnZXRLZXlJdGVtU3VwcGxpZXIAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAGX293bmVyAQAAABRnZXRWYWx1ZUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkBAAAAC2dldFN0ckJ5S2V5AAAAAQkBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW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NnZXRFeHRBZGRyZXNzT3JhY2xlAAAAAAUAAAAPc3VwcGxpZXJBZGRyZXNzAwkAAGcAAAACAAAAAAAAAAAABQAAAAVwcmljZQkAAAIAAAABAgAAAC5wdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGxlc3MgdGhhbiBpdGVtIHByaWNlAwkBAAAAAiE9AAAAAgkBAAAAFGdldFZhbHVlSXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAETk9ORQkAAAIAAAABAgAAABhhbiBpdGVtIGlzIGFscmVhZHkgZXhpc3QDCQAAAAAAAAIFAAAAEXN1cHBsaWVyd2hpdGVsaXN0BQAAAAtCTEFDS0xJU1RFRAkAAAIAAAABAgAAACdzdXBwbGllcidzIGFjY291bnQgaGFzIGJlZW4gYmxhY2tsaXN0ZWQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABJnZXRLZXlJdGVtU3VwcGxpZXIAAAABBQAAAARpdGVtBQAAAA9zdXBwbGllckFkZHJlc3MJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA9nZXRLZXlJdGVtUHJpY2UAAAABBQAAAARpdGVtBQAAAAVwcmljZQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAADmdldEtleUl0ZW1EYXRhAAAAAQUAAAAEaXRlbQUAAAAEZGF0YQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAHGdldEV4dEtleUl0ZW1XaGl0ZUxpc3RTdGF0dXMAAAABBQAAAA9zdXBwbGllckFkZHJlc3MFAAAAEXN1cHBsaWVyd2hpdGVsaXN0BQAAAANuaWwAAAAAieVp1Q==",
"chainId": 84,
"height": 568699,
"spentComplexity": 0
}
View: original | compacted
Prev: HTetfZZiA7vFeT91uCTDuxoUx13w4TWvkhDE1ZXZc9B1
Next: none
Diff:
Old | New | | Differences |
---|
29 | 29 | | func getKeyItemData (item) = (item + "_data") |
---|
30 | 30 | | |
---|
31 | 31 | | |
---|
| 32 | + | func getExtAddressOracle () = extract(addressFromString("3NBGebxfi8arSFesWFZmHiZbUTaL1LN3K2n")) |
---|
| 33 | + | |
---|
| 34 | + | |
---|
| 35 | + | let BLACKLISTED = "blacklist" |
---|
| 36 | + | |
---|
| 37 | + | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") |
---|
| 38 | + | |
---|
| 39 | + | |
---|
| 40 | + | func getExtValueItemWhiteListStatus (oracle,account) = { |
---|
| 41 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { |
---|
| 42 | + | case a: String => |
---|
| 43 | + | a |
---|
| 44 | + | case _ => |
---|
| 45 | + | NONE |
---|
| 46 | + | } |
---|
| 47 | + | str |
---|
| 48 | + | } |
---|
| 49 | + | |
---|
| 50 | + | |
---|
32 | 51 | | @Callable(i) |
---|
33 | 52 | | func addItem (title,price,data) = { |
---|
34 | 53 | | let supplierAddress = toBase58String(i.caller.bytes) |
---|
35 | 54 | | let item = getKeyItem(supplierAddress, title) |
---|
| 55 | + | let supplierwhitelist = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) |
---|
36 | 56 | | if ((0 >= price)) |
---|
37 | 57 | | then throw("purchase amount cannot be less than item price") |
---|
38 | 58 | | else if ((getValueItemSupplier(item) != NONE)) |
---|
39 | 59 | | then throw("an item is already exist") |
---|
40 | | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) |
---|
| 60 | + | else if ((supplierwhitelist == BLACKLISTED)) |
---|
| 61 | + | then throw("supplier's account has been blacklisted") |
---|
| 62 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierwhitelist)]) |
---|
41 | 63 | | } |
---|
42 | 64 | | |
---|
43 | 65 | | |
---|
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 getStrByKey (key) = { |
---|
7 | 7 | | let str = match getString(this, key) { |
---|
8 | 8 | | case a: String => |
---|
9 | 9 | | a |
---|
10 | 10 | | case _ => |
---|
11 | 11 | | NONE |
---|
12 | 12 | | } |
---|
13 | 13 | | str |
---|
14 | 14 | | } |
---|
15 | 15 | | |
---|
16 | 16 | | |
---|
17 | 17 | | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) |
---|
18 | 18 | | |
---|
19 | 19 | | |
---|
20 | 20 | | func getKeyItemSupplier (item) = (item + "_owner") |
---|
21 | 21 | | |
---|
22 | 22 | | |
---|
23 | 23 | | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) |
---|
24 | 24 | | |
---|
25 | 25 | | |
---|
26 | 26 | | func getKeyItemPrice (item) = (item + "_price") |
---|
27 | 27 | | |
---|
28 | 28 | | |
---|
29 | 29 | | func getKeyItemData (item) = (item + "_data") |
---|
30 | 30 | | |
---|
31 | 31 | | |
---|
| 32 | + | func getExtAddressOracle () = extract(addressFromString("3NBGebxfi8arSFesWFZmHiZbUTaL1LN3K2n")) |
---|
| 33 | + | |
---|
| 34 | + | |
---|
| 35 | + | let BLACKLISTED = "blacklist" |
---|
| 36 | + | |
---|
| 37 | + | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") |
---|
| 38 | + | |
---|
| 39 | + | |
---|
| 40 | + | func getExtValueItemWhiteListStatus (oracle,account) = { |
---|
| 41 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { |
---|
| 42 | + | case a: String => |
---|
| 43 | + | a |
---|
| 44 | + | case _ => |
---|
| 45 | + | NONE |
---|
| 46 | + | } |
---|
| 47 | + | str |
---|
| 48 | + | } |
---|
| 49 | + | |
---|
| 50 | + | |
---|
32 | 51 | | @Callable(i) |
---|
33 | 52 | | func addItem (title,price,data) = { |
---|
34 | 53 | | let supplierAddress = toBase58String(i.caller.bytes) |
---|
35 | 54 | | let item = getKeyItem(supplierAddress, title) |
---|
| 55 | + | let supplierwhitelist = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) |
---|
36 | 56 | | if ((0 >= price)) |
---|
37 | 57 | | then throw("purchase amount cannot be less than item price") |
---|
38 | 58 | | else if ((getValueItemSupplier(item) != NONE)) |
---|
39 | 59 | | then throw("an item is already exist") |
---|
40 | | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) |
---|
| 60 | + | else if ((supplierwhitelist == BLACKLISTED)) |
---|
| 61 | + | then throw("supplier's account has been blacklisted") |
---|
| 62 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierwhitelist)]) |
---|
41 | 63 | | } |
---|
42 | 64 | | |
---|
43 | 65 | | |
---|