tx · 2YTUDVy5c9WEf2XUhRfABTXnpMgw11i9VWM6xBZivQZx

3N9be2mwrA52WJho6DiesZkk4351GvpnWuj:  -0.04000000 Waves

2022.08.23 14:58 [2197101] smart account 3N9be2mwrA52WJho6DiesZkk4351GvpnWuj > SELF 0.00000000 Waves

{ "type": 13, "id": "2YTUDVy5c9WEf2XUhRfABTXnpMgw11i9VWM6xBZivQZx", "fee": 4000000, "feeAssetId": null, "timestamp": 1661256044342, "version": 1, "sender": "3N9be2mwrA52WJho6DiesZkk4351GvpnWuj", "senderPublicKey": "6mzmbCza9iqbzxMEELcEA4Xc9NeF4CYpbTtz1zMK3C7x", "proofs": [ "2V2z8cievbPeEHWzv92KTEALj7fcvp1TeKXPzWppy3yK8iBu4ZGff3q2qVnYyRkkmjKaL3yPvcWnMVJ9i76ktWUD", "iobcyHP3he3RdFjBhwoTPuQmgRQipKf5oxbCSrenaK3TbfFaNPNiQdkPPD9FnwHLYgByLhVBaB9x5V97vQom1tZ", "52BArtFQWrNzoUGL4URq3juMryFi6VQqKtB32aM4ucRFZN4AV9Z2PCM4qBUSWwydMNqrn873VRELPNdY8umbRudm" ], "script": "base64:BgJOCAISDgoMCAgICAgIAQEBAQEBEgUKAwgIARIAEgASBQoDCAEIEgMKAQESBAoCAQgSABIECgIIARIECgIBARIECgIIARIFCgMIAQESABIApQEBD2dldFN0cmluZ09yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQUHYWRkcmVzcwkAzAgCAgEuCQDMCAIFA2tleQkAzAgCAg8gaXMgbm90IGRlZmluZWQFA25pbAIAAQVsY2FsYwEBbAkAuQgBBQFsAQ5nZXROdW1iZXJCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMFA2tleQAAAQ5nZXRTdHJpbmdCeUtleQEDa2V5CQELdmFs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WJLZXlBZG1pbnNMaXN0AAMAAgAABAckbWF0Y2gwBQJ0eAMJAAECBQckbWF0Y2gwAhVTcG9uc29yRmVlVHJhbnNhY3Rpb24ECXNwb25zb3JUeAUHJG1hdGNoMAMJARtjaGVja0lzVmFsaWRNaW5TcG9uc29yZWRGZWUBBQlzcG9uc29yVHgJAGcCBQVjb3VudAADBwkAZwIFBWNvdW50AAMlKItO", "chainId": 84, "height": 2197101, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: T8qZPUstRzW3yfUS6qjcejZC78eSAJQxHoXTsHiFLY4 Next: 2YG32vXKqsqm5bGr318anrWctr9Uz2BQZiLuui7yxava Diff:
OldNewDifferences
4949 }
5050
5151
52+func asBytes (val) = match val {
53+ case valByte: ByteVector =>
54+ valByte
55+ case _ =>
56+ throw("fail to cast into ByteVector")
57+}
58+
59+
5260 func asPayment (v) = match v {
5361 case p: AttachedPayment =>
5462 p
5866
5967
6068 func asSwapParamsSTRUCT (v) = match v {
61- case struct: (Int, Int, Int, Int, Int) =>
69+ case struct: (Int, Int, Int, Int, Int, Int, Int) =>
6270 struct
6371 case _ =>
64- throw("fail to cast into Int")
72+ throw("fail to cast into Tuple5 ints")
6573 }
6674
6775
7482 let PRICELET = 1000000
7583
7684 let DEFAULTSWAPFEE = 20000
85+
86+let BRPROTECTED = 100000
7787
7888 let IdxNetAmount = 0
7989
222232 func swapsTimeframeKEY () = "swaps_timeframe"
223233
224234
235+func brProtectedKEY () = "min_BR_protection_level"
236+
237+
225238 func minSwapAmountREAD (swapType) = valueOrElse(getInteger(this, minSwapAmountKEY(swapType)), 0)
226239
227240
357370 }
358371
359372
360-func applyFees (amountGross,feePart) = {
361- let feeAmount = fraction(amountGross, feePart, PAULI)
362-[(amountGross - feeAmount), feeAmount, amountGross]
373+func applyFees (amountOutGross,inAmtToSURF,feePart) = {
374+ let feeAmount = fraction(amountOutGross, feePart, PAULI)
375+[(amountOutGross - feeAmount), feeAmount]
363376 }
364377
365378
423436
424437
425438 func commonSwap (swapType,pmtAmount,userAddressStr,txId58,swapParamsByUserSYSREADONLY) = {
426- let $t01722417304 = swapParamsByUserSYSREADONLY
427- let swapLimitMax = $t01722417304._1
428- let swapLimitSpent = $t01722417304._2
429- let blcks2LmtReset = $t01722417304._3
439+ let swapLimitSpent = swapParamsByUserSYSREADONLY._2
440+ let blcks2LmtReset = swapParamsByUserSYSREADONLY._3
441+ let wavesSwapLimitMax = swapParamsByUserSYSREADONLY._6
442+ let usdnSwapLimitMax = swapParamsByUserSYSREADONLY._7
430443 let minSwapAmount = minSwapAmountREAD(swapType)
431444 let totalLocked = totalLockedREAD(swapType)
432445 let totalLockedByUser = totalLockedByUserREAD(swapType, userAddressStr)
440453 let swapUsdnVolume = if ((swapType == "neutrino"))
441454 then pmtAmount
442455 else convertWavesToNeutrino(pmtAmount, priceByIndex)
456+ let swapLimitMax = if ((swapType == "neutrino"))
457+ then usdnSwapLimitMax
458+ else convertWavesToNeutrino(wavesSwapLimitMax, priceByIndex)
443459 if ((minSwapAmount > pmtAmount))
444460 then minSwapAmountFAIL(swapType, minSwapAmount)
445461 else if (if (!(isSwapByNode))
461477 }
462478
463479
480+let nMetricIdxPrice = 0
481+
482+let nMetricIdxUsdnLockedBalance = 1
483+
484+let nMetricIdxWavesLockedBalance = 2
485+
486+let nMetricIdxReserve = 3
487+
488+let nMetricIdxReserveInUsdn = 4
489+
490+let nMetricIdxUsdnSupply = 5
491+
492+let nMetricIdxSurplus = 6
493+
494+let nMetricIdxSurplusPercent = 7
495+
496+let nMetricIdxBR = 8
497+
498+let nMetricIdxNsbtSupply = 9
499+
500+let nMetricIdxMaxNsbtSupply = 10
501+
502+let nMetricIdxSurfSupply = 11
503+
504+let bFuncIdxSurf = 0
505+
506+let bFuncIdxWaves = 1
507+
508+let bFuncIdxUsdn = 2
509+
510+let bFuncIdxReserveStart = 3
511+
512+let bFuncIdxSupplyStart = 4
513+
514+let bFuncIdxBRStart = 5
515+
516+let bFuncIdxReserveEnd = 6
517+
518+let bFuncIdxSupplyEnd = 7
519+
520+let bFuncIdxBREnd = 8
521+
522+let bFuncIdxRest = 9
523+
524+let bFuncIdxWavesPrice = 10
525+
526+func calcWithdrawW2U (wavesIn,price) = {
527+ let outAmtGross = convertWavesToNeutrino(wavesIn, price)
528+ $Tuple9(outAmtGross, neutrinoAssetId, 0, unit, 0, wavesIn, 0, 0, 0)
529+ }
530+
531+
532+func calcWithdrawU2W (usdnIn,price,br,reservesInUsdn,usdnSupply) = {
533+ let brProtected = valueOrElse(getInteger(this, brProtectedKEY()), BRPROTECTED)
534+ let maxAllowedUsdnBeforeMinBr = if ((brProtected >= br))
535+ then 0
536+ else fraction((reservesInUsdn - fraction(brProtected, usdnSupply, PAULI)), PAULI, (PAULI - brProtected))
537+ let allowedUsdnBeforeMinBr = if ((usdnIn > maxAllowedUsdnBeforeMinBr))
538+ then maxAllowedUsdnBeforeMinBr
539+ else usdnIn
540+ let allowedUsdnAfterMinBr = if ((usdnIn > maxAllowedUsdnBeforeMinBr))
541+ then fraction((usdnIn - maxAllowedUsdnBeforeMinBr), br, PAULI)
542+ else 0
543+ let allowedUsdn = (allowedUsdnBeforeMinBr + allowedUsdnAfterMinBr)
544+ let usdn2SURF = (usdnIn - allowedUsdn)
545+ let outAmtGross = convertNeutrinoToWaves(allowedUsdn, price)
546+ $Tuple9(outAmtGross, unit, usdn2SURF, neutrinoAssetId, outAmtGross, allowedUsdn, maxAllowedUsdnBeforeMinBr, allowedUsdnBeforeMinBr, allowedUsdnAfterMinBr)
547+ }
548+
549+
550+func calcWithdraw (swapType,inAmount,price) = {
551+ let outFeePart = valueOrElse(getInteger(this, outFeePartKEY(swapType)), DEFAULTSWAPFEE)
552+ if (if ((0 > outFeePart))
553+ then true
554+ else (outFeePart >= PAULI))
555+ then throw(((("invalid outFeePart config for " + swapType) + " swap: outFeePart=") + toString(outFeePart)))
556+ else {
557+ let brProtected = valueOrElse(getInteger(this, brProtectedKEY()), BRPROTECTED)
558+ let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil))
559+ let BR = asInt(neutrinoMetrics[nMetricIdxBR])
560+ let reservesInUsdn = asInt(neutrinoMetrics[nMetricIdxReserveInUsdn])
561+ let usdnSupply = asInt(neutrinoMetrics[nMetricIdxUsdnSupply])
562+ let outDataTuple = if ((swapType == "waves"))
563+ then calcWithdrawW2U(inAmount, price)
564+ else if ((swapType == "neutrino"))
565+ then calcWithdrawU2W(inAmount, price, BR, reservesInUsdn, usdnSupply)
566+ else throw(("Unsupported swap type " + swapType))
567+ let outAmtGross = outDataTuple._1
568+ let outAssetId = outDataTuple._2
569+ let inAmtToSurfPart = outDataTuple._3
570+ let inAssetId = outDataTuple._4
571+ let unleaseAmt = outDataTuple._5
572+ let payoutsArray = applyFees(outAmtGross, inAmtToSurfPart, outFeePart)
573+ let outNetAmt = payoutsArray[IdxNetAmount]
574+ let outFeeAmt = payoutsArray[IdxFeeAmount]
575+ let outSurfAmt = if ((0 >= inAmtToSurfPart))
576+ then 0
577+ else {
578+ let surfResult = asAnyList(invoke(mathContract, "surfFunctionREADONLY", [inAmtToSurfPart, inAssetId], nil))
579+ asInt(surfResult[bFuncIdxSurf])
580+ }
581+ $Tuple7(outNetAmt, outAssetId, outSurfAmt, inAmtToSurfPart, unleaseAmt, outFeeAmt, outAmtGross)
582+ }
583+ }
584+
585+
464586 func commonWithdraw (account,index,swapTxId,withdrawTxId) = {
465587 let userAddress = addressFromStringValue(account)
466588 let dataArray = swapDataFailOrREAD(account, swapTxId)
476598 let indexHeight = getHeightPriceByIndex(index)
477599 let prevIndexHeight = getHeightPriceByIndex((index - 1))
478600 let priceByIndex = getPriceHistory(indexHeight)
479- let outAmountGrossTuple = if ((swapType == "waves"))
480- then $Tuple2(convertWavesToNeutrino(inAmount, priceByIndex), neutrinoAssetId)
481- else if ((swapType == "neutrino"))
482- then $Tuple2(convertNeutrinoToWaves(inAmount, priceByIndex), unit)
483- else throw(("Unsupported swap type " + swapType))
484- let payoutsArray = applyFees(outAmountGrossTuple._1, outFeePart)
485- let outNetAmount = payoutsArray[IdxNetAmount]
486- let outFeeAmount = payoutsArray[IdxFeeAmount]
487601 if (isBlocked)
488602 then emergencyShutdownFAIL()
489603 else if ((swapStatus != "PENDING"))
498612 then (prevIndexHeight >= unlockHeight)
499613 else false)
500614 then priceIndexFAIL(index, priceIndex, indexHeight, unlockHeight, prevIndexHeight)
501- else if ((0 >= payoutsArray[IdxGrossAmount]))
502- then throw("balance equals zero")
503- else if (if ((0 > outFeePart))
504- then true
505- else (outFeePart >= PAULI))
506- then throw(((("invalid outFeePart config for " + swapType) + " swap: outFeePart=") + toString(outFeePart)))
615+ else {
616+ let withdrawTuple = calcWithdraw(swapType, inAmount, priceByIndex)
617+ let outNetAmount = withdrawTuple._1
618+ let outAssetId = withdrawTuple._2
619+ let outSurfAmt = withdrawTuple._3
620+ let inAmtToSurfPart = withdrawTuple._4
621+ let unleaseAmt = withdrawTuple._5
622+ let outFeeAmount = withdrawTuple._6
623+ let outAmtGross = withdrawTuple._7
624+ if ((0 >= outAmtGross))
625+ then throw("balance equals zero")
507626 else {
508- let unleaseAmount = if (if ((swapType == "neutrino"))
509- then (outAmountGrossTuple._1 > 0)
510- else false)
511- then outAmountGrossTuple._1
627+ let state = [IntegerEntry(totalLockedByUserKEY(swapType, account), (totalLockedByUser - inAmount)), IntegerEntry(totalLockedKEY(swapType), (totalLocked - inAmount)), ScriptTransfer(userAddress, outNetAmount, outAssetId), StringEntry(swapKEY(account, swapTxId), finishSwapDATA(dataArray, priceByIndex, outNetAmount, outFeeAmount, unlockHeight, index, withdrawTxId))]
628+ let surfCondition = if ((outSurfAmt > 0))
629+ then {
630+ let issueResult = invoke(auctionContract, "issueSurf", [outSurfAmt, account], nil)
631+ if ((issueResult == issueResult))
632+ then 0
633+ else throw("Strict value is not equal to itself.")
634+ }
512635 else 0
513- let state = [IntegerEntry(totalLockedByUserKEY(swapType, account), (totalLockedByUser - inAmount)), IntegerEntry(totalLockedKEY(swapType), (totalLocked - inAmount)), ScriptTransfer(userAddress, outNetAmount, outAmountGrossTuple._2), StringEntry(swapKEY(account, swapTxId), finishSwapDATA(dataArray, priceByIndex, outNetAmount, outFeeAmount, unlockHeight, index, withdrawTxId))]
514- $Tuple3(state, AttachedPayment(outAmountGrossTuple._2, outFeeAmount), unleaseAmount)
636+ if ((surfCondition == surfCondition))
637+ then $Tuple3(state, AttachedPayment(outAssetId, outFeeAmount), unleaseAmt)
638+ else throw("Strict value is not equal to itself.")
515639 }
640+ }
516641 }
517642
518643
665790 if ((i.callerPublicKey != mngPub))
666791 then throw("approveLeasings not authorized")
667792 else {
668- let $t02838428446 = readNodeInfo(0)
669- let nAddr0 = $t02838428446._1
670- let lAmtKEY0 = $t02838428446._2
671- let lAmt0 = $t02838428446._3
672- let lIdKEY0 = $t02838428446._4
673- let lId0 = $t02838428446._5
674- let $t02844928511 = readNodeInfo(1)
675- let nAddr1 = $t02844928511._1
676- let lAmtKEY1 = $t02844928511._2
677- let lAmt1 = $t02844928511._3
678- let lIdKEY1 = $t02844928511._4
679- let lId1 = $t02844928511._5
793+ let $t03363933701 = readNodeInfo(0)
794+ let nAddr0 = $t03363933701._1
795+ let lAmtKEY0 = $t03363933701._2
796+ let lAmt0 = $t03363933701._3
797+ let lIdKEY0 = $t03363933701._4
798+ let lId0 = $t03363933701._5
799+ let $t03370433766 = readNodeInfo(1)
800+ let nAddr1 = $t03370433766._1
801+ let lAmtKEY1 = $t03370433766._2
802+ let lAmt1 = $t03370433766._3
803+ let lIdKEY1 = $t03370433766._4
804+ let lId1 = $t03370433766._5
680805 let newL0 = Lease(nAddr0, (lAmt0 - ((lAmt * expCount) / 2)))
681806 let newL1 = Lease(nAddr1, (lAmt1 - ((lAmt * expCount) / 2)))
682807 let validation = invoke(nodeRegAddr, "validateAndApproveLeasings", [nListS], nil)
711836
712837
713838 @Callable(i)
839+func rebalanceLeasings (amount,groupNum) = {
840+ let nIdxs = [0, 1, 2, 3, 4, 5, 6, 7]
841+ let mngPubS = valueOrElse(getString("%s%s__cfg__leasingManagerPub"), "7AUMX54ukYMYvPmma7yoFf5NjZhs4Bu5nz3Ez9EV8sur")
842+ let mngPub = fromBase58String(mngPubS)
843+ let lGroupNodeListKEY = getLeaseGroupNodeListKey(groupNum)
844+ let nListS = getStringOrFail(this, lGroupNodeListKEY)
845+ let nList = split(nListS, SEP)
846+ if ((i.callerPublicKey != mngPub))
847+ then throw("rebalanceLeasings not authorized")
848+ else {
849+ let unleaseAmt = ((amount / size(nList)) + 1)
850+ let $t03518335245 = readNodeInfo(0)
851+ let nAddr0 = $t03518335245._1
852+ let lAmtKEY0 = $t03518335245._2
853+ let lAmt0 = $t03518335245._3
854+ let lIdKEY0 = $t03518335245._4
855+ let lId0 = $t03518335245._5
856+ let newL0 = Lease(nAddr0, (lAmt0 + (unleaseAmt * size(nList))))
857+ func forEachNodeDoUnlease (a,i) = {
858+ let node = nList[i]
859+ let lIdKEY = getLeaseIdByAddressKey(node)
860+ let lId = getBinaryValue(this, lIdKEY)
861+ let lAmtKEY = getLeaseAmountByAddressKey(node)
862+ let lAmt = getIntegerValue(this, lAmtKEY)
863+ let ula = LeaseCancel(value(lId))
864+ let la = Lease(addressFromStringValue(node), (lAmt - unleaseAmt))
865+ (a ++ [LeaseCancel(value(lId)), la, BinaryEntry(lIdKEY, lcalc(la)), IntegerEntry(lAmtKEY, la.amount)])
866+ }
867+
868+ ({
869+ let $l = nIdxs
870+ let $s = size($l)
871+ let $acc0 = nil
872+ func $f0_1 ($a,$i) = if (($i >= $s))
873+ then $a
874+ else forEachNodeDoUnlease($a, $l[$i])
875+
876+ func $f0_2 ($a,$i) = if (($i >= $s))
877+ then $a
878+ else throw("List size exceeds 8")
879+
880+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8)
881+ } ++ [BinaryEntry(lIdKEY0, lcalc(newL0)), IntegerEntry(lAmtKEY0, newL0.amount), LeaseCancel(lId0), newL0])
882+ }
883+ }
884+
885+
886+
887+@Callable(i)
714888 func swapParamsByUserSYSREADONLY (userAddressStr,gnsbtDiff) = {
715889 let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStr, 0, 0], nil))
716890 let gnsbtAmt = (asInt(gnsbtData[0]) + gnsbtDiff)
717891 let gnsbtAmtTotal = (asInt(gnsbtData[1]) + gnsbtDiff)
718- let swapLimitMax = asInt(invoke(mathContract, "calcSwapLimitREADONLY", [gnsbtAmt], nil))
892+ let swapLimitData = asAnyList(invoke(mathContract, "calcSwapLimitREADONLY", [gnsbtAmt], nil))
893+ let wavesSwapLimitInUsdnMax = asInt(swapLimitData[0])
894+ let wavesSwapLimitMax = asInt(swapLimitData[1])
895+ let usdnSwapLimitMax = asInt(swapLimitData[2])
719896 let lastSwapHeight = valueOrElse(getInteger(this, keyUserLastSwapHeight(userAddressStr)), 0)
720897 let swapLimitTimelifeBlocks = swapsTimeframeREAD()
721898 let passedBlocksAfterLastSwap = (height - lastSwapHeight)
722899 let isSwapTimelifeNew = (passedBlocksAfterLastSwap >= swapLimitTimelifeBlocks)
723- let swapLimitSpent = if (isSwapTimelifeNew)
900+ let swapLimitSpentInUsdn = if (isSwapTimelifeNew)
724901 then 0
725902 else valueOrElse(getInteger(this, keySwapUserSpentInPeriod(userAddressStr)), 0)
726903 let blcks2LmtReset = if (isSwapTimelifeNew)
727904 then 0
728905 else (swapLimitTimelifeBlocks - passedBlocksAfterLastSwap)
729- $Tuple2(nil, $Tuple5(swapLimitMax, swapLimitSpent, blcks2LmtReset, gnsbtAmt, gnsbtAmtTotal))
906+ $Tuple2(nil, $Tuple7(wavesSwapLimitInUsdnMax, swapLimitSpentInUsdn, blcks2LmtReset, gnsbtAmt, gnsbtAmtTotal, wavesSwapLimitMax, usdnSwapLimitMax))
730907 }
908+
909+
910+
911+@Callable(i)
912+func calcWithdrawResultSYSREADONLY (swapType,inAmount,price) = $Tuple2(nil, calcWithdraw(swapType, inAmount, price))
731913
732914
733915
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
55
66
77 func lcalc (l) = calculateLeaseId(l)
88
99
1010 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
1111
1212
1313 func getStringByKey (key) = valueOrElse(getString(this, key), "")
1414
1515
1616 func getBoolByKey (key) = valueOrElse(getBoolean(this, key), false)
1717
1818
1919 func getNumberByAddressAndKey (address,key) = valueOrElse(getInteger(address, key), 0)
2020
2121
2222 func getStringByAddressAndKey (address,key) = valueOrElse(getString(addressFromStringValue(address), key), "")
2323
2424
2525 func getBoolByAddressAndKey (address,key) = valueOrElse(getBoolean(address, key), false)
2626
2727
2828 func asAnyList (v) = match v {
2929 case l: List[Any] =>
3030 l
3131 case _ =>
3232 throw("fail to cast into List[Any]")
3333 }
3434
3535
3636 func asString (v) = match v {
3737 case s: String =>
3838 s
3939 case _ =>
4040 throw("fail to cast into String")
4141 }
4242
4343
4444 func asInt (v) = match v {
4545 case i: Int =>
4646 i
4747 case _ =>
4848 throw("fail to cast into Int")
4949 }
5050
5151
52+func asBytes (val) = match val {
53+ case valByte: ByteVector =>
54+ valByte
55+ case _ =>
56+ throw("fail to cast into ByteVector")
57+}
58+
59+
5260 func asPayment (v) = match v {
5361 case p: AttachedPayment =>
5462 p
5563 case _ =>
5664 throw("fail to cast into AttachedPayment")
5765 }
5866
5967
6068 func asSwapParamsSTRUCT (v) = match v {
61- case struct: (Int, Int, Int, Int, Int) =>
69+ case struct: (Int, Int, Int, Int, Int, Int, Int) =>
6270 struct
6371 case _ =>
64- throw("fail to cast into Int")
72+ throw("fail to cast into Tuple5 ints")
6573 }
6674
6775
6876 let SEP = "__"
6977
7078 let WAVELET = 100000000
7179
7280 let PAULI = 1000000
7381
7482 let PRICELET = 1000000
7583
7684 let DEFAULTSWAPFEE = 20000
85+
86+let BRPROTECTED = 100000
7787
7888 let IdxNetAmount = 0
7989
8090 let IdxFeeAmount = 1
8191
8292 let IdxGrossAmount = 2
8393
8494 let IdxControlCfgNeutrinoDapp = 1
8595
8696 let IdxControlCfgAuctionDapp = 2
8797
8898 let IdxControlCfgRpdDapp = 3
8999
90100 let IdxControlCfgMathDapp = 4
91101
92102 let IdxControlCfgLiquidationDapp = 5
93103
94104 let IdxControlCfgRestDapp = 6
95105
96106 let IdxControlCfgNodeRegistryDapp = 7
97107
98108 let IdxControlCfgNsbtStakingDapp = 8
99109
100110 let IdxControlCfgMediatorDapp = 9
101111
102112 let IdxControlCfgSurfStakingDapp = 10
103113
104114 let IdxControlCfgGnsbtControllerDapp = 11
105115
106116 func keyControlAddress () = "%s%s__config__controlAddress"
107117
108118
109119 func keyControlCfg () = "%s__controlConfig"
110120
111121
112122 func readControlCfgOrFail (control) = split(getStringOrFail(control, keyControlCfg()), SEP)
113123
114124
115125 func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx)))
116126
117127
118128 let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx"))
119129
120130 let controlCfg = readControlCfgOrFail(controlContract)
121131
122132 let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp)
123133
124134 let nsbtStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgNsbtStakingDapp)
125135
126136 let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp)
127137
128138 let gnsbtControllerContract = getContractAddressOrFail(controlCfg, IdxControlCfgGnsbtControllerDapp)
129139
130140 let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp)
131141
132142 let NeutrinoAssetIdKey = "neutrino_asset_id"
133143
134144 let BondAssetIdKey = "bond_asset_id"
135145
136146 let AuctionContractKey = "auction_contract"
137147
138148 let NsbtStakingContractKey = "nsbtStakingContract"
139149
140150 let LiquidationContractKey = "liquidation_contract"
141151
142152 let RPDContractKey = "rpd_contract"
143153
144154 let ContolContractKey = "control_contract"
145155
146156 let MathContractKey = "math_contract"
147157
148158 let BalanceWavesLockIntervalKey = "balance_waves_lock_interval"
149159
150160 let BalanceNeutrinoLockIntervalKey = "balance_neutrino_lock_interval"
151161
152162 let MinWavesSwapAmountKey = "min_waves_swap_amount"
153163
154164 let MinNeutrinoSwapAmountKey = "min_neutrino_swap_amount"
155165
156166 let NodeOracleProviderPubKeyKey = "node_oracle_provider"
157167
158168 let NeutrinoOutFeePartKey = "neutrinoOut_swap_feePart"
159169
160170 let WavesOutFeePartKey = "wavesOut_swap_feePart"
161171
162172 func keyNodeRegistry (address) = ("%s__" + address)
163173
164174
165175 let PriceKey = "price"
166176
167177 let PriceIndexKey = "price_index"
168178
169179 let IsBlockedKey = "is_blocked"
170180
171181 func getPriceHistoryKey (block) = ((PriceKey + "_") + toString(block))
172182
173183
174184 func getHeightPriceByIndexKey (index) = ((PriceIndexKey + "_") + toString(index))
175185
176186
177187 func getStakingNodeByIndex (idx) = getStringByKey(makeString(["%s%d%s", "lease", toString(idx), "nodeAddress"], SEP))
178188
179189
180190 func getStakingNodeAddressByIndex (idx) = addressFromStringValue(getStakingNodeByIndex(idx))
181191
182192
183193 func getReservedAmountForSponsorship () = valueOrElse(getInteger(this, makeString(["%s%s", "lease", "sponsorshipWavesReserve"], SEP)), (1000 * WAVELET))
184194
185195
186196 func getBalanceUnlockBlockKey (owner) = ("balance_unlock_block_" + owner)
187197
188198
189199 func getLeaseIdKey (nodeIndex) = makeString(["%s%d%s", "lease", toString(nodeIndex), "id"], SEP)
190200
191201
192202 func getLeaseIdByAddressKey (nodeAddress) = makeString(["%s%s%s", "leaseByAddress", nodeAddress, "id"], SEP)
193203
194204
195205 func getLeaseAmountKey (nodeIndex) = makeString(["%s%d%s", "lease", toString(nodeIndex), "amount"], SEP)
196206
197207
198208 func getLeaseAmountByAddressKey (nodeAddress) = makeString(["%s%s%s", "leaseByAddress", nodeAddress, "amount"], SEP)
199209
200210
201211 func getLeaseGroupNodeListKey (groupNum) = makeString(["%s%d%s", "leaseGroup", toString(groupNum), "nodeList"], SEP)
202212
203213
204214 func minSwapAmountKEY (swapType) = (("min_" + swapType) + "_swap_amount")
205215
206216
207217 func totalLockedKEY (swapType) = ("balance_lock_" + swapType)
208218
209219
210220 func totalLockedByUserKEY (swapType,owner) = makeString(["balance_lock", swapType, owner], "_")
211221
212222
213223 func balanceLockIntervalKEY (swapType) = (("balance_" + swapType) + "_lock_interval")
214224
215225
216226 func nodeBalanceLockIntervalKEY () = "balance_node_lock_interval"
217227
218228
219229 func outFeePartKEY (swapType) = (swapType + "Out_swap_feePart")
220230
221231
222232 func swapsTimeframeKEY () = "swaps_timeframe"
223233
224234
235+func brProtectedKEY () = "min_BR_protection_level"
236+
237+
225238 func minSwapAmountREAD (swapType) = valueOrElse(getInteger(this, minSwapAmountKEY(swapType)), 0)
226239
227240
228241 func swapsTimeframeREAD () = valueOrElse(getInteger(this, swapsTimeframeKEY()), 1440)
229242
230243
231244 func totalLockedREAD (swapType) = valueOrElse(getInteger(this, totalLockedKEY(swapType)), 0)
232245
233246
234247 func totalLockedByUserREAD (swapType,owner) = valueOrElse(getInteger(this, totalLockedByUserKEY(swapType, owner)), 0)
235248
236249
237250 func balanceLockIntervalREAD (swapType) = valueOrElse(getInteger(this, balanceLockIntervalKEY(swapType)), 1440)
238251
239252
240253 func nodeBalanceLockIntervalREAD () = valueOrElse(getInteger(this, nodeBalanceLockIntervalKEY()), 1)
241254
242255
243256 func keySwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "swapUserSpentInPeriod", userAddress], SEP)
244257
245258
246259 func keyUserLastSwapHeight (userAddress) = makeString(["%s%s", "userLastSwapHeight", userAddress], SEP)
247260
248261
249262 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI)
250263
251264
252265 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET)
253266
254267
255268 func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price)
256269
257270
258271 func convertJsonArrayToList (jsonArray) = split(jsonArray, ",")
259272
260273
261274 func minSwapAmountFAIL (swapType,minSwapAmount) = throw(((("The specified amount in " + swapType) + " swap is less than the required minimum of ") + toString(minSwapAmount)))
262275
263276
264277 func emergencyShutdownFAIL () = throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles")
265278
266279
267280 func priceIndexFAIL (index,priceIndex,indexHeight,unlockHeight,prevIndexHeight) = throw(((((((((("invalid price history index: index=" + toString(index)) + " priceIndex=") + toString(priceIndex)) + " indexHeight=") + toString(indexHeight)) + " unlockHeight=") + toString(unlockHeight)) + " prevIndexHeight=") + toString(prevIndexHeight)))
268281
269282
270283 let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey))
271284
272285 let priceIndex = getNumberByAddressAndKey(controlContract, PriceIndexKey)
273286
274287 let isBlocked = getBoolByAddressAndKey(controlContract, IsBlockedKey)
275288
276289 let nodeOracleProviderPubKey = fromBase58String(getStringByKey(NodeOracleProviderPubKeyKey))
277290
278291 let bondAssetId = fromBase58String("F3iaxzruFeKujfVfYSZEkejpjh67wmRfPCRHiNmWKp3Z")
279292
280293 let deprecatedBondAssetId = fromBase58String("975akZBfnMj513U7MZaHKzQrmsEx5aE3wdWKTrHBhbjF")
281294
282295 let neutrinoContract = this
283296
284297 let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey)
285298
286299 func checkIsValidMinSponsoredFee (tx) = {
287300 let MINTRANSFERFEE = 100000
288301 let SponsoredFeeUpperBound = 1000
289302 let realNeutrinoFee = convertWavesToNeutrino(MINTRANSFERFEE, currentPrice)
290303 let minNeutrinoFee = (realNeutrinoFee * 2)
291304 let maxNeutrinoFee = fraction(realNeutrinoFee, SponsoredFeeUpperBound, 100)
292305 let inputFee = value(tx.minSponsoredAssetFee)
293306 if (if ((inputFee >= minNeutrinoFee))
294307 then (maxNeutrinoFee >= inputFee)
295308 else false)
296309 then (tx.assetId == neutrinoAssetId)
297310 else false
298311 }
299312
300313
301314 func getPriceHistory (block) = getNumberByAddressAndKey(controlContract, getPriceHistoryKey(block))
302315
303316
304317 func getHeightPriceByIndex (index) = getNumberByAddressAndKey(controlContract, getHeightPriceByIndexKey(index))
305318
306319
307320 func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "amount"], SEP)
308321
309322
310323 let sIdxSwapType = 1
311324
312325 let sIdxStatus = 2
313326
314327 let sIdxInAmount = 3
315328
316329 let sIdxPrice = 4
317330
318331 let sIdxOutNetAmount = 5
319332
320333 let sIdxOutFeeAmount = 6
321334
322335 let sIdxStartHeight = 7
323336
324337 let sIdxStartTimestamp = 8
325338
326339 let sIdxEndHeight = 9
327340
328341 let sIdxEndTimestamp = 10
329342
330343 let sIdxSelfUnlockHeight = 11
331344
332345 let sIdxRandUnlockHeight = 12
333346
334347 let sIdxIndex = 13
335348
336349 let sIdxWithdrawTxId = 14
337350
338351 let sIdxMinRand = 15
339352
340353 let sIdxMaxRand = 16
341354
342355 func swapKEY (userAddress,txId) = makeString(["%s%s", userAddress, txId], SEP)
343356
344357
345358 func strSwapDATA (swapType,status,inAmount,price,outNetAmount,outFeeAmount,startHeight,startTimestamp,endHeight,endTimestamp,selfUnlockHeight,randUnlockHeight,index,withdrawTxId,randMin,randMax) = makeString(["%s%s%d%d%d%d%d%d%d%d%d%d%d%s", swapType, status, inAmount, price, outNetAmount, outFeeAmount, startHeight, startTimestamp, endHeight, endTimestamp, selfUnlockHeight, randUnlockHeight, index, withdrawTxId, randMin, randMax], SEP)
346359
347360
348361 func pendingSwapDATA (swapType,inAssetAmount,selfUnlockHeight) = strSwapDATA(swapType, "PENDING", toString(inAssetAmount), "0", "0", "0", toString(height), toString(lastBlock.timestamp), "0", "0", toString(selfUnlockHeight), "0", "0", "NULL", "0", "0")
349362
350363
351364 func finishSwapDATA (dataArray,price,outNetAmount,outFeeAmount,randUnlockHeight,index,withdrawTxId) = strSwapDATA(dataArray[sIdxSwapType], "FINISHED", dataArray[sIdxInAmount], toString(price), toString(outNetAmount), toString(outFeeAmount), dataArray[sIdxStartHeight], dataArray[sIdxStartTimestamp], toString(height), toString(lastBlock.timestamp), dataArray[sIdxSelfUnlockHeight], toString(randUnlockHeight), toString(index), withdrawTxId, dataArray[sIdxMinRand], dataArray[sIdxMaxRand])
352365
353366
354367 func swapDataFailOrREAD (userAddress,swapTxId) = {
355368 let swapKey = swapKEY(userAddress, swapTxId)
356369 split(valueOrErrorMessage(getString(this, swapKey), ("no swap data for " + swapKey)), SEP)
357370 }
358371
359372
360-func applyFees (amountGross,feePart) = {
361- let feeAmount = fraction(amountGross, feePart, PAULI)
362-[(amountGross - feeAmount), feeAmount, amountGross]
373+func applyFees (amountOutGross,inAmtToSURF,feePart) = {
374+ let feeAmount = fraction(amountOutGross, feePart, PAULI)
375+[(amountOutGross - feeAmount), feeAmount]
363376 }
364377
365378
366379 func abs (x) = if ((0 > x))
367380 then -(x)
368381 else x
369382
370383
371384 func selectNode (unleaseAmount) = {
372385 let amountToLease = ((wavesBalance(neutrinoContract).available - unleaseAmount) - getReservedAmountForSponsorship())
373386 let oldLeased0 = getNumberByKey(getLeaseAmountKey(0))
374387 let oldLeased1 = getNumberByKey(getLeaseAmountKey(1))
375388 let newLeased0 = (amountToLease + oldLeased0)
376389 let newLeased1 = (amountToLease + oldLeased1)
377390 if (if ((newLeased0 > 0))
378391 then true
379392 else (newLeased1 > 0))
380393 then {
381394 let delta0 = abs((newLeased0 - oldLeased1))
382395 let delta1 = abs((newLeased1 - oldLeased0))
383396 if ((delta1 >= delta0))
384397 then $Tuple2(0, newLeased0)
385398 else $Tuple2(1, newLeased1)
386399 }
387400 else $Tuple2(-1, 0)
388401 }
389402
390403
391404 func thisOnly (i) = if ((i.caller != this))
392405 then throw("Permission denied: this contract only allowed")
393406 else true
394407
395408
396409 func prepareUnleaseAndLease (unleaseAmount) = {
397410 let nodeTuple = selectNode(unleaseAmount)
398411 let nodeIndex = nodeTuple._1
399412 let newLeaseAmount = nodeTuple._2
400413 if ((newLeaseAmount > 0))
401414 then {
402415 let leaseIdKey = getLeaseIdKey(nodeIndex)
403416 let oldLease = getBinary(this, leaseIdKey)
404417 let unleaseOrEmpty = if (isDefined(oldLease))
405418 then [LeaseCancel(value(oldLease))]
406419 else nil
407420 let leaseAmountKey = getLeaseAmountKey(nodeIndex)
408421 let lease = Lease(getStakingNodeAddressByIndex(nodeIndex), newLeaseAmount)
409422 (unleaseOrEmpty ++ [lease, BinaryEntry(leaseIdKey, lcalc(lease)), IntegerEntry(getLeaseAmountKey(nodeIndex), newLeaseAmount)])
410423 }
411424 else nil
412425 }
413426
414427
415428 func readNodeInfo (nodeIdx) = {
416429 let nodeAddress = getStakingNodeAddressByIndex(nodeIdx)
417430 let leasedAmtKEY = getLeaseAmountKey(nodeIdx)
418431 let leasedAmt = getNumberByKey(leasedAmtKEY)
419432 let leaseIdKEY = getLeaseIdKey(nodeIdx)
420433 let leaseId = value(getBinary(this, leaseIdKEY))
421434 $Tuple5(nodeAddress, leasedAmtKEY, leasedAmt, leaseIdKEY, leaseId)
422435 }
423436
424437
425438 func commonSwap (swapType,pmtAmount,userAddressStr,txId58,swapParamsByUserSYSREADONLY) = {
426- let $t01722417304 = swapParamsByUserSYSREADONLY
427- let swapLimitMax = $t01722417304._1
428- let swapLimitSpent = $t01722417304._2
429- let blcks2LmtReset = $t01722417304._3
439+ let swapLimitSpent = swapParamsByUserSYSREADONLY._2
440+ let blcks2LmtReset = swapParamsByUserSYSREADONLY._3
441+ let wavesSwapLimitMax = swapParamsByUserSYSREADONLY._6
442+ let usdnSwapLimitMax = swapParamsByUserSYSREADONLY._7
430443 let minSwapAmount = minSwapAmountREAD(swapType)
431444 let totalLocked = totalLockedREAD(swapType)
432445 let totalLockedByUser = totalLockedByUserREAD(swapType, userAddressStr)
433446 let nodeAddress = getStakingNodeByIndex(0)
434447 let priceByIndex = getPriceHistory(getHeightPriceByIndex(priceIndex))
435448 let isSwapByNode = (nodeAddress == userAddressStr)
436449 let balanceLockMaxInterval = if (isSwapByNode)
437450 then nodeBalanceLockIntervalREAD()
438451 else balanceLockIntervalREAD(swapType)
439452 let selfUnlockHeight = (height + balanceLockMaxInterval)
440453 let swapUsdnVolume = if ((swapType == "neutrino"))
441454 then pmtAmount
442455 else convertWavesToNeutrino(pmtAmount, priceByIndex)
456+ let swapLimitMax = if ((swapType == "neutrino"))
457+ then usdnSwapLimitMax
458+ else convertWavesToNeutrino(wavesSwapLimitMax, priceByIndex)
443459 if ((minSwapAmount > pmtAmount))
444460 then minSwapAmountFAIL(swapType, minSwapAmount)
445461 else if (if (!(isSwapByNode))
446462 then (swapLimitSpent > 0)
447463 else false)
448464 then throw(("You have exceeded swap limit! Next allowed swap height is " + toString((height + blcks2LmtReset))))
449465 else if (if (!(isSwapByNode))
450466 then (swapUsdnVolume > swapLimitMax)
451467 else false)
452468 then throw(((("You have exceeded your swap limit! Requested: " + toString(swapUsdnVolume)) + ", available: ") + toString(swapLimitMax)))
453469 else if (isBlocked)
454470 then emergencyShutdownFAIL()
455471 else {
456472 let leasePart = if ((swapType == "waves"))
457473 then prepareUnleaseAndLease(0)
458474 else nil
459475 $Tuple2(([IntegerEntry(keySwapUserSpentInPeriod(userAddressStr), swapUsdnVolume), IntegerEntry(keyUserLastSwapHeight(userAddressStr), height), IntegerEntry(totalLockedByUserKEY(swapType, userAddressStr), (totalLockedByUser + pmtAmount)), IntegerEntry(getBalanceUnlockBlockKey(userAddressStr), selfUnlockHeight), IntegerEntry(totalLockedKEY(swapType), (totalLocked + pmtAmount)), StringEntry(swapKEY(userAddressStr, txId58), pendingSwapDATA(swapType, pmtAmount, selfUnlockHeight))] ++ leasePart), unit)
460476 }
461477 }
462478
463479
480+let nMetricIdxPrice = 0
481+
482+let nMetricIdxUsdnLockedBalance = 1
483+
484+let nMetricIdxWavesLockedBalance = 2
485+
486+let nMetricIdxReserve = 3
487+
488+let nMetricIdxReserveInUsdn = 4
489+
490+let nMetricIdxUsdnSupply = 5
491+
492+let nMetricIdxSurplus = 6
493+
494+let nMetricIdxSurplusPercent = 7
495+
496+let nMetricIdxBR = 8
497+
498+let nMetricIdxNsbtSupply = 9
499+
500+let nMetricIdxMaxNsbtSupply = 10
501+
502+let nMetricIdxSurfSupply = 11
503+
504+let bFuncIdxSurf = 0
505+
506+let bFuncIdxWaves = 1
507+
508+let bFuncIdxUsdn = 2
509+
510+let bFuncIdxReserveStart = 3
511+
512+let bFuncIdxSupplyStart = 4
513+
514+let bFuncIdxBRStart = 5
515+
516+let bFuncIdxReserveEnd = 6
517+
518+let bFuncIdxSupplyEnd = 7
519+
520+let bFuncIdxBREnd = 8
521+
522+let bFuncIdxRest = 9
523+
524+let bFuncIdxWavesPrice = 10
525+
526+func calcWithdrawW2U (wavesIn,price) = {
527+ let outAmtGross = convertWavesToNeutrino(wavesIn, price)
528+ $Tuple9(outAmtGross, neutrinoAssetId, 0, unit, 0, wavesIn, 0, 0, 0)
529+ }
530+
531+
532+func calcWithdrawU2W (usdnIn,price,br,reservesInUsdn,usdnSupply) = {
533+ let brProtected = valueOrElse(getInteger(this, brProtectedKEY()), BRPROTECTED)
534+ let maxAllowedUsdnBeforeMinBr = if ((brProtected >= br))
535+ then 0
536+ else fraction((reservesInUsdn - fraction(brProtected, usdnSupply, PAULI)), PAULI, (PAULI - brProtected))
537+ let allowedUsdnBeforeMinBr = if ((usdnIn > maxAllowedUsdnBeforeMinBr))
538+ then maxAllowedUsdnBeforeMinBr
539+ else usdnIn
540+ let allowedUsdnAfterMinBr = if ((usdnIn > maxAllowedUsdnBeforeMinBr))
541+ then fraction((usdnIn - maxAllowedUsdnBeforeMinBr), br, PAULI)
542+ else 0
543+ let allowedUsdn = (allowedUsdnBeforeMinBr + allowedUsdnAfterMinBr)
544+ let usdn2SURF = (usdnIn - allowedUsdn)
545+ let outAmtGross = convertNeutrinoToWaves(allowedUsdn, price)
546+ $Tuple9(outAmtGross, unit, usdn2SURF, neutrinoAssetId, outAmtGross, allowedUsdn, maxAllowedUsdnBeforeMinBr, allowedUsdnBeforeMinBr, allowedUsdnAfterMinBr)
547+ }
548+
549+
550+func calcWithdraw (swapType,inAmount,price) = {
551+ let outFeePart = valueOrElse(getInteger(this, outFeePartKEY(swapType)), DEFAULTSWAPFEE)
552+ if (if ((0 > outFeePart))
553+ then true
554+ else (outFeePart >= PAULI))
555+ then throw(((("invalid outFeePart config for " + swapType) + " swap: outFeePart=") + toString(outFeePart)))
556+ else {
557+ let brProtected = valueOrElse(getInteger(this, brProtectedKEY()), BRPROTECTED)
558+ let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil))
559+ let BR = asInt(neutrinoMetrics[nMetricIdxBR])
560+ let reservesInUsdn = asInt(neutrinoMetrics[nMetricIdxReserveInUsdn])
561+ let usdnSupply = asInt(neutrinoMetrics[nMetricIdxUsdnSupply])
562+ let outDataTuple = if ((swapType == "waves"))
563+ then calcWithdrawW2U(inAmount, price)
564+ else if ((swapType == "neutrino"))
565+ then calcWithdrawU2W(inAmount, price, BR, reservesInUsdn, usdnSupply)
566+ else throw(("Unsupported swap type " + swapType))
567+ let outAmtGross = outDataTuple._1
568+ let outAssetId = outDataTuple._2
569+ let inAmtToSurfPart = outDataTuple._3
570+ let inAssetId = outDataTuple._4
571+ let unleaseAmt = outDataTuple._5
572+ let payoutsArray = applyFees(outAmtGross, inAmtToSurfPart, outFeePart)
573+ let outNetAmt = payoutsArray[IdxNetAmount]
574+ let outFeeAmt = payoutsArray[IdxFeeAmount]
575+ let outSurfAmt = if ((0 >= inAmtToSurfPart))
576+ then 0
577+ else {
578+ let surfResult = asAnyList(invoke(mathContract, "surfFunctionREADONLY", [inAmtToSurfPart, inAssetId], nil))
579+ asInt(surfResult[bFuncIdxSurf])
580+ }
581+ $Tuple7(outNetAmt, outAssetId, outSurfAmt, inAmtToSurfPart, unleaseAmt, outFeeAmt, outAmtGross)
582+ }
583+ }
584+
585+
464586 func commonWithdraw (account,index,swapTxId,withdrawTxId) = {
465587 let userAddress = addressFromStringValue(account)
466588 let dataArray = swapDataFailOrREAD(account, swapTxId)
467589 let selfUnlockHeight = parseIntValue(dataArray[sIdxSelfUnlockHeight])
468590 let swapType = dataArray[sIdxSwapType]
469591 let inAmount = parseIntValue(dataArray[sIdxInAmount])
470592 let swapStatus = dataArray[sIdxStatus]
471593 let startHeight = parseIntValue(dataArray[sIdxStartHeight])
472594 let outFeePart = valueOrElse(getInteger(this, outFeePartKEY(swapType)), DEFAULTSWAPFEE)
473595 let totalLocked = totalLockedREAD(swapType)
474596 let totalLockedByUser = totalLockedByUserREAD(swapType, account)
475597 let unlockHeight = selfUnlockHeight
476598 let indexHeight = getHeightPriceByIndex(index)
477599 let prevIndexHeight = getHeightPriceByIndex((index - 1))
478600 let priceByIndex = getPriceHistory(indexHeight)
479- let outAmountGrossTuple = if ((swapType == "waves"))
480- then $Tuple2(convertWavesToNeutrino(inAmount, priceByIndex), neutrinoAssetId)
481- else if ((swapType == "neutrino"))
482- then $Tuple2(convertNeutrinoToWaves(inAmount, priceByIndex), unit)
483- else throw(("Unsupported swap type " + swapType))
484- let payoutsArray = applyFees(outAmountGrossTuple._1, outFeePart)
485- let outNetAmount = payoutsArray[IdxNetAmount]
486- let outFeeAmount = payoutsArray[IdxFeeAmount]
487601 if (isBlocked)
488602 then emergencyShutdownFAIL()
489603 else if ((swapStatus != "PENDING"))
490604 then throw("swap has been already processed")
491605 else if ((unlockHeight > height))
492606 then throw((("please wait for: " + toString(unlockHeight)) + " block height to withdraw funds"))
493607 else if (if (if ((index > priceIndex))
494608 then true
495609 else (unlockHeight > indexHeight))
496610 then true
497611 else if ((prevIndexHeight != 0))
498612 then (prevIndexHeight >= unlockHeight)
499613 else false)
500614 then priceIndexFAIL(index, priceIndex, indexHeight, unlockHeight, prevIndexHeight)
501- else if ((0 >= payoutsArray[IdxGrossAmount]))
502- then throw("balance equals zero")
503- else if (if ((0 > outFeePart))
504- then true
505- else (outFeePart >= PAULI))
506- then throw(((("invalid outFeePart config for " + swapType) + " swap: outFeePart=") + toString(outFeePart)))
615+ else {
616+ let withdrawTuple = calcWithdraw(swapType, inAmount, priceByIndex)
617+ let outNetAmount = withdrawTuple._1
618+ let outAssetId = withdrawTuple._2
619+ let outSurfAmt = withdrawTuple._3
620+ let inAmtToSurfPart = withdrawTuple._4
621+ let unleaseAmt = withdrawTuple._5
622+ let outFeeAmount = withdrawTuple._6
623+ let outAmtGross = withdrawTuple._7
624+ if ((0 >= outAmtGross))
625+ then throw("balance equals zero")
507626 else {
508- let unleaseAmount = if (if ((swapType == "neutrino"))
509- then (outAmountGrossTuple._1 > 0)
510- else false)
511- then outAmountGrossTuple._1
627+ let state = [IntegerEntry(totalLockedByUserKEY(swapType, account), (totalLockedByUser - inAmount)), IntegerEntry(totalLockedKEY(swapType), (totalLocked - inAmount)), ScriptTransfer(userAddress, outNetAmount, outAssetId), StringEntry(swapKEY(account, swapTxId), finishSwapDATA(dataArray, priceByIndex, outNetAmount, outFeeAmount, unlockHeight, index, withdrawTxId))]
628+ let surfCondition = if ((outSurfAmt > 0))
629+ then {
630+ let issueResult = invoke(auctionContract, "issueSurf", [outSurfAmt, account], nil)
631+ if ((issueResult == issueResult))
632+ then 0
633+ else throw("Strict value is not equal to itself.")
634+ }
512635 else 0
513- let state = [IntegerEntry(totalLockedByUserKEY(swapType, account), (totalLockedByUser - inAmount)), IntegerEntry(totalLockedKEY(swapType), (totalLocked - inAmount)), ScriptTransfer(userAddress, outNetAmount, outAmountGrossTuple._2), StringEntry(swapKEY(account, swapTxId), finishSwapDATA(dataArray, priceByIndex, outNetAmount, outFeeAmount, unlockHeight, index, withdrawTxId))]
514- $Tuple3(state, AttachedPayment(outAmountGrossTuple._2, outFeeAmount), unleaseAmount)
636+ if ((surfCondition == surfCondition))
637+ then $Tuple3(state, AttachedPayment(outAssetId, outFeeAmount), unleaseAmt)
638+ else throw("Strict value is not equal to itself.")
515639 }
640+ }
516641 }
517642
518643
519644 @Callable(i)
520645 func constructor (neutrinoAssetIdPrm,bondAssetIdPrm,auctionContractPrm,liquidationContractPrm,rpdContractPrm,nodeOracleProviderPubKeyPrm,balanceWavesLockIntervalPrm,balanceNeutrinoLockIntervalPrm,minWavesSwapAmountPrm,minNeutrinoSwapAmountPrm,neutrinoOutFeePartPrm,wavesOutFeePartPrm) = {
521646 let checkCaller = thisOnly(i)
522647 if ((checkCaller == checkCaller))
523648 then if ((size(i.payments) != 0))
524649 then throw("no payments allowed")
525650 else [StringEntry(NeutrinoAssetIdKey, neutrinoAssetIdPrm), StringEntry(BondAssetIdKey, bondAssetIdPrm), StringEntry(AuctionContractKey, auctionContractPrm), StringEntry(LiquidationContractKey, liquidationContractPrm), StringEntry(RPDContractKey, rpdContractPrm), StringEntry(NodeOracleProviderPubKeyKey, nodeOracleProviderPubKeyPrm), IntegerEntry(BalanceWavesLockIntervalKey, balanceWavesLockIntervalPrm), IntegerEntry(BalanceNeutrinoLockIntervalKey, balanceNeutrinoLockIntervalPrm), IntegerEntry(MinWavesSwapAmountKey, minWavesSwapAmountPrm), IntegerEntry(MinNeutrinoSwapAmountKey, minNeutrinoSwapAmountPrm), IntegerEntry(NeutrinoOutFeePartKey, neutrinoOutFeePartPrm), IntegerEntry(WavesOutFeePartKey, wavesOutFeePartPrm)]
526651 else throw("Strict value is not equal to itself.")
527652 }
528653
529654
530655
531656 @Callable(i)
532657 func constructorV2 (mathContract,nsbtStakingContract,swapsTimeframeBlocks) = {
533658 let checkCaller = thisOnly(i)
534659 if ((checkCaller == checkCaller))
535660 then if ((size(i.payments) != 0))
536661 then throw("no payments allowed")
537662 else [StringEntry(MathContractKey, mathContract), StringEntry(NsbtStakingContractKey, nsbtStakingContract), IntegerEntry(swapsTimeframeKEY(), swapsTimeframeBlocks)]
538663 else throw("Strict value is not equal to itself.")
539664 }
540665
541666
542667
543668 @Callable(i)
544669 func swapWavesToNeutrino () = if ((size(i.payments) != 1))
545670 then throw("swapWavesToNeutrino require only one payment")
546671 else {
547672 let pmt = value(i.payments[0])
548673 if (isDefined(pmt.assetId))
549674 then throw("Only Waves token is allowed for swapping.")
550675 else {
551676 let userAddress = toString(i.caller)
552677 let txId58 = toBase58String(i.transactionId)
553678 let swapParamsSTRUCT = asSwapParamsSTRUCT(invoke(this, "swapParamsByUserSYSREADONLY", [userAddress, 0], nil))
554679 let commonSwapResult = commonSwap("waves", pmt.amount, userAddress, txId58, swapParamsSTRUCT)
555680 commonSwapResult
556681 }
557682 }
558683
559684
560685
561686 @Callable(i)
562687 func swapNeutrinoToWaves () = if ((size(i.payments) != 1))
563688 then throw("swapNeutrinoToWaves require only one payment")
564689 else {
565690 let pmt = value(i.payments[0])
566691 if ((pmt.assetId != neutrinoAssetId))
567692 then throw("Only appropriate Neutrino tokens are allowed for swapping.")
568693 else {
569694 let userAddress = toString(i.caller)
570695 let txId58 = toBase58String(i.transactionId)
571696 let swapParamsSTRUCT = asSwapParamsSTRUCT(invoke(this, "swapParamsByUserSYSREADONLY", [userAddress, 0], nil))
572697 let commonSwapResult = commonSwap("neutrino", pmt.amount, userAddress, txId58, swapParamsSTRUCT)
573698 commonSwapResult
574699 }
575700 }
576701
577702
578703
579704 @Callable(i)
580705 func withdraw (account,index,swapTxId) = {
581706 let txId = toBase58String(i.transactionId)
582707 if ((size(i.payments) != 0))
583708 then throw("no payments allowed")
584709 else {
585710 let commonTuple = commonWithdraw(account, index, swapTxId, txId)
586711 let state = commonTuple._1
587712 let fee = commonTuple._2
588713 let unleaseAmt = commonTuple._3
589714 let unleaseInvOrEmpty = invoke(this, "internalUnleaseAndLease", [unleaseAmt], nil)
590715 if ((unleaseInvOrEmpty == unleaseInvOrEmpty))
591716 then {
592717 let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", ["", 0, 0], nil))
593718 let gnsbtAmtTotal = asInt(gnsbtData[1])
594719 let gnsbtAmtFromSurfTotal = asInt(asAnyList(gnsbtData[3])[3])
595720 let surfFeeAmt = if ((gnsbtAmtTotal != 0))
596721 then fraction(fee.amount, gnsbtAmtFromSurfTotal, gnsbtAmtTotal)
597722 else 0
598723 let nsbtFeeAmt = (fee.amount - surfFeeAmt)
599724 let surfDeposit = if ((surfFeeAmt > 0))
600725 then {
601726 let surfInv = invoke(surfStakingContract, "deposit", nil, [AttachedPayment(fee.assetId, surfFeeAmt)])
602727 if ((surfInv == surfInv))
603728 then nil
604729 else throw("Strict value is not equal to itself.")
605730 }
606731 else nil
607732 if ((surfDeposit == surfDeposit))
608733 then {
609734 let nsbtDeposit = if ((nsbtFeeAmt > 0))
610735 then {
611736 let nsbtInv = invoke(nsbtStakingContract, "deposit", nil, [AttachedPayment(fee.assetId, nsbtFeeAmt)])
612737 if ((nsbtInv == nsbtInv))
613738 then nil
614739 else throw("Strict value is not equal to itself.")
615740 }
616741 else nil
617742 if ((nsbtDeposit == nsbtDeposit))
618743 then state
619744 else throw("Strict value is not equal to itself.")
620745 }
621746 else throw("Strict value is not equal to itself.")
622747 }
623748 else throw("Strict value is not equal to itself.")
624749 }
625750 }
626751
627752
628753
629754 @Callable(i)
630755 func internalUnleaseAndLease (unleaseAmount) = if ((i.caller != this))
631756 then throw("internalUnleaseAndLease is not public method")
632757 else prepareUnleaseAndLease(unleaseAmount)
633758
634759
635760
636761 @Callable(i)
637762 func transferUsdnToUser (amount,addr) = if ((i.caller != auctionContract))
638763 then throw("Only auction contract is authorized")
639764 else [ScriptTransfer(addressFromStringValue(addr), amount, neutrinoAssetId)]
640765
641766
642767
643768 @Callable(i)
644769 func acceptWaves () = if ((i.caller != auctionContract))
645770 then throw("Currently only auction contract is allowed to call")
646771 else $Tuple2(prepareUnleaseAndLease(0), "success")
647772
648773
649774
650775 @Callable(i)
651776 func approveLeasings (nListS,groupNum) = {
652777 let lAmt = (50 * WAVELET)
653778 let nIdxs = [0, 1, 2, 3, 4, 5, 6, 7]
654779 let mngPubS = valueOrElse(getString("%s%s__cfg__leasingManagerPub"), "7AUMX54ukYMYvPmma7yoFf5NjZhs4Bu5nz3Ez9EV8sur")
655780 let mngPub = fromBase58String(mngPubS)
656781 let nodeRegAddrStr = valueOrElse(getString("%s%s__cfg__nodesRegistryAddress"), "3P9vKqQKjUdmpXAfiWau8krREYAY1Xr69pE")
657782 let nodeRegAddr = addressFromStringValue(nodeRegAddrStr)
658783 let lGroupNodeListKEY = getLeaseGroupNodeListKey(groupNum)
659784 let lGrNodeOpt = getString(this, lGroupNodeListKEY)
660785 if (isDefined(lGrNodeOpt))
661786 then throw((("group " + toString(groupNum)) + " already initialized"))
662787 else {
663788 let nList = split(nListS, SEP)
664789 let expCount = size(nIdxs)
665790 if ((i.callerPublicKey != mngPub))
666791 then throw("approveLeasings not authorized")
667792 else {
668- let $t02838428446 = readNodeInfo(0)
669- let nAddr0 = $t02838428446._1
670- let lAmtKEY0 = $t02838428446._2
671- let lAmt0 = $t02838428446._3
672- let lIdKEY0 = $t02838428446._4
673- let lId0 = $t02838428446._5
674- let $t02844928511 = readNodeInfo(1)
675- let nAddr1 = $t02844928511._1
676- let lAmtKEY1 = $t02844928511._2
677- let lAmt1 = $t02844928511._3
678- let lIdKEY1 = $t02844928511._4
679- let lId1 = $t02844928511._5
793+ let $t03363933701 = readNodeInfo(0)
794+ let nAddr0 = $t03363933701._1
795+ let lAmtKEY0 = $t03363933701._2
796+ let lAmt0 = $t03363933701._3
797+ let lIdKEY0 = $t03363933701._4
798+ let lId0 = $t03363933701._5
799+ let $t03370433766 = readNodeInfo(1)
800+ let nAddr1 = $t03370433766._1
801+ let lAmtKEY1 = $t03370433766._2
802+ let lAmt1 = $t03370433766._3
803+ let lIdKEY1 = $t03370433766._4
804+ let lId1 = $t03370433766._5
680805 let newL0 = Lease(nAddr0, (lAmt0 - ((lAmt * expCount) / 2)))
681806 let newL1 = Lease(nAddr1, (lAmt1 - ((lAmt * expCount) / 2)))
682807 let validation = invoke(nodeRegAddr, "validateAndApproveLeasings", [nListS], nil)
683808 if ((validation == validation))
684809 then {
685810 func forEachNodeValidateAndGenerateLease (a,i) = {
686811 let node = nList[i]
687812 let la = Lease(addressFromStringValue(node), lAmt)
688813 (a ++ [la, BinaryEntry(getLeaseIdByAddressKey(node), lcalc(la)), IntegerEntry(getLeaseAmountByAddressKey(node), lAmt)])
689814 }
690815
691816 ([StringEntry(lGroupNodeListKEY, nListS), BinaryEntry(lIdKEY0, lcalc(newL0)), BinaryEntry(lIdKEY1, lcalc(newL1)), IntegerEntry(lAmtKEY0, newL0.amount), IntegerEntry(lAmtKEY1, newL1.amount), LeaseCancel(lId0), LeaseCancel(lId1), newL0, newL1] ++ {
692817 let $l = nIdxs
693818 let $s = size($l)
694819 let $acc0 = nil
695820 func $f0_1 ($a,$i) = if (($i >= $s))
696821 then $a
697822 else forEachNodeValidateAndGenerateLease($a, $l[$i])
698823
699824 func $f0_2 ($a,$i) = if (($i >= $s))
700825 then $a
701826 else throw("List size exceeds 8")
702827
703828 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8)
704829 })
705830 }
706831 else throw("Strict value is not equal to itself.")
707832 }
708833 }
709834 }
710835
711836
712837
713838 @Callable(i)
839+func rebalanceLeasings (amount,groupNum) = {
840+ let nIdxs = [0, 1, 2, 3, 4, 5, 6, 7]
841+ let mngPubS = valueOrElse(getString("%s%s__cfg__leasingManagerPub"), "7AUMX54ukYMYvPmma7yoFf5NjZhs4Bu5nz3Ez9EV8sur")
842+ let mngPub = fromBase58String(mngPubS)
843+ let lGroupNodeListKEY = getLeaseGroupNodeListKey(groupNum)
844+ let nListS = getStringOrFail(this, lGroupNodeListKEY)
845+ let nList = split(nListS, SEP)
846+ if ((i.callerPublicKey != mngPub))
847+ then throw("rebalanceLeasings not authorized")
848+ else {
849+ let unleaseAmt = ((amount / size(nList)) + 1)
850+ let $t03518335245 = readNodeInfo(0)
851+ let nAddr0 = $t03518335245._1
852+ let lAmtKEY0 = $t03518335245._2
853+ let lAmt0 = $t03518335245._3
854+ let lIdKEY0 = $t03518335245._4
855+ let lId0 = $t03518335245._5
856+ let newL0 = Lease(nAddr0, (lAmt0 + (unleaseAmt * size(nList))))
857+ func forEachNodeDoUnlease (a,i) = {
858+ let node = nList[i]
859+ let lIdKEY = getLeaseIdByAddressKey(node)
860+ let lId = getBinaryValue(this, lIdKEY)
861+ let lAmtKEY = getLeaseAmountByAddressKey(node)
862+ let lAmt = getIntegerValue(this, lAmtKEY)
863+ let ula = LeaseCancel(value(lId))
864+ let la = Lease(addressFromStringValue(node), (lAmt - unleaseAmt))
865+ (a ++ [LeaseCancel(value(lId)), la, BinaryEntry(lIdKEY, lcalc(la)), IntegerEntry(lAmtKEY, la.amount)])
866+ }
867+
868+ ({
869+ let $l = nIdxs
870+ let $s = size($l)
871+ let $acc0 = nil
872+ func $f0_1 ($a,$i) = if (($i >= $s))
873+ then $a
874+ else forEachNodeDoUnlease($a, $l[$i])
875+
876+ func $f0_2 ($a,$i) = if (($i >= $s))
877+ then $a
878+ else throw("List size exceeds 8")
879+
880+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8)
881+ } ++ [BinaryEntry(lIdKEY0, lcalc(newL0)), IntegerEntry(lAmtKEY0, newL0.amount), LeaseCancel(lId0), newL0])
882+ }
883+ }
884+
885+
886+
887+@Callable(i)
714888 func swapParamsByUserSYSREADONLY (userAddressStr,gnsbtDiff) = {
715889 let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStr, 0, 0], nil))
716890 let gnsbtAmt = (asInt(gnsbtData[0]) + gnsbtDiff)
717891 let gnsbtAmtTotal = (asInt(gnsbtData[1]) + gnsbtDiff)
718- let swapLimitMax = asInt(invoke(mathContract, "calcSwapLimitREADONLY", [gnsbtAmt], nil))
892+ let swapLimitData = asAnyList(invoke(mathContract, "calcSwapLimitREADONLY", [gnsbtAmt], nil))
893+ let wavesSwapLimitInUsdnMax = asInt(swapLimitData[0])
894+ let wavesSwapLimitMax = asInt(swapLimitData[1])
895+ let usdnSwapLimitMax = asInt(swapLimitData[2])
719896 let lastSwapHeight = valueOrElse(getInteger(this, keyUserLastSwapHeight(userAddressStr)), 0)
720897 let swapLimitTimelifeBlocks = swapsTimeframeREAD()
721898 let passedBlocksAfterLastSwap = (height - lastSwapHeight)
722899 let isSwapTimelifeNew = (passedBlocksAfterLastSwap >= swapLimitTimelifeBlocks)
723- let swapLimitSpent = if (isSwapTimelifeNew)
900+ let swapLimitSpentInUsdn = if (isSwapTimelifeNew)
724901 then 0
725902 else valueOrElse(getInteger(this, keySwapUserSpentInPeriod(userAddressStr)), 0)
726903 let blcks2LmtReset = if (isSwapTimelifeNew)
727904 then 0
728905 else (swapLimitTimelifeBlocks - passedBlocksAfterLastSwap)
729- $Tuple2(nil, $Tuple5(swapLimitMax, swapLimitSpent, blcks2LmtReset, gnsbtAmt, gnsbtAmtTotal))
906+ $Tuple2(nil, $Tuple7(wavesSwapLimitInUsdnMax, swapLimitSpentInUsdn, blcks2LmtReset, gnsbtAmt, gnsbtAmtTotal, wavesSwapLimitMax, usdnSwapLimitMax))
730907 }
908+
909+
910+
911+@Callable(i)
912+func calcWithdrawResultSYSREADONLY (swapType,inAmount,price) = $Tuple2(nil, calcWithdraw(swapType, inAmount, price))
731913
732914
733915
734916 @Callable(i)
735917 func updateReservesAndNeutrinoSupply () = {
736918 func getNumberByKeyInternal (key) = match getInteger(this, key) {
737919 case a: Int =>
738920 a
739921 case _ =>
740922 0
741923 }
742924
743925 let nMetrix = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil))
744926 let idx = getNumberByKeyInternal("updateReservesAndNeutrinoSupplyIdx")
745927 let newIdx = (idx + 1)
746928 [IntegerEntry("updateReservesAndNeutrinoSupplyIdx", newIdx), IntegerEntry("reserve", asInt(nMetrix[3])), IntegerEntry("neutrinoSupply", asInt(nMetrix[5])), IntegerEntry("reservesInUsdn", convertWavesToNeutrino(asInt(nMetrix[3]), asInt(nMetrix[0]))), IntegerEntry("surplus", asInt(nMetrix[6])), IntegerEntry("deficit", -(asInt(nMetrix[6])))]
747929 }
748930
749931
750932
751933 @Callable(i)
752934 func wavesBalancesVsPayment () = {
753935 let b = wavesBalance(this)
754936 [IntegerEntry("wavesBalance_available", b.available), IntegerEntry("wavesBalance_regular", b.regular), IntegerEntry("wavesBalance_generating", b.generating), IntegerEntry("wavesBalance_effective", b.effective), IntegerEntry("waves_payment", value(i.payments[0]).amount)]
755937 }
756938
757939
758940 @Verifier(tx)
759941 func verify () = {
760942 let id = toBase58String(tx.id)
761943 let pubKeyAdminsListStr = makeString(["ExtEEK19nmKj9mCpnWyvEEJFYATLMcVEMvohhUHkyHNm", "Ev5py5FfBQX9cZpYKnfQrTB49Byf8QmpZWeDVRim4yV7", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR"], SEP)
762944 let pubKeyAdminsList = split(valueOrElse(getString(controlContract, "%s__multisig"), pubKeyAdminsListStr), SEP)
763945 let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0])))
764946 then 1
765947 else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1])))
766948 then 1
767949 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2])))
768950 then 1
769951 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3])))
770952 then 2
771953 else 0))
772954 match tx {
773955 case sponsorTx: SponsorFeeTransaction =>
774956 if (checkIsValidMinSponsoredFee(sponsorTx))
775957 then (count >= 3)
776958 else false
777959 case _ =>
778960 (count >= 3)
779961 }
780962 }
781963

github/deemru/w8io/026f985 
106.21 ms