tx · B7gBHvQVXRJMAUkNK1M6RfUaSmAhyuExbYPsfY3EKMMg 3NB6ViLiZv3r5EdQ2Q8GA8GKpuwmG3zevAt: -0.05000000 Waves 2019.08.17 12:59 [634950] smart account 3NB6ViLiZv3r5EdQ2Q8GA8GKpuwmG3zevAt > SELF 0.00000000 Waves
{ "type": 13, "id": "B7gBHvQVXRJMAUkNK1M6RfUaSmAhyuExbYPsfY3EKMMg", "fee": 5000000, "feeAssetId": null, "timestamp": 1566035983155, "version": 1, "sender": "3NB6ViLiZv3r5EdQ2Q8GA8GKpuwmG3zevAt", "senderPublicKey": "3ghbp6Z5eXoKniLSE8XPjn5od7gT1K7qhk6zANBhv9C3", "proofs": [ "2nLBPfnN1B9Md81CmkNekeMtqWJ6guCgf6GQSzMuvx3is5HAn9UxVJfHFdsTGMoitjsrzQp5t9pFyjqoZCZWdRf" ], "script": "base64:AAIDAAAAAAAAAAAAAAAlAAAAAA5vd25lclB1YmxpY2tleQEAAAAgJ+LupRtywYm1DtC2wa7+mcHTm1BkasCvRteam1vswWgAAAAADGFsbGljZVB1YmtleQEAAAAgdahQG7OF8VCvnmrXif7UUhoQjaCrm/2hFDfEk/59nDEAAAAACWJvYlB1YmtleQEAAAAgoHwmi+qXZSlN20yTARZQ9O8s6pUs/3qey7EnxhpjMk8AAAAADGNvb3BlclB1YmtleQEAAAAgU/w5K0kRwpKzXSOUcyJ72drbib04bPq1q9XqkXENjioAAAAABE5PTkUCAAAABG5vbmUAAAAABlZPVEVSUwAAAAAAAAAAAwAAAAAGUVVPUlVNAAAAAAAAAAACAAAAAAZWT1RJTkcCAAAABnZvdGluZwAAAAAGUkVWRUFMAgAAAAZyZXZlYWwAAAAACEZFQVRVUkVEAgAAAAhmZWF0dXJlZAAAAAAIREVMSVNURUQCAAAACGRlbGlzdGVkAAAAAAh2ZXJpZmllcgIAAAAjM01zOXNVYjdXM0w1NUxMR3hlSFdpcWdUZmRIOXluMm1heWIAAAAACFZFUklGSUVEAgAAAAh2Z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AwUAAAAHY29wcGVyMgUAAAAEYm9iMwcGAwUAAAAHY29wcGVyMwUAAAAEYm9iMQcGAwUAAAAHY29wcGVyMwUAAAAEYm9iMgcEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADm93bmVyUHVibGlja2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGAwMFAAAADGFsbGljZUFuZEJvYgYFAAAAD2FsbGljZUFuZENvb3BlcgYFAAAADWJvYmVBbmRDb29wZXLDMsH9", "chainId": 84, "height": 634950, "spentComplexity": 0 } View: original | compacted Prev: BsxkbY6dmLCx3JF1tJDmoqGrv2gDB8BgKpwaVgToBXHw Next: 6cWt5DowfuZwP3sZBUJWyEspRUWBW816smUh3rVqXBXV Diff:
Old | New | Differences | |
---|---|---|---|
125 | 125 | ||
126 | 126 | ||
127 | 127 | @Callable(i) | |
128 | - | func bid (auctionId) = { | |
128 | + | func bid (auctionId,bid,price,endHeight) = { | |
129 | 129 | let pmt = extract(i.payment) | |
130 | 130 | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
131 | 131 | then toBase58String(value(pmt.assetId)) | |
132 | 132 | else "WAVES" | |
133 | 133 | let callerAddressStr = toBase58String(i.caller.bytes) | |
134 | - | let endHeight = getIntegerValue(this, auctionId) | |
135 | - | let startPrice = getIntegerValue(this, (auctionId + "_startPrice")) | |
136 | 134 | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
135 | + | let winner = getString(this, (auctionId + "_winner")) | |
137 | 136 | let winAmount = getInteger(this, (auctionId + "_winAmount")) | |
138 | - | let winner = getString(this, (auctionId + "_winner")) | |
139 | 137 | let bidFromTheSameUser = if (isDefined(winner)) | |
140 | 138 | then (value(winner) == callerAddressStr) | |
141 | 139 | else false | |
142 | - | let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser) | |
143 | - | then value(winAmount) | |
144 | - | else 0)) | |
145 | - | if ((lastBlock.height >= endHeight)) | |
146 | - | then throw("Auction already finished") | |
147 | - | else if ((priceAssetId != pmtAssetIdStr)) | |
148 | - | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
149 | - | else if (if (if (isDefined(winAmount)) | |
150 | - | then (value(winAmount) >= totalBidAmount) | |
151 | - | else false) | |
152 | - | then true | |
153 | - | else if (!(isDefined(winAmount))) | |
154 | - | then (startPrice >= totalBidAmount) | |
155 | - | else false) | |
156 | - | then throw(("Bid must be more then " + toString(if (isDefined(winAmount)) | |
157 | - | then value(winAmount) | |
158 | - | else startPrice))) | |
159 | - | else if (if (bidFromTheSameUser) | |
160 | - | then true | |
161 | - | else !(isDefined(winner))) | |
162 | - | then WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)]) | |
163 | - | else { | |
164 | - | let previousBidderAddr = addressFromStringValue(value(winner)) | |
165 | - | let priceAsset = if (if ((priceAssetId == "WAVES")) | |
166 | - | then true | |
167 | - | else (priceAssetId == "")) | |
168 | - | then unit | |
169 | - | else fromBase58String(priceAssetId) | |
170 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)])) | |
171 | - | } | |
140 | + | if (if (bidFromTheSameUser) | |
141 | + | then true | |
142 | + | else !(isDefined(winner))) | |
143 | + | then WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), price), DataEntry((auctionId + "_count"), bid), DataEntry((auctionId + "_endHeight"), endHeight)]) | |
144 | + | else { | |
145 | + | let previousBidderAddr = addressFromStringValue(value(winner)) | |
146 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), price)]), TransferSet([ScriptTransfer(previousBidderAddr, value(winAmount), unit)])) | |
147 | + | } | |
172 | 148 | } | |
173 | 149 | ||
174 | 150 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ownerPublickey = base58'3ghbp6Z5eXoKniLSE8XPjn5od7gT1K7qhk6zANBhv9C3' | |
5 | 5 | ||
6 | 6 | let allicePubkey = base58'8vHZLEG3BmzYYVjQyNi1m11kh6FeSoVAKKwtsYXC3bqA' | |
7 | 7 | ||
8 | 8 | let bobPubkey = base58'BoU2oQn7y52MZgT1Q7vJCJwUxov9tXb2zpC5gmWQbutJ' | |
9 | 9 | ||
10 | 10 | let cooperPubkey = base58'6equaSt4fnw6gEoLGiL3dTDDGxDc4PY5NyV3gVkEEr1F' | |
11 | 11 | ||
12 | 12 | let NONE = "none" | |
13 | 13 | ||
14 | 14 | let VOTERS = 3 | |
15 | 15 | ||
16 | 16 | let QUORUM = 2 | |
17 | 17 | ||
18 | 18 | let VOTING = "voting" | |
19 | 19 | ||
20 | 20 | let REVEAL = "reveal" | |
21 | 21 | ||
22 | 22 | let FEATURED = "featured" | |
23 | 23 | ||
24 | 24 | let DELISTED = "delisted" | |
25 | 25 | ||
26 | 26 | let verifier = "3Ms9sUb7W3L55LLGxeHWiqgTfdH9yn2mayb" | |
27 | 27 | ||
28 | 28 | let VERIFIED = "verified" | |
29 | 29 | ||
30 | 30 | let BLACKLISTED = "blacklist" | |
31 | 31 | ||
32 | 32 | let maxAuctionDuration = (1440 * 30) | |
33 | 33 | ||
34 | 34 | func getNumberByKey (key) = { | |
35 | 35 | let num = match getInteger(this, key) { | |
36 | 36 | case a: Int => | |
37 | 37 | a | |
38 | 38 | case _ => | |
39 | 39 | 0 | |
40 | 40 | } | |
41 | 41 | num | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func getStrByKey (key) = { | |
46 | 46 | let str = match getString(this, key) { | |
47 | 47 | case a: String => | |
48 | 48 | a | |
49 | 49 | case _ => | |
50 | 50 | NONE | |
51 | 51 | } | |
52 | 52 | str | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func getKeyItemPrice (item) = (item + "_price") | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func getKeyItemData (item) = (item + "_data") | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func getKeyItemSupplier (item) = (item + "_owner") | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func getKeyBalanceSupplier (account) = (account + "_balance") | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func getKeyCommitsCount (item) = (item + "_comcnt") | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func getKeyItemStatus (item) = (item + "_status") | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func getKeyVoteCount (item,voute) = ((item + "_res:") + voute) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func getValueVouteCount (item,voute) = getNumberByKey(getKeyVoteCount(item, voute)) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | @Callable(i) | |
117 | 117 | func startAuction (duration,startPrice,auctionId,priceAssetId) = { | |
118 | 118 | let endHeight = (lastBlock.height + duration) | |
119 | 119 | let pmt = extract(i.payment) | |
120 | 120 | WriteSet([DataEntry(auctionId, endHeight), DataEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId)) | |
121 | 121 | then toBase58String(value(pmt.assetId)) | |
122 | 122 | else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId)]) | |
123 | 123 | } | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | ||
127 | 127 | @Callable(i) | |
128 | - | func bid (auctionId) = { | |
128 | + | func bid (auctionId,bid,price,endHeight) = { | |
129 | 129 | let pmt = extract(i.payment) | |
130 | 130 | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
131 | 131 | then toBase58String(value(pmt.assetId)) | |
132 | 132 | else "WAVES" | |
133 | 133 | let callerAddressStr = toBase58String(i.caller.bytes) | |
134 | - | let endHeight = getIntegerValue(this, auctionId) | |
135 | - | let startPrice = getIntegerValue(this, (auctionId + "_startPrice")) | |
136 | 134 | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
135 | + | let winner = getString(this, (auctionId + "_winner")) | |
137 | 136 | let winAmount = getInteger(this, (auctionId + "_winAmount")) | |
138 | - | let winner = getString(this, (auctionId + "_winner")) | |
139 | 137 | let bidFromTheSameUser = if (isDefined(winner)) | |
140 | 138 | then (value(winner) == callerAddressStr) | |
141 | 139 | else false | |
142 | - | let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser) | |
143 | - | then value(winAmount) | |
144 | - | else 0)) | |
145 | - | if ((lastBlock.height >= endHeight)) | |
146 | - | then throw("Auction already finished") | |
147 | - | else if ((priceAssetId != pmtAssetIdStr)) | |
148 | - | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
149 | - | else if (if (if (isDefined(winAmount)) | |
150 | - | then (value(winAmount) >= totalBidAmount) | |
151 | - | else false) | |
152 | - | then true | |
153 | - | else if (!(isDefined(winAmount))) | |
154 | - | then (startPrice >= totalBidAmount) | |
155 | - | else false) | |
156 | - | then throw(("Bid must be more then " + toString(if (isDefined(winAmount)) | |
157 | - | then value(winAmount) | |
158 | - | else startPrice))) | |
159 | - | else if (if (bidFromTheSameUser) | |
160 | - | then true | |
161 | - | else !(isDefined(winner))) | |
162 | - | then WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)]) | |
163 | - | else { | |
164 | - | let previousBidderAddr = addressFromStringValue(value(winner)) | |
165 | - | let priceAsset = if (if ((priceAssetId == "WAVES")) | |
166 | - | then true | |
167 | - | else (priceAssetId == "")) | |
168 | - | then unit | |
169 | - | else fromBase58String(priceAssetId) | |
170 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)])) | |
171 | - | } | |
140 | + | if (if (bidFromTheSameUser) | |
141 | + | then true | |
142 | + | else !(isDefined(winner))) | |
143 | + | then WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), price), DataEntry((auctionId + "_count"), bid), DataEntry((auctionId + "_endHeight"), endHeight)]) | |
144 | + | else { | |
145 | + | let previousBidderAddr = addressFromStringValue(value(winner)) | |
146 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), price)]), TransferSet([ScriptTransfer(previousBidderAddr, value(winAmount), unit)])) | |
147 | + | } | |
172 | 148 | } | |
173 | 149 | ||
174 | 150 | ||
175 | 151 | ||
176 | 152 | @Callable(i) | |
177 | 153 | func purchase (item) = { | |
178 | 154 | let pmt = extract(i.payment) | |
179 | 155 | if (isDefined(pmt.assetId)) | |
180 | 156 | then throw("can use Waves only at the moment") | |
181 | 157 | else { | |
182 | 158 | let userAddress = toBase58String(i.caller.bytes) | |
183 | 159 | let price = getValueItemPrice(item) | |
184 | 160 | let supplierAddress = getValueItemSupplier(item) | |
185 | 161 | if ((price > pmt.amount)) | |
186 | 162 | then throw("purchase amount cannot be less than item price") | |
187 | 163 | else if ((pmt.amount > price)) | |
188 | 164 | then throw("purchase amount cannot be higher than item price") | |
189 | 165 | else if ((supplierAddress == NONE)) | |
190 | 166 | then throw("supplier is not exist") | |
191 | 167 | else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]) | |
192 | 168 | } | |
193 | 169 | } | |
194 | 170 | ||
195 | 171 | ||
196 | 172 | ||
197 | 173 | @Callable(i) | |
198 | 174 | func addItem (title,price,data) = { | |
199 | 175 | let supplierAddress = toBase58String(i.caller.bytes) | |
200 | 176 | let item = getKeyItem(supplierAddress, title) | |
201 | 177 | if ((0 >= price)) | |
202 | 178 | then throw("purchase amount cannot be less than item price") | |
203 | 179 | else if ((getValueItemSupplier(item) != NONE)) | |
204 | 180 | then throw("An item is allready exist") | |
205 | 181 | else if ((supplierAddress == BLACKLISTED)) | |
206 | 182 | then throw("supplier's account has been blacklist") | |
207 | 183 | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
208 | 184 | } | |
209 | 185 | ||
210 | 186 | ||
211 | 187 | ||
212 | 188 | @Callable(i) | |
213 | 189 | func deposit () = { | |
214 | 190 | let pmt = extract(i.payment) | |
215 | 191 | let supplierAddress = toBase58String(i.caller.bytes) | |
216 | 192 | let balance = getValueBalanceSupplier(supplierAddress) | |
217 | 193 | let newBalance = (balance + pmt.amount) | |
218 | 194 | if (isDefined(pmt.assetId)) | |
219 | 195 | then throw("can hodl waves only at the moment") | |
220 | 196 | else if ((0 > pmt.amount)) | |
221 | 197 | then throw("Can not deposit negative amount") | |
222 | 198 | else WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), newBalance)]) | |
223 | 199 | } | |
224 | 200 | ||
225 | 201 | ||
226 | 202 | ||
227 | 203 | @Callable(i) | |
228 | 204 | func withdraw (amount) = { | |
229 | 205 | let supplierAddress = toBase58String(i.caller.bytes) | |
230 | 206 | let balance = getValueBalanceSupplier(supplierAddress) | |
231 | 207 | let newBalance = (balance - amount) | |
232 | 208 | if ((0 > amount)) | |
233 | 209 | then throw("Can not withdraw negative amount") | |
234 | 210 | else if ((0 > newBalance)) | |
235 | 211 | then throw("not enough balance") | |
236 | 212 | else if ((0 >= balance)) | |
237 | 213 | then throw("insufficient balance") | |
238 | 214 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), newBalance)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), amount, unit)])) | |
239 | 215 | } | |
240 | 216 | ||
241 | 217 | ||
242 | 218 | ||
243 | 219 | @Callable(i) | |
244 | 220 | func voteCommit (item,hash) = { | |
245 | 221 | let user = toBase58String(i.caller.bytes) | |
246 | 222 | let commits = getValueCommitsCount(item) | |
247 | 223 | let status = getValueItemStatus(item) | |
248 | 224 | if ((commits >= VOTERS)) | |
249 | 225 | then throw("reached max num of vouters") | |
250 | 226 | else if ((getValueCommit(item, user) != NONE)) | |
251 | 227 | then throw("user has allready participated") | |
252 | 228 | else if ((getKeyItemSupplier(item) == NONE)) | |
253 | 229 | then throw("item dose not exist") | |
254 | 230 | else if (if ((status != NONE)) | |
255 | 231 | then (status != VOTING) | |
256 | 232 | else false) | |
257 | 233 | then throw("vouting is not posible") | |
258 | 234 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
259 | 235 | then REVEAL | |
260 | 236 | else VOTING)]) | |
261 | 237 | } | |
262 | 238 | ||
263 | 239 | ||
264 | 240 | ||
265 | 241 | @Callable(i) | |
266 | 242 | func voteReveal (item,vote,salt) = { | |
267 | 243 | let user = toBase58String(i.caller.bytes) | |
268 | 244 | let status = getValueItemStatus(item) | |
269 | 245 | let newVoteCount = getValueVouteCount(item, vote) | |
270 | 246 | if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user))) | |
271 | 247 | then throw("reveal data is not valid") | |
272 | 248 | else if ((VOTERS > getValueCommitsCount(item))) | |
273 | 249 | then throw("max num of hasn't reached yet") | |
274 | 250 | else if ((getValueReveal(item, user) != NONE)) | |
275 | 251 | then throw("user has already participated") | |
276 | 252 | else if (if ((status != VOTING)) | |
277 | 253 | then (status != REVEAL) | |
278 | 254 | else false) | |
279 | 255 | then throw("wrong status") | |
280 | 256 | else if (if ((vote != FEATURED)) | |
281 | 257 | then (vote != DELISTED) | |
282 | 258 | else false) | |
283 | 259 | then throw("wrong vote") | |
284 | 260 | else if (if ((status == FEATURED)) | |
285 | 261 | then true | |
286 | 262 | else (status == DELISTED)) | |
287 | 263 | then throw("vote has finished") | |
288 | 264 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
289 | 265 | then vote | |
290 | 266 | else REVEAL)]) | |
291 | 267 | } | |
292 | 268 | ||
293 | 269 | ||
294 | 270 | @Verifier(tx) | |
295 | 271 | func verify () = { | |
296 | 272 | let alice1 = sigVerify(tx.bodyBytes, tx.proofs[0], allicePubkey) | |
297 | 273 | let alice2 = sigVerify(tx.bodyBytes, tx.proofs[1], allicePubkey) | |
298 | 274 | let alice3 = sigVerify(tx.bodyBytes, tx.proofs[2], allicePubkey) | |
299 | 275 | let bob1 = sigVerify(tx.bodyBytes, tx.proofs[0], bobPubkey) | |
300 | 276 | let bob2 = sigVerify(tx.bodyBytes, tx.proofs[1], bobPubkey) | |
301 | 277 | let bob3 = sigVerify(tx.bodyBytes, tx.proofs[2], bobPubkey) | |
302 | 278 | let cooper1 = sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubkey) | |
303 | 279 | let copper2 = sigVerify(tx.bodyBytes, tx.proofs[1], cooperPubkey) | |
304 | 280 | let copper3 = sigVerify(tx.bodyBytes, tx.proofs[2], cooperPubkey) | |
305 | 281 | let alliceAndBob = if (if (if (if (if (if (alice1) | |
306 | 282 | then bob2 | |
307 | 283 | else false) | |
308 | 284 | then true | |
309 | 285 | else if (alice1) | |
310 | 286 | then bob3 | |
311 | 287 | else false) | |
312 | 288 | then true | |
313 | 289 | else if (alice2) | |
314 | 290 | then bob1 | |
315 | 291 | else false) | |
316 | 292 | then true | |
317 | 293 | else if (alice2) | |
318 | 294 | then bob3 | |
319 | 295 | else false) | |
320 | 296 | then true | |
321 | 297 | else if (alice3) | |
322 | 298 | then bob1 | |
323 | 299 | else false) | |
324 | 300 | then true | |
325 | 301 | else if (alice3) | |
326 | 302 | then bob2 | |
327 | 303 | else false | |
328 | 304 | let alliceAndCooper = if (if (if (if (if (if (alice1) | |
329 | 305 | then copper2 | |
330 | 306 | else false) | |
331 | 307 | then true | |
332 | 308 | else if (alice1) | |
333 | 309 | then copper3 | |
334 | 310 | else false) | |
335 | 311 | then true | |
336 | 312 | else if (alice2) | |
337 | 313 | then cooper1 | |
338 | 314 | else false) | |
339 | 315 | then true | |
340 | 316 | else if (alice2) | |
341 | 317 | then copper3 | |
342 | 318 | else false) | |
343 | 319 | then true | |
344 | 320 | else if (alice3) | |
345 | 321 | then cooper1 | |
346 | 322 | else false) | |
347 | 323 | then true | |
348 | 324 | else if (alice3) | |
349 | 325 | then copper2 | |
350 | 326 | else false | |
351 | 327 | let bobeAndCooper = if (if (if (if (if (if (cooper1) | |
352 | 328 | then bob2 | |
353 | 329 | else false) | |
354 | 330 | then true | |
355 | 331 | else if (cooper1) | |
356 | 332 | then bob3 | |
357 | 333 | else false) | |
358 | 334 | then true | |
359 | 335 | else if (copper2) | |
360 | 336 | then bob1 | |
361 | 337 | else false) | |
362 | 338 | then true | |
363 | 339 | else if (copper2) | |
364 | 340 | then bob3 | |
365 | 341 | else false) | |
366 | 342 | then true | |
367 | 343 | else if (copper3) | |
368 | 344 | then bob1 | |
369 | 345 | else false) | |
370 | 346 | then true | |
371 | 347 | else if (copper3) | |
372 | 348 | then bob2 | |
373 | 349 | else false | |
374 | 350 | match tx { | |
375 | 351 | case d: SetScriptTransaction => | |
376 | 352 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublickey) | |
377 | 353 | case d: DataTransaction => | |
378 | 354 | true | |
379 | 355 | case _ => | |
380 | 356 | if (if (alliceAndBob) | |
381 | 357 | then true | |
382 | 358 | else alliceAndCooper) | |
383 | 359 | then true | |
384 | 360 | else bobeAndCooper | |
385 | 361 | } | |
386 | 362 | } | |
387 | 363 |
github/deemru/w8io/169f3d6 55.37 ms ◑