tx · 8YB9Yp9D9XoKeoXptCw8VUMjmuhvhBFsrTNL6aUcC1qf 3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o: -0.05000000 Waves 2019.08.12 17:37 [627972] smart account 3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o > SELF 0.00000000 Waves
{ "type": 13, "id": "8YB9Yp9D9XoKeoXptCw8VUMjmuhvhBFsrTNL6aUcC1qf", "fee": 5000000, "feeAssetId": null, "timestamp": 1565620646222, "version": 1, "sender": "3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o", "senderPublicKey": "Ebb2ffqL8cMnNmXPNvHLy53xrK7t5WaSFhneCPBSoxop", "proofs": [ "4nwbZMDSp2KMzmn3937bUrurw1PkDpW1LagNoZxY9d9ZVbP7TjfQXpRQpWW1BcUXhNonb5841hw1un4f5XqEwjkT" ], "script": "base64:AAIDAAAAAAAAAAAAAAAhAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWkFAAAAByRtYXRjaDAFAAAAAWkAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5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1c2VyBQAAAAROT05FCQAAAgAAAAECAAAAIlVzZXIgaGFzIGFscmVhZHkgcmV2ZWFsZWQgaGlzIHZvdGUDAwkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAZWT1RJTkcJAQAAAAIhPQAAAAIFAAAABnN0YXR1cwUAAAAGUkVWRUFMBwkAAAIAAAABAgAAABRXcm9uZyBzdGF0dXMgb2Ygdm90ZQMDCQEAAAACIT0AAAACBQAAAAR2b3RlBQAAAAhGRUFUVVJFRAkBAAAAAiE9AAAAAgUAAAAEdm90ZQUAAAAIREVMSVNURUQHCQAAAgAAAAECAAAACldyb25nIHZvdGUDAwkAAAAAAAACBQAAAAZzdGF0dXMFAAAACEZFQVRVUkVEBgkAAAAAAAACBQAAAAZzdGF0dXMFAAAACERFTElTVEVECQAAAgAAAAECAAAAEFZvdGluZyBjb21wbGl0ZWQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAAxnZXRLZXlSZXZlYWwAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAAR2b3RlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAPZ2V0S2V5Vm90ZUNvdW50AAAAAgUAAAAEaXRlbQUAAAAEdm90ZQUAAAAMbmV3Vm90ZUNvdW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAQZ2V0S2V5SXRlbVN0YXR1cwAAAAEFAAAABGl0ZW0DCQAAZwAAAAIFAAAADG5ld1ZvdGVDb3VudAUAAAAGUVVPUlVNBQAAAAR2b3RlBQAAAAZSRVZFQUwFAAAAA25pbAAAAAD+XjHO", "chainId": 84, "height": 627972, "spentComplexity": 0 } View: original | compacted Prev: 5F7cSGhVHSpAgRd9RGHTtG9w3yeePnfaLG3N4iw9bUWg Next: 7h4AzpUxcF6wg88t2YPkvX4vCgxUn8ru5tkPMXNhD7FR Diff:
Old | New | Differences | |
---|---|---|---|
121 | 121 | let supplierAddress = toBase58String(inv.caller.bytes) | |
122 | 122 | let item = getKeyItem(supplierAddress, title) | |
123 | 123 | let VARgetExtKeyItemWhiteListStatus = getExtKeyItemWhiteListStatus(supplierAddress) | |
124 | - | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), getExtKeyItemWhiteListStatus(supplierAddress)) | |
125 | - | throw(("VARgetExtKeyItemWhiteListStatus: " + VARgetExtKeyItemWhiteListStatus)) | |
124 | + | let VARgetExtAddressOracle = getExtAddressOracle() | |
125 | + | let supplierWhiteList = getExtValueItemWhiteListStatus(addressFromStringValue("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT"), getExtKeyItemWhiteListStatus(supplierAddress)) | |
126 | + | throw(("supplierWhiteList: " + supplierWhiteList)) | |
126 | 127 | } | |
127 | 128 | ||
128 | 129 |
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 getNumberByKey (key) = { | |
7 | 7 | let num = match getInteger(this, key) { | |
8 | 8 | case i: Int => | |
9 | 9 | i | |
10 | 10 | case _ => | |
11 | 11 | 0 | |
12 | 12 | } | |
13 | 13 | num | |
14 | 14 | } | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func getStrByKey (key) = { | |
18 | 18 | let str = match getString(this, key) { | |
19 | 19 | case s: String => | |
20 | 20 | s | |
21 | 21 | case _ => | |
22 | 22 | NONE | |
23 | 23 | } | |
24 | 24 | str | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getKeyItemPrice (item) = (item + "_price") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getKeyItemData (item) = (item + "_data") | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getKeyItemSuplier (item) = (item + "_owner") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSuplier(item)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getKeyBalanceSupplier (account) = (account + "_balance") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | let VOTERS = 3 | |
59 | 59 | ||
60 | 60 | let QUORUM = 2 | |
61 | 61 | ||
62 | 62 | let VOTING = "voting" | |
63 | 63 | ||
64 | 64 | let REVEAL = "reveal" | |
65 | 65 | ||
66 | 66 | let FEATURED = "featured" | |
67 | 67 | ||
68 | 68 | let DELISTED = "delisted" | |
69 | 69 | ||
70 | 70 | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getKeyCommitsCount (item) = (item + "_comcnt") | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func getKeyItemStatus (item) = (item + "_status") | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func getExtAddressOracle () = addressFromStringValue("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT") | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | let BLACKLISTED = "blacklisted" | |
104 | 104 | ||
105 | 105 | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getExtValueItemWhiteListStatus (oracle,account) = { | |
109 | 109 | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { | |
110 | 110 | case a: String => | |
111 | 111 | a | |
112 | 112 | case _ => | |
113 | 113 | NONE | |
114 | 114 | } | |
115 | 115 | str | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | @Callable(inv) | |
120 | 120 | func addItem (title,price,data) = { | |
121 | 121 | let supplierAddress = toBase58String(inv.caller.bytes) | |
122 | 122 | let item = getKeyItem(supplierAddress, title) | |
123 | 123 | let VARgetExtKeyItemWhiteListStatus = getExtKeyItemWhiteListStatus(supplierAddress) | |
124 | - | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), getExtKeyItemWhiteListStatus(supplierAddress)) | |
125 | - | throw(("VARgetExtKeyItemWhiteListStatus: " + VARgetExtKeyItemWhiteListStatus)) | |
124 | + | let VARgetExtAddressOracle = getExtAddressOracle() | |
125 | + | let supplierWhiteList = getExtValueItemWhiteListStatus(addressFromStringValue("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT"), getExtKeyItemWhiteListStatus(supplierAddress)) | |
126 | + | throw(("supplierWhiteList: " + supplierWhiteList)) | |
126 | 127 | } | |
127 | 128 | ||
128 | 129 | ||
129 | 130 | ||
130 | 131 | @Callable(inv) | |
131 | 132 | func purchase (item) = { | |
132 | 133 | let payment = extract(inv.payment) | |
133 | 134 | if (isDefined(payment.assetId)) | |
134 | 135 | then throw("Only payments in WAVES are avalible") | |
135 | 136 | else { | |
136 | 137 | let userAddress = toBase58String(inv.caller.bytes) | |
137 | 138 | let price = getValueItemPrice(item) | |
138 | 139 | let supplierAddress = getValueItemSupplier(item) | |
139 | 140 | if ((price > payment.amount)) | |
140 | 141 | then throw("Please send exact coupon price") | |
141 | 142 | else if ((payment.amount > price)) | |
142 | 143 | then throw("Please send exact coupon price") | |
143 | 144 | else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + payment.amount))]) | |
144 | 145 | } | |
145 | 146 | } | |
146 | 147 | ||
147 | 148 | ||
148 | 149 | ||
149 | 150 | @Callable(inv) | |
150 | 151 | func withdraw () = { | |
151 | 152 | let supplierAddress = toBase58String(inv.caller.bytes) | |
152 | 153 | let balance = getValueBalanceSupplier(supplierAddress) | |
153 | 154 | if ((0 >= balance)) | |
154 | 155 | then throw("Ballance is zero") | |
155 | 156 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)])) | |
156 | 157 | } | |
157 | 158 | ||
158 | 159 | ||
159 | 160 | ||
160 | 161 | @Callable(inv) | |
161 | 162 | func voteCommit (item,hash) = { | |
162 | 163 | let user = toBase58String(inv.caller.bytes) | |
163 | 164 | let commits = getValueCommitsCount(item) | |
164 | 165 | let status = getValueItemStatus(item) | |
165 | 166 | if ((commits >= VOTERS)) | |
166 | 167 | then throw("We have reached necessary number of voters") | |
167 | 168 | else if ((getValueCommit(item, user) != NONE)) | |
168 | 169 | then throw("User has already voted") | |
169 | 170 | else if ((getKeyItemSuplier(item) == NONE)) | |
170 | 171 | then throw("Item does not exist") | |
171 | 172 | else if (if ((status != NONE)) | |
172 | 173 | then (status != VOTING) | |
173 | 174 | else false) | |
174 | 175 | then throw("Voting is not possible") | |
175 | 176 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
176 | 177 | then REVEAL | |
177 | 178 | else VOTING)]) | |
178 | 179 | } | |
179 | 180 | ||
180 | 181 | ||
181 | 182 | ||
182 | 183 | @Callable(inv) | |
183 | 184 | func revealVotes (item,vote,salt) = { | |
184 | 185 | let user = toBase58String(inv.caller.bytes) | |
185 | 186 | let commits = getValueCommitsCount(item) | |
186 | 187 | let status = getValueItemStatus(item) | |
187 | 188 | let newVoteCount = (getValueVoteCount(item, vote) + 1) | |
188 | 189 | if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user))) | |
189 | 190 | then throw("Reveal data is not valid") | |
190 | 191 | else if ((VOTERS > getValueCommitsCount(item))) | |
191 | 192 | then throw("Necessary number of voters hasn't reached yet") | |
192 | 193 | else if ((getValueReveal(item, user) != NONE)) | |
193 | 194 | then throw("User has already revealed his vote") | |
194 | 195 | else if (if ((status != VOTING)) | |
195 | 196 | then (status != REVEAL) | |
196 | 197 | else false) | |
197 | 198 | then throw("Wrong status of vote") | |
198 | 199 | else if (if ((vote != FEATURED)) | |
199 | 200 | then (vote != DELISTED) | |
200 | 201 | else false) | |
201 | 202 | then throw("Wrong vote") | |
202 | 203 | else if (if ((status == FEATURED)) | |
203 | 204 | then true | |
204 | 205 | else (status == DELISTED)) | |
205 | 206 | then throw("Voting complited") | |
206 | 207 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
207 | 208 | then vote | |
208 | 209 | else REVEAL)]) | |
209 | 210 | } | |
210 | 211 | ||
211 | 212 |
github/deemru/w8io/026f985 56.65 ms ◑