tx · Gn5nZLHSDvYTSnwaawZkoCQb51JSgtp1hgfSxqBJ8ghd 3N9be2mwrA52WJho6DiesZkk4351GvpnWuj: -0.04100000 Waves 2023.02.23 12:47 [2462140] smart account 3N9be2mwrA52WJho6DiesZkk4351GvpnWuj > SELF 0.00000000 Waves
{ "type": 13, "id": "Gn5nZLHSDvYTSnwaawZkoCQb51JSgtp1hgfSxqBJ8ghd", "fee": 4100000, "feeAssetId": null, "timestamp": 1677145697314, "version": 2, "chainId": 84, "sender": "3N9be2mwrA52WJho6DiesZkk4351GvpnWuj", "senderPublicKey": "6mzmbCza9iqbzxMEELcEA4Xc9NeF4CYpbTtz1zMK3C7x", "proofs": [ "5sBEZX1wQtXzcUyhMm5YcBeJRgjDopnvWmdd1U3TFEHHffYV6MitjNSaBc2Ky9k4mfSp4gSbXfu3CSJ9BePjZKDo", "4SyaQoBFCZVhC8zh5JC7kiPk4E1XmpWkUE5Bsxs71BwP4JyQbsGAnT7gW7VuWSb8hg6wTCTFg5a6SQzVVMgRie7m", "43ETCUhBK3wVm61w2fEHn5786w4dzyM7sfepktEZY6dDaN4Qa78D4iK8uijrZAusiD5nqy8iAkqr4k6oieB8nhx2" ], "script": "base64:BgJdCAISDgoMCAgICAgIAQEBAQEBEgUKAwgIARIHCgUYAQEBARIAEgASBQoDCAEIEgMKAQESBAoCAQgSABIFCgMIAQESBAoCAQESBAoCCAESBgoECAEBCBIGCgQICAEBsgEBD2dldFN0cmluZ09yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQUHYWRkcmVzcwkAzAgCAgEuCQDMCAIFA2tleQkAzAgCAg8gaXMgbm90IGRlZmluZWQFA25pbAIAAQVsY2FsYwEBbAkAuQgBBQFsAQ5nZXROdW1iZXJCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCaCAIFBHRo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cG9uc29yZWRGZWUBBQlzcG9uc29yVHgJAGcCBQVjb3VudAADBwkAZwIFBWNvdW50AAPgEatJ", "height": 2462140, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9hTC4fZnts2hDPiKz7Cbne6CWauhDcEAKHVJKL4aQ4Fz Next: 731LHi8RJPMrgiecRGEVQzBn632rg4hbYdDxxXZZzo9V Diff:
Old | New | Differences | |
---|---|---|---|
202 | 202 | ||
203 | 203 | let MinNeutrinoSwapAmountKey = "min_outMulti_swap_amount" | |
204 | 204 | ||
205 | + | let LegacyMinNeutrinoSwapAmountKey = "min_neutrino_swap_amount" | |
206 | + | ||
205 | 207 | let NodeOracleProviderPubKeyKey = "node_oracle_provider" | |
206 | 208 | ||
207 | 209 | let NeutrinoOutFeePartKey = "neutrinoOut_swap_feePart" | |
291 | 293 | func basketWeightByAssetKey (assetId) = ("%s%s%s__common__weightByAsset__" + assetId) | |
292 | 294 | ||
293 | 295 | ||
294 | - | func minSwapAmountREAD (swapType,assetId) = valueOrElse(if ((swapType == "outMulti")) | |
295 | - | then getInteger(MinNeutrinoSwapAmountKey) | |
296 | - | else getInteger(MinTokenSwapAmountKey(assetId)), 0) | |
296 | + | func keyPriceByAsset (assetId) = ("%s%s%s__common__priceByAsset__" + assetId) | |
297 | + | ||
298 | + | ||
299 | + | func minSwapAmountREAD (swapType,assetId) = if ((swapType == "outMulti")) | |
300 | + | then valueOrElse(getInteger(MinNeutrinoSwapAmountKey), getNumberByKey(LegacyMinNeutrinoSwapAmountKey)) | |
301 | + | else getNumberByKey(MinTokenSwapAmountKey(assetId)) | |
297 | 302 | ||
298 | 303 | ||
299 | 304 | func swapsTimeframeREAD () = valueOrElse(getInteger(this, swapsTimeframeKEY()), 1440) | |
320 | 325 | func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price) | |
321 | 326 | ||
322 | 327 | ||
323 | - | func | |
328 | + | func convertTokenToUsd (amount,price) = fraction(amount, price, MULT8) | |
324 | 329 | ||
325 | 330 | ||
326 | - | func convertWavesToBond (amount,price) = | |
331 | + | func convertWavesToBond (amount,price) = convertTokenToUsd(amount, price) | |
327 | 332 | ||
328 | 333 | ||
329 | 334 | func convertJsonArrayToList (jsonArray) = split(jsonArray, ",") | |
330 | 335 | ||
331 | 336 | ||
332 | 337 | func convertBasketItemToNeutrino (inAmount,inAsset,basketInfoStr,neutrinoPrice) = { | |
333 | - | let basketInfo = split(basketInfoStr, "_") | |
338 | + | let basketInfo = split_4C(basketInfoStr, "_") | |
334 | 339 | func findItem (acc,item) = { | |
335 | 340 | let bItem = split(item, LISTSEP) | |
336 | 341 | if ((bItem[0] == inAsset)) | |
371 | 376 | ||
372 | 377 | ||
373 | 378 | func convertNeutrinoToBasket (amount,basketInfoStr,neutrinoSupply) = { | |
374 | - | let basketInfo = split(basketInfoStr, "_") | |
379 | + | let basketInfo = split_4C(basketInfoStr, "_") | |
375 | 380 | func conv (acc,item) = { | |
376 | 381 | let parts = split(item, LISTSEP) | |
377 | 382 | let assetId = parts[0] | |
432 | 437 | func checkIsValidMinSponsoredFee (tx) = { | |
433 | 438 | let MINTRANSFERFEE = 100000 | |
434 | 439 | let SponsoredFeeUpperBound = 1000 | |
435 | - | let realNeutrinoFee = | |
440 | + | let realNeutrinoFee = convertTokenToUsd(MINTRANSFERFEE, currentPrice) | |
436 | 441 | let minNeutrinoFee = (realNeutrinoFee * 2) | |
437 | 442 | let maxNeutrinoFee = fraction(realNeutrinoFee, SponsoredFeeUpperBound, 100) | |
438 | 443 | let inputFee = value(tx.minSponsoredAssetFee) | |
474 | 479 | func swapKEY (userAddress,txId) = makeString(["%s%s", userAddress, txId], SEP) | |
475 | 480 | ||
476 | 481 | ||
477 | - | func strSwapDATA (swapType,status,inAmount,price,outNetAmount,outFeeAmount,startHeight,startTimestamp,endHeight,endTimestamp,selfUnlockHeight,randUnlockHeight,index,withdrawTxId,randMin,randMax,outSurfAmt,br,basketData,inAsset) = makeString(["%s%s%d%d%d%d%d%d%d%d%d%d%d%s%d%d%d%d%s%s", swapType, status, inAmount, price, outNetAmount, outFeeAmount, startHeight, startTimestamp, endHeight, endTimestamp, selfUnlockHeight, randUnlockHeight, index, withdrawTxId, randMin, randMax, outSurfAmt, br, basketData, inAsset], SEP) | |
482 | + | func strSwapDATA (swapType,status,inAmount,price,outNetAmount,outFeeAmount,startHeight,startTimestamp,endHeight,endTimestamp,selfUnlockHeight,randUnlockHeight,index,withdrawTxId,randMin,randMax,outSurfAmt,br,basketData,inAsset) = makeString_2C(["%s%s%d%d%d%d%d%d%d%d%d%d%d%s%d%d%d%d%s%s", swapType, status, inAmount, price, outNetAmount, outFeeAmount, startHeight, startTimestamp, endHeight, endTimestamp, selfUnlockHeight, randUnlockHeight, index, withdrawTxId, randMin, randMax, outSurfAmt, br, basketData, inAsset], SEP) | |
478 | 483 | ||
479 | 484 | ||
480 | 485 | func pendingSwapDATA (swapType,inAssetAmount,selfUnlockHeight,inAsset) = strSwapDATA(swapType, "PENDING", toString(inAssetAmount), "0", "0", "0", toString(height), toString(lastBlock.timestamp), "0", "0", toString(selfUnlockHeight), "0", "0", "NULL", "0", "0", "0", "0", "", inAsset) | |
518 | 523 | ||
519 | 524 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
520 | 525 | } | |
521 | - | makeString(a, "_") | |
526 | + | makeString_2C(a, "_") | |
522 | 527 | } | |
523 | 528 | ||
524 | 529 | ||
583 | 588 | ||
584 | 589 | func commonSwap (swapType,pmtAmount,inAsset,userAddressStr,txId58) = { | |
585 | 590 | let swapParamsSTRUCT = asSwapParamsSTRUCT(invoke(this, "swapParamsByUserSYSREADONLY", [userAddressStr, 0], nil)) | |
591 | + | let tokenSwapLimitUsd = swapParamsSTRUCT._1 | |
586 | 592 | let swapLimitSpent = swapParamsSTRUCT._2 | |
587 | 593 | let blcks2LmtReset = swapParamsSTRUCT._3 | |
588 | - | let wavesSwapLimitMax = swapParamsSTRUCT._6 | |
589 | 594 | let usdnSwapLimitMax = swapParamsSTRUCT._7 | |
590 | 595 | let minSwapAmount = minSwapAmountREAD(swapType, inAsset) | |
591 | 596 | let totalLocked = totalLockedREAD(swapType, inAsset) | |
592 | 597 | let totalLockedByUser = totalLockedByUserREAD(swapType, userAddressStr, inAsset) | |
593 | 598 | let nodeAddress = getStakingNodeByIndex(0) | |
594 | - | let priceByIndex = getPriceHistory(getHeightPriceByIndex(priceIndex)) | |
595 | 599 | let isSwapByNode = (nodeAddress == userAddressStr) | |
596 | 600 | let balanceLockMaxInterval = if (isSwapByNode) | |
597 | 601 | then nodeBalanceLockIntervalREAD() | |
598 | 602 | else balanceLockIntervalREAD(swapType) | |
599 | 603 | let selfUnlockHeight = (height + balanceLockMaxInterval) | |
604 | + | let pr = valueOrElse(getInteger(controlContract, keyPriceByAsset(inAsset)), MULT6) | |
600 | 605 | let swapUsdnVolume = if ((swapType == "outNeutrino")) | |
601 | - | then | |
606 | + | then convertTokenToUsd(pmtAmount, pr) | |
602 | 607 | else pmtAmount | |
603 | 608 | let swapLimitMax = if ((swapType == "outNeutrino")) | |
604 | - | then | |
609 | + | then tokenSwapLimitUsd | |
605 | 610 | else usdnSwapLimitMax | |
606 | 611 | if ((minSwapAmount > pmtAmount)) | |
607 | 612 | then minSwapAmountFAIL(swapType, minSwapAmount) | |
888 | 893 | let gnsbtAmtTotal = asInt(gnsbtData[1]) | |
889 | 894 | let gnsbtAmtFromSurfTotal = asInt(asAnyList(gnsbtData[3])[3]) | |
890 | 895 | let commonActions = [IntegerEntry(totalLockedByUserKEY(swapType, account, inAsset), (totalLockedByUser - inAmount)), IntegerEntry(totalLockedKEY(swapType, inAsset), (totalLocked - inAmount)), StringEntry(swapKEY(account, swapTxId), finishSwapDATA(dataArray, withdrawPrice, outNetAmount, outFeeAmount, unlockHeight, index, txId, outSurfAmt, BR, withdrawBasket, inAsset))] | |
891 | - | if ((swapType == "outMulti")) | |
896 | + | func deposits (surfFees,nsbtFees,surfPayments,nsbtPayments) = { | |
897 | + | let surfDeposit = if ((surfFees > 0)) | |
898 | + | then asInt(invoke(surfStakingContract, "deposit", nil, surfPayments)) | |
899 | + | else 0 | |
900 | + | let nsbtDeposit = if ((nsbtFees > 0)) | |
901 | + | then asInt(invoke(nsbtStakingContract, "deposit", nil, nsbtPayments)) | |
902 | + | else 0 | |
903 | + | (surfDeposit + nsbtDeposit) | |
904 | + | } | |
905 | + | ||
906 | + | func divideFees (feeAmount) = { | |
907 | + | let surfAmt1 = if ((gnsbtAmtTotal != 0)) | |
908 | + | then fraction(feeAmount, gnsbtAmtFromSurfTotal, gnsbtAmtTotal) | |
909 | + | else 0 | |
910 | + | let surfAmt2 = if ((gnsbtAmtTotal != 0)) | |
911 | + | then fraction(feeAmount, (MULT6 - BR), MULT6) | |
912 | + | else 0 | |
913 | + | let surfAmt = max([surfAmt1, surfAmt2]) | |
914 | + | let nsbtAmt = (feeAmount - surfAmt) | |
915 | + | [surfAmt, nsbtAmt] | |
916 | + | } | |
917 | + | ||
918 | + | let transfers = if ((swapType == "outMulti")) | |
892 | 919 | then { | |
893 | - | let basket = split(withdrawBasket, "_") | |
920 | + | let basket = split_4C(withdrawBasket, "_") | |
894 | 921 | func looper (acc,item) = { | |
895 | 922 | let it = split(item, LISTSEP) | |
896 | 923 | let tempAssetId = fromBase58String(it[0]) | |
899 | 926 | else tempAssetId | |
900 | 927 | let netAmount = parseIntValue(it[2]) | |
901 | 928 | let feeAmount = parseIntValue(it[3]) | |
902 | - | let surfAmt1 = if ((gnsbtAmtTotal != 0)) | |
903 | - | then fraction(feeAmount, gnsbtAmtFromSurfTotal, gnsbtAmtTotal) | |
904 | - | else 0 | |
905 | - | let surfAmt2 = if ((gnsbtAmtTotal != 0)) | |
906 | - | then fraction(feeAmount, (MULT6 - BR), MULT6) | |
907 | - | else 0 | |
908 | - | let surfAmt = max([surfAmt1, surfAmt2]) | |
909 | - | let nsbtAmt = (feeAmount - surfAmt) | |
910 | - | $Tuple5((acc._1 :+ ScriptTransfer(userAddress, netAmount, assetId)), (acc._2 :+ AttachedPayment(assetId, surfAmt)), (acc._3 :+ AttachedPayment(assetId, nsbtAmt)), (acc._4 + surfAmt), (acc._5 + nsbtAmt)) | |
929 | + | let fees = divideFees(feeAmount) | |
930 | + | $Tuple5((acc._1 :+ ScriptTransfer(userAddress, netAmount, assetId)), (acc._2 :+ AttachedPayment(assetId, fees[0])), (acc._3 :+ AttachedPayment(assetId, fees[1])), (acc._4 + fees[0]), (acc._5 + fees[1])) | |
911 | 931 | } | |
912 | 932 | ||
913 | 933 | let r = { | |
924 | 944 | ||
925 | 945 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
926 | 946 | } | |
927 | - | let surfDeposit = if ((r._4 > 0)) | |
928 | - | then { | |
929 | - | let surfInv = invoke(surfStakingContract, "deposit", nil, r._2) | |
930 | - | if ((surfInv == surfInv)) | |
931 | - | then 0 | |
932 | - | else throw("Strict value is not equal to itself.") | |
933 | - | } | |
934 | - | else 0 | |
935 | - | if ((surfDeposit == surfDeposit)) | |
936 | - | then { | |
937 | - | let nsbtDeposit = if ((r._5 > 0)) | |
938 | - | then { | |
939 | - | let nsbtInv = invoke(nsbtStakingContract, "deposit", nil, r._3) | |
940 | - | if ((nsbtInv == nsbtInv)) | |
941 | - | then 0 | |
942 | - | else throw("Strict value is not equal to itself.") | |
943 | - | } | |
944 | - | else 0 | |
945 | - | if ((nsbtDeposit == nsbtDeposit)) | |
946 | - | then (commonActions ++ r._1) | |
947 | - | else throw("Strict value is not equal to itself.") | |
948 | - | } | |
949 | - | else throw("Strict value is not equal to itself.") | |
947 | + | let depoResult = deposits(r._4, r._5, r._2, r._3) | |
948 | + | $Tuple2(r._1, depoResult) | |
950 | 949 | } | |
951 | 950 | else { | |
952 | - | let fee = AttachedPayment(outAssetId, outFeeAmount) | |
953 | - | let surfFeeAmt1 = if ((gnsbtAmtTotal != 0)) | |
954 | - | then fraction(fee.amount, gnsbtAmtFromSurfTotal, gnsbtAmtTotal) | |
955 | - | else 0 | |
956 | - | let surfFeeAmt2 = if ((gnsbtAmtTotal != 0)) | |
957 | - | then fraction(fee.amount, (MULT6 - BR), MULT6) | |
958 | - | else 0 | |
959 | - | let surfFeeAmt = max([surfFeeAmt1, surfFeeAmt2]) | |
960 | - | let nsbtFeeAmt = (fee.amount - surfFeeAmt) | |
961 | - | let surfDeposit = if ((surfFeeAmt > 0)) | |
962 | - | then { | |
963 | - | let surfInv = invoke(surfStakingContract, "deposit", nil, [AttachedPayment(fee.assetId, surfFeeAmt)]) | |
964 | - | if ((surfInv == surfInv)) | |
965 | - | then nil | |
966 | - | else throw("Strict value is not equal to itself.") | |
967 | - | } | |
968 | - | else nil | |
969 | - | if ((surfDeposit == surfDeposit)) | |
970 | - | then { | |
971 | - | let nsbtDeposit = if ((nsbtFeeAmt > 0)) | |
972 | - | then { | |
973 | - | let nsbtInv = invoke(nsbtStakingContract, "deposit", nil, [AttachedPayment(fee.assetId, nsbtFeeAmt)]) | |
974 | - | if ((nsbtInv == nsbtInv)) | |
975 | - | then nil | |
976 | - | else throw("Strict value is not equal to itself.") | |
977 | - | } | |
978 | - | else nil | |
979 | - | if ((nsbtDeposit == nsbtDeposit)) | |
980 | - | then (commonActions :+ ScriptTransfer(userAddress, outNetAmount, outAssetId)) | |
981 | - | else throw("Strict value is not equal to itself.") | |
982 | - | } | |
983 | - | else throw("Strict value is not equal to itself.") | |
951 | + | let fees = divideFees(outFeeAmount) | |
952 | + | let depoResult = deposits(fees[0], fees[1], [AttachedPayment(outAssetId, fees[0])], [AttachedPayment(outAssetId, fees[1])]) | |
953 | + | $Tuple2([ScriptTransfer(userAddress, outNetAmount, outAssetId)], depoResult) | |
984 | 954 | } | |
955 | + | $Tuple2((commonActions ++ transfers._1), transfers._2) | |
985 | 956 | } | |
986 | 957 | else throw("Strict value is not equal to itself.") | |
987 | 958 | } | |
1033 | 1004 | if ((i.callerPublicKey != mngPub)) | |
1034 | 1005 | then throw("approveLeasings not authorized") | |
1035 | 1006 | else { | |
1036 | - | let $ | |
1037 | - | let nAddr0 = $ | |
1038 | - | let lAmtKEY0 = $ | |
1039 | - | let lAmt0 = $ | |
1040 | - | let lIdKEY0 = $ | |
1041 | - | let lId0 = $ | |
1007 | + | let $t04360243664 = readNodeInfo(0) | |
1008 | + | let nAddr0 = $t04360243664._1 | |
1009 | + | let lAmtKEY0 = $t04360243664._2 | |
1010 | + | let lAmt0 = $t04360243664._3 | |
1011 | + | let lIdKEY0 = $t04360243664._4 | |
1012 | + | let lId0 = $t04360243664._5 | |
1042 | 1013 | let newL0 = Lease(nAddr0, (lAmt0 - (lAmt * expCount))) | |
1043 | 1014 | let validation = invoke(nodeRegAddr, "validateAndApproveLeasings", [nListS], nil) | |
1044 | 1015 | if ((validation == validation)) | |
1083 | 1054 | then throw("rebalanceLeasings not authorized") | |
1084 | 1055 | else { | |
1085 | 1056 | let unleaseAmt = ((amount / size(nList)) + 1) | |
1086 | - | let $ | |
1087 | - | let nAddr0 = $ | |
1088 | - | let lAmtKEY0 = $ | |
1089 | - | let lAmt0 = $ | |
1090 | - | let lIdKEY0 = $ | |
1091 | - | let lId0 = $ | |
1057 | + | let $t04490444966 = readNodeInfo(0) | |
1058 | + | let nAddr0 = $t04490444966._1 | |
1059 | + | let lAmtKEY0 = $t04490444966._2 | |
1060 | + | let lAmt0 = $t04490444966._3 | |
1061 | + | let lIdKEY0 = $t04490444966._4 | |
1062 | + | let lId0 = $t04490444966._5 | |
1092 | 1063 | let newL0 = Lease(nAddr0, (lAmt0 + (unleaseAmt * size(nList)))) | |
1093 | 1064 | func forEachNodeDoUnlease (a,i) = { | |
1094 | 1065 | let node = nList[i] | |
1126 | 1097 | let gnsbtAmt = (asInt(gnsbtData[0]) + gnsbtDiff) | |
1127 | 1098 | let gnsbtAmtTotal = (asInt(gnsbtData[1]) + gnsbtDiff) | |
1128 | 1099 | let swapLimitData = asAnyList(invoke(mathContract, "calcSwapLimitREADONLY", [gnsbtAmt], nil)) | |
1129 | - | let wavesSwapLimitInUsdnMax = asInt(swapLimitData[0]) | |
1130 | - | let wavesSwapLimitMax = asInt(swapLimitData[1]) | |
1100 | + | let tokenSwapLimitInUsdMax = asInt(swapLimitData[0]) | |
1131 | 1101 | let usdnSwapLimitMax = asInt(swapLimitData[2]) | |
1132 | 1102 | let lastSwapHeight = valueOrElse(getInteger(this, keyUserLastSwapHeight(userAddressStr)), 0) | |
1133 | 1103 | let swapLimitTimelifeBlocks = swapsTimeframeREAD() | |
1139 | 1109 | let blcks2LmtReset = if (isSwapTimelifeNew) | |
1140 | 1110 | then 0 | |
1141 | 1111 | else (swapLimitTimelifeBlocks - passedBlocksAfterLastSwap) | |
1142 | - | $Tuple2(nil, $Tuple7( | |
1112 | + | $Tuple2(nil, $Tuple7(tokenSwapLimitInUsdMax, swapLimitSpentInUsdn, blcks2LmtReset, gnsbtAmt, gnsbtAmtTotal, 0, usdnSwapLimitMax)) | |
1143 | 1113 | } | |
1144 | 1114 | ||
1145 | 1115 | ||
1182 | 1152 | } | |
1183 | 1153 | ||
1184 | 1154 | ||
1185 | - | ||
1186 | - | @Callable(i) | |
1187 | - | func updateReservesAndNeutrinoSupply () = { | |
1188 | - | func getNumberByKeyInternal (key) = match getInteger(this, key) { | |
1189 | - | case a: Int => | |
1190 | - | a | |
1191 | - | case _ => | |
1192 | - | 0 | |
1193 | - | } | |
1194 | - | ||
1195 | - | let nMetrix = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
1196 | - | let idx = getNumberByKeyInternal("updateReservesAndNeutrinoSupplyIdx") | |
1197 | - | let newIdx = (idx + 1) | |
1198 | - | [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])))] | |
1199 | - | } | |
1200 | - | ||
1201 | - | ||
1202 | - | ||
1203 | - | @Callable(i) | |
1204 | - | func wavesBalancesVsPayment () = { | |
1205 | - | let b = wavesBalance(this) | |
1206 | - | [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)] | |
1207 | - | } | |
1208 | - | ||
1209 | - | ||
1210 | 1155 | @Verifier(tx) | |
1211 | 1156 | func verify () = { | |
1212 | 1157 | let pubKeyAdminsListStr = makeString(["ExtEEK19nmKj9mCpnWyvEEJFYATLMcVEMvohhUHkyHNm", "Ev5py5FfBQX9cZpYKnfQrTB49Byf8QmpZWeDVRim4yV7", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR"], SEP) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func lcalc (l) = calculateLeaseId(l) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func getBoolByKey (key) = valueOrElse(getBoolean(this, key), false) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func getNumberByAddressAndKey (address,key) = valueOrElse(getInteger(address, key), 0) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func getStringByAddressAndKey (address,key) = valueOrElse(getString(addressFromStringValue(address), key), "") | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func getBoolByAddressAndKey (address,key) = valueOrElse(getBoolean(address, key), false) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func asAnyList (v) = match v { | |
29 | 29 | case l: List[Any] => | |
30 | 30 | l | |
31 | 31 | case _ => | |
32 | 32 | throw("fail to cast into List[Any]") | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func asString (v) = match v { | |
37 | 37 | case s: String => | |
38 | 38 | s | |
39 | 39 | case _ => | |
40 | 40 | throw("fail to cast into String") | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func asInt (v) = match v { | |
45 | 45 | case i: Int => | |
46 | 46 | i | |
47 | 47 | case _ => | |
48 | 48 | throw("fail to cast into Int") | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func asBytes (val) = match val { | |
53 | 53 | case valByte: ByteVector => | |
54 | 54 | valByte | |
55 | 55 | case _ => | |
56 | 56 | throw("fail to cast into ByteVector") | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func asPayment (v) = match v { | |
61 | 61 | case p: AttachedPayment => | |
62 | 62 | p | |
63 | 63 | case _ => | |
64 | 64 | throw("fail to cast into AttachedPayment") | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func asSwapParamsSTRUCT (v) = match v { | |
69 | 69 | case struct: (Int, Int, Int, Int, Int, Int, Int) => | |
70 | 70 | struct | |
71 | 71 | case _ => | |
72 | 72 | throw("fail to cast into Tuple5 ints") | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | let SEP = "__" | |
77 | 77 | ||
78 | 78 | let LISTSEP = ":" | |
79 | 79 | ||
80 | 80 | let MULT8 = 100000000 | |
81 | 81 | ||
82 | 82 | let MULT6 = 1000000 | |
83 | 83 | ||
84 | 84 | let DEFAULTSWAPFEE = 20000 | |
85 | 85 | ||
86 | 86 | let BRPROTECTED = 100000 | |
87 | 87 | ||
88 | 88 | let WAVESID = base58'WAVES' | |
89 | 89 | ||
90 | 90 | let nMetricIdxPrice = 0 | |
91 | 91 | ||
92 | 92 | let nMetricIdxUsdnLockedBalance = 1 | |
93 | 93 | ||
94 | 94 | let nMetricIdxWavesLockedBalance = 2 | |
95 | 95 | ||
96 | 96 | let nMetricIdxReserve = 3 | |
97 | 97 | ||
98 | 98 | let nMetricIdxReserveInUsdn = 4 | |
99 | 99 | ||
100 | 100 | let nMetricIdxUsdnSupply = 5 | |
101 | 101 | ||
102 | 102 | let nMetricIdxSurplus = 6 | |
103 | 103 | ||
104 | 104 | let nMetricIdxSurplusPercent = 7 | |
105 | 105 | ||
106 | 106 | let nMetricIdxBR = 8 | |
107 | 107 | ||
108 | 108 | let nMetricIdxNsbtSupply = 9 | |
109 | 109 | ||
110 | 110 | let nMetricIdxMaxNsbtSupply = 10 | |
111 | 111 | ||
112 | 112 | let nMetricIdxSurfSupply = 11 | |
113 | 113 | ||
114 | 114 | let nMetricUsdnUsdtPeg = 12 | |
115 | 115 | ||
116 | 116 | let nMetricCurrentPriceAdj = 13 | |
117 | 117 | ||
118 | 118 | let nMetricBasketInfo = 14 | |
119 | 119 | ||
120 | 120 | let nMetricWeightedPrice = 15 | |
121 | 121 | ||
122 | 122 | let nMetricTotalReservesUsd = 16 | |
123 | 123 | ||
124 | 124 | let IdxControlCfgNeutrinoDapp = 1 | |
125 | 125 | ||
126 | 126 | let IdxControlCfgAuctionDapp = 2 | |
127 | 127 | ||
128 | 128 | let IdxControlCfgRpdDapp = 3 | |
129 | 129 | ||
130 | 130 | let IdxControlCfgMathDapp = 4 | |
131 | 131 | ||
132 | 132 | let IdxControlCfgLiquidationDapp = 5 | |
133 | 133 | ||
134 | 134 | let IdxControlCfgRestDapp = 6 | |
135 | 135 | ||
136 | 136 | let IdxControlCfgNodeRegistryDapp = 7 | |
137 | 137 | ||
138 | 138 | let IdxControlCfgNsbtStakingDapp = 8 | |
139 | 139 | ||
140 | 140 | let IdxControlCfgMediatorDapp = 9 | |
141 | 141 | ||
142 | 142 | let IdxControlCfgSurfStakingDapp = 10 | |
143 | 143 | ||
144 | 144 | let IdxControlCfgGnsbtControllerDapp = 11 | |
145 | 145 | ||
146 | 146 | let IdxControlCfgRestV2Dapp = 12 | |
147 | 147 | ||
148 | 148 | let IdxControlCfgGovernanceDapp = 13 | |
149 | 149 | ||
150 | 150 | func keyControlAddress () = "%s%s__config__controlAddress" | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func keyControlCfg () = "%s__controlConfig" | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func readControlCfgOrFail (control) = split_4C(getStringOrFail(control, keyControlCfg()), SEP) | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx")) | |
163 | 163 | ||
164 | 164 | let controlCfg = readControlCfgOrFail(controlContract) | |
165 | 165 | ||
166 | 166 | let mathContract = getContractAddressOrFail(controlCfg, IdxControlCfgMathDapp) | |
167 | 167 | ||
168 | 168 | let nsbtStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgNsbtStakingDapp) | |
169 | 169 | ||
170 | 170 | let surfStakingContract = getContractAddressOrFail(controlCfg, IdxControlCfgSurfStakingDapp) | |
171 | 171 | ||
172 | 172 | let gnsbtControllerContract = getContractAddressOrFail(controlCfg, IdxControlCfgGnsbtControllerDapp) | |
173 | 173 | ||
174 | 174 | let auctionContract = getContractAddressOrFail(controlCfg, IdxControlCfgAuctionDapp) | |
175 | 175 | ||
176 | 176 | let nodeRegistryContract = getContractAddressOrFail(controlCfg, IdxControlCfgNodeRegistryDapp) | |
177 | 177 | ||
178 | 178 | let govContract = getContractAddressOrFail(controlCfg, IdxControlCfgGovernanceDapp) | |
179 | 179 | ||
180 | 180 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
181 | 181 | ||
182 | 182 | let BondAssetIdKey = "bond_asset_id" | |
183 | 183 | ||
184 | 184 | let AuctionContractKey = "auction_contract" | |
185 | 185 | ||
186 | 186 | let NsbtStakingContractKey = "nsbtStakingContract" | |
187 | 187 | ||
188 | 188 | let LiquidationContractKey = "liquidation_contract" | |
189 | 189 | ||
190 | 190 | let RPDContractKey = "rpd_contract" | |
191 | 191 | ||
192 | 192 | let ContolContractKey = "control_contract" | |
193 | 193 | ||
194 | 194 | let MathContractKey = "math_contract" | |
195 | 195 | ||
196 | 196 | let BalanceWavesLockIntervalKey = "balance_waves_lock_interval" | |
197 | 197 | ||
198 | 198 | let BalanceNeutrinoLockIntervalKey = "balance_neutrino_lock_interval" | |
199 | 199 | ||
200 | 200 | func MinTokenSwapAmountKey (assetId) = ("min_outNeutrino_swap_amount_" + assetId) | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | let MinNeutrinoSwapAmountKey = "min_outMulti_swap_amount" | |
204 | 204 | ||
205 | + | let LegacyMinNeutrinoSwapAmountKey = "min_neutrino_swap_amount" | |
206 | + | ||
205 | 207 | let NodeOracleProviderPubKeyKey = "node_oracle_provider" | |
206 | 208 | ||
207 | 209 | let NeutrinoOutFeePartKey = "neutrinoOut_swap_feePart" | |
208 | 210 | ||
209 | 211 | let WavesOutFeePartKey = "wavesOut_swap_feePart" | |
210 | 212 | ||
211 | 213 | func keyNodeRegistry (address) = ("%s__" + address) | |
212 | 214 | ||
213 | 215 | ||
214 | 216 | let PriceKey = "price" | |
215 | 217 | ||
216 | 218 | let PriceIndexKey = "price_index" | |
217 | 219 | ||
218 | 220 | let IsBlockedKey = "is_blocked" | |
219 | 221 | ||
220 | 222 | func getPriceHistoryKey (block) = ((PriceKey + "_") + toString(block)) | |
221 | 223 | ||
222 | 224 | ||
223 | 225 | func getHeightPriceByIndexKey (index) = ((PriceIndexKey + "_") + toString(index)) | |
224 | 226 | ||
225 | 227 | ||
226 | 228 | func getStakingNodeByIndex (idx) = getStringByKey(makeString(["%s%d%s", "lease", toString(idx), "nodeAddress"], SEP)) | |
227 | 229 | ||
228 | 230 | ||
229 | 231 | func getStakingNodeAddressByIndex (idx) = addressFromStringValue(getStakingNodeByIndex(idx)) | |
230 | 232 | ||
231 | 233 | ||
232 | 234 | func getReservedAmountForSponsorship () = valueOrElse(getInteger(this, makeString(["%s%s", "lease", "sponsorshipWavesReserve"], SEP)), (1000 * MULT8)) | |
233 | 235 | ||
234 | 236 | ||
235 | 237 | func getBalanceUnlockBlockKey (owner) = ("balance_unlock_block_" + owner) | |
236 | 238 | ||
237 | 239 | ||
238 | 240 | func getLeaseIdKey (nodeIndex) = makeString(["%s%d%s", "lease", toString(nodeIndex), "id"], SEP) | |
239 | 241 | ||
240 | 242 | ||
241 | 243 | func getLeaseIdByAddressKey (nodeAddress) = makeString(["%s%s%s", "leaseByAddress", nodeAddress, "id"], SEP) | |
242 | 244 | ||
243 | 245 | ||
244 | 246 | func getLeaseAmountKey (nodeIndex) = makeString(["%s%d%s", "lease", toString(nodeIndex), "amount"], SEP) | |
245 | 247 | ||
246 | 248 | ||
247 | 249 | func getLeaseAmountByAddressKey (nodeAddress) = makeString(["%s%s%s", "leaseByAddress", nodeAddress, "amount"], SEP) | |
248 | 250 | ||
249 | 251 | ||
250 | 252 | func getLeaseGroupNodeListKey (groupNum) = makeString(["%s%d%s", "leaseGroup", toString(groupNum), "nodeList"], SEP) | |
251 | 253 | ||
252 | 254 | ||
253 | 255 | func minSwapAmountKEY (swapType) = (("min_" + swapType) + "_swap_amount") | |
254 | 256 | ||
255 | 257 | ||
256 | 258 | func totalLockedKEY (swapType,assetId) = makeString(["%s%s%s", "balanceLock", swapType, assetId], SEP) | |
257 | 259 | ||
258 | 260 | ||
259 | 261 | func totalLockedByUserKEY (swapType,owner,assetId) = makeString(["%s%s%s%s", "balanceLock", swapType, owner, assetId], "_") | |
260 | 262 | ||
261 | 263 | ||
262 | 264 | func balanceLockIntervalKEY (swapType) = if ((swapType == "outMulti")) | |
263 | 265 | then BalanceNeutrinoLockIntervalKey | |
264 | 266 | else BalanceWavesLockIntervalKey | |
265 | 267 | ||
266 | 268 | ||
267 | 269 | func nodeBalanceLockIntervalKEY () = "balance_node_lock_interval" | |
268 | 270 | ||
269 | 271 | ||
270 | 272 | func swapsTimeframeKEY () = "swaps_timeframe" | |
271 | 273 | ||
272 | 274 | ||
273 | 275 | func brProtectedKEY () = "min_BR_protection_level" | |
274 | 276 | ||
275 | 277 | ||
276 | 278 | func basketAssetsKey () = "%s%s__common__basketAssets" | |
277 | 279 | ||
278 | 280 | ||
279 | 281 | func basketDKey () = "%s%s__common__basketD" | |
280 | 282 | ||
281 | 283 | ||
282 | 284 | func basketKKey () = "%s%s__common__basketK" | |
283 | 285 | ||
284 | 286 | ||
285 | 287 | func basketBKey () = "%s%s__common__basketB" | |
286 | 288 | ||
287 | 289 | ||
288 | 290 | func basketLogbDeltaKey () = "%s%s__common__basketLogbDelta" | |
289 | 291 | ||
290 | 292 | ||
291 | 293 | func basketWeightByAssetKey (assetId) = ("%s%s%s__common__weightByAsset__" + assetId) | |
292 | 294 | ||
293 | 295 | ||
294 | - | func minSwapAmountREAD (swapType,assetId) = valueOrElse(if ((swapType == "outMulti")) | |
295 | - | then getInteger(MinNeutrinoSwapAmountKey) | |
296 | - | else getInteger(MinTokenSwapAmountKey(assetId)), 0) | |
296 | + | func keyPriceByAsset (assetId) = ("%s%s%s__common__priceByAsset__" + assetId) | |
297 | + | ||
298 | + | ||
299 | + | func minSwapAmountREAD (swapType,assetId) = if ((swapType == "outMulti")) | |
300 | + | then valueOrElse(getInteger(MinNeutrinoSwapAmountKey), getNumberByKey(LegacyMinNeutrinoSwapAmountKey)) | |
301 | + | else getNumberByKey(MinTokenSwapAmountKey(assetId)) | |
297 | 302 | ||
298 | 303 | ||
299 | 304 | func swapsTimeframeREAD () = valueOrElse(getInteger(this, swapsTimeframeKEY()), 1440) | |
300 | 305 | ||
301 | 306 | ||
302 | 307 | func totalLockedREAD (swapType,assetId) = valueOrElse(getInteger(this, totalLockedKEY(swapType, assetId)), 0) | |
303 | 308 | ||
304 | 309 | ||
305 | 310 | func totalLockedByUserREAD (swapType,owner,assetId) = valueOrElse(getInteger(this, totalLockedByUserKEY(swapType, owner, assetId)), 0) | |
306 | 311 | ||
307 | 312 | ||
308 | 313 | func balanceLockIntervalREAD (swapType) = valueOrElse(getInteger(this, balanceLockIntervalKEY(swapType)), 1440) | |
309 | 314 | ||
310 | 315 | ||
311 | 316 | func nodeBalanceLockIntervalREAD () = valueOrElse(getInteger(this, nodeBalanceLockIntervalKEY()), 1) | |
312 | 317 | ||
313 | 318 | ||
314 | 319 | func keySwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "swapUserSpentInPeriod", userAddress], SEP) | |
315 | 320 | ||
316 | 321 | ||
317 | 322 | func keyUserLastSwapHeight (userAddress) = makeString(["%s%s", "userLastSwapHeight", userAddress], SEP) | |
318 | 323 | ||
319 | 324 | ||
320 | 325 | func convertNeutrinoToWaves (amount,price) = fraction(amount, MULT8, price) | |
321 | 326 | ||
322 | 327 | ||
323 | - | func | |
328 | + | func convertTokenToUsd (amount,price) = fraction(amount, price, MULT8) | |
324 | 329 | ||
325 | 330 | ||
326 | - | func convertWavesToBond (amount,price) = | |
331 | + | func convertWavesToBond (amount,price) = convertTokenToUsd(amount, price) | |
327 | 332 | ||
328 | 333 | ||
329 | 334 | func convertJsonArrayToList (jsonArray) = split(jsonArray, ",") | |
330 | 335 | ||
331 | 336 | ||
332 | 337 | func convertBasketItemToNeutrino (inAmount,inAsset,basketInfoStr,neutrinoPrice) = { | |
333 | - | let basketInfo = split(basketInfoStr, "_") | |
338 | + | let basketInfo = split_4C(basketInfoStr, "_") | |
334 | 339 | func findItem (acc,item) = { | |
335 | 340 | let bItem = split(item, LISTSEP) | |
336 | 341 | if ((bItem[0] == inAsset)) | |
337 | 342 | then bItem | |
338 | 343 | else acc | |
339 | 344 | } | |
340 | 345 | ||
341 | 346 | let it = { | |
342 | 347 | let $l = basketInfo | |
343 | 348 | let $s = size($l) | |
344 | 349 | let $acc0 = nil | |
345 | 350 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
346 | 351 | then $a | |
347 | 352 | else findItem($a, $l[$i]) | |
348 | 353 | ||
349 | 354 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
350 | 355 | then $a | |
351 | 356 | else throw("List size exceeds 10") | |
352 | 357 | ||
353 | 358 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
354 | 359 | } | |
355 | 360 | let dlog6 = valueOrElse(getInteger(basketLogbDeltaKey()), -18820642) | |
356 | 361 | let d6 = valueOrElse(getInteger(basketDKey()), 50000) | |
357 | 362 | let b6 = valueOrElse(getInteger(basketBKey()), 1250000) | |
358 | 363 | let w6 = valueOrElse(getInteger(basketWeightByAssetKey(inAsset)), 166666) | |
359 | 364 | let p6 = ((dlog6 - w6) + parseIntValue(it[1])) | |
360 | 365 | let pp6 = pow(b6, 6, p6, 6, 6, HALFUP) | |
361 | 366 | let outAmountGross = fraction(inAmount, parseIntValue(it[2]), if ((neutrinoPrice == 0)) | |
362 | 367 | then MULT8 | |
363 | 368 | else (neutrinoPrice * 100)) | |
364 | 369 | let multiplier = ((MULT6 + d6) - pp6) | |
365 | 370 | let netAmount = fraction(outAmountGross, multiplier, MULT6) | |
366 | 371 | let feeAmount = if ((netAmount >= outAmountGross)) | |
367 | 372 | then 0 | |
368 | 373 | else (outAmountGross - netAmount) | |
369 | 374 | [outAmountGross, netAmount, feeAmount] | |
370 | 375 | } | |
371 | 376 | ||
372 | 377 | ||
373 | 378 | func convertNeutrinoToBasket (amount,basketInfoStr,neutrinoSupply) = { | |
374 | - | let basketInfo = split(basketInfoStr, "_") | |
379 | + | let basketInfo = split_4C(basketInfoStr, "_") | |
375 | 380 | func conv (acc,item) = { | |
376 | 381 | let parts = split(item, LISTSEP) | |
377 | 382 | let assetId = parts[0] | |
378 | 383 | let share = parseIntValue(parts[1]) | |
379 | 384 | let price = parseIntValue(parts[2]) | |
380 | 385 | let reserv = parseIntValue(parts[3]) | |
381 | 386 | if ((neutrinoSupply == 0)) | |
382 | 387 | then throw("Attempt to burn neutrino at zero supply") | |
383 | 388 | else { | |
384 | 389 | let outAmount = fraction(amount, reserv, neutrinoSupply) | |
385 | 390 | let wavesTuple = if ((assetId == "WAVES")) | |
386 | 391 | then $Tuple2(outAmount, price) | |
387 | 392 | else $Tuple2(acc._2, acc._3) | |
388 | 393 | $Tuple3((acc._1 :+ $Tuple4(assetId, outAmount, price, share)), wavesTuple._1, wavesTuple._2) | |
389 | 394 | } | |
390 | 395 | } | |
391 | 396 | ||
392 | 397 | let $l = basketInfo | |
393 | 398 | let $s = size($l) | |
394 | 399 | let $acc0 = $Tuple3(nil, 0, 0) | |
395 | 400 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
396 | 401 | then $a | |
397 | 402 | else conv($a, $l[$i]) | |
398 | 403 | ||
399 | 404 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
400 | 405 | then $a | |
401 | 406 | else throw("List size exceeds 10") | |
402 | 407 | ||
403 | 408 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
404 | 409 | } | |
405 | 410 | ||
406 | 411 | ||
407 | 412 | func minSwapAmountFAIL (swapType,minSwapAmount) = throw(((("The specified amount in " + swapType) + " swap is less than the required minimum of ") + toString(minSwapAmount))) | |
408 | 413 | ||
409 | 414 | ||
410 | 415 | func emergencyShutdownFAIL () = throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles") | |
411 | 416 | ||
412 | 417 | ||
413 | 418 | 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))) | |
414 | 419 | ||
415 | 420 | ||
416 | 421 | let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey)) | |
417 | 422 | ||
418 | 423 | let priceIndex = getNumberByAddressAndKey(controlContract, PriceIndexKey) | |
419 | 424 | ||
420 | 425 | let isBlocked = getBoolByAddressAndKey(controlContract, IsBlockedKey) | |
421 | 426 | ||
422 | 427 | let nodeOracleProviderPubKey = fromBase58String(getStringByKey(NodeOracleProviderPubKeyKey)) | |
423 | 428 | ||
424 | 429 | let bondAssetId = fromBase58String("F3iaxzruFeKujfVfYSZEkejpjh67wmRfPCRHiNmWKp3Z") | |
425 | 430 | ||
426 | 431 | let deprecatedBondAssetId = fromBase58String("975akZBfnMj513U7MZaHKzQrmsEx5aE3wdWKTrHBhbjF") | |
427 | 432 | ||
428 | 433 | let neutrinoContract = this | |
429 | 434 | ||
430 | 435 | let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey) | |
431 | 436 | ||
432 | 437 | func checkIsValidMinSponsoredFee (tx) = { | |
433 | 438 | let MINTRANSFERFEE = 100000 | |
434 | 439 | let SponsoredFeeUpperBound = 1000 | |
435 | - | let realNeutrinoFee = | |
440 | + | let realNeutrinoFee = convertTokenToUsd(MINTRANSFERFEE, currentPrice) | |
436 | 441 | let minNeutrinoFee = (realNeutrinoFee * 2) | |
437 | 442 | let maxNeutrinoFee = fraction(realNeutrinoFee, SponsoredFeeUpperBound, 100) | |
438 | 443 | let inputFee = value(tx.minSponsoredAssetFee) | |
439 | 444 | if (if ((inputFee >= minNeutrinoFee)) | |
440 | 445 | then (maxNeutrinoFee >= inputFee) | |
441 | 446 | else false) | |
442 | 447 | then (tx.assetId == neutrinoAssetId) | |
443 | 448 | else false | |
444 | 449 | } | |
445 | 450 | ||
446 | 451 | ||
447 | 452 | func getPriceHistory (block) = getNumberByAddressAndKey(controlContract, getPriceHistoryKey(block)) | |
448 | 453 | ||
449 | 454 | ||
450 | 455 | func getHeightPriceByIndex (index) = getNumberByAddressAndKey(controlContract, getHeightPriceByIndexKey(index)) | |
451 | 456 | ||
452 | 457 | ||
453 | 458 | func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "amount"], SEP) | |
454 | 459 | ||
455 | 460 | ||
456 | 461 | let sIdxSwapType = 1 | |
457 | 462 | ||
458 | 463 | let sIdxStatus = 2 | |
459 | 464 | ||
460 | 465 | let sIdxInAmount = 3 | |
461 | 466 | ||
462 | 467 | let sIdxStartHeight = 7 | |
463 | 468 | ||
464 | 469 | let sIdxStartTimestamp = 8 | |
465 | 470 | ||
466 | 471 | let sIdxSelfUnlockHeight = 11 | |
467 | 472 | ||
468 | 473 | let sIdxMinRand = 15 | |
469 | 474 | ||
470 | 475 | let sIdxMaxRand = 16 | |
471 | 476 | ||
472 | 477 | let sIdxInAsset = 20 | |
473 | 478 | ||
474 | 479 | func swapKEY (userAddress,txId) = makeString(["%s%s", userAddress, txId], SEP) | |
475 | 480 | ||
476 | 481 | ||
477 | - | func strSwapDATA (swapType,status,inAmount,price,outNetAmount,outFeeAmount,startHeight,startTimestamp,endHeight,endTimestamp,selfUnlockHeight,randUnlockHeight,index,withdrawTxId,randMin,randMax,outSurfAmt,br,basketData,inAsset) = makeString(["%s%s%d%d%d%d%d%d%d%d%d%d%d%s%d%d%d%d%s%s", swapType, status, inAmount, price, outNetAmount, outFeeAmount, startHeight, startTimestamp, endHeight, endTimestamp, selfUnlockHeight, randUnlockHeight, index, withdrawTxId, randMin, randMax, outSurfAmt, br, basketData, inAsset], SEP) | |
482 | + | func strSwapDATA (swapType,status,inAmount,price,outNetAmount,outFeeAmount,startHeight,startTimestamp,endHeight,endTimestamp,selfUnlockHeight,randUnlockHeight,index,withdrawTxId,randMin,randMax,outSurfAmt,br,basketData,inAsset) = makeString_2C(["%s%s%d%d%d%d%d%d%d%d%d%d%d%s%d%d%d%d%s%s", swapType, status, inAmount, price, outNetAmount, outFeeAmount, startHeight, startTimestamp, endHeight, endTimestamp, selfUnlockHeight, randUnlockHeight, index, withdrawTxId, randMin, randMax, outSurfAmt, br, basketData, inAsset], SEP) | |
478 | 483 | ||
479 | 484 | ||
480 | 485 | func pendingSwapDATA (swapType,inAssetAmount,selfUnlockHeight,inAsset) = strSwapDATA(swapType, "PENDING", toString(inAssetAmount), "0", "0", "0", toString(height), toString(lastBlock.timestamp), "0", "0", toString(selfUnlockHeight), "0", "0", "NULL", "0", "0", "0", "0", "", inAsset) | |
481 | 486 | ||
482 | 487 | ||
483 | 488 | func finishSwapDATA (dataArray,price,outNetAmount,outFeeAmount,randUnlockHeight,index,withdrawTxId,outSurfAmt,br,basketData,inAsset) = 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], toString(outSurfAmt), toString(br), basketData, inAsset) | |
484 | 489 | ||
485 | 490 | ||
486 | 491 | func swapDataFailOrREAD (userAddress,swapTxId) = { | |
487 | 492 | let swapKey = swapKEY(userAddress, swapTxId) | |
488 | 493 | split_4C(valueOrErrorMessage(getString(swapKey), ("no swap data for " + swapKey)), SEP) | |
489 | 494 | } | |
490 | 495 | ||
491 | 496 | ||
492 | 497 | func applyFees (amountOutGross,inAmtToSURF,feePart) = { | |
493 | 498 | let feeAmount = fraction(amountOutGross, feePart, MULT6) | |
494 | 499 | [(amountOutGross - feeAmount), feeAmount] | |
495 | 500 | } | |
496 | 501 | ||
497 | 502 | ||
498 | 503 | func applyFeesBasket (basketOut) = { | |
499 | 504 | let k6 = valueOrElse(getInteger(basketKKey()), MULT6) | |
500 | 505 | let d6 = valueOrElse(getInteger(basketDKey()), 50000) | |
501 | 506 | let feePart = fraction(k6, d6, MULT6) | |
502 | 507 | func feeApplier (acc,item) = { | |
503 | 508 | let feeAmount = fraction(item._2, feePart, MULT6) | |
504 | 509 | (acc :+ makeString([item._1, toString(item._3), toString((item._2 - feeAmount)), toString(feeAmount), toString(item._4)], LISTSEP)) | |
505 | 510 | } | |
506 | 511 | ||
507 | 512 | let a = { | |
508 | 513 | let $l = basketOut | |
509 | 514 | let $s = size($l) | |
510 | 515 | let $acc0 = nil | |
511 | 516 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
512 | 517 | then $a | |
513 | 518 | else feeApplier($a, $l[$i]) | |
514 | 519 | ||
515 | 520 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
516 | 521 | then $a | |
517 | 522 | else throw("List size exceeds 10") | |
518 | 523 | ||
519 | 524 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
520 | 525 | } | |
521 | - | makeString(a, "_") | |
526 | + | makeString_2C(a, "_") | |
522 | 527 | } | |
523 | 528 | ||
524 | 529 | ||
525 | 530 | func abs (x) = if ((0 > x)) | |
526 | 531 | then -(x) | |
527 | 532 | else x | |
528 | 533 | ||
529 | 534 | ||
530 | 535 | func selectNode (unleaseAmount) = { | |
531 | 536 | let amountToLease = ((wavesBalance(neutrinoContract).available - unleaseAmount) - getReservedAmountForSponsorship()) | |
532 | 537 | let oldLeased0 = getNumberByKey(getLeaseAmountKey(0)) | |
533 | 538 | let oldLeased1 = getNumberByKey(getLeaseAmountKey(1)) | |
534 | 539 | let newLeased0 = (amountToLease + oldLeased0) | |
535 | 540 | let newLeased1 = (amountToLease + oldLeased1) | |
536 | 541 | if (if ((newLeased0 > 0)) | |
537 | 542 | then true | |
538 | 543 | else (newLeased1 > 0)) | |
539 | 544 | then { | |
540 | 545 | let delta0 = abs((newLeased0 - oldLeased1)) | |
541 | 546 | let delta1 = abs((newLeased1 - oldLeased0)) | |
542 | 547 | if ((delta1 >= delta0)) | |
543 | 548 | then $Tuple2(0, newLeased0) | |
544 | 549 | else $Tuple2(1, newLeased1) | |
545 | 550 | } | |
546 | 551 | else $Tuple2(-1, 0) | |
547 | 552 | } | |
548 | 553 | ||
549 | 554 | ||
550 | 555 | func thisOnly (i) = if ((i.caller != this)) | |
551 | 556 | then throw("Permission denied: this contract only allowed") | |
552 | 557 | else true | |
553 | 558 | ||
554 | 559 | ||
555 | 560 | func prepareUnleaseAndLease (unleaseAmount) = { | |
556 | 561 | let nodeTuple = selectNode(unleaseAmount) | |
557 | 562 | let nodeIndex = nodeTuple._1 | |
558 | 563 | let newLeaseAmount = nodeTuple._2 | |
559 | 564 | if ((newLeaseAmount > 0)) | |
560 | 565 | then { | |
561 | 566 | let leaseIdKey = getLeaseIdKey(nodeIndex) | |
562 | 567 | let oldLease = getBinary(this, leaseIdKey) | |
563 | 568 | let unleaseOrEmpty = if (isDefined(oldLease)) | |
564 | 569 | then [LeaseCancel(value(oldLease))] | |
565 | 570 | else nil | |
566 | 571 | let leaseAmountKey = getLeaseAmountKey(nodeIndex) | |
567 | 572 | let lease = Lease(getStakingNodeAddressByIndex(nodeIndex), newLeaseAmount) | |
568 | 573 | (unleaseOrEmpty ++ [lease, BinaryEntry(leaseIdKey, lcalc(lease)), IntegerEntry(getLeaseAmountKey(nodeIndex), newLeaseAmount)]) | |
569 | 574 | } | |
570 | 575 | else nil | |
571 | 576 | } | |
572 | 577 | ||
573 | 578 | ||
574 | 579 | func readNodeInfo (nodeIdx) = { | |
575 | 580 | let nodeAddress = getStakingNodeAddressByIndex(nodeIdx) | |
576 | 581 | let leasedAmtKEY = getLeaseAmountKey(nodeIdx) | |
577 | 582 | let leasedAmt = getNumberByKey(leasedAmtKEY) | |
578 | 583 | let leaseIdKEY = getLeaseIdKey(nodeIdx) | |
579 | 584 | let leaseId = value(getBinary(this, leaseIdKEY)) | |
580 | 585 | $Tuple5(nodeAddress, leasedAmtKEY, leasedAmt, leaseIdKEY, leaseId) | |
581 | 586 | } | |
582 | 587 | ||
583 | 588 | ||
584 | 589 | func commonSwap (swapType,pmtAmount,inAsset,userAddressStr,txId58) = { | |
585 | 590 | let swapParamsSTRUCT = asSwapParamsSTRUCT(invoke(this, "swapParamsByUserSYSREADONLY", [userAddressStr, 0], nil)) | |
591 | + | let tokenSwapLimitUsd = swapParamsSTRUCT._1 | |
586 | 592 | let swapLimitSpent = swapParamsSTRUCT._2 | |
587 | 593 | let blcks2LmtReset = swapParamsSTRUCT._3 | |
588 | - | let wavesSwapLimitMax = swapParamsSTRUCT._6 | |
589 | 594 | let usdnSwapLimitMax = swapParamsSTRUCT._7 | |
590 | 595 | let minSwapAmount = minSwapAmountREAD(swapType, inAsset) | |
591 | 596 | let totalLocked = totalLockedREAD(swapType, inAsset) | |
592 | 597 | let totalLockedByUser = totalLockedByUserREAD(swapType, userAddressStr, inAsset) | |
593 | 598 | let nodeAddress = getStakingNodeByIndex(0) | |
594 | - | let priceByIndex = getPriceHistory(getHeightPriceByIndex(priceIndex)) | |
595 | 599 | let isSwapByNode = (nodeAddress == userAddressStr) | |
596 | 600 | let balanceLockMaxInterval = if (isSwapByNode) | |
597 | 601 | then nodeBalanceLockIntervalREAD() | |
598 | 602 | else balanceLockIntervalREAD(swapType) | |
599 | 603 | let selfUnlockHeight = (height + balanceLockMaxInterval) | |
604 | + | let pr = valueOrElse(getInteger(controlContract, keyPriceByAsset(inAsset)), MULT6) | |
600 | 605 | let swapUsdnVolume = if ((swapType == "outNeutrino")) | |
601 | - | then | |
606 | + | then convertTokenToUsd(pmtAmount, pr) | |
602 | 607 | else pmtAmount | |
603 | 608 | let swapLimitMax = if ((swapType == "outNeutrino")) | |
604 | - | then | |
609 | + | then tokenSwapLimitUsd | |
605 | 610 | else usdnSwapLimitMax | |
606 | 611 | if ((minSwapAmount > pmtAmount)) | |
607 | 612 | then minSwapAmountFAIL(swapType, minSwapAmount) | |
608 | 613 | else if (if (!(isSwapByNode)) | |
609 | 614 | then (swapLimitSpent > 0) | |
610 | 615 | else false) | |
611 | 616 | then throw(("You have exceeded swap limit! Next allowed swap height is " + toString((height + blcks2LmtReset)))) | |
612 | 617 | else if (if (!(isSwapByNode)) | |
613 | 618 | then (swapUsdnVolume > swapLimitMax) | |
614 | 619 | else false) | |
615 | 620 | then throw(((("You have exceeded your swap limit! Requested: " + toString(swapUsdnVolume)) + ", available: ") + toString(swapLimitMax))) | |
616 | 621 | else if (isBlocked) | |
617 | 622 | then emergencyShutdownFAIL() | |
618 | 623 | else { | |
619 | 624 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
620 | 625 | let basketInfo = asString(neutrinoMetrics[nMetricBasketInfo]) | |
621 | 626 | let weightedPrice = asInt(neutrinoMetrics[nMetricWeightedPrice]) | |
622 | 627 | let out = convertBasketItemToNeutrino(pmtAmount, inAsset, basketInfo, weightedPrice) | |
623 | 628 | if (if ((swapType == "outNeutrino")) | |
624 | 629 | then (0 >= out[1]) | |
625 | 630 | else false) | |
626 | 631 | then throw((((((("Net amount is non-positive, cannot swap. (gross, net, fee) = (" + toString(out[0])) + ", ") + toString(out[1])) + ", ") + toString(out[2])) + ")")) | |
627 | 632 | else { | |
628 | 633 | let leasePart = if (if ((swapType == "outNeutrino")) | |
629 | 634 | then (inAsset == "WAVES") | |
630 | 635 | else false) | |
631 | 636 | then prepareUnleaseAndLease(0) | |
632 | 637 | else nil | |
633 | 638 | $Tuple2(([IntegerEntry(keySwapUserSpentInPeriod(userAddressStr), swapUsdnVolume), IntegerEntry(keyUserLastSwapHeight(userAddressStr), height), IntegerEntry(totalLockedByUserKEY(swapType, userAddressStr, inAsset), (totalLockedByUser + pmtAmount)), IntegerEntry(getBalanceUnlockBlockKey(userAddressStr), selfUnlockHeight), IntegerEntry(totalLockedKEY(swapType, inAsset), (totalLocked + pmtAmount)), StringEntry(swapKEY(userAddressStr, txId58), pendingSwapDATA(swapType, pmtAmount, selfUnlockHeight, inAsset))] ++ leasePart), unit) | |
634 | 639 | } | |
635 | 640 | } | |
636 | 641 | } | |
637 | 642 | ||
638 | 643 | ||
639 | 644 | let bFuncIdxSurf = 0 | |
640 | 645 | ||
641 | 646 | let bFuncIdxWaves = 1 | |
642 | 647 | ||
643 | 648 | let bFuncIdxUsdn = 2 | |
644 | 649 | ||
645 | 650 | let bFuncIdxReserveStart = 3 | |
646 | 651 | ||
647 | 652 | let bFuncIdxSupplyStart = 4 | |
648 | 653 | ||
649 | 654 | let bFuncIdxBRStart = 5 | |
650 | 655 | ||
651 | 656 | let bFuncIdxReserveEnd = 6 | |
652 | 657 | ||
653 | 658 | let bFuncIdxSupplyEnd = 7 | |
654 | 659 | ||
655 | 660 | let bFuncIdxBREnd = 8 | |
656 | 661 | ||
657 | 662 | let bFuncIdxRest = 9 | |
658 | 663 | ||
659 | 664 | let bFuncIdxWavesPrice = 10 | |
660 | 665 | ||
661 | 666 | func calcWithdrawT2U (inAmount,inAsset,basketInfo,weightedPrice) = { | |
662 | 667 | let outAmt = convertBasketItemToNeutrino(inAmount, inAsset, basketInfo, weightedPrice) | |
663 | 668 | $Tuple12(outAmt[0], neutrinoAssetId, 0, inAsset, 0, weightedPrice, inAmount, 0, 0, 0, nil, [outAmt[1], outAmt[2]]) | |
664 | 669 | } | |
665 | 670 | ||
666 | 671 | ||
667 | 672 | func calcWithdrawU2Basket (usdnIn,basketInfo,neutrinoSupply) = { | |
668 | 673 | let outAmtGross = convertNeutrinoToBasket(usdnIn, basketInfo, neutrinoSupply) | |
669 | 674 | $Tuple12(outAmtGross._2, unit, 0, neutrinoAssetId, outAmtGross._2, outAmtGross._3, usdnIn, neutrinoSupply, usdnIn, 0, outAmtGross._1, nil) | |
670 | 675 | } | |
671 | 676 | ||
672 | 677 | ||
673 | 678 | func calcWithdraw (swapType,inAmount,price,neutrinoMetrics,inAsset) = { | |
674 | 679 | let neutrinoSupply = asInt(neutrinoMetrics[nMetricIdxUsdnSupply]) | |
675 | 680 | let basketInfo = asString(neutrinoMetrics[nMetricBasketInfo]) | |
676 | 681 | let weightedPrice = asInt(neutrinoMetrics[nMetricWeightedPrice]) | |
677 | 682 | let outDataTuple = if ((swapType == "outNeutrino")) | |
678 | 683 | then calcWithdrawT2U(inAmount, inAsset, basketInfo, weightedPrice) | |
679 | 684 | else if ((swapType == "outMulti")) | |
680 | 685 | then calcWithdrawU2Basket(inAmount, basketInfo, neutrinoSupply) | |
681 | 686 | else throw(("Unsupported swap type " + swapType)) | |
682 | 687 | let outAmtGross = outDataTuple._1 | |
683 | 688 | let outAssetId = outDataTuple._2 | |
684 | 689 | let inAmtToSurfPart = outDataTuple._3 | |
685 | 690 | let inAssetId = outDataTuple._4 | |
686 | 691 | let unleaseAmt = outDataTuple._5 | |
687 | 692 | let withdrawPrice = outDataTuple._6 | |
688 | 693 | let basketData = outDataTuple._11 | |
689 | 694 | let netFeeData = outDataTuple._12 | |
690 | 695 | let outNetAmt = if ((swapType == "outNeutrino")) | |
691 | 696 | then netFeeData[0] | |
692 | 697 | else 0 | |
693 | 698 | let outFeeAmt = if ((swapType == "outNeutrino")) | |
694 | 699 | then netFeeData[1] | |
695 | 700 | else 0 | |
696 | 701 | let outSurfAmt = if ((0 >= inAmtToSurfPart)) | |
697 | 702 | then 0 | |
698 | 703 | else asInt(asAnyList(invoke(mathContract, "surfFunctionREADONLY", [inAmtToSurfPart, inAssetId], nil))[bFuncIdxSurf]) | |
699 | 704 | let withdrawBasket = if ((swapType == "outMulti")) | |
700 | 705 | then applyFeesBasket(basketData) | |
701 | 706 | else "" | |
702 | 707 | $Tuple9(outNetAmt, outAssetId, outSurfAmt, inAmtToSurfPart, unleaseAmt, outFeeAmt, outAmtGross, withdrawPrice, withdrawBasket) | |
703 | 708 | } | |
704 | 709 | ||
705 | 710 | ||
706 | 711 | func keyApplyInProgress () = "%s__applyInProgress" | |
707 | 712 | ||
708 | 713 | ||
709 | 714 | func keyProposalDataById (proposalId) = ("%s%d__proposalData__" + toString(proposalId)) | |
710 | 715 | ||
711 | 716 | ||
712 | 717 | let govIdxTxIds = 9 | |
713 | 718 | ||
714 | 719 | func validateUpdate (tx) = match tx { | |
715 | 720 | case o: Order => | |
716 | 721 | throw("Orders aren't allowed") | |
717 | 722 | case t: DataTransaction|SponsorFeeTransaction|SetScriptTransaction|CreateAliasTransaction|LeaseCancelTransaction|LeaseTransaction|IssueTransaction|InvokeExpressionTransaction|UpdateAssetInfoTransaction|InvokeScriptTransaction|SetAssetScriptTransaction|TransferTransaction|ExchangeTransaction|MassTransferTransaction|BurnTransaction|ReissueTransaction => | |
718 | 723 | let txId = toBase58String(t.id) | |
719 | 724 | let proposalId = valueOrErrorMessage(getInteger(govContract, keyApplyInProgress()), "Apply is not happening") | |
720 | 725 | let txList = split(split(getStringOrFail(govContract, keyProposalDataById(proposalId)), SEP)[govIdxTxIds], LISTSEP) | |
721 | 726 | if (!(isDefined(indexOf(txList, txId)))) | |
722 | 727 | then throw(((("Unknown txId: " + txId) + " for proposalId=") + toString(proposalId))) | |
723 | 728 | else true | |
724 | 729 | case _ => | |
725 | 730 | throw("Match error") | |
726 | 731 | } | |
727 | 732 | ||
728 | 733 | ||
729 | 734 | @Callable(i) | |
730 | 735 | func constructorV1 (neutrinoAssetIdPrm,bondAssetIdPrm,auctionContractPrm,liquidationContractPrm,rpdContractPrm,nodeOracleProviderPubKeyPrm,balanceWavesLockIntervalPrm,balanceNeutrinoLockIntervalPrm,minWavesSwapAmountPrm,minNeutrinoSwapAmountPrm,neutrinoOutFeePartPrm,wavesOutFeePartPrm) = { | |
731 | 736 | let checkCaller = thisOnly(i) | |
732 | 737 | if ((checkCaller == checkCaller)) | |
733 | 738 | then if ((size(i.payments) != 0)) | |
734 | 739 | then throw("no payments allowed") | |
735 | 740 | 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(MinTokenSwapAmountKey("WAVES"), minWavesSwapAmountPrm), IntegerEntry(MinNeutrinoSwapAmountKey, minNeutrinoSwapAmountPrm), IntegerEntry(NeutrinoOutFeePartKey, neutrinoOutFeePartPrm), IntegerEntry(WavesOutFeePartKey, wavesOutFeePartPrm)] | |
736 | 741 | else throw("Strict value is not equal to itself.") | |
737 | 742 | } | |
738 | 743 | ||
739 | 744 | ||
740 | 745 | ||
741 | 746 | @Callable(i) | |
742 | 747 | func constructorV2 (mathContract,nsbtStakingContract,swapsTimeframeBlocks) = { | |
743 | 748 | let checkCaller = thisOnly(i) | |
744 | 749 | if ((checkCaller == checkCaller)) | |
745 | 750 | then if ((size(i.payments) != 0)) | |
746 | 751 | then throw("no payments allowed") | |
747 | 752 | else [StringEntry(MathContractKey, mathContract), StringEntry(NsbtStakingContractKey, nsbtStakingContract), IntegerEntry(swapsTimeframeKEY(), swapsTimeframeBlocks)] | |
748 | 753 | else throw("Strict value is not equal to itself.") | |
749 | 754 | } | |
750 | 755 | ||
751 | 756 | ||
752 | 757 | ||
753 | 758 | @Callable(i) | |
754 | 759 | func constructorV3 (assetsWeightsMins,dParam,kParam,bParam,deltaParam) = { | |
755 | 760 | let checkCaller = thisOnly(i) | |
756 | 761 | if ((checkCaller == checkCaller)) | |
757 | 762 | then if ((size(i.payments) != 0)) | |
758 | 763 | then throw("no payments allowed") | |
759 | 764 | else { | |
760 | 765 | func prepare (acc,item) = { | |
761 | 766 | let parts = split(item, "_") | |
762 | 767 | let assetId = parts[0] | |
763 | 768 | let weight = parseIntValue(parts[1]) | |
764 | 769 | let minVal = parseIntValue(parts[2]) | |
765 | 770 | $Tuple2((acc._1 :+ assetId), ((acc._2 :+ IntegerEntry(basketWeightByAssetKey(assetId), weight)) :+ IntegerEntry(MinTokenSwapAmountKey(assetId), minVal))) | |
766 | 771 | } | |
767 | 772 | ||
768 | 773 | let r = { | |
769 | 774 | let $l = assetsWeightsMins | |
770 | 775 | let $s = size($l) | |
771 | 776 | let $acc0 = $Tuple2(nil, nil) | |
772 | 777 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
773 | 778 | then $a | |
774 | 779 | else prepare($a, $l[$i]) | |
775 | 780 | ||
776 | 781 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
777 | 782 | then $a | |
778 | 783 | else throw("List size exceeds 10") | |
779 | 784 | ||
780 | 785 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
781 | 786 | } | |
782 | 787 | (((((r._2 :+ IntegerEntry(basketDKey(), dParam)) :+ IntegerEntry(basketKKey(), kParam)) :+ IntegerEntry(basketBKey(), bParam)) :+ IntegerEntry(basketLogbDeltaKey(), log(deltaParam, 6, bParam, 6, 6, HALFUP))) :+ StringEntry(basketAssetsKey(), makeString(r._1, SEP))) | |
783 | 788 | } | |
784 | 789 | else throw("Strict value is not equal to itself.") | |
785 | 790 | } | |
786 | 791 | ||
787 | 792 | ||
788 | 793 | ||
789 | 794 | @Callable(i) | |
790 | 795 | func swapTokenToNeutrino () = if ((size(i.payments) != 1)) | |
791 | 796 | then throw("swapTokenToNeutrino require only one payment") | |
792 | 797 | else { | |
793 | 798 | let pmt = value(i.payments[0]) | |
794 | 799 | let basketAssets = valueOrElse(getString(basketAssetsKey()), "WAVES") | |
795 | 800 | let pmtAssetIdStr = toBase58String(valueOrElse(pmt.assetId, WAVESID)) | |
796 | 801 | if (!(contains(basketAssets, pmtAssetIdStr))) | |
797 | 802 | then throw(((pmtAssetIdStr + " is not one of basket tokens:") + basketAssets)) | |
798 | 803 | else { | |
799 | 804 | let userAddress = toString(i.caller) | |
800 | 805 | let txId58 = toBase58String(i.transactionId) | |
801 | 806 | commonSwap("outNeutrino", pmt.amount, pmtAssetIdStr, userAddress, txId58) | |
802 | 807 | } | |
803 | 808 | } | |
804 | 809 | ||
805 | 810 | ||
806 | 811 | ||
807 | 812 | @Callable(i) | |
808 | 813 | func swapNeutrinoToBasket () = if ((size(i.payments) != 1)) | |
809 | 814 | then throw("swapNeutrinoToBasket require only one payment") | |
810 | 815 | else { | |
811 | 816 | let pmt = value(i.payments[0]) | |
812 | 817 | if ((pmt.assetId != neutrinoAssetId)) | |
813 | 818 | then throw("Only appropriate Neutrino tokens are allowed for swapping.") | |
814 | 819 | else { | |
815 | 820 | let userAddress = toString(i.caller) | |
816 | 821 | let txId58 = toBase58String(i.transactionId) | |
817 | 822 | commonSwap("outMulti", pmt.amount, toBase58String(neutrinoAssetId), userAddress, txId58) | |
818 | 823 | } | |
819 | 824 | } | |
820 | 825 | ||
821 | 826 | ||
822 | 827 | ||
823 | 828 | @Callable(i) | |
824 | 829 | func withdraw (account,index,swapTxId) = { | |
825 | 830 | let txId = toBase58String(i.transactionId) | |
826 | 831 | if ((size(i.payments) != 0)) | |
827 | 832 | then throw("no payments allowed") | |
828 | 833 | else { | |
829 | 834 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
830 | 835 | let BR = asInt(neutrinoMetrics[nMetricIdxBR]) | |
831 | 836 | let userAddress = addressFromStringValue(account) | |
832 | 837 | let dataArray = swapDataFailOrREAD(account, swapTxId) | |
833 | 838 | let selfUnlockHeight = parseIntValue(dataArray[sIdxSelfUnlockHeight]) | |
834 | 839 | let swapType = dataArray[sIdxSwapType] | |
835 | 840 | let inAmount = parseIntValue(dataArray[sIdxInAmount]) | |
836 | 841 | let swapStatus = dataArray[sIdxStatus] | |
837 | 842 | let startHeight = parseIntValue(dataArray[sIdxStartHeight]) | |
838 | 843 | let inAsset = dataArray[sIdxInAsset] | |
839 | 844 | let totalLocked = totalLockedREAD(swapType, inAsset) | |
840 | 845 | let totalLockedByUser = totalLockedByUserREAD(swapType, account, inAsset) | |
841 | 846 | let unlockHeight = selfUnlockHeight | |
842 | 847 | let indexHeight = getHeightPriceByIndex(index) | |
843 | 848 | let prevIndexHeight = getHeightPriceByIndex((index - 1)) | |
844 | 849 | let priceByIndex = getPriceHistory(indexHeight) | |
845 | 850 | if (isBlocked) | |
846 | 851 | then emergencyShutdownFAIL() | |
847 | 852 | else if ((swapStatus != "PENDING")) | |
848 | 853 | then throw("swap has been already processed") | |
849 | 854 | else if ((unlockHeight > height)) | |
850 | 855 | then throw((("please wait for: " + toString(unlockHeight)) + " block height to withdraw funds")) | |
851 | 856 | else if (if (if ((index > priceIndex)) | |
852 | 857 | then true | |
853 | 858 | else (unlockHeight > indexHeight)) | |
854 | 859 | then true | |
855 | 860 | else if ((prevIndexHeight != 0)) | |
856 | 861 | then (prevIndexHeight >= unlockHeight) | |
857 | 862 | else false) | |
858 | 863 | then priceIndexFAIL(index, priceIndex, indexHeight, unlockHeight, prevIndexHeight) | |
859 | 864 | else { | |
860 | 865 | let withdrawTuple = calcWithdraw(swapType, inAmount, priceByIndex, neutrinoMetrics, inAsset) | |
861 | 866 | let outNetAmount = withdrawTuple._1 | |
862 | 867 | let outAssetId = withdrawTuple._2 | |
863 | 868 | let outSurfAmt = withdrawTuple._3 | |
864 | 869 | let unleaseAmt = withdrawTuple._5 | |
865 | 870 | let outFeeAmount = withdrawTuple._6 | |
866 | 871 | let outAmtGross = withdrawTuple._7 | |
867 | 872 | let withdrawPrice = withdrawTuple._8 | |
868 | 873 | let withdrawBasket = withdrawTuple._9 | |
869 | 874 | if (if ((swapType == "outNeutrino")) | |
870 | 875 | then (0 >= outAmtGross) | |
871 | 876 | else false) | |
872 | 877 | then throw("balance equals zero") | |
873 | 878 | else { | |
874 | 879 | let surfCondition = if ((outSurfAmt > 0)) | |
875 | 880 | then { | |
876 | 881 | let issueResult = invoke(auctionContract, "issueSurf", [outSurfAmt, account], nil) | |
877 | 882 | if ((issueResult == issueResult)) | |
878 | 883 | then 0 | |
879 | 884 | else throw("Strict value is not equal to itself.") | |
880 | 885 | } | |
881 | 886 | else 0 | |
882 | 887 | if ((surfCondition == surfCondition)) | |
883 | 888 | then { | |
884 | 889 | let unleaseInvOrEmpty = invoke(this, "internalUnleaseAndLease", [unleaseAmt], nil) | |
885 | 890 | if ((unleaseInvOrEmpty == unleaseInvOrEmpty)) | |
886 | 891 | then { | |
887 | 892 | let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", ["", 0, 0], nil)) | |
888 | 893 | let gnsbtAmtTotal = asInt(gnsbtData[1]) | |
889 | 894 | let gnsbtAmtFromSurfTotal = asInt(asAnyList(gnsbtData[3])[3]) | |
890 | 895 | let commonActions = [IntegerEntry(totalLockedByUserKEY(swapType, account, inAsset), (totalLockedByUser - inAmount)), IntegerEntry(totalLockedKEY(swapType, inAsset), (totalLocked - inAmount)), StringEntry(swapKEY(account, swapTxId), finishSwapDATA(dataArray, withdrawPrice, outNetAmount, outFeeAmount, unlockHeight, index, txId, outSurfAmt, BR, withdrawBasket, inAsset))] | |
891 | - | if ((swapType == "outMulti")) | |
896 | + | func deposits (surfFees,nsbtFees,surfPayments,nsbtPayments) = { | |
897 | + | let surfDeposit = if ((surfFees > 0)) | |
898 | + | then asInt(invoke(surfStakingContract, "deposit", nil, surfPayments)) | |
899 | + | else 0 | |
900 | + | let nsbtDeposit = if ((nsbtFees > 0)) | |
901 | + | then asInt(invoke(nsbtStakingContract, "deposit", nil, nsbtPayments)) | |
902 | + | else 0 | |
903 | + | (surfDeposit + nsbtDeposit) | |
904 | + | } | |
905 | + | ||
906 | + | func divideFees (feeAmount) = { | |
907 | + | let surfAmt1 = if ((gnsbtAmtTotal != 0)) | |
908 | + | then fraction(feeAmount, gnsbtAmtFromSurfTotal, gnsbtAmtTotal) | |
909 | + | else 0 | |
910 | + | let surfAmt2 = if ((gnsbtAmtTotal != 0)) | |
911 | + | then fraction(feeAmount, (MULT6 - BR), MULT6) | |
912 | + | else 0 | |
913 | + | let surfAmt = max([surfAmt1, surfAmt2]) | |
914 | + | let nsbtAmt = (feeAmount - surfAmt) | |
915 | + | [surfAmt, nsbtAmt] | |
916 | + | } | |
917 | + | ||
918 | + | let transfers = if ((swapType == "outMulti")) | |
892 | 919 | then { | |
893 | - | let basket = split(withdrawBasket, "_") | |
920 | + | let basket = split_4C(withdrawBasket, "_") | |
894 | 921 | func looper (acc,item) = { | |
895 | 922 | let it = split(item, LISTSEP) | |
896 | 923 | let tempAssetId = fromBase58String(it[0]) | |
897 | 924 | let assetId = if ((tempAssetId == WAVESID)) | |
898 | 925 | then unit | |
899 | 926 | else tempAssetId | |
900 | 927 | let netAmount = parseIntValue(it[2]) | |
901 | 928 | let feeAmount = parseIntValue(it[3]) | |
902 | - | let surfAmt1 = if ((gnsbtAmtTotal != 0)) | |
903 | - | then fraction(feeAmount, gnsbtAmtFromSurfTotal, gnsbtAmtTotal) | |
904 | - | else 0 | |
905 | - | let surfAmt2 = if ((gnsbtAmtTotal != 0)) | |
906 | - | then fraction(feeAmount, (MULT6 - BR), MULT6) | |
907 | - | else 0 | |
908 | - | let surfAmt = max([surfAmt1, surfAmt2]) | |
909 | - | let nsbtAmt = (feeAmount - surfAmt) | |
910 | - | $Tuple5((acc._1 :+ ScriptTransfer(userAddress, netAmount, assetId)), (acc._2 :+ AttachedPayment(assetId, surfAmt)), (acc._3 :+ AttachedPayment(assetId, nsbtAmt)), (acc._4 + surfAmt), (acc._5 + nsbtAmt)) | |
929 | + | let fees = divideFees(feeAmount) | |
930 | + | $Tuple5((acc._1 :+ ScriptTransfer(userAddress, netAmount, assetId)), (acc._2 :+ AttachedPayment(assetId, fees[0])), (acc._3 :+ AttachedPayment(assetId, fees[1])), (acc._4 + fees[0]), (acc._5 + fees[1])) | |
911 | 931 | } | |
912 | 932 | ||
913 | 933 | let r = { | |
914 | 934 | let $l = basket | |
915 | 935 | let $s = size($l) | |
916 | 936 | let $acc0 = $Tuple5(nil, nil, nil, 0, 0) | |
917 | 937 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
918 | 938 | then $a | |
919 | 939 | else looper($a, $l[$i]) | |
920 | 940 | ||
921 | 941 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
922 | 942 | then $a | |
923 | 943 | else throw("List size exceeds 10") | |
924 | 944 | ||
925 | 945 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
926 | 946 | } | |
927 | - | let surfDeposit = if ((r._4 > 0)) | |
928 | - | then { | |
929 | - | let surfInv = invoke(surfStakingContract, "deposit", nil, r._2) | |
930 | - | if ((surfInv == surfInv)) | |
931 | - | then 0 | |
932 | - | else throw("Strict value is not equal to itself.") | |
933 | - | } | |
934 | - | else 0 | |
935 | - | if ((surfDeposit == surfDeposit)) | |
936 | - | then { | |
937 | - | let nsbtDeposit = if ((r._5 > 0)) | |
938 | - | then { | |
939 | - | let nsbtInv = invoke(nsbtStakingContract, "deposit", nil, r._3) | |
940 | - | if ((nsbtInv == nsbtInv)) | |
941 | - | then 0 | |
942 | - | else throw("Strict value is not equal to itself.") | |
943 | - | } | |
944 | - | else 0 | |
945 | - | if ((nsbtDeposit == nsbtDeposit)) | |
946 | - | then (commonActions ++ r._1) | |
947 | - | else throw("Strict value is not equal to itself.") | |
948 | - | } | |
949 | - | else throw("Strict value is not equal to itself.") | |
947 | + | let depoResult = deposits(r._4, r._5, r._2, r._3) | |
948 | + | $Tuple2(r._1, depoResult) | |
950 | 949 | } | |
951 | 950 | else { | |
952 | - | let fee = AttachedPayment(outAssetId, outFeeAmount) | |
953 | - | let surfFeeAmt1 = if ((gnsbtAmtTotal != 0)) | |
954 | - | then fraction(fee.amount, gnsbtAmtFromSurfTotal, gnsbtAmtTotal) | |
955 | - | else 0 | |
956 | - | let surfFeeAmt2 = if ((gnsbtAmtTotal != 0)) | |
957 | - | then fraction(fee.amount, (MULT6 - BR), MULT6) | |
958 | - | else 0 | |
959 | - | let surfFeeAmt = max([surfFeeAmt1, surfFeeAmt2]) | |
960 | - | let nsbtFeeAmt = (fee.amount - surfFeeAmt) | |
961 | - | let surfDeposit = if ((surfFeeAmt > 0)) | |
962 | - | then { | |
963 | - | let surfInv = invoke(surfStakingContract, "deposit", nil, [AttachedPayment(fee.assetId, surfFeeAmt)]) | |
964 | - | if ((surfInv == surfInv)) | |
965 | - | then nil | |
966 | - | else throw("Strict value is not equal to itself.") | |
967 | - | } | |
968 | - | else nil | |
969 | - | if ((surfDeposit == surfDeposit)) | |
970 | - | then { | |
971 | - | let nsbtDeposit = if ((nsbtFeeAmt > 0)) | |
972 | - | then { | |
973 | - | let nsbtInv = invoke(nsbtStakingContract, "deposit", nil, [AttachedPayment(fee.assetId, nsbtFeeAmt)]) | |
974 | - | if ((nsbtInv == nsbtInv)) | |
975 | - | then nil | |
976 | - | else throw("Strict value is not equal to itself.") | |
977 | - | } | |
978 | - | else nil | |
979 | - | if ((nsbtDeposit == nsbtDeposit)) | |
980 | - | then (commonActions :+ ScriptTransfer(userAddress, outNetAmount, outAssetId)) | |
981 | - | else throw("Strict value is not equal to itself.") | |
982 | - | } | |
983 | - | else throw("Strict value is not equal to itself.") | |
951 | + | let fees = divideFees(outFeeAmount) | |
952 | + | let depoResult = deposits(fees[0], fees[1], [AttachedPayment(outAssetId, fees[0])], [AttachedPayment(outAssetId, fees[1])]) | |
953 | + | $Tuple2([ScriptTransfer(userAddress, outNetAmount, outAssetId)], depoResult) | |
984 | 954 | } | |
955 | + | $Tuple2((commonActions ++ transfers._1), transfers._2) | |
985 | 956 | } | |
986 | 957 | else throw("Strict value is not equal to itself.") | |
987 | 958 | } | |
988 | 959 | else throw("Strict value is not equal to itself.") | |
989 | 960 | } | |
990 | 961 | } | |
991 | 962 | } | |
992 | 963 | } | |
993 | 964 | ||
994 | 965 | ||
995 | 966 | ||
996 | 967 | @Callable(i) | |
997 | 968 | func internalUnleaseAndLease (unleaseAmount) = if ((i.caller != this)) | |
998 | 969 | then throw("internalUnleaseAndLease is not public method") | |
999 | 970 | else prepareUnleaseAndLease(unleaseAmount) | |
1000 | 971 | ||
1001 | 972 | ||
1002 | 973 | ||
1003 | 974 | @Callable(i) | |
1004 | 975 | func transferUsdnToUser (amount,addr) = if ((i.caller != auctionContract)) | |
1005 | 976 | then throw("Only auction contract is authorized") | |
1006 | 977 | else [ScriptTransfer(addressFromStringValue(addr), amount, neutrinoAssetId)] | |
1007 | 978 | ||
1008 | 979 | ||
1009 | 980 | ||
1010 | 981 | @Callable(i) | |
1011 | 982 | func acceptWaves () = if (if ((i.caller != auctionContract)) | |
1012 | 983 | then (i.caller != govContract) | |
1013 | 984 | else false) | |
1014 | 985 | then throw("Currently only auction and governance contracts are allowed to call") | |
1015 | 986 | else $Tuple2(prepareUnleaseAndLease(0), "success") | |
1016 | 987 | ||
1017 | 988 | ||
1018 | 989 | ||
1019 | 990 | @Callable(i) | |
1020 | 991 | func approveLeasings (nListS,groupNum,lAmt) = { | |
1021 | 992 | let nIdxs = [0, 1, 2, 3, 4, 5, 6, 7] | |
1022 | 993 | let mngPubS = valueOrElse(getString("%s%s__cfg__leasingManagerPub"), "7AUMX54ukYMYvPmma7yoFf5NjZhs4Bu5nz3Ez9EV8sur") | |
1023 | 994 | let mngPub = fromBase58String(mngPubS) | |
1024 | 995 | let nodeRegAddrStr = valueOrElse(getString("%s%s__cfg__nodesRegistryAddress"), "3P9vKqQKjUdmpXAfiWau8krREYAY1Xr69pE") | |
1025 | 996 | let nodeRegAddr = addressFromStringValue(nodeRegAddrStr) | |
1026 | 997 | let lGroupNodeListKEY = getLeaseGroupNodeListKey(groupNum) | |
1027 | 998 | let lGrNodeOpt = getString(this, lGroupNodeListKEY) | |
1028 | 999 | if (isDefined(lGrNodeOpt)) | |
1029 | 1000 | then throw((("group " + toString(groupNum)) + " already initialized")) | |
1030 | 1001 | else { | |
1031 | 1002 | let nList = split(nListS, SEP) | |
1032 | 1003 | let expCount = size(nIdxs) | |
1033 | 1004 | if ((i.callerPublicKey != mngPub)) | |
1034 | 1005 | then throw("approveLeasings not authorized") | |
1035 | 1006 | else { | |
1036 | - | let $ | |
1037 | - | let nAddr0 = $ | |
1038 | - | let lAmtKEY0 = $ | |
1039 | - | let lAmt0 = $ | |
1040 | - | let lIdKEY0 = $ | |
1041 | - | let lId0 = $ | |
1007 | + | let $t04360243664 = readNodeInfo(0) | |
1008 | + | let nAddr0 = $t04360243664._1 | |
1009 | + | let lAmtKEY0 = $t04360243664._2 | |
1010 | + | let lAmt0 = $t04360243664._3 | |
1011 | + | let lIdKEY0 = $t04360243664._4 | |
1012 | + | let lId0 = $t04360243664._5 | |
1042 | 1013 | let newL0 = Lease(nAddr0, (lAmt0 - (lAmt * expCount))) | |
1043 | 1014 | let validation = invoke(nodeRegAddr, "validateAndApproveLeasings", [nListS], nil) | |
1044 | 1015 | if ((validation == validation)) | |
1045 | 1016 | then { | |
1046 | 1017 | func forEachNodeValidateAndGenerateLease (a,i) = { | |
1047 | 1018 | let node = nList[i] | |
1048 | 1019 | let la = Lease(addressFromStringValue(node), lAmt) | |
1049 | 1020 | (a ++ [la, BinaryEntry(getLeaseIdByAddressKey(node), lcalc(la)), IntegerEntry(getLeaseAmountByAddressKey(node), lAmt)]) | |
1050 | 1021 | } | |
1051 | 1022 | ||
1052 | 1023 | ([StringEntry(lGroupNodeListKEY, nListS), BinaryEntry(lIdKEY0, lcalc(newL0)), IntegerEntry(lAmtKEY0, newL0.amount), LeaseCancel(lId0), newL0] ++ { | |
1053 | 1024 | let $l = nIdxs | |
1054 | 1025 | let $s = size($l) | |
1055 | 1026 | let $acc0 = nil | |
1056 | 1027 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1057 | 1028 | then $a | |
1058 | 1029 | else forEachNodeValidateAndGenerateLease($a, $l[$i]) | |
1059 | 1030 | ||
1060 | 1031 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1061 | 1032 | then $a | |
1062 | 1033 | else throw("List size exceeds 8") | |
1063 | 1034 | ||
1064 | 1035 | $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) | |
1065 | 1036 | }) | |
1066 | 1037 | } | |
1067 | 1038 | else throw("Strict value is not equal to itself.") | |
1068 | 1039 | } | |
1069 | 1040 | } | |
1070 | 1041 | } | |
1071 | 1042 | ||
1072 | 1043 | ||
1073 | 1044 | ||
1074 | 1045 | @Callable(i) | |
1075 | 1046 | func rebalanceLeasings (amount,groupNum) = { | |
1076 | 1047 | let nIdxs = [0, 1, 2, 3, 4, 5, 6, 7] | |
1077 | 1048 | let mngPubS = valueOrElse(getString("%s%s__cfg__leasingManagerPub"), "7AUMX54ukYMYvPmma7yoFf5NjZhs4Bu5nz3Ez9EV8sur") | |
1078 | 1049 | let mngPub = fromBase58String(mngPubS) | |
1079 | 1050 | let lGroupNodeListKEY = getLeaseGroupNodeListKey(groupNum) | |
1080 | 1051 | let nListS = getStringOrFail(this, lGroupNodeListKEY) | |
1081 | 1052 | let nList = split(nListS, SEP) | |
1082 | 1053 | if ((i.callerPublicKey != mngPub)) | |
1083 | 1054 | then throw("rebalanceLeasings not authorized") | |
1084 | 1055 | else { | |
1085 | 1056 | let unleaseAmt = ((amount / size(nList)) + 1) | |
1086 | - | let $ | |
1087 | - | let nAddr0 = $ | |
1088 | - | let lAmtKEY0 = $ | |
1089 | - | let lAmt0 = $ | |
1090 | - | let lIdKEY0 = $ | |
1091 | - | let lId0 = $ | |
1057 | + | let $t04490444966 = readNodeInfo(0) | |
1058 | + | let nAddr0 = $t04490444966._1 | |
1059 | + | let lAmtKEY0 = $t04490444966._2 | |
1060 | + | let lAmt0 = $t04490444966._3 | |
1061 | + | let lIdKEY0 = $t04490444966._4 | |
1062 | + | let lId0 = $t04490444966._5 | |
1092 | 1063 | let newL0 = Lease(nAddr0, (lAmt0 + (unleaseAmt * size(nList)))) | |
1093 | 1064 | func forEachNodeDoUnlease (a,i) = { | |
1094 | 1065 | let node = nList[i] | |
1095 | 1066 | let lIdKEY = getLeaseIdByAddressKey(node) | |
1096 | 1067 | let lId = getBinaryValue(this, lIdKEY) | |
1097 | 1068 | let lAmtKEY = getLeaseAmountByAddressKey(node) | |
1098 | 1069 | let lAmt = getIntegerValue(this, lAmtKEY) | |
1099 | 1070 | let ula = LeaseCancel(value(lId)) | |
1100 | 1071 | let la = Lease(addressFromStringValue(node), (lAmt - unleaseAmt)) | |
1101 | 1072 | (a ++ [LeaseCancel(value(lId)), la, BinaryEntry(lIdKEY, lcalc(la)), IntegerEntry(lAmtKEY, la.amount)]) | |
1102 | 1073 | } | |
1103 | 1074 | ||
1104 | 1075 | ({ | |
1105 | 1076 | let $l = nIdxs | |
1106 | 1077 | let $s = size($l) | |
1107 | 1078 | let $acc0 = nil | |
1108 | 1079 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1109 | 1080 | then $a | |
1110 | 1081 | else forEachNodeDoUnlease($a, $l[$i]) | |
1111 | 1082 | ||
1112 | 1083 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1113 | 1084 | then $a | |
1114 | 1085 | else throw("List size exceeds 8") | |
1115 | 1086 | ||
1116 | 1087 | $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) | |
1117 | 1088 | } ++ [BinaryEntry(lIdKEY0, lcalc(newL0)), IntegerEntry(lAmtKEY0, newL0.amount), LeaseCancel(lId0), newL0]) | |
1118 | 1089 | } | |
1119 | 1090 | } | |
1120 | 1091 | ||
1121 | 1092 | ||
1122 | 1093 | ||
1123 | 1094 | @Callable(i) | |
1124 | 1095 | func swapParamsByUserSYSREADONLY (userAddressStr,gnsbtDiff) = { | |
1125 | 1096 | let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStr, 0, 0], nil)) | |
1126 | 1097 | let gnsbtAmt = (asInt(gnsbtData[0]) + gnsbtDiff) | |
1127 | 1098 | let gnsbtAmtTotal = (asInt(gnsbtData[1]) + gnsbtDiff) | |
1128 | 1099 | let swapLimitData = asAnyList(invoke(mathContract, "calcSwapLimitREADONLY", [gnsbtAmt], nil)) | |
1129 | - | let wavesSwapLimitInUsdnMax = asInt(swapLimitData[0]) | |
1130 | - | let wavesSwapLimitMax = asInt(swapLimitData[1]) | |
1100 | + | let tokenSwapLimitInUsdMax = asInt(swapLimitData[0]) | |
1131 | 1101 | let usdnSwapLimitMax = asInt(swapLimitData[2]) | |
1132 | 1102 | let lastSwapHeight = valueOrElse(getInteger(this, keyUserLastSwapHeight(userAddressStr)), 0) | |
1133 | 1103 | let swapLimitTimelifeBlocks = swapsTimeframeREAD() | |
1134 | 1104 | let passedBlocksAfterLastSwap = (height - lastSwapHeight) | |
1135 | 1105 | let isSwapTimelifeNew = (passedBlocksAfterLastSwap >= swapLimitTimelifeBlocks) | |
1136 | 1106 | let swapLimitSpentInUsdn = if (isSwapTimelifeNew) | |
1137 | 1107 | then 0 | |
1138 | 1108 | else valueOrElse(getInteger(this, keySwapUserSpentInPeriod(userAddressStr)), 0) | |
1139 | 1109 | let blcks2LmtReset = if (isSwapTimelifeNew) | |
1140 | 1110 | then 0 | |
1141 | 1111 | else (swapLimitTimelifeBlocks - passedBlocksAfterLastSwap) | |
1142 | - | $Tuple2(nil, $Tuple7( | |
1112 | + | $Tuple2(nil, $Tuple7(tokenSwapLimitInUsdMax, swapLimitSpentInUsdn, blcks2LmtReset, gnsbtAmt, gnsbtAmtTotal, 0, usdnSwapLimitMax)) | |
1143 | 1113 | } | |
1144 | 1114 | ||
1145 | 1115 | ||
1146 | 1116 | ||
1147 | 1117 | @Callable(i) | |
1148 | 1118 | func calcWithdrawResultSYSREADONLY (swapType,inAmount,price,inAsset) = { | |
1149 | 1119 | let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
1150 | 1120 | $Tuple2(nil, calcWithdraw(swapType, inAmount, price, neutrinoMetrics, inAsset)) | |
1151 | 1121 | } | |
1152 | 1122 | ||
1153 | 1123 | ||
1154 | 1124 | ||
1155 | 1125 | @Callable(i) | |
1156 | 1126 | func replaceCommunityNode (oldAddrStr,newAddrStr,groupNum,penaltyAmount) = { | |
1157 | 1127 | let mngPubS = valueOrElse(getString("%s%s__cfg__leasingManagerPub"), "7AUMX54ukYMYvPmma7yoFf5NjZhs4Bu5nz3Ez9EV8sur") | |
1158 | 1128 | let mngPub = fromBase58String(mngPubS) | |
1159 | 1129 | if ((i.callerPublicKey != mngPub)) | |
1160 | 1130 | then throw("replaceCommunityNode not authorized") | |
1161 | 1131 | else { | |
1162 | 1132 | let groupKey = getLeaseGroupNodeListKey(groupNum) | |
1163 | 1133 | let groupNodeListS = getStringOrFail(this, groupKey) | |
1164 | 1134 | if (!(contains(groupNodeListS, oldAddrStr))) | |
1165 | 1135 | then throw(((("Group " + toString(groupNum)) + " does not contain address ") + oldAddrStr)) | |
1166 | 1136 | else { | |
1167 | 1137 | let doReplace = invoke(nodeRegistryContract, "replaceApprovedNode", [oldAddrStr, newAddrStr, groupNum, penaltyAmount], nil) | |
1168 | 1138 | if ((doReplace == doReplace)) | |
1169 | 1139 | then { | |
1170 | 1140 | let oldLeaseIdKey = getLeaseIdByAddressKey(oldAddrStr) | |
1171 | 1141 | let oldLeaseAmtKey = getLeaseAmountByAddressKey(oldAddrStr) | |
1172 | 1142 | let leaseAmt = getIntegerValue(oldLeaseAmtKey) | |
1173 | 1143 | let newLeaseIdKey = getLeaseIdByAddressKey(newAddrStr) | |
1174 | 1144 | let newLeaseAmtKey = getLeaseAmountByAddressKey(newAddrStr) | |
1175 | 1145 | let newLease = Lease(addressFromStringValue(newAddrStr), leaseAmt) | |
1176 | 1146 | let updatedGroupNodeListS = makeString(split(groupNodeListS, oldAddrStr), newAddrStr) | |
1177 | 1147 | $Tuple2([LeaseCancel(getBinaryValue(oldLeaseIdKey)), DeleteEntry(oldLeaseIdKey), DeleteEntry(oldLeaseAmtKey), StringEntry(groupKey, updatedGroupNodeListS), newLease, BinaryEntry(newLeaseIdKey, lcalc(newLease)), IntegerEntry(newLeaseAmtKey, leaseAmt)], unit) | |
1178 | 1148 | } | |
1179 | 1149 | else throw("Strict value is not equal to itself.") | |
1180 | 1150 | } | |
1181 | 1151 | } | |
1182 | 1152 | } | |
1183 | 1153 | ||
1184 | 1154 | ||
1185 | - | ||
1186 | - | @Callable(i) | |
1187 | - | func updateReservesAndNeutrinoSupply () = { | |
1188 | - | func getNumberByKeyInternal (key) = match getInteger(this, key) { | |
1189 | - | case a: Int => | |
1190 | - | a | |
1191 | - | case _ => | |
1192 | - | 0 | |
1193 | - | } | |
1194 | - | ||
1195 | - | let nMetrix = asAnyList(invoke(mathContract, "calcNeutinoMetricsREADONLY", nil, nil)) | |
1196 | - | let idx = getNumberByKeyInternal("updateReservesAndNeutrinoSupplyIdx") | |
1197 | - | let newIdx = (idx + 1) | |
1198 | - | [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])))] | |
1199 | - | } | |
1200 | - | ||
1201 | - | ||
1202 | - | ||
1203 | - | @Callable(i) | |
1204 | - | func wavesBalancesVsPayment () = { | |
1205 | - | let b = wavesBalance(this) | |
1206 | - | [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)] | |
1207 | - | } | |
1208 | - | ||
1209 | - | ||
1210 | 1155 | @Verifier(tx) | |
1211 | 1156 | func verify () = { | |
1212 | 1157 | let pubKeyAdminsListStr = makeString(["ExtEEK19nmKj9mCpnWyvEEJFYATLMcVEMvohhUHkyHNm", "Ev5py5FfBQX9cZpYKnfQrTB49Byf8QmpZWeDVRim4yV7", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR"], SEP) | |
1213 | 1158 | let pubKeyAdminsList = split(valueOrElse(getString(controlContract, "%s__multisig"), pubKeyAdminsListStr), SEP) | |
1214 | 1159 | let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0]))) | |
1215 | 1160 | then 1 | |
1216 | 1161 | else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1]))) | |
1217 | 1162 | then 1 | |
1218 | 1163 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2]))) | |
1219 | 1164 | then 1 | |
1220 | 1165 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3]))) | |
1221 | 1166 | then 2 | |
1222 | 1167 | else 0)) | |
1223 | 1168 | if (if (isBlocked) | |
1224 | 1169 | then (getStringValue(controlContract, "is_blocked_caller") == toString(govContract)) | |
1225 | 1170 | else false) | |
1226 | 1171 | then validateUpdate(tx) | |
1227 | 1172 | else match tx { | |
1228 | 1173 | case sponsorTx: SponsorFeeTransaction => | |
1229 | 1174 | if (checkIsValidMinSponsoredFee(sponsorTx)) | |
1230 | 1175 | then (count >= 3) | |
1231 | 1176 | else false | |
1232 | 1177 | case _ => | |
1233 | 1178 | (count >= 3) | |
1234 | 1179 | } | |
1235 | 1180 | } | |
1236 | 1181 |
github/deemru/w8io/026f985 158.93 ms ◑