tx · EPTnnvxyLV7R64fMN83EiSjsgSnhHNRhSjTjMBZ9uKrE 3N6VuZMbPQQ9LjuAGMzCKSBKNZdXdVMqzuy: -0.03500000 Waves 2022.12.08 09:54 [2351040] smart account 3N6VuZMbPQQ9LjuAGMzCKSBKNZdXdVMqzuy > SELF 0.00000000 Waves
{ "type": 13, "id": "EPTnnvxyLV7R64fMN83EiSjsgSnhHNRhSjTjMBZ9uKrE", "fee": 3500000, "feeAssetId": null, "timestamp": 1670482503878, "version": 1, "sender": "3N6VuZMbPQQ9LjuAGMzCKSBKNZdXdVMqzuy", "senderPublicKey": "EBrsNJxDcF3dp4oPjbdRu1B95ZcFy6ruHsGywkaD73hN", "proofs": [ "3bM7F6HGoFkxjjTs41NCFrQ5JFzgRrgo4qFa9gQQdsyG4yo2mg6MuwJsAHpzx2ELQXYzmjtD5gLmN793L7y6Cp2d" ], "script": "base64:BgKgLQgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0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lCeXRlcwkAkQMCCAUCZHMGcHJvb2ZzAAEFAmdGAwMDBQJhQgUCYUMHBQJhRAcGCQECYUEDBQJhQgUCYUMFAmFEAwkAAQIFAmROAhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCZVEFAmROBAJnRwkA9gMBCQEFdmFsdWUBCAUCZVEGc2NyaXB0BAJnSAkA2wQBCQEFdmFsdWUBCQCdCAIFAmFMCQECYXkABAJnSQkA8QcBBQR0aGlzAwMJAAACBQJnSAUCZ0cJAQIhPQIFAmdJBQJnRwcGCQD0AwMIBQJnQwlib2R5Qnl0ZXMJAJEDAggFAmdDBnByb29mcwAABQJnRQkA9AMDCAUCZ0MJYm9keUJ5dGVzCQCRAwIIBQJnQwZwcm9vZnMAAAUCZ0V0XrXd", "chainId": 84, "height": 2351040, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FQc9iwkKD2iF6JLXBERQh22yCUUUNmeL7w5vF5wkpr2r Next: GFiJNsk14ax3UXmtbEe93j3mCQUGvU6AzQEmKrif6MfA Diff:
Old | New | Differences | |
---|---|---|---|
63 | 63 | ||
64 | 64 | ||
65 | 65 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
66 | + | ||
67 | + | ||
68 | + | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
66 | 69 | ||
67 | 70 | ||
68 | 71 | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
196 | 199 | ||
197 | 200 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
198 | 201 | ||
199 | - | let $ | |
202 | + | let $t080638229 = poolConfigParsed | |
200 | 203 | ||
201 | - | let cfgPoolAddress = $ | |
204 | + | let cfgPoolAddress = $t080638229._1 | |
202 | 205 | ||
203 | - | let cfgPoolStatus = $ | |
206 | + | let cfgPoolStatus = $t080638229._2 | |
204 | 207 | ||
205 | - | let cfgLpAssetId = $ | |
208 | + | let cfgLpAssetId = $t080638229._3 | |
206 | 209 | ||
207 | - | let cfgAmountAssetId = $ | |
210 | + | let cfgAmountAssetId = $t080638229._4 | |
208 | 211 | ||
209 | - | let cfgPriceAssetId = $ | |
212 | + | let cfgPriceAssetId = $t080638229._5 | |
210 | 213 | ||
211 | - | let cfgAmountAssetDecimals = $ | |
214 | + | let cfgAmountAssetDecimals = $t080638229._6 | |
212 | 215 | ||
213 | - | let cfgPriceAssetDecimals = $ | |
216 | + | let cfgPriceAssetDecimals = $t080638229._7 | |
214 | 217 | ||
215 | 218 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
216 | 219 | ||
353 | 356 | let expAmtAssetAmtX18 = expectedAmts._1 | |
354 | 357 | let expPriceAssetAmtX18 = expectedAmts._2 | |
355 | 358 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR) | |
356 | - | $Tuple5( | |
359 | + | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18) | |
357 | 360 | } | |
358 | 361 | } | |
359 | 362 | let calcLpAmt = res._1 | |
411 | 414 | func validateMatcherOrderAllowed (order) = { | |
412 | 415 | let amountAssetAmount = order.amount | |
413 | 416 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
414 | - | let $ | |
417 | + | let $t02080321015 = if ((order.orderType == Buy)) | |
415 | 418 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
416 | 419 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
417 | - | let amountAssetBalanceDelta = $ | |
418 | - | let priceAssetBalanceDelta = $ | |
420 | + | let amountAssetBalanceDelta = $t02080321015._1 | |
421 | + | let priceAssetBalanceDelta = $t02080321015._2 | |
419 | 422 | if (if (if (isGlobalShutdown()) | |
420 | 423 | then true | |
421 | 424 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
428 | 431 | then throw("Wrong order assets.") | |
429 | 432 | else { | |
430 | 433 | let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp")) | |
431 | - | let $ | |
432 | - | let unusedActions = $ | |
433 | - | let kLpNew = $ | |
434 | + | let $t02148621586 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
435 | + | let unusedActions = $t02148621586._1 | |
436 | + | let kLpNew = $t02148621586._2 | |
434 | 437 | let isOrderValid = (kLpNew >= kLp) | |
435 | 438 | isOrderValid | |
436 | 439 | } | |
506 | 509 | else if ((paymentAssetId == cfgPriceAssetId)) | |
507 | 510 | then false | |
508 | 511 | else throwErr("invalid asset") | |
509 | - | let $ | |
512 | + | let $t02427124564 = if (isEval) | |
510 | 513 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
511 | 514 | else if (paymentInAmountAsset) | |
512 | 515 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
513 | 516 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
514 | - | let amountBalanceOld = $ | |
515 | - | let priceBalanceOld = $ | |
516 | - | let $ | |
517 | + | let amountBalanceOld = $t02427124564._1 | |
518 | + | let priceBalanceOld = $t02427124564._2 | |
519 | + | let $t02456824717 = if (paymentInAmountAsset) | |
517 | 520 | then $Tuple2(paymentAmountRaw, 0) | |
518 | 521 | else $Tuple2(0, paymentAmountRaw) | |
519 | - | let amountAssetAmountRaw = $ | |
520 | - | let priceAssetAmountRaw = $ | |
522 | + | let amountAssetAmountRaw = $t02456824717._1 | |
523 | + | let priceAssetAmountRaw = $t02456824717._2 | |
521 | 524 | let amountAssetAmount = takeFee(amountAssetAmountRaw)._1 | |
522 | 525 | let priceAssetAmount = takeFee(priceAssetAmountRaw)._1 | |
523 | - | let $ | |
524 | - | let paymentAmount = $ | |
525 | - | let feeAmount = $ | |
526 | + | let $t02483924898 = takeFee(paymentAmountRaw) | |
527 | + | let paymentAmount = $t02483924898._1 | |
528 | + | let feeAmount = $t02483924898._2 | |
526 | 529 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
527 | 530 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
528 | 531 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
545 | 548 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
546 | 549 | let priceOld = fromX18(priceOldX18, scale8) | |
547 | 550 | let loss = { | |
548 | - | let $ | |
551 | + | let $t02637526542 = if (paymentInAmountAsset) | |
549 | 552 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
550 | 553 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
551 | - | let amount = $ | |
552 | - | let balance = $ | |
554 | + | let amount = $t02637526542._1 | |
555 | + | let balance = $t02637526542._2 | |
553 | 556 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
554 | 557 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
555 | 558 | } | |
583 | 586 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
584 | 587 | let redeemedBigInt = toBigInt(paymentAmount) | |
585 | 588 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
586 | - | let $ | |
587 | - | let totalAmount = $ | |
588 | - | let feeAmount = $ | |
589 | - | let $ | |
589 | + | let $t02814428194 = takeFee(amountRaw) | |
590 | + | let totalAmount = $t02814428194._1 | |
591 | + | let feeAmount = $t02814428194._2 | |
592 | + | let $t02819828424 = if (outInAmountAsset) | |
590 | 593 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
591 | 594 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
592 | - | let outAmAmount = $ | |
593 | - | let outPrAmount = $ | |
594 | - | let amBalanceNew = $ | |
595 | - | let prBalanceNew = $ | |
595 | + | let outAmAmount = $t02819828424._1 | |
596 | + | let outPrAmount = $t02819828424._2 | |
597 | + | let amBalanceNew = $t02819828424._3 | |
598 | + | let prBalanceNew = $t02819828424._4 | |
596 | 599 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
597 | 600 | let priceNew = fromX18(priceNewX18, scale8) | |
598 | 601 | let commonState = if (isEval) | |
750 | 753 | let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity | |
751 | 754 | if ((lpAssetEmissionAfter == lpAssetEmissionAfter)) | |
752 | 755 | then { | |
753 | - | let $ | |
754 | - | if (($ | |
756 | + | let $t03294433012 = refreshKLpInternal(0, 0, 0) | |
757 | + | if (($t03294433012 == $t03294433012)) | |
755 | 758 | then { | |
756 | - | let updatedKLp = $ | |
757 | - | let refreshKLpActions = $ | |
759 | + | let updatedKLp = $t03294433012._2 | |
760 | + | let refreshKLpActions = $t03294433012._1 | |
758 | 761 | let error = throwErr(makeString([toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentKLp), toString(updatedKLp), toString(emitLpAmt), toString(amDiff), toString(prDiff), toString(lpAssetEmission), toString(lpAssetEmissionAfter)], " ")) | |
759 | 762 | if ((error == error)) | |
760 | 763 | then { | |
799 | 802 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
800 | 803 | if ((currentKLp == currentKLp)) | |
801 | 804 | then { | |
802 | - | let $ | |
803 | - | let refreshKLpActions = $ | |
804 | - | let updatedKLp = $ | |
805 | + | let $t03394434009 = refreshKLpInternal(0, 0, 0) | |
806 | + | let refreshKLpActions = $t03394434009._1 | |
807 | + | let updatedKLp = $t03394434009._2 | |
805 | 808 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
806 | 809 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
807 | 810 | then (state ++ refreshKLpActions) | |
846 | 849 | else throwErr("payment asset is not supported") | |
847 | 850 | let userAddress = i.caller | |
848 | 851 | let txId = i.transactionId | |
849 | - | let $ | |
850 | - | if (($ | |
852 | + | let $t03519435346 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
853 | + | if (($t03519435346 == $t03519435346)) | |
851 | 854 | then { | |
852 | - | let paymentInAmountAsset = $ | |
853 | - | let bonus = $ | |
854 | - | let feeAmount = $ | |
855 | - | let commonState = $ | |
856 | - | let emitAmountEstimated = $ | |
855 | + | let paymentInAmountAsset = $t03519435346._5 | |
856 | + | let bonus = $t03519435346._4 | |
857 | + | let feeAmount = $t03519435346._3 | |
858 | + | let commonState = $t03519435346._2 | |
859 | + | let emitAmountEstimated = $t03519435346._1 | |
857 | 860 | let emitAmount = if (if ((minOutAmount > 0)) | |
858 | 861 | then (minOutAmount > emitAmountEstimated) | |
859 | 862 | else false) | |
873 | 876 | let sendFee = if ((feeAmount > 0)) | |
874 | 877 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
875 | 878 | else nil | |
876 | - | let $ | |
879 | + | let $t03593236129 = if ((this == feeCollectorAddress)) | |
877 | 880 | then $Tuple2(0, 0) | |
878 | 881 | else if (paymentInAmountAsset) | |
879 | 882 | then $Tuple2(-(feeAmount), 0) | |
880 | 883 | else $Tuple2(0, -(feeAmount)) | |
881 | - | let amountAssetBalanceDelta = $ | |
882 | - | let priceAssetBalanceDelta = $ | |
883 | - | let $ | |
884 | - | let refreshKLpActions = $ | |
885 | - | let updatedKLp = $ | |
884 | + | let amountAssetBalanceDelta = $t03593236129._1 | |
885 | + | let priceAssetBalanceDelta = $t03593236129._2 | |
886 | + | let $t03613236240 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
887 | + | let refreshKLpActions = $t03613236240._1 | |
888 | + | let updatedKLp = $t03613236240._2 | |
886 | 889 | let kLp = value(getString(keyKLp)) | |
887 | 890 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
888 | 891 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
900 | 903 | ||
901 | 904 | @Callable(i) | |
902 | 905 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
903 | - | let $ | |
904 | - | let emitAmountEstimated = $ | |
905 | - | let commonState = $ | |
906 | - | let feeAmount = $ | |
907 | - | let bonus = $ | |
908 | - | let paymentInAmountAsset = $ | |
906 | + | let $t03654636703 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
907 | + | let emitAmountEstimated = $t03654636703._1 | |
908 | + | let commonState = $t03654636703._2 | |
909 | + | let feeAmount = $t03654636703._3 | |
910 | + | let bonus = $t03654636703._4 | |
911 | + | let paymentInAmountAsset = $t03654636703._5 | |
909 | 912 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
910 | 913 | } | |
911 | 914 | ||
940 | 943 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount)) | |
941 | 944 | let userAddress = i.caller | |
942 | 945 | let txId = i.transactionId | |
943 | - | let $ | |
944 | - | if (($ | |
946 | + | let $t03759737750 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
947 | + | if (($t03759737750 == $t03759737750)) | |
945 | 948 | then { | |
946 | - | let outInAmountAsset = $ | |
947 | - | let bonus = $ | |
948 | - | let feeAmount = $ | |
949 | - | let commonState = $ | |
950 | - | let amountEstimated = $ | |
949 | + | let outInAmountAsset = $t03759737750._5 | |
950 | + | let bonus = $t03759737750._4 | |
951 | + | let feeAmount = $t03759737750._3 | |
952 | + | let commonState = $t03759737750._2 | |
953 | + | let amountEstimated = $t03759737750._1 | |
951 | 954 | let amount = if (if ((minOutAmount > 0)) | |
952 | 955 | then (minOutAmount > amountEstimated) | |
953 | 956 | else false) | |
960 | 963 | let sendFee = if ((feeAmount > 0)) | |
961 | 964 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
962 | 965 | else nil | |
963 | - | let $ | |
966 | + | let $t03825038497 = { | |
964 | 967 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
965 | 968 | then 0 | |
966 | 969 | else feeAmount | |
968 | 971 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
969 | 972 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
970 | 973 | } | |
971 | - | let amountAssetBalanceDelta = $ | |
972 | - | let priceAssetBalanceDelta = $ | |
973 | - | let $ | |
974 | - | let refreshKLpActions = $ | |
975 | - | let updatedKLp = $ | |
974 | + | let amountAssetBalanceDelta = $t03825038497._1 | |
975 | + | let priceAssetBalanceDelta = $t03825038497._2 | |
976 | + | let $t03850038608 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
977 | + | let refreshKLpActions = $t03850038608._1 | |
978 | + | let updatedKLp = $t03850038608._2 | |
976 | 979 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
977 | 980 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
978 | 981 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
989 | 992 | ||
990 | 993 | @Callable(i) | |
991 | 994 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
992 | - | let $ | |
993 | - | let amountEstimated = $ | |
994 | - | let commonState = $ | |
995 | - | let feeAmount = $ | |
996 | - | let bonus = $ | |
997 | - | let outInAmountAsset = $ | |
995 | + | let $t03886539021 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
996 | + | let amountEstimated = $t03886539021._1 | |
997 | + | let commonState = $t03886539021._2 | |
998 | + | let feeAmount = $t03886539021._3 | |
999 | + | let bonus = $t03886539021._4 | |
1000 | + | let outInAmountAsset = $t03886539021._5 | |
998 | 1001 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
999 | 1002 | } | |
1000 | 1003 | ||
1029 | 1032 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1030 | 1033 | if ((unstakeInv == unstakeInv)) | |
1031 | 1034 | then { | |
1032 | - | let $ | |
1033 | - | if (($ | |
1035 | + | let $t03992340074 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1036 | + | if (($t03992340074 == $t03992340074)) | |
1034 | 1037 | then { | |
1035 | - | let outInAmountAsset = $ | |
1036 | - | let bonus = $ | |
1037 | - | let feeAmount = $ | |
1038 | - | let commonState = $ | |
1039 | - | let amountEstimated = $ | |
1038 | + | let outInAmountAsset = $t03992340074._5 | |
1039 | + | let bonus = $t03992340074._4 | |
1040 | + | let feeAmount = $t03992340074._3 | |
1041 | + | let commonState = $t03992340074._2 | |
1042 | + | let amountEstimated = $t03992340074._1 | |
1040 | 1043 | let amount = if (if ((minOutAmount > 0)) | |
1041 | 1044 | then (minOutAmount > amountEstimated) | |
1042 | 1045 | else false) | |
1049 | 1052 | let sendFee = if ((feeAmount > 0)) | |
1050 | 1053 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1051 | 1054 | else nil | |
1052 | - | let $ | |
1055 | + | let $t04056940816 = { | |
1053 | 1056 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1054 | 1057 | then 0 | |
1055 | 1058 | else feeAmount | |
1057 | 1060 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1058 | 1061 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1059 | 1062 | } | |
1060 | - | let amountAssetBalanceDelta = $ | |
1061 | - | let priceAssetBalanceDelta = $ | |
1062 | - | let $ | |
1063 | - | let refreshKLpActions = $ | |
1064 | - | let updatedKLp = $ | |
1063 | + | let amountAssetBalanceDelta = $t04056940816._1 | |
1064 | + | let priceAssetBalanceDelta = $t04056940816._2 | |
1065 | + | let $t04081940927 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1066 | + | let refreshKLpActions = $t04081940927._1 | |
1067 | + | let updatedKLp = $t04081940927._2 | |
1065 | 1068 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1066 | 1069 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1067 | 1070 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1090 | 1093 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1091 | 1094 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1092 | 1095 | then { | |
1093 | - | let $ | |
1094 | - | let refreshKLpActions = $ | |
1095 | - | let updatedKLp = $ | |
1096 | + | let $t04187541957 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1097 | + | let refreshKLpActions = $t04187541957._1 | |
1098 | + | let updatedKLp = $t04187541957._2 | |
1096 | 1099 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1097 | 1100 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1098 | 1101 | then (state ++ refreshKLpActions) | |
1120 | 1123 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1121 | 1124 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1122 | 1125 | then { | |
1123 | - | let $ | |
1124 | - | let refreshKLpActions = $ | |
1125 | - | let updatedKLp = $ | |
1126 | + | let $t04290842989 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1127 | + | let refreshKLpActions = $t04290842989._1 | |
1128 | + | let updatedKLp = $t04290842989._2 | |
1126 | 1129 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1127 | 1130 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1128 | 1131 | then (state ++ refreshKLpActions) | |
1162 | 1165 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1163 | 1166 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1164 | 1167 | then { | |
1165 | - | let $ | |
1166 | - | let refreshKLpActions = $ | |
1167 | - | let updatedKLp = $ | |
1168 | + | let $t04411244193 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1169 | + | let refreshKLpActions = $t04411244193._1 | |
1170 | + | let updatedKLp = $t04411244193._2 | |
1168 | 1171 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1169 | 1172 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1170 | 1173 | then (state ++ refreshKLpActions) | |
1211 | 1214 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1212 | 1215 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1213 | 1216 | then { | |
1214 | - | let $ | |
1215 | - | let refreshKLpActions = $ | |
1216 | - | let updatedKLp = $ | |
1217 | + | let $t04548545566 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1218 | + | let refreshKLpActions = $t04548545566._1 | |
1219 | + | let updatedKLp = $t04548545566._2 | |
1217 | 1220 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1218 | 1221 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1219 | 1222 | then (state ++ refreshKLpActions) | |
1246 | 1249 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1247 | 1250 | then { | |
1248 | 1251 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1249 | - | let $ | |
1250 | - | let kLpUpdateActions = $ | |
1251 | - | let updatedKLp = $ | |
1252 | + | let $t04675346817 = refreshKLpInternal(0, 0, 0) | |
1253 | + | let kLpUpdateActions = $t04675346817._1 | |
1254 | + | let updatedKLp = $t04675346817._2 | |
1252 | 1255 | let actions = if ((kLp != updatedKLp)) | |
1253 | 1256 | then kLpUpdateActions | |
1254 | 1257 | else throwErr("nothing to refresh") |
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 fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
66 | + | ||
67 | + | ||
68 | + | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
66 | 69 | ||
67 | 70 | ||
68 | 71 | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
69 | 72 | ||
70 | 73 | ||
71 | 74 | func abs (val) = if ((0 > val)) | |
72 | 75 | then -(val) | |
73 | 76 | else val | |
74 | 77 | ||
75 | 78 | ||
76 | 79 | func absBigInt (val) = if ((zeroBigInt > val)) | |
77 | 80 | then -(val) | |
78 | 81 | else val | |
79 | 82 | ||
80 | 83 | ||
81 | 84 | func fc () = "%s__factoryContract" | |
82 | 85 | ||
83 | 86 | ||
84 | 87 | func mpk () = "%s__managerPublicKey" | |
85 | 88 | ||
86 | 89 | ||
87 | 90 | func pmpk () = "%s__pendingManagerPublicKey" | |
88 | 91 | ||
89 | 92 | ||
90 | 93 | func pl () = "%s%s__price__last" | |
91 | 94 | ||
92 | 95 | ||
93 | 96 | func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP) | |
94 | 97 | ||
95 | 98 | ||
96 | 99 | func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId) | |
97 | 100 | ||
98 | 101 | ||
99 | 102 | func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
100 | 103 | ||
101 | 104 | ||
102 | 105 | func aa () = "%s__amountAsset" | |
103 | 106 | ||
104 | 107 | ||
105 | 108 | func pa () = "%s__priceAsset" | |
106 | 109 | ||
107 | 110 | ||
108 | 111 | let keyFee = "%s__fee" | |
109 | 112 | ||
110 | 113 | let feeDefault = fraction(10, scale8, 10000) | |
111 | 114 | ||
112 | 115 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
113 | 116 | ||
114 | 117 | let keyKLp = makeString(["%s", "kLp"], SEP) | |
115 | 118 | ||
116 | 119 | let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP) | |
117 | 120 | ||
118 | 121 | let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP) | |
119 | 122 | ||
120 | 123 | let kLpRefreshDelayDefault = 30 | |
121 | 124 | ||
122 | 125 | let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault) | |
123 | 126 | ||
124 | 127 | func keyFactoryConfig () = "%s__factoryConfig" | |
125 | 128 | ||
126 | 129 | ||
127 | 130 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
128 | 131 | ||
129 | 132 | ||
130 | 133 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
131 | 134 | ||
132 | 135 | ||
133 | 136 | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
134 | 137 | ||
135 | 138 | ||
136 | 139 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
137 | 140 | ||
138 | 141 | ||
139 | 142 | func keyAllPoolsShutdown () = "%s__shutdown" | |
140 | 143 | ||
141 | 144 | ||
142 | 145 | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
143 | 146 | ||
144 | 147 | ||
145 | 148 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
146 | 149 | ||
147 | 150 | ||
148 | 151 | let keyFeeCollectorAddress = "%s__feeCollectorAddress" | |
149 | 152 | ||
150 | 153 | func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
151 | 154 | ||
152 | 155 | ||
153 | 156 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
154 | 157 | ||
155 | 158 | ||
156 | 159 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
157 | 160 | ||
158 | 161 | ||
159 | 162 | func throwErr (msg) = throw(makeString(["lp.ride:", msg], " ")) | |
160 | 163 | ||
161 | 164 | ||
162 | 165 | func fmtErr (msg) = makeString(["lp.ride:", msg], " ") | |
163 | 166 | ||
164 | 167 | ||
165 | 168 | let factoryContract = addressFromStringValue(getStringOrFail(this, fc())) | |
166 | 169 | ||
167 | 170 | let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress)) | |
168 | 171 | ||
169 | 172 | func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false) | |
170 | 173 | ||
171 | 174 | ||
172 | 175 | func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub())) | |
173 | 176 | ||
174 | 177 | ||
175 | 178 | func getPoolConfig () = { | |
176 | 179 | let amtAsset = getStringOrFail(this, aa()) | |
177 | 180 | let priceAsset = getStringOrFail(this, pa()) | |
178 | 181 | let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset)) | |
179 | 182 | let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset)) | |
180 | 183 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP) | |
181 | 184 | } | |
182 | 185 | ||
183 | 186 | ||
184 | 187 | func parseAssetId (input) = if ((input == wavesString)) | |
185 | 188 | then unit | |
186 | 189 | else fromBase58String(input) | |
187 | 190 | ||
188 | 191 | ||
189 | 192 | func assetIdToString (input) = if ((input == unit)) | |
190 | 193 | then wavesString | |
191 | 194 | else toBase58String(value(input)) | |
192 | 195 | ||
193 | 196 | ||
194 | 197 | 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])) | |
195 | 198 | ||
196 | 199 | ||
197 | 200 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
198 | 201 | ||
199 | - | let $ | |
202 | + | let $t080638229 = poolConfigParsed | |
200 | 203 | ||
201 | - | let cfgPoolAddress = $ | |
204 | + | let cfgPoolAddress = $t080638229._1 | |
202 | 205 | ||
203 | - | let cfgPoolStatus = $ | |
206 | + | let cfgPoolStatus = $t080638229._2 | |
204 | 207 | ||
205 | - | let cfgLpAssetId = $ | |
208 | + | let cfgLpAssetId = $t080638229._3 | |
206 | 209 | ||
207 | - | let cfgAmountAssetId = $ | |
210 | + | let cfgAmountAssetId = $t080638229._4 | |
208 | 211 | ||
209 | - | let cfgPriceAssetId = $ | |
212 | + | let cfgPriceAssetId = $t080638229._5 | |
210 | 213 | ||
211 | - | let cfgAmountAssetDecimals = $ | |
214 | + | let cfgAmountAssetDecimals = $t080638229._6 | |
212 | 215 | ||
213 | - | let cfgPriceAssetDecimals = $ | |
216 | + | let cfgPriceAssetDecimals = $t080638229._7 | |
214 | 217 | ||
215 | 218 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
216 | 219 | ||
217 | 220 | ||
218 | 221 | let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address") | |
219 | 222 | ||
220 | 223 | let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address") | |
221 | 224 | ||
222 | 225 | 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) | |
223 | 226 | ||
224 | 227 | ||
225 | 228 | 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) | |
226 | 229 | ||
227 | 230 | ||
228 | 231 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
229 | 232 | then wavesBalance(this).available | |
230 | 233 | else assetBalance(this, fromBase58String(assetId)) | |
231 | 234 | ||
232 | 235 | ||
233 | 236 | func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
234 | 237 | ||
235 | 238 | ||
236 | 239 | func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
237 | 240 | ||
238 | 241 | ||
239 | 242 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
240 | 243 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
241 | 244 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
242 | 245 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
243 | 246 | } | |
244 | 247 | ||
245 | 248 | ||
246 | 249 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
247 | 250 | let cfg = getPoolConfig() | |
248 | 251 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
249 | 252 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
250 | 253 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
251 | 254 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
252 | 255 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
253 | 256 | let lpAmtX18 = toX18(lpAmt, scale8) | |
254 | 257 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
255 | 258 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
256 | 259 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
257 | 260 | } | |
258 | 261 | ||
259 | 262 | ||
260 | 263 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
261 | 264 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
262 | 265 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
263 | 266 | } | |
264 | 267 | ||
265 | 268 | ||
266 | 269 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
267 | 270 | let cfg = getPoolConfig() | |
268 | 271 | let lpAssetId = cfg[idxPoolLPAssetId] | |
269 | 272 | let amAssetId = cfg[idxAmtAssetId] | |
270 | 273 | let prAssetId = cfg[idxPriceAssetId] | |
271 | 274 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
272 | 275 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
273 | 276 | let poolStatus = cfg[idxPoolStatus] | |
274 | 277 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
275 | 278 | if ((lpAssetId != pmtAssetId)) | |
276 | 279 | then throw("Invalid asset passed.") | |
277 | 280 | else { | |
278 | 281 | let amBalance = getAccBalance(amAssetId) | |
279 | 282 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
280 | 283 | let prBalance = getAccBalance(prAssetId) | |
281 | 284 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
282 | 285 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
283 | 286 | let curPrice = fromX18(curPriceX18, scale8) | |
284 | 287 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
285 | 288 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
286 | 289 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
287 | 290 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
288 | 291 | let outAmAmt = fromX18(outAmAmtX18, amAssetDcm) | |
289 | 292 | let outPrAmt = fromX18(outPrAmtX18, prAssetDcm) | |
290 | 293 | let state = if ((txId58 == "")) | |
291 | 294 | then nil | |
292 | 295 | else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
293 | 296 | then unit | |
294 | 297 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
295 | 298 | then unit | |
296 | 299 | 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)] | |
297 | 300 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
298 | 301 | } | |
299 | 302 | } | |
300 | 303 | ||
301 | 304 | ||
302 | 305 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
303 | 306 | let cfg = getPoolConfig() | |
304 | 307 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
305 | 308 | let amAssetIdStr = cfg[idxAmtAssetId] | |
306 | 309 | let prAssetIdStr = cfg[idxPriceAssetId] | |
307 | 310 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
308 | 311 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
309 | 312 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
310 | 313 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
311 | 314 | let poolStatus = cfg[idxPoolStatus] | |
312 | 315 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
313 | 316 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
314 | 317 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
315 | 318 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
316 | 319 | then true | |
317 | 320 | else (prAssetIdStr != inPrAssetIdStr)) | |
318 | 321 | then throw("Invalid amt or price asset passed.") | |
319 | 322 | else { | |
320 | 323 | let amBalance = if (isEvaluate) | |
321 | 324 | then getAccBalance(amAssetIdStr) | |
322 | 325 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
323 | 326 | let prBalance = if (isEvaluate) | |
324 | 327 | then getAccBalance(prAssetIdStr) | |
325 | 328 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
326 | 329 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
327 | 330 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
328 | 331 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
329 | 332 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
330 | 333 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
331 | 334 | let res = if ((lpEmission == 0)) | |
332 | 335 | then { | |
333 | 336 | let curPriceX18 = zeroBigInt | |
334 | 337 | let slippageX18 = zeroBigInt | |
335 | 338 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
336 | 339 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
337 | 340 | } | |
338 | 341 | else { | |
339 | 342 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
340 | 343 | let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
341 | 344 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
342 | 345 | if (if ((curPriceX18 != zeroBigInt)) | |
343 | 346 | then (slippageX18 > slippageToleranceX18) | |
344 | 347 | else false) | |
345 | 348 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
346 | 349 | else { | |
347 | 350 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
348 | 351 | let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
349 | 352 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
350 | 353 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
351 | 354 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
352 | 355 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
353 | 356 | let expAmtAssetAmtX18 = expectedAmts._1 | |
354 | 357 | let expPriceAssetAmtX18 = expectedAmts._2 | |
355 | 358 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR) | |
356 | - | $Tuple5( | |
359 | + | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18) | |
357 | 360 | } | |
358 | 361 | } | |
359 | 362 | let calcLpAmt = res._1 | |
360 | 363 | let calcAmAssetPmt = res._2 | |
361 | 364 | let calcPrAssetPmt = res._3 | |
362 | 365 | let curPrice = fromX18(res._4, scale8) | |
363 | 366 | let slippageCalc = fromX18(res._5, scale8) | |
364 | 367 | if ((0 >= calcLpAmt)) | |
365 | 368 | then throw("Invalid calculations. LP calculated is less than zero.") | |
366 | 369 | else { | |
367 | 370 | let emitLpAmt = if (!(emitLp)) | |
368 | 371 | then 0 | |
369 | 372 | else calcLpAmt | |
370 | 373 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
371 | 374 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
372 | 375 | 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))] | |
373 | 376 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
374 | 377 | } | |
375 | 378 | } | |
376 | 379 | } | |
377 | 380 | ||
378 | 381 | ||
379 | 382 | func calcKLp (amountBalance,priceBalance,lpEmission) = { | |
380 | 383 | let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission) | |
381 | 384 | if ((lpEmission == big0)) | |
382 | 385 | then big0 | |
383 | 386 | else updatedKLp | |
384 | 387 | } | |
385 | 388 | ||
386 | 389 | ||
387 | 390 | func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
388 | 391 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
389 | 392 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
390 | 393 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
391 | 394 | let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
392 | 395 | currentKLp | |
393 | 396 | } | |
394 | 397 | ||
395 | 398 | ||
396 | 399 | func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
397 | 400 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
398 | 401 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
399 | 402 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
400 | 403 | let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
401 | 404 | let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))] | |
402 | 405 | $Tuple2(actions, updatedKLp) | |
403 | 406 | } | |
404 | 407 | ||
405 | 408 | ||
406 | 409 | func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp)) | |
407 | 410 | then true | |
408 | 411 | else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " ")) | |
409 | 412 | ||
410 | 413 | ||
411 | 414 | func validateMatcherOrderAllowed (order) = { | |
412 | 415 | let amountAssetAmount = order.amount | |
413 | 416 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
414 | - | let $ | |
417 | + | let $t02080321015 = if ((order.orderType == Buy)) | |
415 | 418 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
416 | 419 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
417 | - | let amountAssetBalanceDelta = $ | |
418 | - | let priceAssetBalanceDelta = $ | |
420 | + | let amountAssetBalanceDelta = $t02080321015._1 | |
421 | + | let priceAssetBalanceDelta = $t02080321015._2 | |
419 | 422 | if (if (if (isGlobalShutdown()) | |
420 | 423 | then true | |
421 | 424 | else (cfgPoolStatus == PoolMatcherDisabled)) | |
422 | 425 | then true | |
423 | 426 | else (cfgPoolStatus == PoolShutdown)) | |
424 | 427 | then throw("Exchange operations disabled") | |
425 | 428 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
426 | 429 | then true | |
427 | 430 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
428 | 431 | then throw("Wrong order assets.") | |
429 | 432 | else { | |
430 | 433 | let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp")) | |
431 | - | let $ | |
432 | - | let unusedActions = $ | |
433 | - | let kLpNew = $ | |
434 | + | let $t02148621586 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
435 | + | let unusedActions = $t02148621586._1 | |
436 | + | let kLpNew = $t02148621586._2 | |
434 | 437 | let isOrderValid = (kLpNew >= kLp) | |
435 | 438 | isOrderValid | |
436 | 439 | } | |
437 | 440 | } | |
438 | 441 | ||
439 | 442 | ||
440 | 443 | func commonGet (i) = if ((size(i.payments) != 1)) | |
441 | 444 | then throw("exactly 1 payment is expected") | |
442 | 445 | else { | |
443 | 446 | let pmt = value(i.payments[0]) | |
444 | 447 | let pmtAssetId = value(pmt.assetId) | |
445 | 448 | let pmtAmt = pmt.amount | |
446 | 449 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
447 | 450 | let outAmAmt = res._1 | |
448 | 451 | let outPrAmt = res._2 | |
449 | 452 | let poolStatus = parseIntValue(res._9) | |
450 | 453 | let state = res._10 | |
451 | 454 | if (if (isGlobalShutdown()) | |
452 | 455 | then true | |
453 | 456 | else (poolStatus == PoolShutdown)) | |
454 | 457 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
455 | 458 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
456 | 459 | } | |
457 | 460 | ||
458 | 461 | ||
459 | 462 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
460 | 463 | then throw("exactly 2 payments are expected") | |
461 | 464 | else { | |
462 | 465 | let amAssetPmt = value(i.payments[0]) | |
463 | 466 | let prAssetPmt = value(i.payments[1]) | |
464 | 467 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
465 | 468 | let poolStatus = parseIntValue(estPut._8) | |
466 | 469 | if (if (if (isGlobalShutdown()) | |
467 | 470 | then true | |
468 | 471 | else (poolStatus == PoolPutDisabled)) | |
469 | 472 | then true | |
470 | 473 | else (poolStatus == PoolShutdown)) | |
471 | 474 | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
472 | 475 | else estPut | |
473 | 476 | } | |
474 | 477 | ||
475 | 478 | ||
476 | 479 | func emit (amount) = { | |
477 | 480 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
478 | 481 | if ((emitInv == emitInv)) | |
479 | 482 | then { | |
480 | 483 | let emitInvLegacy = match emitInv { | |
481 | 484 | case legacyFactoryContract: Address => | |
482 | 485 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
483 | 486 | case _ => | |
484 | 487 | unit | |
485 | 488 | } | |
486 | 489 | if ((emitInvLegacy == emitInvLegacy)) | |
487 | 490 | then amount | |
488 | 491 | else throw("Strict value is not equal to itself.") | |
489 | 492 | } | |
490 | 493 | else throw("Strict value is not equal to itself.") | |
491 | 494 | } | |
492 | 495 | ||
493 | 496 | ||
494 | 497 | func takeFee (amount) = { | |
495 | 498 | let feeAmount = fraction(amount, fee, scale8) | |
496 | 499 | $Tuple2((amount - feeAmount), feeAmount) | |
497 | 500 | } | |
498 | 501 | ||
499 | 502 | ||
500 | 503 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
501 | 504 | let isEval = (txId == unit) | |
502 | 505 | let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
503 | 506 | let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
504 | 507 | let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId)) | |
505 | 508 | then true | |
506 | 509 | else if ((paymentAssetId == cfgPriceAssetId)) | |
507 | 510 | then false | |
508 | 511 | else throwErr("invalid asset") | |
509 | - | let $ | |
512 | + | let $t02427124564 = if (isEval) | |
510 | 513 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
511 | 514 | else if (paymentInAmountAsset) | |
512 | 515 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
513 | 516 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
514 | - | let amountBalanceOld = $ | |
515 | - | let priceBalanceOld = $ | |
516 | - | let $ | |
517 | + | let amountBalanceOld = $t02427124564._1 | |
518 | + | let priceBalanceOld = $t02427124564._2 | |
519 | + | let $t02456824717 = if (paymentInAmountAsset) | |
517 | 520 | then $Tuple2(paymentAmountRaw, 0) | |
518 | 521 | else $Tuple2(0, paymentAmountRaw) | |
519 | - | let amountAssetAmountRaw = $ | |
520 | - | let priceAssetAmountRaw = $ | |
522 | + | let amountAssetAmountRaw = $t02456824717._1 | |
523 | + | let priceAssetAmountRaw = $t02456824717._2 | |
521 | 524 | let amountAssetAmount = takeFee(amountAssetAmountRaw)._1 | |
522 | 525 | let priceAssetAmount = takeFee(priceAssetAmountRaw)._1 | |
523 | - | let $ | |
524 | - | let paymentAmount = $ | |
525 | - | let feeAmount = $ | |
526 | + | let $t02483924898 = takeFee(paymentAmountRaw) | |
527 | + | let paymentAmount = $t02483924898._1 | |
528 | + | let feeAmount = $t02483924898._2 | |
526 | 529 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
527 | 530 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
528 | 531 | let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals)) | |
529 | 532 | let priceNew = fromX18(priceNewX18, scale8) | |
530 | 533 | let paymentBalance = if (paymentInAmountAsset) | |
531 | 534 | then amountBalanceOld | |
532 | 535 | else priceBalanceOld | |
533 | 536 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
534 | 537 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
535 | 538 | let chechSupply = if ((supplyBigInt > big0)) | |
536 | 539 | then true | |
537 | 540 | else throwErr("initial deposit requires all coins") | |
538 | 541 | if ((chechSupply == chechSupply)) | |
539 | 542 | then { | |
540 | 543 | let depositBigInt = toBigInt(paymentAmount) | |
541 | 544 | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
542 | 545 | let commonState = if (isEval) | |
543 | 546 | then nil | |
544 | 547 | 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))] | |
545 | 548 | let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals)) | |
546 | 549 | let priceOld = fromX18(priceOldX18, scale8) | |
547 | 550 | let loss = { | |
548 | - | let $ | |
551 | + | let $t02637526542 = if (paymentInAmountAsset) | |
549 | 552 | then $Tuple2(amountAssetAmountRaw, amountBalanceOld) | |
550 | 553 | else $Tuple2(priceAssetAmountRaw, priceBalanceOld) | |
551 | - | let amount = $ | |
552 | - | let balance = $ | |
554 | + | let amount = $t02637526542._1 | |
555 | + | let balance = $t02637526542._2 | |
553 | 556 | let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance))) | |
554 | 557 | fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth) | |
555 | 558 | } | |
556 | 559 | $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset) | |
557 | 560 | } | |
558 | 561 | else throw("Strict value is not equal to itself.") | |
559 | 562 | } | |
560 | 563 | ||
561 | 564 | ||
562 | 565 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
563 | 566 | let isEval = (txId == unit) | |
564 | 567 | let checks = [if ((paymentAssetId == cfgLpAssetId)) | |
565 | 568 | then true | |
566 | 569 | else throwErr("invalid lp asset")] | |
567 | 570 | if ((checks == checks)) | |
568 | 571 | then { | |
569 | 572 | let outInAmountAsset = if ((outAssetId == cfgAmountAssetId)) | |
570 | 573 | then true | |
571 | 574 | else if ((outAssetId == cfgPriceAssetId)) | |
572 | 575 | then false | |
573 | 576 | else throwErr("invalid asset") | |
574 | 577 | let balanceBigInt = if (outInAmountAsset) | |
575 | 578 | then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) | |
576 | 579 | else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) | |
577 | 580 | let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
578 | 581 | let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
579 | 582 | let outBalance = if (outInAmountAsset) | |
580 | 583 | then amBalanceOld | |
581 | 584 | else prBalanceOld | |
582 | 585 | let outBalanceBigInt = toBigInt(outBalance) | |
583 | 586 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity) | |
584 | 587 | let redeemedBigInt = toBigInt(paymentAmount) | |
585 | 588 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
586 | - | let $ | |
587 | - | let totalAmount = $ | |
588 | - | let feeAmount = $ | |
589 | - | let $ | |
589 | + | let $t02814428194 = takeFee(amountRaw) | |
590 | + | let totalAmount = $t02814428194._1 | |
591 | + | let feeAmount = $t02814428194._2 | |
592 | + | let $t02819828424 = if (outInAmountAsset) | |
590 | 593 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
591 | 594 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
592 | - | let outAmAmount = $ | |
593 | - | let outPrAmount = $ | |
594 | - | let amBalanceNew = $ | |
595 | - | let prBalanceNew = $ | |
595 | + | let outAmAmount = $t02819828424._1 | |
596 | + | let outPrAmount = $t02819828424._2 | |
597 | + | let amBalanceNew = $t02819828424._3 | |
598 | + | let prBalanceNew = $t02819828424._4 | |
596 | 599 | let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals)) | |
597 | 600 | let priceNew = fromX18(priceNewX18, scale8) | |
598 | 601 | let commonState = if (isEval) | |
599 | 602 | then nil | |
600 | 603 | 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)] | |
601 | 604 | let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals)) | |
602 | 605 | let priceOld = fromX18(priceOldX18, scale8) | |
603 | 606 | let loss = { | |
604 | 607 | let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2) | |
605 | 608 | fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset) | |
606 | 609 | } | |
607 | 610 | $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset) | |
608 | 611 | } | |
609 | 612 | else throw("Strict value is not equal to itself.") | |
610 | 613 | } | |
611 | 614 | ||
612 | 615 | ||
613 | 616 | func managerPublicKeyOrUnit () = match getString(mpk()) { | |
614 | 617 | case s: String => | |
615 | 618 | fromBase58String(s) | |
616 | 619 | case _: Unit => | |
617 | 620 | unit | |
618 | 621 | case _ => | |
619 | 622 | throw("Match error") | |
620 | 623 | } | |
621 | 624 | ||
622 | 625 | ||
623 | 626 | func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) { | |
624 | 627 | case s: String => | |
625 | 628 | fromBase58String(s) | |
626 | 629 | case _: Unit => | |
627 | 630 | unit | |
628 | 631 | case _ => | |
629 | 632 | throw("Match error") | |
630 | 633 | } | |
631 | 634 | ||
632 | 635 | ||
633 | 636 | func isManager (i) = match managerPublicKeyOrUnit() { | |
634 | 637 | case pk: ByteVector => | |
635 | 638 | (i.callerPublicKey == pk) | |
636 | 639 | case _: Unit => | |
637 | 640 | (i.caller == this) | |
638 | 641 | case _ => | |
639 | 642 | throw("Match error") | |
640 | 643 | } | |
641 | 644 | ||
642 | 645 | ||
643 | 646 | func mustManager (i) = { | |
644 | 647 | let pd = throw("Permission denied") | |
645 | 648 | match managerPublicKeyOrUnit() { | |
646 | 649 | case pk: ByteVector => | |
647 | 650 | if ((i.callerPublicKey == pk)) | |
648 | 651 | then true | |
649 | 652 | else pd | |
650 | 653 | case _: Unit => | |
651 | 654 | if ((i.caller == this)) | |
652 | 655 | then true | |
653 | 656 | else pd | |
654 | 657 | case _ => | |
655 | 658 | throw("Match error") | |
656 | 659 | } | |
657 | 660 | } | |
658 | 661 | ||
659 | 662 | ||
660 | 663 | @Callable(i) | |
661 | 664 | func setManager (pendingManagerPublicKey) = { | |
662 | 665 | let checkCaller = mustManager(i) | |
663 | 666 | if ((checkCaller == checkCaller)) | |
664 | 667 | then { | |
665 | 668 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
666 | 669 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
667 | 670 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
668 | 671 | else throw("Strict value is not equal to itself.") | |
669 | 672 | } | |
670 | 673 | else throw("Strict value is not equal to itself.") | |
671 | 674 | } | |
672 | 675 | ||
673 | 676 | ||
674 | 677 | ||
675 | 678 | @Callable(i) | |
676 | 679 | func confirmManager () = { | |
677 | 680 | let pm = pendingManagerPublicKeyOrUnit() | |
678 | 681 | let hasPM = if (isDefined(pm)) | |
679 | 682 | then true | |
680 | 683 | else throw("No pending manager") | |
681 | 684 | if ((hasPM == hasPM)) | |
682 | 685 | then { | |
683 | 686 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
684 | 687 | then true | |
685 | 688 | else throw("You are not pending manager") | |
686 | 689 | if ((checkPM == checkPM)) | |
687 | 690 | then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())] | |
688 | 691 | else throw("Strict value is not equal to itself.") | |
689 | 692 | } | |
690 | 693 | else throw("Strict value is not equal to itself.") | |
691 | 694 | } | |
692 | 695 | ||
693 | 696 | ||
694 | 697 | ||
695 | 698 | @Callable(i) | |
696 | 699 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
697 | 700 | then throw("Invalid slippageTolerance passed") | |
698 | 701 | else { | |
699 | 702 | let estPut = commonPut(i, slippageTolerance, true) | |
700 | 703 | let emitLpAmt = estPut._2 | |
701 | 704 | let lpAssetId = estPut._7 | |
702 | 705 | let state = estPut._9 | |
703 | 706 | let amDiff = estPut._10 | |
704 | 707 | let prDiff = estPut._11 | |
705 | 708 | let amId = estPut._12 | |
706 | 709 | let prId = estPut._13 | |
707 | 710 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
708 | 711 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
709 | 712 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt) | |
710 | 713 | if ((amountAssetBalance == amountAssetBalance)) | |
711 | 714 | then { | |
712 | 715 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt) | |
713 | 716 | if ((priceAssetBalance == priceAssetBalance)) | |
714 | 717 | then { | |
715 | 718 | let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity) | |
716 | 719 | if ((lpAssetEmission == lpAssetEmission)) | |
717 | 720 | then { | |
718 | 721 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
719 | 722 | if ((currentKLp == currentKLp)) | |
720 | 723 | then { | |
721 | 724 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
722 | 725 | if ((emitInv == emitInv)) | |
723 | 726 | then { | |
724 | 727 | let emitInvLegacy = match emitInv { | |
725 | 728 | case legacyFactoryContract: Address => | |
726 | 729 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
727 | 730 | case _ => | |
728 | 731 | unit | |
729 | 732 | } | |
730 | 733 | if ((emitInvLegacy == emitInvLegacy)) | |
731 | 734 | then { | |
732 | 735 | let slippageAInv = if ((amDiff > 0)) | |
733 | 736 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
734 | 737 | else nil | |
735 | 738 | if ((slippageAInv == slippageAInv)) | |
736 | 739 | then { | |
737 | 740 | let slippagePInv = if ((prDiff > 0)) | |
738 | 741 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
739 | 742 | else nil | |
740 | 743 | if ((slippagePInv == slippagePInv)) | |
741 | 744 | then { | |
742 | 745 | let lpTransfer = if (shouldAutoStake) | |
743 | 746 | then { | |
744 | 747 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
745 | 748 | if ((slpStakeInv == slpStakeInv)) | |
746 | 749 | then nil | |
747 | 750 | else throw("Strict value is not equal to itself.") | |
748 | 751 | } | |
749 | 752 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
750 | 753 | let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity | |
751 | 754 | if ((lpAssetEmissionAfter == lpAssetEmissionAfter)) | |
752 | 755 | then { | |
753 | - | let $ | |
754 | - | if (($ | |
756 | + | let $t03294433012 = refreshKLpInternal(0, 0, 0) | |
757 | + | if (($t03294433012 == $t03294433012)) | |
755 | 758 | then { | |
756 | - | let updatedKLp = $ | |
757 | - | let refreshKLpActions = $ | |
759 | + | let updatedKLp = $t03294433012._2 | |
760 | + | let refreshKLpActions = $t03294433012._1 | |
758 | 761 | let error = throwErr(makeString([toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentKLp), toString(updatedKLp), toString(emitLpAmt), toString(amDiff), toString(prDiff), toString(lpAssetEmission), toString(lpAssetEmissionAfter)], " ")) | |
759 | 762 | if ((error == error)) | |
760 | 763 | then { | |
761 | 764 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
762 | 765 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
763 | 766 | then ((state ++ lpTransfer) ++ refreshKLpActions) | |
764 | 767 | else throw("Strict value is not equal to itself.") | |
765 | 768 | } | |
766 | 769 | else throw("Strict value is not equal to itself.") | |
767 | 770 | } | |
768 | 771 | else throw("Strict value is not equal to itself.") | |
769 | 772 | } | |
770 | 773 | else throw("Strict value is not equal to itself.") | |
771 | 774 | } | |
772 | 775 | else throw("Strict value is not equal to itself.") | |
773 | 776 | } | |
774 | 777 | else throw("Strict value is not equal to itself.") | |
775 | 778 | } | |
776 | 779 | else throw("Strict value is not equal to itself.") | |
777 | 780 | } | |
778 | 781 | else throw("Strict value is not equal to itself.") | |
779 | 782 | } | |
780 | 783 | else throw("Strict value is not equal to itself.") | |
781 | 784 | } | |
782 | 785 | else throw("Strict value is not equal to itself.") | |
783 | 786 | } | |
784 | 787 | else throw("Strict value is not equal to itself.") | |
785 | 788 | } | |
786 | 789 | else throw("Strict value is not equal to itself.") | |
787 | 790 | } | |
788 | 791 | ||
789 | 792 | ||
790 | 793 | ||
791 | 794 | @Callable(i) | |
792 | 795 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
793 | 796 | then throw("Invalid value passed") | |
794 | 797 | else { | |
795 | 798 | let estPut = commonPut(i, maxSlippage, false) | |
796 | 799 | let state = estPut._9 | |
797 | 800 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
798 | 801 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
799 | 802 | let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
800 | 803 | if ((currentKLp == currentKLp)) | |
801 | 804 | then { | |
802 | - | let $ | |
803 | - | let refreshKLpActions = $ | |
804 | - | let updatedKLp = $ | |
805 | + | let $t03394434009 = refreshKLpInternal(0, 0, 0) | |
806 | + | let refreshKLpActions = $t03394434009._1 | |
807 | + | let updatedKLp = $t03394434009._2 | |
805 | 808 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
806 | 809 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
807 | 810 | then (state ++ refreshKLpActions) | |
808 | 811 | else throw("Strict value is not equal to itself.") | |
809 | 812 | } | |
810 | 813 | else throw("Strict value is not equal to itself.") | |
811 | 814 | } | |
812 | 815 | ||
813 | 816 | ||
814 | 817 | ||
815 | 818 | @Callable(i) | |
816 | 819 | func putOneTkn (minOutAmount,autoStake) = { | |
817 | 820 | let isPoolOneTokenOperationsDisabled = { | |
818 | 821 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
819 | 822 | if ($isInstanceOf(@, "Boolean")) | |
820 | 823 | then @ | |
821 | 824 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
822 | 825 | } | |
823 | 826 | let isPutDisabled = if (if (if (isGlobalShutdown()) | |
824 | 827 | then true | |
825 | 828 | else (cfgPoolStatus == PoolPutDisabled)) | |
826 | 829 | then true | |
827 | 830 | else (cfgPoolStatus == PoolShutdown)) | |
828 | 831 | then true | |
829 | 832 | else isPoolOneTokenOperationsDisabled | |
830 | 833 | let checks = [if (if (!(isPutDisabled)) | |
831 | 834 | then true | |
832 | 835 | else isManager(i)) | |
833 | 836 | then true | |
834 | 837 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
835 | 838 | then true | |
836 | 839 | else throwErr("exactly 1 payment are expected")] | |
837 | 840 | if ((checks == checks)) | |
838 | 841 | then { | |
839 | 842 | let payment = i.payments[0] | |
840 | 843 | let paymentAssetId = payment.assetId | |
841 | 844 | let paymentAmountRaw = payment.amount | |
842 | 845 | let currentKLp = if ((paymentAssetId == cfgAmountAssetId)) | |
843 | 846 | then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0)) | |
844 | 847 | else if ((paymentAssetId == cfgPriceAssetId)) | |
845 | 848 | then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0)) | |
846 | 849 | else throwErr("payment asset is not supported") | |
847 | 850 | let userAddress = i.caller | |
848 | 851 | let txId = i.transactionId | |
849 | - | let $ | |
850 | - | if (($ | |
852 | + | let $t03519435346 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
853 | + | if (($t03519435346 == $t03519435346)) | |
851 | 854 | then { | |
852 | - | let paymentInAmountAsset = $ | |
853 | - | let bonus = $ | |
854 | - | let feeAmount = $ | |
855 | - | let commonState = $ | |
856 | - | let emitAmountEstimated = $ | |
855 | + | let paymentInAmountAsset = $t03519435346._5 | |
856 | + | let bonus = $t03519435346._4 | |
857 | + | let feeAmount = $t03519435346._3 | |
858 | + | let commonState = $t03519435346._2 | |
859 | + | let emitAmountEstimated = $t03519435346._1 | |
857 | 860 | let emitAmount = if (if ((minOutAmount > 0)) | |
858 | 861 | then (minOutAmount > emitAmountEstimated) | |
859 | 862 | else false) | |
860 | 863 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
861 | 864 | else emitAmountEstimated | |
862 | 865 | let emitInv = emit(emitAmount) | |
863 | 866 | if ((emitInv == emitInv)) | |
864 | 867 | then { | |
865 | 868 | let lpTransfer = if (autoStake) | |
866 | 869 | then { | |
867 | 870 | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
868 | 871 | if ((stakeInv == stakeInv)) | |
869 | 872 | then nil | |
870 | 873 | else throw("Strict value is not equal to itself.") | |
871 | 874 | } | |
872 | 875 | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
873 | 876 | let sendFee = if ((feeAmount > 0)) | |
874 | 877 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
875 | 878 | else nil | |
876 | - | let $ | |
879 | + | let $t03593236129 = if ((this == feeCollectorAddress)) | |
877 | 880 | then $Tuple2(0, 0) | |
878 | 881 | else if (paymentInAmountAsset) | |
879 | 882 | then $Tuple2(-(feeAmount), 0) | |
880 | 883 | else $Tuple2(0, -(feeAmount)) | |
881 | - | let amountAssetBalanceDelta = $ | |
882 | - | let priceAssetBalanceDelta = $ | |
883 | - | let $ | |
884 | - | let refreshKLpActions = $ | |
885 | - | let updatedKLp = $ | |
884 | + | let amountAssetBalanceDelta = $t03593236129._1 | |
885 | + | let priceAssetBalanceDelta = $t03593236129._2 | |
886 | + | let $t03613236240 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
887 | + | let refreshKLpActions = $t03613236240._1 | |
888 | + | let updatedKLp = $t03613236240._2 | |
886 | 889 | let kLp = value(getString(keyKLp)) | |
887 | 890 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
888 | 891 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
889 | 892 | then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount) | |
890 | 893 | else throw("Strict value is not equal to itself.") | |
891 | 894 | } | |
892 | 895 | else throw("Strict value is not equal to itself.") | |
893 | 896 | } | |
894 | 897 | else throw("Strict value is not equal to itself.") | |
895 | 898 | } | |
896 | 899 | else throw("Strict value is not equal to itself.") | |
897 | 900 | } | |
898 | 901 | ||
899 | 902 | ||
900 | 903 | ||
901 | 904 | @Callable(i) | |
902 | 905 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
903 | - | let $ | |
904 | - | let emitAmountEstimated = $ | |
905 | - | let commonState = $ | |
906 | - | let feeAmount = $ | |
907 | - | let bonus = $ | |
908 | - | let paymentInAmountAsset = $ | |
906 | + | let $t03654636703 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
907 | + | let emitAmountEstimated = $t03654636703._1 | |
908 | + | let commonState = $t03654636703._2 | |
909 | + | let feeAmount = $t03654636703._3 | |
910 | + | let bonus = $t03654636703._4 | |
911 | + | let paymentInAmountAsset = $t03654636703._5 | |
909 | 912 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
910 | 913 | } | |
911 | 914 | ||
912 | 915 | ||
913 | 916 | ||
914 | 917 | @Callable(i) | |
915 | 918 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
916 | 919 | let isPoolOneTokenOperationsDisabled = { | |
917 | 920 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
918 | 921 | if ($isInstanceOf(@, "Boolean")) | |
919 | 922 | then @ | |
920 | 923 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
921 | 924 | } | |
922 | 925 | let isGetDisabled = if (if (isGlobalShutdown()) | |
923 | 926 | then true | |
924 | 927 | else (cfgPoolStatus == PoolShutdown)) | |
925 | 928 | then true | |
926 | 929 | else isPoolOneTokenOperationsDisabled | |
927 | 930 | let checks = [if (if (!(isGetDisabled)) | |
928 | 931 | then true | |
929 | 932 | else isManager(i)) | |
930 | 933 | then true | |
931 | 934 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
932 | 935 | then true | |
933 | 936 | else throwErr("exactly 1 payment are expected")] | |
934 | 937 | if ((checks == checks)) | |
935 | 938 | then { | |
936 | 939 | let outAssetId = parseAssetId(outAssetIdStr) | |
937 | 940 | let payment = i.payments[0] | |
938 | 941 | let paymentAssetId = payment.assetId | |
939 | 942 | let paymentAmount = payment.amount | |
940 | 943 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount)) | |
941 | 944 | let userAddress = i.caller | |
942 | 945 | let txId = i.transactionId | |
943 | - | let $ | |
944 | - | if (($ | |
946 | + | let $t03759737750 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
947 | + | if (($t03759737750 == $t03759737750)) | |
945 | 948 | then { | |
946 | - | let outInAmountAsset = $ | |
947 | - | let bonus = $ | |
948 | - | let feeAmount = $ | |
949 | - | let commonState = $ | |
950 | - | let amountEstimated = $ | |
949 | + | let outInAmountAsset = $t03759737750._5 | |
950 | + | let bonus = $t03759737750._4 | |
951 | + | let feeAmount = $t03759737750._3 | |
952 | + | let commonState = $t03759737750._2 | |
953 | + | let amountEstimated = $t03759737750._1 | |
951 | 954 | let amount = if (if ((minOutAmount > 0)) | |
952 | 955 | then (minOutAmount > amountEstimated) | |
953 | 956 | else false) | |
954 | 957 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
955 | 958 | else amountEstimated | |
956 | 959 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
957 | 960 | if ((burnInv == burnInv)) | |
958 | 961 | then { | |
959 | 962 | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
960 | 963 | let sendFee = if ((feeAmount > 0)) | |
961 | 964 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
962 | 965 | else nil | |
963 | - | let $ | |
966 | + | let $t03825038497 = { | |
964 | 967 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
965 | 968 | then 0 | |
966 | 969 | else feeAmount | |
967 | 970 | if (outInAmountAsset) | |
968 | 971 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
969 | 972 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
970 | 973 | } | |
971 | - | let amountAssetBalanceDelta = $ | |
972 | - | let priceAssetBalanceDelta = $ | |
973 | - | let $ | |
974 | - | let refreshKLpActions = $ | |
975 | - | let updatedKLp = $ | |
974 | + | let amountAssetBalanceDelta = $t03825038497._1 | |
975 | + | let priceAssetBalanceDelta = $t03825038497._2 | |
976 | + | let $t03850038608 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
977 | + | let refreshKLpActions = $t03850038608._1 | |
978 | + | let updatedKLp = $t03850038608._2 | |
976 | 979 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
977 | 980 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
978 | 981 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
979 | 982 | else throw("Strict value is not equal to itself.") | |
980 | 983 | } | |
981 | 984 | else throw("Strict value is not equal to itself.") | |
982 | 985 | } | |
983 | 986 | else throw("Strict value is not equal to itself.") | |
984 | 987 | } | |
985 | 988 | else throw("Strict value is not equal to itself.") | |
986 | 989 | } | |
987 | 990 | ||
988 | 991 | ||
989 | 992 | ||
990 | 993 | @Callable(i) | |
991 | 994 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
992 | - | let $ | |
993 | - | let amountEstimated = $ | |
994 | - | let commonState = $ | |
995 | - | let feeAmount = $ | |
996 | - | let bonus = $ | |
997 | - | let outInAmountAsset = $ | |
995 | + | let $t03886539021 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
996 | + | let amountEstimated = $t03886539021._1 | |
997 | + | let commonState = $t03886539021._2 | |
998 | + | let feeAmount = $t03886539021._3 | |
999 | + | let bonus = $t03886539021._4 | |
1000 | + | let outInAmountAsset = $t03886539021._5 | |
998 | 1001 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
999 | 1002 | } | |
1000 | 1003 | ||
1001 | 1004 | ||
1002 | 1005 | ||
1003 | 1006 | @Callable(i) | |
1004 | 1007 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
1005 | 1008 | let isPoolOneTokenOperationsDisabled = { | |
1006 | 1009 | let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1007 | 1010 | if ($isInstanceOf(@, "Boolean")) | |
1008 | 1011 | then @ | |
1009 | 1012 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1010 | 1013 | } | |
1011 | 1014 | let isGetDisabled = if (if (isGlobalShutdown()) | |
1012 | 1015 | then true | |
1013 | 1016 | else (cfgPoolStatus == PoolShutdown)) | |
1014 | 1017 | then true | |
1015 | 1018 | else isPoolOneTokenOperationsDisabled | |
1016 | 1019 | let checks = [if (if (!(isGetDisabled)) | |
1017 | 1020 | then true | |
1018 | 1021 | else isManager(i)) | |
1019 | 1022 | then true | |
1020 | 1023 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1021 | 1024 | then true | |
1022 | 1025 | else throwErr("no payments are expected")] | |
1023 | 1026 | if ((checks == checks)) | |
1024 | 1027 | then { | |
1025 | 1028 | let outAssetId = parseAssetId(outAssetIdStr) | |
1026 | 1029 | let userAddress = i.caller | |
1027 | 1030 | let txId = i.transactionId | |
1028 | 1031 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1029 | 1032 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1030 | 1033 | if ((unstakeInv == unstakeInv)) | |
1031 | 1034 | then { | |
1032 | - | let $ | |
1033 | - | if (($ | |
1035 | + | let $t03992340074 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId) | |
1036 | + | if (($t03992340074 == $t03992340074)) | |
1034 | 1037 | then { | |
1035 | - | let outInAmountAsset = $ | |
1036 | - | let bonus = $ | |
1037 | - | let feeAmount = $ | |
1038 | - | let commonState = $ | |
1039 | - | let amountEstimated = $ | |
1038 | + | let outInAmountAsset = $t03992340074._5 | |
1039 | + | let bonus = $t03992340074._4 | |
1040 | + | let feeAmount = $t03992340074._3 | |
1041 | + | let commonState = $t03992340074._2 | |
1042 | + | let amountEstimated = $t03992340074._1 | |
1040 | 1043 | let amount = if (if ((minOutAmount > 0)) | |
1041 | 1044 | then (minOutAmount > amountEstimated) | |
1042 | 1045 | else false) | |
1043 | 1046 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1044 | 1047 | else amountEstimated | |
1045 | 1048 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1046 | 1049 | if ((burnInv == burnInv)) | |
1047 | 1050 | then { | |
1048 | 1051 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
1049 | 1052 | let sendFee = if ((feeAmount > 0)) | |
1050 | 1053 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
1051 | 1054 | else nil | |
1052 | - | let $ | |
1055 | + | let $t04056940816 = { | |
1053 | 1056 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
1054 | 1057 | then 0 | |
1055 | 1058 | else feeAmount | |
1056 | 1059 | if (outInAmountAsset) | |
1057 | 1060 | then $Tuple2(-((amount + feeAmountForCalc)), 0) | |
1058 | 1061 | else $Tuple2(0, -((amount + feeAmountForCalc))) | |
1059 | 1062 | } | |
1060 | - | let amountAssetBalanceDelta = $ | |
1061 | - | let priceAssetBalanceDelta = $ | |
1062 | - | let $ | |
1063 | - | let refreshKLpActions = $ | |
1064 | - | let updatedKLp = $ | |
1063 | + | let amountAssetBalanceDelta = $t04056940816._1 | |
1064 | + | let priceAssetBalanceDelta = $t04056940816._2 | |
1065 | + | let $t04081940927 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1066 | + | let refreshKLpActions = $t04081940927._1 | |
1067 | + | let updatedKLp = $t04081940927._2 | |
1065 | 1068 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1066 | 1069 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1067 | 1070 | then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount) | |
1068 | 1071 | else throw("Strict value is not equal to itself.") | |
1069 | 1072 | } | |
1070 | 1073 | else throw("Strict value is not equal to itself.") | |
1071 | 1074 | } | |
1072 | 1075 | else throw("Strict value is not equal to itself.") | |
1073 | 1076 | } | |
1074 | 1077 | else throw("Strict value is not equal to itself.") | |
1075 | 1078 | } | |
1076 | 1079 | else throw("Strict value is not equal to itself.") | |
1077 | 1080 | } | |
1078 | 1081 | ||
1079 | 1082 | ||
1080 | 1083 | ||
1081 | 1084 | @Callable(i) | |
1082 | 1085 | func get () = { | |
1083 | 1086 | let res = commonGet(i) | |
1084 | 1087 | let outAmtAmt = res._1 | |
1085 | 1088 | let outPrAmt = res._2 | |
1086 | 1089 | let pmtAmt = res._3 | |
1087 | 1090 | let pmtAssetId = res._4 | |
1088 | 1091 | let state = res._5 | |
1089 | 1092 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt)) | |
1090 | 1093 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1091 | 1094 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1092 | 1095 | then { | |
1093 | - | let $ | |
1094 | - | let refreshKLpActions = $ | |
1095 | - | let updatedKLp = $ | |
1096 | + | let $t04187541957 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1097 | + | let refreshKLpActions = $t04187541957._1 | |
1098 | + | let updatedKLp = $t04187541957._2 | |
1096 | 1099 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1097 | 1100 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1098 | 1101 | then (state ++ refreshKLpActions) | |
1099 | 1102 | else throw("Strict value is not equal to itself.") | |
1100 | 1103 | } | |
1101 | 1104 | else throw("Strict value is not equal to itself.") | |
1102 | 1105 | } | |
1103 | 1106 | ||
1104 | 1107 | ||
1105 | 1108 | ||
1106 | 1109 | @Callable(i) | |
1107 | 1110 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1108 | 1111 | let res = commonGet(i) | |
1109 | 1112 | let outAmAmt = res._1 | |
1110 | 1113 | let outPrAmt = res._2 | |
1111 | 1114 | let pmtAmt = res._3 | |
1112 | 1115 | let pmtAssetId = res._4 | |
1113 | 1116 | let state = res._5 | |
1114 | 1117 | if ((noLessThenAmtAsset > outAmAmt)) | |
1115 | 1118 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1116 | 1119 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1117 | 1120 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1118 | 1121 | else { | |
1119 | 1122 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt)) | |
1120 | 1123 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1121 | 1124 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1122 | 1125 | then { | |
1123 | - | let $ | |
1124 | - | let refreshKLpActions = $ | |
1125 | - | let updatedKLp = $ | |
1126 | + | let $t04290842989 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1127 | + | let refreshKLpActions = $t04290842989._1 | |
1128 | + | let updatedKLp = $t04290842989._2 | |
1126 | 1129 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1127 | 1130 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1128 | 1131 | then (state ++ refreshKLpActions) | |
1129 | 1132 | else throw("Strict value is not equal to itself.") | |
1130 | 1133 | } | |
1131 | 1134 | else throw("Strict value is not equal to itself.") | |
1132 | 1135 | } | |
1133 | 1136 | } | |
1134 | 1137 | ||
1135 | 1138 | ||
1136 | 1139 | ||
1137 | 1140 | @Callable(i) | |
1138 | 1141 | func unstakeAndGet (amount) = { | |
1139 | 1142 | let checkPayments = if ((size(i.payments) != 0)) | |
1140 | 1143 | then throw("No payments are expected") | |
1141 | 1144 | else true | |
1142 | 1145 | if ((checkPayments == checkPayments)) | |
1143 | 1146 | then { | |
1144 | 1147 | let cfg = getPoolConfig() | |
1145 | 1148 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1146 | 1149 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1147 | 1150 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1148 | 1151 | if ((unstakeInv == unstakeInv)) | |
1149 | 1152 | then { | |
1150 | 1153 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1151 | 1154 | let outAmAmt = res._1 | |
1152 | 1155 | let outPrAmt = res._2 | |
1153 | 1156 | let poolStatus = parseIntValue(res._9) | |
1154 | 1157 | let state = res._10 | |
1155 | 1158 | let checkPoolStatus = if (if (isGlobalShutdown()) | |
1156 | 1159 | then true | |
1157 | 1160 | else (poolStatus == PoolShutdown)) | |
1158 | 1161 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
1159 | 1162 | else true | |
1160 | 1163 | if ((checkPoolStatus == checkPoolStatus)) | |
1161 | 1164 | then { | |
1162 | 1165 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1163 | 1166 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1164 | 1167 | then { | |
1165 | - | let $ | |
1166 | - | let refreshKLpActions = $ | |
1167 | - | let updatedKLp = $ | |
1168 | + | let $t04411244193 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1169 | + | let refreshKLpActions = $t04411244193._1 | |
1170 | + | let updatedKLp = $t04411244193._2 | |
1168 | 1171 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1169 | 1172 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1170 | 1173 | then (state ++ refreshKLpActions) | |
1171 | 1174 | else throw("Strict value is not equal to itself.") | |
1172 | 1175 | } | |
1173 | 1176 | else throw("Strict value is not equal to itself.") | |
1174 | 1177 | } | |
1175 | 1178 | else throw("Strict value is not equal to itself.") | |
1176 | 1179 | } | |
1177 | 1180 | else throw("Strict value is not equal to itself.") | |
1178 | 1181 | } | |
1179 | 1182 | else throw("Strict value is not equal to itself.") | |
1180 | 1183 | } | |
1181 | 1184 | ||
1182 | 1185 | ||
1183 | 1186 | ||
1184 | 1187 | @Callable(i) | |
1185 | 1188 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1186 | 1189 | let isGetDisabled = if (isGlobalShutdown()) | |
1187 | 1190 | then true | |
1188 | 1191 | else (cfgPoolStatus == PoolShutdown) | |
1189 | 1192 | let checks = [if (!(isGetDisabled)) | |
1190 | 1193 | then true | |
1191 | 1194 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1192 | 1195 | then true | |
1193 | 1196 | else throw("no payments are expected")] | |
1194 | 1197 | if ((checks == checks)) | |
1195 | 1198 | then { | |
1196 | 1199 | let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1197 | 1200 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1198 | 1201 | if ((unstakeInv == unstakeInv)) | |
1199 | 1202 | then { | |
1200 | 1203 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1201 | 1204 | let outAmAmt = res._1 | |
1202 | 1205 | let outPrAmt = res._2 | |
1203 | 1206 | let state = res._10 | |
1204 | 1207 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1205 | 1208 | then true | |
1206 | 1209 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1207 | 1210 | then true | |
1208 | 1211 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1209 | 1212 | if ((checkAmounts == checkAmounts)) | |
1210 | 1213 | then { | |
1211 | 1214 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1212 | 1215 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1213 | 1216 | then { | |
1214 | - | let $ | |
1215 | - | let refreshKLpActions = $ | |
1216 | - | let updatedKLp = $ | |
1217 | + | let $t04548545566 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1218 | + | let refreshKLpActions = $t04548545566._1 | |
1219 | + | let updatedKLp = $t04548545566._2 | |
1217 | 1220 | let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp) | |
1218 | 1221 | if ((isUpdatedKLpValid == isUpdatedKLpValid)) | |
1219 | 1222 | then (state ++ refreshKLpActions) | |
1220 | 1223 | else throw("Strict value is not equal to itself.") | |
1221 | 1224 | } | |
1222 | 1225 | else throw("Strict value is not equal to itself.") | |
1223 | 1226 | } | |
1224 | 1227 | else throw("Strict value is not equal to itself.") | |
1225 | 1228 | } | |
1226 | 1229 | else throw("Strict value is not equal to itself.") | |
1227 | 1230 | } | |
1228 | 1231 | else throw("Strict value is not equal to itself.") | |
1229 | 1232 | } | |
1230 | 1233 | ||
1231 | 1234 | ||
1232 | 1235 | ||
1233 | 1236 | @Callable(i) | |
1234 | 1237 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
1235 | 1238 | then throw("permissions denied") | |
1236 | 1239 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
1237 | 1240 | ||
1238 | 1241 | ||
1239 | 1242 | ||
1240 | 1243 | @Callable(i) | |
1241 | 1244 | func refreshKLp () = { | |
1242 | 1245 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0) | |
1243 | 1246 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay)) | |
1244 | 1247 | then unit | |
1245 | 1248 | else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1246 | 1249 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1247 | 1250 | then { | |
1248 | 1251 | let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp")) | |
1249 | - | let $ | |
1250 | - | let kLpUpdateActions = $ | |
1251 | - | let updatedKLp = $ | |
1252 | + | let $t04675346817 = refreshKLpInternal(0, 0, 0) | |
1253 | + | let kLpUpdateActions = $t04675346817._1 | |
1254 | + | let updatedKLp = $t04675346817._2 | |
1252 | 1255 | let actions = if ((kLp != updatedKLp)) | |
1253 | 1256 | then kLpUpdateActions | |
1254 | 1257 | else throwErr("nothing to refresh") | |
1255 | 1258 | $Tuple2(actions, toString(updatedKLp)) | |
1256 | 1259 | } | |
1257 | 1260 | else throw("Strict value is not equal to itself.") | |
1258 | 1261 | } | |
1259 | 1262 | ||
1260 | 1263 | ||
1261 | 1264 | ||
1262 | 1265 | @Callable(i) | |
1263 | 1266 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
1264 | 1267 | ||
1265 | 1268 | ||
1266 | 1269 | ||
1267 | 1270 | @Callable(i) | |
1268 | 1271 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1269 | 1272 | ||
1270 | 1273 | ||
1271 | 1274 | ||
1272 | 1275 | @Callable(i) | |
1273 | 1276 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1274 | 1277 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
1275 | 1278 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
1276 | 1279 | } | |
1277 | 1280 | ||
1278 | 1281 | ||
1279 | 1282 | ||
1280 | 1283 | @Callable(i) | |
1281 | 1284 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
1282 | 1285 | ||
1283 | 1286 | ||
1284 | 1287 | ||
1285 | 1288 | @Callable(i) | |
1286 | 1289 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
1287 | 1290 | ||
1288 | 1291 | ||
1289 | 1292 | ||
1290 | 1293 | @Callable(i) | |
1291 | 1294 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1292 | 1295 | ||
1293 | 1296 | ||
1294 | 1297 | ||
1295 | 1298 | @Callable(i) | |
1296 | 1299 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1297 | 1300 | ||
1298 | 1301 | ||
1299 | 1302 | ||
1300 | 1303 | @Callable(i) | |
1301 | 1304 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1302 | 1305 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1303 | 1306 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1304 | 1307 | } | |
1305 | 1308 | ||
1306 | 1309 | ||
1307 | 1310 | ||
1308 | 1311 | @Callable(i) | |
1309 | 1312 | func statsREADONLY () = { | |
1310 | 1313 | let cfg = getPoolConfig() | |
1311 | 1314 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1312 | 1315 | let amtAssetId = cfg[idxAmtAssetId] | |
1313 | 1316 | let priceAssetId = cfg[idxPriceAssetId] | |
1314 | 1317 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1315 | 1318 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1316 | 1319 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1317 | 1320 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1318 | 1321 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1319 | 1322 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1320 | 1323 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1321 | 1324 | let pricesList = if ((poolLPBalance == 0)) | |
1322 | 1325 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1323 | 1326 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1324 | 1327 | let curPrice = 0 | |
1325 | 1328 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1326 | 1329 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1327 | 1330 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1328 | 1331 | $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)) | |
1329 | 1332 | } | |
1330 | 1333 | ||
1331 | 1334 | ||
1332 | 1335 | ||
1333 | 1336 | @Callable(i) | |
1334 | 1337 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1335 | 1338 | let cfg = getPoolConfig() | |
1336 | 1339 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1337 | 1340 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1338 | 1341 | let amAssetId = fromBase58String(amAssetIdStr) | |
1339 | 1342 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1340 | 1343 | let prAssetId = fromBase58String(prAssetIdStr) | |
1341 | 1344 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1342 | 1345 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1343 | 1346 | let poolStatus = cfg[idxPoolStatus] | |
1344 | 1347 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1345 | 1348 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1346 | 1349 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1347 | 1350 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1348 | 1351 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1349 | 1352 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1350 | 1353 | then zeroBigInt | |
1351 | 1354 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1352 | 1355 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1353 | 1356 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1354 | 1357 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1355 | 1358 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1356 | 1359 | let calcLpAmt = estPut._1 | |
1357 | 1360 | let curPriceCalc = estPut._3 | |
1358 | 1361 | let amBalance = estPut._4 | |
1359 | 1362 | let prBalance = estPut._5 | |
1360 | 1363 | let lpEmission = estPut._6 | |
1361 | 1364 | $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)) | |
1362 | 1365 | } | |
1363 | 1366 | ||
1364 | 1367 | ||
1365 | 1368 | ||
1366 | 1369 | @Callable(i) | |
1367 | 1370 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1368 | 1371 | let cfg = getPoolConfig() | |
1369 | 1372 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1370 | 1373 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1371 | 1374 | let amAssetId = fromBase58String(amAssetIdStr) | |
1372 | 1375 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1373 | 1376 | let prAssetId = fromBase58String(prAssetIdStr) | |
1374 | 1377 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1375 | 1378 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1376 | 1379 | let poolStatus = cfg[idxPoolStatus] | |
1377 | 1380 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1378 | 1381 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1379 | 1382 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1380 | 1383 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1381 | 1384 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1382 | 1385 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1383 | 1386 | then zeroBigInt | |
1384 | 1387 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1385 | 1388 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1386 | 1389 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1387 | 1390 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1388 | 1391 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1389 | 1392 | let calcLpAmt = estPut._1 | |
1390 | 1393 | let curPriceCalc = estPut._3 | |
1391 | 1394 | let amBalance = estPut._4 | |
1392 | 1395 | let prBalance = estPut._5 | |
1393 | 1396 | let lpEmission = estPut._6 | |
1394 | 1397 | $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)) | |
1395 | 1398 | } | |
1396 | 1399 | ||
1397 | 1400 | ||
1398 | 1401 | ||
1399 | 1402 | @Callable(i) | |
1400 | 1403 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1401 | 1404 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1402 | 1405 | let outAmAmt = res._1 | |
1403 | 1406 | let outPrAmt = res._2 | |
1404 | 1407 | let amBalance = res._5 | |
1405 | 1408 | let prBalance = res._6 | |
1406 | 1409 | let lpEmission = res._7 | |
1407 | 1410 | let curPrice = res._8 | |
1408 | 1411 | let poolStatus = parseIntValue(res._9) | |
1409 | 1412 | $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)) | |
1410 | 1413 | } | |
1411 | 1414 | ||
1412 | 1415 | ||
1413 | 1416 | @Verifier(tx) | |
1414 | 1417 | func verify () = { | |
1415 | 1418 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1416 | 1419 | case pk: ByteVector => | |
1417 | 1420 | pk | |
1418 | 1421 | case _: Unit => | |
1419 | 1422 | tx.senderPublicKey | |
1420 | 1423 | case _ => | |
1421 | 1424 | throw("Match error") | |
1422 | 1425 | } | |
1423 | 1426 | match tx { | |
1424 | 1427 | case order: Order => | |
1425 | 1428 | let matcherPub = getMatcherPubOrFail() | |
1426 | 1429 | let orderValid = validateMatcherOrderAllowed(order) | |
1427 | 1430 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1428 | 1431 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1429 | 1432 | if (if (if (orderValid) | |
1430 | 1433 | then senderValid | |
1431 | 1434 | else false) | |
1432 | 1435 | then matcherValid | |
1433 | 1436 | else false) | |
1434 | 1437 | then true | |
1435 | 1438 | else throwOrderError(orderValid, senderValid, matcherValid) | |
1436 | 1439 | case s: SetScriptTransaction => | |
1437 | 1440 | let newHash = blake2b256(value(s.script)) | |
1438 | 1441 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1439 | 1442 | let currentHash = scriptHash(this) | |
1440 | 1443 | if (if ((allowedHash == newHash)) | |
1441 | 1444 | then (currentHash != newHash) | |
1442 | 1445 | else false) | |
1443 | 1446 | then true | |
1444 | 1447 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1445 | 1448 | case _ => | |
1446 | 1449 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1447 | 1450 | } | |
1448 | 1451 | } | |
1449 | 1452 |
github/deemru/w8io/fabc49c 188.75 ms ◑