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