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