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