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