tx · 1WWTFMu5bdszJd9Xv7dXM5iPomBLpKvUAknz8mBaFd5 3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg: -0.01400000 Waves 2019.07.05 12:53 [572054] smart account 3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg > SELF 0.00000000 Waves
{ "type": 13, "id": "1WWTFMu5bdszJd9Xv7dXM5iPomBLpKvUAknz8mBaFd5", "fee": 1400000, "feeAssetId": null, "timestamp": 1562320482924, "version": 1, "sender": "3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg", "senderPublicKey": "GBcKAM5muVn8dBji3B7ciEqt4XzrT4CBrAKXoTVfbw7", "proofs": [ "5apbr5qkuHYjSADWAfLWvwHYA1TWNXqfK57Mcv4h8dHdeVefvBWEs7YTUtsm1Qpgt3puHuMWmcgUpZf5rnxjGQWY" ], "script": "base64:AAIDAAAAAAAAAAAAAAAhAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQUAAAAD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ZvdGVDb3VudAAAAAIFAAAABGl0ZW0FAAAABHZvdGUFAAAADG5ld1ZvdGVDb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEGdldEtleUl0ZW1TdGF0dXMAAAABBQAAAARpdGVtAwkAAGcAAAACBQAAAAxuZXdWb3RlQ291bnQFAAAABlFVT1JVTQUAAAAEdm90ZQUAAAAGUkVWRUFMBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlee9+EMI=", "chainId": 84, "height": 572054, "spentComplexity": 0 } View: original | compacted Prev: HapicqVsT1h5UBtqTNRejEFy53GYLSyzd6dtkpMDXVBv Next: none Diff:
Old | New | Differences | |
---|---|---|---|
97 | 97 | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
98 | 98 | ||
99 | 99 | ||
100 | + | func getExtAddressOracle () = extract(addressFromString("3N3M8E7uF1QstBzTMeobiUg1rGFttQNbgCz")) | |
101 | + | ||
102 | + | ||
103 | + | let BLACKLISTED = "blacklist" | |
104 | + | ||
105 | + | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") | |
106 | + | ||
107 | + | ||
108 | + | func getExtValueItemWhiteListStatus (oracle,account) = { | |
109 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { | |
110 | + | case a: String => | |
111 | + | a | |
112 | + | case _ => | |
113 | + | NONE | |
114 | + | } | |
115 | + | str | |
116 | + | } | |
117 | + | ||
118 | + | ||
100 | 119 | @Callable(i) | |
101 | 120 | func addItem (title,price,data) = { | |
102 | 121 | let supplierAddress = toBase58String(i.caller.bytes) | |
103 | 122 | let item = getKeyItem(supplierAddress, title) | |
123 | + | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
104 | 124 | if ((0 >= price)) | |
105 | 125 | then throw("Purchase amount cannot be less that item price") | |
106 | 126 | else if ((getValueItemSupplier(item) != NONE)) | |
107 | 127 | then throw("This item already exist") | |
108 | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
128 | + | else if ((supplierWhiteList == BLACKLISTED)) | |
129 | + | then throw("Supplier's account has been blacklisted") | |
130 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)]) | |
109 | 131 | } | |
110 | 132 | ||
111 | 133 |
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 VOTERS = 3 | |
7 | 7 | ||
8 | 8 | let QUORUM = 2 | |
9 | 9 | ||
10 | 10 | let VOTING = "voting" | |
11 | 11 | ||
12 | 12 | let REVEAL = "reveal" | |
13 | 13 | ||
14 | 14 | let FEATURED = "featured" | |
15 | 15 | ||
16 | 16 | let DELISTED = "delisted" | |
17 | 17 | ||
18 | 18 | func getNumberByKey (key) = { | |
19 | 19 | let num = match getInteger(this, key) { | |
20 | 20 | case a: Int => | |
21 | 21 | a | |
22 | 22 | case _ => | |
23 | 23 | 0 | |
24 | 24 | } | |
25 | 25 | num | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func getStrByKey (key) = { | |
30 | 30 | let str = match getString(this, key) { | |
31 | 31 | case a: String => | |
32 | 32 | a | |
33 | 33 | case _ => | |
34 | 34 | NONE | |
35 | 35 | } | |
36 | 36 | str | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getKeyItemPrice (item) = (item + "_price") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getKeyUserItemCounter (user,item) = ((item + "_user") + "_cnt") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getKeyItemData (item) = (item + "_data") | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func getKeyItemSupplier (item) = (item + "_owner") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func getKeyBalanceSupplier (account) = (account + "_balance") | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
68 | 68 | ||
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 | + | func getExtAddressOracle () = extract(addressFromString("3N3M8E7uF1QstBzTMeobiUg1rGFttQNbgCz")) | |
101 | + | ||
102 | + | ||
103 | + | let BLACKLISTED = "blacklist" | |
104 | + | ||
105 | + | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") | |
106 | + | ||
107 | + | ||
108 | + | func getExtValueItemWhiteListStatus (oracle,account) = { | |
109 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { | |
110 | + | case a: String => | |
111 | + | a | |
112 | + | case _ => | |
113 | + | NONE | |
114 | + | } | |
115 | + | str | |
116 | + | } | |
117 | + | ||
118 | + | ||
100 | 119 | @Callable(i) | |
101 | 120 | func addItem (title,price,data) = { | |
102 | 121 | let supplierAddress = toBase58String(i.caller.bytes) | |
103 | 122 | let item = getKeyItem(supplierAddress, title) | |
123 | + | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
104 | 124 | if ((0 >= price)) | |
105 | 125 | then throw("Purchase amount cannot be less that item price") | |
106 | 126 | else if ((getValueItemSupplier(item) != NONE)) | |
107 | 127 | then throw("This item already exist") | |
108 | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
128 | + | else if ((supplierWhiteList == BLACKLISTED)) | |
129 | + | then throw("Supplier's account has been blacklisted") | |
130 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)]) | |
109 | 131 | } | |
110 | 132 | ||
111 | 133 | ||
112 | 134 | ||
113 | 135 | @Callable(i) | |
114 | 136 | func purchase (item) = { | |
115 | 137 | let pmt = extract(i.payment) | |
116 | 138 | if (isDefined(pmt.assetId)) | |
117 | 139 | then throw("Waves token only at this moment") | |
118 | 140 | else { | |
119 | 141 | let userAddress = toBase58String(i.caller.bytes) | |
120 | 142 | let price = getValueItemPrice(item) | |
121 | 143 | let supplierAddress = getValueItemSupplier(item) | |
122 | 144 | if ((price > pmt.amount)) | |
123 | 145 | then throw("Purchase amount can not be less than item price") | |
124 | 146 | else if ((pmt.amount > price)) | |
125 | 147 | then throw("Purchase amount can not be higher than item price") | |
126 | 148 | else if ((supplierAddress == NONE)) | |
127 | 149 | then throw("Supplier does not exist") | |
128 | 150 | else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]) | |
129 | 151 | } | |
130 | 152 | } | |
131 | 153 | ||
132 | 154 | ||
133 | 155 | ||
134 | 156 | @Callable(i) | |
135 | 157 | func withdraw () = { | |
136 | 158 | let supplierAddress = toBase58String(i.caller.bytes) | |
137 | 159 | let balance = getValueBalanceSupplier(supplierAddress) | |
138 | 160 | if ((0 >= balance)) | |
139 | 161 | then throw("Insufficient Balance") | |
140 | 162 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)])) | |
141 | 163 | } | |
142 | 164 | ||
143 | 165 | ||
144 | 166 | ||
145 | 167 | @Callable(i) | |
146 | 168 | func voteCommit (item,hash) = { | |
147 | 169 | let user = toBase58String(i.caller.bytes) | |
148 | 170 | let commits = getValueCommitsCount(item) | |
149 | 171 | let status = getValueItemStatus(item) | |
150 | 172 | if ((commits >= VOTERS)) | |
151 | 173 | then throw("Reached max numbers of voters") | |
152 | 174 | else if ((getValueCommit(item, user) != NONE)) | |
153 | 175 | then throw("User has already participated") | |
154 | 176 | else if ((getKeyItemSupplier(item) == NONE)) | |
155 | 177 | then throw("Item does not exist") | |
156 | 178 | else if (if ((status != NONE)) | |
157 | 179 | then (status != VOTING) | |
158 | 180 | else false) | |
159 | 181 | then throw("Voting is not possible") | |
160 | 182 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
161 | 183 | then REVEAL | |
162 | 184 | else VOTING)]) | |
163 | 185 | } | |
164 | 186 | ||
165 | 187 | ||
166 | 188 | ||
167 | 189 | @Callable(i) | |
168 | 190 | func voteReveal (item,vote,salt) = { | |
169 | 191 | let user = toBase58String(i.caller.bytes) | |
170 | 192 | let status = getValueItemStatus(item) | |
171 | 193 | let newVoteCount = (getValueVoteCount(item, vote) + 1) | |
172 | 194 | if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user))) | |
173 | 195 | then throw("reveal data is not valid") | |
174 | 196 | else if ((VOTERS > getValueCommitsCount(item))) | |
175 | 197 | then throw("Max number of votes hasn't been reached yet") | |
176 | 198 | else if ((getValueReveal(item, user) != NONE)) | |
177 | 199 | then throw("user has already participated") | |
178 | 200 | else if (if ((status != VOTING)) | |
179 | 201 | then (status != REVEAL) | |
180 | 202 | else false) | |
181 | 203 | then throw("wrong status") | |
182 | 204 | else if (if ((vote != FEATURED)) | |
183 | 205 | then (vote != DELISTED) | |
184 | 206 | else false) | |
185 | 207 | then throw("wrong vote") | |
186 | 208 | else if (if ((status == FEATURED)) | |
187 | 209 | then true | |
188 | 210 | else (status == DELISTED)) | |
189 | 211 | then throw("Vote has finished") | |
190 | 212 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
191 | 213 | then vote | |
192 | 214 | else REVEAL)]) | |
193 | 215 | } | |
194 | 216 | ||
195 | 217 | ||
196 | 218 | @Verifier(tx) | |
197 | 219 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
198 | 220 |
github/deemru/w8io/026f985 42.24 ms ◑