72 | | - | (G + E) |
---|
73 | | - | } |
---|
74 | | - | |
---|
75 | | - | |
---|
76 | | - | func J (D,E) = { |
---|
77 | | - | let F = getInteger(this, (D + "_Freezed")) |
---|
78 | | - | let G = { |
---|
79 | | - | let H = F |
---|
80 | | - | if ($isInstanceOf(H, "Int")) |
---|
81 | | - | then { |
---|
82 | | - | let I = H |
---|
83 | | - | I |
---|
84 | | - | } |
---|
85 | | - | else 0 |
---|
86 | | - | } |
---|
87 | | - | let I = (G - E) |
---|
88 | | - | if ((I > 0)) |
---|
89 | | - | then I |
---|
90 | | - | else throw("Freezed amount couldn't be less than 0") |
---|
91 | | - | } |
---|
92 | | - | |
---|
93 | | - | |
---|
94 | | - | func K (L) = { |
---|
95 | | - | let K = getString(this, (L + "_Freelancer")) |
---|
96 | | - | let H = K |
---|
97 | | - | if ($isInstanceOf(H, "String")) |
---|
98 | | - | then { |
---|
99 | | - | let I = H |
---|
100 | | - | L |
---|
101 | | - | } |
---|
102 | | - | else throw("Only registered users can make bets") |
---|
103 | | - | } |
---|
104 | | - | |
---|
105 | | - | |
---|
106 | | - | func M (N) = if ((N > 0)) |
---|
107 | | - | then N |
---|
108 | | - | else throw("Amount must be higher then 0") |
---|
109 | | - | |
---|
110 | | - | |
---|
111 | | - | func O (v) = { |
---|
112 | | - | let P = getString(this, (v + "_State")) |
---|
113 | | - | let H = P |
---|
114 | | - | if ($isInstanceOf(H, "String")) |
---|
115 | | - | then { |
---|
116 | | - | let I = H |
---|
117 | | - | I |
---|
118 | | - | } |
---|
119 | | - | else throw("Auction State was not found") |
---|
120 | | - | } |
---|
121 | | - | |
---|
122 | | - | |
---|
123 | | - | func Q (v) = { |
---|
124 | | - | let R = getString(this, (v + "_AuctionClient")) |
---|
125 | | - | let I = { |
---|
126 | | - | let H = R |
---|
127 | | - | if ($isInstanceOf(H, "String")) |
---|
128 | | - | then { |
---|
129 | | - | let I = H |
---|
130 | | - | I |
---|
131 | | - | } |
---|
132 | | - | else throw("Auction Client was not found") |
---|
133 | | - | } |
---|
134 | | - | fromBase58String(I) |
---|
135 | | - | } |
---|
136 | | - | |
---|
137 | | - | |
---|
138 | | - | func S (v) = { |
---|
139 | | - | let T = getInteger(this, (v + "_AuctionStart")) |
---|
140 | | - | let H = T |
---|
141 | | - | if ($isInstanceOf(H, "Int")) |
---|
142 | | - | then { |
---|
143 | | - | let I = H |
---|
144 | | - | I |
---|
145 | | - | } |
---|
146 | | - | else throw("Auction Start time was not found") |
---|
147 | | - | } |
---|
148 | | - | |
---|
149 | | - | |
---|
150 | | - | func U (v) = { |
---|
151 | | - | let V = getInteger(this, (v + "_AuctionDuration")) |
---|
152 | | - | let H = V |
---|
153 | | - | if ($isInstanceOf(H, "Int")) |
---|
154 | | - | then { |
---|
155 | | - | let I = H |
---|
156 | | - | I |
---|
157 | | - | } |
---|
158 | | - | else throw("Auction duration time was not found") |
---|
159 | | - | } |
---|
160 | | - | |
---|
161 | | - | |
---|
162 | | - | func W (v) = { |
---|
163 | | - | let X = getInteger(this, (v + "_JobPerformance")) |
---|
164 | | - | let H = X |
---|
165 | | - | if ($isInstanceOf(H, "Int")) |
---|
166 | | - | then { |
---|
167 | | - | let I = H |
---|
168 | | - | I |
---|
169 | | - | } |
---|
170 | | - | else throw("Auction job performance time was not found") |
---|
171 | | - | } |
---|
172 | | - | |
---|
173 | | - | |
---|
174 | | - | func Y (v) = { |
---|
175 | | - | let Z = getString(this, (v + "_AssetName")) |
---|
176 | | - | let H = Z |
---|
177 | | - | if ($isInstanceOf(H, "String")) |
---|
178 | | - | then { |
---|
179 | | - | let I = H |
---|
180 | | - | I |
---|
181 | | - | } |
---|
182 | | - | else throw("Auction asset name was not found") |
---|
183 | | - | } |
---|
184 | | - | |
---|
185 | | - | |
---|
186 | | - | func aa (v) = { |
---|
187 | | - | let ab = getInteger(this, (v + "_Price")) |
---|
188 | | - | let H = ab |
---|
189 | | - | if ($isInstanceOf(H, "Int")) |
---|
190 | | - | then { |
---|
191 | | - | let I = H |
---|
192 | | - | I |
---|
193 | | - | } |
---|
194 | | - | else throw("Auction price was not found") |
---|
195 | | - | } |
---|
196 | | - | |
---|
197 | | - | |
---|
198 | | - | func ac (v) = { |
---|
199 | | - | let R = getString(this, (v + "_HiredFreelancer")) |
---|
200 | | - | let I = { |
---|
201 | | - | let H = R |
---|
202 | | - | if ($isInstanceOf(H, "String")) |
---|
203 | | - | then { |
---|
204 | | - | let I = H |
---|
205 | | - | I |
---|
206 | | - | } |
---|
207 | | - | else throw("Auction Client was not found") |
---|
208 | | - | } |
---|
209 | | - | fromBase58String(I) |
---|
210 | | - | } |
---|
211 | | - | |
---|
212 | | - | |
---|
213 | | - | @Callable(ad) |
---|
214 | | - | func freelancerSignUp (ae) = { |
---|
215 | | - | let af = toBase58String(ad.callerPublicKey) |
---|
216 | | - | let ag = getString(this, (af + "_Freelancer")) |
---|
217 | | - | if (isDefined(ag)) |
---|
218 | | - | then throw("User already registered") |
---|
219 | | - | else WriteSet([DataEntry((af + "_Freelancer"), ae)]) |
---|
| 18 | + | let h = split(e, ".") |
---|
| 19 | + | let i = (h[0] + h[1]) |
---|
| 20 | + | let j = parseIntValue(take(i, 4)) |
---|
| 21 | + | let k = (100000000 * 100000000) |
---|
| 22 | + | let l = assetBalance(addressFromStringValue(d), base58'WAVES') |
---|
| 23 | + | let m = base58'FneCJqM5BP2eAuyteMiuEEHYALrE4axhEfcpHVGbdr5s' |
---|
| 24 | + | WriteSet([DataEntry("euroPrice", e), DataEntry("euroPrice2", i), DataEntry("euroPrice3", j), DataEntry("Amount1", l), DataEntry("toBase58Pub", toBase58String(m))]) |
---|
233 | | - | |
---|
234 | | - | |
---|
235 | | - | @Callable(ad) |
---|
236 | | - | func createAuction (ah,ai,aj) = { |
---|
237 | | - | let v = toBase58String(ad.transactionId) |
---|
238 | | - | let ak = toBase58String(ad.callerPublicKey) |
---|
239 | | - | let al = extract(ad.payment) |
---|
240 | | - | let N = al.amount |
---|
241 | | - | let E = M(N) |
---|
242 | | - | let am = height |
---|
243 | | - | let an = (ai * a) |
---|
244 | | - | let ao = (ah * a) |
---|
245 | | - | let D = if (!(isDefined(al.assetId))) |
---|
246 | | - | then "WAVES" |
---|
247 | | - | else if ((al.assetId == c)) |
---|
248 | | - | then "BTC" |
---|
249 | | - | else if ((al.assetId == d)) |
---|
250 | | - | then "EUR" |
---|
251 | | - | else if ((al.assetId == e)) |
---|
252 | | - | then "USD" |
---|
253 | | - | else throw("AssetId is incorrect") |
---|
254 | | - | let ap = C(D, E) |
---|
255 | | - | WriteSet([DataEntry((v + "_State"), f), DataEntry((v + "_Info"), aj), DataEntry((v + "_AuctionClient"), ak), DataEntry((v + "_AuctionStart"), am), DataEntry((v + "_AuctionDuration"), an), DataEntry((v + "_JobPerformance"), ao), DataEntry((v + "_AssetName"), D), DataEntry((v + "_Price"), E), DataEntry((D + "_Freezed"), ap)]) |
---|
256 | | - | } |
---|
257 | | - | |
---|
258 | | - | |
---|
259 | | - | |
---|
260 | | - | @Callable(ad) |
---|
261 | | - | func makeBid (v,aq) = { |
---|
262 | | - | let L = toBase58String(ad.callerPublicKey) |
---|
263 | | - | let ar = height |
---|
264 | | - | let as = O(v) |
---|
265 | | - | let ak = Q(v) |
---|
266 | | - | let am = S(v) |
---|
267 | | - | let at = U(v) |
---|
268 | | - | let au = W(v) |
---|
269 | | - | let x = Y(v) |
---|
270 | | - | let E = aa(v) |
---|
271 | | - | let av = w(x) |
---|
272 | | - | let aw = K(L) |
---|
273 | | - | let ax = ((E * 3) / 100) |
---|
274 | | - | let ap = J(x, E) |
---|
275 | | - | let ay = y(ar, am, at) |
---|
276 | | - | if (ay) |
---|
277 | | - | then if ((as == f)) |
---|
278 | | - | then ScriptResult(WriteSet([DataEntry((v + "_State"), h), DataEntry((x + "_Freezed"), ap)]), TransferSet([ScriptTransfer(addressFromPublicKey(ak), (E - ax), av)])) |
---|
279 | | - | else if ((as == g)) |
---|
280 | | - | then { |
---|
281 | | - | let az = { |
---|
282 | | - | let aA = getString(this, (v + "_LowestBidderPub")) |
---|
283 | | - | let H = aA |
---|
284 | | - | if ($isInstanceOf(H, "String")) |
---|
285 | | - | then { |
---|
286 | | - | let I = H |
---|
287 | | - | I |
---|
288 | | - | } |
---|
289 | | - | else throw("Auction lowest bidder was not found") |
---|
290 | | - | } |
---|
291 | | - | let aB = { |
---|
292 | | - | let aC = getInteger(this, ((v + "_Bid_") + az)) |
---|
293 | | - | let H = aC |
---|
294 | | - | if ($isInstanceOf(H, "Int")) |
---|
295 | | - | then { |
---|
296 | | - | let I = H |
---|
297 | | - | I |
---|
298 | | - | } |
---|
299 | | - | else throw("Auction lowest bid was not found") |
---|
300 | | - | } |
---|
301 | | - | let aD = ((E - aB) - ax) |
---|
302 | | - | ScriptResult(WriteSet([DataEntry((v + "_State"), i), DataEntry((v + "_HiredFreelancer"), az), DataEntry((v + "_Price"), aB)]), TransferSet([ScriptTransfer(addressFromPublicKey(ak), aD, av)])) |
---|
303 | | - | } |
---|
304 | | - | else throw("Incorrect auction state") |
---|
305 | | - | else if ((as == f)) |
---|
306 | | - | then WriteSet([DataEntry(((v + "_Bid_") + aw), aq), DataEntry((v + "_State"), g), DataEntry((v + "_LowestBidderPub"), L)]) |
---|
307 | | - | else if ((as == g)) |
---|
308 | | - | then { |
---|
309 | | - | let aE = { |
---|
310 | | - | let aF = getString(this, (v + "_LowestBidderPub")) |
---|
311 | | - | let H = aF |
---|
312 | | - | if ($isInstanceOf(H, "String")) |
---|
313 | | - | then { |
---|
314 | | - | let I = H |
---|
315 | | - | I |
---|
316 | | - | } |
---|
317 | | - | else throw("Auction lowest bidder was not found") |
---|
318 | | - | } |
---|
319 | | - | let aG = { |
---|
320 | | - | let aH = getInteger(this, ((v + "_Bid_") + aE)) |
---|
321 | | - | let aI = { |
---|
322 | | - | let H = aH |
---|
323 | | - | if ($isInstanceOf(H, "Int")) |
---|
324 | | - | then { |
---|
325 | | - | let I = H |
---|
326 | | - | I |
---|
327 | | - | } |
---|
328 | | - | else throw("Auction lowest bid was not found") |
---|
329 | | - | } |
---|
330 | | - | if ((aI > aq)) |
---|
331 | | - | then aw |
---|
332 | | - | else aE |
---|
333 | | - | } |
---|
334 | | - | WriteSet([DataEntry((v + "_LowestBidderPub"), aG), DataEntry(((v + "_Bid_") + aw), aq)]) |
---|
335 | | - | } |
---|
336 | | - | else throw(((((("Incorrect jobId state. Now: " + as) + ", must be: ") + f) + " or ") + g)) |
---|
337 | | - | } |
---|
338 | | - | |
---|
339 | | - | |
---|
340 | | - | |
---|
341 | | - | @Callable(ad) |
---|
342 | | - | func chooseFreelancer (v,aJ) = { |
---|
343 | | - | let L = extract(ad.callerPublicKey) |
---|
344 | | - | let ar = height |
---|
345 | | - | let as = O(v) |
---|
346 | | - | let ak = Q(v) |
---|
347 | | - | let am = S(v) |
---|
348 | | - | let at = U(v) |
---|
349 | | - | let x = Y(v) |
---|
350 | | - | let E = aa(v) |
---|
351 | | - | let av = w(x) |
---|
352 | | - | let aK = { |
---|
353 | | - | let aL = ((v + "_Bid_") + aJ) |
---|
354 | | - | let aM = getInteger(this, aL) |
---|
355 | | - | let H = aM |
---|
356 | | - | if ($isInstanceOf(H, "Int")) |
---|
357 | | - | then { |
---|
358 | | - | let I = H |
---|
359 | | - | I |
---|
360 | | - | } |
---|
361 | | - | else throw("Freelancer's bet was not found") |
---|
362 | | - | } |
---|
363 | | - | let ax = ((aK * 3) / 100) |
---|
364 | | - | let ay = y(ar, am, at) |
---|
365 | | - | if ((L == ak)) |
---|
366 | | - | then if (ay) |
---|
367 | | - | then if ((as == f)) |
---|
368 | | - | then { |
---|
369 | | - | let ap = J(x, E) |
---|
370 | | - | ScriptResult(WriteSet([DataEntry((v + "_State"), h), DataEntry((x + "_Freezed"), ap)]), TransferSet([ScriptTransfer(addressFromPublicKey(ak), (E - ax), av)])) |
---|
371 | | - | } |
---|
372 | | - | else if ((as == g)) |
---|
373 | | - | then { |
---|
374 | | - | let az = { |
---|
375 | | - | let aA = getString(this, (v + "_LowestBidderPub")) |
---|
376 | | - | let H = aA |
---|
377 | | - | if ($isInstanceOf(H, "String")) |
---|
378 | | - | then { |
---|
379 | | - | let I = H |
---|
380 | | - | I |
---|
381 | | - | } |
---|
382 | | - | else throw("Auction lowest bidder was not found") |
---|
383 | | - | } |
---|
384 | | - | let aB = { |
---|
385 | | - | let aC = getInteger(this, ((v + "_Bid_") + az)) |
---|
386 | | - | let H = aC |
---|
387 | | - | if ($isInstanceOf(H, "Int")) |
---|
388 | | - | then { |
---|
389 | | - | let I = H |
---|
390 | | - | I |
---|
391 | | - | } |
---|
392 | | - | else throw("Auction lowest bid was not found") |
---|
393 | | - | } |
---|
394 | | - | let aD = (E - aB) |
---|
395 | | - | let ap = J(x, aD) |
---|
396 | | - | ScriptResult(WriteSet([DataEntry((v + "_State"), i), DataEntry((v + "_HiredFreelancer"), az), DataEntry((v + "_Price"), aB), DataEntry((x + "_Freezed"), ap)]), TransferSet([ScriptTransfer(addressFromPublicKey(ak), aD, av)])) |
---|
397 | | - | } |
---|
398 | | - | else throw("Incorrect auction state") |
---|
399 | | - | else { |
---|
400 | | - | let aN = { |
---|
401 | | - | let aw = getInteger(this, ((v + "_Bid_") + aJ)) |
---|
402 | | - | let H = aw |
---|
403 | | - | if ($isInstanceOf(H, "Int")) |
---|
404 | | - | then { |
---|
405 | | - | let I = H |
---|
406 | | - | aJ |
---|
407 | | - | } |
---|
408 | | - | else throw("Error: Incorrect freelancerPub") |
---|
409 | | - | } |
---|
410 | | - | let aB = { |
---|
411 | | - | let aO = getInteger(this, ((v + "_Bid_") + aJ)) |
---|
412 | | - | let H = aO |
---|
413 | | - | if ($isInstanceOf(H, "Int")) |
---|
414 | | - | then { |
---|
415 | | - | let I = H |
---|
416 | | - | I |
---|
417 | | - | } |
---|
418 | | - | else throw("Auction lowest bidder was not found") |
---|
419 | | - | } |
---|
420 | | - | let aD = (E - aK) |
---|
421 | | - | let ap = J(x, aD) |
---|
422 | | - | ScriptResult(WriteSet([DataEntry((v + "_State"), i), DataEntry((v + "_HiredFreelancer"), aN), DataEntry((v + "_Price"), aB), DataEntry((x + "_Freezed"), ap)]), TransferSet([ScriptTransfer(addressFromPublicKey(ak), (aD - ax), av)])) |
---|
423 | | - | } |
---|
424 | | - | else throw("Only auction customer can choose a freelancer") |
---|
425 | | - | } |
---|
426 | | - | |
---|
427 | | - | |
---|
428 | | - | |
---|
429 | | - | @Callable(ad) |
---|
430 | | - | func increaseExecutionTime (v,aP) = { |
---|
431 | | - | let aQ = extract(ad.callerPublicKey) |
---|
432 | | - | let as = O(v) |
---|
433 | | - | let ak = Q(v) |
---|
434 | | - | let au = W(v) |
---|
435 | | - | let aR = { |
---|
436 | | - | let aS = (aP * a) |
---|
437 | | - | if ((aS > au)) |
---|
438 | | - | then aS |
---|
439 | | - | else throw("New execution time must more than current execution time") |
---|
440 | | - | } |
---|
441 | | - | if ((aQ == ak)) |
---|
442 | | - | then if (if (if ((as == f)) |
---|
443 | | - | then true |
---|
444 | | - | else (as == g)) |
---|
445 | | - | then true |
---|
446 | | - | else (as == i)) |
---|
447 | | - | then WriteSet([DataEntry((v + "_JobPerformance"), aR)]) |
---|
448 | | - | else throw("Incorrect state") |
---|
449 | | - | else throw("Only Client can increase execution time") |
---|
450 | | - | } |
---|
451 | | - | |
---|
452 | | - | |
---|
453 | | - | |
---|
454 | | - | @Callable(ad) |
---|
455 | | - | func cancelAuction (v) = { |
---|
456 | | - | let L = extract(ad.callerPublicKey) |
---|
457 | | - | let as = O(v) |
---|
458 | | - | let ak = Q(v) |
---|
459 | | - | let x = Y(v) |
---|
460 | | - | let E = aa(v) |
---|
461 | | - | let av = w(x) |
---|
462 | | - | let ax = ((E * 3) / 100) |
---|
463 | | - | let aT = (E - ax) |
---|
464 | | - | let ap = J(x, E) |
---|
465 | | - | let aU = if ((L == ak)) |
---|
466 | | - | then true |
---|
467 | | - | else throw("Auction can be canceled only by auction owner.") |
---|
468 | | - | if (aU) |
---|
469 | | - | then if ((as == f)) |
---|
470 | | - | then ScriptResult(WriteSet([DataEntry((v + "_State"), h), DataEntry((x + "_Freezed"), ap)]), TransferSet([ScriptTransfer(addressFromPublicKey(ak), aT, av)])) |
---|
471 | | - | else throw("Incorrect auction state.") |
---|
472 | | - | else throw("Only Client can cancel auction") |
---|
473 | | - | } |
---|
474 | | - | |
---|
475 | | - | |
---|
476 | | - | |
---|
477 | | - | @Callable(ad) |
---|
478 | | - | func openDispute (v) = { |
---|
479 | | - | let aQ = extract(ad.callerPublicKey) |
---|
480 | | - | let as = O(v) |
---|
481 | | - | let ak = Q(v) |
---|
482 | | - | let aV = ac(v) |
---|
483 | | - | if (if ((as == f)) |
---|
484 | | - | then true |
---|
485 | | - | else (as == g)) |
---|
486 | | - | then throw("Incorrect auction state for dispute opening") |
---|
487 | | - | else if (if ((aQ == ak)) |
---|
488 | | - | then true |
---|
489 | | - | else (aQ == aV)) |
---|
490 | | - | then WriteSet([DataEntry((v + "_State"), l), DataEntry((v + "_DisputeVotes"), 0)]) |
---|
491 | | - | else throw("Only customer and freelancer can open dispute") |
---|
492 | | - | } |
---|
493 | | - | |
---|
494 | | - | |
---|
495 | | - | |
---|
496 | | - | @Callable(ad) |
---|
497 | | - | func voteDispute (v,aW) = { |
---|
498 | | - | let L = extract(ad.callerPublicKey) |
---|
499 | | - | let as = O(v) |
---|
500 | | - | let ak = Q(v) |
---|
501 | | - | let x = Y(v) |
---|
502 | | - | let E = aa(v) |
---|
503 | | - | let aV = ac(v) |
---|
504 | | - | let aX = ((E * 3) / 100) |
---|
505 | | - | let av = w(x) |
---|
506 | | - | let aY = if (if (if (if (if ((L == p)) |
---|
507 | | - | then true |
---|
508 | | - | else (L == q)) |
---|
509 | | - | then true |
---|
510 | | - | else (L == r)) |
---|
511 | | - | then true |
---|
512 | | - | else (L == s)) |
---|
513 | | - | then true |
---|
514 | | - | else (L == t)) |
---|
515 | | - | then toBase58String(L) |
---|
516 | | - | else throw("Only defined ambassadors can vote in disputes") |
---|
517 | | - | let aZ = if (if ((aW == n)) |
---|
518 | | - | then true |
---|
519 | | - | else (aW == o)) |
---|
520 | | - | then aW |
---|
521 | | - | else throw(((("Vote is incorrect. Must be: " + n) + " or ") + o)) |
---|
522 | | - | let ba = { |
---|
523 | | - | let bb = ((v + "_DiputeVote_") + aY) |
---|
524 | | - | let bc = getString(this, bb) |
---|
525 | | - | let H = bc |
---|
526 | | - | if ($isInstanceOf(H, "String")) |
---|
527 | | - | then { |
---|
528 | | - | let I = H |
---|
529 | | - | throw("User already voted") |
---|
530 | | - | } |
---|
531 | | - | else aY |
---|
532 | | - | } |
---|
533 | | - | let bd = { |
---|
534 | | - | let be = getInteger(this, (v + "_DisputeVotes")) |
---|
535 | | - | let H = be |
---|
536 | | - | if ($isInstanceOf(H, "Int")) |
---|
537 | | - | then { |
---|
538 | | - | let I = H |
---|
539 | | - | I |
---|
540 | | - | } |
---|
541 | | - | else throw("VotesNumber was not found") |
---|
542 | | - | } |
---|
543 | | - | if ((as == l)) |
---|
544 | | - | then if ((bd == 4)) |
---|
545 | | - | then { |
---|
546 | | - | let bf = { |
---|
547 | | - | let bg = getString(this, ((v + "_DiputeVote_") + toBase58String(p))) |
---|
548 | | - | let bh = getString(this, ((v + "_DiputeVote_") + toBase58String(q))) |
---|
549 | | - | let bi = getString(this, ((v + "_DiputeVote_") + toBase58String(r))) |
---|
550 | | - | let bj = getString(this, ((v + "_DiputeVote_") + toBase58String(s))) |
---|
551 | | - | let bk = getString(this, ((v + "_DiputeVote_") + toBase58String(t))) |
---|
552 | | - | let bl = if ((bg == n)) |
---|
553 | | - | then 1 |
---|
554 | | - | else 0 |
---|
555 | | - | let bm = if ((bh == n)) |
---|
556 | | - | then 1 |
---|
557 | | - | else 0 |
---|
558 | | - | let bn = if ((bi == n)) |
---|
559 | | - | then 1 |
---|
560 | | - | else 0 |
---|
561 | | - | let bo = if ((bj == n)) |
---|
562 | | - | then 1 |
---|
563 | | - | else 0 |
---|
564 | | - | let bp = if ((bk == n)) |
---|
565 | | - | then 1 |
---|
566 | | - | else 0 |
---|
567 | | - | let bq = if ((aZ == n)) |
---|
568 | | - | then 1 |
---|
569 | | - | else 0 |
---|
570 | | - | let br = (((((bl + bm) + bn) + bo) + bp) + bq) |
---|
571 | | - | if ((br > 2)) |
---|
572 | | - | then ak |
---|
573 | | - | else aV |
---|
574 | | - | } |
---|
575 | | - | let bs = if ((bf == ak)) |
---|
576 | | - | then E |
---|
577 | | - | else (E - aX) |
---|
578 | | - | let ap = J(x, E) |
---|
579 | | - | ScriptResult(WriteSet([DataEntry((v + "_DisputeVotes"), (bd + 1)), DataEntry((v + "_State"), m), DataEntry(((v + "_DiputeVote_") + aY), aZ), DataEntry((x + "_Freezed"), ap)]), TransferSet([ScriptTransfer(addressFromPublicKey(bf), bs, av)])) |
---|
580 | | - | } |
---|
581 | | - | else WriteSet([DataEntry((v + "_DisputeVotes"), (bd + 1)), DataEntry(((v + "_DiputeVote_") + aY), aZ)]) |
---|
582 | | - | else throw(("Incorrect state. Must be: " + l)) |
---|
583 | | - | } |
---|
584 | | - | |
---|
585 | | - | |
---|
586 | | - | |
---|
587 | | - | @Callable(ad) |
---|
588 | | - | func workHandOver (v) = { |
---|
589 | | - | let L = extract(ad.callerPublicKey) |
---|
590 | | - | let as = O(v) |
---|
591 | | - | let am = S(v) |
---|
592 | | - | let at = U(v) |
---|
593 | | - | let au = W(v) |
---|
594 | | - | let aV = ac(v) |
---|
595 | | - | let z = height |
---|
596 | | - | let bt = if ((L == aV)) |
---|
597 | | - | then L |
---|
598 | | - | else throw("Only a freelancer can indicate that the work is done") |
---|
599 | | - | let bu = ((z - am) > au) |
---|
600 | | - | if ((as == i)) |
---|
601 | | - | then if (bu) |
---|
602 | | - | then WriteSet([DataEntry((v + "_State"), l), DataEntry((v + "_DisputeVotes"), "0")]) |
---|
603 | | - | else WriteSet([DataEntry((v + "_State"), j)]) |
---|
604 | | - | else throw("Auction state is incorrect") |
---|
605 | | - | } |
---|
606 | | - | |
---|
607 | | - | |
---|
608 | | - | |
---|
609 | | - | @Callable(ad) |
---|
610 | | - | func acceptWork (v) = { |
---|
611 | | - | let L = extract(ad.callerPublicKey) |
---|
612 | | - | let as = O(v) |
---|
613 | | - | let ak = Q(v) |
---|
614 | | - | let am = S(v) |
---|
615 | | - | let at = U(v) |
---|
616 | | - | let x = Y(v) |
---|
617 | | - | let E = aa(v) |
---|
618 | | - | let aV = ac(v) |
---|
619 | | - | let ax = ((E * 3) / 100) |
---|
620 | | - | let aT = (E - ax) |
---|
621 | | - | let av = w(x) |
---|
622 | | - | let ap = J(x, E) |
---|
623 | | - | let bv = { |
---|
624 | | - | let bw = getInteger(this, (toBase58String(aV) + "_Rating")) |
---|
625 | | - | let bx = { |
---|
626 | | - | let H = bw |
---|
627 | | - | if ($isInstanceOf(H, "Int")) |
---|
628 | | - | then { |
---|
629 | | - | let I = H |
---|
630 | | - | I |
---|
631 | | - | } |
---|
632 | | - | else 0 |
---|
633 | | - | } |
---|
634 | | - | (bx + 1) |
---|
635 | | - | } |
---|
636 | | - | if ((L == ak)) |
---|
637 | | - | then if ((as == j)) |
---|
638 | | - | then ScriptResult(WriteSet([DataEntry((v + "_State"), k), DataEntry((toBase58String(aV) + "_Rating"), bv), DataEntry((x + "_Freezed"), ap)]), TransferSet([ScriptTransfer(addressFromPublicKey(aV), aT, av)])) |
---|
639 | | - | else throw(("Incorrect state. Must be: " + j)) |
---|
640 | | - | else throw("Only auction customer can use this function") |
---|
641 | | - | } |
---|
642 | | - | |
---|
643 | | - | |
---|
644 | | - | @Verifier(by) |
---|
645 | | - | func bz () = if (sigVerify(by.bodyBytes, by.proofs[0], by.senderPublicKey)) |
---|
646 | | - | then { |
---|
647 | | - | let H = by |
---|
648 | | - | if ($isInstanceOf(H, "TransferTransaction")) |
---|
649 | | - | then { |
---|
650 | | - | let bA = H |
---|
651 | | - | true |
---|
652 | | - | } |
---|
653 | | - | else if ($isInstanceOf(H, "SetScriptTransaction")) |
---|
654 | | - | then { |
---|
655 | | - | let bB = H |
---|
656 | | - | true |
---|
657 | | - | } |
---|
658 | | - | else false |
---|
659 | | - | } |
---|
660 | | - | else false |
---|