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