tx · 3CuLD38yfBueMDQNVXFjrZSr6uZBtqBRURnpzdGZophH

3MsCuhfTF9EnyVoNh2yqo4eZ1Q24Ki3fntS:  -0.03400000 Waves

2022.12.06 14:12 [2348407] smart account 3MsCuhfTF9EnyVoNh2yqo4eZ1Q24Ki3fntS > SELF 0.00000000 Waves

{ "type": 13, "id": "3CuLD38yfBueMDQNVXFjrZSr6uZBtqBRURnpzdGZophH", "fee": 3400000, "feeAssetId": null, "timestamp": 1670324911642, "version": 1, "sender": "3MsCuhfTF9EnyVoNh2yqo4eZ1Q24Ki3fntS", "senderPublicKey": "8rqHfvDx1Q95zF6SWwiQWVTu2vr2wNQpxUzAx84ZAedj", "proofs": [ "2pRMjJVZYydgVh82qNZa4dNyfYtojn6ECSnmwD4KQvcqPQ3Zk952Y2rzCiwTrC7H2hXPHwsgooLXMaUGP62BZzsm" ], "script": "base64:BgKdLAgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlk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Amd0CWJvZHlCeXRlcwkAkQMCCAUCZ3QGcHJvb2ZzAAAFAmd2pTn++w==", "chainId": 84, "height": 2348407, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3uRHxMfyUycrLGbPWWobETZ3KCoJEgrptRENRM9KpsPi Next: 4jsCtBrqcahHgBkz8QV1botdmHfUPeSpogjBYPyAacZh Diff:
OldNewDifferences
389389 }
390390
391391
392+func validateUpdatedKLp (updatedKLp) = {
393+ let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
394+ let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
395+ let lpAssetEmission = value(assetInfo(cfgLpAssetId)).quantity
396+ let currentKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
397+ if ((updatedKLp >= currentKLp))
398+ then true
399+ else throwErr("updated KLp lower than current KLp")
400+ }
401+
402+
392403 func validateMatcherOrderAllowed (order) = {
393404 let amountAssetAmount = order.amount
394405 let priceAssetAmount = fraction(order.amount, order.price, scale8)
395- let $t01955919771 = if ((order.orderType == Buy))
406+ let $t02002520237 = if ((order.orderType == Buy))
396407 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
397408 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
398- let amountAssetBalanceDelta = $t01955919771._1
399- let priceAssetBalanceDelta = $t01955919771._2
409+ let amountAssetBalanceDelta = $t02002520237._1
410+ let priceAssetBalanceDelta = $t02002520237._2
400411 if (if (if (isGlobalShutdown())
401412 then true
402413 else (cfgPoolStatus == PoolMatcherDisabled))
409420 then throw("Wrong order assets.")
410421 else {
411422 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
412- let $t02024220342 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
413- let unusedActions = $t02024220342._1
414- let kLpNew = $t02024220342._2
423+ let $t02070820808 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
424+ let unusedActions = $t02070820808._1
425+ let kLpNew = $t02070820808._2
415426 let isOrderValid = (kLpNew > kLp)
416427 isOrderValid
417428 }
487498 else if ((paymentAssetId == cfgPriceAssetId))
488499 then false
489500 else throwErr("invalid asset")
490- let $t02302623319 = if (isEval)
501+ let $t02349223785 = if (isEval)
491502 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
492503 else if (paymentInAmountAsset)
493504 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
494505 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
495- let amountBalanceOld = $t02302623319._1
496- let priceBalanceOld = $t02302623319._2
497- let $t02332323472 = if (paymentInAmountAsset)
506+ let amountBalanceOld = $t02349223785._1
507+ let priceBalanceOld = $t02349223785._2
508+ let $t02378923938 = if (paymentInAmountAsset)
498509 then $Tuple2(paymentAmountRaw, 0)
499510 else $Tuple2(0, paymentAmountRaw)
500- let amountAssetAmountRaw = $t02332323472._1
501- let priceAssetAmountRaw = $t02332323472._2
511+ let amountAssetAmountRaw = $t02378923938._1
512+ let priceAssetAmountRaw = $t02378923938._2
502513 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
503514 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
504- let $t02359423653 = takeFee(paymentAmountRaw)
505- let paymentAmount = $t02359423653._1
506- let feeAmount = $t02359423653._2
515+ let $t02406024119 = takeFee(paymentAmountRaw)
516+ let paymentAmount = $t02406024119._1
517+ let feeAmount = $t02406024119._2
507518 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
508519 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
509520 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
526537 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
527538 let priceOld = fromX18(priceOldX18, scale8)
528539 let loss = {
529- let $t02513025297 = if (paymentInAmountAsset)
540+ let $t02559625763 = if (paymentInAmountAsset)
530541 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
531542 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
532- let amount = $t02513025297._1
533- let balance = $t02513025297._2
543+ let amount = $t02559625763._1
544+ let balance = $t02559625763._2
534545 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
535546 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
536547 }
564575 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
565576 let redeemedBigInt = toBigInt(paymentAmount)
566577 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
567- let $t02689926949 = takeFee(amountRaw)
568- let totalAmount = $t02689926949._1
569- let feeAmount = $t02689926949._2
570- let $t02695327179 = if (outInAmountAsset)
578+ let $t02736527415 = takeFee(amountRaw)
579+ let totalAmount = $t02736527415._1
580+ let feeAmount = $t02736527415._2
581+ let $t02741927645 = if (outInAmountAsset)
571582 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
572583 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
573- let outAmAmount = $t02695327179._1
574- let outPrAmount = $t02695327179._2
575- let amBalanceNew = $t02695327179._3
576- let prBalanceNew = $t02695327179._4
584+ let outAmAmount = $t02741927645._1
585+ let outPrAmount = $t02741927645._2
586+ let amBalanceNew = $t02741927645._3
587+ let prBalanceNew = $t02741927645._4
577588 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
578589 let priceNew = fromX18(priceNewX18, scale8)
579590 let commonState = if (isEval)
714725 else throw("Strict value is not equal to itself.")
715726 }
716727 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
717- let $t03113031195 = refreshKLpInternal(0, 0, 0)
718- let refreshKLpActions = $t03113031195._1
719- let updatedKLp = $t03113031195._2
720- ((state ++ lpTransfer) ++ refreshKLpActions)
728+ let $t03159631661 = refreshKLpInternal(0, 0, 0)
729+ let refreshKLpActions = $t03159631661._1
730+ let updatedKLp = $t03159631661._2
731+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
732+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
733+ then ((state ++ lpTransfer) ++ refreshKLpActions)
734+ else throw("Strict value is not equal to itself.")
721735 }
722736 else throw("Strict value is not equal to itself.")
723737 }
736750 else {
737751 let estPut = commonPut(i, maxSlippage, false)
738752 let state = estPut._9
739- let $t03148131546 = refreshKLpInternal(0, 0, 0)
740- let refreshKLpActions = $t03148131546._1
741- let updatedKLp = $t03148131546._2
742- (state ++ refreshKLpActions)
753+ let $t03201032075 = refreshKLpInternal(0, 0, 0)
754+ let refreshKLpActions = $t03201032075._1
755+ let updatedKLp = $t03201032075._2
756+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
757+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
758+ then (state ++ refreshKLpActions)
759+ else throw("Strict value is not equal to itself.")
743760 }
744761
745762
773790 let paymentAmountRaw = payment.amount
774791 let userAddress = i.caller
775792 let txId = i.transactionId
776- let $t03232232474 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
777- if (($t03232232474 == $t03232232474))
793+ let $t03291333065 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
794+ if (($t03291333065 == $t03291333065))
778795 then {
779- let paymentInAmountAsset = $t03232232474._5
780- let bonus = $t03232232474._4
781- let feeAmount = $t03232232474._3
782- let commonState = $t03232232474._2
783- let emitAmountEstimated = $t03232232474._1
796+ let paymentInAmountAsset = $t03291333065._5
797+ let bonus = $t03291333065._4
798+ let feeAmount = $t03291333065._3
799+ let commonState = $t03291333065._2
800+ let emitAmountEstimated = $t03291333065._1
784801 let emitAmount = if (if ((minOutAmount > 0))
785802 then (minOutAmount > emitAmountEstimated)
786803 else false)
800817 let sendFee = if ((feeAmount > 0))
801818 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
802819 else nil
803- let $t03306033257 = if ((this == feeCollectorAddress))
820+ let $t03365133848 = if ((this == feeCollectorAddress))
804821 then $Tuple2(0, 0)
805822 else if (paymentInAmountAsset)
806823 then $Tuple2(-(feeAmount), 0)
807824 else $Tuple2(0, -(feeAmount))
808- let amountAssetBalanceDelta = $t03306033257._1
809- let priceAssetBalanceDelta = $t03306033257._2
810- let $t03326033368 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
811- let refreshKLpActions = $t03326033368._1
812- let updatedKLp = $t03326033368._2
813- $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
825+ let amountAssetBalanceDelta = $t03365133848._1
826+ let priceAssetBalanceDelta = $t03365133848._2
827+ let $t03385133959 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
828+ let refreshKLpActions = $t03385133959._1
829+ let updatedKLp = $t03385133959._2
830+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
831+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
832+ then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
833+ else throw("Strict value is not equal to itself.")
814834 }
815835 else throw("Strict value is not equal to itself.")
816836 }
823843
824844 @Callable(i)
825845 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
826- let $t03356133718 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
827- let emitAmountEstimated = $t03356133718._1
828- let commonState = $t03356133718._2
829- let feeAmount = $t03356133718._3
830- let bonus = $t03356133718._4
831- let paymentInAmountAsset = $t03356133718._5
846+ let $t03421334370 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
847+ let emitAmountEstimated = $t03421334370._1
848+ let commonState = $t03421334370._2
849+ let feeAmount = $t03421334370._3
850+ let bonus = $t03421334370._4
851+ let paymentInAmountAsset = $t03421334370._5
832852 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
833853 }
834854
862882 let paymentAmount = payment.amount
863883 let userAddress = i.caller
864884 let txId = i.transactionId
865- let $t03452334676 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
866- if (($t03452334676 == $t03452334676))
885+ let $t03517535328 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
886+ if (($t03517535328 == $t03517535328))
867887 then {
868- let outInAmountAsset = $t03452334676._5
869- let bonus = $t03452334676._4
870- let feeAmount = $t03452334676._3
871- let commonState = $t03452334676._2
872- let amountEstimated = $t03452334676._1
888+ let outInAmountAsset = $t03517535328._5
889+ let bonus = $t03517535328._4
890+ let feeAmount = $t03517535328._3
891+ let commonState = $t03517535328._2
892+ let amountEstimated = $t03517535328._1
873893 let amount = if (if ((minOutAmount > 0))
874894 then (minOutAmount > amountEstimated)
875895 else false)
882902 let sendFee = if ((feeAmount > 0))
883903 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
884904 else nil
885- let $t03517635423 = {
905+ let $t03582836075 = {
886906 let feeAmountForCalc = if ((this == feeCollectorAddress))
887907 then 0
888908 else feeAmount
890910 then $Tuple2(-((amount + feeAmountForCalc)), 0)
891911 else $Tuple2(0, -((amount + feeAmountForCalc)))
892912 }
893- let amountAssetBalanceDelta = $t03517635423._1
894- let priceAssetBalanceDelta = $t03517635423._2
895- let $t03542635534 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
896- let refreshKLpActions = $t03542635534._1
897- let updatedKLp = $t03542635534._2
898- $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
913+ let amountAssetBalanceDelta = $t03582836075._1
914+ let priceAssetBalanceDelta = $t03582836075._2
915+ let $t03607836186 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
916+ let refreshKLpActions = $t03607836186._1
917+ let updatedKLp = $t03607836186._2
918+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
919+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
920+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
921+ else throw("Strict value is not equal to itself.")
899922 }
900923 else throw("Strict value is not equal to itself.")
901924 }
908931
909932 @Callable(i)
910933 func getOneTknREADONLY (outAssetId,paymentAmount) = {
911- let $t03571835874 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
912- let amountEstimated = $t03571835874._1
913- let commonState = $t03571835874._2
914- let feeAmount = $t03571835874._3
915- let bonus = $t03571835874._4
916- let outInAmountAsset = $t03571835874._5
934+ let $t03643136587 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
935+ let amountEstimated = $t03643136587._1
936+ let commonState = $t03643136587._2
937+ let feeAmount = $t03643136587._3
938+ let bonus = $t03643136587._4
939+ let outInAmountAsset = $t03643136587._5
917940 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
918941 }
919942
947970 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
948971 if ((unstakeInv == unstakeInv))
949972 then {
950- let $t03669936850 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
951- if (($t03669936850 == $t03669936850))
973+ let $t03741237563 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
974+ if (($t03741237563 == $t03741237563))
952975 then {
953- let outInAmountAsset = $t03669936850._5
954- let bonus = $t03669936850._4
955- let feeAmount = $t03669936850._3
956- let commonState = $t03669936850._2
957- let amountEstimated = $t03669936850._1
976+ let outInAmountAsset = $t03741237563._5
977+ let bonus = $t03741237563._4
978+ let feeAmount = $t03741237563._3
979+ let commonState = $t03741237563._2
980+ let amountEstimated = $t03741237563._1
958981 let amount = if (if ((minOutAmount > 0))
959982 then (minOutAmount > amountEstimated)
960983 else false)
967990 let sendFee = if ((feeAmount > 0))
968991 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
969992 else nil
970- let $t03734537592 = {
993+ let $t03805838305 = {
971994 let feeAmountForCalc = if ((this == feeCollectorAddress))
972995 then 0
973996 else feeAmount
975998 then $Tuple2(-((amount + feeAmountForCalc)), 0)
976999 else $Tuple2(0, -((amount + feeAmountForCalc)))
9771000 }
978- let amountAssetBalanceDelta = $t03734537592._1
979- let priceAssetBalanceDelta = $t03734537592._2
980- let $t03759537703 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
981- let refreshKLpActions = $t03759537703._1
982- let updatedKLp = $t03759537703._2
983- $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1001+ let amountAssetBalanceDelta = $t03805838305._1
1002+ let priceAssetBalanceDelta = $t03805838305._2
1003+ let $t03830838416 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1004+ let refreshKLpActions = $t03830838416._1
1005+ let updatedKLp = $t03830838416._2
1006+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1007+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1008+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1009+ else throw("Strict value is not equal to itself.")
9841010 }
9851011 else throw("Strict value is not equal to itself.")
9861012 }
10041030 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10051031 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10061032 then {
1007- let $t03849538577 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1008- let refreshKLpActions = $t03849538577._1
1009- let updatedKLp = $t03849538577._2
1010- (state ++ refreshKLpActions)
1033+ let $t03926939351 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1034+ let refreshKLpActions = $t03926939351._1
1035+ let updatedKLp = $t03926939351._2
1036+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1037+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1038+ then (state ++ refreshKLpActions)
1039+ else throw("Strict value is not equal to itself.")
10111040 }
10121041 else throw("Strict value is not equal to itself.")
10131042 }
10301059 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10311060 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10321061 then {
1033- let $t03937339454 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1034- let refreshKLpActions = $t03937339454._1
1035- let updatedKLp = $t03937339454._2
1036- (state ++ refreshKLpActions)
1062+ let $t04020840289 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1063+ let refreshKLpActions = $t04020840289._1
1064+ let updatedKLp = $t04020840289._2
1065+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1066+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1067+ then (state ++ refreshKLpActions)
1068+ else throw("Strict value is not equal to itself.")
10371069 }
10381070 else throw("Strict value is not equal to itself.")
10391071 }
10681100 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
10691101 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10701102 then {
1071- let $t04042740508 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1072- let refreshKLpActions = $t04042740508._1
1073- let updatedKLp = $t04042740508._2
1074- (state ++ refreshKLpActions)
1103+ let $t04132341404 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1104+ let refreshKLpActions = $t04132341404._1
1105+ let updatedKLp = $t04132341404._2
1106+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1107+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1108+ then (state ++ refreshKLpActions)
1109+ else throw("Strict value is not equal to itself.")
10751110 }
10761111 else throw("Strict value is not equal to itself.")
10771112 }
11131148 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11141149 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11151150 then {
1116- let $t04164841729 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1117- let refreshKLpActions = $t04164841729._1
1118- let updatedKLp = $t04164841729._2
1119- (state ++ refreshKLpActions)
1151+ let $t04260742688 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1152+ let refreshKLpActions = $t04260742688._1
1153+ let updatedKLp = $t04260742688._2
1154+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1155+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1156+ then (state ++ refreshKLpActions)
1157+ else throw("Strict value is not equal to itself.")
11201158 }
11211159 else throw("Strict value is not equal to itself.")
11221160 }
11451183 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
11461184 then {
11471185 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1148- let $t04284342907 = refreshKLpInternal(0, 0, 0)
1149- let kLpUpdateActions = $t04284342907._1
1150- let updatedKLp = $t04284342907._2
1186+ let $t04386343927 = refreshKLpInternal(0, 0, 0)
1187+ let kLpUpdateActions = $t04386343927._1
1188+ let updatedKLp = $t04386343927._2
11511189 let actions = if ((kLp != updatedKLp))
11521190 then kLpUpdateActions
11531191 else throwErr("nothing to refresh")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lPdecimals = 8
55
66 let scale8 = 100000000
77
88 let scale8BigInt = toBigInt(100000000)
99
1010 let scale18 = toBigInt(1000000000000000000)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let big0 = toBigInt(0)
1515
1616 let big1 = toBigInt(1)
1717
1818 let big2 = toBigInt(2)
1919
2020 let wavesString = "WAVES"
2121
2222 let SEP = "__"
2323
2424 let PoolActive = 1
2525
2626 let PoolPutDisabled = 2
2727
2828 let PoolMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
3232 let idxPoolAddress = 1
3333
3434 let idxPoolStatus = 2
3535
3636 let idxPoolLPAssetId = 3
3737
3838 let idxAmtAssetId = 4
3939
4040 let idxPriceAssetId = 5
4141
4242 let idxAmtAssetDcm = 6
4343
4444 let idxPriceAssetDcm = 7
4545
4646 let idxIAmtAssetId = 8
4747
4848 let idxIPriceAssetId = 9
4949
5050 let idxLPAssetDcm = 10
5151
5252 let idxPoolAmtAssetAmt = 1
5353
5454 let idxPoolPriceAssetAmt = 2
5555
5656 let idxPoolLPAssetAmt = 3
5757
5858 let idxFactoryStakingContract = 1
5959
6060 let idxFactorySlippageContract = 7
6161
6262 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6666
6767
6868 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
6969
7070
7171 func abs (val) = if ((0 > val))
7272 then -(val)
7373 else val
7474
7575
7676 func absBigInt (val) = if ((zeroBigInt > val))
7777 then -(val)
7878 else val
7979
8080
8181 func fc () = "%s__factoryContract"
8282
8383
8484 func mpk () = "%s__managerPublicKey"
8585
8686
8787 func pmpk () = "%s__pendingManagerPublicKey"
8888
8989
9090 func pl () = "%s%s__price__last"
9191
9292
9393 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
9494
9595
9696 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
9797
9898
9999 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
100100
101101
102102 func aa () = "%s__amountAsset"
103103
104104
105105 func pa () = "%s__priceAsset"
106106
107107
108108 let keyFee = "%s__fee"
109109
110110 let feeDefault = fraction(10, scale8, 10000)
111111
112112 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
113113
114114 let keyKLp = makeString(["%s", "kLp"], SEP)
115115
116116 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
117117
118118 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
119119
120120 let kLpRefreshDelayDefault = 30
121121
122122 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
123123
124124 func keyFactoryConfig () = "%s__factoryConfig"
125125
126126
127127 func keyMatcherPub () = "%s%s__matcher__publicKey"
128128
129129
130130 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
131131
132132
133133 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
134134
135135
136136 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
137137
138138
139139 func keyAllPoolsShutdown () = "%s__shutdown"
140140
141141
142142 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
143143
144144
145145 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
146146
147147
148148 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
149149
150150 func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
151151
152152
153153 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
154154
155155
156156 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
157157
158158
159159 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
160160
161161
162162 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
163163
164164
165165 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
166166
167167 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
168168
169169 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
170170
171171
172172 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
173173
174174
175175 func getPoolConfig () = {
176176 let amtAsset = getStringOrFail(this, aa())
177177 let priceAsset = getStringOrFail(this, pa())
178178 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
179179 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
180180 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
181181 }
182182
183183
184184 func parseAssetId (input) = if ((input == wavesString))
185185 then unit
186186 else fromBase58String(input)
187187
188188
189189 func assetIdToString (input) = if ((input == unit))
190190 then wavesString
191191 else toBase58String(value(input))
192192
193193
194194 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]))
195195
196196
197197 let poolConfigParsed = parsePoolConfig(getPoolConfig())
198198
199199 let $t079158081 = poolConfigParsed
200200
201201 let cfgPoolAddress = $t079158081._1
202202
203203 let cfgPoolStatus = $t079158081._2
204204
205205 let cfgLpAssetId = $t079158081._3
206206
207207 let cfgAmountAssetId = $t079158081._4
208208
209209 let cfgPriceAssetId = $t079158081._5
210210
211211 let cfgAmountAssetDecimals = $t079158081._6
212212
213213 let cfgPriceAssetDecimals = $t079158081._7
214214
215215 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
216216
217217
218218 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
219219
220220 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
221221
222222 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)
223223
224224
225225 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)
226226
227227
228228 func getAccBalance (assetId) = if ((assetId == "WAVES"))
229229 then wavesBalance(this).available
230230 else assetBalance(this, fromBase58String(assetId))
231231
232232
233233 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
234234
235235
236236 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
237237 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
238238 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
239239 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
240240 }
241241
242242
243243 func calcPrices (amAmt,prAmt,lpAmt) = {
244244 let cfg = getPoolConfig()
245245 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
246246 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
247247 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
248248 let amAmtX18 = toX18(amAmt, amtAssetDcm)
249249 let prAmtX18 = toX18(prAmt, priceAssetDcm)
250250 let lpAmtX18 = toX18(lpAmt, scale8)
251251 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
252252 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
253253 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
254254 }
255255
256256
257257 func calculatePrices (amAmt,prAmt,lpAmt) = {
258258 let prices = calcPrices(amAmt, prAmt, lpAmt)
259259 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
260260 }
261261
262262
263263 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
264264 let cfg = getPoolConfig()
265265 let lpAssetId = cfg[idxPoolLPAssetId]
266266 let amAssetId = cfg[idxAmtAssetId]
267267 let prAssetId = cfg[idxPriceAssetId]
268268 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
269269 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
270270 let poolStatus = cfg[idxPoolStatus]
271271 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
272272 if ((lpAssetId != pmtAssetId))
273273 then throw("Invalid asset passed.")
274274 else {
275275 let amBalance = getAccBalance(amAssetId)
276276 let amBalanceX18 = toX18(amBalance, amAssetDcm)
277277 let prBalance = getAccBalance(prAssetId)
278278 let prBalanceX18 = toX18(prBalance, prAssetDcm)
279279 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
280280 let curPrice = fromX18(curPriceX18, scale8)
281281 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
282282 let lpEmissionX18 = toX18(lpEmission, scale8)
283283 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
284284 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
285285 let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
286286 let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
287287 let state = if ((txId58 == ""))
288288 then nil
289289 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
290290 then unit
291291 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
292292 then unit
293293 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)]
294294 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
295295 }
296296 }
297297
298298
299299 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
300300 let cfg = getPoolConfig()
301301 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
302302 let amAssetIdStr = cfg[idxAmtAssetId]
303303 let prAssetIdStr = cfg[idxPriceAssetId]
304304 let iAmtAssetId = cfg[idxIAmtAssetId]
305305 let iPriceAssetId = cfg[idxIPriceAssetId]
306306 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
307307 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
308308 let poolStatus = cfg[idxPoolStatus]
309309 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
310310 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
311311 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
312312 if (if ((amAssetIdStr != inAmAssetIdStr))
313313 then true
314314 else (prAssetIdStr != inPrAssetIdStr))
315315 then throw("Invalid amt or price asset passed.")
316316 else {
317317 let amBalance = if (isEvaluate)
318318 then getAccBalance(amAssetIdStr)
319319 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
320320 let prBalance = if (isEvaluate)
321321 then getAccBalance(prAssetIdStr)
322322 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
323323 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
324324 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
325325 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
326326 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
327327 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
328328 let res = if ((lpEmission == 0))
329329 then {
330330 let curPriceX18 = zeroBigInt
331331 let slippageX18 = zeroBigInt
332332 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
333333 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
334334 }
335335 else {
336336 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
337337 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
338338 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
339339 if (if ((curPriceX18 != zeroBigInt))
340340 then (slippageX18 > slippageToleranceX18)
341341 else false)
342342 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
343343 else {
344344 let lpEmissionX18 = toX18(lpEmission, scale8)
345345 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
346346 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
347347 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
348348 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
349349 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
350350 let expAmtAssetAmtX18 = expectedAmts._1
351351 let expPriceAssetAmtX18 = expectedAmts._2
352352 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
353353 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
354354 }
355355 }
356356 let calcLpAmt = res._1
357357 let calcAmAssetPmt = res._2
358358 let calcPrAssetPmt = res._3
359359 let curPrice = fromX18(res._4, scale8)
360360 let slippageCalc = fromX18(res._5, scale8)
361361 if ((0 >= calcLpAmt))
362362 then throw("Invalid calculations. LP calculated is less than zero.")
363363 else {
364364 let emitLpAmt = if (!(emitLp))
365365 then 0
366366 else calcLpAmt
367367 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
368368 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
369369 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))]
370370 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
371371 }
372372 }
373373 }
374374
375375
376376 func calcKLp (amountBalance,priceBalance,lpEmission) = {
377377 let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpEmission)
378378 updatedKLp
379379 }
380380
381381
382382 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
383383 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
384384 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
385385 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
386386 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
387387 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
388388 $Tuple2(actions, updatedKLp)
389389 }
390390
391391
392+func validateUpdatedKLp (updatedKLp) = {
393+ let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
394+ let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
395+ let lpAssetEmission = value(assetInfo(cfgLpAssetId)).quantity
396+ let currentKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
397+ if ((updatedKLp >= currentKLp))
398+ then true
399+ else throwErr("updated KLp lower than current KLp")
400+ }
401+
402+
392403 func validateMatcherOrderAllowed (order) = {
393404 let amountAssetAmount = order.amount
394405 let priceAssetAmount = fraction(order.amount, order.price, scale8)
395- let $t01955919771 = if ((order.orderType == Buy))
406+ let $t02002520237 = if ((order.orderType == Buy))
396407 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
397408 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
398- let amountAssetBalanceDelta = $t01955919771._1
399- let priceAssetBalanceDelta = $t01955919771._2
409+ let amountAssetBalanceDelta = $t02002520237._1
410+ let priceAssetBalanceDelta = $t02002520237._2
400411 if (if (if (isGlobalShutdown())
401412 then true
402413 else (cfgPoolStatus == PoolMatcherDisabled))
403414 then true
404415 else (cfgPoolStatus == PoolShutdown))
405416 then throw("Exchange operations disabled")
406417 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
407418 then true
408419 else (order.assetPair.priceAsset != cfgPriceAssetId))
409420 then throw("Wrong order assets.")
410421 else {
411422 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
412- let $t02024220342 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
413- let unusedActions = $t02024220342._1
414- let kLpNew = $t02024220342._2
423+ let $t02070820808 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
424+ let unusedActions = $t02070820808._1
425+ let kLpNew = $t02070820808._2
415426 let isOrderValid = (kLpNew > kLp)
416427 isOrderValid
417428 }
418429 }
419430
420431
421432 func commonGet (i) = if ((size(i.payments) != 1))
422433 then throw("exactly 1 payment is expected")
423434 else {
424435 let pmt = value(i.payments[0])
425436 let pmtAssetId = value(pmt.assetId)
426437 let pmtAmt = pmt.amount
427438 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
428439 let outAmAmt = res._1
429440 let outPrAmt = res._2
430441 let poolStatus = parseIntValue(res._9)
431442 let state = res._10
432443 if (if (isGlobalShutdown())
433444 then true
434445 else (poolStatus == PoolShutdown))
435446 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
436447 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
437448 }
438449
439450
440451 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
441452 then throw("exactly 2 payments are expected")
442453 else {
443454 let amAssetPmt = value(i.payments[0])
444455 let prAssetPmt = value(i.payments[1])
445456 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
446457 let poolStatus = parseIntValue(estPut._8)
447458 if (if (if (isGlobalShutdown())
448459 then true
449460 else (poolStatus == PoolPutDisabled))
450461 then true
451462 else (poolStatus == PoolShutdown))
452463 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
453464 else estPut
454465 }
455466
456467
457468 func emit (amount) = {
458469 let emitInv = invoke(factoryContract, "emit", [amount], nil)
459470 if ((emitInv == emitInv))
460471 then {
461472 let emitInvLegacy = match emitInv {
462473 case legacyFactoryContract: Address =>
463474 invoke(legacyFactoryContract, "emit", [amount], nil)
464475 case _ =>
465476 unit
466477 }
467478 if ((emitInvLegacy == emitInvLegacy))
468479 then amount
469480 else throw("Strict value is not equal to itself.")
470481 }
471482 else throw("Strict value is not equal to itself.")
472483 }
473484
474485
475486 func takeFee (amount) = {
476487 let feeAmount = fraction(amount, fee, scale8)
477488 $Tuple2((amount - feeAmount), feeAmount)
478489 }
479490
480491
481492 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
482493 let isEval = (txId == unit)
483494 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
484495 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
485496 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
486497 then true
487498 else if ((paymentAssetId == cfgPriceAssetId))
488499 then false
489500 else throwErr("invalid asset")
490- let $t02302623319 = if (isEval)
501+ let $t02349223785 = if (isEval)
491502 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
492503 else if (paymentInAmountAsset)
493504 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
494505 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
495- let amountBalanceOld = $t02302623319._1
496- let priceBalanceOld = $t02302623319._2
497- let $t02332323472 = if (paymentInAmountAsset)
506+ let amountBalanceOld = $t02349223785._1
507+ let priceBalanceOld = $t02349223785._2
508+ let $t02378923938 = if (paymentInAmountAsset)
498509 then $Tuple2(paymentAmountRaw, 0)
499510 else $Tuple2(0, paymentAmountRaw)
500- let amountAssetAmountRaw = $t02332323472._1
501- let priceAssetAmountRaw = $t02332323472._2
511+ let amountAssetAmountRaw = $t02378923938._1
512+ let priceAssetAmountRaw = $t02378923938._2
502513 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
503514 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
504- let $t02359423653 = takeFee(paymentAmountRaw)
505- let paymentAmount = $t02359423653._1
506- let feeAmount = $t02359423653._2
515+ let $t02406024119 = takeFee(paymentAmountRaw)
516+ let paymentAmount = $t02406024119._1
517+ let feeAmount = $t02406024119._2
507518 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
508519 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
509520 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
510521 let priceNew = fromX18(priceNewX18, scale8)
511522 let paymentBalance = if (paymentInAmountAsset)
512523 then amountBalanceOld
513524 else priceBalanceOld
514525 let paymentBalanceBigInt = toBigInt(paymentBalance)
515526 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
516527 let chechSupply = if ((supplyBigInt > big0))
517528 then true
518529 else throwErr("initial deposit requires all coins")
519530 if ((chechSupply == chechSupply))
520531 then {
521532 let depositBigInt = toBigInt(paymentAmount)
522533 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
523534 let commonState = if (isEval)
524535 then nil
525536 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))]
526537 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
527538 let priceOld = fromX18(priceOldX18, scale8)
528539 let loss = {
529- let $t02513025297 = if (paymentInAmountAsset)
540+ let $t02559625763 = if (paymentInAmountAsset)
530541 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
531542 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
532- let amount = $t02513025297._1
533- let balance = $t02513025297._2
543+ let amount = $t02559625763._1
544+ let balance = $t02559625763._2
534545 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
535546 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
536547 }
537548 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
538549 }
539550 else throw("Strict value is not equal to itself.")
540551 }
541552
542553
543554 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
544555 let isEval = (txId == unit)
545556 let checks = [if ((paymentAssetId == cfgLpAssetId))
546557 then true
547558 else throwErr("invalid lp asset")]
548559 if ((checks == checks))
549560 then {
550561 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
551562 then true
552563 else if ((outAssetId == cfgPriceAssetId))
553564 then false
554565 else throwErr("invalid asset")
555566 let balanceBigInt = if (outInAmountAsset)
556567 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
557568 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
558569 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
559570 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
560571 let outBalance = if (outInAmountAsset)
561572 then amBalanceOld
562573 else prBalanceOld
563574 let outBalanceBigInt = toBigInt(outBalance)
564575 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
565576 let redeemedBigInt = toBigInt(paymentAmount)
566577 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
567- let $t02689926949 = takeFee(amountRaw)
568- let totalAmount = $t02689926949._1
569- let feeAmount = $t02689926949._2
570- let $t02695327179 = if (outInAmountAsset)
578+ let $t02736527415 = takeFee(amountRaw)
579+ let totalAmount = $t02736527415._1
580+ let feeAmount = $t02736527415._2
581+ let $t02741927645 = if (outInAmountAsset)
571582 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
572583 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
573- let outAmAmount = $t02695327179._1
574- let outPrAmount = $t02695327179._2
575- let amBalanceNew = $t02695327179._3
576- let prBalanceNew = $t02695327179._4
584+ let outAmAmount = $t02741927645._1
585+ let outPrAmount = $t02741927645._2
586+ let amBalanceNew = $t02741927645._3
587+ let prBalanceNew = $t02741927645._4
577588 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
578589 let priceNew = fromX18(priceNewX18, scale8)
579590 let commonState = if (isEval)
580591 then nil
581592 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)]
582593 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
583594 let priceOld = fromX18(priceOldX18, scale8)
584595 let loss = {
585596 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
586597 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
587598 }
588599 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
589600 }
590601 else throw("Strict value is not equal to itself.")
591602 }
592603
593604
594605 func managerPublicKeyOrUnit () = match getString(mpk()) {
595606 case s: String =>
596607 fromBase58String(s)
597608 case _: Unit =>
598609 unit
599610 case _ =>
600611 throw("Match error")
601612 }
602613
603614
604615 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
605616 case s: String =>
606617 fromBase58String(s)
607618 case _: Unit =>
608619 unit
609620 case _ =>
610621 throw("Match error")
611622 }
612623
613624
614625 func isManager (i) = match managerPublicKeyOrUnit() {
615626 case pk: ByteVector =>
616627 (i.callerPublicKey == pk)
617628 case _: Unit =>
618629 (i.caller == this)
619630 case _ =>
620631 throw("Match error")
621632 }
622633
623634
624635 func mustManager (i) = {
625636 let pd = throw("Permission denied")
626637 match managerPublicKeyOrUnit() {
627638 case pk: ByteVector =>
628639 if ((i.callerPublicKey == pk))
629640 then true
630641 else pd
631642 case _: Unit =>
632643 if ((i.caller == this))
633644 then true
634645 else pd
635646 case _ =>
636647 throw("Match error")
637648 }
638649 }
639650
640651
641652 @Callable(i)
642653 func setManager (pendingManagerPublicKey) = {
643654 let checkCaller = mustManager(i)
644655 if ((checkCaller == checkCaller))
645656 then {
646657 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
647658 if ((checkManagerPublicKey == checkManagerPublicKey))
648659 then [StringEntry(pmpk(), pendingManagerPublicKey)]
649660 else throw("Strict value is not equal to itself.")
650661 }
651662 else throw("Strict value is not equal to itself.")
652663 }
653664
654665
655666
656667 @Callable(i)
657668 func confirmManager () = {
658669 let pm = pendingManagerPublicKeyOrUnit()
659670 let hasPM = if (isDefined(pm))
660671 then true
661672 else throw("No pending manager")
662673 if ((hasPM == hasPM))
663674 then {
664675 let checkPM = if ((i.callerPublicKey == value(pm)))
665676 then true
666677 else throw("You are not pending manager")
667678 if ((checkPM == checkPM))
668679 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
669680 else throw("Strict value is not equal to itself.")
670681 }
671682 else throw("Strict value is not equal to itself.")
672683 }
673684
674685
675686
676687 @Callable(i)
677688 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
678689 then throw("Invalid slippageTolerance passed")
679690 else {
680691 let estPut = commonPut(i, slippageTolerance, true)
681692 let emitLpAmt = estPut._2
682693 let lpAssetId = estPut._7
683694 let state = estPut._9
684695 let amDiff = estPut._10
685696 let prDiff = estPut._11
686697 let amId = estPut._12
687698 let prId = estPut._13
688699 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
689700 if ((emitInv == emitInv))
690701 then {
691702 let emitInvLegacy = match emitInv {
692703 case legacyFactoryContract: Address =>
693704 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
694705 case _ =>
695706 unit
696707 }
697708 if ((emitInvLegacy == emitInvLegacy))
698709 then {
699710 let slippageAInv = if ((amDiff > 0))
700711 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
701712 else nil
702713 if ((slippageAInv == slippageAInv))
703714 then {
704715 let slippagePInv = if ((prDiff > 0))
705716 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
706717 else nil
707718 if ((slippagePInv == slippagePInv))
708719 then {
709720 let lpTransfer = if (shouldAutoStake)
710721 then {
711722 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
712723 if ((slpStakeInv == slpStakeInv))
713724 then nil
714725 else throw("Strict value is not equal to itself.")
715726 }
716727 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
717- let $t03113031195 = refreshKLpInternal(0, 0, 0)
718- let refreshKLpActions = $t03113031195._1
719- let updatedKLp = $t03113031195._2
720- ((state ++ lpTransfer) ++ refreshKLpActions)
728+ let $t03159631661 = refreshKLpInternal(0, 0, 0)
729+ let refreshKLpActions = $t03159631661._1
730+ let updatedKLp = $t03159631661._2
731+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
732+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
733+ then ((state ++ lpTransfer) ++ refreshKLpActions)
734+ else throw("Strict value is not equal to itself.")
721735 }
722736 else throw("Strict value is not equal to itself.")
723737 }
724738 else throw("Strict value is not equal to itself.")
725739 }
726740 else throw("Strict value is not equal to itself.")
727741 }
728742 else throw("Strict value is not equal to itself.")
729743 }
730744
731745
732746
733747 @Callable(i)
734748 func putForFree (maxSlippage) = if ((0 > maxSlippage))
735749 then throw("Invalid value passed")
736750 else {
737751 let estPut = commonPut(i, maxSlippage, false)
738752 let state = estPut._9
739- let $t03148131546 = refreshKLpInternal(0, 0, 0)
740- let refreshKLpActions = $t03148131546._1
741- let updatedKLp = $t03148131546._2
742- (state ++ refreshKLpActions)
753+ let $t03201032075 = refreshKLpInternal(0, 0, 0)
754+ let refreshKLpActions = $t03201032075._1
755+ let updatedKLp = $t03201032075._2
756+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
757+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
758+ then (state ++ refreshKLpActions)
759+ else throw("Strict value is not equal to itself.")
743760 }
744761
745762
746763
747764 @Callable(i)
748765 func putOneTkn (minOutAmount,autoStake) = {
749766 let isPoolOneTokenOperationsDisabled = {
750767 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
751768 if ($isInstanceOf(@, "Boolean"))
752769 then @
753770 else throw(($getType(@) + " couldn't be cast to Boolean"))
754771 }
755772 let isPutDisabled = if (if (if (isGlobalShutdown())
756773 then true
757774 else (cfgPoolStatus == PoolPutDisabled))
758775 then true
759776 else (cfgPoolStatus == PoolShutdown))
760777 then true
761778 else isPoolOneTokenOperationsDisabled
762779 let checks = [if (if (!(isPutDisabled))
763780 then true
764781 else isManager(i))
765782 then true
766783 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
767784 then true
768785 else throwErr("exactly 1 payment are expected")]
769786 if ((checks == checks))
770787 then {
771788 let payment = i.payments[0]
772789 let paymentAssetId = payment.assetId
773790 let paymentAmountRaw = payment.amount
774791 let userAddress = i.caller
775792 let txId = i.transactionId
776- let $t03232232474 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
777- if (($t03232232474 == $t03232232474))
793+ let $t03291333065 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
794+ if (($t03291333065 == $t03291333065))
778795 then {
779- let paymentInAmountAsset = $t03232232474._5
780- let bonus = $t03232232474._4
781- let feeAmount = $t03232232474._3
782- let commonState = $t03232232474._2
783- let emitAmountEstimated = $t03232232474._1
796+ let paymentInAmountAsset = $t03291333065._5
797+ let bonus = $t03291333065._4
798+ let feeAmount = $t03291333065._3
799+ let commonState = $t03291333065._2
800+ let emitAmountEstimated = $t03291333065._1
784801 let emitAmount = if (if ((minOutAmount > 0))
785802 then (minOutAmount > emitAmountEstimated)
786803 else false)
787804 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
788805 else emitAmountEstimated
789806 let emitInv = emit(emitAmount)
790807 if ((emitInv == emitInv))
791808 then {
792809 let lpTransfer = if (autoStake)
793810 then {
794811 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
795812 if ((stakeInv == stakeInv))
796813 then nil
797814 else throw("Strict value is not equal to itself.")
798815 }
799816 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
800817 let sendFee = if ((feeAmount > 0))
801818 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
802819 else nil
803- let $t03306033257 = if ((this == feeCollectorAddress))
820+ let $t03365133848 = if ((this == feeCollectorAddress))
804821 then $Tuple2(0, 0)
805822 else if (paymentInAmountAsset)
806823 then $Tuple2(-(feeAmount), 0)
807824 else $Tuple2(0, -(feeAmount))
808- let amountAssetBalanceDelta = $t03306033257._1
809- let priceAssetBalanceDelta = $t03306033257._2
810- let $t03326033368 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
811- let refreshKLpActions = $t03326033368._1
812- let updatedKLp = $t03326033368._2
813- $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
825+ let amountAssetBalanceDelta = $t03365133848._1
826+ let priceAssetBalanceDelta = $t03365133848._2
827+ let $t03385133959 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
828+ let refreshKLpActions = $t03385133959._1
829+ let updatedKLp = $t03385133959._2
830+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
831+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
832+ then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
833+ else throw("Strict value is not equal to itself.")
814834 }
815835 else throw("Strict value is not equal to itself.")
816836 }
817837 else throw("Strict value is not equal to itself.")
818838 }
819839 else throw("Strict value is not equal to itself.")
820840 }
821841
822842
823843
824844 @Callable(i)
825845 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
826- let $t03356133718 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
827- let emitAmountEstimated = $t03356133718._1
828- let commonState = $t03356133718._2
829- let feeAmount = $t03356133718._3
830- let bonus = $t03356133718._4
831- let paymentInAmountAsset = $t03356133718._5
846+ let $t03421334370 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
847+ let emitAmountEstimated = $t03421334370._1
848+ let commonState = $t03421334370._2
849+ let feeAmount = $t03421334370._3
850+ let bonus = $t03421334370._4
851+ let paymentInAmountAsset = $t03421334370._5
832852 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
833853 }
834854
835855
836856
837857 @Callable(i)
838858 func getOneTkn (outAssetIdStr,minOutAmount) = {
839859 let isPoolOneTokenOperationsDisabled = {
840860 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
841861 if ($isInstanceOf(@, "Boolean"))
842862 then @
843863 else throw(($getType(@) + " couldn't be cast to Boolean"))
844864 }
845865 let isGetDisabled = if (if (isGlobalShutdown())
846866 then true
847867 else (cfgPoolStatus == PoolShutdown))
848868 then true
849869 else isPoolOneTokenOperationsDisabled
850870 let checks = [if (if (!(isGetDisabled))
851871 then true
852872 else isManager(i))
853873 then true
854874 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
855875 then true
856876 else throwErr("exactly 1 payment are expected")]
857877 if ((checks == checks))
858878 then {
859879 let outAssetId = parseAssetId(outAssetIdStr)
860880 let payment = i.payments[0]
861881 let paymentAssetId = payment.assetId
862882 let paymentAmount = payment.amount
863883 let userAddress = i.caller
864884 let txId = i.transactionId
865- let $t03452334676 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
866- if (($t03452334676 == $t03452334676))
885+ let $t03517535328 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
886+ if (($t03517535328 == $t03517535328))
867887 then {
868- let outInAmountAsset = $t03452334676._5
869- let bonus = $t03452334676._4
870- let feeAmount = $t03452334676._3
871- let commonState = $t03452334676._2
872- let amountEstimated = $t03452334676._1
888+ let outInAmountAsset = $t03517535328._5
889+ let bonus = $t03517535328._4
890+ let feeAmount = $t03517535328._3
891+ let commonState = $t03517535328._2
892+ let amountEstimated = $t03517535328._1
873893 let amount = if (if ((minOutAmount > 0))
874894 then (minOutAmount > amountEstimated)
875895 else false)
876896 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
877897 else amountEstimated
878898 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
879899 if ((burnInv == burnInv))
880900 then {
881901 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
882902 let sendFee = if ((feeAmount > 0))
883903 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
884904 else nil
885- let $t03517635423 = {
905+ let $t03582836075 = {
886906 let feeAmountForCalc = if ((this == feeCollectorAddress))
887907 then 0
888908 else feeAmount
889909 if (outInAmountAsset)
890910 then $Tuple2(-((amount + feeAmountForCalc)), 0)
891911 else $Tuple2(0, -((amount + feeAmountForCalc)))
892912 }
893- let amountAssetBalanceDelta = $t03517635423._1
894- let priceAssetBalanceDelta = $t03517635423._2
895- let $t03542635534 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
896- let refreshKLpActions = $t03542635534._1
897- let updatedKLp = $t03542635534._2
898- $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
913+ let amountAssetBalanceDelta = $t03582836075._1
914+ let priceAssetBalanceDelta = $t03582836075._2
915+ let $t03607836186 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
916+ let refreshKLpActions = $t03607836186._1
917+ let updatedKLp = $t03607836186._2
918+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
919+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
920+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
921+ else throw("Strict value is not equal to itself.")
899922 }
900923 else throw("Strict value is not equal to itself.")
901924 }
902925 else throw("Strict value is not equal to itself.")
903926 }
904927 else throw("Strict value is not equal to itself.")
905928 }
906929
907930
908931
909932 @Callable(i)
910933 func getOneTknREADONLY (outAssetId,paymentAmount) = {
911- let $t03571835874 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
912- let amountEstimated = $t03571835874._1
913- let commonState = $t03571835874._2
914- let feeAmount = $t03571835874._3
915- let bonus = $t03571835874._4
916- let outInAmountAsset = $t03571835874._5
934+ let $t03643136587 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
935+ let amountEstimated = $t03643136587._1
936+ let commonState = $t03643136587._2
937+ let feeAmount = $t03643136587._3
938+ let bonus = $t03643136587._4
939+ let outInAmountAsset = $t03643136587._5
917940 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
918941 }
919942
920943
921944
922945 @Callable(i)
923946 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
924947 let isPoolOneTokenOperationsDisabled = {
925948 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
926949 if ($isInstanceOf(@, "Boolean"))
927950 then @
928951 else throw(($getType(@) + " couldn't be cast to Boolean"))
929952 }
930953 let isGetDisabled = if (if (isGlobalShutdown())
931954 then true
932955 else (cfgPoolStatus == PoolShutdown))
933956 then true
934957 else isPoolOneTokenOperationsDisabled
935958 let checks = [if (if (!(isGetDisabled))
936959 then true
937960 else isManager(i))
938961 then true
939962 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
940963 then true
941964 else throwErr("no payments are expected")]
942965 if ((checks == checks))
943966 then {
944967 let outAssetId = parseAssetId(outAssetIdStr)
945968 let userAddress = i.caller
946969 let txId = i.transactionId
947970 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
948971 if ((unstakeInv == unstakeInv))
949972 then {
950- let $t03669936850 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
951- if (($t03669936850 == $t03669936850))
973+ let $t03741237563 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
974+ if (($t03741237563 == $t03741237563))
952975 then {
953- let outInAmountAsset = $t03669936850._5
954- let bonus = $t03669936850._4
955- let feeAmount = $t03669936850._3
956- let commonState = $t03669936850._2
957- let amountEstimated = $t03669936850._1
976+ let outInAmountAsset = $t03741237563._5
977+ let bonus = $t03741237563._4
978+ let feeAmount = $t03741237563._3
979+ let commonState = $t03741237563._2
980+ let amountEstimated = $t03741237563._1
958981 let amount = if (if ((minOutAmount > 0))
959982 then (minOutAmount > amountEstimated)
960983 else false)
961984 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
962985 else amountEstimated
963986 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
964987 if ((burnInv == burnInv))
965988 then {
966989 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
967990 let sendFee = if ((feeAmount > 0))
968991 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
969992 else nil
970- let $t03734537592 = {
993+ let $t03805838305 = {
971994 let feeAmountForCalc = if ((this == feeCollectorAddress))
972995 then 0
973996 else feeAmount
974997 if (outInAmountAsset)
975998 then $Tuple2(-((amount + feeAmountForCalc)), 0)
976999 else $Tuple2(0, -((amount + feeAmountForCalc)))
9771000 }
978- let amountAssetBalanceDelta = $t03734537592._1
979- let priceAssetBalanceDelta = $t03734537592._2
980- let $t03759537703 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
981- let refreshKLpActions = $t03759537703._1
982- let updatedKLp = $t03759537703._2
983- $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1001+ let amountAssetBalanceDelta = $t03805838305._1
1002+ let priceAssetBalanceDelta = $t03805838305._2
1003+ let $t03830838416 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1004+ let refreshKLpActions = $t03830838416._1
1005+ let updatedKLp = $t03830838416._2
1006+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1007+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1008+ then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1009+ else throw("Strict value is not equal to itself.")
9841010 }
9851011 else throw("Strict value is not equal to itself.")
9861012 }
9871013 else throw("Strict value is not equal to itself.")
9881014 }
9891015 else throw("Strict value is not equal to itself.")
9901016 }
9911017 else throw("Strict value is not equal to itself.")
9921018 }
9931019
9941020
9951021
9961022 @Callable(i)
9971023 func get () = {
9981024 let res = commonGet(i)
9991025 let outAmtAmt = res._1
10001026 let outPrAmt = res._2
10011027 let pmtAmt = res._3
10021028 let pmtAssetId = res._4
10031029 let state = res._5
10041030 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10051031 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10061032 then {
1007- let $t03849538577 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1008- let refreshKLpActions = $t03849538577._1
1009- let updatedKLp = $t03849538577._2
1010- (state ++ refreshKLpActions)
1033+ let $t03926939351 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1034+ let refreshKLpActions = $t03926939351._1
1035+ let updatedKLp = $t03926939351._2
1036+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1037+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1038+ then (state ++ refreshKLpActions)
1039+ else throw("Strict value is not equal to itself.")
10111040 }
10121041 else throw("Strict value is not equal to itself.")
10131042 }
10141043
10151044
10161045
10171046 @Callable(i)
10181047 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
10191048 let res = commonGet(i)
10201049 let outAmAmt = res._1
10211050 let outPrAmt = res._2
10221051 let pmtAmt = res._3
10231052 let pmtAssetId = res._4
10241053 let state = res._5
10251054 if ((noLessThenAmtAsset > outAmAmt))
10261055 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
10271056 else if ((noLessThenPriceAsset > outPrAmt))
10281057 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
10291058 else {
10301059 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10311060 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10321061 then {
1033- let $t03937339454 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1034- let refreshKLpActions = $t03937339454._1
1035- let updatedKLp = $t03937339454._2
1036- (state ++ refreshKLpActions)
1062+ let $t04020840289 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1063+ let refreshKLpActions = $t04020840289._1
1064+ let updatedKLp = $t04020840289._2
1065+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1066+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1067+ then (state ++ refreshKLpActions)
1068+ else throw("Strict value is not equal to itself.")
10371069 }
10381070 else throw("Strict value is not equal to itself.")
10391071 }
10401072 }
10411073
10421074
10431075
10441076 @Callable(i)
10451077 func unstakeAndGet (amount) = {
10461078 let checkPayments = if ((size(i.payments) != 0))
10471079 then throw("No payments are expected")
10481080 else true
10491081 if ((checkPayments == checkPayments))
10501082 then {
10511083 let cfg = getPoolConfig()
10521084 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
10531085 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
10541086 if ((unstakeInv == unstakeInv))
10551087 then {
10561088 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
10571089 let outAmAmt = res._1
10581090 let outPrAmt = res._2
10591091 let poolStatus = parseIntValue(res._9)
10601092 let state = res._10
10611093 let checkPoolStatus = if (if (isGlobalShutdown())
10621094 then true
10631095 else (poolStatus == PoolShutdown))
10641096 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
10651097 else true
10661098 if ((checkPoolStatus == checkPoolStatus))
10671099 then {
10681100 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
10691101 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10701102 then {
1071- let $t04042740508 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1072- let refreshKLpActions = $t04042740508._1
1073- let updatedKLp = $t04042740508._2
1074- (state ++ refreshKLpActions)
1103+ let $t04132341404 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1104+ let refreshKLpActions = $t04132341404._1
1105+ let updatedKLp = $t04132341404._2
1106+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1107+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1108+ then (state ++ refreshKLpActions)
1109+ else throw("Strict value is not equal to itself.")
10751110 }
10761111 else throw("Strict value is not equal to itself.")
10771112 }
10781113 else throw("Strict value is not equal to itself.")
10791114 }
10801115 else throw("Strict value is not equal to itself.")
10811116 }
10821117 else throw("Strict value is not equal to itself.")
10831118 }
10841119
10851120
10861121
10871122 @Callable(i)
10881123 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
10891124 let isGetDisabled = if (isGlobalShutdown())
10901125 then true
10911126 else (cfgPoolStatus == PoolShutdown)
10921127 let checks = [if (!(isGetDisabled))
10931128 then true
10941129 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
10951130 then true
10961131 else throw("no payments are expected")]
10971132 if ((checks == checks))
10981133 then {
10991134 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11001135 if ((unstakeInv == unstakeInv))
11011136 then {
11021137 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11031138 let outAmAmt = res._1
11041139 let outPrAmt = res._2
11051140 let state = res._10
11061141 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11071142 then true
11081143 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11091144 then true
11101145 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11111146 if ((checkAmounts == checkAmounts))
11121147 then {
11131148 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11141149 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11151150 then {
1116- let $t04164841729 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1117- let refreshKLpActions = $t04164841729._1
1118- let updatedKLp = $t04164841729._2
1119- (state ++ refreshKLpActions)
1151+ let $t04260742688 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1152+ let refreshKLpActions = $t04260742688._1
1153+ let updatedKLp = $t04260742688._2
1154+ let isUpdatedKLpValid = validateUpdatedKLp(updatedKLp)
1155+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
1156+ then (state ++ refreshKLpActions)
1157+ else throw("Strict value is not equal to itself.")
11201158 }
11211159 else throw("Strict value is not equal to itself.")
11221160 }
11231161 else throw("Strict value is not equal to itself.")
11241162 }
11251163 else throw("Strict value is not equal to itself.")
11261164 }
11271165 else throw("Strict value is not equal to itself.")
11281166 }
11291167
11301168
11311169
11321170 @Callable(i)
11331171 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
11341172 then throw("permissions denied")
11351173 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
11361174
11371175
11381176
11391177 @Callable(i)
11401178 func refreshKLp () = {
11411179 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
11421180 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
11431181 then unit
11441182 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
11451183 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
11461184 then {
11471185 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1148- let $t04284342907 = refreshKLpInternal(0, 0, 0)
1149- let kLpUpdateActions = $t04284342907._1
1150- let updatedKLp = $t04284342907._2
1186+ let $t04386343927 = refreshKLpInternal(0, 0, 0)
1187+ let kLpUpdateActions = $t04386343927._1
1188+ let updatedKLp = $t04386343927._2
11511189 let actions = if ((kLp != updatedKLp))
11521190 then kLpUpdateActions
11531191 else throwErr("nothing to refresh")
11541192 $Tuple2(actions, toString(updatedKLp))
11551193 }
11561194 else throw("Strict value is not equal to itself.")
11571195 }
11581196
11591197
11601198
11611199 @Callable(i)
11621200 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
11631201
11641202
11651203
11661204 @Callable(i)
11671205 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
11681206
11691207
11701208
11711209 @Callable(i)
11721210 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
11731211 let prices = calcPrices(amAmt, prAmt, lpAmt)
11741212 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
11751213 }
11761214
11771215
11781216
11791217 @Callable(i)
11801218 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
11811219
11821220
11831221
11841222 @Callable(i)
11851223 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
11861224
11871225
11881226
11891227 @Callable(i)
11901228 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
11911229
11921230
11931231
11941232 @Callable(i)
11951233 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
11961234
11971235
11981236
11991237 @Callable(i)
12001238 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
12011239 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
12021240 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
12031241 }
12041242
12051243
12061244
12071245 @Callable(i)
12081246 func statsREADONLY () = {
12091247 let cfg = getPoolConfig()
12101248 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12111249 let amtAssetId = cfg[idxAmtAssetId]
12121250 let priceAssetId = cfg[idxPriceAssetId]
12131251 let iAmtAssetId = cfg[idxIAmtAssetId]
12141252 let iPriceAssetId = cfg[idxIPriceAssetId]
12151253 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12161254 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12171255 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12181256 let accAmtAssetBalance = getAccBalance(amtAssetId)
12191257 let accPriceAssetBalance = getAccBalance(priceAssetId)
12201258 let pricesList = if ((poolLPBalance == 0))
12211259 then [zeroBigInt, zeroBigInt, zeroBigInt]
12221260 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
12231261 let curPrice = 0
12241262 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
12251263 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
12261264 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
12271265 $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))
12281266 }
12291267
12301268
12311269
12321270 @Callable(i)
12331271 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
12341272 let cfg = getPoolConfig()
12351273 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12361274 let amAssetIdStr = cfg[idxAmtAssetId]
12371275 let amAssetId = fromBase58String(amAssetIdStr)
12381276 let prAssetIdStr = cfg[idxPriceAssetId]
12391277 let prAssetId = fromBase58String(prAssetIdStr)
12401278 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12411279 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12421280 let poolStatus = cfg[idxPoolStatus]
12431281 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12441282 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
12451283 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
12461284 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
12471285 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
12481286 let curPriceX18 = if ((poolLPBalance == 0))
12491287 then zeroBigInt
12501288 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
12511289 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
12521290 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
12531291 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
12541292 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
12551293 let calcLpAmt = estPut._1
12561294 let curPriceCalc = estPut._3
12571295 let amBalance = estPut._4
12581296 let prBalance = estPut._5
12591297 let lpEmission = estPut._6
12601298 $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))
12611299 }
12621300
12631301
12641302
12651303 @Callable(i)
12661304 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
12671305 let cfg = getPoolConfig()
12681306 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12691307 let amAssetIdStr = cfg[idxAmtAssetId]
12701308 let amAssetId = fromBase58String(amAssetIdStr)
12711309 let prAssetIdStr = cfg[idxPriceAssetId]
12721310 let prAssetId = fromBase58String(prAssetIdStr)
12731311 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12741312 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12751313 let poolStatus = cfg[idxPoolStatus]
12761314 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12771315 let amBalanceRaw = getAccBalance(amAssetIdStr)
12781316 let prBalanceRaw = getAccBalance(prAssetIdStr)
12791317 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
12801318 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
12811319 let curPriceX18 = if ((poolLPBalance == 0))
12821320 then zeroBigInt
12831321 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
12841322 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
12851323 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
12861324 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
12871325 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
12881326 let calcLpAmt = estPut._1
12891327 let curPriceCalc = estPut._3
12901328 let amBalance = estPut._4
12911329 let prBalance = estPut._5
12921330 let lpEmission = estPut._6
12931331 $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))
12941332 }
12951333
12961334
12971335
12981336 @Callable(i)
12991337 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
13001338 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
13011339 let outAmAmt = res._1
13021340 let outPrAmt = res._2
13031341 let amBalance = res._5
13041342 let prBalance = res._6
13051343 let lpEmission = res._7
13061344 let curPrice = res._8
13071345 let poolStatus = parseIntValue(res._9)
13081346 $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))
13091347 }
13101348
13111349
13121350 @Verifier(tx)
13131351 func verify () = {
13141352 let targetPublicKey = match managerPublicKeyOrUnit() {
13151353 case pk: ByteVector =>
13161354 pk
13171355 case _: Unit =>
13181356 tx.senderPublicKey
13191357 case _ =>
13201358 throw("Match error")
13211359 }
13221360 match tx {
13231361 case order: Order =>
13241362 let matcherPub = getMatcherPubOrFail()
13251363 let orderValid = validateMatcherOrderAllowed(order)
13261364 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
13271365 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
13281366 if (if (if (orderValid)
13291367 then senderValid
13301368 else false)
13311369 then matcherValid
13321370 else false)
13331371 then true
13341372 else throwOrderError(orderValid, senderValid, matcherValid)
13351373 case s: SetScriptTransaction =>
13361374 let newHash = blake2b256(value(s.script))
13371375 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
13381376 let currentHash = scriptHash(this)
13391377 if (if ((allowedHash == newHash))
13401378 then (currentHash != newHash)
13411379 else false)
13421380 then true
13431381 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13441382 case _ =>
13451383 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13461384 }
13471385 }
13481386

github/deemru/w8io/026f985 
148.08 ms