tx · 59JRXajgPL2a7ZCqxiKBRmfTaAfXNV539Acg4N1qWgGH 3N2EM5HFgf6UMBnvcJX3Cegmozwdv1iDeq2: -0.01500000 Waves 2019.10.14 13:48 [719504] smart account 3N2EM5HFgf6UMBnvcJX3Cegmozwdv1iDeq2 > SELF 0.00000000 Waves
{ "type": 13, "id": "59JRXajgPL2a7ZCqxiKBRmfTaAfXNV539Acg4N1qWgGH", "fee": 1500000, "feeAssetId": null, "timestamp": 1571050088414, "version": 1, "sender": "3N2EM5HFgf6UMBnvcJX3Cegmozwdv1iDeq2", "senderPublicKey": "8y2Uc9uYf5gRD6Dzm1aC73zYe3LZvtVDUVAnAhNdN2mg", "proofs": [ "bA4wdF2TFZhNG7Ux1mFSMHYCajm9ai6aMLkP7riJXhbgf3T75336NsxGdHGqEbt1onqkDNrME44Eemf6BbKyrGX" ], "script": "base64:AAIDAAAAAAAAAD8IARIDCgEIEgMKAQgSBQoDAQEIEgQKAggBEgQKAggIEgQKAggBEgMKAQgSAwoBCBIECgIICBIDCgEIEgMKAQgAAAAxAAAAAANkYXkAAAAAAAAABaAAAAAABVdBVkVTBQAAAAR1bml0AAAAAAR3QlRDAQAAACBs+mr/xe2qjAt/tSqT0qIML4KC23R6BIxT+/0TH3Og/wAAAAAEd0VVUgEAAAAg7BZhBF97kSFBBjs38+fX1Pjz08YOqoCX85C/0PoVupkAAAAABHdVU0QBAAAAIN0cvQHwz3UFMHgHsqi2OJjRRd1cH7ozWuNAb/pmWXD9AAAAAAlhdWN0VG9rZW4BAAAAAQAAAAAACXN0YXRlT3BlbgIAAAAGT3BlbmVkAAAAAA5zdGF0ZVN1Z2dlc3RlZAIAAAAJU3VnZ2VzdGVkAAAAAAtzdGF0ZUNhbmNlbAIAAAAIQ2FuY2VsZWQAAAAAD3N0YXRlSW5Qcm9ncmVzcwIAAAAKSW5Qcm9ncmVzcwAAAAARc3RhdGVXYWl0NENvbmZpcm0CAAAAE1dhaXRGb3JDb25maXJtYXRpb24AAAAADXN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JYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAN0dHgFAAAAByRtYXRjaDAEAAAACWFzc2V0TmFtZQkBAAAAEkFzc2V0SWRUb0Fzc2V0TmFtZQAAAAEIBQAAAAN0dHgAAAAHYXNzZXRJZAQAAAAUdmFsdWVSZXNlcnZlZEJhbGFuY2UJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAlhc3NldE5hbWUCAAAACV9SZXNlcnZlZAQAAAAPcmVzZXJ2ZWRCYWxhbmNlBAAAAAckbWF0Y2gxBQAAABR2YWx1ZVJlc2VydmVkQmFsYW5jZQMJAAABAAAAAgUAAAAHJG1hdGNoMQIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gxBQAAAAFhAAAAAAAAAAAABAAAABBhdmFpbGFibGVCYWxhbmNlCQAAZQAAAAIJAAPrAAAAAgUAAAAEdGhpcwgFAAAAA3R0eAAAAAdhc3NldElkBQAAAA9yZXNlcnZlZEJhbGFuY2UJAABnAAAAAgUAAAAQYXZhaWxhYmxlQmFsYW5jZQgFAAAAA3R0eAAAAAZhbW91bnQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAANzdHgFAAAAByRtYXRjaDAGBwcT2gjf", "chainId": 84, "height": 719504, "spentComplexity": 0 } View: original | compacted Prev: SA49YpFDw2LFfJT6bTi5BiQQwgdbFtsNBJzDxsCnSXb Next: 5BUM7Kj8n12HoTQxRt7bxEBBxXHJWEVR3FGk1wuxsu5r Diff:
Old | New | Differences | |
---|---|---|---|
10 | 10 | let wEUR = base58'Gtb1WRznfchDnTh37ezoDTJ4wcoKaRsKqKjJjy7nm2zU' | |
11 | 11 | ||
12 | 12 | let wUSD = base58'Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck' | |
13 | + | ||
14 | + | let auctToken = base58'1' | |
13 | 15 | ||
14 | 16 | let stateOpen = "Opened" | |
15 | 17 | ||
31 | 33 | ||
32 | 34 | let freelancer = "FL" | |
33 | 35 | ||
34 | - | let ambassador1 = | |
36 | + | let ambassador1 = "FneCJqM5BP2eAuyteMiuEEHYALrE4axhEfcpHVGbdr5s" | |
35 | 37 | ||
36 | - | let ambassador2 = | |
38 | + | let ambassador2 = "6QAMdssb1GJjpQVQQcnx8fKU8WhtcF9ZsQhifdThAEK8" | |
37 | 39 | ||
38 | - | let ambassador3 = | |
40 | + | let ambassador3 = "2ituwW7DSRsLP3Vcbnpr98QUQMGFRWKmyYPFqsUKRDoP" | |
39 | 41 | ||
40 | - | let ambassador4 = | |
42 | + | let ambassador4 = "ANsPQocEESyLb3yQqk2pwCdoK7PJQxLoZVpYvsm3SxUG" | |
41 | 43 | ||
42 | - | let ambassador5 = base58'13VixwQin1MzZCyY69NSWMSBNEV27Rzc159o7uZXR9VS' | |
43 | - | ||
44 | - | func AuctionIdDataKey (auctionId) = (auctionId + "_AuctionData") | |
45 | - | ||
44 | + | let ambassador5 = "13VixwQin1MzZCyY69NSWMSBNEV27Rzc159o7uZXR9VS" | |
46 | 45 | ||
47 | 46 | func getInt (key) = { | |
48 | 47 | let valueJobsOnGoing = getInteger(this, key) | |
55 | 54 | } | |
56 | 55 | ||
57 | 56 | ||
58 | - | func AssetNameToBase58 (auctionAssetName) = if ((auctionAssetName == "WAVES")) | |
57 | + | func AssetIdToAssetName (pmtAssetId) = if (!(isDefined(pmtAssetId))) | |
58 | + | then "WAVES" | |
59 | + | else if ((pmtAssetId == wBTC)) | |
60 | + | then "BTC" | |
61 | + | else if ((pmtAssetId == wEUR)) | |
62 | + | then "EUR" | |
63 | + | else if ((pmtAssetId == wUSD)) | |
64 | + | then "USD" | |
65 | + | else if ((pmtAssetId == auctToken)) | |
66 | + | then "AUCT" | |
67 | + | else throw("AssetId is incorrect") | |
68 | + | ||
69 | + | ||
70 | + | func AssetNameToAssetId (auctionAssetName) = if ((auctionAssetName == "WAVES")) | |
59 | 71 | then WAVES | |
60 | 72 | else if ((auctionAssetName == "BTC")) | |
61 | 73 | then wBTC | |
63 | 75 | then wEUR | |
64 | 76 | else if ((auctionAssetName == "USD")) | |
65 | 77 | then wUSD | |
66 | - | else throw("Incorrect Asset Id") | |
78 | + | else if ((auctionAssetName == "AUCT")) | |
79 | + | then auctToken | |
80 | + | else throw("Incorrect Asset Id") | |
67 | 81 | ||
68 | 82 | ||
69 | 83 | func timeCheck (currentTime,startTime,expirationTime) = ((currentTime - startTime) > expirationTime) | |
101 | 115 | } | |
102 | 116 | ||
103 | 117 | ||
104 | - | func freelancerIsRegistered (callerPub) = { | |
118 | + | func clientRegistered (callerPub) = { | |
119 | + | let freelancerIsRegistered = getString(this, (callerPub + "_Freelancer")) | |
120 | + | match freelancerIsRegistered { | |
121 | + | case a: String => | |
122 | + | callerPub | |
123 | + | case _ => | |
124 | + | throw("Only registered users can make bets") | |
125 | + | } | |
126 | + | } | |
127 | + | ||
128 | + | ||
129 | + | func freelancerRegistered (callerPub) = { | |
105 | 130 | let freelancerIsRegistered = getString(this, (callerPub + "_Freelancer")) | |
106 | 131 | match freelancerIsRegistered { | |
107 | 132 | case a: String => | |
129 | 154 | ||
130 | 155 | ||
131 | 156 | func getAuctionClientPub (auctionId) = { | |
132 | - | let | |
133 | - | ||
157 | + | let valueClientPub = getString(this, (auctionId + "_AuctionClient")) | |
158 | + | match valueClientPub { | |
134 | 159 | case a: String => | |
135 | 160 | a | |
136 | 161 | case _ => | |
137 | 162 | throw("Auction Client was not found") | |
138 | 163 | } | |
139 | - | fromBase58String(clientPub) | |
140 | 164 | } | |
141 | 165 | ||
142 | 166 | ||
197 | 221 | ||
198 | 222 | func getAuctionFreelancerPub (auctionId) = { | |
199 | 223 | let valueClient = getString(this, (auctionId + "_HiredFreelancer")) | |
200 | - | ||
224 | + | match valueClient { | |
201 | 225 | case a: String => | |
202 | 226 | a | |
203 | 227 | case _ => | |
204 | 228 | throw("Auction Client was not found") | |
205 | 229 | } | |
206 | - | fromBase58String(a) | |
230 | + | } | |
231 | + | ||
232 | + | ||
233 | + | func getAuctionLowestBidder (auctionId) = { | |
234 | + | let valueLowestBidder = getString(this, (auctionId + "_LowestBidderPub")) | |
235 | + | match valueLowestBidder { | |
236 | + | case a: String => | |
237 | + | a | |
238 | + | case _ => | |
239 | + | throw("Auction lowest bidder was not found") | |
240 | + | } | |
241 | + | } | |
242 | + | ||
243 | + | ||
244 | + | func getBid (auctionId,auctionLowestBidder) = { | |
245 | + | let valueNewAuctionPrice = getInteger(this, ((auctionId + "_Bid_") + auctionLowestBidder)) | |
246 | + | match valueNewAuctionPrice { | |
247 | + | case a: Int => | |
248 | + | a | |
249 | + | case _ => | |
250 | + | throw("Auction lowest bid was not found") | |
251 | + | } | |
252 | + | } | |
253 | + | ||
254 | + | ||
255 | + | func defineNewLowestBidder (auctionId,currentLowestBidderPub,bidAmount,newFreelancer) = { | |
256 | + | let valueCurrentLowestBid = getInteger(this, ((auctionId + "_Bid_") + currentLowestBidderPub)) | |
257 | + | let currentLowestBid = match valueCurrentLowestBid { | |
258 | + | case a: Int => | |
259 | + | a | |
260 | + | case _ => | |
261 | + | throw("Auction lowest bid was not found") | |
262 | + | } | |
263 | + | if ((currentLowestBid > bidAmount)) | |
264 | + | then newFreelancer | |
265 | + | else currentLowestBidderPub | |
266 | + | } | |
267 | + | ||
268 | + | ||
269 | + | func choosedFreelancerCheck (auctionId,freelancerPub) = { | |
270 | + | let newFreelancer = getInteger(this, ((auctionId + "_Bid_") + freelancerPub)) | |
271 | + | match newFreelancer { | |
272 | + | case a: Int => | |
273 | + | freelancerPub | |
274 | + | case _ => | |
275 | + | throw("Error: Incorrect freelancerPub") | |
276 | + | } | |
277 | + | } | |
278 | + | ||
279 | + | ||
280 | + | func newExecutionTimeCheck (executionDays,auctionBlocksForExecution) = { | |
281 | + | let newAuctionBlocksForExecution = (executionDays * day) | |
282 | + | if ((newAuctionBlocksForExecution > auctionBlocksForExecution)) | |
283 | + | then newAuctionBlocksForExecution | |
284 | + | else throw("New execution time must more than current execution time") | |
285 | + | } | |
286 | + | ||
287 | + | ||
288 | + | func getRating (auctionFreelancer) = { | |
289 | + | let valueRating = getInteger(this, (auctionFreelancer + "_Rating")) | |
290 | + | match valueRating { | |
291 | + | case a: Int => | |
292 | + | a | |
293 | + | case _ => | |
294 | + | 0 | |
295 | + | } | |
296 | + | } | |
297 | + | ||
298 | + | ||
299 | + | func callerIsAmbassador (callerPub) = if (if (if (if (if ((callerPub == ambassador1)) | |
300 | + | then true | |
301 | + | else (callerPub == ambassador2)) | |
302 | + | then true | |
303 | + | else (callerPub == ambassador3)) | |
304 | + | then true | |
305 | + | else (callerPub == ambassador4)) | |
306 | + | then true | |
307 | + | else (callerPub == ambassador5)) | |
308 | + | then callerPub | |
309 | + | else throw("Only defined ambassadors can vote in disputes") | |
310 | + | ||
311 | + | ||
312 | + | func ambassadorVoteCheck (auctionId,ambassadorPub,vote) = { | |
313 | + | let keyVoter = ((auctionId + "_DiputeVote_") + ambassadorPub) | |
314 | + | let valueVoter = getString(this, keyVoter) | |
315 | + | let ambassadorVoted = match valueVoter { | |
316 | + | case a: String => | |
317 | + | true | |
318 | + | case _ => | |
319 | + | false | |
320 | + | } | |
321 | + | if (ambassadorVoted) | |
322 | + | then throw("Ambassador voted already ") | |
323 | + | else if (if ((vote == client)) | |
324 | + | then true | |
325 | + | else (vote == freelancer)) | |
326 | + | then vote | |
327 | + | else throw(((("Vote is incorrect. Must be: " + client) + " or ") + freelancer)) | |
328 | + | } | |
329 | + | ||
330 | + | ||
331 | + | func getVotesNumber (auctionId) = { | |
332 | + | let valueVotesNumber = getInteger(this, (auctionId + "_DisputeVotes")) | |
333 | + | match valueVotesNumber { | |
334 | + | case a: Int => | |
335 | + | a | |
336 | + | case _ => | |
337 | + | throw("VotesNumber was not found") | |
338 | + | } | |
339 | + | } | |
340 | + | ||
341 | + | ||
342 | + | func defineDisputeWinner (auctionId,newVote,auctionClient,auctionFreelancer) = { | |
343 | + | let ambassador1Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador1)) | |
344 | + | let ambassador2Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador2)) | |
345 | + | let ambassador3Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador3)) | |
346 | + | let ambassador4Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador4)) | |
347 | + | let ambassador5Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador5)) | |
348 | + | let v1 = if ((ambassador1Vote == client)) | |
349 | + | then 1 | |
350 | + | else 0 | |
351 | + | let v2 = if ((ambassador2Vote == client)) | |
352 | + | then 1 | |
353 | + | else 0 | |
354 | + | let v3 = if ((ambassador3Vote == client)) | |
355 | + | then 1 | |
356 | + | else 0 | |
357 | + | let v4 = if ((ambassador4Vote == client)) | |
358 | + | then 1 | |
359 | + | else 0 | |
360 | + | let v5 = if ((ambassador5Vote == client)) | |
361 | + | then 1 | |
362 | + | else 0 | |
363 | + | let currentVote = if ((newVote == client)) | |
364 | + | then 1 | |
365 | + | else 0 | |
366 | + | let votesForClient = (((((v1 + v2) + v3) + v4) + v5) + currentVote) | |
367 | + | if ((votesForClient > 2)) | |
368 | + | then auctionClient | |
369 | + | else auctionFreelancer | |
207 | 370 | } | |
208 | 371 | ||
209 | 372 | ||
231 | 394 | ||
232 | 395 | @Callable(i) | |
233 | 396 | func createAuction (jobExecutionDays,auctionDurationDays,auctionInfo) = { | |
397 | + | let callerPub = toBase58String(i.callerPublicKey) | |
234 | 398 | let auctionId = toBase58String(i.transactionId) | |
235 | - | let auctionClient = | |
399 | + | let auctionClient = clientRegistered(callerPub) | |
236 | 400 | let pmt = extract(i.payment) | |
237 | 401 | let pmtAmount = pmt.amount | |
238 | 402 | let auctionPrice = createAuctionPriceCheck(pmtAmount) | |
239 | 403 | let auctionStart = height | |
240 | 404 | let auctionDurationBlocks = (auctionDurationDays * day) | |
241 | 405 | let blocksForExecution = (jobExecutionDays * day) | |
242 | - | let pmtAssetName = if (!(isDefined(pmt.assetId))) | |
243 | - | then "WAVES" | |
244 | - | else if ((pmt.assetId == wBTC)) | |
245 | - | then "BTC" | |
246 | - | else if ((pmt.assetId == wEUR)) | |
247 | - | then "EUR" | |
248 | - | else if ((pmt.assetId == wUSD)) | |
249 | - | then "USD" | |
250 | - | else throw("AssetId is incorrect") | |
406 | + | let pmtAssetName = AssetIdToAssetName(pmt.assetId) | |
251 | 407 | let jobsCreated = getInt((auctionClient + "_JobsCreated")) | |
252 | 408 | let newFreezedBalance = increaseFreezedBalance(pmtAssetName, auctionPrice) | |
253 | 409 | WriteSet([DataEntry((auctionId + "_State"), stateOpen), DataEntry((auctionId + "_Info"), auctionInfo), DataEntry((auctionId + "_AuctionClient"), auctionClient), DataEntry((auctionId + "_AuctionStart"), auctionStart), DataEntry((auctionId + "_AuctionDuration"), auctionDurationBlocks), DataEntry((auctionId + "_JobPerformance"), blocksForExecution), DataEntry((auctionId + "_AssetName"), pmtAssetName), DataEntry((auctionId + "_Price"), auctionPrice), DataEntry((pmtAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsCreated"), (jobsCreated + 1))]) | |
258 | 414 | @Callable(i) | |
259 | 415 | func makeBid (auctionId,amount) = { | |
260 | 416 | let callerPub = toBase58String(i.callerPublicKey) | |
261 | - | let betTime = height | |
262 | 417 | let auctionState = getAuctionState(auctionId) | |
263 | 418 | let auctionClient = getAuctionClientPub(auctionId) | |
264 | 419 | let auctionStart = getAuctionStartTime(auctionId) | |
266 | 421 | let auctionBlocksForExecution = getAuctionJobPerformanceTime(auctionId) | |
267 | 422 | let auctionAssetName = getAuctionAssetName(auctionId) | |
268 | 423 | let auctionPrice = getAuctionPrice(auctionId) | |
269 | - | let auctionAssetId58 = | |
270 | - | let newFreelancer = | |
424 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
425 | + | let newFreelancer = freelancerRegistered(callerPub) | |
271 | 426 | let dAppCommission = ((auctionPrice * 3) / 100) | |
272 | 427 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
273 | 428 | let bidAmount = bidAmountCheck(amount, auctionPrice) | |
274 | - | let auctionTimeisOver = timeCheck( | |
429 | + | let auctionTimeisOver = timeCheck(height, auctionStart, auctionDuration) | |
275 | 430 | if (auctionTimeisOver) | |
276 | 431 | then if ((auctionState == stateOpen)) | |
277 | - | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(auctionClient), (auctionPrice - dAppCommission), auctionAssetId58)])) | |
432 | + | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), (auctionPrice - dAppCommission), auctionAssetId58)])) | |
278 | 433 | else if ((auctionState == stateSuggested)) | |
279 | 434 | then { | |
280 | - | let auctionLowestBidder = { | |
281 | - | let valueLowestBidder = getString(this, (auctionId + "_LowestBidderPub")) | |
282 | - | match valueLowestBidder { | |
283 | - | case a: String => | |
284 | - | a | |
285 | - | case _ => | |
286 | - | throw("Auction lowest bidder was not found") | |
287 | - | } | |
288 | - | } | |
289 | - | let newAuctionPrice = { | |
290 | - | let valueNewAuctionPrice = getInteger(this, ((auctionId + "_Bid_") + auctionLowestBidder)) | |
291 | - | match valueNewAuctionPrice { | |
292 | - | case a: Int => | |
293 | - | a | |
294 | - | case _ => | |
295 | - | throw("Auction lowest bid was not found") | |
296 | - | } | |
297 | - | } | |
298 | - | let amountDifference = ((auctionPrice - newAuctionPrice) - dAppCommission) | |
299 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), auctionLowestBidder), DataEntry((auctionId + "_Price"), newAuctionPrice)]), TransferSet([ScriptTransfer(addressFromPublicKey(auctionClient), amountDifference, auctionAssetId58)])) | |
435 | + | let auctionLowestBidder = getAuctionLowestBidder(auctionId) | |
436 | + | let auctionLowestBid = getBid(auctionId, auctionLowestBidder) | |
437 | + | let amountDifference = ((auctionPrice - auctionLowestBid) - dAppCommission) | |
438 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), auctionLowestBidder), DataEntry((auctionId + "_Price"), auctionLowestBid)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), amountDifference, auctionAssetId58)])) | |
300 | 439 | } | |
301 | 440 | else throw("Incorrect auction state") | |
302 | 441 | else if ((auctionState == stateOpen)) | |
303 | 442 | then WriteSet([DataEntry(((auctionId + "_Bid_") + newFreelancer), bidAmount), DataEntry((auctionId + "_State"), stateSuggested), DataEntry((auctionId + "_LowestBidderPub"), callerPub)]) | |
304 | 443 | else if ((auctionState == stateSuggested)) | |
305 | 444 | then { | |
306 | - | let currentLowestBidderPub = { | |
307 | - | let lowestBidder = getString(this, (auctionId + "_LowestBidderPub")) | |
308 | - | match lowestBidder { | |
309 | - | case a: String => | |
310 | - | a | |
311 | - | case _ => | |
312 | - | throw("Auction lowest bidder was not found") | |
313 | - | } | |
314 | - | } | |
315 | - | let newLowestBidderPub = { | |
316 | - | let valueCurrentLowestBid = getInteger(this, ((auctionId + "_Bid_") + currentLowestBidderPub)) | |
317 | - | let currentLowestBid = match valueCurrentLowestBid { | |
318 | - | case a: Int => | |
319 | - | a | |
320 | - | case _ => | |
321 | - | throw("Auction lowest bid was not found") | |
322 | - | } | |
323 | - | if ((currentLowestBid > bidAmount)) | |
324 | - | then newFreelancer | |
325 | - | else currentLowestBidderPub | |
326 | - | } | |
445 | + | let currentLowestBidderPub = getAuctionLowestBidder(auctionId) | |
446 | + | let newLowestBidderPub = defineNewLowestBidder(auctionId, currentLowestBidderPub, bidAmount, newFreelancer) | |
327 | 447 | WriteSet([DataEntry((auctionId + "_LowestBidderPub"), newLowestBidderPub), DataEntry(((auctionId + "_Bid_") + newFreelancer), bidAmount)]) | |
328 | 448 | } | |
329 | 449 | else throw(((((("Incorrect jobId state. Now: " + auctionState) + ", must be: ") + stateOpen) + " or ") + stateSuggested)) | |
333 | 453 | ||
334 | 454 | @Callable(i) | |
335 | 455 | func chooseFreelancer (auctionId,freelancerPub) = { | |
336 | - | let callerPub = extract(i.callerPublicKey) | |
337 | - | let betTime = height | |
456 | + | let callerPub = toBase58String(i.callerPublicKey) | |
338 | 457 | let auctionState = getAuctionState(auctionId) | |
339 | 458 | let auctionClient = getAuctionClientPub(auctionId) | |
340 | 459 | let auctionStart = getAuctionStartTime(auctionId) | |
341 | 460 | let auctionDuration = getAuctionDurationTime(auctionId) | |
342 | 461 | let auctionAssetName = getAuctionAssetName(auctionId) | |
343 | 462 | let auctionPrice = getAuctionPrice(auctionId) | |
344 | - | let auctionAssetId58 = AssetNameToBase58(auctionAssetName) | |
345 | - | let jobsOnGoing = getInt((toBase58String(auctionClient) + "_JobsOnGoing")) | |
463 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
464 | + | let newFreelancer = choosedFreelancerCheck(auctionId, freelancerPub) | |
465 | + | let freelancerBidAmount = getBid(auctionId, newFreelancer) | |
466 | + | let auctionTimeisOver = timeCheck(height, auctionStart, auctionDuration) | |
467 | + | let jobsOnGoing = getInt((auctionClient + "_JobsOnGoing")) | |
346 | 468 | let freelancerPendingEarnings = getInt((freelancerPub + "_PendingEarnings")) | |
347 | 469 | let freelancerTotalEarnings = getInt((freelancerPub + "_TotalEarnings")) | |
348 | - | let freelancerBidAmount = { | |
349 | - | let keyFreelancerBid = ((auctionId + "_Bid_") + freelancerPub) | |
350 | - | let valueFreelacerBid = getInteger(this, keyFreelancerBid) | |
351 | - | match valueFreelacerBid { | |
352 | - | case a: Int => | |
353 | - | a | |
354 | - | case _ => | |
355 | - | throw("Freelancer's bet was not found") | |
356 | - | } | |
357 | - | } | |
358 | - | let auctionTimeisOver = timeCheck(betTime, auctionStart, auctionDuration) | |
359 | 470 | if ((callerPub == auctionClient)) | |
360 | 471 | then if (auctionTimeisOver) | |
361 | 472 | then if ((auctionState == stateOpen)) | |
362 | 473 | then { | |
363 | 474 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
364 | 475 | let dAppCommission = ((auctionPrice * 3) / 100) | |
365 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(auctionClient), (auctionPrice - dAppCommission), auctionAssetId58)])) | |
476 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), (auctionPrice - dAppCommission), auctionAssetId58)])) | |
366 | 477 | } | |
367 | 478 | else if ((auctionState == stateSuggested)) | |
368 | 479 | then { | |
369 | - | let auctionLowestBidder = { | |
370 | - | let valueLowestBidder = getString(this, (auctionId + "_LowestBidderPub")) | |
371 | - | match valueLowestBidder { | |
372 | - | case a: String => | |
373 | - | a | |
374 | - | case _ => | |
375 | - | throw("Auction lowest bidder was not found") | |
376 | - | } | |
377 | - | } | |
378 | - | let newAuctionPrice = { | |
379 | - | let valueNewAuctionPrice = getInteger(this, ((auctionId + "_Bid_") + auctionLowestBidder)) | |
380 | - | match valueNewAuctionPrice { | |
381 | - | case a: Int => | |
382 | - | a | |
383 | - | case _ => | |
384 | - | throw("Auction lowest bid was not found") | |
385 | - | } | |
386 | - | } | |
387 | - | let amountDifference = (auctionPrice - newAuctionPrice) | |
480 | + | let auctionLowestBidder = getAuctionLowestBidder(auctionId) | |
481 | + | let auctionLowestBid = getBid(auctionId, auctionLowestBidder) | |
482 | + | let amountDifference = (auctionPrice - auctionLowestBid) | |
388 | 483 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, amountDifference) | |
389 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), auctionLowestBidder), DataEntry((auctionId + "_Price"), | |
484 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), auctionLowestBidder), DataEntry((auctionId + "_Price"), auctionLowestBid), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsOnGoing"), (jobsOnGoing + 1)), DataEntry((freelancerPub + "_PendingEarnings"), (freelancerPendingEarnings + auctionLowestBid)), DataEntry((freelancerPub + "_TotalEarnings"), (freelancerTotalEarnings + auctionLowestBid))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), amountDifference, auctionAssetId58)])) | |
390 | 485 | } | |
391 | 486 | else throw("Incorrect auction state") | |
392 | 487 | else if (if ((auctionState == stateOpen)) | |
393 | 488 | then true | |
394 | 489 | else (auctionState == stateSuggested)) | |
395 | 490 | then { | |
396 | - | let setNewFreelancer = { | |
397 | - | let newFreelancer = getInteger(this, ((auctionId + "_Bid_") + freelancerPub)) | |
398 | - | match newFreelancer { | |
399 | - | case a: Int => | |
400 | - | freelancerPub | |
401 | - | case _ => | |
402 | - | throw("Error: Incorrect freelancerPub") | |
403 | - | } | |
404 | - | } | |
405 | - | let newAuctionPrice = { | |
406 | - | let freelancerBid = getInteger(this, ((auctionId + "_Bid_") + freelancerPub)) | |
407 | - | match freelancerBid { | |
408 | - | case a: Int => | |
409 | - | a | |
410 | - | case _ => | |
411 | - | throw("Auction lowest bidder was not found") | |
412 | - | } | |
413 | - | } | |
414 | 491 | let amountDifference = (auctionPrice - freelancerBidAmount) | |
415 | 492 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, amountDifference) | |
416 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), | |
493 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), newFreelancer), DataEntry((auctionId + "_Price"), freelancerBidAmount), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsOnGoing"), (jobsOnGoing + 1)), DataEntry((freelancerPub + "_PendingEarnings"), (freelancerPendingEarnings + freelancerBidAmount)), DataEntry((freelancerPub + "_TotalEarnings"), (freelancerTotalEarnings + freelancerBidAmount))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), (amountDifference + 1), auctionAssetId58)])) | |
417 | 494 | } | |
418 | 495 | else throw("Incorrect auction state") | |
419 | 496 | else throw("Only auction customer can choose a freelancer") | |
423 | 500 | ||
424 | 501 | @Callable(i) | |
425 | 502 | func increaseExecutionTime (auctionId,executionDays) = { | |
426 | - | let caller = | |
503 | + | let caller = toBase58String(i.callerPublicKey) | |
427 | 504 | let auctionState = getAuctionState(auctionId) | |
428 | 505 | let auctionClient = getAuctionClientPub(auctionId) | |
429 | 506 | let auctionBlocksForExecution = getAuctionJobPerformanceTime(auctionId) | |
430 | - | let newAuctionExecutionTime = { | |
431 | - | let newAuctionBlocksForExecution = (executionDays * day) | |
432 | - | if ((newAuctionBlocksForExecution > auctionBlocksForExecution)) | |
433 | - | then newAuctionBlocksForExecution | |
434 | - | else throw("New execution time must more than current execution time") | |
435 | - | } | |
507 | + | let newAuctionExecutionTime = newExecutionTimeCheck(executionDays, auctionBlocksForExecution) | |
436 | 508 | if ((caller == auctionClient)) | |
437 | 509 | then if (if (if ((auctionState == stateOpen)) | |
438 | 510 | then true | |
448 | 520 | ||
449 | 521 | @Callable(i) | |
450 | 522 | func cancelAuction (auctionId) = { | |
451 | - | let callerPub = | |
523 | + | let callerPub = toBase58String(i.callerPublicKey) | |
452 | 524 | let auctionState = getAuctionState(auctionId) | |
453 | 525 | let auctionClient = getAuctionClientPub(auctionId) | |
454 | 526 | let auctionAssetName = getAuctionAssetName(auctionId) | |
455 | 527 | let auctionPrice = getAuctionPrice(auctionId) | |
456 | - | let auctionAssetId58 = | |
528 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
457 | 529 | let dAppCommission = ((auctionPrice * 3) / 100) | |
458 | 530 | let amountWithoutComm = (auctionPrice - dAppCommission) | |
459 | 531 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
460 | 532 | if ((callerPub == auctionClient)) | |
461 | 533 | then if ((auctionState == stateOpen)) | |
462 | - | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(auctionClient), amountWithoutComm, auctionAssetId58)])) | |
534 | + | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), amountWithoutComm, auctionAssetId58)])) | |
463 | 535 | else throw("Auction can be canceled only by auction owner.") | |
464 | 536 | else throw("Only Client can cancel auction") | |
465 | 537 | } | |
468 | 540 | ||
469 | 541 | @Callable(i) | |
470 | 542 | func openDispute (auctionId) = { | |
471 | - | let caller = | |
543 | + | let caller = toBase58String(i.callerPublicKey) | |
472 | 544 | let auctionState = getAuctionState(auctionId) | |
473 | 545 | let auctionClient = getAuctionClientPub(auctionId) | |
474 | 546 | let auctionFreelancer = getAuctionFreelancerPub(auctionId) | |
475 | - | let clientJobsInDispute = getInt(( | |
547 | + | let clientJobsInDispute = getInt((auctionClient + "_JobsInDispute")) | |
476 | 548 | if (if ((auctionState == stateInProgress)) | |
477 | 549 | then true | |
478 | 550 | else (auctionState == stateWait4Confirm)) | |
479 | 551 | then if (if ((caller == auctionClient)) | |
480 | 552 | then true | |
481 | 553 | else (caller == auctionFreelancer)) | |
482 | - | then WriteSet([DataEntry((auctionId + "_State"), stateDispute), DataEntry((auctionId + "_DisputeVotes"), 0), DataEntry(( | |
554 | + | then WriteSet([DataEntry((auctionId + "_State"), stateDispute), DataEntry((auctionId + "_DisputeVotes"), 0), DataEntry((auctionClient + "_JobsInDispute"), (clientJobsInDispute + 1))]) | |
483 | 555 | else throw("Only Client and Freelancer can open dispute") | |
484 | 556 | else throw("Incorrect auction state for dispute opening") | |
485 | 557 | } | |
488 | 560 | ||
489 | 561 | @Callable(i) | |
490 | 562 | func voteDispute (auctionId,vote) = { | |
491 | - | let callerPub = | |
563 | + | let callerPub = toBase58String(i.callerPublicKey) | |
492 | 564 | let auctionState = getAuctionState(auctionId) | |
493 | 565 | let auctionClient = getAuctionClientPub(auctionId) | |
494 | 566 | let auctionAssetName = getAuctionAssetName(auctionId) | |
495 | 567 | let auctionPrice = getAuctionPrice(auctionId) | |
496 | 568 | let auctionFreelancer = getAuctionFreelancerPub(auctionId) | |
497 | 569 | let commission = ((auctionPrice * 3) / 100) | |
498 | - | let auctionAssetId58 = AssetNameToBase58(auctionAssetName) | |
499 | - | let clientJobsInDispute = getInt((toBase58String(auctionClient) + "_JobsInDispute")) | |
500 | - | let freelancerPendingEarnings = getInt((toBase58String(auctionFreelancer) + "_PendingEarnings")) | |
501 | - | let callerIsAmbassador = if (if (if (if (if ((callerPub == ambassador1)) | |
502 | - | then true | |
503 | - | else (callerPub == ambassador2)) | |
504 | - | then true | |
505 | - | else (callerPub == ambassador3)) | |
506 | - | then true | |
507 | - | else (callerPub == ambassador4)) | |
508 | - | then true | |
509 | - | else (callerPub == ambassador5)) | |
510 | - | then toBase58String(callerPub) | |
511 | - | else throw("Only defined ambassadors can vote in disputes") | |
512 | - | let newVote = if (if ((vote == client)) | |
513 | - | then true | |
514 | - | else (vote == freelancer)) | |
515 | - | then vote | |
516 | - | else throw(((("Vote is incorrect. Must be: " + client) + " or ") + freelancer)) | |
517 | - | let newVoter = { | |
518 | - | let keyVoter = ((auctionId + "_DiputeVote_") + callerIsAmbassador) | |
519 | - | let valueVoter = getString(this, keyVoter) | |
520 | - | match valueVoter { | |
521 | - | case a: String => | |
522 | - | throw("User already voted") | |
523 | - | case _ => | |
524 | - | callerIsAmbassador | |
525 | - | } | |
526 | - | } | |
527 | - | let votesNumber = { | |
528 | - | let valueVotesNumber = getInteger(this, (auctionId + "_DisputeVotes")) | |
529 | - | match valueVotesNumber { | |
530 | - | case a: Int => | |
531 | - | a | |
532 | - | case _ => | |
533 | - | throw("VotesNumber was not found") | |
534 | - | } | |
535 | - | } | |
570 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
571 | + | let ambassadorPub = callerIsAmbassador(callerPub) | |
572 | + | let ambassadorVote = ambassadorVoteCheck(auctionId, ambassadorPub, vote) | |
573 | + | let votesNumber = getVotesNumber(auctionId) | |
574 | + | let clientJobsInDispute = getInt((auctionClient + "_JobsInDispute")) | |
575 | + | let freelancerPendingEarnings = getInt((auctionFreelancer + "_PendingEarnings")) | |
576 | + | let freelancerTotalEarnings = getInt((auctionFreelancer + "_TotalEarnings")) | |
536 | 577 | if ((auctionState == stateDispute)) | |
537 | 578 | then if ((votesNumber == 4)) | |
538 | 579 | then { | |
539 | - | let disputeWinner = { | |
540 | - | let ambassador1Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador1))) | |
541 | - | let ambassador2Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador2))) | |
542 | - | let ambassador3Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador3))) | |
543 | - | let ambassador4Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador4))) | |
544 | - | let ambassador5Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador5))) | |
545 | - | let v1 = if ((ambassador1Vote == client)) | |
546 | - | then 1 | |
547 | - | else 0 | |
548 | - | let v2 = if ((ambassador2Vote == client)) | |
549 | - | then 1 | |
550 | - | else 0 | |
551 | - | let v3 = if ((ambassador3Vote == client)) | |
552 | - | then 1 | |
553 | - | else 0 | |
554 | - | let v4 = if ((ambassador4Vote == client)) | |
555 | - | then 1 | |
556 | - | else 0 | |
557 | - | let v5 = if ((ambassador5Vote == client)) | |
558 | - | then 1 | |
559 | - | else 0 | |
560 | - | let currentVote = if ((newVote == client)) | |
561 | - | then 1 | |
562 | - | else 0 | |
563 | - | let votesForClient = (((((v1 + v2) + v3) + v4) + v5) + currentVote) | |
564 | - | if ((votesForClient > 2)) | |
565 | - | then auctionClient | |
566 | - | else auctionFreelancer | |
567 | - | } | |
568 | - | let paymentWithoutComm = if ((disputeWinner == auctionClient)) | |
569 | - | then (auctionPrice - commission) | |
570 | - | else (auctionPrice - (commission * 2)) | |
580 | + | let disputeWinnerPub = defineDisputeWinner(auctionId, ambassadorVote, auctionClient, auctionFreelancer) | |
571 | 581 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
572 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry((auctionId + "_State"), stateDisputeResolved), DataEntry(((auctionId + "_DiputeVote_") + newVoter), newVote), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((toBase58String(auctionClient) + "_JobsInDispute"), (clientJobsInDispute - 1)), DataEntry((toBase58String(auctionFreelancer) + "_PendingEarnings"), (freelancerPendingEarnings - auctionPrice))]), TransferSet([ScriptTransfer(addressFromPublicKey(disputeWinner), paymentWithoutComm, auctionAssetId58)])) | |
582 | + | if ((disputeWinnerPub == auctionClient)) | |
583 | + | then { | |
584 | + | let paymentWithoutComm = (auctionPrice - commission) | |
585 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry((auctionId + "_State"), stateDisputeResolved), DataEntry(((auctionId + "_DiputeVote_") + ambassadorPub), ambassadorVote), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsInDispute"), (clientJobsInDispute - 1)), DataEntry((auctionFreelancer + "_PendingEarnings"), (freelancerPendingEarnings - auctionPrice)), DataEntry((auctionFreelancer + "_TotalEarnings"), (freelancerTotalEarnings - auctionPrice))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(disputeWinnerPub)), paymentWithoutComm, auctionAssetId58)])) | |
586 | + | } | |
587 | + | else { | |
588 | + | let paymentWithoutComm = (auctionPrice - (commission * 2)) | |
589 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry((auctionId + "_State"), stateDisputeResolved), DataEntry(((auctionId + "_DiputeVote_") + ambassadorPub), ambassadorVote), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsInDispute"), (clientJobsInDispute - 1)), DataEntry((auctionFreelancer + "_PendingEarnings"), (freelancerPendingEarnings - auctionPrice))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(disputeWinnerPub)), paymentWithoutComm, auctionAssetId58)])) | |
590 | + | } | |
573 | 591 | } | |
574 | - | else WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry(((auctionId + "_DiputeVote_") + | |
592 | + | else WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry(((auctionId + "_DiputeVote_") + ambassadorPub), ambassadorVote)]) | |
575 | 593 | else throw(("Incorrect state. Must be: " + stateDispute)) | |
576 | 594 | } | |
577 | 595 | ||
579 | 597 | ||
580 | 598 | @Callable(i) | |
581 | 599 | func workHandOver (auctionId) = { | |
582 | - | let callerPub = | |
600 | + | let callerPub = toBase58String(i.callerPublicKey) | |
583 | 601 | let auctionState = getAuctionState(auctionId) | |
584 | 602 | let auctionClient = getAuctionClientPub(auctionId) | |
585 | 603 | let auctionStart = getAuctionStartTime(auctionId) | |
586 | 604 | let auctionDuration = getAuctionDurationTime(auctionId) | |
587 | 605 | let auctionBlocksForExecution = getAuctionJobPerformanceTime(auctionId) | |
588 | 606 | let auctionFreelancer = getAuctionFreelancerPub(auctionId) | |
589 | - | let clientJobsInDispute = getInt((toBase58String(auctionClient) + "_JobsInDispute")) | |
590 | - | let currentTime = height | |
591 | - | let freelancerPubCheck = if ((callerPub == auctionFreelancer)) | |
592 | - | then callerPub | |
607 | + | let timeIsOver = ((height - auctionStart) > auctionBlocksForExecution) | |
608 | + | let clientJobsInDispute = getInt((auctionClient + "_JobsInDispute")) | |
609 | + | if ((callerPub == auctionFreelancer)) | |
610 | + | then if ((auctionState == stateInProgress)) | |
611 | + | then if (timeIsOver) | |
612 | + | then WriteSet([DataEntry((auctionId + "_State"), stateDispute), DataEntry((auctionId + "_DisputeVotes"), "0"), DataEntry((auctionClient + "_JobInDispute"), (clientJobsInDispute + 1))]) | |
613 | + | else WriteSet([DataEntry((auctionId + "_State"), stateWait4Confirm)]) | |
614 | + | else throw("Auction state is incorrect") | |
593 | 615 | else throw("Only a freelancer can indicate that the work is done") | |
594 | - | let timeIsOver = ((currentTime - auctionStart) > auctionBlocksForExecution) | |
595 | - | if ((auctionState == stateInProgress)) | |
596 | - | then if (timeIsOver) | |
597 | - | then WriteSet([DataEntry((auctionId + "_State"), stateDispute), DataEntry((auctionId + "_DisputeVotes"), "0"), DataEntry((toBase58String(auctionClient) + "_JobInDispute"), (clientJobsInDispute + 1))]) | |
598 | - | else WriteSet([DataEntry((auctionId + "_State"), stateWait4Confirm)]) | |
599 | - | else throw("Auction state is incorrect") | |
600 | 616 | } | |
601 | 617 | ||
602 | 618 | ||
603 | 619 | ||
604 | 620 | @Callable(i) | |
605 | 621 | func acceptWork (auctionId) = { | |
606 | - | let callerPub = | |
622 | + | let callerPub = toBase58String(i.callerPublicKey) | |
607 | 623 | let auctionState = getAuctionState(auctionId) | |
608 | 624 | let auctionClient = getAuctionClientPub(auctionId) | |
609 | 625 | let auctionStart = getAuctionStartTime(auctionId) | |
611 | 627 | let auctionAssetName = getAuctionAssetName(auctionId) | |
612 | 628 | let auctionPrice = getAuctionPrice(auctionId) | |
613 | 629 | let auctionFreelancer = getAuctionFreelancerPub(auctionId) | |
614 | - | let jobsOnGoing = getInt(( | |
615 | - | let freelancerPendingEarnings = getInt(( | |
616 | - | let freelancerPaidEarnings = getInt(( | |
630 | + | let jobsOnGoing = getInt((auctionClient + "_JobsOnGoing")) | |
631 | + | let freelancerPendingEarnings = getInt((auctionFreelancer + "_PendingEarnings")) | |
632 | + | let freelancerPaidEarnings = getInt((auctionFreelancer + "_PaidEarnings")) | |
617 | 633 | let dAppCommission = ((auctionPrice * 3) / 100) | |
618 | - | let amountWithoutComm = (auctionPrice - dAppCommission) | |
619 | - | let auctionAssetId58 = | |
634 | + | let amountWithoutComm = (auctionPrice - (dAppCommission * 2)) | |
635 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
620 | 636 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
621 | - | let newRating = { | |
622 | - | let valueRating = getInteger(this, (toBase58String(auctionFreelancer) + "_Rating")) | |
623 | - | let currentRating = match valueRating { | |
624 | - | case a: Int => | |
625 | - | a | |
626 | - | case _ => | |
627 | - | 0 | |
628 | - | } | |
629 | - | (currentRating + 1) | |
630 | - | } | |
637 | + | let freelancerRating = getRating(auctionFreelancer) | |
631 | 638 | if ((callerPub == auctionClient)) | |
632 | 639 | then if ((auctionState == stateWait4Confirm)) | |
633 | - | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateComplete), DataEntry(( | |
640 | + | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateComplete), DataEntry((auctionFreelancer + "_Rating"), (freelancerRating + 1)), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsOnGoing"), (jobsOnGoing - 1)), DataEntry((auctionFreelancer + "_PendingEarnings"), (freelancerPendingEarnings - auctionPrice)), DataEntry((auctionFreelancer + "_PaidEarnings"), (freelancerPaidEarnings + auctionPrice))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionFreelancer)), amountWithoutComm, auctionAssetId58)])) | |
634 | 641 | else throw(("Incorrect state. Must be: " + stateWait4Confirm)) | |
635 | 642 | else throw("Only auction customer can use this function") | |
636 | 643 | } | |
640 | 647 | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
641 | 648 | then match tx { | |
642 | 649 | case ttx: TransferTransaction => | |
643 | - | true | |
650 | + | let assetName = AssetIdToAssetName(ttx.assetId) | |
651 | + | let valueReservedBalance = getInteger(this, (assetName + "_Reserved")) | |
652 | + | let reservedBalance = match valueReservedBalance { | |
653 | + | case a: Int => | |
654 | + | a | |
655 | + | case _ => | |
656 | + | 0 | |
657 | + | } | |
658 | + | let availableBalance = (assetBalance(this, ttx.assetId) - reservedBalance) | |
659 | + | (availableBalance >= ttx.amount) | |
644 | 660 | case stx: SetScriptTransaction => | |
645 | 661 | true | |
646 | 662 | case _ => |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let day = 1440 | |
5 | 5 | ||
6 | 6 | let WAVES = unit | |
7 | 7 | ||
8 | 8 | let wBTC = base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS' | |
9 | 9 | ||
10 | 10 | let wEUR = base58'Gtb1WRznfchDnTh37ezoDTJ4wcoKaRsKqKjJjy7nm2zU' | |
11 | 11 | ||
12 | 12 | let wUSD = base58'Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck' | |
13 | + | ||
14 | + | let auctToken = base58'1' | |
13 | 15 | ||
14 | 16 | let stateOpen = "Opened" | |
15 | 17 | ||
16 | 18 | let stateSuggested = "Suggested" | |
17 | 19 | ||
18 | 20 | let stateCancel = "Canceled" | |
19 | 21 | ||
20 | 22 | let stateInProgress = "InProgress" | |
21 | 23 | ||
22 | 24 | let stateWait4Confirm = "WaitForConfirmation" | |
23 | 25 | ||
24 | 26 | let stateComplete = "Completed" | |
25 | 27 | ||
26 | 28 | let stateDispute = "Dispute" | |
27 | 29 | ||
28 | 30 | let stateDisputeResolved = "DisputeResolved" | |
29 | 31 | ||
30 | 32 | let client = "CL" | |
31 | 33 | ||
32 | 34 | let freelancer = "FL" | |
33 | 35 | ||
34 | - | let ambassador1 = | |
36 | + | let ambassador1 = "FneCJqM5BP2eAuyteMiuEEHYALrE4axhEfcpHVGbdr5s" | |
35 | 37 | ||
36 | - | let ambassador2 = | |
38 | + | let ambassador2 = "6QAMdssb1GJjpQVQQcnx8fKU8WhtcF9ZsQhifdThAEK8" | |
37 | 39 | ||
38 | - | let ambassador3 = | |
40 | + | let ambassador3 = "2ituwW7DSRsLP3Vcbnpr98QUQMGFRWKmyYPFqsUKRDoP" | |
39 | 41 | ||
40 | - | let ambassador4 = | |
42 | + | let ambassador4 = "ANsPQocEESyLb3yQqk2pwCdoK7PJQxLoZVpYvsm3SxUG" | |
41 | 43 | ||
42 | - | let ambassador5 = base58'13VixwQin1MzZCyY69NSWMSBNEV27Rzc159o7uZXR9VS' | |
43 | - | ||
44 | - | func AuctionIdDataKey (auctionId) = (auctionId + "_AuctionData") | |
45 | - | ||
44 | + | let ambassador5 = "13VixwQin1MzZCyY69NSWMSBNEV27Rzc159o7uZXR9VS" | |
46 | 45 | ||
47 | 46 | func getInt (key) = { | |
48 | 47 | let valueJobsOnGoing = getInteger(this, key) | |
49 | 48 | match valueJobsOnGoing { | |
50 | 49 | case a: Int => | |
51 | 50 | a | |
52 | 51 | case _ => | |
53 | 52 | 0 | |
54 | 53 | } | |
55 | 54 | } | |
56 | 55 | ||
57 | 56 | ||
58 | - | func AssetNameToBase58 (auctionAssetName) = if ((auctionAssetName == "WAVES")) | |
57 | + | func AssetIdToAssetName (pmtAssetId) = if (!(isDefined(pmtAssetId))) | |
58 | + | then "WAVES" | |
59 | + | else if ((pmtAssetId == wBTC)) | |
60 | + | then "BTC" | |
61 | + | else if ((pmtAssetId == wEUR)) | |
62 | + | then "EUR" | |
63 | + | else if ((pmtAssetId == wUSD)) | |
64 | + | then "USD" | |
65 | + | else if ((pmtAssetId == auctToken)) | |
66 | + | then "AUCT" | |
67 | + | else throw("AssetId is incorrect") | |
68 | + | ||
69 | + | ||
70 | + | func AssetNameToAssetId (auctionAssetName) = if ((auctionAssetName == "WAVES")) | |
59 | 71 | then WAVES | |
60 | 72 | else if ((auctionAssetName == "BTC")) | |
61 | 73 | then wBTC | |
62 | 74 | else if ((auctionAssetName == "EUR")) | |
63 | 75 | then wEUR | |
64 | 76 | else if ((auctionAssetName == "USD")) | |
65 | 77 | then wUSD | |
66 | - | else throw("Incorrect Asset Id") | |
78 | + | else if ((auctionAssetName == "AUCT")) | |
79 | + | then auctToken | |
80 | + | else throw("Incorrect Asset Id") | |
67 | 81 | ||
68 | 82 | ||
69 | 83 | func timeCheck (currentTime,startTime,expirationTime) = ((currentTime - startTime) > expirationTime) | |
70 | 84 | ||
71 | 85 | ||
72 | 86 | func bidAmountCheck (amount,auctionPrice) = if ((amount > auctionPrice)) | |
73 | 87 | then throw("Bid amount must be lower or equal than auctionPrice") | |
74 | 88 | else amount | |
75 | 89 | ||
76 | 90 | ||
77 | 91 | func increaseFreezedBalance (pmtAssetName,auctionPrice) = { | |
78 | 92 | let keyFreezedFunds = getInteger(this, (pmtAssetName + "_Freezed")) | |
79 | 93 | let currentFreezedBalance = match keyFreezedFunds { | |
80 | 94 | case a: Int => | |
81 | 95 | a | |
82 | 96 | case _ => | |
83 | 97 | 0 | |
84 | 98 | } | |
85 | 99 | (currentFreezedBalance + auctionPrice) | |
86 | 100 | } | |
87 | 101 | ||
88 | 102 | ||
89 | 103 | func decreaseFreezedBalance (pmtAssetName,auctionPrice) = { | |
90 | 104 | let keyFreezedFunds = getInteger(this, (pmtAssetName + "_Freezed")) | |
91 | 105 | let currentFreezedBalance = match keyFreezedFunds { | |
92 | 106 | case a: Int => | |
93 | 107 | a | |
94 | 108 | case _ => | |
95 | 109 | 0 | |
96 | 110 | } | |
97 | 111 | let a = (currentFreezedBalance - auctionPrice) | |
98 | 112 | if ((a >= 0)) | |
99 | 113 | then a | |
100 | 114 | else throw("Freezed amount couldn't be less than 0") | |
101 | 115 | } | |
102 | 116 | ||
103 | 117 | ||
104 | - | func freelancerIsRegistered (callerPub) = { | |
118 | + | func clientRegistered (callerPub) = { | |
119 | + | let freelancerIsRegistered = getString(this, (callerPub + "_Freelancer")) | |
120 | + | match freelancerIsRegistered { | |
121 | + | case a: String => | |
122 | + | callerPub | |
123 | + | case _ => | |
124 | + | throw("Only registered users can make bets") | |
125 | + | } | |
126 | + | } | |
127 | + | ||
128 | + | ||
129 | + | func freelancerRegistered (callerPub) = { | |
105 | 130 | let freelancerIsRegistered = getString(this, (callerPub + "_Freelancer")) | |
106 | 131 | match freelancerIsRegistered { | |
107 | 132 | case a: String => | |
108 | 133 | callerPub | |
109 | 134 | case _ => | |
110 | 135 | throw("Only registered users can make bets") | |
111 | 136 | } | |
112 | 137 | } | |
113 | 138 | ||
114 | 139 | ||
115 | 140 | func createAuctionPriceCheck (pmtAmount) = if ((pmtAmount > 0)) | |
116 | 141 | then pmtAmount | |
117 | 142 | else throw("Amount must be higher then 0") | |
118 | 143 | ||
119 | 144 | ||
120 | 145 | func getAuctionState (auctionId) = { | |
121 | 146 | let valueState = getString(this, (auctionId + "_State")) | |
122 | 147 | match valueState { | |
123 | 148 | case a: String => | |
124 | 149 | a | |
125 | 150 | case _ => | |
126 | 151 | throw("Auction State was not found") | |
127 | 152 | } | |
128 | 153 | } | |
129 | 154 | ||
130 | 155 | ||
131 | 156 | func getAuctionClientPub (auctionId) = { | |
132 | - | let | |
133 | - | ||
157 | + | let valueClientPub = getString(this, (auctionId + "_AuctionClient")) | |
158 | + | match valueClientPub { | |
134 | 159 | case a: String => | |
135 | 160 | a | |
136 | 161 | case _ => | |
137 | 162 | throw("Auction Client was not found") | |
138 | 163 | } | |
139 | - | fromBase58String(clientPub) | |
140 | 164 | } | |
141 | 165 | ||
142 | 166 | ||
143 | 167 | func getAuctionStartTime (auctionId) = { | |
144 | 168 | let valueAuctionStart = getInteger(this, (auctionId + "_AuctionStart")) | |
145 | 169 | match valueAuctionStart { | |
146 | 170 | case a: Int => | |
147 | 171 | a | |
148 | 172 | case _ => | |
149 | 173 | throw("Auction Start time was not found") | |
150 | 174 | } | |
151 | 175 | } | |
152 | 176 | ||
153 | 177 | ||
154 | 178 | func getAuctionDurationTime (auctionId) = { | |
155 | 179 | let valueauctionDuration = getInteger(this, (auctionId + "_AuctionDuration")) | |
156 | 180 | match valueauctionDuration { | |
157 | 181 | case a: Int => | |
158 | 182 | a | |
159 | 183 | case _ => | |
160 | 184 | throw("Auction duration time was not found") | |
161 | 185 | } | |
162 | 186 | } | |
163 | 187 | ||
164 | 188 | ||
165 | 189 | func getAuctionJobPerformanceTime (auctionId) = { | |
166 | 190 | let valueBlocksForExecution = getInteger(this, (auctionId + "_JobPerformance")) | |
167 | 191 | match valueBlocksForExecution { | |
168 | 192 | case a: Int => | |
169 | 193 | a | |
170 | 194 | case _ => | |
171 | 195 | throw("Auction job performance time was not found") | |
172 | 196 | } | |
173 | 197 | } | |
174 | 198 | ||
175 | 199 | ||
176 | 200 | func getAuctionAssetName (auctionId) = { | |
177 | 201 | let valueAssetName = getString(this, (auctionId + "_AssetName")) | |
178 | 202 | match valueAssetName { | |
179 | 203 | case a: String => | |
180 | 204 | a | |
181 | 205 | case _ => | |
182 | 206 | throw("Auction asset name was not found") | |
183 | 207 | } | |
184 | 208 | } | |
185 | 209 | ||
186 | 210 | ||
187 | 211 | func getAuctionPrice (auctionId) = { | |
188 | 212 | let valuePrice = getInteger(this, (auctionId + "_Price")) | |
189 | 213 | match valuePrice { | |
190 | 214 | case a: Int => | |
191 | 215 | a | |
192 | 216 | case _ => | |
193 | 217 | throw("Auction price was not found") | |
194 | 218 | } | |
195 | 219 | } | |
196 | 220 | ||
197 | 221 | ||
198 | 222 | func getAuctionFreelancerPub (auctionId) = { | |
199 | 223 | let valueClient = getString(this, (auctionId + "_HiredFreelancer")) | |
200 | - | ||
224 | + | match valueClient { | |
201 | 225 | case a: String => | |
202 | 226 | a | |
203 | 227 | case _ => | |
204 | 228 | throw("Auction Client was not found") | |
205 | 229 | } | |
206 | - | fromBase58String(a) | |
230 | + | } | |
231 | + | ||
232 | + | ||
233 | + | func getAuctionLowestBidder (auctionId) = { | |
234 | + | let valueLowestBidder = getString(this, (auctionId + "_LowestBidderPub")) | |
235 | + | match valueLowestBidder { | |
236 | + | case a: String => | |
237 | + | a | |
238 | + | case _ => | |
239 | + | throw("Auction lowest bidder was not found") | |
240 | + | } | |
241 | + | } | |
242 | + | ||
243 | + | ||
244 | + | func getBid (auctionId,auctionLowestBidder) = { | |
245 | + | let valueNewAuctionPrice = getInteger(this, ((auctionId + "_Bid_") + auctionLowestBidder)) | |
246 | + | match valueNewAuctionPrice { | |
247 | + | case a: Int => | |
248 | + | a | |
249 | + | case _ => | |
250 | + | throw("Auction lowest bid was not found") | |
251 | + | } | |
252 | + | } | |
253 | + | ||
254 | + | ||
255 | + | func defineNewLowestBidder (auctionId,currentLowestBidderPub,bidAmount,newFreelancer) = { | |
256 | + | let valueCurrentLowestBid = getInteger(this, ((auctionId + "_Bid_") + currentLowestBidderPub)) | |
257 | + | let currentLowestBid = match valueCurrentLowestBid { | |
258 | + | case a: Int => | |
259 | + | a | |
260 | + | case _ => | |
261 | + | throw("Auction lowest bid was not found") | |
262 | + | } | |
263 | + | if ((currentLowestBid > bidAmount)) | |
264 | + | then newFreelancer | |
265 | + | else currentLowestBidderPub | |
266 | + | } | |
267 | + | ||
268 | + | ||
269 | + | func choosedFreelancerCheck (auctionId,freelancerPub) = { | |
270 | + | let newFreelancer = getInteger(this, ((auctionId + "_Bid_") + freelancerPub)) | |
271 | + | match newFreelancer { | |
272 | + | case a: Int => | |
273 | + | freelancerPub | |
274 | + | case _ => | |
275 | + | throw("Error: Incorrect freelancerPub") | |
276 | + | } | |
277 | + | } | |
278 | + | ||
279 | + | ||
280 | + | func newExecutionTimeCheck (executionDays,auctionBlocksForExecution) = { | |
281 | + | let newAuctionBlocksForExecution = (executionDays * day) | |
282 | + | if ((newAuctionBlocksForExecution > auctionBlocksForExecution)) | |
283 | + | then newAuctionBlocksForExecution | |
284 | + | else throw("New execution time must more than current execution time") | |
285 | + | } | |
286 | + | ||
287 | + | ||
288 | + | func getRating (auctionFreelancer) = { | |
289 | + | let valueRating = getInteger(this, (auctionFreelancer + "_Rating")) | |
290 | + | match valueRating { | |
291 | + | case a: Int => | |
292 | + | a | |
293 | + | case _ => | |
294 | + | 0 | |
295 | + | } | |
296 | + | } | |
297 | + | ||
298 | + | ||
299 | + | func callerIsAmbassador (callerPub) = if (if (if (if (if ((callerPub == ambassador1)) | |
300 | + | then true | |
301 | + | else (callerPub == ambassador2)) | |
302 | + | then true | |
303 | + | else (callerPub == ambassador3)) | |
304 | + | then true | |
305 | + | else (callerPub == ambassador4)) | |
306 | + | then true | |
307 | + | else (callerPub == ambassador5)) | |
308 | + | then callerPub | |
309 | + | else throw("Only defined ambassadors can vote in disputes") | |
310 | + | ||
311 | + | ||
312 | + | func ambassadorVoteCheck (auctionId,ambassadorPub,vote) = { | |
313 | + | let keyVoter = ((auctionId + "_DiputeVote_") + ambassadorPub) | |
314 | + | let valueVoter = getString(this, keyVoter) | |
315 | + | let ambassadorVoted = match valueVoter { | |
316 | + | case a: String => | |
317 | + | true | |
318 | + | case _ => | |
319 | + | false | |
320 | + | } | |
321 | + | if (ambassadorVoted) | |
322 | + | then throw("Ambassador voted already ") | |
323 | + | else if (if ((vote == client)) | |
324 | + | then true | |
325 | + | else (vote == freelancer)) | |
326 | + | then vote | |
327 | + | else throw(((("Vote is incorrect. Must be: " + client) + " or ") + freelancer)) | |
328 | + | } | |
329 | + | ||
330 | + | ||
331 | + | func getVotesNumber (auctionId) = { | |
332 | + | let valueVotesNumber = getInteger(this, (auctionId + "_DisputeVotes")) | |
333 | + | match valueVotesNumber { | |
334 | + | case a: Int => | |
335 | + | a | |
336 | + | case _ => | |
337 | + | throw("VotesNumber was not found") | |
338 | + | } | |
339 | + | } | |
340 | + | ||
341 | + | ||
342 | + | func defineDisputeWinner (auctionId,newVote,auctionClient,auctionFreelancer) = { | |
343 | + | let ambassador1Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador1)) | |
344 | + | let ambassador2Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador2)) | |
345 | + | let ambassador3Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador3)) | |
346 | + | let ambassador4Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador4)) | |
347 | + | let ambassador5Vote = getString(this, ((auctionId + "_DiputeVote_") + ambassador5)) | |
348 | + | let v1 = if ((ambassador1Vote == client)) | |
349 | + | then 1 | |
350 | + | else 0 | |
351 | + | let v2 = if ((ambassador2Vote == client)) | |
352 | + | then 1 | |
353 | + | else 0 | |
354 | + | let v3 = if ((ambassador3Vote == client)) | |
355 | + | then 1 | |
356 | + | else 0 | |
357 | + | let v4 = if ((ambassador4Vote == client)) | |
358 | + | then 1 | |
359 | + | else 0 | |
360 | + | let v5 = if ((ambassador5Vote == client)) | |
361 | + | then 1 | |
362 | + | else 0 | |
363 | + | let currentVote = if ((newVote == client)) | |
364 | + | then 1 | |
365 | + | else 0 | |
366 | + | let votesForClient = (((((v1 + v2) + v3) + v4) + v5) + currentVote) | |
367 | + | if ((votesForClient > 2)) | |
368 | + | then auctionClient | |
369 | + | else auctionFreelancer | |
207 | 370 | } | |
208 | 371 | ||
209 | 372 | ||
210 | 373 | @Callable(i) | |
211 | 374 | func freelancerSignUp (info) = { | |
212 | 375 | let userPublicKey = toBase58String(i.callerPublicKey) | |
213 | 376 | let alreadyRegistered = getString(this, (userPublicKey + "_Freelancer")) | |
214 | 377 | if (isDefined(alreadyRegistered)) | |
215 | 378 | then throw("User already registered") | |
216 | 379 | else WriteSet([DataEntry((userPublicKey + "_Freelancer"), info), DataEntry((userPublicKey + "_PendingEarnings"), 0), DataEntry((userPublicKey + "_PaidEarnings"), 0), DataEntry((userPublicKey + "_TotalEarnings"), 0), DataEntry((userPublicKey + "_JobsPending"), 0), DataEntry((userPublicKey + "_JobsCompleted"), 0), DataEntry((userPublicKey + "_JobsTotal"), 0)]) | |
217 | 380 | } | |
218 | 381 | ||
219 | 382 | ||
220 | 383 | ||
221 | 384 | @Callable(i) | |
222 | 385 | func clientSignUp (info) = { | |
223 | 386 | let userPublicKey = toBase58String(i.callerPublicKey) | |
224 | 387 | let alreadyRegistered = getString(this, (userPublicKey + "_Client")) | |
225 | 388 | if (isDefined(alreadyRegistered)) | |
226 | 389 | then throw("User already registered") | |
227 | 390 | else WriteSet([DataEntry((userPublicKey + "_Client"), info), DataEntry((userPublicKey + "_JobsCreated"), 0), DataEntry((userPublicKey + "_JobsOnGoing"), 0), DataEntry((userPublicKey + "_JobInDispute"), 0)]) | |
228 | 391 | } | |
229 | 392 | ||
230 | 393 | ||
231 | 394 | ||
232 | 395 | @Callable(i) | |
233 | 396 | func createAuction (jobExecutionDays,auctionDurationDays,auctionInfo) = { | |
397 | + | let callerPub = toBase58String(i.callerPublicKey) | |
234 | 398 | let auctionId = toBase58String(i.transactionId) | |
235 | - | let auctionClient = | |
399 | + | let auctionClient = clientRegistered(callerPub) | |
236 | 400 | let pmt = extract(i.payment) | |
237 | 401 | let pmtAmount = pmt.amount | |
238 | 402 | let auctionPrice = createAuctionPriceCheck(pmtAmount) | |
239 | 403 | let auctionStart = height | |
240 | 404 | let auctionDurationBlocks = (auctionDurationDays * day) | |
241 | 405 | let blocksForExecution = (jobExecutionDays * day) | |
242 | - | let pmtAssetName = if (!(isDefined(pmt.assetId))) | |
243 | - | then "WAVES" | |
244 | - | else if ((pmt.assetId == wBTC)) | |
245 | - | then "BTC" | |
246 | - | else if ((pmt.assetId == wEUR)) | |
247 | - | then "EUR" | |
248 | - | else if ((pmt.assetId == wUSD)) | |
249 | - | then "USD" | |
250 | - | else throw("AssetId is incorrect") | |
406 | + | let pmtAssetName = AssetIdToAssetName(pmt.assetId) | |
251 | 407 | let jobsCreated = getInt((auctionClient + "_JobsCreated")) | |
252 | 408 | let newFreezedBalance = increaseFreezedBalance(pmtAssetName, auctionPrice) | |
253 | 409 | WriteSet([DataEntry((auctionId + "_State"), stateOpen), DataEntry((auctionId + "_Info"), auctionInfo), DataEntry((auctionId + "_AuctionClient"), auctionClient), DataEntry((auctionId + "_AuctionStart"), auctionStart), DataEntry((auctionId + "_AuctionDuration"), auctionDurationBlocks), DataEntry((auctionId + "_JobPerformance"), blocksForExecution), DataEntry((auctionId + "_AssetName"), pmtAssetName), DataEntry((auctionId + "_Price"), auctionPrice), DataEntry((pmtAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsCreated"), (jobsCreated + 1))]) | |
254 | 410 | } | |
255 | 411 | ||
256 | 412 | ||
257 | 413 | ||
258 | 414 | @Callable(i) | |
259 | 415 | func makeBid (auctionId,amount) = { | |
260 | 416 | let callerPub = toBase58String(i.callerPublicKey) | |
261 | - | let betTime = height | |
262 | 417 | let auctionState = getAuctionState(auctionId) | |
263 | 418 | let auctionClient = getAuctionClientPub(auctionId) | |
264 | 419 | let auctionStart = getAuctionStartTime(auctionId) | |
265 | 420 | let auctionDuration = getAuctionDurationTime(auctionId) | |
266 | 421 | let auctionBlocksForExecution = getAuctionJobPerformanceTime(auctionId) | |
267 | 422 | let auctionAssetName = getAuctionAssetName(auctionId) | |
268 | 423 | let auctionPrice = getAuctionPrice(auctionId) | |
269 | - | let auctionAssetId58 = | |
270 | - | let newFreelancer = | |
424 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
425 | + | let newFreelancer = freelancerRegistered(callerPub) | |
271 | 426 | let dAppCommission = ((auctionPrice * 3) / 100) | |
272 | 427 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
273 | 428 | let bidAmount = bidAmountCheck(amount, auctionPrice) | |
274 | - | let auctionTimeisOver = timeCheck( | |
429 | + | let auctionTimeisOver = timeCheck(height, auctionStart, auctionDuration) | |
275 | 430 | if (auctionTimeisOver) | |
276 | 431 | then if ((auctionState == stateOpen)) | |
277 | - | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(auctionClient), (auctionPrice - dAppCommission), auctionAssetId58)])) | |
432 | + | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), (auctionPrice - dAppCommission), auctionAssetId58)])) | |
278 | 433 | else if ((auctionState == stateSuggested)) | |
279 | 434 | then { | |
280 | - | let auctionLowestBidder = { | |
281 | - | let valueLowestBidder = getString(this, (auctionId + "_LowestBidderPub")) | |
282 | - | match valueLowestBidder { | |
283 | - | case a: String => | |
284 | - | a | |
285 | - | case _ => | |
286 | - | throw("Auction lowest bidder was not found") | |
287 | - | } | |
288 | - | } | |
289 | - | let newAuctionPrice = { | |
290 | - | let valueNewAuctionPrice = getInteger(this, ((auctionId + "_Bid_") + auctionLowestBidder)) | |
291 | - | match valueNewAuctionPrice { | |
292 | - | case a: Int => | |
293 | - | a | |
294 | - | case _ => | |
295 | - | throw("Auction lowest bid was not found") | |
296 | - | } | |
297 | - | } | |
298 | - | let amountDifference = ((auctionPrice - newAuctionPrice) - dAppCommission) | |
299 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), auctionLowestBidder), DataEntry((auctionId + "_Price"), newAuctionPrice)]), TransferSet([ScriptTransfer(addressFromPublicKey(auctionClient), amountDifference, auctionAssetId58)])) | |
435 | + | let auctionLowestBidder = getAuctionLowestBidder(auctionId) | |
436 | + | let auctionLowestBid = getBid(auctionId, auctionLowestBidder) | |
437 | + | let amountDifference = ((auctionPrice - auctionLowestBid) - dAppCommission) | |
438 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), auctionLowestBidder), DataEntry((auctionId + "_Price"), auctionLowestBid)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), amountDifference, auctionAssetId58)])) | |
300 | 439 | } | |
301 | 440 | else throw("Incorrect auction state") | |
302 | 441 | else if ((auctionState == stateOpen)) | |
303 | 442 | then WriteSet([DataEntry(((auctionId + "_Bid_") + newFreelancer), bidAmount), DataEntry((auctionId + "_State"), stateSuggested), DataEntry((auctionId + "_LowestBidderPub"), callerPub)]) | |
304 | 443 | else if ((auctionState == stateSuggested)) | |
305 | 444 | then { | |
306 | - | let currentLowestBidderPub = { | |
307 | - | let lowestBidder = getString(this, (auctionId + "_LowestBidderPub")) | |
308 | - | match lowestBidder { | |
309 | - | case a: String => | |
310 | - | a | |
311 | - | case _ => | |
312 | - | throw("Auction lowest bidder was not found") | |
313 | - | } | |
314 | - | } | |
315 | - | let newLowestBidderPub = { | |
316 | - | let valueCurrentLowestBid = getInteger(this, ((auctionId + "_Bid_") + currentLowestBidderPub)) | |
317 | - | let currentLowestBid = match valueCurrentLowestBid { | |
318 | - | case a: Int => | |
319 | - | a | |
320 | - | case _ => | |
321 | - | throw("Auction lowest bid was not found") | |
322 | - | } | |
323 | - | if ((currentLowestBid > bidAmount)) | |
324 | - | then newFreelancer | |
325 | - | else currentLowestBidderPub | |
326 | - | } | |
445 | + | let currentLowestBidderPub = getAuctionLowestBidder(auctionId) | |
446 | + | let newLowestBidderPub = defineNewLowestBidder(auctionId, currentLowestBidderPub, bidAmount, newFreelancer) | |
327 | 447 | WriteSet([DataEntry((auctionId + "_LowestBidderPub"), newLowestBidderPub), DataEntry(((auctionId + "_Bid_") + newFreelancer), bidAmount)]) | |
328 | 448 | } | |
329 | 449 | else throw(((((("Incorrect jobId state. Now: " + auctionState) + ", must be: ") + stateOpen) + " or ") + stateSuggested)) | |
330 | 450 | } | |
331 | 451 | ||
332 | 452 | ||
333 | 453 | ||
334 | 454 | @Callable(i) | |
335 | 455 | func chooseFreelancer (auctionId,freelancerPub) = { | |
336 | - | let callerPub = extract(i.callerPublicKey) | |
337 | - | let betTime = height | |
456 | + | let callerPub = toBase58String(i.callerPublicKey) | |
338 | 457 | let auctionState = getAuctionState(auctionId) | |
339 | 458 | let auctionClient = getAuctionClientPub(auctionId) | |
340 | 459 | let auctionStart = getAuctionStartTime(auctionId) | |
341 | 460 | let auctionDuration = getAuctionDurationTime(auctionId) | |
342 | 461 | let auctionAssetName = getAuctionAssetName(auctionId) | |
343 | 462 | let auctionPrice = getAuctionPrice(auctionId) | |
344 | - | let auctionAssetId58 = AssetNameToBase58(auctionAssetName) | |
345 | - | let jobsOnGoing = getInt((toBase58String(auctionClient) + "_JobsOnGoing")) | |
463 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
464 | + | let newFreelancer = choosedFreelancerCheck(auctionId, freelancerPub) | |
465 | + | let freelancerBidAmount = getBid(auctionId, newFreelancer) | |
466 | + | let auctionTimeisOver = timeCheck(height, auctionStart, auctionDuration) | |
467 | + | let jobsOnGoing = getInt((auctionClient + "_JobsOnGoing")) | |
346 | 468 | let freelancerPendingEarnings = getInt((freelancerPub + "_PendingEarnings")) | |
347 | 469 | let freelancerTotalEarnings = getInt((freelancerPub + "_TotalEarnings")) | |
348 | - | let freelancerBidAmount = { | |
349 | - | let keyFreelancerBid = ((auctionId + "_Bid_") + freelancerPub) | |
350 | - | let valueFreelacerBid = getInteger(this, keyFreelancerBid) | |
351 | - | match valueFreelacerBid { | |
352 | - | case a: Int => | |
353 | - | a | |
354 | - | case _ => | |
355 | - | throw("Freelancer's bet was not found") | |
356 | - | } | |
357 | - | } | |
358 | - | let auctionTimeisOver = timeCheck(betTime, auctionStart, auctionDuration) | |
359 | 470 | if ((callerPub == auctionClient)) | |
360 | 471 | then if (auctionTimeisOver) | |
361 | 472 | then if ((auctionState == stateOpen)) | |
362 | 473 | then { | |
363 | 474 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
364 | 475 | let dAppCommission = ((auctionPrice * 3) / 100) | |
365 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(auctionClient), (auctionPrice - dAppCommission), auctionAssetId58)])) | |
476 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), (auctionPrice - dAppCommission), auctionAssetId58)])) | |
366 | 477 | } | |
367 | 478 | else if ((auctionState == stateSuggested)) | |
368 | 479 | then { | |
369 | - | let auctionLowestBidder = { | |
370 | - | let valueLowestBidder = getString(this, (auctionId + "_LowestBidderPub")) | |
371 | - | match valueLowestBidder { | |
372 | - | case a: String => | |
373 | - | a | |
374 | - | case _ => | |
375 | - | throw("Auction lowest bidder was not found") | |
376 | - | } | |
377 | - | } | |
378 | - | let newAuctionPrice = { | |
379 | - | let valueNewAuctionPrice = getInteger(this, ((auctionId + "_Bid_") + auctionLowestBidder)) | |
380 | - | match valueNewAuctionPrice { | |
381 | - | case a: Int => | |
382 | - | a | |
383 | - | case _ => | |
384 | - | throw("Auction lowest bid was not found") | |
385 | - | } | |
386 | - | } | |
387 | - | let amountDifference = (auctionPrice - newAuctionPrice) | |
480 | + | let auctionLowestBidder = getAuctionLowestBidder(auctionId) | |
481 | + | let auctionLowestBid = getBid(auctionId, auctionLowestBidder) | |
482 | + | let amountDifference = (auctionPrice - auctionLowestBid) | |
388 | 483 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, amountDifference) | |
389 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), auctionLowestBidder), DataEntry((auctionId + "_Price"), | |
484 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), auctionLowestBidder), DataEntry((auctionId + "_Price"), auctionLowestBid), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsOnGoing"), (jobsOnGoing + 1)), DataEntry((freelancerPub + "_PendingEarnings"), (freelancerPendingEarnings + auctionLowestBid)), DataEntry((freelancerPub + "_TotalEarnings"), (freelancerTotalEarnings + auctionLowestBid))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), amountDifference, auctionAssetId58)])) | |
390 | 485 | } | |
391 | 486 | else throw("Incorrect auction state") | |
392 | 487 | else if (if ((auctionState == stateOpen)) | |
393 | 488 | then true | |
394 | 489 | else (auctionState == stateSuggested)) | |
395 | 490 | then { | |
396 | - | let setNewFreelancer = { | |
397 | - | let newFreelancer = getInteger(this, ((auctionId + "_Bid_") + freelancerPub)) | |
398 | - | match newFreelancer { | |
399 | - | case a: Int => | |
400 | - | freelancerPub | |
401 | - | case _ => | |
402 | - | throw("Error: Incorrect freelancerPub") | |
403 | - | } | |
404 | - | } | |
405 | - | let newAuctionPrice = { | |
406 | - | let freelancerBid = getInteger(this, ((auctionId + "_Bid_") + freelancerPub)) | |
407 | - | match freelancerBid { | |
408 | - | case a: Int => | |
409 | - | a | |
410 | - | case _ => | |
411 | - | throw("Auction lowest bidder was not found") | |
412 | - | } | |
413 | - | } | |
414 | 491 | let amountDifference = (auctionPrice - freelancerBidAmount) | |
415 | 492 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, amountDifference) | |
416 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), | |
493 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateInProgress), DataEntry((auctionId + "_HiredFreelancer"), newFreelancer), DataEntry((auctionId + "_Price"), freelancerBidAmount), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsOnGoing"), (jobsOnGoing + 1)), DataEntry((freelancerPub + "_PendingEarnings"), (freelancerPendingEarnings + freelancerBidAmount)), DataEntry((freelancerPub + "_TotalEarnings"), (freelancerTotalEarnings + freelancerBidAmount))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), (amountDifference + 1), auctionAssetId58)])) | |
417 | 494 | } | |
418 | 495 | else throw("Incorrect auction state") | |
419 | 496 | else throw("Only auction customer can choose a freelancer") | |
420 | 497 | } | |
421 | 498 | ||
422 | 499 | ||
423 | 500 | ||
424 | 501 | @Callable(i) | |
425 | 502 | func increaseExecutionTime (auctionId,executionDays) = { | |
426 | - | let caller = | |
503 | + | let caller = toBase58String(i.callerPublicKey) | |
427 | 504 | let auctionState = getAuctionState(auctionId) | |
428 | 505 | let auctionClient = getAuctionClientPub(auctionId) | |
429 | 506 | let auctionBlocksForExecution = getAuctionJobPerformanceTime(auctionId) | |
430 | - | let newAuctionExecutionTime = { | |
431 | - | let newAuctionBlocksForExecution = (executionDays * day) | |
432 | - | if ((newAuctionBlocksForExecution > auctionBlocksForExecution)) | |
433 | - | then newAuctionBlocksForExecution | |
434 | - | else throw("New execution time must more than current execution time") | |
435 | - | } | |
507 | + | let newAuctionExecutionTime = newExecutionTimeCheck(executionDays, auctionBlocksForExecution) | |
436 | 508 | if ((caller == auctionClient)) | |
437 | 509 | then if (if (if ((auctionState == stateOpen)) | |
438 | 510 | then true | |
439 | 511 | else (auctionState == stateSuggested)) | |
440 | 512 | then true | |
441 | 513 | else (auctionState == stateInProgress)) | |
442 | 514 | then WriteSet([DataEntry((auctionId + "_JobPerformance"), newAuctionExecutionTime)]) | |
443 | 515 | else throw("Incorrect state") | |
444 | 516 | else throw("Only Client can increase execution time") | |
445 | 517 | } | |
446 | 518 | ||
447 | 519 | ||
448 | 520 | ||
449 | 521 | @Callable(i) | |
450 | 522 | func cancelAuction (auctionId) = { | |
451 | - | let callerPub = | |
523 | + | let callerPub = toBase58String(i.callerPublicKey) | |
452 | 524 | let auctionState = getAuctionState(auctionId) | |
453 | 525 | let auctionClient = getAuctionClientPub(auctionId) | |
454 | 526 | let auctionAssetName = getAuctionAssetName(auctionId) | |
455 | 527 | let auctionPrice = getAuctionPrice(auctionId) | |
456 | - | let auctionAssetId58 = | |
528 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
457 | 529 | let dAppCommission = ((auctionPrice * 3) / 100) | |
458 | 530 | let amountWithoutComm = (auctionPrice - dAppCommission) | |
459 | 531 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
460 | 532 | if ((callerPub == auctionClient)) | |
461 | 533 | then if ((auctionState == stateOpen)) | |
462 | - | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(auctionClient), amountWithoutComm, auctionAssetId58)])) | |
534 | + | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateCancel), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance)]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionClient)), amountWithoutComm, auctionAssetId58)])) | |
463 | 535 | else throw("Auction can be canceled only by auction owner.") | |
464 | 536 | else throw("Only Client can cancel auction") | |
465 | 537 | } | |
466 | 538 | ||
467 | 539 | ||
468 | 540 | ||
469 | 541 | @Callable(i) | |
470 | 542 | func openDispute (auctionId) = { | |
471 | - | let caller = | |
543 | + | let caller = toBase58String(i.callerPublicKey) | |
472 | 544 | let auctionState = getAuctionState(auctionId) | |
473 | 545 | let auctionClient = getAuctionClientPub(auctionId) | |
474 | 546 | let auctionFreelancer = getAuctionFreelancerPub(auctionId) | |
475 | - | let clientJobsInDispute = getInt(( | |
547 | + | let clientJobsInDispute = getInt((auctionClient + "_JobsInDispute")) | |
476 | 548 | if (if ((auctionState == stateInProgress)) | |
477 | 549 | then true | |
478 | 550 | else (auctionState == stateWait4Confirm)) | |
479 | 551 | then if (if ((caller == auctionClient)) | |
480 | 552 | then true | |
481 | 553 | else (caller == auctionFreelancer)) | |
482 | - | then WriteSet([DataEntry((auctionId + "_State"), stateDispute), DataEntry((auctionId + "_DisputeVotes"), 0), DataEntry(( | |
554 | + | then WriteSet([DataEntry((auctionId + "_State"), stateDispute), DataEntry((auctionId + "_DisputeVotes"), 0), DataEntry((auctionClient + "_JobsInDispute"), (clientJobsInDispute + 1))]) | |
483 | 555 | else throw("Only Client and Freelancer can open dispute") | |
484 | 556 | else throw("Incorrect auction state for dispute opening") | |
485 | 557 | } | |
486 | 558 | ||
487 | 559 | ||
488 | 560 | ||
489 | 561 | @Callable(i) | |
490 | 562 | func voteDispute (auctionId,vote) = { | |
491 | - | let callerPub = | |
563 | + | let callerPub = toBase58String(i.callerPublicKey) | |
492 | 564 | let auctionState = getAuctionState(auctionId) | |
493 | 565 | let auctionClient = getAuctionClientPub(auctionId) | |
494 | 566 | let auctionAssetName = getAuctionAssetName(auctionId) | |
495 | 567 | let auctionPrice = getAuctionPrice(auctionId) | |
496 | 568 | let auctionFreelancer = getAuctionFreelancerPub(auctionId) | |
497 | 569 | let commission = ((auctionPrice * 3) / 100) | |
498 | - | let auctionAssetId58 = AssetNameToBase58(auctionAssetName) | |
499 | - | let clientJobsInDispute = getInt((toBase58String(auctionClient) + "_JobsInDispute")) | |
500 | - | let freelancerPendingEarnings = getInt((toBase58String(auctionFreelancer) + "_PendingEarnings")) | |
501 | - | let callerIsAmbassador = if (if (if (if (if ((callerPub == ambassador1)) | |
502 | - | then true | |
503 | - | else (callerPub == ambassador2)) | |
504 | - | then true | |
505 | - | else (callerPub == ambassador3)) | |
506 | - | then true | |
507 | - | else (callerPub == ambassador4)) | |
508 | - | then true | |
509 | - | else (callerPub == ambassador5)) | |
510 | - | then toBase58String(callerPub) | |
511 | - | else throw("Only defined ambassadors can vote in disputes") | |
512 | - | let newVote = if (if ((vote == client)) | |
513 | - | then true | |
514 | - | else (vote == freelancer)) | |
515 | - | then vote | |
516 | - | else throw(((("Vote is incorrect. Must be: " + client) + " or ") + freelancer)) | |
517 | - | let newVoter = { | |
518 | - | let keyVoter = ((auctionId + "_DiputeVote_") + callerIsAmbassador) | |
519 | - | let valueVoter = getString(this, keyVoter) | |
520 | - | match valueVoter { | |
521 | - | case a: String => | |
522 | - | throw("User already voted") | |
523 | - | case _ => | |
524 | - | callerIsAmbassador | |
525 | - | } | |
526 | - | } | |
527 | - | let votesNumber = { | |
528 | - | let valueVotesNumber = getInteger(this, (auctionId + "_DisputeVotes")) | |
529 | - | match valueVotesNumber { | |
530 | - | case a: Int => | |
531 | - | a | |
532 | - | case _ => | |
533 | - | throw("VotesNumber was not found") | |
534 | - | } | |
535 | - | } | |
570 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
571 | + | let ambassadorPub = callerIsAmbassador(callerPub) | |
572 | + | let ambassadorVote = ambassadorVoteCheck(auctionId, ambassadorPub, vote) | |
573 | + | let votesNumber = getVotesNumber(auctionId) | |
574 | + | let clientJobsInDispute = getInt((auctionClient + "_JobsInDispute")) | |
575 | + | let freelancerPendingEarnings = getInt((auctionFreelancer + "_PendingEarnings")) | |
576 | + | let freelancerTotalEarnings = getInt((auctionFreelancer + "_TotalEarnings")) | |
536 | 577 | if ((auctionState == stateDispute)) | |
537 | 578 | then if ((votesNumber == 4)) | |
538 | 579 | then { | |
539 | - | let disputeWinner = { | |
540 | - | let ambassador1Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador1))) | |
541 | - | let ambassador2Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador2))) | |
542 | - | let ambassador3Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador3))) | |
543 | - | let ambassador4Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador4))) | |
544 | - | let ambassador5Vote = getString(this, ((auctionId + "_DiputeVote_") + toBase58String(ambassador5))) | |
545 | - | let v1 = if ((ambassador1Vote == client)) | |
546 | - | then 1 | |
547 | - | else 0 | |
548 | - | let v2 = if ((ambassador2Vote == client)) | |
549 | - | then 1 | |
550 | - | else 0 | |
551 | - | let v3 = if ((ambassador3Vote == client)) | |
552 | - | then 1 | |
553 | - | else 0 | |
554 | - | let v4 = if ((ambassador4Vote == client)) | |
555 | - | then 1 | |
556 | - | else 0 | |
557 | - | let v5 = if ((ambassador5Vote == client)) | |
558 | - | then 1 | |
559 | - | else 0 | |
560 | - | let currentVote = if ((newVote == client)) | |
561 | - | then 1 | |
562 | - | else 0 | |
563 | - | let votesForClient = (((((v1 + v2) + v3) + v4) + v5) + currentVote) | |
564 | - | if ((votesForClient > 2)) | |
565 | - | then auctionClient | |
566 | - | else auctionFreelancer | |
567 | - | } | |
568 | - | let paymentWithoutComm = if ((disputeWinner == auctionClient)) | |
569 | - | then (auctionPrice - commission) | |
570 | - | else (auctionPrice - (commission * 2)) | |
580 | + | let disputeWinnerPub = defineDisputeWinner(auctionId, ambassadorVote, auctionClient, auctionFreelancer) | |
571 | 581 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
572 | - | ScriptResult(WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry((auctionId + "_State"), stateDisputeResolved), DataEntry(((auctionId + "_DiputeVote_") + newVoter), newVote), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((toBase58String(auctionClient) + "_JobsInDispute"), (clientJobsInDispute - 1)), DataEntry((toBase58String(auctionFreelancer) + "_PendingEarnings"), (freelancerPendingEarnings - auctionPrice))]), TransferSet([ScriptTransfer(addressFromPublicKey(disputeWinner), paymentWithoutComm, auctionAssetId58)])) | |
582 | + | if ((disputeWinnerPub == auctionClient)) | |
583 | + | then { | |
584 | + | let paymentWithoutComm = (auctionPrice - commission) | |
585 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry((auctionId + "_State"), stateDisputeResolved), DataEntry(((auctionId + "_DiputeVote_") + ambassadorPub), ambassadorVote), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsInDispute"), (clientJobsInDispute - 1)), DataEntry((auctionFreelancer + "_PendingEarnings"), (freelancerPendingEarnings - auctionPrice)), DataEntry((auctionFreelancer + "_TotalEarnings"), (freelancerTotalEarnings - auctionPrice))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(disputeWinnerPub)), paymentWithoutComm, auctionAssetId58)])) | |
586 | + | } | |
587 | + | else { | |
588 | + | let paymentWithoutComm = (auctionPrice - (commission * 2)) | |
589 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry((auctionId + "_State"), stateDisputeResolved), DataEntry(((auctionId + "_DiputeVote_") + ambassadorPub), ambassadorVote), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsInDispute"), (clientJobsInDispute - 1)), DataEntry((auctionFreelancer + "_PendingEarnings"), (freelancerPendingEarnings - auctionPrice))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(disputeWinnerPub)), paymentWithoutComm, auctionAssetId58)])) | |
590 | + | } | |
573 | 591 | } | |
574 | - | else WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry(((auctionId + "_DiputeVote_") + | |
592 | + | else WriteSet([DataEntry((auctionId + "_DisputeVotes"), (votesNumber + 1)), DataEntry(((auctionId + "_DiputeVote_") + ambassadorPub), ambassadorVote)]) | |
575 | 593 | else throw(("Incorrect state. Must be: " + stateDispute)) | |
576 | 594 | } | |
577 | 595 | ||
578 | 596 | ||
579 | 597 | ||
580 | 598 | @Callable(i) | |
581 | 599 | func workHandOver (auctionId) = { | |
582 | - | let callerPub = | |
600 | + | let callerPub = toBase58String(i.callerPublicKey) | |
583 | 601 | let auctionState = getAuctionState(auctionId) | |
584 | 602 | let auctionClient = getAuctionClientPub(auctionId) | |
585 | 603 | let auctionStart = getAuctionStartTime(auctionId) | |
586 | 604 | let auctionDuration = getAuctionDurationTime(auctionId) | |
587 | 605 | let auctionBlocksForExecution = getAuctionJobPerformanceTime(auctionId) | |
588 | 606 | let auctionFreelancer = getAuctionFreelancerPub(auctionId) | |
589 | - | let clientJobsInDispute = getInt((toBase58String(auctionClient) + "_JobsInDispute")) | |
590 | - | let currentTime = height | |
591 | - | let freelancerPubCheck = if ((callerPub == auctionFreelancer)) | |
592 | - | then callerPub | |
607 | + | let timeIsOver = ((height - auctionStart) > auctionBlocksForExecution) | |
608 | + | let clientJobsInDispute = getInt((auctionClient + "_JobsInDispute")) | |
609 | + | if ((callerPub == auctionFreelancer)) | |
610 | + | then if ((auctionState == stateInProgress)) | |
611 | + | then if (timeIsOver) | |
612 | + | then WriteSet([DataEntry((auctionId + "_State"), stateDispute), DataEntry((auctionId + "_DisputeVotes"), "0"), DataEntry((auctionClient + "_JobInDispute"), (clientJobsInDispute + 1))]) | |
613 | + | else WriteSet([DataEntry((auctionId + "_State"), stateWait4Confirm)]) | |
614 | + | else throw("Auction state is incorrect") | |
593 | 615 | else throw("Only a freelancer can indicate that the work is done") | |
594 | - | let timeIsOver = ((currentTime - auctionStart) > auctionBlocksForExecution) | |
595 | - | if ((auctionState == stateInProgress)) | |
596 | - | then if (timeIsOver) | |
597 | - | then WriteSet([DataEntry((auctionId + "_State"), stateDispute), DataEntry((auctionId + "_DisputeVotes"), "0"), DataEntry((toBase58String(auctionClient) + "_JobInDispute"), (clientJobsInDispute + 1))]) | |
598 | - | else WriteSet([DataEntry((auctionId + "_State"), stateWait4Confirm)]) | |
599 | - | else throw("Auction state is incorrect") | |
600 | 616 | } | |
601 | 617 | ||
602 | 618 | ||
603 | 619 | ||
604 | 620 | @Callable(i) | |
605 | 621 | func acceptWork (auctionId) = { | |
606 | - | let callerPub = | |
622 | + | let callerPub = toBase58String(i.callerPublicKey) | |
607 | 623 | let auctionState = getAuctionState(auctionId) | |
608 | 624 | let auctionClient = getAuctionClientPub(auctionId) | |
609 | 625 | let auctionStart = getAuctionStartTime(auctionId) | |
610 | 626 | let auctionDuration = getAuctionDurationTime(auctionId) | |
611 | 627 | let auctionAssetName = getAuctionAssetName(auctionId) | |
612 | 628 | let auctionPrice = getAuctionPrice(auctionId) | |
613 | 629 | let auctionFreelancer = getAuctionFreelancerPub(auctionId) | |
614 | - | let jobsOnGoing = getInt(( | |
615 | - | let freelancerPendingEarnings = getInt(( | |
616 | - | let freelancerPaidEarnings = getInt(( | |
630 | + | let jobsOnGoing = getInt((auctionClient + "_JobsOnGoing")) | |
631 | + | let freelancerPendingEarnings = getInt((auctionFreelancer + "_PendingEarnings")) | |
632 | + | let freelancerPaidEarnings = getInt((auctionFreelancer + "_PaidEarnings")) | |
617 | 633 | let dAppCommission = ((auctionPrice * 3) / 100) | |
618 | - | let amountWithoutComm = (auctionPrice - dAppCommission) | |
619 | - | let auctionAssetId58 = | |
634 | + | let amountWithoutComm = (auctionPrice - (dAppCommission * 2)) | |
635 | + | let auctionAssetId58 = AssetNameToAssetId(auctionAssetName) | |
620 | 636 | let newFreezedBalance = decreaseFreezedBalance(auctionAssetName, auctionPrice) | |
621 | - | let newRating = { | |
622 | - | let valueRating = getInteger(this, (toBase58String(auctionFreelancer) + "_Rating")) | |
623 | - | let currentRating = match valueRating { | |
624 | - | case a: Int => | |
625 | - | a | |
626 | - | case _ => | |
627 | - | 0 | |
628 | - | } | |
629 | - | (currentRating + 1) | |
630 | - | } | |
637 | + | let freelancerRating = getRating(auctionFreelancer) | |
631 | 638 | if ((callerPub == auctionClient)) | |
632 | 639 | then if ((auctionState == stateWait4Confirm)) | |
633 | - | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateComplete), DataEntry(( | |
640 | + | then ScriptResult(WriteSet([DataEntry((auctionId + "_State"), stateComplete), DataEntry((auctionFreelancer + "_Rating"), (freelancerRating + 1)), DataEntry((auctionAssetName + "_Freezed"), newFreezedBalance), DataEntry((auctionClient + "_JobsOnGoing"), (jobsOnGoing - 1)), DataEntry((auctionFreelancer + "_PendingEarnings"), (freelancerPendingEarnings - auctionPrice)), DataEntry((auctionFreelancer + "_PaidEarnings"), (freelancerPaidEarnings + auctionPrice))]), TransferSet([ScriptTransfer(addressFromPublicKey(fromBase58String(auctionFreelancer)), amountWithoutComm, auctionAssetId58)])) | |
634 | 641 | else throw(("Incorrect state. Must be: " + stateWait4Confirm)) | |
635 | 642 | else throw("Only auction customer can use this function") | |
636 | 643 | } | |
637 | 644 | ||
638 | 645 | ||
639 | 646 | @Verifier(tx) | |
640 | 647 | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
641 | 648 | then match tx { | |
642 | 649 | case ttx: TransferTransaction => | |
643 | - | true | |
650 | + | let assetName = AssetIdToAssetName(ttx.assetId) | |
651 | + | let valueReservedBalance = getInteger(this, (assetName + "_Reserved")) | |
652 | + | let reservedBalance = match valueReservedBalance { | |
653 | + | case a: Int => | |
654 | + | a | |
655 | + | case _ => | |
656 | + | 0 | |
657 | + | } | |
658 | + | let availableBalance = (assetBalance(this, ttx.assetId) - reservedBalance) | |
659 | + | (availableBalance >= ttx.amount) | |
644 | 660 | case stx: SetScriptTransaction => | |
645 | 661 | true | |
646 | 662 | case _ => | |
647 | 663 | false | |
648 | 664 | } | |
649 | 665 | else false | |
650 | 666 |
github/deemru/w8io/169f3d6 104.78 ms ◑