tx · Ababeg6eX7cGUCHRcPd1hWwfjVgDySz4xjM24KDWgnDT 3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT: -0.04300000 Waves 2024.07.10 11:15 [3187675] smart account 3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT > SELF 0.00000000 Waves
{ "type": 13, "id": "Ababeg6eX7cGUCHRcPd1hWwfjVgDySz4xjM24KDWgnDT", "fee": 4300000, "feeAssetId": null, "timestamp": 1720599356767, "version": 2, "chainId": 84, "sender": "3N7b3kPunHUXhZp1vMG9NhPMARNEprCMWxT", "senderPublicKey": "AYbpHveq7zviKTDV7SGTB1pZGFbkumgfq3jSwVv6BznT", "proofs": [ "5h3fj82zkLYdB26Yvo2vsnYGBh1Lo3dkFogFMy4zsYmUDJMt7EHbKsEoaDhwXAs5L48gC6eSqp3inKjoZKAmqYFg" ], "script": "base64:BgLWOAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXNzZXRJZCIQaWR4S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AUCZWYCXzgEAmR6CQENcGFyc2VJbnRWYWx1ZQEIBQJlZgJfOQkAlAoCBQNuaWwJALkJAgkAzAgCAg4lZCVkJWQlZCVkJWQlZAkAzAgCCQCkAwEFAmRMCQDMCAIJAKQDAQUCZE0JAMwIAgkApAMBBQJkQgkAzAgCCQCkAwEFAmRECQDMCAIJAKQDAQUCZEEJAMwIAgkApgMBBQJkRwkAzAgCCQCkAwEFAmR6BQNuaWwFAWoBAmlsAQJpbQAEAmluBAJhUAkBAmdxAAMJAAECBQJhUAIKQnl0ZVZlY3RvcgQCZ3QFAmFQBQJndAMJAAECBQJhUAIEVW5pdAgFAmlsD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yBAJhUAUCaWwDCQABAgUCYVACBU9yZGVyBAJlUgUCYVAEAmlvCQECYmsABAJpcAMJAQJlTgAJAJQKAgYCAAkBAmVRAQUCZVIEAmFLCAUCaXACXzEEAmFMCAUCaXACXzIEAmFNCQD0AwMIBQJlUglib2R5Qnl0ZXMJAJEDAggFAmVSBnByb29mcwABBQJpbwMDBQJhSwUCYU0HBgkBAmFKAwUCYUsFAmFMBQJhTQMJAAECBQJhUAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAmFVBQJhUAMJAPQDAwgFAmlsCWJvZHlCeXRlcwkAkQMCCAUCaWwGcHJvb2ZzAAAFAmluBgQCaXEJAPYDAQkBBXZhbHVlAQgFAmFVBnNjcmlwdAQCaXIJANsEAQkBBXZhbHVlAQkAnQgCBQJiYwkBAmFGAAQCaXMJAPEHAQUEdGhpcwMJAAACBQJpcgUCaXEJAQIhPQIFAmlzBQJpcQcJAPQDAwgFAmlsCWJvZHlCeXRlcwkAkQMCCAUCaWwGcHJvb2ZzAAAFAmluoXX8uA==", "height": 3187675, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6a9iRFpjiz3iQTxB28o4RYihZ6HnnDmgtEiWSCQhNT43 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
171 | 171 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
172 | 172 | ||
173 | 173 | ||
174 | - | func throwOrderError (orderValid,orderValidInfo, | |
174 | + | func throwOrderError (orderValid,orderValidInfo,matcherValid) = throw((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " matcherValid=") + toString(matcherValid))) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func addressFromStringOrThis (addressString) = match addressFromString(addressString) { | |
264 | 264 | ||
265 | 265 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
266 | 266 | ||
267 | - | let $ | |
267 | + | let $t097029868 = poolConfigParsed | |
268 | 268 | ||
269 | - | let cfgPoolAddress = $ | |
269 | + | let cfgPoolAddress = $t097029868._1 | |
270 | 270 | ||
271 | - | let cfgPoolStatus = $ | |
271 | + | let cfgPoolStatus = $t097029868._2 | |
272 | 272 | ||
273 | - | let cfgLpAssetId = $ | |
273 | + | let cfgLpAssetId = $t097029868._3 | |
274 | 274 | ||
275 | - | let cfgAmountAssetId = $ | |
275 | + | let cfgAmountAssetId = $t097029868._4 | |
276 | 276 | ||
277 | - | let cfgPriceAssetId = $ | |
277 | + | let cfgPriceAssetId = $t097029868._5 | |
278 | 278 | ||
279 | - | let cfgAmountAssetDecimals = $ | |
279 | + | let cfgAmountAssetDecimals = $t097029868._6 | |
280 | 280 | ||
281 | - | let cfgPriceAssetDecimals = $ | |
281 | + | let cfgPriceAssetDecimals = $t097029868._7 | |
282 | 282 | ||
283 | 283 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
284 | 284 | ||
429 | 429 | ||
430 | 430 | ||
431 | 431 | func rebalanceAsset (assetId) = { | |
432 | - | let $ | |
433 | - | let isLeasable = $ | |
434 | - | let leasedRatio = $ | |
435 | - | let minBalance = $ | |
436 | - | let proxyAddress = $ | |
437 | - | let proxyAssetId = $ | |
438 | - | let proxyRateMul = $ | |
439 | - | let stakingProfitAddress = $ | |
432 | + | let $t01615316289 = getLeaseProxyConfig(assetId) | |
433 | + | let isLeasable = $t01615316289._1 | |
434 | + | let leasedRatio = $t01615316289._2 | |
435 | + | let minBalance = $t01615316289._3 | |
436 | + | let proxyAddress = $t01615316289._4 | |
437 | + | let proxyAssetId = $t01615316289._5 | |
438 | + | let proxyRateMul = $t01615316289._6 | |
439 | + | let stakingProfitAddress = $t01615316289._7 | |
440 | 440 | if (isLeasable) | |
441 | 441 | then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress)) | |
442 | 442 | else nil | |
444 | 444 | ||
445 | 445 | ||
446 | 446 | func withdrawAndRebalanceAsset (assetId,getAmount) = { | |
447 | - | let $ | |
448 | - | let isLeasable = $ | |
449 | - | let leasedRatio = $ | |
450 | - | let minBalance = $ | |
451 | - | let proxyAddress = $ | |
452 | - | let proxyAssetId = $ | |
453 | - | let proxyRateMul = $ | |
454 | - | let stakingProfitAddress = $ | |
447 | + | let $t01668816824 = getLeaseProxyConfig(assetId) | |
448 | + | let isLeasable = $t01668816824._1 | |
449 | + | let leasedRatio = $t01668816824._2 | |
450 | + | let minBalance = $t01668816824._3 | |
451 | + | let proxyAddress = $t01668816824._4 | |
452 | + | let proxyAssetId = $t01668816824._5 | |
453 | + | let proxyRateMul = $t01668816824._6 | |
454 | + | let stakingProfitAddress = $t01668816824._7 | |
455 | 455 | if (isLeasable) | |
456 | 456 | then { | |
457 | 457 | let currentStakingAssetBalance = getStakingAssetBalanceOrZero(proxyAssetId) | |
678 | 678 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
679 | 679 | let amountAssetAmount = order.amount | |
680 | 680 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
681 | - | let $ | |
681 | + | let $t02945029662 = if ((order.orderType == Buy)) | |
682 | 682 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
683 | 683 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
684 | - | let amountAssetBalanceDelta = $ | |
685 | - | let priceAssetBalanceDelta = $ | |
684 | + | let amountAssetBalanceDelta = $t02945029662._1 | |
685 | + | let priceAssetBalanceDelta = $t02945029662._2 | |
686 | 686 | if (if (if (isGlobalShutdown()) | |
687 | 687 | then true | |
688 | 688 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
695 | 695 | then throw("Wrong order assets.") | |
696 | 696 | else { | |
697 | 697 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
698 | - | let $ | |
699 | - | let unusedActions = $ | |
700 | - | let kLpNew = $ | |
698 | + | let $t03010230202 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
699 | + | let unusedActions = $t03010230202._1 | |
700 | + | let kLpNew = $t03010230202._2 | |
701 | 701 | let isOrderValid = (kLpNew >= kLp) | |
702 | 702 | let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
703 | 703 | $Tuple2(isOrderValid, info) | |
780 | 780 | else if ((paymentAssetId == cfgPriceAssetId)) | |
781 | 781 | then false | |
782 | 782 | else throwErr("invalid asset") | |
783 | - | let $ | |
783 | + | let $t03338833681 = if (isEval) | |
784 | 784 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
785 | 785 | else if (paymentInAmountAsset) | |
786 | 786 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
787 | 787 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
788 | - | let amountBalanceOld = $ | |
789 | - | let priceBalanceOld = $ | |
790 | - | let $ | |
788 | + | let amountBalanceOld = $t03338833681._1 | |
789 | + | let priceBalanceOld = $t03338833681._2 | |
790 | + | let $t03368533834 = if (paymentInAmountAsset) | |
791 | 791 | then $Tuple2(paymentAmountRaw, 0) | |
792 | 792 | else $Tuple2(0, paymentAmountRaw) | |
793 | - | let amountAssetAmountRaw = $ | |
794 | - | let priceAssetAmountRaw = $ | |
793 | + | let amountAssetAmountRaw = $t03368533834._1 | |
794 | + | let priceAssetAmountRaw = $t03368533834._2 | |
795 | 795 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
796 | 796 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
797 | - | let $ | |
798 | - | let paymentAmount = $ | |
799 | - | let feeAmount = $ | |
797 | + | let $t03396634030 = takeFee(paymentAmountRaw, inFee) | |
798 | + | let paymentAmount = $t03396634030._1 | |
799 | + | let feeAmount = $t03396634030._2 | |
800 | 800 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
801 | 801 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
802 | 802 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
819 | 819 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
820 | 820 | let priceOld = fromX18(priceOldX18, scale8) | |
821 | 821 | let loss = { | |
822 | - | let $ | |
822 | + | let $t03571135878 = if (paymentInAmountAsset) | |
823 | 823 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
824 | 824 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
825 | - | let amount = $ | |
826 | - | let balance = $ | |
825 | + | let amount = $t03571135878._1 | |
826 | + | let balance = $t03571135878._2 | |
827 | 827 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
828 | 828 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
829 | 829 | } | |
863 | 863 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
864 | 864 | let redeemedBigInt = toBigInt(paymentAmount) | |
865 | 865 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
866 | - | let $ | |
867 | - | let totalAmount = $ | |
868 | - | let feeAmount = $ | |
869 | - | let $ | |
866 | + | let $t03795638012 = takeFee(amountRaw, outFee) | |
867 | + | let totalAmount = $t03795638012._1 | |
868 | + | let feeAmount = $t03795638012._2 | |
869 | + | let $t03801638242 = if (outInAmountAsset) | |
870 | 870 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
871 | 871 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
872 | - | let outAmAmount = $ | |
873 | - | let outPrAmount = $ | |
874 | - | let amBalanceNew = $ | |
875 | - | let prBalanceNew = $ | |
872 | + | let outAmAmount = $t03801638242._1 | |
873 | + | let outPrAmount = $t03801638242._2 | |
874 | + | let amBalanceNew = $t03801638242._3 | |
875 | + | let prBalanceNew = $t03801638242._4 | |
876 | 876 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
877 | 877 | let priceNew = fromX18(priceNewX18, scale8) | |
878 | 878 | let commonState = if (isEval) | |
937 | 937 | ||
938 | 938 | @Callable(i) | |
939 | 939 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
940 | - | let $ | |
940 | + | let $t04010040405 = if ((isReverse == false)) | |
941 | 941 | then { | |
942 | 942 | let assetOut = getStringOrFail(this, pa()) | |
943 | 943 | let assetIn = getStringOrFail(this, aa()) | |
948 | 948 | let assetIn = getStringOrFail(this, pa()) | |
949 | 949 | $Tuple2(assetOut, assetIn) | |
950 | 950 | } | |
951 | - | let assetOut = $ | |
952 | - | let assetIn = $ | |
951 | + | let assetOut = $t04010040405._1 | |
952 | + | let assetIn = $t04010040405._2 | |
953 | 953 | let poolAssetInBalance = getAccBalance(assetIn) | |
954 | 954 | let poolAssetOutBalance = getAccBalance(assetOut) | |
955 | 955 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
1002 | 1002 | let assetOut = if ((isReverse == false)) | |
1003 | 1003 | then getStringOrFail(this, pa()) | |
1004 | 1004 | else getStringOrFail(this, aa()) | |
1005 | - | let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1005 | + | let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount) | |
1006 | 1006 | let poolAssetOutBalance = getAccBalance(assetOut) | |
1007 | 1007 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
1008 | 1008 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
1009 | - | let newK = (toBigInt(getAccBalance(assetIn)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
1009 | + | let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
1010 | 1010 | let checkK = if ((newK >= oldK)) | |
1011 | 1011 | then true | |
1012 | 1012 | else throw("new K is fewer error") | |
1017 | 1017 | else throw("Exchange result is fewer coins than expected") | |
1018 | 1018 | if ((checkMin == checkMin)) | |
1019 | 1019 | then { | |
1020 | - | let priceAssetId = getStringOrFail(this, pa()) | |
1021 | - | let feeAssetId = fromBase58String(priceAssetId) | |
1022 | - | let feeAmount = fraction(cleanAmountIn, feePoolAmount, 100) | |
1023 | - | let rebalanceState = rebalanceAsset(assetIn) | |
1024 | - | if ((rebalanceState == rebalanceState)) | |
1020 | + | let amountAssetBalanceDelta = if (isReverse) | |
1021 | + | then -(amountOut) | |
1022 | + | else feePoolAmount | |
1023 | + | let priceAssetBalanceDelta = if (isReverse) | |
1024 | + | then feePoolAmount | |
1025 | + | else -(amountOut) | |
1026 | + | let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1 | |
1027 | + | if ((refreshKLpActions == refreshKLpActions)) | |
1025 | 1028 | then { | |
1026 | - | let | |
1027 | - | if (( | |
1029 | + | let rebalanceState = rebalanceAsset(assetIn) | |
1030 | + | if ((rebalanceState == rebalanceState)) | |
1028 | 1031 | then { | |
1029 | - | let feeTransfer = ScriptTransfer(feeCollectorAddress, feeAmount, feeAssetId) | |
1030 | - | $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), (amountOut - feeAmount), parseAssetId(assetOut)), feeTransfer]), amountOut) | |
1032 | + | let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut) | |
1033 | + | if ((withdrawState == withdrawState)) | |
1034 | + | then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut) | |
1035 | + | else throw("Strict value is not equal to itself.") | |
1031 | 1036 | } | |
1032 | 1037 | else throw("Strict value is not equal to itself.") | |
1033 | 1038 | } | |
1088 | 1093 | else throw("Strict value is not equal to itself.") | |
1089 | 1094 | } | |
1090 | 1095 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1091 | - | let $ | |
1092 | - | if (($ | |
1096 | + | let $t04558146043 = refreshKLpInternal(0, 0, 0) | |
1097 | + | if (($t04558146043 == $t04558146043)) | |
1093 | 1098 | then { | |
1094 | - | let updatedKLp = $ | |
1095 | - | let refreshKLpActions = $ | |
1099 | + | let updatedKLp = $t04558146043._2 | |
1100 | + | let refreshKLpActions = $t04558146043._1 | |
1096 | 1101 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1097 | 1102 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1098 | 1103 | then { | |
1129 | 1134 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1130 | 1135 | if ((currentKLp == currentKLp)) | |
1131 | 1136 | then { | |
1132 | - | let $ | |
1133 | - | let refreshKLpActions = $ | |
1134 | - | let updatedKLp = $ | |
1137 | + | let $t04665546720 = refreshKLpInternal(0, 0, 0) | |
1138 | + | let refreshKLpActions = $t04665546720._1 | |
1139 | + | let updatedKLp = $t04665546720._2 | |
1135 | 1140 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1136 | 1141 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1137 | 1142 | then (state ++ refreshKLpActions) | |
1180 | 1185 | then { | |
1181 | 1186 | let userAddress = i.caller | |
1182 | 1187 | let txId = i.transactionId | |
1183 | - | let $ | |
1184 | - | if (($ | |
1188 | + | let $t04794948101 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
1189 | + | if (($t04794948101 == $t04794948101)) | |
1185 | 1190 | then { | |
1186 | - | let paymentInAmountAsset = $ | |
1187 | - | let bonus = $ | |
1188 | - | let feeAmount = $ | |
1189 | - | let commonState = $ | |
1190 | - | let emitAmountEstimated = $ | |
1191 | + | let paymentInAmountAsset = $t04794948101._5 | |
1192 | + | let bonus = $t04794948101._4 | |
1193 | + | let feeAmount = $t04794948101._3 | |
1194 | + | let commonState = $t04794948101._2 | |
1195 | + | let emitAmountEstimated = $t04794948101._1 | |
1191 | 1196 | let emitAmount = if (if ((minOutAmount > 0)) | |
1192 | 1197 | then (minOutAmount > emitAmountEstimated) | |
1193 | 1198 | else false) | |
1207 | 1212 | let sendFee = if ((feeAmount > 0)) | |
1208 | 1213 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
1209 | 1214 | else nil | |
1210 | - | let $ | |
1215 | + | let $t04868748884 = if ((this == feeCollectorAddress)) | |
1211 | 1216 | then $Tuple2(0, 0) | |
1212 | 1217 | else if (paymentInAmountAsset) | |
1213 | 1218 | then $Tuple2(-(feeAmount), 0) | |
1214 | 1219 | else $Tuple2(0, -(feeAmount)) | |
1215 | - | let amountAssetBalanceDelta = $ | |
1216 | - | let priceAssetBalanceDelta = $ | |
1217 | - | let $ | |
1218 | - | let refreshKLpActions = $ | |
1219 | - | let updatedKLp = $ | |
1220 | + | let amountAssetBalanceDelta = $t04868748884._1 | |
1221 | + | let priceAssetBalanceDelta = $t04868748884._2 | |
1222 | + | let $t04888748995 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1223 | + | let refreshKLpActions = $t04888748995._1 | |
1224 | + | let updatedKLp = $t04888748995._2 | |
1220 | 1225 | let kLp = value(getString(keyKLp)) | |
1221 | 1226 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1222 | 1227 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1241 | 1246 | ||
1242 | 1247 | @Callable(i) | |
1243 | 1248 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
1244 | - | let $ | |
1245 | - | let emitAmountEstimated = $ | |
1246 | - | let commonState = $ | |
1247 | - | let feeAmount = $ | |
1248 | - | let bonus = $ | |
1249 | - | let paymentInAmountAsset = $ | |
1249 | + | let $t04935049507 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
1250 | + | let emitAmountEstimated = $t04935049507._1 | |
1251 | + | let commonState = $t04935049507._2 | |
1252 | + | let feeAmount = $t04935049507._3 | |
1253 | + | let bonus = $t04935049507._4 | |
1254 | + | let paymentInAmountAsset = $t04935049507._5 | |
1250 | 1255 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1251 | 1256 | } | |
1252 | 1257 | ||
1285 | 1290 | then { | |
1286 | 1291 | let userAddress = i.caller | |
1287 | 1292 | let txId = i.transactionId | |
1288 | - | let $ | |
1289 | - | if (($ | |
1293 | + | let $t05042950582 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
1294 | + | if (($t05042950582 == $t05042950582)) | |
1290 | 1295 | then { | |
1291 | - | let outInAmountAsset = $ | |
1292 | - | let bonus = $ | |
1293 | - | let feeAmount = $ | |
1294 | - | let commonState = $ | |
1295 | - | let amountEstimated = $ | |
1296 | + | let outInAmountAsset = $t05042950582._5 | |
1297 | + | let bonus = $t05042950582._4 | |
1298 | + | let feeAmount = $t05042950582._3 | |
1299 | + | let commonState = $t05042950582._2 | |
1300 | + | let amountEstimated = $t05042950582._1 | |
1296 | 1301 | let amount = if (if ((minOutAmount > 0)) | |
1297 | 1302 | then (minOutAmount > amountEstimated) | |
1298 | 1303 | else false) | |
1306 | 1311 | let sendFee = if ((feeAmount > 0)) | |
1307 | 1312 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1308 | 1313 | else nil | |
1309 | - | let $ | |
1314 | + | let $t05124651493 = { | |
1310 | 1315 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1311 | 1316 | then 0 | |
1312 | 1317 | else feeAmount | |
1314 | 1319 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1315 | 1320 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1316 | 1321 | } | |
1317 | - | let amountAssetBalanceDelta = $ | |
1318 | - | let priceAssetBalanceDelta = $ | |
1319 | - | let $ | |
1320 | - | let refreshKLpActions = $ | |
1321 | - | let updatedKLp = $ | |
1322 | + | let amountAssetBalanceDelta = $t05124651493._1 | |
1323 | + | let priceAssetBalanceDelta = $t05124651493._2 | |
1324 | + | let $t05149651604 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1325 | + | let refreshKLpActions = $t05149651604._1 | |
1326 | + | let updatedKLp = $t05149651604._2 | |
1322 | 1327 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1323 | 1328 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1324 | 1329 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1337 | 1342 | ||
1338 | 1343 | @Callable(i) | |
1339 | 1344 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1340 | - | let $ | |
1341 | - | let amountEstimated = $ | |
1342 | - | let commonState = $ | |
1343 | - | let feeAmount = $ | |
1344 | - | let bonus = $ | |
1345 | - | let outInAmountAsset = $ | |
1345 | + | let $t05188252038 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1346 | + | let amountEstimated = $t05188252038._1 | |
1347 | + | let commonState = $t05188252038._2 | |
1348 | + | let feeAmount = $t05188252038._3 | |
1349 | + | let bonus = $t05188252038._4 | |
1350 | + | let outInAmountAsset = $t05188252038._5 | |
1346 | 1351 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1347 | 1352 | } | |
1348 | 1353 | ||
1381 | 1386 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1382 | 1387 | if ((unstakeInv == unstakeInv)) | |
1383 | 1388 | then { | |
1384 | - | let $ | |
1385 | - | if (($ | |
1389 | + | let $t05298053131 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1390 | + | if (($t05298053131 == $t05298053131)) | |
1386 | 1391 | then { | |
1387 | - | let outInAmountAsset = $ | |
1388 | - | let bonus = $ | |
1389 | - | let feeAmount = $ | |
1390 | - | let commonState = $ | |
1391 | - | let amountEstimated = $ | |
1392 | + | let outInAmountAsset = $t05298053131._5 | |
1393 | + | let bonus = $t05298053131._4 | |
1394 | + | let feeAmount = $t05298053131._3 | |
1395 | + | let commonState = $t05298053131._2 | |
1396 | + | let amountEstimated = $t05298053131._1 | |
1392 | 1397 | let amount = if (if ((minOutAmount > 0)) | |
1393 | 1398 | then (minOutAmount > amountEstimated) | |
1394 | 1399 | else false) | |
1402 | 1407 | let sendFee = if ((feeAmount > 0)) | |
1403 | 1408 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1404 | 1409 | else nil | |
1405 | - | let $ | |
1410 | + | let $t05379054037 = { | |
1406 | 1411 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1407 | 1412 | then 0 | |
1408 | 1413 | else feeAmount | |
1410 | 1415 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1411 | 1416 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1412 | 1417 | } | |
1413 | - | let amountAssetBalanceDelta = $ | |
1414 | - | let priceAssetBalanceDelta = $ | |
1415 | - | let $ | |
1416 | - | let refreshKLpActions = $ | |
1417 | - | let updatedKLp = $ | |
1418 | + | let amountAssetBalanceDelta = $t05379054037._1 | |
1419 | + | let priceAssetBalanceDelta = $t05379054037._2 | |
1420 | + | let $t05404054148 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1421 | + | let refreshKLpActions = $t05404054148._1 | |
1422 | + | let updatedKLp = $t05404054148._2 | |
1418 | 1423 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1419 | 1424 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1420 | 1425 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1448 | 1453 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1449 | 1454 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1450 | 1455 | then { | |
1451 | - | let $ | |
1452 | - | let refreshKLpActions = $ | |
1453 | - | let updatedKLp = $ | |
1456 | + | let $t05524355324 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1457 | + | let refreshKLpActions = $t05524355324._1 | |
1458 | + | let updatedKLp = $t05524355324._2 | |
1454 | 1459 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1455 | 1460 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1456 | 1461 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1483 | 1488 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1484 | 1489 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1485 | 1490 | then { | |
1486 | - | let $ | |
1487 | - | let refreshKLpActions = $ | |
1488 | - | let updatedKLp = $ | |
1491 | + | let $t05641956500 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1492 | + | let refreshKLpActions = $t05641956500._1 | |
1493 | + | let updatedKLp = $t05641956500._2 | |
1489 | 1494 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1490 | 1495 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1491 | 1496 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1533 | 1538 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1534 | 1539 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1535 | 1540 | then { | |
1536 | - | let $ | |
1537 | - | let refreshKLpActions = $ | |
1538 | - | let updatedKLp = $ | |
1541 | + | let $t05784857929 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1542 | + | let refreshKLpActions = $t05784857929._1 | |
1543 | + | let updatedKLp = $t05784857929._2 | |
1539 | 1544 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1540 | 1545 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1541 | 1546 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1589 | 1594 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1590 | 1595 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1591 | 1596 | then { | |
1592 | - | let $ | |
1593 | - | let refreshKLpActions = $ | |
1594 | - | let updatedKLp = $ | |
1597 | + | let $t05940759488 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1598 | + | let refreshKLpActions = $t05940759488._1 | |
1599 | + | let updatedKLp = $t05940759488._2 | |
1595 | 1600 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1596 | 1601 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1597 | 1602 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1626 | 1631 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1627 | 1632 | then { | |
1628 | 1633 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1629 | - | let $ | |
1630 | - | let kLpUpdateActions = $ | |
1631 | - | let updatedKLp = $ | |
1634 | + | let $t06069260756 = refreshKLpInternal(0, 0, 0) | |
1635 | + | let kLpUpdateActions = $t06069260756._1 | |
1636 | + | let updatedKLp = $t06069260756._2 | |
1632 | 1637 | let actions = if ((kLp != updatedKLp)) | |
1633 | 1638 | then kLpUpdateActions | |
1634 | 1639 | else throwErr("nothing to refresh") | |
1803 | 1808 | match tx { | |
1804 | 1809 | case order: Order => | |
1805 | 1810 | let matcherPub = getMatcherPubOrFail() | |
1806 | - | let $ | |
1811 | + | let $t06941869646 = if (skipOrderValidation()) | |
1807 | 1812 | then $Tuple2(true, "") | |
1808 | 1813 | else validateMatcherOrderAllowed(order) | |
1809 | - | let orderValid = $t06942969546._1 | |
1810 | - | let orderValidInfo = $t06942969546._2 | |
1811 | - | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1814 | + | let orderValid = $t06941869646._1 | |
1815 | + | let orderValidInfo = $t06941869646._2 | |
1812 | 1816 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1813 | - | if (if (if (orderValid) | |
1814 | - | then senderValid | |
1815 | - | else false) | |
1817 | + | if (if (orderValid) | |
1816 | 1818 | then matcherValid | |
1817 | 1819 | else false) | |
1818 | 1820 | then true | |
1819 | - | else throwOrderError(orderValid, orderValidInfo, | |
1821 | + | else throwOrderError(orderValid, orderValidInfo, matcherValid) | |
1820 | 1822 | case s: SetScriptTransaction => | |
1821 | 1823 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1822 | 1824 | then true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lPdecimals = 8 | |
5 | 5 | ||
6 | 6 | let scale8 = 100000000 | |
7 | 7 | ||
8 | 8 | let scale8BigInt = toBigInt(100000000) | |
9 | 9 | ||
10 | 10 | let scale18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let zeroBigInt = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big0 = toBigInt(0) | |
15 | 15 | ||
16 | 16 | let big1 = toBigInt(1) | |
17 | 17 | ||
18 | 18 | let big2 = toBigInt(2) | |
19 | 19 | ||
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | 23 | ||
24 | 24 | let PoolActive = 1 | |
25 | 25 | ||
26 | 26 | let PoolPutDisabled = 2 | |
27 | 27 | ||
28 | 28 | let PoolMatcherDisabled = 3 | |
29 | 29 | ||
30 | 30 | let PoolShutdown = 4 | |
31 | 31 | ||
32 | 32 | let idxPoolAddress = 1 | |
33 | 33 | ||
34 | 34 | let idxPoolStatus = 2 | |
35 | 35 | ||
36 | 36 | let idxPoolLPAssetId = 3 | |
37 | 37 | ||
38 | 38 | let idxAmtAssetId = 4 | |
39 | 39 | ||
40 | 40 | let idxPriceAssetId = 5 | |
41 | 41 | ||
42 | 42 | let idxAmtAssetDcm = 6 | |
43 | 43 | ||
44 | 44 | let idxPriceAssetDcm = 7 | |
45 | 45 | ||
46 | 46 | let idxIAmtAssetId = 8 | |
47 | 47 | ||
48 | 48 | let idxIPriceAssetId = 9 | |
49 | 49 | ||
50 | 50 | let idxLPAssetDcm = 10 | |
51 | 51 | ||
52 | 52 | let idxPoolAmtAssetAmt = 1 | |
53 | 53 | ||
54 | 54 | let idxPoolPriceAssetAmt = 2 | |
55 | 55 | ||
56 | 56 | let idxPoolLPAssetAmt = 3 | |
57 | 57 | ||
58 | 58 | let idxFactoryStakingContract = 1 | |
59 | 59 | ||
60 | 60 | let idxFactorySlippageContract = 7 | |
61 | 61 | ||
62 | 62 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func abs (val) = if ((0 > val)) | |
78 | 78 | then -(val) | |
79 | 79 | else val | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func absBigInt (val) = if ((zeroBigInt > val)) | |
83 | 83 | then -(val) | |
84 | 84 | else val | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func swapContract () = "%s__swapContract" | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func fc () = "%s__factoryContract" | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func pl () = "%s%s__price__last" | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func aa () = "%s__amountAsset" | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func pa () = "%s__priceAsset" | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | let keyFee = "%s__fee" | |
118 | 118 | ||
119 | 119 | let feeDefault = fraction(10, scale8, 10000) | |
120 | 120 | ||
121 | 121 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
122 | 122 | ||
123 | 123 | let keyKLp = makeString(["%s", "kLp"], SEP) | |
124 | 124 | ||
125 | 125 | let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP) | |
126 | 126 | ||
127 | 127 | let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP) | |
128 | 128 | ||
129 | 129 | let kLpRefreshDelayDefault = 30 | |
130 | 130 | ||
131 | 131 | let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault) | |
132 | 132 | ||
133 | 133 | func keyAdditionalBalance (assetId) = makeString(["%s%s", "stakedBalance", assetId], SEP) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func keyStakingAssetBalance (assetId) = makeString(["%s%s", "shareAssetBalance", assetId], SEP) | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func getAdditionalBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0) | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func getStakingAssetBalanceOrZero (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0) | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func keyFactoryConfig () = "%s__factoryConfig" | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func keyAllPoolsShutdown () = "%s__shutdown" | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
167 | 167 | ||
168 | 168 | ||
169 | 169 | let keyFeeCollectorAddress = "%s__feeCollectorAddress" | |
170 | 170 | ||
171 | 171 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
172 | 172 | ||
173 | 173 | ||
174 | - | func throwOrderError (orderValid,orderValidInfo, | |
174 | + | func throwOrderError (orderValid,orderValidInfo,matcherValid) = throw((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " matcherValid=") + toString(matcherValid))) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func addressFromStringOrThis (addressString) = match addressFromString(addressString) { | |
178 | 178 | case a: Address => | |
179 | 179 | a | |
180 | 180 | case _ => | |
181 | 181 | this | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func getManagerVaultAddressOrThis () = { | |
186 | 186 | let factoryAddress = match getString(fc()) { | |
187 | 187 | case fca: String => | |
188 | 188 | addressFromStringOrThis(fca) | |
189 | 189 | case _ => | |
190 | 190 | this | |
191 | 191 | } | |
192 | 192 | match getString(factoryAddress, keyManagerVaultAddress()) { | |
193 | 193 | case s: String => | |
194 | 194 | addressFromStringOrThis(s) | |
195 | 195 | case _ => | |
196 | 196 | this | |
197 | 197 | } | |
198 | 198 | } | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func throwErr (msg) = throw(makeString(["lp.ride:", msg], " ")) | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | func fmtErr (msg) = makeString(["lp.ride:", msg], " ") | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | let factoryContract = addressFromStringValue(getStringOrFail(this, fc())) | |
214 | 214 | ||
215 | 215 | let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress)) | |
216 | 216 | ||
217 | 217 | let inFee = { | |
218 | 218 | let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil) | |
219 | 219 | if ($isInstanceOf(@, "Int")) | |
220 | 220 | then @ | |
221 | 221 | else throw(($getType(@) + " couldn't be cast to Int")) | |
222 | 222 | } | |
223 | 223 | ||
224 | 224 | let outFee = { | |
225 | 225 | let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil) | |
226 | 226 | if ($isInstanceOf(@, "Int")) | |
227 | 227 | then @ | |
228 | 228 | else throw(($getType(@) + " couldn't be cast to Int")) | |
229 | 229 | } | |
230 | 230 | ||
231 | 231 | func keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP) | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | func isAddressWhitelisted (address) = valueOrElse(getBoolean(factoryContract, keyAddressWhitelisted(address)), false) | |
235 | 235 | ||
236 | 236 | ||
237 | 237 | func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false) | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub())) | |
241 | 241 | ||
242 | 242 | ||
243 | 243 | func getPoolConfig () = { | |
244 | 244 | let amtAsset = getStringOrFail(this, aa()) | |
245 | 245 | let priceAsset = getStringOrFail(this, pa()) | |
246 | 246 | let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset)) | |
247 | 247 | let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset)) | |
248 | 248 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP) | |
249 | 249 | } | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | func parseAssetId (input) = if ((input == wavesString)) | |
253 | 253 | then unit | |
254 | 254 | else fromBase58String(input) | |
255 | 255 | ||
256 | 256 | ||
257 | 257 | func assetIdToString (input) = if ((input == unit)) | |
258 | 258 | then wavesString | |
259 | 259 | else toBase58String(value(input)) | |
260 | 260 | ||
261 | 261 | ||
262 | 262 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolStatus]), fromBase58String(poolConfig[idxPoolLPAssetId]), parseAssetId(poolConfig[idxAmtAssetId]), parseAssetId(poolConfig[idxPriceAssetId]), parseIntValue(poolConfig[idxAmtAssetDcm]), parseIntValue(poolConfig[idxPriceAssetDcm])) | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
266 | 266 | ||
267 | - | let $ | |
267 | + | let $t097029868 = poolConfigParsed | |
268 | 268 | ||
269 | - | let cfgPoolAddress = $ | |
269 | + | let cfgPoolAddress = $t097029868._1 | |
270 | 270 | ||
271 | - | let cfgPoolStatus = $ | |
271 | + | let cfgPoolStatus = $t097029868._2 | |
272 | 272 | ||
273 | - | let cfgLpAssetId = $ | |
273 | + | let cfgLpAssetId = $t097029868._3 | |
274 | 274 | ||
275 | - | let cfgAmountAssetId = $ | |
275 | + | let cfgAmountAssetId = $t097029868._4 | |
276 | 276 | ||
277 | - | let cfgPriceAssetId = $ | |
277 | + | let cfgPriceAssetId = $t097029868._5 | |
278 | 278 | ||
279 | - | let cfgAmountAssetDecimals = $ | |
279 | + | let cfgAmountAssetDecimals = $t097029868._6 | |
280 | 280 | ||
281 | - | let cfgPriceAssetDecimals = $ | |
281 | + | let cfgPriceAssetDecimals = $t097029868._7 | |
282 | 282 | ||
283 | 283 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address") | |
287 | 287 | ||
288 | 288 | let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address") | |
289 | 289 | ||
290 | 290 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp,slipageAmtAssetAmt,slipagePriceAssetAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp), toString(slipageAmtAssetAmt), toString(slipagePriceAssetAmt)], SEP) | |
291 | 291 | ||
292 | 292 | ||
293 | 293 | func dataGetActionInfo (outAmtAssetAmt,outPriceAssetAmt,inLpAmt,price,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d", toString(outAmtAssetAmt), toString(outPriceAssetAmt), toString(inLpAmt), toString(price), toString(txHeight), toString(txTimestamp)], SEP) | |
294 | 294 | ||
295 | 295 | ||
296 | 296 | func getAccBalance (assetId) = { | |
297 | 297 | let balanceOnPool = if ((assetId == "WAVES")) | |
298 | 298 | then wavesBalance(this).available | |
299 | 299 | else assetBalance(this, fromBase58String(assetId)) | |
300 | 300 | let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId)) | |
301 | 301 | max([0, totalBalance]) | |
302 | 302 | } | |
303 | 303 | ||
304 | 304 | ||
305 | 305 | func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
306 | 306 | ||
307 | 307 | ||
308 | 308 | func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
309 | 309 | ||
310 | 310 | ||
311 | 311 | func getRate (proxy) = { | |
312 | 312 | let inv = invoke(proxy, "getRate", nil, nil) | |
313 | 313 | if ((inv == inv)) | |
314 | 314 | then match inv { | |
315 | 315 | case r: Int => | |
316 | 316 | r | |
317 | 317 | case _ => | |
318 | 318 | throwErr("proxy.getRate() unexpected value") | |
319 | 319 | } | |
320 | 320 | else throw("Strict value is not equal to itself.") | |
321 | 321 | } | |
322 | 322 | ||
323 | 323 | ||
324 | 324 | func deposit (assetId,amount,stakingAssetId,proxy) = { | |
325 | 325 | let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId) | |
326 | 326 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
327 | 327 | then { | |
328 | 328 | let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId) | |
329 | 329 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
330 | 330 | then { | |
331 | 331 | let asset = parseAssetId(assetId) | |
332 | 332 | if ((amount > 0)) | |
333 | 333 | then { | |
334 | 334 | let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)]) | |
335 | 335 | if ((depositInvoke == depositInvoke)) | |
336 | 336 | then match depositInvoke { | |
337 | 337 | case receivedStakingAsset: Int => | |
338 | 338 | let newAdditionalBalance = (currentAdditionalBalance + amount) | |
339 | 339 | let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset) | |
340 | 340 | [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)] | |
341 | 341 | case _ => | |
342 | 342 | nil | |
343 | 343 | } | |
344 | 344 | else throw("Strict value is not equal to itself.") | |
345 | 345 | } | |
346 | 346 | else nil | |
347 | 347 | } | |
348 | 348 | else throw("Strict value is not equal to itself.") | |
349 | 349 | } | |
350 | 350 | else throw("Strict value is not equal to itself.") | |
351 | 351 | } | |
352 | 352 | ||
353 | 353 | ||
354 | 354 | func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = { | |
355 | 355 | let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId) | |
356 | 356 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
357 | 357 | then { | |
358 | 358 | let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId) | |
359 | 359 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
360 | 360 | then { | |
361 | 361 | let currentProxyRate = getRate(proxy) | |
362 | 362 | if ((currentProxyRate == currentProxyRate)) | |
363 | 363 | then { | |
364 | 364 | let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance) | |
365 | 365 | let stakingAsset = parseAssetId(stakingAssetId) | |
366 | 366 | let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate) | |
367 | 367 | let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate) | |
368 | 368 | let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)]) | |
369 | 369 | if ((sendStakingAssetAmount > 0)) | |
370 | 370 | then { | |
371 | 371 | let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)]) | |
372 | 372 | if ((withdrawInvoke == withdrawInvoke)) | |
373 | 373 | then match withdrawInvoke { | |
374 | 374 | case receivedAssets: Int => | |
375 | 375 | let newAdditionalBalance = (currentAdditionalBalance - receivedAssets) | |
376 | 376 | let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount) | |
377 | 377 | [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))] | |
378 | 378 | case _ => | |
379 | 379 | nil | |
380 | 380 | } | |
381 | 381 | else throw("Strict value is not equal to itself.") | |
382 | 382 | } | |
383 | 383 | else nil | |
384 | 384 | } | |
385 | 385 | else throw("Strict value is not equal to itself.") | |
386 | 386 | } | |
387 | 387 | else throw("Strict value is not equal to itself.") | |
388 | 388 | } | |
389 | 389 | else throw("Strict value is not equal to itself.") | |
390 | 390 | } | |
391 | 391 | ||
392 | 392 | ||
393 | 393 | func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) { | |
394 | 394 | case a: (Boolean, Int, Int, String, String, Int, String) => | |
395 | 395 | a | |
396 | 396 | case _ => | |
397 | 397 | throwErr((("[" + assetId) + "] getLeaseProxyConfig() error")) | |
398 | 398 | } | |
399 | 399 | ||
400 | 400 | ||
401 | 401 | func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = { | |
402 | 402 | let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId) | |
403 | 403 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
404 | 404 | then { | |
405 | 405 | let currentAdditionalBalance = if ((currentStakingAssetBalance != 0)) | |
406 | 406 | then getAdditionalBalanceOrZero(assetId) | |
407 | 407 | else 0 | |
408 | 408 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
409 | 409 | then { | |
410 | 410 | let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)]) | |
411 | 411 | let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100) | |
412 | 412 | let diff = (currentAdditionalBalance - targetAdditionalBalance) | |
413 | 413 | if ((diff == 0)) | |
414 | 414 | then nil | |
415 | 415 | else if ((0 > diff)) | |
416 | 416 | then { | |
417 | 417 | let sendAssetAmount = -(diff) | |
418 | 418 | deposit(assetId, sendAssetAmount, stakingAssetId, proxy) | |
419 | 419 | } | |
420 | 420 | else { | |
421 | 421 | let getAssetAmount = diff | |
422 | 422 | withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress) | |
423 | 423 | } | |
424 | 424 | } | |
425 | 425 | else throw("Strict value is not equal to itself.") | |
426 | 426 | } | |
427 | 427 | else throw("Strict value is not equal to itself.") | |
428 | 428 | } | |
429 | 429 | ||
430 | 430 | ||
431 | 431 | func rebalanceAsset (assetId) = { | |
432 | - | let $ | |
433 | - | let isLeasable = $ | |
434 | - | let leasedRatio = $ | |
435 | - | let minBalance = $ | |
436 | - | let proxyAddress = $ | |
437 | - | let proxyAssetId = $ | |
438 | - | let proxyRateMul = $ | |
439 | - | let stakingProfitAddress = $ | |
432 | + | let $t01615316289 = getLeaseProxyConfig(assetId) | |
433 | + | let isLeasable = $t01615316289._1 | |
434 | + | let leasedRatio = $t01615316289._2 | |
435 | + | let minBalance = $t01615316289._3 | |
436 | + | let proxyAddress = $t01615316289._4 | |
437 | + | let proxyAssetId = $t01615316289._5 | |
438 | + | let proxyRateMul = $t01615316289._6 | |
439 | + | let stakingProfitAddress = $t01615316289._7 | |
440 | 440 | if (isLeasable) | |
441 | 441 | then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress)) | |
442 | 442 | else nil | |
443 | 443 | } | |
444 | 444 | ||
445 | 445 | ||
446 | 446 | func withdrawAndRebalanceAsset (assetId,getAmount) = { | |
447 | - | let $ | |
448 | - | let isLeasable = $ | |
449 | - | let leasedRatio = $ | |
450 | - | let minBalance = $ | |
451 | - | let proxyAddress = $ | |
452 | - | let proxyAssetId = $ | |
453 | - | let proxyRateMul = $ | |
454 | - | let stakingProfitAddress = $ | |
447 | + | let $t01668816824 = getLeaseProxyConfig(assetId) | |
448 | + | let isLeasable = $t01668816824._1 | |
449 | + | let leasedRatio = $t01668816824._2 | |
450 | + | let minBalance = $t01668816824._3 | |
451 | + | let proxyAddress = $t01668816824._4 | |
452 | + | let proxyAssetId = $t01668816824._5 | |
453 | + | let proxyRateMul = $t01668816824._6 | |
454 | + | let stakingProfitAddress = $t01668816824._7 | |
455 | 455 | if (isLeasable) | |
456 | 456 | then { | |
457 | 457 | let currentStakingAssetBalance = getStakingAssetBalanceOrZero(proxyAssetId) | |
458 | 458 | if ((currentStakingAssetBalance == currentStakingAssetBalance)) | |
459 | 459 | then { | |
460 | 460 | let currentAdditionalBalance = if ((currentStakingAssetBalance != 0)) | |
461 | 461 | then getAdditionalBalanceOrZero(assetId) | |
462 | 462 | else 0 | |
463 | 463 | if ((currentAdditionalBalance == currentAdditionalBalance)) | |
464 | 464 | then { | |
465 | 465 | let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)]) | |
466 | 466 | if ((newTotalLeasableBalance == newTotalLeasableBalance)) | |
467 | 467 | then { | |
468 | 468 | let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100) | |
469 | 469 | if ((newAdditionalBalance == newAdditionalBalance)) | |
470 | 470 | then { | |
471 | 471 | let withdrawAmount = (currentAdditionalBalance - newAdditionalBalance) | |
472 | 472 | if ((withdrawAmount == withdrawAmount)) | |
473 | 473 | then if ((withdrawAmount == 0)) | |
474 | 474 | then nil | |
475 | 475 | else if ((0 > withdrawAmount)) | |
476 | 476 | then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress)) | |
477 | 477 | else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress)) | |
478 | 478 | else throw("Strict value is not equal to itself.") | |
479 | 479 | } | |
480 | 480 | else throw("Strict value is not equal to itself.") | |
481 | 481 | } | |
482 | 482 | else throw("Strict value is not equal to itself.") | |
483 | 483 | } | |
484 | 484 | else throw("Strict value is not equal to itself.") | |
485 | 485 | } | |
486 | 486 | else throw("Strict value is not equal to itself.") | |
487 | 487 | } | |
488 | 488 | else nil | |
489 | 489 | } | |
490 | 490 | ||
491 | 491 | ||
492 | 492 | func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = { | |
493 | 493 | let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount) | |
494 | 494 | let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount) | |
495 | 495 | (AmAmtWithdrawState ++ PrAmtWithdrawState) | |
496 | 496 | } | |
497 | 497 | ||
498 | 498 | ||
499 | 499 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
500 | 500 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
501 | 501 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
502 | 502 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
503 | 503 | } | |
504 | 504 | ||
505 | 505 | ||
506 | 506 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
507 | 507 | let cfg = getPoolConfig() | |
508 | 508 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
509 | 509 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
510 | 510 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
511 | 511 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
512 | 512 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
513 | 513 | let lpAmtX18 = toX18(lpAmt, scale8) | |
514 | 514 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
515 | 515 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
516 | 516 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
517 | 517 | } | |
518 | 518 | ||
519 | 519 | ||
520 | 520 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
521 | 521 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
522 | 522 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
523 | 523 | } | |
524 | 524 | ||
525 | 525 | ||
526 | 526 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
527 | 527 | let cfg = getPoolConfig() | |
528 | 528 | let lpAssetId = cfg[idxPoolLPAssetId] | |
529 | 529 | let amAssetId = cfg[idxAmtAssetId] | |
530 | 530 | let prAssetId = cfg[idxPriceAssetId] | |
531 | 531 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
532 | 532 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
533 | 533 | let poolStatus = cfg[idxPoolStatus] | |
534 | 534 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
535 | 535 | if ((lpAssetId != pmtAssetId)) | |
536 | 536 | then throw("Invalid asset passed.") | |
537 | 537 | else { | |
538 | 538 | let amBalance = getAccBalance(amAssetId) | |
539 | 539 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
540 | 540 | let prBalance = getAccBalance(prAssetId) | |
541 | 541 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
542 | 542 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
543 | 543 | let curPrice = fromX18(curPriceX18, scale8) | |
544 | 544 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
545 | 545 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
546 | 546 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
547 | 547 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
548 | 548 | let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR) | |
549 | 549 | let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR) | |
550 | 550 | let state = if ((txId58 == "")) | |
551 | 551 | then nil | |
552 | 552 | else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
553 | 553 | then unit | |
554 | 554 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
555 | 555 | then unit | |
556 | 556 | else fromBase58String(prAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
557 | 557 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
558 | 558 | } | |
559 | 559 | } | |
560 | 560 | ||
561 | 561 | ||
562 | 562 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
563 | 563 | let cfg = getPoolConfig() | |
564 | 564 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
565 | 565 | let amAssetIdStr = cfg[idxAmtAssetId] | |
566 | 566 | let prAssetIdStr = cfg[idxPriceAssetId] | |
567 | 567 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
568 | 568 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
569 | 569 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
570 | 570 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
571 | 571 | let poolStatus = cfg[idxPoolStatus] | |
572 | 572 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
573 | 573 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
574 | 574 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
575 | 575 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
576 | 576 | then true | |
577 | 577 | else (prAssetIdStr != inPrAssetIdStr)) | |
578 | 578 | then throw("Invalid amt or price asset passed.") | |
579 | 579 | else { | |
580 | 580 | let amBalance = if (isEvaluate) | |
581 | 581 | then getAccBalance(amAssetIdStr) | |
582 | 582 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
583 | 583 | let prBalance = if (isEvaluate) | |
584 | 584 | then getAccBalance(prAssetIdStr) | |
585 | 585 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
586 | 586 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
587 | 587 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
588 | 588 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
589 | 589 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
590 | 590 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
591 | 591 | let res = if ((lpEmission == 0)) | |
592 | 592 | then { | |
593 | 593 | let curPriceX18 = zeroBigInt | |
594 | 594 | let slippageX18 = zeroBigInt | |
595 | 595 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
596 | 596 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
597 | 597 | } | |
598 | 598 | else { | |
599 | 599 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
600 | 600 | let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
601 | 601 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
602 | 602 | if (if ((curPriceX18 != zeroBigInt)) | |
603 | 603 | then (slippageX18 > slippageToleranceX18) | |
604 | 604 | else false) | |
605 | 605 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
606 | 606 | else { | |
607 | 607 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
608 | 608 | let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
609 | 609 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
610 | 610 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
611 | 611 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
612 | 612 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
613 | 613 | let expAmtAssetAmtX18 = expectedAmts._1 | |
614 | 614 | let expPriceAssetAmtX18 = expectedAmts._2 | |
615 | 615 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR) | |
616 | 616 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18) | |
617 | 617 | } | |
618 | 618 | } | |
619 | 619 | let calcLpAmt = res._1 | |
620 | 620 | let calcAmAssetPmt = res._2 | |
621 | 621 | let calcPrAssetPmt = res._3 | |
622 | 622 | let curPrice = fromX18(res._4, scale8) | |
623 | 623 | let slippageCalc = fromX18(res._5, scale8) | |
624 | 624 | if ((0 >= calcLpAmt)) | |
625 | 625 | then throw("Invalid calculations. LP calculated is less than zero.") | |
626 | 626 | else { | |
627 | 627 | let emitLpAmt = if (!(emitLp)) | |
628 | 628 | then 0 | |
629 | 629 | else calcLpAmt | |
630 | 630 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
631 | 631 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
632 | 632 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(calcAmAssetPmt, calcPrAssetPmt, emitLpAmt, curPrice, slippageTolerance, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
633 | 633 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
634 | 634 | } | |
635 | 635 | } | |
636 | 636 | } | |
637 | 637 | ||
638 | 638 | ||
639 | 639 | func calcKLp (amountBalance,priceBalance,lpEmission) = { | |
640 | 640 | let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)) | |
641 | 641 | let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals)) | |
642 | 642 | let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
643 | 643 | if ((lpEmission == big0)) | |
644 | 644 | then big0 | |
645 | 645 | else updatedKLp | |
646 | 646 | } | |
647 | 647 | ||
648 | 648 | ||
649 | 649 | func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
650 | 650 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
651 | 651 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
652 | 652 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
653 | 653 | let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
654 | 654 | currentKLp | |
655 | 655 | } | |
656 | 656 | ||
657 | 657 | ||
658 | 658 | func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
659 | 659 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
660 | 660 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
661 | 661 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
662 | 662 | let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
663 | 663 | let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))] | |
664 | 664 | $Tuple2(actions, updatedKLp) | |
665 | 665 | } | |
666 | 666 | ||
667 | 667 | ||
668 | 668 | func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false) | |
669 | 669 | ||
670 | 670 | ||
671 | 671 | func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp)) | |
672 | 672 | then true | |
673 | 673 | else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " ")) | |
674 | 674 | ||
675 | 675 | ||
676 | 676 | func validateMatcherOrderAllowed (order) = { | |
677 | 677 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
678 | 678 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
679 | 679 | let amountAssetAmount = order.amount | |
680 | 680 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
681 | - | let $ | |
681 | + | let $t02945029662 = if ((order.orderType == Buy)) | |
682 | 682 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
683 | 683 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
684 | - | let amountAssetBalanceDelta = $ | |
685 | - | let priceAssetBalanceDelta = $ | |
684 | + | let amountAssetBalanceDelta = $t02945029662._1 | |
685 | + | let priceAssetBalanceDelta = $t02945029662._2 | |
686 | 686 | if (if (if (isGlobalShutdown()) | |
687 | 687 | then true | |
688 | 688 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
689 | 689 | then true | |
690 | 690 | else (cfgPoolStatus == PoolShutdown)) | |
691 | 691 | then throw("Exchange operations disabled") | |
692 | 692 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
693 | 693 | then true | |
694 | 694 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
695 | 695 | then throw("Wrong order assets.") | |
696 | 696 | else { | |
697 | 697 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
698 | - | let $ | |
699 | - | let unusedActions = $ | |
700 | - | let kLpNew = $ | |
698 | + | let $t03010230202 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
699 | + | let unusedActions = $t03010230202._1 | |
700 | + | let kLpNew = $t03010230202._2 | |
701 | 701 | let isOrderValid = (kLpNew >= kLp) | |
702 | 702 | let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
703 | 703 | $Tuple2(isOrderValid, info) | |
704 | 704 | } | |
705 | 705 | } | |
706 | 706 | ||
707 | 707 | ||
708 | 708 | func commonGet (i) = if ((size(i.payments) != 1)) | |
709 | 709 | then throw("exactly 1 payment is expected") | |
710 | 710 | else { | |
711 | 711 | let pmt = value(i.payments[0]) | |
712 | 712 | let pmtAssetId = value(pmt.assetId) | |
713 | 713 | let pmtAmt = pmt.amount | |
714 | 714 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
715 | 715 | let outAmAmt = res._1 | |
716 | 716 | let outPrAmt = res._2 | |
717 | 717 | let state = res._10 | |
718 | 718 | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
719 | 719 | then if (isGlobalShutdown()) | |
720 | 720 | then true | |
721 | 721 | else (cfgPoolStatus == PoolShutdown) | |
722 | 722 | else false | |
723 | 723 | if (isGetDisabled) | |
724 | 724 | then throw(("Get operation is blocked by admin. Status = " + toString(cfgPoolStatus))) | |
725 | 725 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
726 | 726 | } | |
727 | 727 | ||
728 | 728 | ||
729 | 729 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
730 | 730 | then throw("exactly 2 payments are expected") | |
731 | 731 | else { | |
732 | 732 | let amAssetPmt = value(i.payments[0]) | |
733 | 733 | let prAssetPmt = value(i.payments[1]) | |
734 | 734 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
735 | 735 | let isPutDisabled = if (!(isAddressWhitelisted(i.caller))) | |
736 | 736 | then if (if (isGlobalShutdown()) | |
737 | 737 | then true | |
738 | 738 | else (cfgPoolStatus == PoolPutDisabled)) | |
739 | 739 | then true | |
740 | 740 | else (cfgPoolStatus == PoolShutdown) | |
741 | 741 | else false | |
742 | 742 | if (isPutDisabled) | |
743 | 743 | then throw(("Put operation is blocked by admin. Status = " + toString(cfgPoolStatus))) | |
744 | 744 | else estPut | |
745 | 745 | } | |
746 | 746 | ||
747 | 747 | ||
748 | 748 | func emit (amount) = { | |
749 | 749 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
750 | 750 | if ((emitInv == emitInv)) | |
751 | 751 | then { | |
752 | 752 | let emitInvLegacy = match emitInv { | |
753 | 753 | case legacyFactoryContract: Address => | |
754 | 754 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
755 | 755 | case _ => | |
756 | 756 | unit | |
757 | 757 | } | |
758 | 758 | if ((emitInvLegacy == emitInvLegacy)) | |
759 | 759 | then amount | |
760 | 760 | else throw("Strict value is not equal to itself.") | |
761 | 761 | } | |
762 | 762 | else throw("Strict value is not equal to itself.") | |
763 | 763 | } | |
764 | 764 | ||
765 | 765 | ||
766 | 766 | func takeFee (amount,fee) = { | |
767 | 767 | let feeAmount = if ((fee == 0)) | |
768 | 768 | then 0 | |
769 | 769 | else fraction(amount, fee, scale8) | |
770 | 770 | $Tuple2((amount - feeAmount), feeAmount) | |
771 | 771 | } | |
772 | 772 | ||
773 | 773 | ||
774 | 774 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
775 | 775 | let isEval = (txId == unit) | |
776 | 776 | let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
777 | 777 | let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
778 | 778 | let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId)) | |
779 | 779 | then true | |
780 | 780 | else if ((paymentAssetId == cfgPriceAssetId)) | |
781 | 781 | then false | |
782 | 782 | else throwErr("invalid asset") | |
783 | - | let $ | |
783 | + | let $t03338833681 = if (isEval) | |
784 | 784 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
785 | 785 | else if (paymentInAmountAsset) | |
786 | 786 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
787 | 787 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
788 | - | let amountBalanceOld = $ | |
789 | - | let priceBalanceOld = $ | |
790 | - | let $ | |
788 | + | let amountBalanceOld = $t03338833681._1 | |
789 | + | let priceBalanceOld = $t03338833681._2 | |
790 | + | let $t03368533834 = if (paymentInAmountAsset) | |
791 | 791 | then $Tuple2(paymentAmountRaw, 0) | |
792 | 792 | else $Tuple2(0, paymentAmountRaw) | |
793 | - | let amountAssetAmountRaw = $ | |
794 | - | let priceAssetAmountRaw = $ | |
793 | + | let amountAssetAmountRaw = $t03368533834._1 | |
794 | + | let priceAssetAmountRaw = $t03368533834._2 | |
795 | 795 | let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1 | |
796 | 796 | let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1 | |
797 | - | let $ | |
798 | - | let paymentAmount = $ | |
799 | - | let feeAmount = $ | |
797 | + | let $t03396634030 = takeFee(paymentAmountRaw, inFee) | |
798 | + | let paymentAmount = $t03396634030._1 | |
799 | + | let feeAmount = $t03396634030._2 | |
800 | 800 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
801 | 801 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
802 | 802 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
803 | 803 | let priceNew = fromX18(priceNewX18, scale8) | |
804 | 804 | let paymentBalance = if (paymentInAmountAsset) | |
805 | 805 | then amountBalanceOld | |
806 | 806 | else priceBalanceOld | |
807 | 807 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
808 | 808 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
809 | 809 | let chechSupply = if ((supplyBigInt > big0)) | |
810 | 810 | then true | |
811 | 811 | else throwErr("initial deposit requires all coins") | |
812 | 812 | if ((chechSupply == chechSupply)) | |
813 | 813 | then { | |
814 | 814 | let depositBigInt = toBigInt(paymentAmount) | |
815 | 815 | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
816 | 816 | let commonState = if (isEval) | |
817 | 817 | then nil | |
818 | 818 | else [IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew), StringEntry(pau(toString(value(userAddress)), toBase58String(value(txId))), dataPutActionInfo(amountAssetAmountRaw, priceAssetAmountRaw, issueAmount, priceNew, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
819 | 819 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
820 | 820 | let priceOld = fromX18(priceOldX18, scale8) | |
821 | 821 | let loss = { | |
822 | - | let $ | |
822 | + | let $t03571135878 = if (paymentInAmountAsset) | |
823 | 823 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
824 | 824 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
825 | - | let amount = $ | |
826 | - | let balance = $ | |
825 | + | let amount = $t03571135878._1 | |
826 | + | let balance = $t03571135878._2 | |
827 | 827 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
828 | 828 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
829 | 829 | } | |
830 | 830 | $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset) | |
831 | 831 | } | |
832 | 832 | else throw("Strict value is not equal to itself.") | |
833 | 833 | } | |
834 | 834 | ||
835 | 835 | ||
836 | 836 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
837 | 837 | let isEval = (txId == unit) | |
838 | 838 | let cfg = getPoolConfig() | |
839 | 839 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
840 | 840 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
841 | 841 | let checks = [if ((paymentAssetId == cfgLpAssetId)) | |
842 | 842 | then true | |
843 | 843 | else throwErr("invalid lp asset")] | |
844 | 844 | if ((checks == checks)) | |
845 | 845 | then { | |
846 | 846 | let outInAmountAsset = if ((outAssetId == cfgAmountAssetId)) | |
847 | 847 | then true | |
848 | 848 | else if ((outAssetId == cfgPriceAssetId)) | |
849 | 849 | then false | |
850 | 850 | else throwErr("invalid asset") | |
851 | 851 | let balanceBigInt = if (outInAmountAsset) | |
852 | 852 | then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) | |
853 | 853 | else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) | |
854 | 854 | let outInAmountAssetDecimals = if (outInAmountAsset) | |
855 | 855 | then amtAssetDcm | |
856 | 856 | else priceAssetDcm | |
857 | 857 | let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
858 | 858 | let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
859 | 859 | let outBalance = if (outInAmountAsset) | |
860 | 860 | then amBalanceOld | |
861 | 861 | else prBalanceOld | |
862 | 862 | let outBalanceBigInt = toBigInt(outBalance) | |
863 | 863 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
864 | 864 | let redeemedBigInt = toBigInt(paymentAmount) | |
865 | 865 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
866 | - | let $ | |
867 | - | let totalAmount = $ | |
868 | - | let feeAmount = $ | |
869 | - | let $ | |
866 | + | let $t03795638012 = takeFee(amountRaw, outFee) | |
867 | + | let totalAmount = $t03795638012._1 | |
868 | + | let feeAmount = $t03795638012._2 | |
869 | + | let $t03801638242 = if (outInAmountAsset) | |
870 | 870 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
871 | 871 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
872 | - | let outAmAmount = $ | |
873 | - | let outPrAmount = $ | |
874 | - | let amBalanceNew = $ | |
875 | - | let prBalanceNew = $ | |
872 | + | let outAmAmount = $t03801638242._1 | |
873 | + | let outPrAmount = $t03801638242._2 | |
874 | + | let amBalanceNew = $t03801638242._3 | |
875 | + | let prBalanceNew = $t03801638242._4 | |
876 | 876 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
877 | 877 | let priceNew = fromX18(priceNewX18, scale8) | |
878 | 878 | let commonState = if (isEval) | |
879 | 879 | then nil | |
880 | 880 | else [StringEntry(gau(toString(value(userAddress)), toBase58String(value(txId))), dataGetActionInfo(outAmAmount, outPrAmount, paymentAmount, priceNew, height, lastBlock.timestamp)), IntegerEntry(pl(), priceNew), IntegerEntry(ph(height, lastBlock.timestamp), priceNew)] | |
881 | 881 | let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals)) | |
882 | 882 | let priceOld = fromX18(priceOldX18, scale8) | |
883 | 883 | let loss = { | |
884 | 884 | let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2) | |
885 | 885 | fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset) | |
886 | 886 | } | |
887 | 887 | $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset) | |
888 | 888 | } | |
889 | 889 | else throw("Strict value is not equal to itself.") | |
890 | 890 | } | |
891 | 891 | ||
892 | 892 | ||
893 | 893 | func managerPublicKeyOrUnit () = { | |
894 | 894 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
895 | 895 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
896 | 896 | case s: String => | |
897 | 897 | fromBase58String(s) | |
898 | 898 | case _: Unit => | |
899 | 899 | unit | |
900 | 900 | case _ => | |
901 | 901 | throw("Match error") | |
902 | 902 | } | |
903 | 903 | } | |
904 | 904 | ||
905 | 905 | ||
906 | 906 | func isManager (i) = match managerPublicKeyOrUnit() { | |
907 | 907 | case pk: ByteVector => | |
908 | 908 | (i.callerPublicKey == pk) | |
909 | 909 | case _: Unit => | |
910 | 910 | (i.caller == this) | |
911 | 911 | case _ => | |
912 | 912 | throw("Match error") | |
913 | 913 | } | |
914 | 914 | ||
915 | 915 | ||
916 | 916 | func mustManager (i) = { | |
917 | 917 | let pd = throw("Permission denied") | |
918 | 918 | match managerPublicKeyOrUnit() { | |
919 | 919 | case pk: ByteVector => | |
920 | 920 | if ((i.callerPublicKey == pk)) | |
921 | 921 | then true | |
922 | 922 | else pd | |
923 | 923 | case _: Unit => | |
924 | 924 | if ((i.caller == this)) | |
925 | 925 | then true | |
926 | 926 | else pd | |
927 | 927 | case _ => | |
928 | 928 | throw("Match error") | |
929 | 929 | } | |
930 | 930 | } | |
931 | 931 | ||
932 | 932 | ||
933 | 933 | @Callable(i) | |
934 | 934 | func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa()))) | |
935 | 935 | ||
936 | 936 | ||
937 | 937 | ||
938 | 938 | @Callable(i) | |
939 | 939 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
940 | - | let $ | |
940 | + | let $t04010040405 = if ((isReverse == false)) | |
941 | 941 | then { | |
942 | 942 | let assetOut = getStringOrFail(this, pa()) | |
943 | 943 | let assetIn = getStringOrFail(this, aa()) | |
944 | 944 | $Tuple2(assetOut, assetIn) | |
945 | 945 | } | |
946 | 946 | else { | |
947 | 947 | let assetOut = getStringOrFail(this, aa()) | |
948 | 948 | let assetIn = getStringOrFail(this, pa()) | |
949 | 949 | $Tuple2(assetOut, assetIn) | |
950 | 950 | } | |
951 | - | let assetOut = $ | |
952 | - | let assetIn = $ | |
951 | + | let assetOut = $t04010040405._1 | |
952 | + | let assetIn = $t04010040405._2 | |
953 | 953 | let poolAssetInBalance = getAccBalance(assetIn) | |
954 | 954 | let poolAssetOutBalance = getAccBalance(assetOut) | |
955 | 955 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
956 | 956 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
957 | 957 | let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
958 | 958 | let checkK = if ((newK >= oldK)) | |
959 | 959 | then true | |
960 | 960 | else throw("new K is fewer error") | |
961 | 961 | if ((checkK == checkK)) | |
962 | 962 | then $Tuple2(nil, amountOut) | |
963 | 963 | else throw("Strict value is not equal to itself.") | |
964 | 964 | } | |
965 | 965 | ||
966 | 966 | ||
967 | 967 | ||
968 | 968 | @Callable(i) | |
969 | 969 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
970 | 970 | let swapContact = { | |
971 | 971 | let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil) | |
972 | 972 | if ($isInstanceOf(@, "String")) | |
973 | 973 | then @ | |
974 | 974 | else throw(($getType(@) + " couldn't be cast to String")) | |
975 | 975 | } | |
976 | 976 | let isPoolSwapDisabled = { | |
977 | 977 | let @ = invoke(factoryContract, "isPoolSwapDisabledREADONLY", [toString(this)], nil) | |
978 | 978 | if ($isInstanceOf(@, "Boolean")) | |
979 | 979 | then @ | |
980 | 980 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
981 | 981 | } | |
982 | 982 | let isSwapDisabled = if (!(isAddressWhitelisted(i.caller))) | |
983 | 983 | then if (if (isGlobalShutdown()) | |
984 | 984 | then true | |
985 | 985 | else (cfgPoolStatus == PoolShutdown)) | |
986 | 986 | then true | |
987 | 987 | else isPoolSwapDisabled | |
988 | 988 | else false | |
989 | 989 | let checks = [if (if (!(isSwapDisabled)) | |
990 | 990 | then true | |
991 | 991 | else isManager(i)) | |
992 | 992 | then true | |
993 | 993 | else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
994 | 994 | then true | |
995 | 995 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
996 | 996 | then true | |
997 | 997 | else throwErr("Permission denied")] | |
998 | 998 | if ((checks == checks)) | |
999 | 999 | then { | |
1000 | 1000 | let pmt = value(i.payments[0]) | |
1001 | 1001 | let assetIn = assetIdToString(pmt.assetId) | |
1002 | 1002 | let assetOut = if ((isReverse == false)) | |
1003 | 1003 | then getStringOrFail(this, pa()) | |
1004 | 1004 | else getStringOrFail(this, aa()) | |
1005 | - | let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1005 | + | let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount) | |
1006 | 1006 | let poolAssetOutBalance = getAccBalance(assetOut) | |
1007 | 1007 | let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn)) | |
1008 | 1008 | let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance)) | |
1009 | - | let newK = (toBigInt(getAccBalance(assetIn)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
1009 | + | let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut))) | |
1010 | 1010 | let checkK = if ((newK >= oldK)) | |
1011 | 1011 | then true | |
1012 | 1012 | else throw("new K is fewer error") | |
1013 | 1013 | if ((checkK == checkK)) | |
1014 | 1014 | then { | |
1015 | 1015 | let checkMin = if ((amountOut >= amountOutMin)) | |
1016 | 1016 | then true | |
1017 | 1017 | else throw("Exchange result is fewer coins than expected") | |
1018 | 1018 | if ((checkMin == checkMin)) | |
1019 | 1019 | then { | |
1020 | - | let priceAssetId = getStringOrFail(this, pa()) | |
1021 | - | let feeAssetId = fromBase58String(priceAssetId) | |
1022 | - | let feeAmount = fraction(cleanAmountIn, feePoolAmount, 100) | |
1023 | - | let rebalanceState = rebalanceAsset(assetIn) | |
1024 | - | if ((rebalanceState == rebalanceState)) | |
1020 | + | let amountAssetBalanceDelta = if (isReverse) | |
1021 | + | then -(amountOut) | |
1022 | + | else feePoolAmount | |
1023 | + | let priceAssetBalanceDelta = if (isReverse) | |
1024 | + | then feePoolAmount | |
1025 | + | else -(amountOut) | |
1026 | + | let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1 | |
1027 | + | if ((refreshKLpActions == refreshKLpActions)) | |
1025 | 1028 | then { | |
1026 | - | let | |
1027 | - | if (( | |
1029 | + | let rebalanceState = rebalanceAsset(assetIn) | |
1030 | + | if ((rebalanceState == rebalanceState)) | |
1028 | 1031 | then { | |
1029 | - | let feeTransfer = ScriptTransfer(feeCollectorAddress, feeAmount, feeAssetId) | |
1030 | - | $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), (amountOut - feeAmount), parseAssetId(assetOut)), feeTransfer]), amountOut) | |
1032 | + | let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut) | |
1033 | + | if ((withdrawState == withdrawState)) | |
1034 | + | then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut) | |
1035 | + | else throw("Strict value is not equal to itself.") | |
1031 | 1036 | } | |
1032 | 1037 | else throw("Strict value is not equal to itself.") | |
1033 | 1038 | } | |
1034 | 1039 | else throw("Strict value is not equal to itself.") | |
1035 | 1040 | } | |
1036 | 1041 | else throw("Strict value is not equal to itself.") | |
1037 | 1042 | } | |
1038 | 1043 | else throw("Strict value is not equal to itself.") | |
1039 | 1044 | } | |
1040 | 1045 | else throw("Strict value is not equal to itself.") | |
1041 | 1046 | } | |
1042 | 1047 | ||
1043 | 1048 | ||
1044 | 1049 | ||
1045 | 1050 | @Callable(i) | |
1046 | 1051 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
1047 | 1052 | then throw("Invalid slippageTolerance passed") | |
1048 | 1053 | else { | |
1049 | 1054 | let estPut = commonPut(i, slippageTolerance, true) | |
1050 | 1055 | let emitLpAmt = estPut._2 | |
1051 | 1056 | let lpAssetId = estPut._7 | |
1052 | 1057 | let state = estPut._9 | |
1053 | 1058 | let amDiff = estPut._10 | |
1054 | 1059 | let prDiff = estPut._11 | |
1055 | 1060 | let amId = estPut._12 | |
1056 | 1061 | let prId = estPut._13 | |
1057 | 1062 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1058 | 1063 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1059 | 1064 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1060 | 1065 | if ((currentKLp == currentKLp)) | |
1061 | 1066 | then { | |
1062 | 1067 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
1063 | 1068 | if ((emitInv == emitInv)) | |
1064 | 1069 | then { | |
1065 | 1070 | let emitInvLegacy = match emitInv { | |
1066 | 1071 | case legacyFactoryContract: Address => | |
1067 | 1072 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
1068 | 1073 | case _ => | |
1069 | 1074 | unit | |
1070 | 1075 | } | |
1071 | 1076 | if ((emitInvLegacy == emitInvLegacy)) | |
1072 | 1077 | then { | |
1073 | 1078 | let slippageAInv = if ((amDiff > 0)) | |
1074 | 1079 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1075 | 1080 | else nil | |
1076 | 1081 | if ((slippageAInv == slippageAInv)) | |
1077 | 1082 | then { | |
1078 | 1083 | let slippagePInv = if ((prDiff > 0)) | |
1079 | 1084 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1080 | 1085 | else nil | |
1081 | 1086 | if ((slippagePInv == slippagePInv)) | |
1082 | 1087 | then { | |
1083 | 1088 | let lpTransfer = if (shouldAutoStake) | |
1084 | 1089 | then { | |
1085 | 1090 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1086 | 1091 | if ((slpStakeInv == slpStakeInv)) | |
1087 | 1092 | then nil | |
1088 | 1093 | else throw("Strict value is not equal to itself.") | |
1089 | 1094 | } | |
1090 | 1095 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1091 | - | let $ | |
1092 | - | if (($ | |
1096 | + | let $t04558146043 = refreshKLpInternal(0, 0, 0) | |
1097 | + | if (($t04558146043 == $t04558146043)) | |
1093 | 1098 | then { | |
1094 | - | let updatedKLp = $ | |
1095 | - | let refreshKLpActions = $ | |
1099 | + | let updatedKLp = $t04558146043._2 | |
1100 | + | let refreshKLpActions = $t04558146043._1 | |
1096 | 1101 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1097 | 1102 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1098 | 1103 | then { | |
1099 | 1104 | let reb = invoke(this, "rebalance", nil, nil) | |
1100 | 1105 | if ((reb == reb)) | |
1101 | 1106 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
1102 | 1107 | else throw("Strict value is not equal to itself.") | |
1103 | 1108 | } | |
1104 | 1109 | else throw("Strict value is not equal to itself.") | |
1105 | 1110 | } | |
1106 | 1111 | else throw("Strict value is not equal to itself.") | |
1107 | 1112 | } | |
1108 | 1113 | else throw("Strict value is not equal to itself.") | |
1109 | 1114 | } | |
1110 | 1115 | else throw("Strict value is not equal to itself.") | |
1111 | 1116 | } | |
1112 | 1117 | else throw("Strict value is not equal to itself.") | |
1113 | 1118 | } | |
1114 | 1119 | else throw("Strict value is not equal to itself.") | |
1115 | 1120 | } | |
1116 | 1121 | else throw("Strict value is not equal to itself.") | |
1117 | 1122 | } | |
1118 | 1123 | ||
1119 | 1124 | ||
1120 | 1125 | ||
1121 | 1126 | @Callable(i) | |
1122 | 1127 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
1123 | 1128 | then throw("Invalid value passed") | |
1124 | 1129 | else { | |
1125 | 1130 | let estPut = commonPut(i, maxSlippage, false) | |
1126 | 1131 | let state = estPut._9 | |
1127 | 1132 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1128 | 1133 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1129 | 1134 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1130 | 1135 | if ((currentKLp == currentKLp)) | |
1131 | 1136 | then { | |
1132 | - | let $ | |
1133 | - | let refreshKLpActions = $ | |
1134 | - | let updatedKLp = $ | |
1137 | + | let $t04665546720 = refreshKLpInternal(0, 0, 0) | |
1138 | + | let refreshKLpActions = $t04665546720._1 | |
1139 | + | let updatedKLp = $t04665546720._2 | |
1135 | 1140 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1136 | 1141 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1137 | 1142 | then (state ++ refreshKLpActions) | |
1138 | 1143 | else throw("Strict value is not equal to itself.") | |
1139 | 1144 | } | |
1140 | 1145 | else throw("Strict value is not equal to itself.") | |
1141 | 1146 | } | |
1142 | 1147 | ||
1143 | 1148 | ||
1144 | 1149 | ||
1145 | 1150 | @Callable(i) | |
1146 | 1151 | func putOneTkn (minOutAmount,autoStake) = { | |
1147 | 1152 | let isPoolOneTokenOperationsDisabled = { | |
1148 | 1153 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1149 | 1154 | if ($isInstanceOf(@, "Boolean")) | |
1150 | 1155 | then @ | |
1151 | 1156 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1152 | 1157 | } | |
1153 | 1158 | let isPutDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1154 | 1159 | then if (if (if (isGlobalShutdown()) | |
1155 | 1160 | then true | |
1156 | 1161 | else (cfgPoolStatus == PoolPutDisabled)) | |
1157 | 1162 | then true | |
1158 | 1163 | else (cfgPoolStatus == PoolShutdown)) | |
1159 | 1164 | then true | |
1160 | 1165 | else isPoolOneTokenOperationsDisabled | |
1161 | 1166 | else false | |
1162 | 1167 | let checks = [if (if (!(isPutDisabled)) | |
1163 | 1168 | then true | |
1164 | 1169 | else isManager(i)) | |
1165 | 1170 | then true | |
1166 | 1171 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1167 | 1172 | then true | |
1168 | 1173 | else throwErr("exactly 1 payment are expected")] | |
1169 | 1174 | if ((checks == checks)) | |
1170 | 1175 | then { | |
1171 | 1176 | let payment = i.payments[0] | |
1172 | 1177 | let paymentAssetId = payment.assetId | |
1173 | 1178 | let paymentAmountRaw = payment.amount | |
1174 | 1179 | let currentKLp = if ((paymentAssetId == cfgAmountAssetId)) | |
1175 | 1180 | then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0)) | |
1176 | 1181 | else if ((paymentAssetId == cfgPriceAssetId)) | |
1177 | 1182 | then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0)) | |
1178 | 1183 | else throwErr("payment asset is not supported") | |
1179 | 1184 | if ((currentKLp == currentKLp)) | |
1180 | 1185 | then { | |
1181 | 1186 | let userAddress = i.caller | |
1182 | 1187 | let txId = i.transactionId | |
1183 | - | let $ | |
1184 | - | if (($ | |
1188 | + | let $t04794948101 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
1189 | + | if (($t04794948101 == $t04794948101)) | |
1185 | 1190 | then { | |
1186 | - | let paymentInAmountAsset = $ | |
1187 | - | let bonus = $ | |
1188 | - | let feeAmount = $ | |
1189 | - | let commonState = $ | |
1190 | - | let emitAmountEstimated = $ | |
1191 | + | let paymentInAmountAsset = $t04794948101._5 | |
1192 | + | let bonus = $t04794948101._4 | |
1193 | + | let feeAmount = $t04794948101._3 | |
1194 | + | let commonState = $t04794948101._2 | |
1195 | + | let emitAmountEstimated = $t04794948101._1 | |
1191 | 1196 | let emitAmount = if (if ((minOutAmount > 0)) | |
1192 | 1197 | then (minOutAmount > emitAmountEstimated) | |
1193 | 1198 | else false) | |
1194 | 1199 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1195 | 1200 | else emitAmountEstimated | |
1196 | 1201 | let emitInv = emit(emitAmount) | |
1197 | 1202 | if ((emitInv == emitInv)) | |
1198 | 1203 | then { | |
1199 | 1204 | let lpTransfer = if (autoStake) | |
1200 | 1205 | then { | |
1201 | 1206 | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
1202 | 1207 | if ((stakeInv == stakeInv)) | |
1203 | 1208 | then nil | |
1204 | 1209 | else throw("Strict value is not equal to itself.") | |
1205 | 1210 | } | |
1206 | 1211 | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
1207 | 1212 | let sendFee = if ((feeAmount > 0)) | |
1208 | 1213 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
1209 | 1214 | else nil | |
1210 | - | let $ | |
1215 | + | let $t04868748884 = if ((this == feeCollectorAddress)) | |
1211 | 1216 | then $Tuple2(0, 0) | |
1212 | 1217 | else if (paymentInAmountAsset) | |
1213 | 1218 | then $Tuple2(-(feeAmount), 0) | |
1214 | 1219 | else $Tuple2(0, -(feeAmount)) | |
1215 | - | let amountAssetBalanceDelta = $ | |
1216 | - | let priceAssetBalanceDelta = $ | |
1217 | - | let $ | |
1218 | - | let refreshKLpActions = $ | |
1219 | - | let updatedKLp = $ | |
1220 | + | let amountAssetBalanceDelta = $t04868748884._1 | |
1221 | + | let priceAssetBalanceDelta = $t04868748884._2 | |
1222 | + | let $t04888748995 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1223 | + | let refreshKLpActions = $t04888748995._1 | |
1224 | + | let updatedKLp = $t04888748995._2 | |
1220 | 1225 | let kLp = value(getString(keyKLp)) | |
1221 | 1226 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1222 | 1227 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1223 | 1228 | then { | |
1224 | 1229 | let reb = invoke(this, "rebalance", nil, nil) | |
1225 | 1230 | if ((reb == reb)) | |
1226 | 1231 | then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount) | |
1227 | 1232 | else throw("Strict value is not equal to itself.") | |
1228 | 1233 | } | |
1229 | 1234 | else throw("Strict value is not equal to itself.") | |
1230 | 1235 | } | |
1231 | 1236 | else throw("Strict value is not equal to itself.") | |
1232 | 1237 | } | |
1233 | 1238 | else throw("Strict value is not equal to itself.") | |
1234 | 1239 | } | |
1235 | 1240 | else throw("Strict value is not equal to itself.") | |
1236 | 1241 | } | |
1237 | 1242 | else throw("Strict value is not equal to itself.") | |
1238 | 1243 | } | |
1239 | 1244 | ||
1240 | 1245 | ||
1241 | 1246 | ||
1242 | 1247 | @Callable(i) | |
1243 | 1248 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
1244 | - | let $ | |
1245 | - | let emitAmountEstimated = $ | |
1246 | - | let commonState = $ | |
1247 | - | let feeAmount = $ | |
1248 | - | let bonus = $ | |
1249 | - | let paymentInAmountAsset = $ | |
1249 | + | let $t04935049507 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
1250 | + | let emitAmountEstimated = $t04935049507._1 | |
1251 | + | let commonState = $t04935049507._2 | |
1252 | + | let feeAmount = $t04935049507._3 | |
1253 | + | let bonus = $t04935049507._4 | |
1254 | + | let paymentInAmountAsset = $t04935049507._5 | |
1250 | 1255 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
1251 | 1256 | } | |
1252 | 1257 | ||
1253 | 1258 | ||
1254 | 1259 | ||
1255 | 1260 | @Callable(i) | |
1256 | 1261 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
1257 | 1262 | let isPoolOneTokenOperationsDisabled = { | |
1258 | 1263 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1259 | 1264 | if ($isInstanceOf(@, "Boolean")) | |
1260 | 1265 | then @ | |
1261 | 1266 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1262 | 1267 | } | |
1263 | 1268 | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1264 | 1269 | then if (if (isGlobalShutdown()) | |
1265 | 1270 | then true | |
1266 | 1271 | else (cfgPoolStatus == PoolShutdown)) | |
1267 | 1272 | then true | |
1268 | 1273 | else isPoolOneTokenOperationsDisabled | |
1269 | 1274 | else false | |
1270 | 1275 | let checks = [if (if (!(isGetDisabled)) | |
1271 | 1276 | then true | |
1272 | 1277 | else isManager(i)) | |
1273 | 1278 | then true | |
1274 | 1279 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1275 | 1280 | then true | |
1276 | 1281 | else throwErr("exactly 1 payment are expected")] | |
1277 | 1282 | if ((checks == checks)) | |
1278 | 1283 | then { | |
1279 | 1284 | let outAssetId = parseAssetId(outAssetIdStr) | |
1280 | 1285 | let payment = i.payments[0] | |
1281 | 1286 | let paymentAssetId = payment.assetId | |
1282 | 1287 | let paymentAmount = payment.amount | |
1283 | 1288 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1284 | 1289 | if ((currentKLp == currentKLp)) | |
1285 | 1290 | then { | |
1286 | 1291 | let userAddress = i.caller | |
1287 | 1292 | let txId = i.transactionId | |
1288 | - | let $ | |
1289 | - | if (($ | |
1293 | + | let $t05042950582 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
1294 | + | if (($t05042950582 == $t05042950582)) | |
1290 | 1295 | then { | |
1291 | - | let outInAmountAsset = $ | |
1292 | - | let bonus = $ | |
1293 | - | let feeAmount = $ | |
1294 | - | let commonState = $ | |
1295 | - | let amountEstimated = $ | |
1296 | + | let outInAmountAsset = $t05042950582._5 | |
1297 | + | let bonus = $t05042950582._4 | |
1298 | + | let feeAmount = $t05042950582._3 | |
1299 | + | let commonState = $t05042950582._2 | |
1300 | + | let amountEstimated = $t05042950582._1 | |
1296 | 1301 | let amount = if (if ((minOutAmount > 0)) | |
1297 | 1302 | then (minOutAmount > amountEstimated) | |
1298 | 1303 | else false) | |
1299 | 1304 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1300 | 1305 | else amountEstimated | |
1301 | 1306 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
1302 | 1307 | if ((burnInv == burnInv)) | |
1303 | 1308 | then { | |
1304 | 1309 | let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount]))) | |
1305 | 1310 | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
1306 | 1311 | let sendFee = if ((feeAmount > 0)) | |
1307 | 1312 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1308 | 1313 | else nil | |
1309 | - | let $ | |
1314 | + | let $t05124651493 = { | |
1310 | 1315 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1311 | 1316 | then 0 | |
1312 | 1317 | else feeAmount | |
1313 | 1318 | if (outInAmountAsset) | |
1314 | 1319 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1315 | 1320 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1316 | 1321 | } | |
1317 | - | let amountAssetBalanceDelta = $ | |
1318 | - | let priceAssetBalanceDelta = $ | |
1319 | - | let $ | |
1320 | - | let refreshKLpActions = $ | |
1321 | - | let updatedKLp = $ | |
1322 | + | let amountAssetBalanceDelta = $t05124651493._1 | |
1323 | + | let priceAssetBalanceDelta = $t05124651493._2 | |
1324 | + | let $t05149651604 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1325 | + | let refreshKLpActions = $t05149651604._1 | |
1326 | + | let updatedKLp = $t05149651604._2 | |
1322 | 1327 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1323 | 1328 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1324 | 1329 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1325 | 1330 | else throw("Strict value is not equal to itself.") | |
1326 | 1331 | } | |
1327 | 1332 | else throw("Strict value is not equal to itself.") | |
1328 | 1333 | } | |
1329 | 1334 | else throw("Strict value is not equal to itself.") | |
1330 | 1335 | } | |
1331 | 1336 | else throw("Strict value is not equal to itself.") | |
1332 | 1337 | } | |
1333 | 1338 | else throw("Strict value is not equal to itself.") | |
1334 | 1339 | } | |
1335 | 1340 | ||
1336 | 1341 | ||
1337 | 1342 | ||
1338 | 1343 | @Callable(i) | |
1339 | 1344 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
1340 | - | let $ | |
1341 | - | let amountEstimated = $ | |
1342 | - | let commonState = $ | |
1343 | - | let feeAmount = $ | |
1344 | - | let bonus = $ | |
1345 | - | let outInAmountAsset = $ | |
1345 | + | let $t05188252038 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
1346 | + | let amountEstimated = $t05188252038._1 | |
1347 | + | let commonState = $t05188252038._2 | |
1348 | + | let feeAmount = $t05188252038._3 | |
1349 | + | let bonus = $t05188252038._4 | |
1350 | + | let outInAmountAsset = $t05188252038._5 | |
1346 | 1351 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
1347 | 1352 | } | |
1348 | 1353 | ||
1349 | 1354 | ||
1350 | 1355 | ||
1351 | 1356 | @Callable(i) | |
1352 | 1357 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
1353 | 1358 | let isPoolOneTokenOperationsDisabled = { | |
1354 | 1359 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1355 | 1360 | if ($isInstanceOf(@, "Boolean")) | |
1356 | 1361 | then @ | |
1357 | 1362 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1358 | 1363 | } | |
1359 | 1364 | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1360 | 1365 | then if (if (isGlobalShutdown()) | |
1361 | 1366 | then true | |
1362 | 1367 | else (cfgPoolStatus == PoolShutdown)) | |
1363 | 1368 | then true | |
1364 | 1369 | else isPoolOneTokenOperationsDisabled | |
1365 | 1370 | else false | |
1366 | 1371 | let checks = [if (if (!(isGetDisabled)) | |
1367 | 1372 | then true | |
1368 | 1373 | else isManager(i)) | |
1369 | 1374 | then true | |
1370 | 1375 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1371 | 1376 | then true | |
1372 | 1377 | else throwErr("no payments are expected")] | |
1373 | 1378 | if ((checks == checks)) | |
1374 | 1379 | then { | |
1375 | 1380 | let outAssetId = parseAssetId(outAssetIdStr) | |
1376 | 1381 | let userAddress = i.caller | |
1377 | 1382 | let txId = i.transactionId | |
1378 | 1383 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1379 | 1384 | if ((currentKLp == currentKLp)) | |
1380 | 1385 | then { | |
1381 | 1386 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1382 | 1387 | if ((unstakeInv == unstakeInv)) | |
1383 | 1388 | then { | |
1384 | - | let $ | |
1385 | - | if (($ | |
1389 | + | let $t05298053131 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1390 | + | if (($t05298053131 == $t05298053131)) | |
1386 | 1391 | then { | |
1387 | - | let outInAmountAsset = $ | |
1388 | - | let bonus = $ | |
1389 | - | let feeAmount = $ | |
1390 | - | let commonState = $ | |
1391 | - | let amountEstimated = $ | |
1392 | + | let outInAmountAsset = $t05298053131._5 | |
1393 | + | let bonus = $t05298053131._4 | |
1394 | + | let feeAmount = $t05298053131._3 | |
1395 | + | let commonState = $t05298053131._2 | |
1396 | + | let amountEstimated = $t05298053131._1 | |
1392 | 1397 | let amount = if (if ((minOutAmount > 0)) | |
1393 | 1398 | then (minOutAmount > amountEstimated) | |
1394 | 1399 | else false) | |
1395 | 1400 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1396 | 1401 | else amountEstimated | |
1397 | 1402 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1398 | 1403 | if ((burnInv == burnInv)) | |
1399 | 1404 | then { | |
1400 | 1405 | let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount]))) | |
1401 | 1406 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
1402 | 1407 | let sendFee = if ((feeAmount > 0)) | |
1403 | 1408 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1404 | 1409 | else nil | |
1405 | - | let $ | |
1410 | + | let $t05379054037 = { | |
1406 | 1411 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1407 | 1412 | then 0 | |
1408 | 1413 | else feeAmount | |
1409 | 1414 | if (outInAmountAsset) | |
1410 | 1415 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1411 | 1416 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1412 | 1417 | } | |
1413 | - | let amountAssetBalanceDelta = $ | |
1414 | - | let priceAssetBalanceDelta = $ | |
1415 | - | let $ | |
1416 | - | let refreshKLpActions = $ | |
1417 | - | let updatedKLp = $ | |
1418 | + | let amountAssetBalanceDelta = $t05379054037._1 | |
1419 | + | let priceAssetBalanceDelta = $t05379054037._2 | |
1420 | + | let $t05404054148 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1421 | + | let refreshKLpActions = $t05404054148._1 | |
1422 | + | let updatedKLp = $t05404054148._2 | |
1418 | 1423 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1419 | 1424 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1420 | 1425 | then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1421 | 1426 | else throw("Strict value is not equal to itself.") | |
1422 | 1427 | } | |
1423 | 1428 | else throw("Strict value is not equal to itself.") | |
1424 | 1429 | } | |
1425 | 1430 | else throw("Strict value is not equal to itself.") | |
1426 | 1431 | } | |
1427 | 1432 | else throw("Strict value is not equal to itself.") | |
1428 | 1433 | } | |
1429 | 1434 | else throw("Strict value is not equal to itself.") | |
1430 | 1435 | } | |
1431 | 1436 | else throw("Strict value is not equal to itself.") | |
1432 | 1437 | } | |
1433 | 1438 | ||
1434 | 1439 | ||
1435 | 1440 | ||
1436 | 1441 | @Callable(i) | |
1437 | 1442 | func get () = { | |
1438 | 1443 | let res = commonGet(i) | |
1439 | 1444 | let outAmAmt = res._1 | |
1440 | 1445 | let outPrAmt = res._2 | |
1441 | 1446 | let pmtAmt = res._3 | |
1442 | 1447 | let pmtAssetId = res._4 | |
1443 | 1448 | let state = res._5 | |
1444 | 1449 | let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt) | |
1445 | 1450 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1446 | 1451 | if ((currentKLp == currentKLp)) | |
1447 | 1452 | then { | |
1448 | 1453 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1449 | 1454 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1450 | 1455 | then { | |
1451 | - | let $ | |
1452 | - | let refreshKLpActions = $ | |
1453 | - | let updatedKLp = $ | |
1456 | + | let $t05524355324 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1457 | + | let refreshKLpActions = $t05524355324._1 | |
1458 | + | let updatedKLp = $t05524355324._2 | |
1454 | 1459 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1455 | 1460 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1456 | 1461 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1457 | 1462 | else throw("Strict value is not equal to itself.") | |
1458 | 1463 | } | |
1459 | 1464 | else throw("Strict value is not equal to itself.") | |
1460 | 1465 | } | |
1461 | 1466 | else throw("Strict value is not equal to itself.") | |
1462 | 1467 | } | |
1463 | 1468 | ||
1464 | 1469 | ||
1465 | 1470 | ||
1466 | 1471 | @Callable(i) | |
1467 | 1472 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1468 | 1473 | let res = commonGet(i) | |
1469 | 1474 | let outAmAmt = res._1 | |
1470 | 1475 | let outPrAmt = res._2 | |
1471 | 1476 | let pmtAmt = res._3 | |
1472 | 1477 | let pmtAssetId = res._4 | |
1473 | 1478 | let state = res._5 | |
1474 | 1479 | if ((noLessThenAmtAsset > outAmAmt)) | |
1475 | 1480 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1476 | 1481 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1477 | 1482 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1478 | 1483 | else { | |
1479 | 1484 | let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt) | |
1480 | 1485 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1481 | 1486 | if ((currentKLp == currentKLp)) | |
1482 | 1487 | then { | |
1483 | 1488 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1484 | 1489 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1485 | 1490 | then { | |
1486 | - | let $ | |
1487 | - | let refreshKLpActions = $ | |
1488 | - | let updatedKLp = $ | |
1491 | + | let $t05641956500 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1492 | + | let refreshKLpActions = $t05641956500._1 | |
1493 | + | let updatedKLp = $t05641956500._2 | |
1489 | 1494 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1490 | 1495 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1491 | 1496 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1492 | 1497 | else throw("Strict value is not equal to itself.") | |
1493 | 1498 | } | |
1494 | 1499 | else throw("Strict value is not equal to itself.") | |
1495 | 1500 | } | |
1496 | 1501 | else throw("Strict value is not equal to itself.") | |
1497 | 1502 | } | |
1498 | 1503 | } | |
1499 | 1504 | ||
1500 | 1505 | ||
1501 | 1506 | ||
1502 | 1507 | @Callable(i) | |
1503 | 1508 | func unstakeAndGet (amount) = { | |
1504 | 1509 | let checkPayments = if ((size(i.payments) != 0)) | |
1505 | 1510 | then throw("No payments are expected") | |
1506 | 1511 | else true | |
1507 | 1512 | if ((checkPayments == checkPayments)) | |
1508 | 1513 | then { | |
1509 | 1514 | let cfg = getPoolConfig() | |
1510 | 1515 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1511 | 1516 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1512 | 1517 | if ((currentKLp == currentKLp)) | |
1513 | 1518 | then { | |
1514 | 1519 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1515 | 1520 | if ((unstakeInv == unstakeInv)) | |
1516 | 1521 | then { | |
1517 | 1522 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1518 | 1523 | let outAmAmt = res._1 | |
1519 | 1524 | let outPrAmt = res._2 | |
1520 | 1525 | let poolStatus = parseIntValue(res._9) | |
1521 | 1526 | let state = res._10 | |
1522 | 1527 | let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt) | |
1523 | 1528 | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1524 | 1529 | then if (isGlobalShutdown()) | |
1525 | 1530 | then true | |
1526 | 1531 | else (cfgPoolStatus == PoolShutdown) | |
1527 | 1532 | else false | |
1528 | 1533 | let checkPoolStatus = if (isGetDisabled) | |
1529 | 1534 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
1530 | 1535 | else true | |
1531 | 1536 | if ((checkPoolStatus == checkPoolStatus)) | |
1532 | 1537 | then { | |
1533 | 1538 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1534 | 1539 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1535 | 1540 | then { | |
1536 | - | let $ | |
1537 | - | let refreshKLpActions = $ | |
1538 | - | let updatedKLp = $ | |
1541 | + | let $t05784857929 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1542 | + | let refreshKLpActions = $t05784857929._1 | |
1543 | + | let updatedKLp = $t05784857929._2 | |
1539 | 1544 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1540 | 1545 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1541 | 1546 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1542 | 1547 | else throw("Strict value is not equal to itself.") | |
1543 | 1548 | } | |
1544 | 1549 | else throw("Strict value is not equal to itself.") | |
1545 | 1550 | } | |
1546 | 1551 | else throw("Strict value is not equal to itself.") | |
1547 | 1552 | } | |
1548 | 1553 | else throw("Strict value is not equal to itself.") | |
1549 | 1554 | } | |
1550 | 1555 | else throw("Strict value is not equal to itself.") | |
1551 | 1556 | } | |
1552 | 1557 | else throw("Strict value is not equal to itself.") | |
1553 | 1558 | } | |
1554 | 1559 | ||
1555 | 1560 | ||
1556 | 1561 | ||
1557 | 1562 | @Callable(i) | |
1558 | 1563 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1559 | 1564 | let isGetDisabled = if (!(isAddressWhitelisted(i.caller))) | |
1560 | 1565 | then if (isGlobalShutdown()) | |
1561 | 1566 | then true | |
1562 | 1567 | else (cfgPoolStatus == PoolShutdown) | |
1563 | 1568 | else false | |
1564 | 1569 | let checks = [if (!(isGetDisabled)) | |
1565 | 1570 | then true | |
1566 | 1571 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1567 | 1572 | then true | |
1568 | 1573 | else throw("no payments are expected")] | |
1569 | 1574 | if ((checks == checks)) | |
1570 | 1575 | then { | |
1571 | 1576 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1572 | 1577 | if ((currentKLp == currentKLp)) | |
1573 | 1578 | then { | |
1574 | 1579 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1575 | 1580 | if ((unstakeInv == unstakeInv)) | |
1576 | 1581 | then { | |
1577 | 1582 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1578 | 1583 | let outAmAmt = res._1 | |
1579 | 1584 | let outPrAmt = res._2 | |
1580 | 1585 | let state = res._10 | |
1581 | 1586 | let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt) | |
1582 | 1587 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1583 | 1588 | then true | |
1584 | 1589 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1585 | 1590 | then true | |
1586 | 1591 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1587 | 1592 | if ((checkAmounts == checkAmounts)) | |
1588 | 1593 | then { | |
1589 | 1594 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1590 | 1595 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1591 | 1596 | then { | |
1592 | - | let $ | |
1593 | - | let refreshKLpActions = $ | |
1594 | - | let updatedKLp = $ | |
1597 | + | let $t05940759488 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1598 | + | let refreshKLpActions = $t05940759488._1 | |
1599 | + | let updatedKLp = $t05940759488._2 | |
1595 | 1600 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1596 | 1601 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1597 | 1602 | then ((withdrawState ++ state) ++ refreshKLpActions) | |
1598 | 1603 | else throw("Strict value is not equal to itself.") | |
1599 | 1604 | } | |
1600 | 1605 | else throw("Strict value is not equal to itself.") | |
1601 | 1606 | } | |
1602 | 1607 | else throw("Strict value is not equal to itself.") | |
1603 | 1608 | } | |
1604 | 1609 | else throw("Strict value is not equal to itself.") | |
1605 | 1610 | } | |
1606 | 1611 | else throw("Strict value is not equal to itself.") | |
1607 | 1612 | } | |
1608 | 1613 | else throw("Strict value is not equal to itself.") | |
1609 | 1614 | } | |
1610 | 1615 | ||
1611 | 1616 | ||
1612 | 1617 | ||
1613 | 1618 | @Callable(i) | |
1614 | 1619 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
1615 | 1620 | then throw("permissions denied") | |
1616 | 1621 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
1617 | 1622 | ||
1618 | 1623 | ||
1619 | 1624 | ||
1620 | 1625 | @Callable(i) | |
1621 | 1626 | func refreshKLp () = { | |
1622 | 1627 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0) | |
1623 | 1628 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay)) | |
1624 | 1629 | then unit | |
1625 | 1630 | else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1626 | 1631 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1627 | 1632 | then { | |
1628 | 1633 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1629 | - | let $ | |
1630 | - | let kLpUpdateActions = $ | |
1631 | - | let updatedKLp = $ | |
1634 | + | let $t06069260756 = refreshKLpInternal(0, 0, 0) | |
1635 | + | let kLpUpdateActions = $t06069260756._1 | |
1636 | + | let updatedKLp = $t06069260756._2 | |
1632 | 1637 | let actions = if ((kLp != updatedKLp)) | |
1633 | 1638 | then kLpUpdateActions | |
1634 | 1639 | else throwErr("nothing to refresh") | |
1635 | 1640 | $Tuple2(actions, toString(updatedKLp)) | |
1636 | 1641 | } | |
1637 | 1642 | else throw("Strict value is not equal to itself.") | |
1638 | 1643 | } | |
1639 | 1644 | ||
1640 | 1645 | ||
1641 | 1646 | ||
1642 | 1647 | @Callable(i) | |
1643 | 1648 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
1644 | 1649 | ||
1645 | 1650 | ||
1646 | 1651 | ||
1647 | 1652 | @Callable(i) | |
1648 | 1653 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1649 | 1654 | ||
1650 | 1655 | ||
1651 | 1656 | ||
1652 | 1657 | @Callable(i) | |
1653 | 1658 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1654 | 1659 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
1655 | 1660 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
1656 | 1661 | } | |
1657 | 1662 | ||
1658 | 1663 | ||
1659 | 1664 | ||
1660 | 1665 | @Callable(i) | |
1661 | 1666 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
1662 | 1667 | ||
1663 | 1668 | ||
1664 | 1669 | ||
1665 | 1670 | @Callable(i) | |
1666 | 1671 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
1667 | 1672 | ||
1668 | 1673 | ||
1669 | 1674 | ||
1670 | 1675 | @Callable(i) | |
1671 | 1676 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1672 | 1677 | ||
1673 | 1678 | ||
1674 | 1679 | ||
1675 | 1680 | @Callable(i) | |
1676 | 1681 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1677 | 1682 | ||
1678 | 1683 | ||
1679 | 1684 | ||
1680 | 1685 | @Callable(i) | |
1681 | 1686 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1682 | 1687 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1683 | 1688 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1684 | 1689 | } | |
1685 | 1690 | ||
1686 | 1691 | ||
1687 | 1692 | ||
1688 | 1693 | @Callable(i) | |
1689 | 1694 | func statsREADONLY () = { | |
1690 | 1695 | let cfg = getPoolConfig() | |
1691 | 1696 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1692 | 1697 | let amtAssetId = cfg[idxAmtAssetId] | |
1693 | 1698 | let priceAssetId = cfg[idxPriceAssetId] | |
1694 | 1699 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1695 | 1700 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1696 | 1701 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1697 | 1702 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1698 | 1703 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1699 | 1704 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1700 | 1705 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1701 | 1706 | let pricesList = if ((poolLPBalance == 0)) | |
1702 | 1707 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1703 | 1708 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1704 | 1709 | let curPrice = 0 | |
1705 | 1710 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1706 | 1711 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1707 | 1712 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1708 | 1713 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP)) | |
1709 | 1714 | } | |
1710 | 1715 | ||
1711 | 1716 | ||
1712 | 1717 | ||
1713 | 1718 | @Callable(i) | |
1714 | 1719 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1715 | 1720 | let cfg = getPoolConfig() | |
1716 | 1721 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1717 | 1722 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1718 | 1723 | let amAssetId = fromBase58String(amAssetIdStr) | |
1719 | 1724 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1720 | 1725 | let prAssetId = fromBase58String(prAssetIdStr) | |
1721 | 1726 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1722 | 1727 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1723 | 1728 | let poolStatus = cfg[idxPoolStatus] | |
1724 | 1729 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1725 | 1730 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1726 | 1731 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1727 | 1732 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1728 | 1733 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1729 | 1734 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1730 | 1735 | then zeroBigInt | |
1731 | 1736 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1732 | 1737 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1733 | 1738 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1734 | 1739 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1735 | 1740 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1736 | 1741 | let calcLpAmt = estPut._1 | |
1737 | 1742 | let curPriceCalc = estPut._3 | |
1738 | 1743 | let amBalance = estPut._4 | |
1739 | 1744 | let prBalance = estPut._5 | |
1740 | 1745 | let lpEmission = estPut._6 | |
1741 | 1746 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1742 | 1747 | } | |
1743 | 1748 | ||
1744 | 1749 | ||
1745 | 1750 | ||
1746 | 1751 | @Callable(i) | |
1747 | 1752 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1748 | 1753 | let cfg = getPoolConfig() | |
1749 | 1754 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1750 | 1755 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1751 | 1756 | let amAssetId = fromBase58String(amAssetIdStr) | |
1752 | 1757 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1753 | 1758 | let prAssetId = fromBase58String(prAssetIdStr) | |
1754 | 1759 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1755 | 1760 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1756 | 1761 | let poolStatus = cfg[idxPoolStatus] | |
1757 | 1762 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1758 | 1763 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1759 | 1764 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1760 | 1765 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1761 | 1766 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1762 | 1767 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1763 | 1768 | then zeroBigInt | |
1764 | 1769 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1765 | 1770 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1766 | 1771 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1767 | 1772 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1768 | 1773 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1769 | 1774 | let calcLpAmt = estPut._1 | |
1770 | 1775 | let curPriceCalc = estPut._3 | |
1771 | 1776 | let amBalance = estPut._4 | |
1772 | 1777 | let prBalance = estPut._5 | |
1773 | 1778 | let lpEmission = estPut._6 | |
1774 | 1779 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1775 | 1780 | } | |
1776 | 1781 | ||
1777 | 1782 | ||
1778 | 1783 | ||
1779 | 1784 | @Callable(i) | |
1780 | 1785 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1781 | 1786 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1782 | 1787 | let outAmAmt = res._1 | |
1783 | 1788 | let outPrAmt = res._2 | |
1784 | 1789 | let amBalance = res._5 | |
1785 | 1790 | let prBalance = res._6 | |
1786 | 1791 | let lpEmission = res._7 | |
1787 | 1792 | let curPrice = res._8 | |
1788 | 1793 | let poolStatus = parseIntValue(res._9) | |
1789 | 1794 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), toString(curPrice), toString(poolStatus)], SEP)) | |
1790 | 1795 | } | |
1791 | 1796 | ||
1792 | 1797 | ||
1793 | 1798 | @Verifier(tx) | |
1794 | 1799 | func verify () = { | |
1795 | 1800 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1796 | 1801 | case pk: ByteVector => | |
1797 | 1802 | pk | |
1798 | 1803 | case _: Unit => | |
1799 | 1804 | tx.senderPublicKey | |
1800 | 1805 | case _ => | |
1801 | 1806 | throw("Match error") | |
1802 | 1807 | } | |
1803 | 1808 | match tx { | |
1804 | 1809 | case order: Order => | |
1805 | 1810 | let matcherPub = getMatcherPubOrFail() | |
1806 | - | let $ | |
1811 | + | let $t06941869646 = if (skipOrderValidation()) | |
1807 | 1812 | then $Tuple2(true, "") | |
1808 | 1813 | else validateMatcherOrderAllowed(order) | |
1809 | - | let orderValid = $t06942969546._1 | |
1810 | - | let orderValidInfo = $t06942969546._2 | |
1811 | - | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1814 | + | let orderValid = $t06941869646._1 | |
1815 | + | let orderValidInfo = $t06941869646._2 | |
1812 | 1816 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1813 | - | if (if (if (orderValid) | |
1814 | - | then senderValid | |
1815 | - | else false) | |
1817 | + | if (if (orderValid) | |
1816 | 1818 | then matcherValid | |
1817 | 1819 | else false) | |
1818 | 1820 | then true | |
1819 | - | else throwOrderError(orderValid, orderValidInfo, | |
1821 | + | else throwOrderError(orderValid, orderValidInfo, matcherValid) | |
1820 | 1822 | case s: SetScriptTransaction => | |
1821 | 1823 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1822 | 1824 | then true | |
1823 | 1825 | else { | |
1824 | 1826 | let newHash = blake2b256(value(s.script)) | |
1825 | 1827 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1826 | 1828 | let currentHash = scriptHash(this) | |
1827 | 1829 | if ((allowedHash == newHash)) | |
1828 | 1830 | then (currentHash != newHash) | |
1829 | 1831 | else false | |
1830 | 1832 | } | |
1831 | 1833 | case _ => | |
1832 | 1834 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1833 | 1835 | } | |
1834 | 1836 | } | |
1835 | 1837 |
github/deemru/w8io/026f985 413.57 ms ◑