tx · HR6G9oMDfJtMSmWCghPZBR54E2DkwneAFyuLD4W3aSvU 3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9: -0.01400000 Waves 2019.07.04 00:38 [569790] smart account 3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9 > SELF 0.00000000 Waves
{ "type": 13, "id": "HR6G9oMDfJtMSmWCghPZBR54E2DkwneAFyuLD4W3aSvU", "fee": 1400000, "feeAssetId": null, "timestamp": 1562189933073, "version": 1, "sender": "3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9", "senderPublicKey": "2kKaoCcJJ7XyWXm1bKS64QdpwGQpmaEcrToYuPd1k2nB", "proofs": [ "3Qdu1SLhJBWjd1abwKiCx6uoPXnZhw57WvxBv3Re2zuSHG8whcHyU5g2qQC7xkmpg6v6g5BNCVspJXnQgM9GDD9" ], "script": "base64:AAIDAAAAAAAAAAAAAAAOAAAAAAtCTEFDS0xJU1RFRAIAAAAJYmxhY2tsaXN0AAAAAAROT05FAgAAAARub25lAAAAAAh2ZXJpZmllcgIAAAAjM041eWhaYW90QkxVR0oxRWVlZ1QyS0MzaVRkaEFhbWNISjkAAAAACFZFUklGSUVEAgAAAAh2ZXJpZmllZAEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAAOZ2V0S2V5SXRlbURhdGEAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAFX2RhdGEBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfb3duZXIBAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAA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AAAACBQAAABFzdXBwbGllcldoaXRlTGlzdAUAAAALQkxBQ0tMSVNURUQJAAACAAAAAQIAAAAnc3VwcGxpZXIncyBhY2NvdW50IGhhcyBiZWVuIGJsYWNrbGlzdGVkCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAPc3VwcGxpZXJBZGRyZXNzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQUAAAAEaXRlbQUAAAAFcHJpY2UJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABxnZXRFeHRLZXlJdGVtV2hpdGVMaXN0U3RhdHVzAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAABFzdXBwbGllcldoaXRlTGlzdAUAAAADbmlsAAAAABsgoNc=", "chainId": 84, "height": 569790, "spentComplexity": 0 } View: original | compacted Prev: BC8QvNBEjfnmSJZxmbbb8qpBYCwY19GEnTgaoUCxKv9m Next: none Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | let BLACKLISTED = "blacklist" | |
5 | 5 | ||
6 | 6 | let NONE = "none" | |
7 | + | ||
8 | + | let verifier = "3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9" | |
9 | + | ||
10 | + | let VERIFIED = "verified" | |
7 | 11 | ||
8 | 12 | func getKeyItemPrice (item) = (item + "_price") | |
9 | 13 | ||
48 | 52 | } | |
49 | 53 | ||
50 | 54 | ||
55 | + | func getValueItemWhiteListStatus (item) = (item + "_verifier_status") | |
56 | + | ||
57 | + | ||
58 | + | @Callable(i) | |
59 | + | func setstatus (supplier,status) = { | |
60 | + | let account = toBase58String(i.caller.bytes) | |
61 | + | if ((account != verifier)) | |
62 | + | then throw("only oracle verifier are able to manage whitelist") | |
63 | + | else if (if ((status != VERIFIED)) | |
64 | + | then (status != BLACKLISTED) | |
65 | + | else false) | |
66 | + | then throw("wrong status") | |
67 | + | else WriteSet([DataEntry(getValueItemWhiteListStatus(supplier), status)]) | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | ||
51 | 72 | @Callable(i) | |
52 | 73 | func addItem (title,price,data) = { | |
53 | 74 | let supplierAddress = toBase58String(i.caller.bytes) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BLACKLISTED = "blacklist" | |
5 | 5 | ||
6 | 6 | let NONE = "none" | |
7 | + | ||
8 | + | let verifier = "3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9" | |
9 | + | ||
10 | + | let VERIFIED = "verified" | |
7 | 11 | ||
8 | 12 | func getKeyItemPrice (item) = (item + "_price") | |
9 | 13 | ||
10 | 14 | ||
11 | 15 | func getKeyItemData (item) = (item + "_data") | |
12 | 16 | ||
13 | 17 | ||
14 | 18 | func getKeyItemSupplier (item) = (item + "_owner") | |
15 | 19 | ||
16 | 20 | ||
17 | 21 | func getStrByKey (key) = { | |
18 | 22 | let str = match getString(this, key) { | |
19 | 23 | case a: String => | |
20 | 24 | a | |
21 | 25 | case _ => | |
22 | 26 | NONE | |
23 | 27 | } | |
24 | 28 | str | |
25 | 29 | } | |
26 | 30 | ||
27 | 31 | ||
28 | 32 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
29 | 33 | ||
30 | 34 | ||
31 | 35 | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
32 | 36 | ||
33 | 37 | ||
34 | 38 | func getExtAddressOracle () = extract(addressFromString("3N5yhZaotBLUGJ1EeegT2KC3iTdhAamcHJ9")) | |
35 | 39 | ||
36 | 40 | ||
37 | 41 | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") | |
38 | 42 | ||
39 | 43 | ||
40 | 44 | func getExtValueItemWhiteListStatus (oracle,account) = { | |
41 | 45 | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { | |
42 | 46 | case a: String => | |
43 | 47 | a | |
44 | 48 | case _ => | |
45 | 49 | NONE | |
46 | 50 | } | |
47 | 51 | str | |
48 | 52 | } | |
49 | 53 | ||
50 | 54 | ||
55 | + | func getValueItemWhiteListStatus (item) = (item + "_verifier_status") | |
56 | + | ||
57 | + | ||
58 | + | @Callable(i) | |
59 | + | func setstatus (supplier,status) = { | |
60 | + | let account = toBase58String(i.caller.bytes) | |
61 | + | if ((account != verifier)) | |
62 | + | then throw("only oracle verifier are able to manage whitelist") | |
63 | + | else if (if ((status != VERIFIED)) | |
64 | + | then (status != BLACKLISTED) | |
65 | + | else false) | |
66 | + | then throw("wrong status") | |
67 | + | else WriteSet([DataEntry(getValueItemWhiteListStatus(supplier), status)]) | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | ||
51 | 72 | @Callable(i) | |
52 | 73 | func addItem (title,price,data) = { | |
53 | 74 | let supplierAddress = toBase58String(i.caller.bytes) | |
54 | 75 | let item = getKeyItem(supplierAddress, title) | |
55 | 76 | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
56 | 77 | if ((0 >= price)) | |
57 | 78 | then throw("purchase amount cannot be less than item price") | |
58 | 79 | else if ((getValueItemSupplier(item) != NONE)) | |
59 | 80 | then throw("an item already exists") | |
60 | 81 | else if ((supplierWhiteList == BLACKLISTED)) | |
61 | 82 | then throw("supplier's account has been blacklisted") | |
62 | 83 | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)]) | |
63 | 84 | } | |
64 | 85 | ||
65 | 86 |
github/deemru/w8io/169f3d6 29.51 ms ◑