tx · 9Nqkn9ZExoXmkirPixdcQu6XRKRtFKVJj1Jt2rzsirsp 3MqzKJcjfKxqGWSA84WR4kQwZksM5vjxiFp: -0.02700000 Waves 2022.12.05 09:29 [2346704] smart account 3MqzKJcjfKxqGWSA84WR4kQwZksM5vjxiFp > SELF 0.00000000 Waves
{ "type": 13, "id": "9Nqkn9ZExoXmkirPixdcQu6XRKRtFKVJj1Jt2rzsirsp", "fee": 2700000, "feeAssetId": null, "timestamp": 1670221781031, "version": 1, "sender": "3MqzKJcjfKxqGWSA84WR4kQwZksM5vjxiFp", "senderPublicKey": "bS6Cchmk25EdDcapkz8W5WkZgthTHHW6sSBbcidSrCb", "proofs": [ "2oDcfyHrkUc6Nnpkyr7F1TU99NhCCVZjgKiPByzg33vQEckKiNdc8PkBMEZEUZoUh38EXMTcEx9dBgpfnbHB3HBL" ], "script": "base64:AAIFAAAAAAAAD0QIAhIJCgcBAQEBAQgBEgASBAoCCAgSBAoCCAgSBAoCCAgSAwoBCBIAIg9nZXRTdHJpbmdPckZhaWwiA2tleSIDU0VQIghCVUZTQ0FMRSIGc2NhbGU4Igh0aHJvd0VyciIDbXNnIh1jb252ZXJ0UHJpY2VBc3NldEludG9JZG9Bc3NldCIQcHJpY2VBc3NldEFtb3VudCIOcHJpY2VBc3NldE1VTFQiBXByaWNlIglwcmljZU1VTFQiDGlkb0Fzc2V0TVVMVCIPYlByaWNlQXNzZXRNVUxUIg1iSWRvQXNzZXRNVUxUIg5iUHJpY2VBc3NldEJVRiIPYkFtb3VudEFzc2V0QlVGIg5JZHhDZmdJZG9TdGFydCIRSWR4Q2ZnSWRvRHVyYXRpb24iEElkeENmZ0NsYWltU3RhcnQiE0lkeENmZ0NsYWltRHVyYXRpb24iC0lkeENmZ1ByaWNlIg9JZHhDZmdQcmljZU11bHQiEElkeENmZ0lkb0Fzc2V0SWQiEklkeENmZ0lkb0Fzc2V0TXVsdCISSWR4Q2ZnUHJpY2VBc3NldElkIhRJZHhDZmdQcmljZUFzc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29uZmlybU1hbmFnZXIAAAAABAAAAAJjVgkBAAAAAmNmAAAAAAQAAAACY1cDCQEAAAAJaXNEZWZpbmVkAAAAAQUAAAACY1YGCQAAAgAAAAECAAAAEk5vIHBlbmRpbmcgbWFuYWdlcgMJAAAAAAAAAgUAAAACY1cFAAAAAmNXBAAAAAJjWAMJAAAAAAAAAggFAAAAAmNoAAAAD2NhbGxlclB1YmxpY0tleQkBAAAABXZhbHVlAAAAAQUAAAACY1YGCQAAAgAAAAECAAAAG1lvdSBhcmUgbm90IHBlbmRpbmcgbWFuYWdlcgMJAAAAAAAAAgUAAAACY1gFAAAAAmNYCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAAAJhQgAAAAAJAAJYAAAAAQkBAAAABXZhbHVlAAAAAQUAAAACY1YJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAmFDAAAAAAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAmNZAQAAAAJjWgAAAAAEAAAAAmRhBAAAAAJjZAkBAAAAAmNjAAAAAAMJAAABAAAAAgUAAAACY2QCAAAACkJ5dGVWZWN0b3IEAAAAAmNqBQAAAAJjZAUAAAACY2oDCQAAAQAAAAIFAAAAAmNkAgAAAARVbml0CAUAAAACY1kAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJjWQAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmNZAAAABnByb29mcwAAAAAAAAAAAAUAAAACZGFs7YUH", "chainId": 84, "height": 2346704, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FUwBGt91eaTzwrgxUkcWTd8iuxQBXJRNxDR58JGuire9 Next: HNAZjp4N6gzhHXAGGALQMBHMmVB7DdPFK7Wkkc7pC3En Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
11 | 11 | let scale8 = 100000000 | |
12 | 12 | ||
13 | 13 | func throwErr (msg) = throw(makeString(["ido.ride:", msg], " ")) | |
14 | - | ||
15 | - | ||
16 | - | func asString (val) = match val { | |
17 | - | case valStr: String => | |
18 | - | valStr | |
19 | - | case _ => | |
20 | - | throw("fail to cast into String") | |
21 | - | } | |
22 | 14 | ||
23 | 15 | ||
24 | 16 | func convertPriceAssetIntoIdoAsset (priceAssetAmount,priceAssetMULT,price,priceMULT,idoAssetMULT) = { | |
131 | 123 | func keyPriceAssetBalance (address) = makeString(["%s%s", "priceAssetBalance", address], SEP) | |
132 | 124 | ||
133 | 125 | ||
134 | - | func keyInvestorRemainingAmount (address) = makeString(["%s%s", "investorRemainingAmount", address], SEP) | |
135 | - | ||
136 | - | ||
137 | - | func keyTotalRemainingAmount () = makeString(["%s", "totalRemainingAmount"], SEP) | |
138 | - | ||
139 | - | ||
140 | 126 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
141 | 127 | ||
142 | 128 | ||
180 | 166 | let priceAssetBalancePriceAssetDecimals = fraction(priceAssetBalance, scale8, pow(10, 0, priceAssetDecimals, 0, 0, DOWN)) | |
181 | 167 | let newClaimedPriceAssetAmount = ((claimedPriceAssetAmount + incrementDiff[IdxDiffClaimedPriceAmountIncrement]) - priceAssetBalance) | |
182 | 168 | let newClaimedIdoAssetAmount = ((claimedIdoAssetAmount + incrementDiff[IdxDiffClaimedIdoAssetAmountIncrement]) + priceAssetBalancePriceAssetDecimals) | |
183 | - | let entries = if ((0 > newRemainingAmount)) | |
184 | - | then { | |
185 | - | let diff = ((newTotalAmount - newClaimedPriceAssetAmount) - newClaimedIdoAssetAmount) | |
186 | - | let newLogicRemainingAmount = if ((0 > diff)) | |
187 | - | then 0 | |
188 | - | else diff | |
189 | - | StringEntry(key, formatInvestor(newTotalAmount, newLogicRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight)) | |
190 | - | } | |
169 | + | if ((0 > newRemainingAmount)) | |
170 | + | then throwErr(makeString(["invalid math", toString(remainingAmount), toString(incrementDiff[IdxDiffRemainingPriceAmountIncrement]), toString(newRemainingAmount), toString(incrementDiff[IdxDiffTotalIncrement])], " ")) | |
191 | 171 | else StringEntry(key, formatInvestor(newTotalAmount, newRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight)) | |
192 | - | entries | |
193 | 172 | } | |
194 | 173 | ||
195 | 174 | ||
250 | 229 | let periodLength = value(getInteger(keyPeriodLength())) | |
251 | 230 | let currentPeriod = valueOrElse(getInteger(keyCurrentPeriod()), 0) | |
252 | 231 | let zeroPeriodEndHeighIsDefined = isDefined(getInteger(keyPeriodEndHeight(0))) | |
253 | - | let $ | |
232 | + | let $t01248214352 = if ((currentPeriod > 0)) | |
254 | 233 | then { | |
255 | 234 | let lastPeriodStartHeight = value(getInteger(keyPeriodStartHeight(currentPeriod))) | |
256 | 235 | let lastPeriodEndHeight = value(getInteger(keyPeriodEndHeight(currentPeriod))) | |
257 | - | let $ | |
236 | + | let $t01274213447 = if ((height > lastPeriodEndHeight)) | |
258 | 237 | then { | |
259 | 238 | let updatedCurrentPeriod = (currentPeriod + 1) | |
260 | 239 | let periodStart = if ((height > (lastPeriodEndHeight + periodLength))) | |
269 | 248 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
270 | 249 | } | |
271 | 250 | else $Tuple3(currentPeriod, lastPeriodStartHeight, lastPeriodEndHeight) | |
272 | - | let updatedCurrentPeriod = $ | |
273 | - | let periodStart = $ | |
274 | - | let periodEnd = $ | |
251 | + | let updatedCurrentPeriod = $t01274213447._1 | |
252 | + | let periodStart = $t01274213447._2 | |
253 | + | let periodEnd = $t01274213447._3 | |
275 | 254 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
276 | 255 | } | |
277 | 256 | else if (zeroPeriodEndHeighIsDefined) | |
278 | 257 | then { | |
279 | 258 | let zeroPeriodStartHeight = value(getInteger(keyPeriodStartHeight(0))) | |
280 | 259 | let zeroPeriodEndHeight = value(getInteger(keyPeriodEndHeight(0))) | |
281 | - | let $ | |
260 | + | let $t01370214084 = if ((height > zeroPeriodEndHeight)) | |
282 | 261 | then { | |
283 | 262 | let updatedCurrentPeriod = (currentPeriod + 1) | |
284 | 263 | let periodStart = (zeroPeriodEndHeight + 1) | |
286 | 265 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
287 | 266 | } | |
288 | 267 | else $Tuple3(currentPeriod, zeroPeriodStartHeight, zeroPeriodEndHeight) | |
289 | - | let updatedCurrentPeriod = $ | |
290 | - | let periodStart = $ | |
291 | - | let periodEnd = $ | |
268 | + | let updatedCurrentPeriod = $t01370214084._1 | |
269 | + | let periodStart = $t01370214084._2 | |
270 | + | let periodEnd = $t01370214084._3 | |
292 | 271 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
293 | 272 | } | |
294 | 273 | else $Tuple3(currentPeriod, valueOrElse(getInteger(keyPeriodStartHeight(currentPeriod)), height), valueOrElse(getInteger(keyPeriodEndHeight(currentPeriod)), ((height + periodLength) - 1))) | |
295 | - | let updatedCurrentPeriod = $ | |
296 | - | let periodStart = $ | |
297 | - | let periodEnd = $ | |
274 | + | let updatedCurrentPeriod = $t01248214352._1 | |
275 | + | let periodStart = $t01248214352._2 | |
276 | + | let periodEnd = $t01248214352._3 | |
298 | 277 | let periodTotalAvailableToClaim = valueOrElse(getInteger(keyPeriodTotalAvailableToClaim(priceAssetId58, updatedCurrentPeriod)), totalPeriodPriceAssetAllowance) | |
299 | 278 | let periodUserAvailableToClaim = valueOrElse(getInteger(keyPeriodUserAvailableToClaim(priceAssetId58, updatedCurrentPeriod, userAddress58)), userPeriodPriceAssetAllowance) | |
300 | 279 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
301 | 280 | let periodMinAvailableToClaim = min([(outAmount + priceAssetBalance), periodTotalAvailableToClaim, periodUserAvailableToClaim]) | |
302 | 281 | let usdtPriceAssetAllowableRatio = value(getInteger(keyUsdtPriceAssetAllowableRatio())) | |
303 | 282 | let putOneTknV2PriceAssetAmount = scale8 | |
304 | - | let $ | |
283 | + | let $t01510715360 = { | |
305 | 284 | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "putOneTknV2WithoutTakeFeeREADONLY", [putOneTknV2PriceAssetAmount, priceAssetId58], nil) | |
306 | 285 | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
307 | 286 | then @ | |
308 | - | else throw( | |
287 | + | else throw("Couldn't cast Any to (Int, Int, Int)") | |
309 | 288 | } | |
310 | - | if (($ | |
289 | + | if (($t01510715360 == $t01510715360)) | |
311 | 290 | then { | |
312 | - | let bonus = $ | |
313 | - | let feeAmount = $ | |
314 | - | let lpAmount = $ | |
291 | + | let bonus = $t01510715360._3 | |
292 | + | let feeAmount = $t01510715360._2 | |
293 | + | let lpAmount = $t01510715360._1 | |
315 | 294 | let usdtAssetId = value(getString(keyUsdtAssetId())) | |
316 | - | let $ | |
295 | + | let $t01542215640 = { | |
317 | 296 | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "getOneTknV2READONLY", [usdtAssetId, lpAmount], nil) | |
318 | 297 | if ($isInstanceOf(@, "(Int, Int)")) | |
319 | 298 | then @ | |
320 | - | else throw( | |
299 | + | else throw("Couldn't cast Any to (Int, Int)") | |
321 | 300 | } | |
322 | - | if (($ | |
301 | + | if (($t01542215640 == $t01542215640)) | |
323 | 302 | then { | |
324 | - | let getOneTknV2FeeAmount = $ | |
325 | - | let usdtAmount = $ | |
303 | + | let getOneTknV2FeeAmount = $t01542215640._2 | |
304 | + | let usdtAmount = $t01542215640._1 | |
326 | 305 | let currentUsdtPriceAssetRatio = fraction(putOneTknV2PriceAssetAmount, scale8, usdtAmount) | |
327 | 306 | let endPeriodBlocksLeft = (periodEnd - height) | |
328 | 307 | $Tuple10(periodMinAvailableToClaim, periodTotalAvailableToClaim, periodUserAvailableToClaim, totalUserAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft, updatedCurrentPeriod, periodStart, periodEnd) | |
466 | 445 | let priceAssetDecimals = value(assetInfo(fromBase58String(priceAssetId58))).decimals | |
467 | 446 | let entries = if ((claimedAssetId58 == priceAssetId58)) | |
468 | 447 | then { | |
469 | - | let $ | |
470 | - | let periodMinAvailableToClaim = $ | |
471 | - | let periodTotalAvailableToClaim = $ | |
472 | - | let periodUserAvailableToClaim = $ | |
473 | - | let totalUserAvailableToClaim = $ | |
474 | - | let usdtPriceAssetAllowableRatio = $ | |
475 | - | let currentUsdtPriceAssetRatio = $ | |
476 | - | let endPeriodBlocksLeft = $ | |
477 | - | let updatedCurrentPeriod = $ | |
478 | - | let periodStart = $ | |
479 | - | let periodEnd = $ | |
448 | + | let $t02154921993 = internalClaimV2(priceAssetId58, userAddress58, outAmount, totalsDiff[IdxDiffClaimedPriceAmountIncrement]) | |
449 | + | let periodMinAvailableToClaim = $t02154921993._1 | |
450 | + | let periodTotalAvailableToClaim = $t02154921993._2 | |
451 | + | let periodUserAvailableToClaim = $t02154921993._3 | |
452 | + | let totalUserAvailableToClaim = $t02154921993._4 | |
453 | + | let usdtPriceAssetAllowableRatio = $t02154921993._5 | |
454 | + | let currentUsdtPriceAssetRatio = $t02154921993._6 | |
455 | + | let endPeriodBlocksLeft = $t02154921993._7 | |
456 | + | let updatedCurrentPeriod = $t02154921993._8 | |
457 | + | let periodStart = $t02154921993._9 | |
458 | + | let periodEnd = $t02154921993._10 | |
480 | 459 | let checks = [if ((periodUserAvailableToClaim > 0)) | |
481 | 460 | then true | |
482 | 461 | else throwErr("unavailable to claim because user period allowance reached"), if ((periodTotalAvailableToClaim > 0)) | |
490 | 469 | then { | |
491 | 470 | let updatedPeriodTotalAvailableToClaim = (periodTotalAvailableToClaim - periodMinAvailableToClaim) | |
492 | 471 | let updatedPeriodUserAvailableToClaim = (periodUserAvailableToClaim - periodMinAvailableToClaim) | |
493 | - | let entries = if ((priceAssetBalance > periodMinAvailableToClaim)) | |
472 | + | let entries = if ((priceAssetBalance >= periodMinAvailableToClaim)) | |
494 | 473 | then [ScriptTransfer(i.caller, periodMinAvailableToClaim, outAssetId), IntegerEntry(keyPriceAssetBalance(userAddress58), (priceAssetBalance - periodMinAvailableToClaim))] | |
495 | 474 | else { | |
496 | - | let evaluateResult = split(asString(invoke(this, "claimREADONLY", [priceAssetId58, userAddress58], nil)), SEP) | |
497 | - | if ((evaluateResult == evaluateResult)) | |
498 | - | then { | |
499 | - | let availablePriceAmountToClaim = parseIntValue(evaluateResult[3]) | |
500 | - | let lastClaimEntries = if ((availablePriceAmountToClaim == periodMinAvailableToClaim)) | |
501 | - | then { | |
502 | - | let investorTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount]) | |
503 | - | let investorRemainingAmount = parseIntValue(origInvestArray[IdxInvRemainingAmount]) | |
504 | - | let investorPriceAssetBalance = parseIntValue(origInvestArray[IdxInvClaimedPriceAssetAmount]) | |
505 | - | let investorIdoAssetBalance = parseIntValue(origInvestArray[IdxInvClaimedIdoAssetAmount]) | |
506 | - | let investorLastClaimedHeight = parseIntValue(origInvestArray[IdxInvLastClaimedHeight]) | |
507 | - | let newInvestArray = [toString(investorTotalAmount), "0", toString(investorPriceAssetBalance), toString(investorIdoAssetBalance), toString(investorLastClaimedHeight)] | |
508 | - | let totals = readTotalsArrayOrDefault() | |
509 | - | let totalsTotalAmount = parseIntValue(totals[IdxInvTotalAmount]) | |
510 | - | let totalsRemainingAmount = parseIntValue(totals[IdxInvRemainingAmount]) | |
511 | - | let totalsClaimedPriceAssetAmount = parseIntValue(totals[IdxInvRemainingAmount]) | |
512 | - | let totalsClaimedIdoAssetAmount = parseIntValue(totals[IdxInvClaimedPriceAssetAmount]) | |
513 | - | let totalsLastClaimedHeight = parseIntValue(totals[IdxInvLastClaimedHeight]) | |
514 | - | let newTotalsRemainingAmount = (totalsRemainingAmount - investorRemainingAmount) | |
515 | - | let newTotalArray = [toString(totalsTotalAmount), toString(newTotalsRemainingAmount), toString(totalsClaimedPriceAssetAmount), toString(totalsClaimedIdoAssetAmount), toString(totalsLastClaimedHeight)] | |
516 | - | let newTotalRemainingAmount = (valueOrElse(getInteger(keyTotalRemainingAmount()), 0) + investorRemainingAmount) | |
517 | - | [StringEntry(keyInvestorRemainingAmount(userAddress58), toString(investorRemainingAmount)), StringEntry(keyTotalRemainingAmount(), toString(newTotalRemainingAmount)), TotalsEntry(keyInvestor(userAddress58), newInvestArray, totalsDiff, newClaimPeriodHeight, 0), TotalsEntry(keyTotals(), newTotalArray, totalsDiff, newClaimPeriodHeight, 0)] | |
518 | - | } | |
519 | - | else [TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight, 0), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight, 0)] | |
520 | - | let updatedPriceAssetBalance = ((priceAssetBalance + outAmount) - periodMinAvailableToClaim) | |
521 | - | ([ScriptTransfer(i.caller, periodMinAvailableToClaim, outAssetId), IntegerEntry(keyPriceAssetBalance(userAddress58), updatedPriceAssetBalance)] ++ lastClaimEntries) | |
522 | - | } | |
523 | - | else throw("Strict value is not equal to itself.") | |
475 | + | let updatedPriceAssetBalance = ((priceAssetBalance + outAmount) - periodMinAvailableToClaim) | |
476 | + | [ScriptTransfer(i.caller, periodMinAvailableToClaim, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight, 0), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight, 0), IntegerEntry(keyPriceAssetBalance(userAddress58), updatedPriceAssetBalance)] | |
524 | 477 | } | |
525 | 478 | $Tuple2(([IntegerEntry(keyCurrentPeriod(), updatedCurrentPeriod), IntegerEntry(keyPeriodStartHeight(updatedCurrentPeriod), periodStart), IntegerEntry(keyPeriodEndHeight(updatedCurrentPeriod), periodEnd), IntegerEntry(keyPeriodTotalAvailableToClaim(priceAssetId58, updatedCurrentPeriod), updatedPeriodTotalAvailableToClaim), IntegerEntry(keyPeriodUserAvailableToClaim(priceAssetId58, updatedCurrentPeriod, userAddress58), updatedPeriodUserAvailableToClaim), ClaimOperationHistoryEntry(userAddress58, periodMinAvailableToClaim, claimedIdoAssetAmountFromDiff, i.transactionId)] ++ entries), unit) | |
526 | 479 | } | |
568 | 521 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
569 | 522 | let priceAssetBalanceIdoDecimals = (priceAssetBalance * 100) | |
570 | 523 | let availableIdoAmountToClaimWithPriceAssetBalance = (availableIdoAmountToClaim + priceAssetBalanceIdoDecimals) | |
571 | - | let $ | |
572 | - | let periodMinAvailableToClaim = $ | |
573 | - | let periodTotalAvailableToClaim = $ | |
574 | - | let periodUserAvailableToClaim = $ | |
575 | - | let totalUserAvailableToClaim = $ | |
576 | - | let usdtPriceAssetAllowableRatio = $ | |
577 | - | let currentUsdtPriceAssetRatio = $ | |
578 | - | let endPeriodBlocksLeft = $ | |
579 | - | let updatedCurrentPeriod = $ | |
580 | - | let periodStart = $ | |
581 | - | let periodEnd = $ | |
524 | + | let $t02828628698 = internalClaimV2(priceAssetId58, userAddress58, outAmount, totalsDiff[IdxDiffClaimedPriceAmountIncrement]) | |
525 | + | let periodMinAvailableToClaim = $t02828628698._1 | |
526 | + | let periodTotalAvailableToClaim = $t02828628698._2 | |
527 | + | let periodUserAvailableToClaim = $t02828628698._3 | |
528 | + | let totalUserAvailableToClaim = $t02828628698._4 | |
529 | + | let usdtPriceAssetAllowableRatio = $t02828628698._5 | |
530 | + | let currentUsdtPriceAssetRatio = $t02828628698._6 | |
531 | + | let endPeriodBlocksLeft = $t02828628698._7 | |
532 | + | let updatedCurrentPeriod = $t02828628698._8 | |
533 | + | let periodStart = $t02828628698._9 | |
534 | + | let periodEnd = $t02828628698._10 | |
582 | 535 | let currentPeriodEndHeight = valueOrElse(getInteger(keyPeriodEndHeight(updatedCurrentPeriod)), 0) | |
583 | 536 | let userTotalPriceAssetClaimed = (parseIntValue(readInvestorArrayOrFail(userAddress58)[IdxInvClaimedPriceAssetAmount]) - priceAssetBalance) | |
584 | 537 | let resultString = if ((height > currentPeriodEndHeight)) |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | let SEP = "__" | |
8 | 8 | ||
9 | 9 | let BUFSCALE = toBigInt(1000000000000000000) | |
10 | 10 | ||
11 | 11 | let scale8 = 100000000 | |
12 | 12 | ||
13 | 13 | func throwErr (msg) = throw(makeString(["ido.ride:", msg], " ")) | |
14 | - | ||
15 | - | ||
16 | - | func asString (val) = match val { | |
17 | - | case valStr: String => | |
18 | - | valStr | |
19 | - | case _ => | |
20 | - | throw("fail to cast into String") | |
21 | - | } | |
22 | 14 | ||
23 | 15 | ||
24 | 16 | func convertPriceAssetIntoIdoAsset (priceAssetAmount,priceAssetMULT,price,priceMULT,idoAssetMULT) = { | |
25 | 17 | let bPriceAssetMULT = toBigInt(priceAssetMULT) | |
26 | 18 | let bIdoAssetMULT = toBigInt(idoAssetMULT) | |
27 | 19 | let bPriceAssetBUF = fraction(toBigInt(priceAssetAmount), BUFSCALE, bPriceAssetMULT) | |
28 | 20 | let bAmountAssetBUF = fraction(bPriceAssetBUF, toBigInt(priceMULT), toBigInt(price)) | |
29 | 21 | toInt(fraction(bAmountAssetBUF, toBigInt(idoAssetMULT), BUFSCALE)) | |
30 | 22 | } | |
31 | 23 | ||
32 | 24 | ||
33 | 25 | let IdxCfgIdoStart = 1 | |
34 | 26 | ||
35 | 27 | let IdxCfgIdoDuration = 2 | |
36 | 28 | ||
37 | 29 | let IdxCfgClaimStart = 3 | |
38 | 30 | ||
39 | 31 | let IdxCfgClaimDuration = 4 | |
40 | 32 | ||
41 | 33 | let IdxCfgPrice = 5 | |
42 | 34 | ||
43 | 35 | let IdxCfgPriceMult = 6 | |
44 | 36 | ||
45 | 37 | let IdxCfgIdoAssetId = 7 | |
46 | 38 | ||
47 | 39 | let IdxCfgIdoAssetMult = 8 | |
48 | 40 | ||
49 | 41 | let IdxCfgPriceAssetId = 9 | |
50 | 42 | ||
51 | 43 | let IdxCfgPriceAssetMult = 10 | |
52 | 44 | ||
53 | 45 | let IdxCfgMinInvestAmount = 11 | |
54 | 46 | ||
55 | 47 | func fromatConfigS (idoStart,idoDuration,claimStart,claimDuration,price,priceMult,idoAssetId58,idoAssetMult,priceAssetId58,priceAssetMult,minInvestAmount,totalIdoAssetToSell) = makeString(["%d%d%d%d%d%d%s%d%s%d%d%d", idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount, totalIdoAssetToSell], SEP) | |
56 | 48 | ||
57 | 49 | ||
58 | 50 | func fromatConfig (idoStart,idoDuration,claimStart,claimDuration,price,priceMult,idoAssetId58,idoAssetMult,priceAssetId58,priceAssetMult,minInvestAmount,totalIdoAssetToSell) = fromatConfigS(toString(idoStart), toString(idoDuration), toString(claimStart), toString(claimDuration), toString(price), toString(priceMult), idoAssetId58, toString(idoAssetMult), priceAssetId58, toString(priceAssetMult), toString(minInvestAmount), toString(totalIdoAssetToSell)) | |
59 | 51 | ||
60 | 52 | ||
61 | 53 | let IdxInvTotalAmount = 1 | |
62 | 54 | ||
63 | 55 | let IdxInvRemainingAmount = 2 | |
64 | 56 | ||
65 | 57 | let IdxInvClaimedPriceAssetAmount = 3 | |
66 | 58 | ||
67 | 59 | let IdxInvClaimedIdoAssetAmount = 4 | |
68 | 60 | ||
69 | 61 | let IdxInvLastClaimedHeight = 5 | |
70 | 62 | ||
71 | 63 | func formatInvestorS (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = makeString(["%d%d%d%d%d", totalAmount, remainingAmount, claimedPriceAssetAmount, claimedIdoAssetAmount, lastClaimedHeight], SEP) | |
72 | 64 | ||
73 | 65 | ||
74 | 66 | func formatInvestor (totalAmount,remainingAmount,claimedPriceAssetAmount,claimedIdoAssetAmount,lastClaimedHeight) = formatInvestorS(toString(totalAmount), toString(remainingAmount), toString(claimedPriceAssetAmount), toString(claimedIdoAssetAmount), toString(lastClaimedHeight)) | |
75 | 67 | ||
76 | 68 | ||
77 | 69 | func formatHistoryRecord (priceAssetAmount,idoAssetAmount) = makeString(["%d%d%d%d", toString(height), toString(lastBlock.timestamp), toString(priceAssetAmount), toString(idoAssetAmount)], SEP) | |
78 | 70 | ||
79 | 71 | ||
80 | 72 | func keyConfig () = "%s__config" | |
81 | 73 | ||
82 | 74 | ||
83 | 75 | func keyInvestor (userAddress) = ("%s__" + userAddress) | |
84 | 76 | ||
85 | 77 | ||
86 | 78 | func keyTotals () = "%s__totals" | |
87 | 79 | ||
88 | 80 | ||
89 | 81 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
90 | 82 | ||
91 | 83 | ||
92 | 84 | func keyUSDNClaimDisabled () = "%s__usdnClaimDisabled" | |
93 | 85 | ||
94 | 86 | ||
95 | 87 | func keyUSDNClaimEndHeight () = "%s__usdnClaimEndHeight" | |
96 | 88 | ||
97 | 89 | ||
98 | 90 | func keyPeriodLength () = makeString(["%s", "periodLength"], SEP) | |
99 | 91 | ||
100 | 92 | ||
101 | 93 | func keyCurrentPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
102 | 94 | ||
103 | 95 | ||
104 | 96 | func keyPeriodStartHeight (periodNum) = makeString(["%s%s", "periodStartHeight", toString(periodNum)], SEP) | |
105 | 97 | ||
106 | 98 | ||
107 | 99 | func keyPeriodEndHeight (periodNum) = makeString(["%s%s", "periodEndHeight", toString(periodNum)], SEP) | |
108 | 100 | ||
109 | 101 | ||
110 | 102 | func keyUsdtPriceAssetAllowableRatio () = makeString(["%s", "usdtPriceAssetAllowableRatio"], SEP) | |
111 | 103 | ||
112 | 104 | ||
113 | 105 | func keyTotalPeriodAllowance (assetId) = makeString(["%s%s", "totalPeriodAllowance", assetId], SEP) | |
114 | 106 | ||
115 | 107 | ||
116 | 108 | func keyUserPeriodAllowance (assetId) = makeString(["%s%s", "userPeriodAllowance", assetId], SEP) | |
117 | 109 | ||
118 | 110 | ||
119 | 111 | func keyPeriodTotalAvailableToClaim (assetId,periodNum) = makeString(["%s%s%s", "periodTotalAvailableToClaim", assetId, toString(periodNum)], SEP) | |
120 | 112 | ||
121 | 113 | ||
122 | 114 | func keyPeriodUserAvailableToClaim (assetId,periodNum,userAddress) = makeString(["%s%s%s%s", "periodUserAvailableToClaim", assetId, toString(periodNum), userAddress], SEP) | |
123 | 115 | ||
124 | 116 | ||
125 | 117 | func keyUsdtPriceAssetStablePool () = makeString(["%s", "usdtPriceAssetStablePool"], SEP) | |
126 | 118 | ||
127 | 119 | ||
128 | 120 | func keyUsdtAssetId () = makeString(["%s", "usdtAssetId"], SEP) | |
129 | 121 | ||
130 | 122 | ||
131 | 123 | func keyPriceAssetBalance (address) = makeString(["%s%s", "priceAssetBalance", address], SEP) | |
132 | 124 | ||
133 | 125 | ||
134 | - | func keyInvestorRemainingAmount (address) = makeString(["%s%s", "investorRemainingAmount", address], SEP) | |
135 | - | ||
136 | - | ||
137 | - | func keyTotalRemainingAmount () = makeString(["%s", "totalRemainingAmount"], SEP) | |
138 | - | ||
139 | - | ||
140 | 126 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
141 | 127 | ||
142 | 128 | ||
143 | 129 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
144 | 130 | ||
145 | 131 | ||
146 | 132 | func readConfigArray () = split(getStringOrFail(keyConfig()), SEP) | |
147 | 133 | ||
148 | 134 | ||
149 | 135 | func readTotalsArrayOrDefaultByCustomKey (customKey) = split(valueOrElse(getString(customKey), formatInvestorS("0", "0", "0", "0", "0")), SEP) | |
150 | 136 | ||
151 | 137 | ||
152 | 138 | func readTotalsArrayOrDefault () = readTotalsArrayOrDefaultByCustomKey(keyTotals()) | |
153 | 139 | ||
154 | 140 | ||
155 | 141 | func readInvestorArrayOrDefault (userAddress) = readTotalsArrayOrDefaultByCustomKey(keyInvestor(userAddress)) | |
156 | 142 | ||
157 | 143 | ||
158 | 144 | func readInvestorArrayOrFail (userAddress) = split(getStringOrFail(keyInvestor(userAddress)), SEP) | |
159 | 145 | ||
160 | 146 | ||
161 | 147 | let IdxDiffTotalIncrement = 0 | |
162 | 148 | ||
163 | 149 | let IdxDiffRemainingPriceAmountIncrement = 1 | |
164 | 150 | ||
165 | 151 | let IdxDiffClaimedPriceAmountIncrement = 2 | |
166 | 152 | ||
167 | 153 | let IdxDiffClaimedIdoAssetAmountIncrement = 3 | |
168 | 154 | ||
169 | 155 | func TotalsEntry (key,origArray,incrementDiff,newLastClaimedHeight,priceAssetBalance) = { | |
170 | 156 | let totalAmount = parseIntValue(origArray[IdxInvTotalAmount]) | |
171 | 157 | let remainingAmount = parseIntValue(origArray[IdxInvRemainingAmount]) | |
172 | 158 | let claimedPriceAssetAmount = parseIntValue(origArray[IdxInvClaimedPriceAssetAmount]) | |
173 | 159 | let claimedIdoAssetAmount = parseIntValue(origArray[IdxInvClaimedIdoAssetAmount]) | |
174 | 160 | let lastClaimedHeight = parseIntValue(origArray[IdxInvLastClaimedHeight]) | |
175 | 161 | let newTotalAmount = (totalAmount + incrementDiff[IdxDiffTotalIncrement]) | |
176 | 162 | let newRemainingAmount = (remainingAmount + incrementDiff[IdxDiffRemainingPriceAmountIncrement]) | |
177 | 163 | let cfgArray = readConfigArray() | |
178 | 164 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
179 | 165 | let priceAssetDecimals = value(assetInfo(fromBase58String(priceAssetId58))).decimals | |
180 | 166 | let priceAssetBalancePriceAssetDecimals = fraction(priceAssetBalance, scale8, pow(10, 0, priceAssetDecimals, 0, 0, DOWN)) | |
181 | 167 | let newClaimedPriceAssetAmount = ((claimedPriceAssetAmount + incrementDiff[IdxDiffClaimedPriceAmountIncrement]) - priceAssetBalance) | |
182 | 168 | let newClaimedIdoAssetAmount = ((claimedIdoAssetAmount + incrementDiff[IdxDiffClaimedIdoAssetAmountIncrement]) + priceAssetBalancePriceAssetDecimals) | |
183 | - | let entries = if ((0 > newRemainingAmount)) | |
184 | - | then { | |
185 | - | let diff = ((newTotalAmount - newClaimedPriceAssetAmount) - newClaimedIdoAssetAmount) | |
186 | - | let newLogicRemainingAmount = if ((0 > diff)) | |
187 | - | then 0 | |
188 | - | else diff | |
189 | - | StringEntry(key, formatInvestor(newTotalAmount, newLogicRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight)) | |
190 | - | } | |
169 | + | if ((0 > newRemainingAmount)) | |
170 | + | then throwErr(makeString(["invalid math", toString(remainingAmount), toString(incrementDiff[IdxDiffRemainingPriceAmountIncrement]), toString(newRemainingAmount), toString(incrementDiff[IdxDiffTotalIncrement])], " ")) | |
191 | 171 | else StringEntry(key, formatInvestor(newTotalAmount, newRemainingAmount, newClaimedPriceAssetAmount, newClaimedIdoAssetAmount, newLastClaimedHeight)) | |
192 | - | entries | |
193 | 172 | } | |
194 | 173 | ||
195 | 174 | ||
196 | 175 | func InvestOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("invest", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount)) | |
197 | 176 | ||
198 | 177 | ||
199 | 178 | func ClaimOperationHistoryEntry (userAddress,priceAssetAmount,idoAssetAmount,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(priceAssetAmount, idoAssetAmount)) | |
200 | 179 | ||
201 | 180 | ||
202 | 181 | func internalClaim (claimedAssetId58,userAddress,txId) = { | |
203 | 182 | let cfgArray = readConfigArray() | |
204 | 183 | let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart]) | |
205 | 184 | let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration]) | |
206 | 185 | let claimEnd = (claimStart + claimDuration) | |
207 | 186 | let price = parseIntValue(cfgArray[IdxCfgPrice]) | |
208 | 187 | let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult]) | |
209 | 188 | let idoAssetId58 = cfgArray[IdxCfgIdoAssetId] | |
210 | 189 | let idoAssetId = fromBase58String(idoAssetId58) | |
211 | 190 | let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult]) | |
212 | 191 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
213 | 192 | let priceAssetId = fromBase58String(priceAssetId58) | |
214 | 193 | let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult]) | |
215 | 194 | let userAddress58 = toString(userAddress) | |
216 | 195 | let origInvestArray = readInvestorArrayOrFail(userAddress58) | |
217 | 196 | let investTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount]) | |
218 | 197 | let investLastClaimedHeightTMP = parseIntValue(origInvestArray[IdxInvLastClaimedHeight]) | |
219 | 198 | let investLastClaimedHeight = if ((claimStart >= investLastClaimedHeightTMP)) | |
220 | 199 | then claimStart | |
221 | 200 | else investLastClaimedHeightTMP | |
222 | 201 | let newClaimPeriodHeight = if ((height > claimEnd)) | |
223 | 202 | then claimEnd | |
224 | 203 | else if ((claimStart > height)) | |
225 | 204 | then claimStart | |
226 | 205 | else height | |
227 | 206 | let claimingBlocks = (newClaimPeriodHeight - investLastClaimedHeight) | |
228 | 207 | let claimingPriceAssetAmount = fraction(investTotalAmount, claimingBlocks, claimDuration) | |
229 | 208 | let claimingIdoAssetAmount = convertPriceAssetIntoIdoAsset(claimingPriceAssetAmount, priceAssetMult, price, priceMult, idoAssetMult) | |
230 | 209 | let isUSDN = (claimedAssetId58 == priceAssetId58) | |
231 | 210 | let isUSDNClaimDisabled = valueOrElse(getBoolean(keyUSDNClaimDisabled()), false) | |
232 | 211 | let checks = [if (!(if (isUSDN) | |
233 | 212 | then isUSDNClaimDisabled | |
234 | 213 | else false)) | |
235 | 214 | then true | |
236 | 215 | else throw("USDN claim is disabled")] | |
237 | 216 | if ((checks == checks)) | |
238 | 217 | then if ((claimedAssetId58 == priceAssetId58)) | |
239 | 218 | then $Tuple6([0, -(claimingPriceAssetAmount), claimingPriceAssetAmount, 0], claimingPriceAssetAmount, priceAssetId, origInvestArray, newClaimPeriodHeight, [claimingPriceAssetAmount, claimingIdoAssetAmount]) | |
240 | 219 | else if ((claimedAssetId58 == idoAssetId58)) | |
241 | 220 | then $Tuple6([0, -(claimingPriceAssetAmount), 0, claimingIdoAssetAmount], claimingIdoAssetAmount, idoAssetId, origInvestArray, newClaimPeriodHeight, [claimingPriceAssetAmount, claimingIdoAssetAmount]) | |
242 | 221 | else throw(("unsupported assetId: " + claimedAssetId58)) | |
243 | 222 | else throw("Strict value is not equal to itself.") | |
244 | 223 | } | |
245 | 224 | ||
246 | 225 | ||
247 | 226 | func internalClaimV2 (priceAssetId58,userAddress58,outAmount,totalUserAvailableToClaim) = { | |
248 | 227 | let totalPeriodPriceAssetAllowance = value(getInteger(keyTotalPeriodAllowance(priceAssetId58))) | |
249 | 228 | let userPeriodPriceAssetAllowance = value(getInteger(keyUserPeriodAllowance(priceAssetId58))) | |
250 | 229 | let periodLength = value(getInteger(keyPeriodLength())) | |
251 | 230 | let currentPeriod = valueOrElse(getInteger(keyCurrentPeriod()), 0) | |
252 | 231 | let zeroPeriodEndHeighIsDefined = isDefined(getInteger(keyPeriodEndHeight(0))) | |
253 | - | let $ | |
232 | + | let $t01248214352 = if ((currentPeriod > 0)) | |
254 | 233 | then { | |
255 | 234 | let lastPeriodStartHeight = value(getInteger(keyPeriodStartHeight(currentPeriod))) | |
256 | 235 | let lastPeriodEndHeight = value(getInteger(keyPeriodEndHeight(currentPeriod))) | |
257 | - | let $ | |
236 | + | let $t01274213447 = if ((height > lastPeriodEndHeight)) | |
258 | 237 | then { | |
259 | 238 | let updatedCurrentPeriod = (currentPeriod + 1) | |
260 | 239 | let periodStart = if ((height > (lastPeriodEndHeight + periodLength))) | |
261 | 240 | then { | |
262 | 241 | let blocksToLastPeriodStart = ((height - lastPeriodEndHeight) % periodLength) | |
263 | 242 | if ((blocksToLastPeriodStart == 0)) | |
264 | 243 | then ((height - periodLength) + 1) | |
265 | 244 | else (height - blocksToLastPeriodStart) | |
266 | 245 | } | |
267 | 246 | else (lastPeriodEndHeight + 1) | |
268 | 247 | let periodEnd = ((periodStart + periodLength) - 1) | |
269 | 248 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
270 | 249 | } | |
271 | 250 | else $Tuple3(currentPeriod, lastPeriodStartHeight, lastPeriodEndHeight) | |
272 | - | let updatedCurrentPeriod = $ | |
273 | - | let periodStart = $ | |
274 | - | let periodEnd = $ | |
251 | + | let updatedCurrentPeriod = $t01274213447._1 | |
252 | + | let periodStart = $t01274213447._2 | |
253 | + | let periodEnd = $t01274213447._3 | |
275 | 254 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
276 | 255 | } | |
277 | 256 | else if (zeroPeriodEndHeighIsDefined) | |
278 | 257 | then { | |
279 | 258 | let zeroPeriodStartHeight = value(getInteger(keyPeriodStartHeight(0))) | |
280 | 259 | let zeroPeriodEndHeight = value(getInteger(keyPeriodEndHeight(0))) | |
281 | - | let $ | |
260 | + | let $t01370214084 = if ((height > zeroPeriodEndHeight)) | |
282 | 261 | then { | |
283 | 262 | let updatedCurrentPeriod = (currentPeriod + 1) | |
284 | 263 | let periodStart = (zeroPeriodEndHeight + 1) | |
285 | 264 | let periodEnd = ((periodStart + periodLength) - 1) | |
286 | 265 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
287 | 266 | } | |
288 | 267 | else $Tuple3(currentPeriod, zeroPeriodStartHeight, zeroPeriodEndHeight) | |
289 | - | let updatedCurrentPeriod = $ | |
290 | - | let periodStart = $ | |
291 | - | let periodEnd = $ | |
268 | + | let updatedCurrentPeriod = $t01370214084._1 | |
269 | + | let periodStart = $t01370214084._2 | |
270 | + | let periodEnd = $t01370214084._3 | |
292 | 271 | $Tuple3(updatedCurrentPeriod, periodStart, periodEnd) | |
293 | 272 | } | |
294 | 273 | else $Tuple3(currentPeriod, valueOrElse(getInteger(keyPeriodStartHeight(currentPeriod)), height), valueOrElse(getInteger(keyPeriodEndHeight(currentPeriod)), ((height + periodLength) - 1))) | |
295 | - | let updatedCurrentPeriod = $ | |
296 | - | let periodStart = $ | |
297 | - | let periodEnd = $ | |
274 | + | let updatedCurrentPeriod = $t01248214352._1 | |
275 | + | let periodStart = $t01248214352._2 | |
276 | + | let periodEnd = $t01248214352._3 | |
298 | 277 | let periodTotalAvailableToClaim = valueOrElse(getInteger(keyPeriodTotalAvailableToClaim(priceAssetId58, updatedCurrentPeriod)), totalPeriodPriceAssetAllowance) | |
299 | 278 | let periodUserAvailableToClaim = valueOrElse(getInteger(keyPeriodUserAvailableToClaim(priceAssetId58, updatedCurrentPeriod, userAddress58)), userPeriodPriceAssetAllowance) | |
300 | 279 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
301 | 280 | let periodMinAvailableToClaim = min([(outAmount + priceAssetBalance), periodTotalAvailableToClaim, periodUserAvailableToClaim]) | |
302 | 281 | let usdtPriceAssetAllowableRatio = value(getInteger(keyUsdtPriceAssetAllowableRatio())) | |
303 | 282 | let putOneTknV2PriceAssetAmount = scale8 | |
304 | - | let $ | |
283 | + | let $t01510715360 = { | |
305 | 284 | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "putOneTknV2WithoutTakeFeeREADONLY", [putOneTknV2PriceAssetAmount, priceAssetId58], nil) | |
306 | 285 | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
307 | 286 | then @ | |
308 | - | else throw( | |
287 | + | else throw("Couldn't cast Any to (Int, Int, Int)") | |
309 | 288 | } | |
310 | - | if (($ | |
289 | + | if (($t01510715360 == $t01510715360)) | |
311 | 290 | then { | |
312 | - | let bonus = $ | |
313 | - | let feeAmount = $ | |
314 | - | let lpAmount = $ | |
291 | + | let bonus = $t01510715360._3 | |
292 | + | let feeAmount = $t01510715360._2 | |
293 | + | let lpAmount = $t01510715360._1 | |
315 | 294 | let usdtAssetId = value(getString(keyUsdtAssetId())) | |
316 | - | let $ | |
295 | + | let $t01542215640 = { | |
317 | 296 | let @ = invoke(addressFromStringValue(value(getString(keyUsdtPriceAssetStablePool()))), "getOneTknV2READONLY", [usdtAssetId, lpAmount], nil) | |
318 | 297 | if ($isInstanceOf(@, "(Int, Int)")) | |
319 | 298 | then @ | |
320 | - | else throw( | |
299 | + | else throw("Couldn't cast Any to (Int, Int)") | |
321 | 300 | } | |
322 | - | if (($ | |
301 | + | if (($t01542215640 == $t01542215640)) | |
323 | 302 | then { | |
324 | - | let getOneTknV2FeeAmount = $ | |
325 | - | let usdtAmount = $ | |
303 | + | let getOneTknV2FeeAmount = $t01542215640._2 | |
304 | + | let usdtAmount = $t01542215640._1 | |
326 | 305 | let currentUsdtPriceAssetRatio = fraction(putOneTknV2PriceAssetAmount, scale8, usdtAmount) | |
327 | 306 | let endPeriodBlocksLeft = (periodEnd - height) | |
328 | 307 | $Tuple10(periodMinAvailableToClaim, periodTotalAvailableToClaim, periodUserAvailableToClaim, totalUserAvailableToClaim, usdtPriceAssetAllowableRatio, currentUsdtPriceAssetRatio, endPeriodBlocksLeft, updatedCurrentPeriod, periodStart, periodEnd) | |
329 | 308 | } | |
330 | 309 | else throw("Strict value is not equal to itself.") | |
331 | 310 | } | |
332 | 311 | else throw("Strict value is not equal to itself.") | |
333 | 312 | } | |
334 | 313 | ||
335 | 314 | ||
336 | 315 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
337 | 316 | case s: String => | |
338 | 317 | fromBase58String(s) | |
339 | 318 | case _: Unit => | |
340 | 319 | unit | |
341 | 320 | case _ => | |
342 | 321 | throw("Match error") | |
343 | 322 | } | |
344 | 323 | ||
345 | 324 | ||
346 | 325 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
347 | 326 | case s: String => | |
348 | 327 | fromBase58String(s) | |
349 | 328 | case _: Unit => | |
350 | 329 | unit | |
351 | 330 | case _ => | |
352 | 331 | throw("Match error") | |
353 | 332 | } | |
354 | 333 | ||
355 | 334 | ||
356 | 335 | func mustManager (i) = { | |
357 | 336 | let pd = throw("Permission denied") | |
358 | 337 | match managerPublicKeyOrUnit() { | |
359 | 338 | case pk: ByteVector => | |
360 | 339 | if ((i.callerPublicKey == pk)) | |
361 | 340 | then true | |
362 | 341 | else pd | |
363 | 342 | case _: Unit => | |
364 | 343 | if ((i.caller == this)) | |
365 | 344 | then true | |
366 | 345 | else pd | |
367 | 346 | case _ => | |
368 | 347 | throw("Match error") | |
369 | 348 | } | |
370 | 349 | } | |
371 | 350 | ||
372 | 351 | ||
373 | 352 | @Callable(i) | |
374 | 353 | func constructor (idoStart,idoDuration,claimStart,claimDuration,price,priceAssetId58,minInvestAmount) = { | |
375 | 354 | let priceMult = ((100 * 1000) * 1000) | |
376 | 355 | let idoEnd = (idoStart + idoDuration) | |
377 | 356 | if (isDefined(getString(keyConfig()))) | |
378 | 357 | then throw("already initialized") | |
379 | 358 | else if (("3PMEHLx1j6zerarZTYfsGqDeeZqQoMpxq5S" != toString(i.caller))) | |
380 | 359 | then throw("not authorized") | |
381 | 360 | else if ((size(i.payments) != 1)) | |
382 | 361 | then throw("exactly 1 payment must be attached") | |
383 | 362 | else if ((idoEnd >= claimStart)) | |
384 | 363 | then throw("claimStart must be greater than idoEnd") | |
385 | 364 | else { | |
386 | 365 | let pmt = value(i.payments[0]) | |
387 | 366 | let idoAssetId = value(pmt.assetId) | |
388 | 367 | let idoAssetInfo = valueOrErrorMessage(assetInfo(idoAssetId), "fail to load ido asset info") | |
389 | 368 | let idoAssetId58 = toBase58String(idoAssetId) | |
390 | 369 | let idoAssetMult = pow(10, 0, idoAssetInfo.decimals, 0, 0, DOWN) | |
391 | 370 | let priceAssetId = fromBase58String(priceAssetId58) | |
392 | 371 | let priceAssetInfo = valueOrErrorMessage(assetInfo(priceAssetId), "fail to load price asset info") | |
393 | 372 | let priceAssetMult = pow(10, 0, priceAssetInfo.decimals, 0, 0, DOWN) | |
394 | 373 | let origTotalsArray = readTotalsArrayOrDefault() | |
395 | 374 | let totalsDiff = [0, 0, 0, 0] | |
396 | 375 | [StringEntry(keyConfig(), fromatConfig(idoStart, idoDuration, claimStart, claimDuration, price, priceMult, idoAssetId58, idoAssetMult, priceAssetId58, priceAssetMult, minInvestAmount, pmt.amount)), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart, 0)] | |
397 | 376 | } | |
398 | 377 | } | |
399 | 378 | ||
400 | 379 | ||
401 | 380 | ||
402 | 381 | @Callable(i) | |
403 | 382 | func invest () = { | |
404 | 383 | let cfgArray = readConfigArray() | |
405 | 384 | let idoStart = parseIntValue(cfgArray[IdxCfgIdoStart]) | |
406 | 385 | let idoDuration = parseIntValue(cfgArray[IdxCfgIdoDuration]) | |
407 | 386 | let idoEnd = (idoStart + idoDuration) | |
408 | 387 | let claimStart = parseIntValue(cfgArray[IdxCfgClaimStart]) | |
409 | 388 | let claimDuration = parseIntValue(cfgArray[IdxCfgClaimDuration]) | |
410 | 389 | let price = parseIntValue(cfgArray[IdxCfgPrice]) | |
411 | 390 | let priceMult = parseIntValue(cfgArray[IdxCfgPriceMult]) | |
412 | 391 | let idoAssetId58 = cfgArray[IdxCfgIdoAssetId] | |
413 | 392 | let idoAssetId = fromBase58String(idoAssetId58) | |
414 | 393 | let idoAssetMult = parseIntValue(cfgArray[IdxCfgIdoAssetMult]) | |
415 | 394 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
416 | 395 | let priceAssetId = fromBase58String(priceAssetId58) | |
417 | 396 | let priceAssetMult = parseIntValue(cfgArray[IdxCfgPriceAssetMult]) | |
418 | 397 | let minIvestAmount = parseIntValue(cfgArray[IdxCfgMinInvestAmount]) | |
419 | 398 | let userAddress = toString(i.caller) | |
420 | 399 | if ((idoStart > height)) | |
421 | 400 | then throw("ido has not been started yet") | |
422 | 401 | else if ((height > idoEnd)) | |
423 | 402 | then throw("ido has been already ended") | |
424 | 403 | else if ((size(i.payments) != 1)) | |
425 | 404 | then throw("exactly 1 payment is expected") | |
426 | 405 | else { | |
427 | 406 | let pmt = value(i.payments[0]) | |
428 | 407 | let pmtAssetId = value(pmt.assetId) | |
429 | 408 | let pmtAmount = pmt.amount | |
430 | 409 | if ((pmtAssetId != priceAssetId)) | |
431 | 410 | then throw((("invalid payment asset id: " + toBase58String(pmtAssetId)) + " is expected")) | |
432 | 411 | else { | |
433 | 412 | let origInvestorArray = readInvestorArrayOrDefault(userAddress) | |
434 | 413 | let origTotalsArray = readTotalsArrayOrDefault() | |
435 | 414 | let newPriceTotalAmount = (parseIntValue(origTotalsArray[IdxInvTotalAmount]) + pmtAmount) | |
436 | 415 | let requiredIdoAssetAmount = (newPriceTotalAmount * 100) | |
437 | 416 | if ((requiredIdoAssetAmount > assetBalance(this, idoAssetId))) | |
438 | 417 | then throw("IDO asset has been - sold consider to use smaller payment") | |
439 | 418 | else { | |
440 | 419 | let totalsDiff = [pmtAmount, pmtAmount, 0, 0] | |
441 | 420 | [TotalsEntry(keyInvestor(userAddress), origInvestorArray, totalsDiff, claimStart, 0), TotalsEntry(keyTotals(), origTotalsArray, totalsDiff, claimStart, 0), InvestOperationHistoryEntry(userAddress, pmtAmount, 0, i.transactionId)] | |
442 | 421 | } | |
443 | 422 | } | |
444 | 423 | } | |
445 | 424 | } | |
446 | 425 | ||
447 | 426 | ||
448 | 427 | ||
449 | 428 | @Callable(i) | |
450 | 429 | func claim (claimedAssetId58,userAddress58) = { | |
451 | 430 | let callerAddress58 = toString(i.caller) | |
452 | 431 | if ((userAddress58 != callerAddress58)) | |
453 | 432 | then throw("not authorized") | |
454 | 433 | else { | |
455 | 434 | let cfgArray = readConfigArray() | |
456 | 435 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
457 | 436 | let claimResultTuple = internalClaim(claimedAssetId58, i.caller, i.transactionId) | |
458 | 437 | let totalsDiff = claimResultTuple._1 | |
459 | 438 | let outAmount = claimResultTuple._2 | |
460 | 439 | let outAssetId = claimResultTuple._3 | |
461 | 440 | let origInvestArray = claimResultTuple._4 | |
462 | 441 | let newClaimPeriodHeight = claimResultTuple._5 | |
463 | 442 | let claimedPriceAmountFromDiff = totalsDiff[IdxDiffClaimedPriceAmountIncrement] | |
464 | 443 | let claimedIdoAssetAmountFromDiff = totalsDiff[IdxDiffClaimedIdoAssetAmountIncrement] | |
465 | 444 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
466 | 445 | let priceAssetDecimals = value(assetInfo(fromBase58String(priceAssetId58))).decimals | |
467 | 446 | let entries = if ((claimedAssetId58 == priceAssetId58)) | |
468 | 447 | then { | |
469 | - | let $ | |
470 | - | let periodMinAvailableToClaim = $ | |
471 | - | let periodTotalAvailableToClaim = $ | |
472 | - | let periodUserAvailableToClaim = $ | |
473 | - | let totalUserAvailableToClaim = $ | |
474 | - | let usdtPriceAssetAllowableRatio = $ | |
475 | - | let currentUsdtPriceAssetRatio = $ | |
476 | - | let endPeriodBlocksLeft = $ | |
477 | - | let updatedCurrentPeriod = $ | |
478 | - | let periodStart = $ | |
479 | - | let periodEnd = $ | |
448 | + | let $t02154921993 = internalClaimV2(priceAssetId58, userAddress58, outAmount, totalsDiff[IdxDiffClaimedPriceAmountIncrement]) | |
449 | + | let periodMinAvailableToClaim = $t02154921993._1 | |
450 | + | let periodTotalAvailableToClaim = $t02154921993._2 | |
451 | + | let periodUserAvailableToClaim = $t02154921993._3 | |
452 | + | let totalUserAvailableToClaim = $t02154921993._4 | |
453 | + | let usdtPriceAssetAllowableRatio = $t02154921993._5 | |
454 | + | let currentUsdtPriceAssetRatio = $t02154921993._6 | |
455 | + | let endPeriodBlocksLeft = $t02154921993._7 | |
456 | + | let updatedCurrentPeriod = $t02154921993._8 | |
457 | + | let periodStart = $t02154921993._9 | |
458 | + | let periodEnd = $t02154921993._10 | |
480 | 459 | let checks = [if ((periodUserAvailableToClaim > 0)) | |
481 | 460 | then true | |
482 | 461 | else throwErr("unavailable to claim because user period allowance reached"), if ((periodTotalAvailableToClaim > 0)) | |
483 | 462 | then true | |
484 | 463 | else throwErr("unavailable to claim because total period allowance reached"), if ((periodMinAvailableToClaim > 0)) | |
485 | 464 | then true | |
486 | 465 | else throwErr("nothing to claim"), if ((usdtPriceAssetAllowableRatio > currentUsdtPriceAssetRatio)) | |
487 | 466 | then true | |
488 | 467 | else throwErr("unavailable to claim because usdn price lower than usdtPriceAssetAllowableRatio")] | |
489 | 468 | if ((checks == checks)) | |
490 | 469 | then { | |
491 | 470 | let updatedPeriodTotalAvailableToClaim = (periodTotalAvailableToClaim - periodMinAvailableToClaim) | |
492 | 471 | let updatedPeriodUserAvailableToClaim = (periodUserAvailableToClaim - periodMinAvailableToClaim) | |
493 | - | let entries = if ((priceAssetBalance > periodMinAvailableToClaim)) | |
472 | + | let entries = if ((priceAssetBalance >= periodMinAvailableToClaim)) | |
494 | 473 | then [ScriptTransfer(i.caller, periodMinAvailableToClaim, outAssetId), IntegerEntry(keyPriceAssetBalance(userAddress58), (priceAssetBalance - periodMinAvailableToClaim))] | |
495 | 474 | else { | |
496 | - | let evaluateResult = split(asString(invoke(this, "claimREADONLY", [priceAssetId58, userAddress58], nil)), SEP) | |
497 | - | if ((evaluateResult == evaluateResult)) | |
498 | - | then { | |
499 | - | let availablePriceAmountToClaim = parseIntValue(evaluateResult[3]) | |
500 | - | let lastClaimEntries = if ((availablePriceAmountToClaim == periodMinAvailableToClaim)) | |
501 | - | then { | |
502 | - | let investorTotalAmount = parseIntValue(origInvestArray[IdxInvTotalAmount]) | |
503 | - | let investorRemainingAmount = parseIntValue(origInvestArray[IdxInvRemainingAmount]) | |
504 | - | let investorPriceAssetBalance = parseIntValue(origInvestArray[IdxInvClaimedPriceAssetAmount]) | |
505 | - | let investorIdoAssetBalance = parseIntValue(origInvestArray[IdxInvClaimedIdoAssetAmount]) | |
506 | - | let investorLastClaimedHeight = parseIntValue(origInvestArray[IdxInvLastClaimedHeight]) | |
507 | - | let newInvestArray = [toString(investorTotalAmount), "0", toString(investorPriceAssetBalance), toString(investorIdoAssetBalance), toString(investorLastClaimedHeight)] | |
508 | - | let totals = readTotalsArrayOrDefault() | |
509 | - | let totalsTotalAmount = parseIntValue(totals[IdxInvTotalAmount]) | |
510 | - | let totalsRemainingAmount = parseIntValue(totals[IdxInvRemainingAmount]) | |
511 | - | let totalsClaimedPriceAssetAmount = parseIntValue(totals[IdxInvRemainingAmount]) | |
512 | - | let totalsClaimedIdoAssetAmount = parseIntValue(totals[IdxInvClaimedPriceAssetAmount]) | |
513 | - | let totalsLastClaimedHeight = parseIntValue(totals[IdxInvLastClaimedHeight]) | |
514 | - | let newTotalsRemainingAmount = (totalsRemainingAmount - investorRemainingAmount) | |
515 | - | let newTotalArray = [toString(totalsTotalAmount), toString(newTotalsRemainingAmount), toString(totalsClaimedPriceAssetAmount), toString(totalsClaimedIdoAssetAmount), toString(totalsLastClaimedHeight)] | |
516 | - | let newTotalRemainingAmount = (valueOrElse(getInteger(keyTotalRemainingAmount()), 0) + investorRemainingAmount) | |
517 | - | [StringEntry(keyInvestorRemainingAmount(userAddress58), toString(investorRemainingAmount)), StringEntry(keyTotalRemainingAmount(), toString(newTotalRemainingAmount)), TotalsEntry(keyInvestor(userAddress58), newInvestArray, totalsDiff, newClaimPeriodHeight, 0), TotalsEntry(keyTotals(), newTotalArray, totalsDiff, newClaimPeriodHeight, 0)] | |
518 | - | } | |
519 | - | else [TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight, 0), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight, 0)] | |
520 | - | let updatedPriceAssetBalance = ((priceAssetBalance + outAmount) - periodMinAvailableToClaim) | |
521 | - | ([ScriptTransfer(i.caller, periodMinAvailableToClaim, outAssetId), IntegerEntry(keyPriceAssetBalance(userAddress58), updatedPriceAssetBalance)] ++ lastClaimEntries) | |
522 | - | } | |
523 | - | else throw("Strict value is not equal to itself.") | |
475 | + | let updatedPriceAssetBalance = ((priceAssetBalance + outAmount) - periodMinAvailableToClaim) | |
476 | + | [ScriptTransfer(i.caller, periodMinAvailableToClaim, outAssetId), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight, 0), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight, 0), IntegerEntry(keyPriceAssetBalance(userAddress58), updatedPriceAssetBalance)] | |
524 | 477 | } | |
525 | 478 | $Tuple2(([IntegerEntry(keyCurrentPeriod(), updatedCurrentPeriod), IntegerEntry(keyPeriodStartHeight(updatedCurrentPeriod), periodStart), IntegerEntry(keyPeriodEndHeight(updatedCurrentPeriod), periodEnd), IntegerEntry(keyPeriodTotalAvailableToClaim(priceAssetId58, updatedCurrentPeriod), updatedPeriodTotalAvailableToClaim), IntegerEntry(keyPeriodUserAvailableToClaim(priceAssetId58, updatedCurrentPeriod, userAddress58), updatedPeriodUserAvailableToClaim), ClaimOperationHistoryEntry(userAddress58, periodMinAvailableToClaim, claimedIdoAssetAmountFromDiff, i.transactionId)] ++ entries), unit) | |
526 | 479 | } | |
527 | 480 | else throw("Strict value is not equal to itself.") | |
528 | 481 | } | |
529 | 482 | else { | |
530 | 483 | let priceAssetBalanceIdoDecimals = fraction(priceAssetBalance, scale8, pow(10, 0, priceAssetDecimals, 0, 0, DOWN)) | |
531 | 484 | $Tuple2([ScriptTransfer(i.caller, (outAmount + priceAssetBalanceIdoDecimals), outAssetId), IntegerEntry(keyPriceAssetBalance(userAddress58), 0), TotalsEntry(keyInvestor(userAddress58), origInvestArray, totalsDiff, newClaimPeriodHeight, priceAssetBalance), TotalsEntry(keyTotals(), readTotalsArrayOrDefault(), totalsDiff, newClaimPeriodHeight, priceAssetBalance), ClaimOperationHistoryEntry(userAddress58, claimedPriceAmountFromDiff, (claimedIdoAssetAmountFromDiff + priceAssetBalanceIdoDecimals), i.transactionId)], unit) | |
532 | 485 | } | |
533 | 486 | entries | |
534 | 487 | } | |
535 | 488 | } | |
536 | 489 | ||
537 | 490 | ||
538 | 491 | ||
539 | 492 | @Callable(i) | |
540 | 493 | func claimREADONLY (claimedAssetId58,userAddress58) = { | |
541 | 494 | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
542 | 495 | let totalsDiff = claimResultTuple._1 | |
543 | 496 | let outAmount = claimResultTuple._2 | |
544 | 497 | let outAssetId = claimResultTuple._3 | |
545 | 498 | let origInvestArray = claimResultTuple._4 | |
546 | 499 | let newClaimPeriodHeight = claimResultTuple._5 | |
547 | 500 | let availableToClaimArray = claimResultTuple._6 | |
548 | 501 | let availablePriceAmountToClaim = availableToClaimArray[0] | |
549 | 502 | let availableIdoAmountToClaim = availableToClaimArray[1] | |
550 | 503 | $Tuple2(nil, makeString(["%s%d%d", userAddress58, toString(availablePriceAmountToClaim), toString(availableIdoAmountToClaim)], SEP)) | |
551 | 504 | } | |
552 | 505 | ||
553 | 506 | ||
554 | 507 | ||
555 | 508 | @Callable(i) | |
556 | 509 | func claimV2READONLY (claimedAssetId58,userAddress58) = { | |
557 | 510 | let claimResultTuple = internalClaim(claimedAssetId58, addressFromStringValue(userAddress58), fromBase58String("")) | |
558 | 511 | let totalsDiff = claimResultTuple._1 | |
559 | 512 | let outAmount = claimResultTuple._2 | |
560 | 513 | let outAssetId = claimResultTuple._3 | |
561 | 514 | let origInvestArray = claimResultTuple._4 | |
562 | 515 | let newClaimPeriodHeight = claimResultTuple._5 | |
563 | 516 | let availableToClaimArray = claimResultTuple._6 | |
564 | 517 | let availablePriceAmountToClaim = availableToClaimArray[0] | |
565 | 518 | let availableIdoAmountToClaim = availableToClaimArray[1] | |
566 | 519 | let cfgArray = readConfigArray() | |
567 | 520 | let priceAssetId58 = cfgArray[IdxCfgPriceAssetId] | |
568 | 521 | let priceAssetBalance = valueOrElse(getInteger(keyPriceAssetBalance(userAddress58)), 0) | |
569 | 522 | let priceAssetBalanceIdoDecimals = (priceAssetBalance * 100) | |
570 | 523 | let availableIdoAmountToClaimWithPriceAssetBalance = (availableIdoAmountToClaim + priceAssetBalanceIdoDecimals) | |
571 | - | let $ | |
572 | - | let periodMinAvailableToClaim = $ | |
573 | - | let periodTotalAvailableToClaim = $ | |
574 | - | let periodUserAvailableToClaim = $ | |
575 | - | let totalUserAvailableToClaim = $ | |
576 | - | let usdtPriceAssetAllowableRatio = $ | |
577 | - | let currentUsdtPriceAssetRatio = $ | |
578 | - | let endPeriodBlocksLeft = $ | |
579 | - | let updatedCurrentPeriod = $ | |
580 | - | let periodStart = $ | |
581 | - | let periodEnd = $ | |
524 | + | let $t02828628698 = internalClaimV2(priceAssetId58, userAddress58, outAmount, totalsDiff[IdxDiffClaimedPriceAmountIncrement]) | |
525 | + | let periodMinAvailableToClaim = $t02828628698._1 | |
526 | + | let periodTotalAvailableToClaim = $t02828628698._2 | |
527 | + | let periodUserAvailableToClaim = $t02828628698._3 | |
528 | + | let totalUserAvailableToClaim = $t02828628698._4 | |
529 | + | let usdtPriceAssetAllowableRatio = $t02828628698._5 | |
530 | + | let currentUsdtPriceAssetRatio = $t02828628698._6 | |
531 | + | let endPeriodBlocksLeft = $t02828628698._7 | |
532 | + | let updatedCurrentPeriod = $t02828628698._8 | |
533 | + | let periodStart = $t02828628698._9 | |
534 | + | let periodEnd = $t02828628698._10 | |
582 | 535 | let currentPeriodEndHeight = valueOrElse(getInteger(keyPeriodEndHeight(updatedCurrentPeriod)), 0) | |
583 | 536 | let userTotalPriceAssetClaimed = (parseIntValue(readInvestorArrayOrFail(userAddress58)[IdxInvClaimedPriceAssetAmount]) - priceAssetBalance) | |
584 | 537 | let resultString = if ((height > currentPeriodEndHeight)) | |
585 | 538 | then { | |
586 | 539 | let periodLenght = value(getInteger(keyPeriodLength())) | |
587 | 540 | let userPeriodAllowance = value(getInteger(keyUserPeriodAllowance(priceAssetId58))) | |
588 | 541 | let totalPeriodAllowance = value(getInteger(keyTotalPeriodAllowance(priceAssetId58))) | |
589 | 542 | makeString(["%d%d%d%d%d%d", toString(availableIdoAmountToClaimWithPriceAssetBalance), toString(userPeriodAllowance), toString(totalPeriodAllowance), toString(usdtPriceAssetAllowableRatio), toString(currentUsdtPriceAssetRatio), toString(periodLenght), toString(userTotalPriceAssetClaimed)], SEP) | |
590 | 543 | } | |
591 | 544 | else makeString(["%d%d%d%d%d%d", toString(availableIdoAmountToClaimWithPriceAssetBalance), toString(periodMinAvailableToClaim), toString(periodTotalAvailableToClaim), toString(usdtPriceAssetAllowableRatio), toString(currentUsdtPriceAssetRatio), toString(endPeriodBlocksLeft), toString(userTotalPriceAssetClaimed)], SEP) | |
592 | 545 | $Tuple2(nil, resultString) | |
593 | 546 | } | |
594 | 547 | ||
595 | 548 | ||
596 | 549 | ||
597 | 550 | @Callable(i) | |
598 | 551 | func setManager (pendingManagerPublicKey) = { | |
599 | 552 | let checkCaller = mustManager(i) | |
600 | 553 | if ((checkCaller == checkCaller)) | |
601 | 554 | then { | |
602 | 555 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
603 | 556 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
604 | 557 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
605 | 558 | else throw("Strict value is not equal to itself.") | |
606 | 559 | } | |
607 | 560 | else throw("Strict value is not equal to itself.") | |
608 | 561 | } | |
609 | 562 | ||
610 | 563 | ||
611 | 564 | ||
612 | 565 | @Callable(i) | |
613 | 566 | func confirmManager () = { | |
614 | 567 | let pm = pendingManagerPublicKeyOrUnit() | |
615 | 568 | let hasPM = if (isDefined(pm)) | |
616 | 569 | then true | |
617 | 570 | else throw("No pending manager") | |
618 | 571 | if ((hasPM == hasPM)) | |
619 | 572 | then { | |
620 | 573 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
621 | 574 | then true | |
622 | 575 | else throw("You are not pending manager") | |
623 | 576 | if ((checkPM == checkPM)) | |
624 | 577 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
625 | 578 | else throw("Strict value is not equal to itself.") | |
626 | 579 | } | |
627 | 580 | else throw("Strict value is not equal to itself.") | |
628 | 581 | } | |
629 | 582 | ||
630 | 583 | ||
631 | 584 | @Verifier(tx) | |
632 | 585 | func verify () = { | |
633 | 586 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
634 | 587 | case pk: ByteVector => | |
635 | 588 | pk | |
636 | 589 | case _: Unit => | |
637 | 590 | tx.senderPublicKey | |
638 | 591 | case _ => | |
639 | 592 | throw("Match error") | |
640 | 593 | } | |
641 | 594 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
642 | 595 | } | |
643 | 596 |
github/deemru/w8io/026f985 81.22 ms ◑