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