tx · C6wCXd7da5YEwT3be9XCnYgvQ72QEBPA46y8U2ZHuqte 3Mr5sE9j8pwf1XwKEa5Dus9xJ3CvJLtwkh9: -0.01400000 Waves 2019.07.03 12:45 [569067] smart account 3Mr5sE9j8pwf1XwKEa5Dus9xJ3CvJLtwkh9 > SELF 0.00000000 Waves
{ "type": 13, "id": "C6wCXd7da5YEwT3be9XCnYgvQ72QEBPA46y8U2ZHuqte", "fee": 1400000, "feeAssetId": null, "timestamp": 1562147154063, "version": 1, "sender": "3Mr5sE9j8pwf1XwKEa5Dus9xJ3CvJLtwkh9", "senderPublicKey": "Ewpv1KbhV86nMYKE13YqKqELTq7YedxV1tPEGeftmMYN", "proofs": [ "2PECoQbxekczVmDYrWxZALF7X13cpyeMXLR1sn65sfTBY6SpZnh9cnyvcQcrQ6nzHRqj5Yf1wWC6cyRreroq7RpN" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5S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2V0RXh0VmFsdWVJdGVtV2hpdGVMaXN0U3RhdHVzAAAAAgkBAAAAE2dldEV4dEFkZHJlc3NPcmFjbGUAAAAABQAAAA9zdXBwbGllckFkZHJlc3MDCQAAZwAAAAIAAAAAAAAAAAAFAAAABXByaWNlCQAAAgAAAAECAAAALnB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgbGV0dCB0aGFuIGl0ZW0gcHJpY2UDCQEAAAACIT0AAAACCQEAAAAUZ2V0VmFsdWVJdGVtU3VwcGxpZXIAAAABBQAAAARpdGVtBQAAAAROT05FCQAAAgAAAAECAAAAGGFuIGl0ZW0gaXMgYWxyZWFkeSBleGlzdAMJAAAAAAAAAgUAAAARc3VwcGxpZXJXaGl0ZUxpc3QFAAAAC0JMQUNLTElTVEVECQAAAgAAAAECAAAAJ3N1cHBsaWVyJ3MgYWNjb3VudCBoYXMgYmVlbiBibGFja2xpc3RlZAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAAD3N1cHBsaWVyQWRkcmVzcwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEFAAAABGl0ZW0FAAAABXByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAOZ2V0S2V5SXRlbURhdGEAAAABBQAAAARpdGVtBQAAAARkYXRhCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAcZ2V0RXh0S2V5SXRlbVdoaXRlTGlzdFN0YXR1cwAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwUAAAARc3VwcGxpZXJXaGl0ZUxpc3QFAAAAA25pbAAAAACQgNAl", "chainId": 84, "height": 569067, "spentComplexity": 0 } View: original | compacted Prev: none Next: CoNoGc5tYou5wyNidthq7xWBYWrexFK9j4ycoPCS6e7w Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let NONE = "none" | |
5 | + | ||
6 | + | func getNumberByKey (key) = { | |
7 | + | let num = match getInteger(this, key) { | |
8 | + | case a: Int => | |
9 | + | a | |
10 | + | case _ => | |
11 | + | 0 | |
12 | + | } | |
13 | + | num | |
14 | + | } | |
15 | + | ||
16 | + | ||
17 | + | func getStrByKey (key) = { | |
18 | + | let str = match getString(this, key) { | |
19 | + | case a: String => | |
20 | + | a | |
21 | + | case _ => | |
22 | + | NONE | |
23 | + | } | |
24 | + | str | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func getKeyItemPrice (item) = (item + "_price") | |
29 | + | ||
30 | + | ||
31 | + | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
32 | + | ||
33 | + | ||
34 | + | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
35 | + | ||
36 | + | ||
37 | + | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(item, item)) | |
38 | + | ||
39 | + | ||
40 | + | func getKeyItem (supplier,titlle) = ("item_" + toBase58String(sha256(toBytes((supplier + titlle))))) | |
41 | + | ||
42 | + | ||
43 | + | func getKeyItemData (item) = (item + "_data") | |
44 | + | ||
45 | + | ||
46 | + | func getKeyItemSupplier (item) = (item + "_owner") | |
47 | + | ||
48 | + | ||
49 | + | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
50 | + | ||
51 | + | ||
52 | + | func getKeyBalanceSupplier (account) = (account + "_balance") | |
53 | + | ||
54 | + | ||
55 | + | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
56 | + | ||
57 | + | ||
58 | + | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
59 | + | ||
60 | + | ||
61 | + | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
62 | + | ||
63 | + | ||
64 | + | func getKeyCommitsCount (item) = (item + "_comcnt") | |
65 | + | ||
66 | + | ||
67 | + | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
68 | + | ||
69 | + | ||
70 | + | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
71 | + | ||
72 | + | ||
73 | + | func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
74 | + | ||
75 | + | ||
76 | + | func getKeyItemStatus (item) = (item + "_status") | |
77 | + | ||
78 | + | ||
79 | + | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
80 | + | ||
81 | + | ||
82 | + | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
83 | + | ||
84 | + | ||
85 | + | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
86 | + | ||
87 | + | ||
88 | + | func getExtAddressOracle () = extract(addressFromString("3Mt9c5k87x7P3bMwSf5qSkjfFQQpL3hSkAM")) | |
89 | + | ||
90 | + | ||
91 | + | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") | |
92 | + | ||
93 | + | ||
94 | + | func getExtValueItemWhiteListStatus (oracle,account) = { | |
95 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { | |
96 | + | case a: String => | |
97 | + | a | |
98 | + | case _ => | |
99 | + | NONE | |
100 | + | } | |
101 | + | str | |
102 | + | } | |
103 | + | ||
104 | + | ||
105 | + | let verifier = "3Mt9c5k87x7P3bMwSf5qSkjfFQQpL3hSkAM" | |
106 | + | ||
107 | + | let VERIFIED = "verified" | |
108 | + | ||
109 | + | let BLACKLISTED = "blacklist" | |
110 | + | ||
111 | + | @Callable(i) | |
112 | + | func addItem (title,price,data) = { | |
113 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
114 | + | let item = getKeyItem(supplierAddress, title) | |
115 | + | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
116 | + | if ((0 >= price)) | |
117 | + | then throw("purchase amount cannot be lett than item price") | |
118 | + | else if ((getValueItemSupplier(item) != NONE)) | |
119 | + | then throw("an item is already exist") | |
120 | + | else if ((supplierWhiteList == BLACKLISTED)) | |
121 | + | then throw("supplier's account has been blacklisted") | |
122 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)]) | |
123 | + | } | |
124 | + | ||
125 | + |
github/deemru/w8io/026f985 17.53 ms ◑