tx · 2PrT7sb6ScjaLZkSsDDKhQTivEHmNGR22ZiPJ765xLNv 3N7LWLXDtaXAyrzFjxhPPLBfV5DepLY4JQT: -0.02100000 Waves 2022.12.02 15:12 [2342716] smart account 3N7LWLXDtaXAyrzFjxhPPLBfV5DepLY4JQT > SELF 0.00000000 Waves
{ "type": 13, "id": "2PrT7sb6ScjaLZkSsDDKhQTivEHmNGR22ZiPJ765xLNv", "fee": 2100000, "feeAssetId": null, "timestamp": 1669983179572, "version": 2, "chainId": 84, "sender": "3N7LWLXDtaXAyrzFjxhPPLBfV5DepLY4JQT", "senderPublicKey": "Dua5JUgjDoKiGQvqvHFw2EcHUMTEH2zYWs8T2usUxu1S", "proofs": [ "bksVqAKbA87rKGUREyqRN3pE3xSiSQq6Wk43yw9FDX3PbRa37n9rdHtkgPhbps68HVMqPtmwtTfqM23CuxH9e6R" ], "script": "base64:AAIFAAAAAAAAAFAIAhILCgkBAQEBAQgBAQgSAwoBARIDCgEIEgUKAwEICBIECgIBCBIGCgQBCAECEgcKBQgBCAECEgQKAgEYEgUKAwgIARIECgIBCBIECgIBAQAAAD0BAAAAEWdldEludGVnZXJPclRocm93AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGgAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAMQ2FuJ3QgcmVhZCAnBQAAAANrZXkCAAAADScgYXQgYWRkcmVzcyAJAAQlAAAAAQUAAAAHYWRkcmVzcwEAAAAQZ2V0U3RyaW5nT3JUaHJvdwAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAADENhbid0IHJlYWQgJwUAAAADa2V5AgAAAA0nIGF0IGFkZHJlc3MgC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4NDE3OTY1AAAAAl8yCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAABVrZXlfbmFtZU1pbmltYWxMZW5ndGgFAAAAEW5leHRNaW5pbWFsTGVuZ2h0CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIFAAAAGWtleV9uZXh0TmFtZU1pbmltYWxMZW5ndGgJAAEsAAAAAgkAASwAAAACCQABpAAAAAEFAAAACWF1Y3Rpb25JZAIAAAABLAkAAaQAAAABBQAAAA1taW5pbWFsTGVuZ2h0BQAAAANuaWwJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgUAAAAZa2V5X25leHROYW1lTWluaW1hbExlbmd0aAkAASwAAAACCQABLAAAAAIJAAGkAAAAAQUAAAAJYXVjdGlvbklkAgAAAAEsCQABpAAAAAEFAAAADW1pbmltYWxMZW5naHQFAAAAA25pbAAAAACHMvBt", "height": 2342716, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Fo6g4422nH9WwGmwxpcm5VyCW3wPq3k4SMu2aEuuFg7U Next: 7GGyHkZKoitSErQsNkje4RgfvNGfiyRWMGE83hHJW7GR Diff:
Old | New | Differences | |
---|---|---|---|
46 | 46 | func key_referrerPercent (name) = (("Referrer_" + name) + "_percent") | |
47 | 47 | ||
48 | 48 | ||
49 | + | func key_lengthPrice (length) = ("Length_" + toString(length)) | |
50 | + | ||
51 | + | ||
49 | 52 | let key_initTimestamp = "initTimestamp" | |
50 | 53 | ||
51 | 54 | let key_bidDuration = "bidDuration" | |
63 | 66 | let key_percentRate = "percentRate" | |
64 | 67 | ||
65 | 68 | let key_collectorAddress = "collectorAddress" | |
69 | + | ||
70 | + | let key_nextNameMinimalLength = "nextNameMinimalLength" | |
71 | + | ||
72 | + | let key_lengthPrices = "lengthPrices" | |
66 | 73 | ||
67 | 74 | let auctionStart = getIntegerOrThrow(this, key_initTimestamp) | |
68 | 75 | ||
104 | 111 | let bidReferrerName = getString(this, bidReferrerKey) | |
105 | 112 | if (isDefined(bidReferrerName)) | |
106 | 113 | then { | |
107 | - | let $ | |
108 | - | let referrer = $ | |
109 | - | let referrerPercent = $ | |
114 | + | let $t033673442 = _getReferrerData(value(bidReferrerName)) | |
115 | + | let referrer = $t033673442._1 | |
116 | + | let referrerPercent = $t033673442._2 | |
110 | 117 | let referrerPercentAmount = fraction(bidAmount, referrerPercent, 100) | |
111 | 118 | $Tuple2([ScriptTransfer(referrer, referrerPercentAmount, unit), DeleteEntry(bidReferrerKey)], referrerPercentAmount) | |
112 | 119 | } | |
142 | 149 | ||
143 | 150 | let PHASE_REVEAL = "REVEAL" | |
144 | 151 | ||
152 | + | func _getPriceForLength (length) = { | |
153 | + | let lengthPrices = getInteger(this, key_lengthPrice(length)) | |
154 | + | if (isDefined(lengthPrices)) | |
155 | + | then value(lengthPrices) | |
156 | + | else minimalBid | |
157 | + | } | |
158 | + | ||
159 | + | ||
160 | + | func _getAllPrices () = { | |
161 | + | let price6 = getInteger(this, key_lengthPrice(6)) | |
162 | + | let price5 = getInteger(this, key_lengthPrice(5)) | |
163 | + | let price4 = getInteger(this, key_lengthPrice(4)) | |
164 | + | let price3 = getInteger(this, key_lengthPrice(3)) | |
165 | + | let price2 = getInteger(this, key_lengthPrice(2)) | |
166 | + | let price1 = getInteger(this, key_lengthPrice(1)) | |
167 | + | ([minimalBid] ++ (if (isDefined(price6)) | |
168 | + | then [value(price6)] | |
169 | + | else (nil ++ (if (isDefined(price5)) | |
170 | + | then [value(price5)] | |
171 | + | else (nil ++ (if (isDefined(price4)) | |
172 | + | then [value(price4)] | |
173 | + | else (nil ++ (if (isDefined(price3)) | |
174 | + | then [value(price3)] | |
175 | + | else (nil ++ (if (isDefined(price2)) | |
176 | + | then [value(price2)] | |
177 | + | else (nil ++ (if (isDefined(price1)) | |
178 | + | then [value(price1)] | |
179 | + | else nil)))))))))))) | |
180 | + | } | |
181 | + | ||
182 | + | ||
183 | + | func _getMinimalLength (auctionId) = { | |
184 | + | let nextNameMinimalLength = getString(this, key_nextNameMinimalLength) | |
185 | + | if (!(isDefined(nextNameMinimalLength))) | |
186 | + | then { | |
187 | + | let $t055625747 = { | |
188 | + | let values = split(value(nextNameMinimalLength), ",") | |
189 | + | $Tuple2(parseIntValue(values[0]), parseIntValue(values[1])) | |
190 | + | } | |
191 | + | let nextAuctionId = $t055625747._1 | |
192 | + | let nextMinimalLenght = $t055625747._2 | |
193 | + | if ((auctionId >= nextAuctionId)) | |
194 | + | then nextMinimalLenght | |
195 | + | else nameMinimalLength | |
196 | + | } | |
197 | + | else nameMinimalLength | |
198 | + | } | |
199 | + | ||
200 | + | ||
145 | 201 | func _getAuctionById (auctionId) = { | |
146 | - | let bidStart = (auctionStart + (auctionId * auctionDuration)) | |
202 | + | let bidStart = (auctionStart + ((auctionId - 1) * auctionDuration)) | |
147 | 203 | let revealStart = (bidStart + bidDuration) | |
148 | 204 | let auctionEnd = (revealStart + revealDuration) | |
149 | 205 | let phase = if ((lastBlock.timestamp > revealStart)) | |
150 | 206 | then PHASE_REVEAL | |
151 | 207 | else PHASE_BID | |
152 | - | $Tuple5(auctionId, phase, bidStart, revealStart, auctionEnd) | |
208 | + | let minimalLength = _getMinimalLength(auctionId) | |
209 | + | let prices = _getAllPrices() | |
210 | + | $Tuple7(auctionId, phase, bidStart, revealStart, auctionEnd, minimalLength, prices) | |
153 | 211 | } | |
154 | 212 | ||
155 | 213 | ||
156 | 214 | func getAuction () = { | |
157 | - | let auctionId = ((lastBlock.timestamp - auctionStart) / auctionDuration) | |
215 | + | let auctionId = (((lastBlock.timestamp - auctionStart) / auctionDuration) + 1) | |
158 | 216 | _getAuctionById(auctionId) | |
159 | 217 | } | |
160 | 218 | ||
161 | 219 | ||
162 | - | func getAuctionPhase () = match getAuction() { | |
163 | - | case auction: (Int, String, Int, Int, Int) => | |
164 | - | let auctionId = auction._1 | |
165 | - | let phase = auction._2 | |
166 | - | $Tuple2(auctionId, phase) | |
167 | - | case _ => | |
168 | - | throw("Invalid auction info") | |
169 | - | } | |
220 | + | func getAuctionPhase () = { | |
221 | + | let auction = getAuction() | |
222 | + | let auctionId = auction._1 | |
223 | + | let phase = auction._2 | |
224 | + | $Tuple2(auctionId, phase) | |
225 | + | } | |
170 | 226 | ||
171 | 227 | ||
172 | 228 | func isValidName (name) = { | |
176 | 232 | case _ => | |
177 | 233 | throw("Unsupported result format (available)") | |
178 | 234 | } | |
235 | + | let minimalLenght = getAuction()._6 | |
179 | 236 | if (isValid) | |
180 | - | then (size(name) >= | |
237 | + | then (size(name) >= minimalLenght) | |
181 | 238 | else false | |
182 | 239 | } | |
183 | 240 | ||
216 | 273 | else false) | |
217 | 274 | then inv.payments[0].amount | |
218 | 275 | else throw("Single payment required") | |
219 | - | let callerAddress = toString(inv.caller) | |
220 | - | let bidKey = key_bid(key_bidderHash(toString(auctionId), callerAddress, hash)) | |
221 | - | let $t063656422 = getAuctionPhase() | |
222 | - | let currentAuctionId = $t063656422._1 | |
223 | - | let currentPeriod = $t063656422._2 | |
276 | + | let checkHash = fromBase58String(hash) | |
277 | + | if ((checkHash == checkHash)) | |
278 | + | then { | |
279 | + | let callerAddress = toString(inv.caller) | |
280 | + | let bidKey = key_bid(key_bidderHash(toString(auctionId), callerAddress, hash)) | |
281 | + | let $t081088165 = getAuctionPhase() | |
282 | + | let currentAuctionId = $t081088165._1 | |
283 | + | let currentPeriod = $t081088165._2 | |
284 | + | if ((currentAuctionId != auctionId)) | |
285 | + | then throw("Auctions is already over") | |
286 | + | else if ((currentPeriod != PHASE_BID)) | |
287 | + | then throw("Bid period is over") | |
288 | + | else if (isDefined(getInteger(this, bidKey))) | |
289 | + | then throw("Bid with exact amount already presented") | |
290 | + | else [IntegerEntry(bidKey, pmt)] | |
291 | + | } | |
292 | + | else throw("Strict value is not equal to itself.") | |
293 | + | } | |
294 | + | ||
295 | + | ||
296 | + | func _reveal (bidder,auctionId,name,bidAmount,secret) = { | |
297 | + | let bidderAddress = toString(bidder) | |
298 | + | let hash = calcHash(name, bidAmount, bidderAddress, secret) | |
299 | + | let bidderHashKey = key_bidderHash(toString(auctionId), bidderAddress, hash) | |
300 | + | let revealKey = key_reveal(bidderHashKey) | |
301 | + | let $t088508907 = getAuctionPhase() | |
302 | + | let currentAuctionId = $t088508907._1 | |
303 | + | let currentPeriod = $t088508907._2 | |
224 | 304 | if ((currentAuctionId != auctionId)) | |
225 | 305 | then throw("Auctions is already over") | |
226 | - | else if ((currentPeriod != PHASE_BID)) | |
227 | - | then throw("Bid period is over") | |
228 | - | else if (isDefined(getInteger(this, bidKey))) | |
229 | - | then throw("Bid with exact amount already presented") | |
230 | - | else [IntegerEntry(bidKey, pmt)] | |
306 | + | else if ((currentPeriod != PHASE_REVEAL)) | |
307 | + | then throw("Reveal period is over") | |
308 | + | else if (isDefined(getString(this, revealKey))) | |
309 | + | then throw("Bid is already revealed") | |
310 | + | else { | |
311 | + | let bidKey = key_bid(bidderHashKey) | |
312 | + | let deposit = valueOrErrorMessage(getInteger(this, bidKey), ("Bid doesn't exists " + hash)) | |
313 | + | let topKey = key_top(name) | |
314 | + | let topKeyData = getString(this, topKey) | |
315 | + | let minBidName = _getPriceForLength(size(name)) | |
316 | + | let isValidBid = if (if ((bidAmount >= minBidName)) | |
317 | + | then (deposit >= bidAmount) | |
318 | + | else false) | |
319 | + | then isAvailableName(name) | |
320 | + | else false | |
321 | + | let revealedBid = [StringEntry(revealKey, ((((toString(deposit) + ",") + toString(bidAmount)) + ",") + name))] | |
322 | + | if (!(isValidBid)) | |
323 | + | then { | |
324 | + | let feeAmount = fraction(deposit, 10, 100) | |
325 | + | let returnDepositWithoutFeeAndDeleteBid = [ScriptTransfer(bidder, (deposit - feeAmount), unit), ScriptTransfer(collector, feeAmount, unit), DeleteEntry(bidKey)] | |
326 | + | returnDepositWithoutFeeAndDeleteBid | |
327 | + | } | |
328 | + | else if (isDefined(topKeyData)) | |
329 | + | then { | |
330 | + | let $t01012110300 = { | |
331 | + | let topValues = split(value(topKeyData), ",") | |
332 | + | $Tuple2(topValues[0], parseIntValue(topValues[1])) | |
333 | + | } | |
334 | + | let topRevealKey = $t01012110300._1 | |
335 | + | let secondTopBidAmount = $t01012110300._2 | |
336 | + | let revealedData = value(getString(this, topRevealKey)) | |
337 | + | let topBidAmount = parseIntValue(split(revealedData, ",")[1]) | |
338 | + | let $t01045710755 = if ((bidAmount > topBidAmount)) | |
339 | + | then $Tuple2(revealKey, topBidAmount) | |
340 | + | else if ((bidAmount > secondTopBidAmount)) | |
341 | + | then $Tuple2(topRevealKey, bidAmount) | |
342 | + | else $Tuple2(unit, unit) | |
343 | + | let newTopRevealKey = $t01045710755._1 | |
344 | + | let newSecondBidAmount = $t01045710755._2 | |
345 | + | let updateTopKey = match $Tuple2(newTopRevealKey, newSecondBidAmount) { | |
346 | + | case newTopData: (String, Int) => | |
347 | + | [StringEntry(topKey, ((newTopData._1 + ",") + toString(newTopData._2)))] | |
348 | + | case _ => | |
349 | + | nil | |
350 | + | } | |
351 | + | (revealedBid ++ updateTopKey) | |
352 | + | } | |
353 | + | else { | |
354 | + | let newTopBidder = [StringEntry(topKey, ((revealKey + ",") + toString(minimalBid)))] | |
355 | + | (revealedBid ++ newTopBidder) | |
356 | + | } | |
357 | + | } | |
231 | 358 | } | |
232 | 359 | ||
233 | 360 | ||
267 | 394 | ||
268 | 395 | ||
269 | 396 | @Callable(inv) | |
270 | - | func reveal (auctionId,name,bidAmount,secret) = { | |
271 | - | let caller = inv.caller | |
272 | - | let callerAddress = toString(caller) | |
273 | - | let hash = calcHash(name, bidAmount, callerAddress, secret) | |
274 | - | let bidderHashKey = key_bidderHash(toString(auctionId), callerAddress, hash) | |
275 | - | let revealKey = key_reveal(bidderHashKey) | |
276 | - | let $t093159372 = getAuctionPhase() | |
277 | - | let currentAuctionId = $t093159372._1 | |
278 | - | let currentPeriod = $t093159372._2 | |
279 | - | if ((currentAuctionId != auctionId)) | |
280 | - | then throw("Auctions is already over") | |
281 | - | else if ((currentPeriod != PHASE_REVEAL)) | |
282 | - | then throw("Reveal period is over") | |
283 | - | else if (isDefined(getString(this, revealKey))) | |
284 | - | then throw("Bid is already revealed") | |
285 | - | else { | |
286 | - | let bidKey = key_bid(bidderHashKey) | |
287 | - | let deposit = valueOrErrorMessage(getInteger(this, bidKey), ("Bid doesn't exists " + hash)) | |
288 | - | let topKey = key_top(name) | |
289 | - | let topKeyData = getString(this, topKey) | |
290 | - | let isValidBid = if (if ((bidAmount >= minimalBid)) | |
291 | - | then (deposit >= bidAmount) | |
292 | - | else false) | |
293 | - | then isAvailableName(name) | |
294 | - | else false | |
295 | - | let revealedBid = [StringEntry(revealKey, ((((toString(deposit) + ",") + toString(bidAmount)) + ",") + name))] | |
296 | - | if (!(isValidBid)) | |
297 | - | then { | |
298 | - | let feeAmount = fraction(deposit, 10, 100) | |
299 | - | let returnDepositWithoutFeeAndDeleteBid = [ScriptTransfer(caller, (deposit - feeAmount), unit), ScriptTransfer(collector, feeAmount, unit), DeleteEntry(bidKey)] | |
300 | - | returnDepositWithoutFeeAndDeleteBid | |
301 | - | } | |
302 | - | else if (isDefined(topKeyData)) | |
303 | - | then { | |
304 | - | let $t01054210722 = { | |
305 | - | let topValues = split(value(topKeyData), ",") | |
306 | - | $Tuple2(topValues[0], parseIntValue(topValues[1])) | |
307 | - | } | |
308 | - | let topRevealKey = $t01054210722._1 | |
309 | - | let secondTopBidAmount = $t01054210722._2 | |
310 | - | let revealedData = value(getString(this, topRevealKey)) | |
311 | - | let topBidAmount = parseIntValue(split(revealedData, ",")[1]) | |
312 | - | let $t01089111191 = if ((bidAmount > topBidAmount)) | |
313 | - | then $Tuple2(revealKey, topBidAmount) | |
314 | - | else if ((bidAmount > secondTopBidAmount)) | |
315 | - | then $Tuple2(topRevealKey, bidAmount) | |
316 | - | else $Tuple2(unit, unit) | |
317 | - | let newTopRevealKey = $t01089111191._1 | |
318 | - | let newSecondBidAmount = $t01089111191._2 | |
319 | - | let updateTopKey = match $Tuple2(newTopRevealKey, newSecondBidAmount) { | |
320 | - | case newTopData: (String, Int) => | |
321 | - | [StringEntry(topKey, ((newTopData._1 + ",") + toString(newTopData._2)))] | |
322 | - | case _ => | |
323 | - | nil | |
324 | - | } | |
325 | - | (revealedBid ++ updateTopKey) | |
326 | - | } | |
327 | - | else { | |
328 | - | let newTopBidder = [StringEntry(topKey, ((revealKey + ",") + toString(minimalBid)))] | |
329 | - | (revealedBid ++ newTopBidder) | |
330 | - | } | |
331 | - | } | |
332 | - | } | |
397 | + | func reveal (auctionId,name,bidAmount,secret) = _reveal(inv.caller, auctionId, name, bidAmount, secret) | |
398 | + | ||
399 | + | ||
400 | + | ||
401 | + | @Callable(inv) | |
402 | + | func revealForBidder (bidder,auctionId,name,bidAmount,secret) = _reveal(valueOrErrorMessage(addressFromString(bidder), "Bidder must be valid address"), auctionId, name, bidAmount, secret) | |
333 | 403 | ||
334 | 404 | ||
335 | 405 | ||
344 | 414 | let caller = inv.caller | |
345 | 415 | let callerAddress = toString(caller) | |
346 | 416 | func foldRefund (acc,hash) = { | |
347 | - | let bidderHashKey = key_bidderHash(toString(auctionId), callerAddress, hash) | |
348 | - | let bidKey = key_bid(bidderHashKey) | |
349 | - | let revealKey = key_reveal(bidderHashKey) | |
350 | - | let revealedBid = getString(this, revealKey) | |
351 | - | let $t01232312624 = { | |
352 | - | let bidValues = split(valueOrErrorMessage(revealedBid, (("Bid with hash " + hash) + " not found")), ",") | |
353 | - | $Tuple3(parseIntValue(bidValues[0]), parseIntValue(bidValues[1]), bidValues[2]) | |
354 | - | } | |
355 | - | let deposit = $t01232312624._1 | |
356 | - | let bidAmount = $t01232312624._2 | |
357 | - | let name = $t01232312624._3 | |
358 | - | let topKey = key_top(name) | |
359 | - | let topKeyData = getString(this, topKey) | |
360 | - | let $t01271712885 = { | |
361 | - | let topValues = split(value(topKeyData), ",") | |
362 | - | $Tuple2(topValues[0], parseIntValue(topValues[1])) | |
363 | - | } | |
364 | - | let topRevealKey = $t01271712885._1 | |
365 | - | let secondTopBidAmount = $t01271712885._2 | |
366 | - | let $t01289513057 = { | |
367 | - | let winnerInfo = split(topRevealKey, "_") | |
368 | - | $Tuple2(parseIntValue(winnerInfo[1]), winnerInfo[2]) | |
369 | - | } | |
370 | - | let winnerAuctionId = $t01289513057._1 | |
371 | - | let winnerAddress = $t01289513057._2 | |
372 | - | let deleteEntries = [DeleteEntry(revealKey), DeleteEntry(bidKey)] | |
373 | - | let transferAndDeleteEntry = if ((topRevealKey == revealKey)) | |
417 | + | let checkHash = fromBase58String(hash) | |
418 | + | if ((checkHash == checkHash)) | |
374 | 419 | then { | |
375 | - | let $t01325913360 = _referrerPercentTransfer(bidderHashKey, secondTopBidAmount) | |
376 | - | let referrerTransfer = $t01325913360._1 | |
377 | - | let referrerPercent = $t01325913360._2 | |
378 | - | let claimNft = invoke(registrar, "register", [name, winnerAddress, auctionEnd], nil) | |
379 | - | if ((claimNft == claimNft)) | |
420 | + | let bidderHashKey = key_bidderHash(toString(auctionId), callerAddress, hash) | |
421 | + | let bidKey = key_bid(bidderHashKey) | |
422 | + | let revealKey = key_reveal(bidderHashKey) | |
423 | + | let revealedBid = getString(this, revealKey) | |
424 | + | let $t01461714918 = { | |
425 | + | let bidValues = split(valueOrErrorMessage(revealedBid, (("Bid with hash " + hash) + " not found")), ",") | |
426 | + | $Tuple3(parseIntValue(bidValues[0]), parseIntValue(bidValues[1]), bidValues[2]) | |
427 | + | } | |
428 | + | let deposit = $t01461714918._1 | |
429 | + | let bidAmount = $t01461714918._2 | |
430 | + | let name = $t01461714918._3 | |
431 | + | let topKey = key_top(name) | |
432 | + | let topKeyData = getString(this, topKey) | |
433 | + | let $t01501115179 = { | |
434 | + | let topValues = split(value(topKeyData), ",") | |
435 | + | $Tuple2(topValues[0], parseIntValue(topValues[1])) | |
436 | + | } | |
437 | + | let topRevealKey = $t01501115179._1 | |
438 | + | let secondTopBidAmount = $t01501115179._2 | |
439 | + | let $t01518915351 = { | |
440 | + | let winnerInfo = split(topRevealKey, "_") | |
441 | + | $Tuple2(parseIntValue(winnerInfo[1]), winnerInfo[2]) | |
442 | + | } | |
443 | + | let winnerAuctionId = $t01518915351._1 | |
444 | + | let winnerAddress = $t01518915351._2 | |
445 | + | let deleteEntries = [DeleteEntry(revealKey), DeleteEntry(bidKey)] | |
446 | + | let transferAndDeleteEntry = if ((topRevealKey == revealKey)) | |
380 | 447 | then { | |
381 | - | let transferDelta = [ScriptTransfer(caller, (deposit - secondTopBidAmount), unit), ScriptTransfer(collector, (secondTopBidAmount - referrerPercent), unit)] | |
382 | - | (referrerTransfer ++ transferDelta) | |
448 | + | let $t01555315654 = _referrerPercentTransfer(bidderHashKey, secondTopBidAmount) | |
449 | + | let referrerTransfer = $t01555315654._1 | |
450 | + | let referrerPercent = $t01555315654._2 | |
451 | + | let claimNft = invoke(registrar, "register", [name, winnerAddress, auctionEnd], nil) | |
452 | + | if ((claimNft == claimNft)) | |
453 | + | then { | |
454 | + | let refund = (deposit - secondTopBidAmount) | |
455 | + | let transferDelta = if ((refund > 0)) | |
456 | + | then [ScriptTransfer(caller, refund, unit)] | |
457 | + | else nil | |
458 | + | let transferCollector = [ScriptTransfer(collector, (secondTopBidAmount - referrerPercent), unit)] | |
459 | + | ((referrerTransfer ++ transferCollector) ++ transferDelta) | |
460 | + | } | |
461 | + | else throw("Strict value is not equal to itself.") | |
383 | 462 | } | |
384 | - | else throw("Strict value is not equal to itself.") | |
463 | + | else [ScriptTransfer(caller, deposit, unit)] | |
464 | + | ((acc ++ deleteEntries) ++ transferAndDeleteEntry) | |
385 | 465 | } | |
386 | - | else [ScriptTransfer(caller, deposit, unit)] | |
387 | - | ((acc ++ deleteEntries) ++ transferAndDeleteEntry) | |
466 | + | else throw("Strict value is not equal to itself.") | |
388 | 467 | } | |
389 | 468 | ||
390 | 469 | let $l = hashes | |
420 | 499 | func revokeBid (auctionId,hash) = { | |
421 | 500 | let caller = inv.caller | |
422 | 501 | let callerStr = toString(caller) | |
423 | - | let bidderHashKey = key_bidderHash(toString(auctionId), callerStr, hash) | |
424 | - | let bidKey = key_bid(bidderHashKey) | |
425 | - | let bid = getInteger(this, bidKey) | |
426 | - | let $t01469214749 = getAuctionPhase() | |
427 | - | let currentAuctionId = $t01469214749._1 | |
428 | - | let currentPeriod = $t01469214749._2 | |
429 | - | if ((currentAuctionId != auctionId)) | |
430 | - | then throw("Auction is already over") | |
431 | - | else if ((currentPeriod != PHASE_BID)) | |
432 | - | then throw("Bid period is already over") | |
433 | - | else if (!(isDefined(bid))) | |
434 | - | then throw((("Bid with " + hash) + " not found")) | |
435 | - | else [ScriptTransfer(caller, value(bid), unit), DeleteEntry(bidKey)] | |
502 | + | let checkHash = fromBase58String(hash) | |
503 | + | if ((checkHash == checkHash)) | |
504 | + | then { | |
505 | + | let bidderHashKey = key_bidderHash(toString(auctionId), callerStr, hash) | |
506 | + | let bidKey = key_bid(bidderHashKey) | |
507 | + | let bid = getInteger(this, bidKey) | |
508 | + | let $t01710717164 = getAuctionPhase() | |
509 | + | let currentAuctionId = $t01710717164._1 | |
510 | + | let currentPeriod = $t01710717164._2 | |
511 | + | if ((currentAuctionId != auctionId)) | |
512 | + | then throw("Auction is already over") | |
513 | + | else if ((currentPeriod != PHASE_BID)) | |
514 | + | then throw("Bid period is already over") | |
515 | + | else if (!(isDefined(bid))) | |
516 | + | then throw((("Bid with " + hash) + " not found")) | |
517 | + | else [ScriptTransfer(caller, value(bid), unit), DeleteEntry(bidKey)] | |
518 | + | } | |
519 | + | else throw("Strict value is not equal to itself.") | |
436 | 520 | } | |
521 | + | ||
522 | + | ||
523 | + | ||
524 | + | @Callable(inv) | |
525 | + | func setNextMinimalLength (auctionId,minimalLenght) = valueOrElse(modifiers([onlyAdmin(inv)]), { | |
526 | + | let nextMinimalLength = getString(this, key_nextNameMinimalLength) | |
527 | + | if (isDefined(nextMinimalLength)) | |
528 | + | then { | |
529 | + | let $t01778417965 = { | |
530 | + | let values = split(value(nextMinimalLength), ",") | |
531 | + | $Tuple2(parseIntValue(values[0]), parseIntValue(values[1])) | |
532 | + | } | |
533 | + | let nextAuctionId = $t01778417965._1 | |
534 | + | let nextMinimalLenght = $t01778417965._2 | |
535 | + | [IntegerEntry(key_nameMinimalLength, nextMinimalLenght), StringEntry(key_nextNameMinimalLength, ((toString(auctionId) + ",") + toString(minimalLenght)))] | |
536 | + | } | |
537 | + | else [StringEntry(key_nextNameMinimalLength, ((toString(auctionId) + ",") + toString(minimalLenght)))] | |
538 | + | }) | |
437 | 539 | ||
438 | 540 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func getStringOrThrow (address,key) = valueOrErrorMessage(getString(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func getIntegerOrDefault (address,key,default) = valueOrElse(getInteger(address, key), default) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func parseIntOrThrow (maybeInt) = valueOrErrorMessage(parseInt(maybeInt), (("Can't parse integer from '" + maybeInt) + "'")) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'")) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func parseIntOrDefault (maybeInt,default) = valueOrElse(parseInt(maybeInt), default) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func key_top (name) = ("Top_" + name) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func key_top2 (name) = ("Top2_" + name) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func key_bidderHash (auctionId,address,hash) = ((((auctionId + "_") + address) + "_") + hash) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func key_bid (bidderHash) = ("Bid_" + bidderHash) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func key_reveal (bidderHash) = ("Reveal_" + bidderHash) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func key_referrer (bidderHash) = ("Referrer_" + bidderHash) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func key_referrerAddress (name) = (("Referrer_" + name) + "_address") | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func key_referrerPercent (name) = (("Referrer_" + name) + "_percent") | |
47 | 47 | ||
48 | 48 | ||
49 | + | func key_lengthPrice (length) = ("Length_" + toString(length)) | |
50 | + | ||
51 | + | ||
49 | 52 | let key_initTimestamp = "initTimestamp" | |
50 | 53 | ||
51 | 54 | let key_bidDuration = "bidDuration" | |
52 | 55 | ||
53 | 56 | let key_revealDuration = "revealDuration" | |
54 | 57 | ||
55 | 58 | let key_errorFee = "errorFee" | |
56 | 59 | ||
57 | 60 | let key_minimalBid = "minimalBid" | |
58 | 61 | ||
59 | 62 | let key_registrarAddress = "registrarAddress" | |
60 | 63 | ||
61 | 64 | let key_nameMinimalLength = "nameMinimalLength" | |
62 | 65 | ||
63 | 66 | let key_percentRate = "percentRate" | |
64 | 67 | ||
65 | 68 | let key_collectorAddress = "collectorAddress" | |
69 | + | ||
70 | + | let key_nextNameMinimalLength = "nextNameMinimalLength" | |
71 | + | ||
72 | + | let key_lengthPrices = "lengthPrices" | |
66 | 73 | ||
67 | 74 | let auctionStart = getIntegerOrThrow(this, key_initTimestamp) | |
68 | 75 | ||
69 | 76 | let bidDuration = getIntegerOrThrow(this, key_bidDuration) | |
70 | 77 | ||
71 | 78 | let revealDuration = getIntegerOrThrow(this, key_revealDuration) | |
72 | 79 | ||
73 | 80 | let auctionDuration = (bidDuration + revealDuration) | |
74 | 81 | ||
75 | 82 | let errorFee = getIntegerOrThrow(this, key_errorFee) | |
76 | 83 | ||
77 | 84 | let minimalBid = getIntegerOrThrow(this, key_minimalBid) | |
78 | 85 | ||
79 | 86 | let nameMinimalLength = getIntegerOrThrow(this, key_nameMinimalLength) | |
80 | 87 | ||
81 | 88 | let percentRate = getIntegerOrThrow(this, key_percentRate) | |
82 | 89 | ||
83 | 90 | let registrarAddress = getStringOrThrow(this, key_registrarAddress) | |
84 | 91 | ||
85 | 92 | let registrar = parseAddressOrThrow(registrarAddress) | |
86 | 93 | ||
87 | 94 | let collectorAddress = getStringOrThrow(this, key_collectorAddress) | |
88 | 95 | ||
89 | 96 | let collector = parseAddressOrThrow(collectorAddress) | |
90 | 97 | ||
91 | 98 | func _getReferrerData (referrerName) = { | |
92 | 99 | let refAddress = parseAddressOrThrow(getStringOrThrow(this, key_referrerAddress(referrerName))) | |
93 | 100 | let refPercent = valueOrElse(getInteger(this, key_referrerPercent(referrerName)), percentRate) | |
94 | 101 | if (if ((0 > refPercent)) | |
95 | 102 | then true | |
96 | 103 | else (refPercent > 100)) | |
97 | 104 | then throw("Incorrect percent rate") | |
98 | 105 | else $Tuple2(refAddress, refPercent) | |
99 | 106 | } | |
100 | 107 | ||
101 | 108 | ||
102 | 109 | func _referrerPercentTransfer (bidderHashKey,bidAmount) = { | |
103 | 110 | let bidReferrerKey = key_referrer(bidderHashKey) | |
104 | 111 | let bidReferrerName = getString(this, bidReferrerKey) | |
105 | 112 | if (isDefined(bidReferrerName)) | |
106 | 113 | then { | |
107 | - | let $ | |
108 | - | let referrer = $ | |
109 | - | let referrerPercent = $ | |
114 | + | let $t033673442 = _getReferrerData(value(bidReferrerName)) | |
115 | + | let referrer = $t033673442._1 | |
116 | + | let referrerPercent = $t033673442._2 | |
110 | 117 | let referrerPercentAmount = fraction(bidAmount, referrerPercent, 100) | |
111 | 118 | $Tuple2([ScriptTransfer(referrer, referrerPercentAmount, unit), DeleteEntry(bidReferrerKey)], referrerPercentAmount) | |
112 | 119 | } | |
113 | 120 | else $Tuple2(nil, 0) | |
114 | 121 | } | |
115 | 122 | ||
116 | 123 | ||
117 | 124 | func calcHash (name,amount,bidSender,secret) = toBase58String(blake2b256_16Kb(keccak256_16Kb((((toBytes(name) + toBytes(amount)) + fromBase58String(bidSender)) + secret)))) | |
118 | 125 | ||
119 | 126 | ||
120 | 127 | func modifiers (validations) = unit | |
121 | 128 | ||
122 | 129 | ||
123 | 130 | func isAdmin (inv) = (inv.caller == this) | |
124 | 131 | ||
125 | 132 | ||
126 | 133 | func onlyAdmin (inv) = if (isAdmin(inv)) | |
127 | 134 | then unit | |
128 | 135 | else throw("Permission denied") | |
129 | 136 | ||
130 | 137 | ||
131 | 138 | func onlyValidAddress (maybeAddress) = if (isDefined(addressFromString(maybeAddress))) | |
132 | 139 | then unit | |
133 | 140 | else throw((maybeAddress + " is not a valid address")) | |
134 | 141 | ||
135 | 142 | ||
136 | 143 | func onlyPositiveInt (number,variable) = if ((number > 0)) | |
137 | 144 | then unit | |
138 | 145 | else throw((variable + " must be greter than 0")) | |
139 | 146 | ||
140 | 147 | ||
141 | 148 | let PHASE_BID = "BID" | |
142 | 149 | ||
143 | 150 | let PHASE_REVEAL = "REVEAL" | |
144 | 151 | ||
152 | + | func _getPriceForLength (length) = { | |
153 | + | let lengthPrices = getInteger(this, key_lengthPrice(length)) | |
154 | + | if (isDefined(lengthPrices)) | |
155 | + | then value(lengthPrices) | |
156 | + | else minimalBid | |
157 | + | } | |
158 | + | ||
159 | + | ||
160 | + | func _getAllPrices () = { | |
161 | + | let price6 = getInteger(this, key_lengthPrice(6)) | |
162 | + | let price5 = getInteger(this, key_lengthPrice(5)) | |
163 | + | let price4 = getInteger(this, key_lengthPrice(4)) | |
164 | + | let price3 = getInteger(this, key_lengthPrice(3)) | |
165 | + | let price2 = getInteger(this, key_lengthPrice(2)) | |
166 | + | let price1 = getInteger(this, key_lengthPrice(1)) | |
167 | + | ([minimalBid] ++ (if (isDefined(price6)) | |
168 | + | then [value(price6)] | |
169 | + | else (nil ++ (if (isDefined(price5)) | |
170 | + | then [value(price5)] | |
171 | + | else (nil ++ (if (isDefined(price4)) | |
172 | + | then [value(price4)] | |
173 | + | else (nil ++ (if (isDefined(price3)) | |
174 | + | then [value(price3)] | |
175 | + | else (nil ++ (if (isDefined(price2)) | |
176 | + | then [value(price2)] | |
177 | + | else (nil ++ (if (isDefined(price1)) | |
178 | + | then [value(price1)] | |
179 | + | else nil)))))))))))) | |
180 | + | } | |
181 | + | ||
182 | + | ||
183 | + | func _getMinimalLength (auctionId) = { | |
184 | + | let nextNameMinimalLength = getString(this, key_nextNameMinimalLength) | |
185 | + | if (!(isDefined(nextNameMinimalLength))) | |
186 | + | then { | |
187 | + | let $t055625747 = { | |
188 | + | let values = split(value(nextNameMinimalLength), ",") | |
189 | + | $Tuple2(parseIntValue(values[0]), parseIntValue(values[1])) | |
190 | + | } | |
191 | + | let nextAuctionId = $t055625747._1 | |
192 | + | let nextMinimalLenght = $t055625747._2 | |
193 | + | if ((auctionId >= nextAuctionId)) | |
194 | + | then nextMinimalLenght | |
195 | + | else nameMinimalLength | |
196 | + | } | |
197 | + | else nameMinimalLength | |
198 | + | } | |
199 | + | ||
200 | + | ||
145 | 201 | func _getAuctionById (auctionId) = { | |
146 | - | let bidStart = (auctionStart + (auctionId * auctionDuration)) | |
202 | + | let bidStart = (auctionStart + ((auctionId - 1) * auctionDuration)) | |
147 | 203 | let revealStart = (bidStart + bidDuration) | |
148 | 204 | let auctionEnd = (revealStart + revealDuration) | |
149 | 205 | let phase = if ((lastBlock.timestamp > revealStart)) | |
150 | 206 | then PHASE_REVEAL | |
151 | 207 | else PHASE_BID | |
152 | - | $Tuple5(auctionId, phase, bidStart, revealStart, auctionEnd) | |
208 | + | let minimalLength = _getMinimalLength(auctionId) | |
209 | + | let prices = _getAllPrices() | |
210 | + | $Tuple7(auctionId, phase, bidStart, revealStart, auctionEnd, minimalLength, prices) | |
153 | 211 | } | |
154 | 212 | ||
155 | 213 | ||
156 | 214 | func getAuction () = { | |
157 | - | let auctionId = ((lastBlock.timestamp - auctionStart) / auctionDuration) | |
215 | + | let auctionId = (((lastBlock.timestamp - auctionStart) / auctionDuration) + 1) | |
158 | 216 | _getAuctionById(auctionId) | |
159 | 217 | } | |
160 | 218 | ||
161 | 219 | ||
162 | - | func getAuctionPhase () = match getAuction() { | |
163 | - | case auction: (Int, String, Int, Int, Int) => | |
164 | - | let auctionId = auction._1 | |
165 | - | let phase = auction._2 | |
166 | - | $Tuple2(auctionId, phase) | |
167 | - | case _ => | |
168 | - | throw("Invalid auction info") | |
169 | - | } | |
220 | + | func getAuctionPhase () = { | |
221 | + | let auction = getAuction() | |
222 | + | let auctionId = auction._1 | |
223 | + | let phase = auction._2 | |
224 | + | $Tuple2(auctionId, phase) | |
225 | + | } | |
170 | 226 | ||
171 | 227 | ||
172 | 228 | func isValidName (name) = { | |
173 | 229 | let isValid = match invoke(registrar, "isValid", [name], nil) { | |
174 | 230 | case a: Boolean => | |
175 | 231 | a | |
176 | 232 | case _ => | |
177 | 233 | throw("Unsupported result format (available)") | |
178 | 234 | } | |
235 | + | let minimalLenght = getAuction()._6 | |
179 | 236 | if (isValid) | |
180 | - | then (size(name) >= | |
237 | + | then (size(name) >= minimalLenght) | |
181 | 238 | else false | |
182 | 239 | } | |
183 | 240 | ||
184 | 241 | ||
185 | 242 | func isRegistrableName (name) = match invoke(registrar, "isAvailable", [name], nil) { | |
186 | 243 | case a: Boolean => | |
187 | 244 | a | |
188 | 245 | case _ => | |
189 | 246 | throw("Unsupported result format (available)") | |
190 | 247 | } | |
191 | 248 | ||
192 | 249 | ||
193 | 250 | func isWinnableName (name) = { | |
194 | 251 | let revealKey = getString(this, key_top(name)) | |
195 | 252 | if (!(isDefined(revealKey))) | |
196 | 253 | then true | |
197 | 254 | else { | |
198 | 255 | let currentAuction = getAuctionPhase()._1 | |
199 | 256 | let topAuctionId = split(value(revealKey), "_")[1] | |
200 | 257 | let auctionId = parseIntOrDefault(topAuctionId, 0) | |
201 | 258 | (auctionId == currentAuction) | |
202 | 259 | } | |
203 | 260 | } | |
204 | 261 | ||
205 | 262 | ||
206 | 263 | func isAvailableName (name) = if (if (isRegistrableName(name)) | |
207 | 264 | then isWinnableName(name) | |
208 | 265 | else false) | |
209 | 266 | then isValidName(name) | |
210 | 267 | else false | |
211 | 268 | ||
212 | 269 | ||
213 | 270 | func _bid (inv,auctionId,hash) = { | |
214 | 271 | let pmt = if (if ((size(inv.payments) == 1)) | |
215 | 272 | then (inv.payments[0].assetId == unit) | |
216 | 273 | else false) | |
217 | 274 | then inv.payments[0].amount | |
218 | 275 | else throw("Single payment required") | |
219 | - | let callerAddress = toString(inv.caller) | |
220 | - | let bidKey = key_bid(key_bidderHash(toString(auctionId), callerAddress, hash)) | |
221 | - | let $t063656422 = getAuctionPhase() | |
222 | - | let currentAuctionId = $t063656422._1 | |
223 | - | let currentPeriod = $t063656422._2 | |
276 | + | let checkHash = fromBase58String(hash) | |
277 | + | if ((checkHash == checkHash)) | |
278 | + | then { | |
279 | + | let callerAddress = toString(inv.caller) | |
280 | + | let bidKey = key_bid(key_bidderHash(toString(auctionId), callerAddress, hash)) | |
281 | + | let $t081088165 = getAuctionPhase() | |
282 | + | let currentAuctionId = $t081088165._1 | |
283 | + | let currentPeriod = $t081088165._2 | |
284 | + | if ((currentAuctionId != auctionId)) | |
285 | + | then throw("Auctions is already over") | |
286 | + | else if ((currentPeriod != PHASE_BID)) | |
287 | + | then throw("Bid period is over") | |
288 | + | else if (isDefined(getInteger(this, bidKey))) | |
289 | + | then throw("Bid with exact amount already presented") | |
290 | + | else [IntegerEntry(bidKey, pmt)] | |
291 | + | } | |
292 | + | else throw("Strict value is not equal to itself.") | |
293 | + | } | |
294 | + | ||
295 | + | ||
296 | + | func _reveal (bidder,auctionId,name,bidAmount,secret) = { | |
297 | + | let bidderAddress = toString(bidder) | |
298 | + | let hash = calcHash(name, bidAmount, bidderAddress, secret) | |
299 | + | let bidderHashKey = key_bidderHash(toString(auctionId), bidderAddress, hash) | |
300 | + | let revealKey = key_reveal(bidderHashKey) | |
301 | + | let $t088508907 = getAuctionPhase() | |
302 | + | let currentAuctionId = $t088508907._1 | |
303 | + | let currentPeriod = $t088508907._2 | |
224 | 304 | if ((currentAuctionId != auctionId)) | |
225 | 305 | then throw("Auctions is already over") | |
226 | - | else if ((currentPeriod != PHASE_BID)) | |
227 | - | then throw("Bid period is over") | |
228 | - | else if (isDefined(getInteger(this, bidKey))) | |
229 | - | then throw("Bid with exact amount already presented") | |
230 | - | else [IntegerEntry(bidKey, pmt)] | |
306 | + | else if ((currentPeriod != PHASE_REVEAL)) | |
307 | + | then throw("Reveal period is over") | |
308 | + | else if (isDefined(getString(this, revealKey))) | |
309 | + | then throw("Bid is already revealed") | |
310 | + | else { | |
311 | + | let bidKey = key_bid(bidderHashKey) | |
312 | + | let deposit = valueOrErrorMessage(getInteger(this, bidKey), ("Bid doesn't exists " + hash)) | |
313 | + | let topKey = key_top(name) | |
314 | + | let topKeyData = getString(this, topKey) | |
315 | + | let minBidName = _getPriceForLength(size(name)) | |
316 | + | let isValidBid = if (if ((bidAmount >= minBidName)) | |
317 | + | then (deposit >= bidAmount) | |
318 | + | else false) | |
319 | + | then isAvailableName(name) | |
320 | + | else false | |
321 | + | let revealedBid = [StringEntry(revealKey, ((((toString(deposit) + ",") + toString(bidAmount)) + ",") + name))] | |
322 | + | if (!(isValidBid)) | |
323 | + | then { | |
324 | + | let feeAmount = fraction(deposit, 10, 100) | |
325 | + | let returnDepositWithoutFeeAndDeleteBid = [ScriptTransfer(bidder, (deposit - feeAmount), unit), ScriptTransfer(collector, feeAmount, unit), DeleteEntry(bidKey)] | |
326 | + | returnDepositWithoutFeeAndDeleteBid | |
327 | + | } | |
328 | + | else if (isDefined(topKeyData)) | |
329 | + | then { | |
330 | + | let $t01012110300 = { | |
331 | + | let topValues = split(value(topKeyData), ",") | |
332 | + | $Tuple2(topValues[0], parseIntValue(topValues[1])) | |
333 | + | } | |
334 | + | let topRevealKey = $t01012110300._1 | |
335 | + | let secondTopBidAmount = $t01012110300._2 | |
336 | + | let revealedData = value(getString(this, topRevealKey)) | |
337 | + | let topBidAmount = parseIntValue(split(revealedData, ",")[1]) | |
338 | + | let $t01045710755 = if ((bidAmount > topBidAmount)) | |
339 | + | then $Tuple2(revealKey, topBidAmount) | |
340 | + | else if ((bidAmount > secondTopBidAmount)) | |
341 | + | then $Tuple2(topRevealKey, bidAmount) | |
342 | + | else $Tuple2(unit, unit) | |
343 | + | let newTopRevealKey = $t01045710755._1 | |
344 | + | let newSecondBidAmount = $t01045710755._2 | |
345 | + | let updateTopKey = match $Tuple2(newTopRevealKey, newSecondBidAmount) { | |
346 | + | case newTopData: (String, Int) => | |
347 | + | [StringEntry(topKey, ((newTopData._1 + ",") + toString(newTopData._2)))] | |
348 | + | case _ => | |
349 | + | nil | |
350 | + | } | |
351 | + | (revealedBid ++ updateTopKey) | |
352 | + | } | |
353 | + | else { | |
354 | + | let newTopBidder = [StringEntry(topKey, ((revealKey + ",") + toString(minimalBid)))] | |
355 | + | (revealedBid ++ newTopBidder) | |
356 | + | } | |
357 | + | } | |
231 | 358 | } | |
232 | 359 | ||
233 | 360 | ||
234 | 361 | @Callable(inv) | |
235 | 362 | func init (timestamp,bidDuration,revealDuration,errorFee,minimalBid,registrarAddress,nameMinimalLength,percentRate,collectorAddress) = valueOrElse(modifiers([onlyAdmin(inv), if (!(isDefined(getInteger(this, key_initTimestamp)))) | |
236 | 363 | then unit | |
237 | 364 | else throw("Auction already has been initialized"), onlyValidAddress(registrarAddress), onlyValidAddress(collectorAddress), onlyPositiveInt(bidDuration, "Bid duration"), onlyPositiveInt(revealDuration, "Reveal duration"), onlyPositiveInt(errorFee, "Error fee"), onlyPositiveInt(minimalBid, "Minimal bid"), onlyPositiveInt(percentRate, "Percent rate"), if ((nameMinimalLength > 3)) | |
238 | 365 | then unit | |
239 | 366 | else throw("Minimal name length must be more than 3")]), [IntegerEntry(key_initTimestamp, timestamp), IntegerEntry(key_bidDuration, bidDuration), IntegerEntry(key_revealDuration, revealDuration), IntegerEntry(key_errorFee, errorFee), IntegerEntry(key_minimalBid, minimalBid), StringEntry(key_registrarAddress, registrarAddress), IntegerEntry(key_nameMinimalLength, nameMinimalLength), IntegerEntry(key_percentRate, percentRate), StringEntry(key_collectorAddress, collectorAddress)]) | |
240 | 367 | ||
241 | 368 | ||
242 | 369 | ||
243 | 370 | @Callable(inv) | |
244 | 371 | func getAuctionById (auctionId) = $Tuple2(nil, _getAuctionById(auctionId)) | |
245 | 372 | ||
246 | 373 | ||
247 | 374 | ||
248 | 375 | @Callable(inv) | |
249 | 376 | func isAvailable (name) = $Tuple2(nil, isAvailableName(name)) | |
250 | 377 | ||
251 | 378 | ||
252 | 379 | ||
253 | 380 | @Callable(inv) | |
254 | 381 | func bidWithReferrer (auctionId,hash,referrerName) = valueOrElse(modifiers([if (isDefined(getString(this, key_referrerAddress(referrerName)))) | |
255 | 382 | then unit | |
256 | 383 | else throw((("Referrer `" + referrerName) + "` not found"))]), { | |
257 | 384 | let bid = _bid(inv, auctionId, hash) | |
258 | 385 | let commitBidReferrer = [StringEntry(key_referrer(key_bidderHash(toString(auctionId), toString(inv.caller), hash)), referrerName)] | |
259 | 386 | (bid ++ commitBidReferrer) | |
260 | 387 | }) | |
261 | 388 | ||
262 | 389 | ||
263 | 390 | ||
264 | 391 | @Callable(inv) | |
265 | 392 | func bid (auctionId,hash) = _bid(inv, auctionId, hash) | |
266 | 393 | ||
267 | 394 | ||
268 | 395 | ||
269 | 396 | @Callable(inv) | |
270 | - | func reveal (auctionId,name,bidAmount,secret) = { | |
271 | - | let caller = inv.caller | |
272 | - | let callerAddress = toString(caller) | |
273 | - | let hash = calcHash(name, bidAmount, callerAddress, secret) | |
274 | - | let bidderHashKey = key_bidderHash(toString(auctionId), callerAddress, hash) | |
275 | - | let revealKey = key_reveal(bidderHashKey) | |
276 | - | let $t093159372 = getAuctionPhase() | |
277 | - | let currentAuctionId = $t093159372._1 | |
278 | - | let currentPeriod = $t093159372._2 | |
279 | - | if ((currentAuctionId != auctionId)) | |
280 | - | then throw("Auctions is already over") | |
281 | - | else if ((currentPeriod != PHASE_REVEAL)) | |
282 | - | then throw("Reveal period is over") | |
283 | - | else if (isDefined(getString(this, revealKey))) | |
284 | - | then throw("Bid is already revealed") | |
285 | - | else { | |
286 | - | let bidKey = key_bid(bidderHashKey) | |
287 | - | let deposit = valueOrErrorMessage(getInteger(this, bidKey), ("Bid doesn't exists " + hash)) | |
288 | - | let topKey = key_top(name) | |
289 | - | let topKeyData = getString(this, topKey) | |
290 | - | let isValidBid = if (if ((bidAmount >= minimalBid)) | |
291 | - | then (deposit >= bidAmount) | |
292 | - | else false) | |
293 | - | then isAvailableName(name) | |
294 | - | else false | |
295 | - | let revealedBid = [StringEntry(revealKey, ((((toString(deposit) + ",") + toString(bidAmount)) + ",") + name))] | |
296 | - | if (!(isValidBid)) | |
297 | - | then { | |
298 | - | let feeAmount = fraction(deposit, 10, 100) | |
299 | - | let returnDepositWithoutFeeAndDeleteBid = [ScriptTransfer(caller, (deposit - feeAmount), unit), ScriptTransfer(collector, feeAmount, unit), DeleteEntry(bidKey)] | |
300 | - | returnDepositWithoutFeeAndDeleteBid | |
301 | - | } | |
302 | - | else if (isDefined(topKeyData)) | |
303 | - | then { | |
304 | - | let $t01054210722 = { | |
305 | - | let topValues = split(value(topKeyData), ",") | |
306 | - | $Tuple2(topValues[0], parseIntValue(topValues[1])) | |
307 | - | } | |
308 | - | let topRevealKey = $t01054210722._1 | |
309 | - | let secondTopBidAmount = $t01054210722._2 | |
310 | - | let revealedData = value(getString(this, topRevealKey)) | |
311 | - | let topBidAmount = parseIntValue(split(revealedData, ",")[1]) | |
312 | - | let $t01089111191 = if ((bidAmount > topBidAmount)) | |
313 | - | then $Tuple2(revealKey, topBidAmount) | |
314 | - | else if ((bidAmount > secondTopBidAmount)) | |
315 | - | then $Tuple2(topRevealKey, bidAmount) | |
316 | - | else $Tuple2(unit, unit) | |
317 | - | let newTopRevealKey = $t01089111191._1 | |
318 | - | let newSecondBidAmount = $t01089111191._2 | |
319 | - | let updateTopKey = match $Tuple2(newTopRevealKey, newSecondBidAmount) { | |
320 | - | case newTopData: (String, Int) => | |
321 | - | [StringEntry(topKey, ((newTopData._1 + ",") + toString(newTopData._2)))] | |
322 | - | case _ => | |
323 | - | nil | |
324 | - | } | |
325 | - | (revealedBid ++ updateTopKey) | |
326 | - | } | |
327 | - | else { | |
328 | - | let newTopBidder = [StringEntry(topKey, ((revealKey + ",") + toString(minimalBid)))] | |
329 | - | (revealedBid ++ newTopBidder) | |
330 | - | } | |
331 | - | } | |
332 | - | } | |
397 | + | func reveal (auctionId,name,bidAmount,secret) = _reveal(inv.caller, auctionId, name, bidAmount, secret) | |
398 | + | ||
399 | + | ||
400 | + | ||
401 | + | @Callable(inv) | |
402 | + | func revealForBidder (bidder,auctionId,name,bidAmount,secret) = _reveal(valueOrErrorMessage(addressFromString(bidder), "Bidder must be valid address"), auctionId, name, bidAmount, secret) | |
333 | 403 | ||
334 | 404 | ||
335 | 405 | ||
336 | 406 | @Callable(inv) | |
337 | 407 | func finalize (auctionId,hashes) = { | |
338 | 408 | let auctionEnd = _getAuctionById(auctionId)._5 | |
339 | 409 | let err = if ((lastBlock.timestamp > auctionEnd)) | |
340 | 410 | then unit | |
341 | 411 | else throw("Cannot finalize auction that has not ended") | |
342 | 412 | if ((err == err)) | |
343 | 413 | then { | |
344 | 414 | let caller = inv.caller | |
345 | 415 | let callerAddress = toString(caller) | |
346 | 416 | func foldRefund (acc,hash) = { | |
347 | - | let bidderHashKey = key_bidderHash(toString(auctionId), callerAddress, hash) | |
348 | - | let bidKey = key_bid(bidderHashKey) | |
349 | - | let revealKey = key_reveal(bidderHashKey) | |
350 | - | let revealedBid = getString(this, revealKey) | |
351 | - | let $t01232312624 = { | |
352 | - | let bidValues = split(valueOrErrorMessage(revealedBid, (("Bid with hash " + hash) + " not found")), ",") | |
353 | - | $Tuple3(parseIntValue(bidValues[0]), parseIntValue(bidValues[1]), bidValues[2]) | |
354 | - | } | |
355 | - | let deposit = $t01232312624._1 | |
356 | - | let bidAmount = $t01232312624._2 | |
357 | - | let name = $t01232312624._3 | |
358 | - | let topKey = key_top(name) | |
359 | - | let topKeyData = getString(this, topKey) | |
360 | - | let $t01271712885 = { | |
361 | - | let topValues = split(value(topKeyData), ",") | |
362 | - | $Tuple2(topValues[0], parseIntValue(topValues[1])) | |
363 | - | } | |
364 | - | let topRevealKey = $t01271712885._1 | |
365 | - | let secondTopBidAmount = $t01271712885._2 | |
366 | - | let $t01289513057 = { | |
367 | - | let winnerInfo = split(topRevealKey, "_") | |
368 | - | $Tuple2(parseIntValue(winnerInfo[1]), winnerInfo[2]) | |
369 | - | } | |
370 | - | let winnerAuctionId = $t01289513057._1 | |
371 | - | let winnerAddress = $t01289513057._2 | |
372 | - | let deleteEntries = [DeleteEntry(revealKey), DeleteEntry(bidKey)] | |
373 | - | let transferAndDeleteEntry = if ((topRevealKey == revealKey)) | |
417 | + | let checkHash = fromBase58String(hash) | |
418 | + | if ((checkHash == checkHash)) | |
374 | 419 | then { | |
375 | - | let $t01325913360 = _referrerPercentTransfer(bidderHashKey, secondTopBidAmount) | |
376 | - | let referrerTransfer = $t01325913360._1 | |
377 | - | let referrerPercent = $t01325913360._2 | |
378 | - | let claimNft = invoke(registrar, "register", [name, winnerAddress, auctionEnd], nil) | |
379 | - | if ((claimNft == claimNft)) | |
420 | + | let bidderHashKey = key_bidderHash(toString(auctionId), callerAddress, hash) | |
421 | + | let bidKey = key_bid(bidderHashKey) | |
422 | + | let revealKey = key_reveal(bidderHashKey) | |
423 | + | let revealedBid = getString(this, revealKey) | |
424 | + | let $t01461714918 = { | |
425 | + | let bidValues = split(valueOrErrorMessage(revealedBid, (("Bid with hash " + hash) + " not found")), ",") | |
426 | + | $Tuple3(parseIntValue(bidValues[0]), parseIntValue(bidValues[1]), bidValues[2]) | |
427 | + | } | |
428 | + | let deposit = $t01461714918._1 | |
429 | + | let bidAmount = $t01461714918._2 | |
430 | + | let name = $t01461714918._3 | |
431 | + | let topKey = key_top(name) | |
432 | + | let topKeyData = getString(this, topKey) | |
433 | + | let $t01501115179 = { | |
434 | + | let topValues = split(value(topKeyData), ",") | |
435 | + | $Tuple2(topValues[0], parseIntValue(topValues[1])) | |
436 | + | } | |
437 | + | let topRevealKey = $t01501115179._1 | |
438 | + | let secondTopBidAmount = $t01501115179._2 | |
439 | + | let $t01518915351 = { | |
440 | + | let winnerInfo = split(topRevealKey, "_") | |
441 | + | $Tuple2(parseIntValue(winnerInfo[1]), winnerInfo[2]) | |
442 | + | } | |
443 | + | let winnerAuctionId = $t01518915351._1 | |
444 | + | let winnerAddress = $t01518915351._2 | |
445 | + | let deleteEntries = [DeleteEntry(revealKey), DeleteEntry(bidKey)] | |
446 | + | let transferAndDeleteEntry = if ((topRevealKey == revealKey)) | |
380 | 447 | then { | |
381 | - | let transferDelta = [ScriptTransfer(caller, (deposit - secondTopBidAmount), unit), ScriptTransfer(collector, (secondTopBidAmount - referrerPercent), unit)] | |
382 | - | (referrerTransfer ++ transferDelta) | |
448 | + | let $t01555315654 = _referrerPercentTransfer(bidderHashKey, secondTopBidAmount) | |
449 | + | let referrerTransfer = $t01555315654._1 | |
450 | + | let referrerPercent = $t01555315654._2 | |
451 | + | let claimNft = invoke(registrar, "register", [name, winnerAddress, auctionEnd], nil) | |
452 | + | if ((claimNft == claimNft)) | |
453 | + | then { | |
454 | + | let refund = (deposit - secondTopBidAmount) | |
455 | + | let transferDelta = if ((refund > 0)) | |
456 | + | then [ScriptTransfer(caller, refund, unit)] | |
457 | + | else nil | |
458 | + | let transferCollector = [ScriptTransfer(collector, (secondTopBidAmount - referrerPercent), unit)] | |
459 | + | ((referrerTransfer ++ transferCollector) ++ transferDelta) | |
460 | + | } | |
461 | + | else throw("Strict value is not equal to itself.") | |
383 | 462 | } | |
384 | - | else throw("Strict value is not equal to itself.") | |
463 | + | else [ScriptTransfer(caller, deposit, unit)] | |
464 | + | ((acc ++ deleteEntries) ++ transferAndDeleteEntry) | |
385 | 465 | } | |
386 | - | else [ScriptTransfer(caller, deposit, unit)] | |
387 | - | ((acc ++ deleteEntries) ++ transferAndDeleteEntry) | |
466 | + | else throw("Strict value is not equal to itself.") | |
388 | 467 | } | |
389 | 468 | ||
390 | 469 | let $l = hashes | |
391 | 470 | let $s = size($l) | |
392 | 471 | let $acc0 = nil | |
393 | 472 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
394 | 473 | then $a | |
395 | 474 | else foldRefund($a, $l[$i]) | |
396 | 475 | ||
397 | 476 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
398 | 477 | then $a | |
399 | 478 | else throw("List size exceeds 10") | |
400 | 479 | ||
401 | 480 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
402 | 481 | } | |
403 | 482 | else throw("Strict value is not equal to itself.") | |
404 | 483 | } | |
405 | 484 | ||
406 | 485 | ||
407 | 486 | ||
408 | 487 | @Callable(inv) | |
409 | 488 | func addReferrer (referrerName,referrerAddress,percent) = valueOrElse(modifiers([onlyAdmin(inv), onlyValidAddress(referrerAddress), if (if ((percent > 0)) | |
410 | 489 | then (100 > percent) | |
411 | 490 | else false) | |
412 | 491 | then unit | |
413 | 492 | else throw("Percent must be between 0 and 100"), if ((size(referrerName) > 0)) | |
414 | 493 | then unit | |
415 | 494 | else throw("Referrer name cannot be empty")]), [StringEntry(key_referrerAddress(referrerName), referrerAddress), IntegerEntry(key_referrerPercent(referrerName), percent)]) | |
416 | 495 | ||
417 | 496 | ||
418 | 497 | ||
419 | 498 | @Callable(inv) | |
420 | 499 | func revokeBid (auctionId,hash) = { | |
421 | 500 | let caller = inv.caller | |
422 | 501 | let callerStr = toString(caller) | |
423 | - | let bidderHashKey = key_bidderHash(toString(auctionId), callerStr, hash) | |
424 | - | let bidKey = key_bid(bidderHashKey) | |
425 | - | let bid = getInteger(this, bidKey) | |
426 | - | let $t01469214749 = getAuctionPhase() | |
427 | - | let currentAuctionId = $t01469214749._1 | |
428 | - | let currentPeriod = $t01469214749._2 | |
429 | - | if ((currentAuctionId != auctionId)) | |
430 | - | then throw("Auction is already over") | |
431 | - | else if ((currentPeriod != PHASE_BID)) | |
432 | - | then throw("Bid period is already over") | |
433 | - | else if (!(isDefined(bid))) | |
434 | - | then throw((("Bid with " + hash) + " not found")) | |
435 | - | else [ScriptTransfer(caller, value(bid), unit), DeleteEntry(bidKey)] | |
502 | + | let checkHash = fromBase58String(hash) | |
503 | + | if ((checkHash == checkHash)) | |
504 | + | then { | |
505 | + | let bidderHashKey = key_bidderHash(toString(auctionId), callerStr, hash) | |
506 | + | let bidKey = key_bid(bidderHashKey) | |
507 | + | let bid = getInteger(this, bidKey) | |
508 | + | let $t01710717164 = getAuctionPhase() | |
509 | + | let currentAuctionId = $t01710717164._1 | |
510 | + | let currentPeriod = $t01710717164._2 | |
511 | + | if ((currentAuctionId != auctionId)) | |
512 | + | then throw("Auction is already over") | |
513 | + | else if ((currentPeriod != PHASE_BID)) | |
514 | + | then throw("Bid period is already over") | |
515 | + | else if (!(isDefined(bid))) | |
516 | + | then throw((("Bid with " + hash) + " not found")) | |
517 | + | else [ScriptTransfer(caller, value(bid), unit), DeleteEntry(bidKey)] | |
518 | + | } | |
519 | + | else throw("Strict value is not equal to itself.") | |
436 | 520 | } | |
521 | + | ||
522 | + | ||
523 | + | ||
524 | + | @Callable(inv) | |
525 | + | func setNextMinimalLength (auctionId,minimalLenght) = valueOrElse(modifiers([onlyAdmin(inv)]), { | |
526 | + | let nextMinimalLength = getString(this, key_nextNameMinimalLength) | |
527 | + | if (isDefined(nextMinimalLength)) | |
528 | + | then { | |
529 | + | let $t01778417965 = { | |
530 | + | let values = split(value(nextMinimalLength), ",") | |
531 | + | $Tuple2(parseIntValue(values[0]), parseIntValue(values[1])) | |
532 | + | } | |
533 | + | let nextAuctionId = $t01778417965._1 | |
534 | + | let nextMinimalLenght = $t01778417965._2 | |
535 | + | [IntegerEntry(key_nameMinimalLength, nextMinimalLenght), StringEntry(key_nextNameMinimalLength, ((toString(auctionId) + ",") + toString(minimalLenght)))] | |
536 | + | } | |
537 | + | else [StringEntry(key_nextNameMinimalLength, ((toString(auctionId) + ",") + toString(minimalLenght)))] | |
538 | + | }) | |
437 | 539 | ||
438 | 540 |
github/deemru/w8io/169f3d6 78.61 ms ◑