tx · BsxkbY6dmLCx3JF1tJDmoqGrv2gDB8BgKpwaVgToBXHw 3NB6ViLiZv3r5EdQ2Q8GA8GKpuwmG3zevAt: -0.05000000 Waves 2019.08.17 12:00 [634889] smart account 3NB6ViLiZv3r5EdQ2Q8GA8GKpuwmG3zevAt > SELF 0.00000000 Waves
{ "type": 13, "id": "BsxkbY6dmLCx3JF1tJDmoqGrv2gDB8BgKpwaVgToBXHw", "fee": 5000000, "feeAssetId": null, "timestamp": 1566032486326, "version": 1, "sender": "3NB6ViLiZv3r5EdQ2Q8GA8GKpuwmG3zevAt", "senderPublicKey": "3ghbp6Z5eXoKniLSE8XPjn5od7gT1K7qhk6zANBhv9C3", "proofs": [ "5QoMPuLj6rvAtxBKpDo6WhJYpBFWAXzArkY8wSymshvhdaGpX5oMceXScsnnaemUUvAo8JSL5ozd4eQ1hqnpHtKy" ], "script": "base64:AAIDAAAAAAAAAAAAAAAlAAAAAA5vd25lclB1YmxpY2tleQEAAAAgJ+LupRtywYm1DtC2wa7+mcHTm1BkasCvRteam1vswWgAAAAADGFsbGljZVB1YmtleQEAAAAgdahQG7OF8VCvnmrXif7UUhoQjaCrm/2hFDfEk/59nDEAAAAACWJvYlB1YmtleQEAAAAgoHwmi+qXZSlN20yTARZQ9O8s6pUs/3qey7EnxhpjMk8AAAAADGNvb3BlclB1YmtleQEAAAAgU/w5K0kRwpKzXSOUcyJ72drbib04bPq1q9XqkXENjioAAAAABE5PTkUCAAAABG5vbmUAAAAABlZPVEVSUwAAAAAAAAAAAwAAAAAGUVVPUlVNAAAAAAAAAAACAAAAAAZWT1RJTkcCAAAABnZvdGluZwAAAAAGUkVWRUFMAgAAAAZyZXZlYWwAAAAACEZFQVRVUkVEAgAAAAhmZWF0dXJlZAAAAAAIREVMSVNURUQCAAAACGRlbGlzdGVkAAAAAAh2ZXJpZmllcgIAAAAjM01zOXNVYjdXM0w1NUxMR3hlSFdpcWdUZmRIOXluMm1heWIAAAAACFZFUklGSUVEAgAAAAh2Z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2NvcHBlcjMFAAAABGJvYjIHBAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgMDBQAAAAxhbGxpY2VBbmRCb2IGBQAAAA9hbGxpY2VBbmRDb29wZXIGBQAAAA1ib2JlQW5kQ29vcGVygVhm7Q==", "chainId": 84, "height": 634889, "spentComplexity": 0 } View: original | compacted Prev: E9mRHv82fimc1iEFHocqtEv4TAUfM4TPFTV9v65zWmvZ Next: B7gBHvQVXRJMAUkNK1M6RfUaSmAhyuExbYPsfY3EKMMg Diff:
Old | New | Differences | |
---|---|---|---|
114 | 114 | ||
115 | 115 | ||
116 | 116 | @Callable(i) | |
117 | - | func startAuction (duration,startPrice,priceAssetId) = { | |
118 | - | let auctionId = toBase58String(i.transactionId) | |
117 | + | func startAuction (duration,startPrice,auctionId,priceAssetId) = { | |
119 | 118 | let endHeight = (lastBlock.height + duration) | |
120 | 119 | let pmt = extract(i.payment) | |
121 | 120 | WriteSet([DataEntry(auctionId, endHeight), DataEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId)) |
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 | - | func startAuction (duration,startPrice,priceAssetId) = { | |
118 | - | let auctionId = toBase58String(i.transactionId) | |
117 | + | func startAuction (duration,startPrice,auctionId,priceAssetId) = { | |
119 | 118 | let endHeight = (lastBlock.height + duration) | |
120 | 119 | let pmt = extract(i.payment) | |
121 | 120 | WriteSet([DataEntry(auctionId, endHeight), DataEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId)) | |
122 | 121 | then toBase58String(value(pmt.assetId)) | |
123 | 122 | else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId)]) | |
124 | 123 | } | |
125 | 124 | ||
126 | 125 | ||
127 | 126 | ||
128 | 127 | @Callable(i) | |
129 | 128 | func bid (auctionId) = { | |
130 | 129 | let pmt = extract(i.payment) | |
131 | 130 | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
132 | 131 | then toBase58String(value(pmt.assetId)) | |
133 | 132 | else "WAVES" | |
134 | 133 | let callerAddressStr = toBase58String(i.caller.bytes) | |
135 | 134 | let endHeight = getIntegerValue(this, auctionId) | |
136 | 135 | let startPrice = getIntegerValue(this, (auctionId + "_startPrice")) | |
137 | 136 | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
138 | 137 | let winAmount = getInteger(this, (auctionId + "_winAmount")) | |
139 | 138 | let winner = getString(this, (auctionId + "_winner")) | |
140 | 139 | let bidFromTheSameUser = if (isDefined(winner)) | |
141 | 140 | then (value(winner) == callerAddressStr) | |
142 | 141 | else false | |
143 | 142 | let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser) | |
144 | 143 | then value(winAmount) | |
145 | 144 | else 0)) | |
146 | 145 | if ((lastBlock.height >= endHeight)) | |
147 | 146 | then throw("Auction already finished") | |
148 | 147 | else if ((priceAssetId != pmtAssetIdStr)) | |
149 | 148 | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
150 | 149 | else if (if (if (isDefined(winAmount)) | |
151 | 150 | then (value(winAmount) >= totalBidAmount) | |
152 | 151 | else false) | |
153 | 152 | then true | |
154 | 153 | else if (!(isDefined(winAmount))) | |
155 | 154 | then (startPrice >= totalBidAmount) | |
156 | 155 | else false) | |
157 | 156 | then throw(("Bid must be more then " + toString(if (isDefined(winAmount)) | |
158 | 157 | then value(winAmount) | |
159 | 158 | else startPrice))) | |
160 | 159 | else if (if (bidFromTheSameUser) | |
161 | 160 | then true | |
162 | 161 | else !(isDefined(winner))) | |
163 | 162 | then WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)]) | |
164 | 163 | else { | |
165 | 164 | let previousBidderAddr = addressFromStringValue(value(winner)) | |
166 | 165 | let priceAsset = if (if ((priceAssetId == "WAVES")) | |
167 | 166 | then true | |
168 | 167 | else (priceAssetId == "")) | |
169 | 168 | then unit | |
170 | 169 | else fromBase58String(priceAssetId) | |
171 | 170 | ScriptResult(WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)])) | |
172 | 171 | } | |
173 | 172 | } | |
174 | 173 | ||
175 | 174 | ||
176 | 175 | ||
177 | 176 | @Callable(i) | |
178 | 177 | func purchase (item) = { | |
179 | 178 | let pmt = extract(i.payment) | |
180 | 179 | if (isDefined(pmt.assetId)) | |
181 | 180 | then throw("can use Waves only at the moment") | |
182 | 181 | else { | |
183 | 182 | let userAddress = toBase58String(i.caller.bytes) | |
184 | 183 | let price = getValueItemPrice(item) | |
185 | 184 | let supplierAddress = getValueItemSupplier(item) | |
186 | 185 | if ((price > pmt.amount)) | |
187 | 186 | then throw("purchase amount cannot be less than item price") | |
188 | 187 | else if ((pmt.amount > price)) | |
189 | 188 | then throw("purchase amount cannot be higher than item price") | |
190 | 189 | else if ((supplierAddress == NONE)) | |
191 | 190 | then throw("supplier is not exist") | |
192 | 191 | else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]) | |
193 | 192 | } | |
194 | 193 | } | |
195 | 194 | ||
196 | 195 | ||
197 | 196 | ||
198 | 197 | @Callable(i) | |
199 | 198 | func addItem (title,price,data) = { | |
200 | 199 | let supplierAddress = toBase58String(i.caller.bytes) | |
201 | 200 | let item = getKeyItem(supplierAddress, title) | |
202 | 201 | if ((0 >= price)) | |
203 | 202 | then throw("purchase amount cannot be less than item price") | |
204 | 203 | else if ((getValueItemSupplier(item) != NONE)) | |
205 | 204 | then throw("An item is allready exist") | |
206 | 205 | else if ((supplierAddress == BLACKLISTED)) | |
207 | 206 | then throw("supplier's account has been blacklist") | |
208 | 207 | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
209 | 208 | } | |
210 | 209 | ||
211 | 210 | ||
212 | 211 | ||
213 | 212 | @Callable(i) | |
214 | 213 | func deposit () = { | |
215 | 214 | let pmt = extract(i.payment) | |
216 | 215 | let supplierAddress = toBase58String(i.caller.bytes) | |
217 | 216 | let balance = getValueBalanceSupplier(supplierAddress) | |
218 | 217 | let newBalance = (balance + pmt.amount) | |
219 | 218 | if (isDefined(pmt.assetId)) | |
220 | 219 | then throw("can hodl waves only at the moment") | |
221 | 220 | else if ((0 > pmt.amount)) | |
222 | 221 | then throw("Can not deposit negative amount") | |
223 | 222 | else WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), newBalance)]) | |
224 | 223 | } | |
225 | 224 | ||
226 | 225 | ||
227 | 226 | ||
228 | 227 | @Callable(i) | |
229 | 228 | func withdraw (amount) = { | |
230 | 229 | let supplierAddress = toBase58String(i.caller.bytes) | |
231 | 230 | let balance = getValueBalanceSupplier(supplierAddress) | |
232 | 231 | let newBalance = (balance - amount) | |
233 | 232 | if ((0 > amount)) | |
234 | 233 | then throw("Can not withdraw negative amount") | |
235 | 234 | else if ((0 > newBalance)) | |
236 | 235 | then throw("not enough balance") | |
237 | 236 | else if ((0 >= balance)) | |
238 | 237 | then throw("insufficient balance") | |
239 | 238 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), newBalance)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), amount, unit)])) | |
240 | 239 | } | |
241 | 240 | ||
242 | 241 | ||
243 | 242 | ||
244 | 243 | @Callable(i) | |
245 | 244 | func voteCommit (item,hash) = { | |
246 | 245 | let user = toBase58String(i.caller.bytes) | |
247 | 246 | let commits = getValueCommitsCount(item) | |
248 | 247 | let status = getValueItemStatus(item) | |
249 | 248 | if ((commits >= VOTERS)) | |
250 | 249 | then throw("reached max num of vouters") | |
251 | 250 | else if ((getValueCommit(item, user) != NONE)) | |
252 | 251 | then throw("user has allready participated") | |
253 | 252 | else if ((getKeyItemSupplier(item) == NONE)) | |
254 | 253 | then throw("item dose not exist") | |
255 | 254 | else if (if ((status != NONE)) | |
256 | 255 | then (status != VOTING) | |
257 | 256 | else false) | |
258 | 257 | then throw("vouting is not posible") | |
259 | 258 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
260 | 259 | then REVEAL | |
261 | 260 | else VOTING)]) | |
262 | 261 | } | |
263 | 262 | ||
264 | 263 | ||
265 | 264 | ||
266 | 265 | @Callable(i) | |
267 | 266 | func voteReveal (item,vote,salt) = { | |
268 | 267 | let user = toBase58String(i.caller.bytes) | |
269 | 268 | let status = getValueItemStatus(item) | |
270 | 269 | let newVoteCount = getValueVouteCount(item, vote) | |
271 | 270 | if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user))) | |
272 | 271 | then throw("reveal data is not valid") | |
273 | 272 | else if ((VOTERS > getValueCommitsCount(item))) | |
274 | 273 | then throw("max num of hasn't reached yet") | |
275 | 274 | else if ((getValueReveal(item, user) != NONE)) | |
276 | 275 | then throw("user has already participated") | |
277 | 276 | else if (if ((status != VOTING)) | |
278 | 277 | then (status != REVEAL) | |
279 | 278 | else false) | |
280 | 279 | then throw("wrong status") | |
281 | 280 | else if (if ((vote != FEATURED)) | |
282 | 281 | then (vote != DELISTED) | |
283 | 282 | else false) | |
284 | 283 | then throw("wrong vote") | |
285 | 284 | else if (if ((status == FEATURED)) | |
286 | 285 | then true | |
287 | 286 | else (status == DELISTED)) | |
288 | 287 | then throw("vote has finished") | |
289 | 288 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
290 | 289 | then vote | |
291 | 290 | else REVEAL)]) | |
292 | 291 | } | |
293 | 292 | ||
294 | 293 | ||
295 | 294 | @Verifier(tx) | |
296 | 295 | func verify () = { | |
297 | 296 | let alice1 = sigVerify(tx.bodyBytes, tx.proofs[0], allicePubkey) | |
298 | 297 | let alice2 = sigVerify(tx.bodyBytes, tx.proofs[1], allicePubkey) | |
299 | 298 | let alice3 = sigVerify(tx.bodyBytes, tx.proofs[2], allicePubkey) | |
300 | 299 | let bob1 = sigVerify(tx.bodyBytes, tx.proofs[0], bobPubkey) | |
301 | 300 | let bob2 = sigVerify(tx.bodyBytes, tx.proofs[1], bobPubkey) | |
302 | 301 | let bob3 = sigVerify(tx.bodyBytes, tx.proofs[2], bobPubkey) | |
303 | 302 | let cooper1 = sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubkey) | |
304 | 303 | let copper2 = sigVerify(tx.bodyBytes, tx.proofs[1], cooperPubkey) | |
305 | 304 | let copper3 = sigVerify(tx.bodyBytes, tx.proofs[2], cooperPubkey) | |
306 | 305 | let alliceAndBob = if (if (if (if (if (if (alice1) | |
307 | 306 | then bob2 | |
308 | 307 | else false) | |
309 | 308 | then true | |
310 | 309 | else if (alice1) | |
311 | 310 | then bob3 | |
312 | 311 | else false) | |
313 | 312 | then true | |
314 | 313 | else if (alice2) | |
315 | 314 | then bob1 | |
316 | 315 | else false) | |
317 | 316 | then true | |
318 | 317 | else if (alice2) | |
319 | 318 | then bob3 | |
320 | 319 | else false) | |
321 | 320 | then true | |
322 | 321 | else if (alice3) | |
323 | 322 | then bob1 | |
324 | 323 | else false) | |
325 | 324 | then true | |
326 | 325 | else if (alice3) | |
327 | 326 | then bob2 | |
328 | 327 | else false | |
329 | 328 | let alliceAndCooper = if (if (if (if (if (if (alice1) | |
330 | 329 | then copper2 | |
331 | 330 | else false) | |
332 | 331 | then true | |
333 | 332 | else if (alice1) | |
334 | 333 | then copper3 | |
335 | 334 | else false) | |
336 | 335 | then true | |
337 | 336 | else if (alice2) | |
338 | 337 | then cooper1 | |
339 | 338 | else false) | |
340 | 339 | then true | |
341 | 340 | else if (alice2) | |
342 | 341 | then copper3 | |
343 | 342 | else false) | |
344 | 343 | then true | |
345 | 344 | else if (alice3) | |
346 | 345 | then cooper1 | |
347 | 346 | else false) | |
348 | 347 | then true | |
349 | 348 | else if (alice3) | |
350 | 349 | then copper2 | |
351 | 350 | else false | |
352 | 351 | let bobeAndCooper = if (if (if (if (if (if (cooper1) | |
353 | 352 | then bob2 | |
354 | 353 | else false) | |
355 | 354 | then true | |
356 | 355 | else if (cooper1) | |
357 | 356 | then bob3 | |
358 | 357 | else false) | |
359 | 358 | then true | |
360 | 359 | else if (copper2) | |
361 | 360 | then bob1 | |
362 | 361 | else false) | |
363 | 362 | then true | |
364 | 363 | else if (copper2) | |
365 | 364 | then bob3 | |
366 | 365 | else false) | |
367 | 366 | then true | |
368 | 367 | else if (copper3) | |
369 | 368 | then bob1 | |
370 | 369 | else false) | |
371 | 370 | then true | |
372 | 371 | else if (copper3) | |
373 | 372 | then bob2 | |
374 | 373 | else false | |
375 | 374 | match tx { | |
376 | 375 | case d: SetScriptTransaction => | |
377 | 376 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublickey) | |
378 | 377 | case d: DataTransaction => | |
379 | 378 | true | |
380 | 379 | case _ => | |
381 | 380 | if (if (alliceAndBob) | |
382 | 381 | then true | |
383 | 382 | else alliceAndCooper) | |
384 | 383 | then true | |
385 | 384 | else bobeAndCooper | |
386 | 385 | } | |
387 | 386 | } | |
388 | 387 |
github/deemru/w8io/169f3d6 58.89 ms ◑