tx · 4BETGVJeAfDw5yAtfPGfVZwqn5aL92urexhXhYeYkQ6L

3MqjK2SfnefGxk4fiaeRHZaxg6wHAZ6tbd2:  -0.03400000 Waves

2022.12.07 11:01 [2349663] smart account 3MqjK2SfnefGxk4fiaeRHZaxg6wHAZ6tbd2 > SELF 0.00000000 Waves

{ "type": 13, "id": "4BETGVJeAfDw5yAtfPGfVZwqn5aL92urexhXhYeYkQ6L", "fee": 3400000, "feeAssetId": null, "timestamp": 1670400026274, "version": 1, "sender": "3MqjK2SfnefGxk4fiaeRHZaxg6wHAZ6tbd2", "senderPublicKey": "4eCcSEdDzsn3CVYwcVcGA3AbMH8prX8N1GVuLubC57iy", "proofs": [ "5GpS1af98PYUvjVR3thnw71qgPYqLggQKhYa5ytVhw8wnN69W95RSwzSuLQN4Ed4bynTVPxCwobgD7h7GpAB6yDm" ], "script": "base64:BgLYLAgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlkeExQQ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QgkBAiE9AgUCZ0QFAmdCBwYJAPQDAwgFAmd4CWJvZHlCeXRlcwkAkQMCCAUCZ3gGcHJvb2ZzAAAFAmd6CQD0AwMIBQJneAlib2R5Qnl0ZXMJAJEDAggFAmd4BnByb29mcwAABQJnei3cWnY=", "chainId": 84, "height": 2349663, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8zqUiu41fYVbWHhk1zRzPTKMKLtKbCNJEQ6VGfmdFN8W Next: CdRwfZBBYZyrNMmETPYheCmgfz25whpvBZisQih3Fs9F Diff:
OldNewDifferences
405405
406406 func validateMatcherOrderAllowed (order) = {
407407 let amountAssetAmount = order.amount
408- let priceAssetAmount = fraction(order.amount, order.price, scale8)
409- let $t02029520507 = if ((order.orderType == Buy))
408+ let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
409+ let $t02030220514 = if ((order.orderType == Buy))
410410 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
411411 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
412- let amountAssetBalanceDelta = $t02029520507._1
413- let priceAssetBalanceDelta = $t02029520507._2
412+ let amountAssetBalanceDelta = $t02030220514._1
413+ let priceAssetBalanceDelta = $t02030220514._2
414414 if (if (if (isGlobalShutdown())
415415 then true
416416 else (cfgPoolStatus == PoolMatcherDisabled))
423423 then throw("Wrong order assets.")
424424 else {
425425 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
426- let $t02097821078 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
427- let unusedActions = $t02097821078._1
428- let kLpNew = $t02097821078._2
426+ let $t02098521085 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
427+ let unusedActions = $t02098521085._1
428+ let kLpNew = $t02098521085._2
429429 let isOrderValid = (kLpNew >= kLp)
430430 isOrderValid
431431 }
501501 else if ((paymentAssetId == cfgPriceAssetId))
502502 then false
503503 else throwErr("invalid asset")
504- let $t02376324056 = if (isEval)
504+ let $t02377024063 = if (isEval)
505505 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
506506 else if (paymentInAmountAsset)
507507 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
508508 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
509- let amountBalanceOld = $t02376324056._1
510- let priceBalanceOld = $t02376324056._2
511- let $t02406024209 = if (paymentInAmountAsset)
509+ let amountBalanceOld = $t02377024063._1
510+ let priceBalanceOld = $t02377024063._2
511+ let $t02406724216 = if (paymentInAmountAsset)
512512 then $Tuple2(paymentAmountRaw, 0)
513513 else $Tuple2(0, paymentAmountRaw)
514- let amountAssetAmountRaw = $t02406024209._1
515- let priceAssetAmountRaw = $t02406024209._2
514+ let amountAssetAmountRaw = $t02406724216._1
515+ let priceAssetAmountRaw = $t02406724216._2
516516 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
517517 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
518- let $t02433124390 = takeFee(paymentAmountRaw)
519- let paymentAmount = $t02433124390._1
520- let feeAmount = $t02433124390._2
518+ let $t02433824397 = takeFee(paymentAmountRaw)
519+ let paymentAmount = $t02433824397._1
520+ let feeAmount = $t02433824397._2
521521 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
522522 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
523523 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
540540 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
541541 let priceOld = fromX18(priceOldX18, scale8)
542542 let loss = {
543- let $t02586726034 = if (paymentInAmountAsset)
543+ let $t02587426041 = if (paymentInAmountAsset)
544544 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
545545 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
546- let amount = $t02586726034._1
547- let balance = $t02586726034._2
546+ let amount = $t02587426041._1
547+ let balance = $t02587426041._2
548548 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
549549 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
550550 }
578578 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
579579 let redeemedBigInt = toBigInt(paymentAmount)
580580 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
581- let $t02763627686 = takeFee(amountRaw)
582- let totalAmount = $t02763627686._1
583- let feeAmount = $t02763627686._2
584- let $t02769027916 = if (outInAmountAsset)
581+ let $t02764327693 = takeFee(amountRaw)
582+ let totalAmount = $t02764327693._1
583+ let feeAmount = $t02764327693._2
584+ let $t02769727923 = if (outInAmountAsset)
585585 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
586586 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
587- let outAmAmount = $t02769027916._1
588- let outPrAmount = $t02769027916._2
589- let amBalanceNew = $t02769027916._3
590- let prBalanceNew = $t02769027916._4
587+ let outAmAmount = $t02769727923._1
588+ let outPrAmount = $t02769727923._2
589+ let amBalanceNew = $t02769727923._3
590+ let prBalanceNew = $t02769727923._4
591591 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
592592 let priceNew = fromX18(priceNewX18, scale8)
593593 let commonState = if (isEval)
733733 else throw("Strict value is not equal to itself.")
734734 }
735735 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
736- let $t03206832133 = refreshKLpInternal(0, 0, 0)
737- let refreshKLpActions = $t03206832133._1
738- let updatedKLp = $t03206832133._2
736+ let $t03207532140 = refreshKLpInternal(0, 0, 0)
737+ let refreshKLpActions = $t03207532140._1
738+ let updatedKLp = $t03207532140._2
739739 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
740740 if ((isUpdatedKLpValid == isUpdatedKLpValid))
741741 then ((state ++ lpTransfer) ++ refreshKLpActions)
765765 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
766766 if ((currentKLp == currentKLp))
767767 then {
768- let $t03269532760 = refreshKLpInternal(0, 0, 0)
769- let refreshKLpActions = $t03269532760._1
770- let updatedKLp = $t03269532760._2
768+ let $t03270232767 = refreshKLpInternal(0, 0, 0)
769+ let refreshKLpActions = $t03270232767._1
770+ let updatedKLp = $t03270232767._2
771771 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
772772 if ((isUpdatedKLpValid == isUpdatedKLpValid))
773773 then (state ++ refreshKLpActions)
812812 else throwErr("payment asset is not supported")
813813 let userAddress = i.caller
814814 let txId = i.transactionId
815- let $t03394534097 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
816- if (($t03394534097 == $t03394534097))
815+ let $t03395234104 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
816+ if (($t03395234104 == $t03395234104))
817817 then {
818- let paymentInAmountAsset = $t03394534097._5
819- let bonus = $t03394534097._4
820- let feeAmount = $t03394534097._3
821- let commonState = $t03394534097._2
822- let emitAmountEstimated = $t03394534097._1
818+ let paymentInAmountAsset = $t03395234104._5
819+ let bonus = $t03395234104._4
820+ let feeAmount = $t03395234104._3
821+ let commonState = $t03395234104._2
822+ let emitAmountEstimated = $t03395234104._1
823823 let emitAmount = if (if ((minOutAmount > 0))
824824 then (minOutAmount > emitAmountEstimated)
825825 else false)
839839 let sendFee = if ((feeAmount > 0))
840840 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
841841 else nil
842- let $t03468334880 = if ((this == feeCollectorAddress))
842+ let $t03469034887 = if ((this == feeCollectorAddress))
843843 then $Tuple2(0, 0)
844844 else if (paymentInAmountAsset)
845845 then $Tuple2(-(feeAmount), 0)
846846 else $Tuple2(0, -(feeAmount))
847- let amountAssetBalanceDelta = $t03468334880._1
848- let priceAssetBalanceDelta = $t03468334880._2
849- let $t03488334991 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
850- let refreshKLpActions = $t03488334991._1
851- let updatedKLp = $t03488334991._2
847+ let amountAssetBalanceDelta = $t03469034887._1
848+ let priceAssetBalanceDelta = $t03469034887._2
849+ let $t03489034998 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
850+ let refreshKLpActions = $t03489034998._1
851+ let updatedKLp = $t03489034998._2
852852 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
853853 if ((isUpdatedKLpValid == isUpdatedKLpValid))
854854 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
865865
866866 @Callable(i)
867867 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
868- let $t03525735414 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
869- let emitAmountEstimated = $t03525735414._1
870- let commonState = $t03525735414._2
871- let feeAmount = $t03525735414._3
872- let bonus = $t03525735414._4
873- let paymentInAmountAsset = $t03525735414._5
868+ let $t03526435421 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
869+ let emitAmountEstimated = $t03526435421._1
870+ let commonState = $t03526435421._2
871+ let feeAmount = $t03526435421._3
872+ let bonus = $t03526435421._4
873+ let paymentInAmountAsset = $t03526435421._5
874874 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
875875 }
876876
905905 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
906906 let userAddress = i.caller
907907 let txId = i.transactionId
908- let $t03630836461 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
909- if (($t03630836461 == $t03630836461))
908+ let $t03631536468 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
909+ if (($t03631536468 == $t03631536468))
910910 then {
911- let outInAmountAsset = $t03630836461._5
912- let bonus = $t03630836461._4
913- let feeAmount = $t03630836461._3
914- let commonState = $t03630836461._2
915- let amountEstimated = $t03630836461._1
911+ let outInAmountAsset = $t03631536468._5
912+ let bonus = $t03631536468._4
913+ let feeAmount = $t03631536468._3
914+ let commonState = $t03631536468._2
915+ let amountEstimated = $t03631536468._1
916916 let amount = if (if ((minOutAmount > 0))
917917 then (minOutAmount > amountEstimated)
918918 else false)
925925 let sendFee = if ((feeAmount > 0))
926926 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
927927 else nil
928- let $t03696137208 = {
928+ let $t03696837215 = {
929929 let feeAmountForCalc = if ((this == feeCollectorAddress))
930930 then 0
931931 else feeAmount
933933 then $Tuple2(-((amount + feeAmountForCalc)), 0)
934934 else $Tuple2(0, -((amount + feeAmountForCalc)))
935935 }
936- let amountAssetBalanceDelta = $t03696137208._1
937- let priceAssetBalanceDelta = $t03696137208._2
938- let $t03721137319 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
939- let refreshKLpActions = $t03721137319._1
940- let updatedKLp = $t03721137319._2
936+ let amountAssetBalanceDelta = $t03696837215._1
937+ let priceAssetBalanceDelta = $t03696837215._2
938+ let $t03721837326 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
939+ let refreshKLpActions = $t03721837326._1
940+ let updatedKLp = $t03721837326._2
941941 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
942942 if ((isUpdatedKLpValid == isUpdatedKLpValid))
943943 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
954954
955955 @Callable(i)
956956 func getOneTknREADONLY (outAssetId,paymentAmount) = {
957- let $t03757637732 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
958- let amountEstimated = $t03757637732._1
959- let commonState = $t03757637732._2
960- let feeAmount = $t03757637732._3
961- let bonus = $t03757637732._4
962- let outInAmountAsset = $t03757637732._5
957+ let $t03758337739 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
958+ let amountEstimated = $t03758337739._1
959+ let commonState = $t03758337739._2
960+ let feeAmount = $t03758337739._3
961+ let bonus = $t03758337739._4
962+ let outInAmountAsset = $t03758337739._5
963963 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
964964 }
965965
994994 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
995995 if ((unstakeInv == unstakeInv))
996996 then {
997- let $t03863438785 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
998- if (($t03863438785 == $t03863438785))
997+ let $t03864138792 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
998+ if (($t03864138792 == $t03864138792))
999999 then {
1000- let outInAmountAsset = $t03863438785._5
1001- let bonus = $t03863438785._4
1002- let feeAmount = $t03863438785._3
1003- let commonState = $t03863438785._2
1004- let amountEstimated = $t03863438785._1
1000+ let outInAmountAsset = $t03864138792._5
1001+ let bonus = $t03864138792._4
1002+ let feeAmount = $t03864138792._3
1003+ let commonState = $t03864138792._2
1004+ let amountEstimated = $t03864138792._1
10051005 let amount = if (if ((minOutAmount > 0))
10061006 then (minOutAmount > amountEstimated)
10071007 else false)
10141014 let sendFee = if ((feeAmount > 0))
10151015 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10161016 else nil
1017- let $t03928039527 = {
1017+ let $t03928739534 = {
10181018 let feeAmountForCalc = if ((this == feeCollectorAddress))
10191019 then 0
10201020 else feeAmount
10221022 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10231023 else $Tuple2(0, -((amount + feeAmountForCalc)))
10241024 }
1025- let amountAssetBalanceDelta = $t03928039527._1
1026- let priceAssetBalanceDelta = $t03928039527._2
1027- let $t03953039638 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1028- let refreshKLpActions = $t03953039638._1
1029- let updatedKLp = $t03953039638._2
1025+ let amountAssetBalanceDelta = $t03928739534._1
1026+ let priceAssetBalanceDelta = $t03928739534._2
1027+ let $t03953739645 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1028+ let refreshKLpActions = $t03953739645._1
1029+ let updatedKLp = $t03953739645._2
10301030 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10311031 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10321032 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10551055 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10561056 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10571057 then {
1058- let $t04058640668 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1059- let refreshKLpActions = $t04058640668._1
1060- let updatedKLp = $t04058640668._2
1058+ let $t04059340675 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1059+ let refreshKLpActions = $t04059340675._1
1060+ let updatedKLp = $t04059340675._2
10611061 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10621062 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10631063 then (state ++ refreshKLpActions)
10851085 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10861086 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10871087 then {
1088- let $t04161941700 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1089- let refreshKLpActions = $t04161941700._1
1090- let updatedKLp = $t04161941700._2
1088+ let $t04162641707 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1089+ let refreshKLpActions = $t04162641707._1
1090+ let updatedKLp = $t04162641707._2
10911091 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10921092 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10931093 then (state ++ refreshKLpActions)
11271127 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11281128 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11291129 then {
1130- let $t04282342904 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1131- let refreshKLpActions = $t04282342904._1
1132- let updatedKLp = $t04282342904._2
1130+ let $t04283042911 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1131+ let refreshKLpActions = $t04283042911._1
1132+ let updatedKLp = $t04283042911._2
11331133 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11341134 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11351135 then (state ++ refreshKLpActions)
11761176 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11771177 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11781178 then {
1179- let $t04419644277 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1180- let refreshKLpActions = $t04419644277._1
1181- let updatedKLp = $t04419644277._2
1179+ let $t04420344284 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1180+ let refreshKLpActions = $t04420344284._1
1181+ let updatedKLp = $t04420344284._2
11821182 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11831183 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11841184 then (state ++ refreshKLpActions)
12111211 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12121212 then {
12131213 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1214- let $t04546445528 = refreshKLpInternal(0, 0, 0)
1215- let kLpUpdateActions = $t04546445528._1
1216- let updatedKLp = $t04546445528._2
1214+ let $t04547145535 = refreshKLpInternal(0, 0, 0)
1215+ let kLpUpdateActions = $t04547145535._1
1216+ let updatedKLp = $t04547145535._2
12171217 let actions = if ((kLp != updatedKLp))
12181218 then kLpUpdateActions
12191219 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, 18, DOWN), big1, lpEmission)
378378 updatedKLp
379379 }
380380
381381
382382 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
383383 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
384384 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
385385 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
386386 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
387387 currentKLp
388388 }
389389
390390
391391 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
392392 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
393393 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
394394 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
395395 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
396396 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
397397 $Tuple2(actions, updatedKLp)
398398 }
399399
400400
401401 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
402402 then true
403403 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
404404
405405
406406 func validateMatcherOrderAllowed (order) = {
407407 let amountAssetAmount = order.amount
408- let priceAssetAmount = fraction(order.amount, order.price, scale8)
409- let $t02029520507 = if ((order.orderType == Buy))
408+ let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
409+ let $t02030220514 = if ((order.orderType == Buy))
410410 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
411411 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
412- let amountAssetBalanceDelta = $t02029520507._1
413- let priceAssetBalanceDelta = $t02029520507._2
412+ let amountAssetBalanceDelta = $t02030220514._1
413+ let priceAssetBalanceDelta = $t02030220514._2
414414 if (if (if (isGlobalShutdown())
415415 then true
416416 else (cfgPoolStatus == PoolMatcherDisabled))
417417 then true
418418 else (cfgPoolStatus == PoolShutdown))
419419 then throw("Exchange operations disabled")
420420 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
421421 then true
422422 else (order.assetPair.priceAsset != cfgPriceAssetId))
423423 then throw("Wrong order assets.")
424424 else {
425425 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
426- let $t02097821078 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
427- let unusedActions = $t02097821078._1
428- let kLpNew = $t02097821078._2
426+ let $t02098521085 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
427+ let unusedActions = $t02098521085._1
428+ let kLpNew = $t02098521085._2
429429 let isOrderValid = (kLpNew >= kLp)
430430 isOrderValid
431431 }
432432 }
433433
434434
435435 func commonGet (i) = if ((size(i.payments) != 1))
436436 then throw("exactly 1 payment is expected")
437437 else {
438438 let pmt = value(i.payments[0])
439439 let pmtAssetId = value(pmt.assetId)
440440 let pmtAmt = pmt.amount
441441 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
442442 let outAmAmt = res._1
443443 let outPrAmt = res._2
444444 let poolStatus = parseIntValue(res._9)
445445 let state = res._10
446446 if (if (isGlobalShutdown())
447447 then true
448448 else (poolStatus == PoolShutdown))
449449 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
450450 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
451451 }
452452
453453
454454 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
455455 then throw("exactly 2 payments are expected")
456456 else {
457457 let amAssetPmt = value(i.payments[0])
458458 let prAssetPmt = value(i.payments[1])
459459 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
460460 let poolStatus = parseIntValue(estPut._8)
461461 if (if (if (isGlobalShutdown())
462462 then true
463463 else (poolStatus == PoolPutDisabled))
464464 then true
465465 else (poolStatus == PoolShutdown))
466466 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
467467 else estPut
468468 }
469469
470470
471471 func emit (amount) = {
472472 let emitInv = invoke(factoryContract, "emit", [amount], nil)
473473 if ((emitInv == emitInv))
474474 then {
475475 let emitInvLegacy = match emitInv {
476476 case legacyFactoryContract: Address =>
477477 invoke(legacyFactoryContract, "emit", [amount], nil)
478478 case _ =>
479479 unit
480480 }
481481 if ((emitInvLegacy == emitInvLegacy))
482482 then amount
483483 else throw("Strict value is not equal to itself.")
484484 }
485485 else throw("Strict value is not equal to itself.")
486486 }
487487
488488
489489 func takeFee (amount) = {
490490 let feeAmount = fraction(amount, fee, scale8)
491491 $Tuple2((amount - feeAmount), feeAmount)
492492 }
493493
494494
495495 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
496496 let isEval = (txId == unit)
497497 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
498498 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
499499 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
500500 then true
501501 else if ((paymentAssetId == cfgPriceAssetId))
502502 then false
503503 else throwErr("invalid asset")
504- let $t02376324056 = if (isEval)
504+ let $t02377024063 = if (isEval)
505505 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
506506 else if (paymentInAmountAsset)
507507 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
508508 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
509- let amountBalanceOld = $t02376324056._1
510- let priceBalanceOld = $t02376324056._2
511- let $t02406024209 = if (paymentInAmountAsset)
509+ let amountBalanceOld = $t02377024063._1
510+ let priceBalanceOld = $t02377024063._2
511+ let $t02406724216 = if (paymentInAmountAsset)
512512 then $Tuple2(paymentAmountRaw, 0)
513513 else $Tuple2(0, paymentAmountRaw)
514- let amountAssetAmountRaw = $t02406024209._1
515- let priceAssetAmountRaw = $t02406024209._2
514+ let amountAssetAmountRaw = $t02406724216._1
515+ let priceAssetAmountRaw = $t02406724216._2
516516 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
517517 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
518- let $t02433124390 = takeFee(paymentAmountRaw)
519- let paymentAmount = $t02433124390._1
520- let feeAmount = $t02433124390._2
518+ let $t02433824397 = takeFee(paymentAmountRaw)
519+ let paymentAmount = $t02433824397._1
520+ let feeAmount = $t02433824397._2
521521 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
522522 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
523523 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
524524 let priceNew = fromX18(priceNewX18, scale8)
525525 let paymentBalance = if (paymentInAmountAsset)
526526 then amountBalanceOld
527527 else priceBalanceOld
528528 let paymentBalanceBigInt = toBigInt(paymentBalance)
529529 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
530530 let chechSupply = if ((supplyBigInt > big0))
531531 then true
532532 else throwErr("initial deposit requires all coins")
533533 if ((chechSupply == chechSupply))
534534 then {
535535 let depositBigInt = toBigInt(paymentAmount)
536536 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
537537 let commonState = if (isEval)
538538 then nil
539539 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))]
540540 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
541541 let priceOld = fromX18(priceOldX18, scale8)
542542 let loss = {
543- let $t02586726034 = if (paymentInAmountAsset)
543+ let $t02587426041 = if (paymentInAmountAsset)
544544 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
545545 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
546- let amount = $t02586726034._1
547- let balance = $t02586726034._2
546+ let amount = $t02587426041._1
547+ let balance = $t02587426041._2
548548 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
549549 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
550550 }
551551 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
552552 }
553553 else throw("Strict value is not equal to itself.")
554554 }
555555
556556
557557 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
558558 let isEval = (txId == unit)
559559 let checks = [if ((paymentAssetId == cfgLpAssetId))
560560 then true
561561 else throwErr("invalid lp asset")]
562562 if ((checks == checks))
563563 then {
564564 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
565565 then true
566566 else if ((outAssetId == cfgPriceAssetId))
567567 then false
568568 else throwErr("invalid asset")
569569 let balanceBigInt = if (outInAmountAsset)
570570 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
571571 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
572572 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
573573 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
574574 let outBalance = if (outInAmountAsset)
575575 then amBalanceOld
576576 else prBalanceOld
577577 let outBalanceBigInt = toBigInt(outBalance)
578578 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
579579 let redeemedBigInt = toBigInt(paymentAmount)
580580 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
581- let $t02763627686 = takeFee(amountRaw)
582- let totalAmount = $t02763627686._1
583- let feeAmount = $t02763627686._2
584- let $t02769027916 = if (outInAmountAsset)
581+ let $t02764327693 = takeFee(amountRaw)
582+ let totalAmount = $t02764327693._1
583+ let feeAmount = $t02764327693._2
584+ let $t02769727923 = if (outInAmountAsset)
585585 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
586586 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
587- let outAmAmount = $t02769027916._1
588- let outPrAmount = $t02769027916._2
589- let amBalanceNew = $t02769027916._3
590- let prBalanceNew = $t02769027916._4
587+ let outAmAmount = $t02769727923._1
588+ let outPrAmount = $t02769727923._2
589+ let amBalanceNew = $t02769727923._3
590+ let prBalanceNew = $t02769727923._4
591591 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
592592 let priceNew = fromX18(priceNewX18, scale8)
593593 let commonState = if (isEval)
594594 then nil
595595 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)]
596596 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
597597 let priceOld = fromX18(priceOldX18, scale8)
598598 let loss = {
599599 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
600600 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
601601 }
602602 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
603603 }
604604 else throw("Strict value is not equal to itself.")
605605 }
606606
607607
608608 func managerPublicKeyOrUnit () = match getString(mpk()) {
609609 case s: String =>
610610 fromBase58String(s)
611611 case _: Unit =>
612612 unit
613613 case _ =>
614614 throw("Match error")
615615 }
616616
617617
618618 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
619619 case s: String =>
620620 fromBase58String(s)
621621 case _: Unit =>
622622 unit
623623 case _ =>
624624 throw("Match error")
625625 }
626626
627627
628628 func isManager (i) = match managerPublicKeyOrUnit() {
629629 case pk: ByteVector =>
630630 (i.callerPublicKey == pk)
631631 case _: Unit =>
632632 (i.caller == this)
633633 case _ =>
634634 throw("Match error")
635635 }
636636
637637
638638 func mustManager (i) = {
639639 let pd = throw("Permission denied")
640640 match managerPublicKeyOrUnit() {
641641 case pk: ByteVector =>
642642 if ((i.callerPublicKey == pk))
643643 then true
644644 else pd
645645 case _: Unit =>
646646 if ((i.caller == this))
647647 then true
648648 else pd
649649 case _ =>
650650 throw("Match error")
651651 }
652652 }
653653
654654
655655 @Callable(i)
656656 func setManager (pendingManagerPublicKey) = {
657657 let checkCaller = mustManager(i)
658658 if ((checkCaller == checkCaller))
659659 then {
660660 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
661661 if ((checkManagerPublicKey == checkManagerPublicKey))
662662 then [StringEntry(pmpk(), pendingManagerPublicKey)]
663663 else throw("Strict value is not equal to itself.")
664664 }
665665 else throw("Strict value is not equal to itself.")
666666 }
667667
668668
669669
670670 @Callable(i)
671671 func confirmManager () = {
672672 let pm = pendingManagerPublicKeyOrUnit()
673673 let hasPM = if (isDefined(pm))
674674 then true
675675 else throw("No pending manager")
676676 if ((hasPM == hasPM))
677677 then {
678678 let checkPM = if ((i.callerPublicKey == value(pm)))
679679 then true
680680 else throw("You are not pending manager")
681681 if ((checkPM == checkPM))
682682 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
683683 else throw("Strict value is not equal to itself.")
684684 }
685685 else throw("Strict value is not equal to itself.")
686686 }
687687
688688
689689
690690 @Callable(i)
691691 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
692692 then throw("Invalid slippageTolerance passed")
693693 else {
694694 let estPut = commonPut(i, slippageTolerance, true)
695695 let emitLpAmt = estPut._2
696696 let lpAssetId = estPut._7
697697 let state = estPut._9
698698 let amDiff = estPut._10
699699 let prDiff = estPut._11
700700 let amId = estPut._12
701701 let prId = estPut._13
702702 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
703703 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
704704 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
705705 if ((currentKLp == currentKLp))
706706 then {
707707 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
708708 if ((emitInv == emitInv))
709709 then {
710710 let emitInvLegacy = match emitInv {
711711 case legacyFactoryContract: Address =>
712712 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
713713 case _ =>
714714 unit
715715 }
716716 if ((emitInvLegacy == emitInvLegacy))
717717 then {
718718 let slippageAInv = if ((amDiff > 0))
719719 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
720720 else nil
721721 if ((slippageAInv == slippageAInv))
722722 then {
723723 let slippagePInv = if ((prDiff > 0))
724724 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
725725 else nil
726726 if ((slippagePInv == slippagePInv))
727727 then {
728728 let lpTransfer = if (shouldAutoStake)
729729 then {
730730 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
731731 if ((slpStakeInv == slpStakeInv))
732732 then nil
733733 else throw("Strict value is not equal to itself.")
734734 }
735735 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
736- let $t03206832133 = refreshKLpInternal(0, 0, 0)
737- let refreshKLpActions = $t03206832133._1
738- let updatedKLp = $t03206832133._2
736+ let $t03207532140 = refreshKLpInternal(0, 0, 0)
737+ let refreshKLpActions = $t03207532140._1
738+ let updatedKLp = $t03207532140._2
739739 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
740740 if ((isUpdatedKLpValid == isUpdatedKLpValid))
741741 then ((state ++ lpTransfer) ++ refreshKLpActions)
742742 else throw("Strict value is not equal to itself.")
743743 }
744744 else throw("Strict value is not equal to itself.")
745745 }
746746 else throw("Strict value is not equal to itself.")
747747 }
748748 else throw("Strict value is not equal to itself.")
749749 }
750750 else throw("Strict value is not equal to itself.")
751751 }
752752 else throw("Strict value is not equal to itself.")
753753 }
754754
755755
756756
757757 @Callable(i)
758758 func putForFree (maxSlippage) = if ((0 > maxSlippage))
759759 then throw("Invalid value passed")
760760 else {
761761 let estPut = commonPut(i, maxSlippage, false)
762762 let state = estPut._9
763763 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
764764 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
765765 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
766766 if ((currentKLp == currentKLp))
767767 then {
768- let $t03269532760 = refreshKLpInternal(0, 0, 0)
769- let refreshKLpActions = $t03269532760._1
770- let updatedKLp = $t03269532760._2
768+ let $t03270232767 = refreshKLpInternal(0, 0, 0)
769+ let refreshKLpActions = $t03270232767._1
770+ let updatedKLp = $t03270232767._2
771771 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
772772 if ((isUpdatedKLpValid == isUpdatedKLpValid))
773773 then (state ++ refreshKLpActions)
774774 else throw("Strict value is not equal to itself.")
775775 }
776776 else throw("Strict value is not equal to itself.")
777777 }
778778
779779
780780
781781 @Callable(i)
782782 func putOneTkn (minOutAmount,autoStake) = {
783783 let isPoolOneTokenOperationsDisabled = {
784784 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
785785 if ($isInstanceOf(@, "Boolean"))
786786 then @
787787 else throw(($getType(@) + " couldn't be cast to Boolean"))
788788 }
789789 let isPutDisabled = if (if (if (isGlobalShutdown())
790790 then true
791791 else (cfgPoolStatus == PoolPutDisabled))
792792 then true
793793 else (cfgPoolStatus == PoolShutdown))
794794 then true
795795 else isPoolOneTokenOperationsDisabled
796796 let checks = [if (if (!(isPutDisabled))
797797 then true
798798 else isManager(i))
799799 then true
800800 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
801801 then true
802802 else throwErr("exactly 1 payment are expected")]
803803 if ((checks == checks))
804804 then {
805805 let payment = i.payments[0]
806806 let paymentAssetId = payment.assetId
807807 let paymentAmountRaw = payment.amount
808808 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
809809 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
810810 else if ((paymentAssetId == cfgPriceAssetId))
811811 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
812812 else throwErr("payment asset is not supported")
813813 let userAddress = i.caller
814814 let txId = i.transactionId
815- let $t03394534097 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
816- if (($t03394534097 == $t03394534097))
815+ let $t03395234104 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
816+ if (($t03395234104 == $t03395234104))
817817 then {
818- let paymentInAmountAsset = $t03394534097._5
819- let bonus = $t03394534097._4
820- let feeAmount = $t03394534097._3
821- let commonState = $t03394534097._2
822- let emitAmountEstimated = $t03394534097._1
818+ let paymentInAmountAsset = $t03395234104._5
819+ let bonus = $t03395234104._4
820+ let feeAmount = $t03395234104._3
821+ let commonState = $t03395234104._2
822+ let emitAmountEstimated = $t03395234104._1
823823 let emitAmount = if (if ((minOutAmount > 0))
824824 then (minOutAmount > emitAmountEstimated)
825825 else false)
826826 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
827827 else emitAmountEstimated
828828 let emitInv = emit(emitAmount)
829829 if ((emitInv == emitInv))
830830 then {
831831 let lpTransfer = if (autoStake)
832832 then {
833833 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
834834 if ((stakeInv == stakeInv))
835835 then nil
836836 else throw("Strict value is not equal to itself.")
837837 }
838838 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
839839 let sendFee = if ((feeAmount > 0))
840840 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
841841 else nil
842- let $t03468334880 = if ((this == feeCollectorAddress))
842+ let $t03469034887 = if ((this == feeCollectorAddress))
843843 then $Tuple2(0, 0)
844844 else if (paymentInAmountAsset)
845845 then $Tuple2(-(feeAmount), 0)
846846 else $Tuple2(0, -(feeAmount))
847- let amountAssetBalanceDelta = $t03468334880._1
848- let priceAssetBalanceDelta = $t03468334880._2
849- let $t03488334991 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
850- let refreshKLpActions = $t03488334991._1
851- let updatedKLp = $t03488334991._2
847+ let amountAssetBalanceDelta = $t03469034887._1
848+ let priceAssetBalanceDelta = $t03469034887._2
849+ let $t03489034998 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
850+ let refreshKLpActions = $t03489034998._1
851+ let updatedKLp = $t03489034998._2
852852 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
853853 if ((isUpdatedKLpValid == isUpdatedKLpValid))
854854 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
855855 else throw("Strict value is not equal to itself.")
856856 }
857857 else throw("Strict value is not equal to itself.")
858858 }
859859 else throw("Strict value is not equal to itself.")
860860 }
861861 else throw("Strict value is not equal to itself.")
862862 }
863863
864864
865865
866866 @Callable(i)
867867 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
868- let $t03525735414 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
869- let emitAmountEstimated = $t03525735414._1
870- let commonState = $t03525735414._2
871- let feeAmount = $t03525735414._3
872- let bonus = $t03525735414._4
873- let paymentInAmountAsset = $t03525735414._5
868+ let $t03526435421 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
869+ let emitAmountEstimated = $t03526435421._1
870+ let commonState = $t03526435421._2
871+ let feeAmount = $t03526435421._3
872+ let bonus = $t03526435421._4
873+ let paymentInAmountAsset = $t03526435421._5
874874 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
875875 }
876876
877877
878878
879879 @Callable(i)
880880 func getOneTkn (outAssetIdStr,minOutAmount) = {
881881 let isPoolOneTokenOperationsDisabled = {
882882 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
883883 if ($isInstanceOf(@, "Boolean"))
884884 then @
885885 else throw(($getType(@) + " couldn't be cast to Boolean"))
886886 }
887887 let isGetDisabled = if (if (isGlobalShutdown())
888888 then true
889889 else (cfgPoolStatus == PoolShutdown))
890890 then true
891891 else isPoolOneTokenOperationsDisabled
892892 let checks = [if (if (!(isGetDisabled))
893893 then true
894894 else isManager(i))
895895 then true
896896 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
897897 then true
898898 else throwErr("exactly 1 payment are expected")]
899899 if ((checks == checks))
900900 then {
901901 let outAssetId = parseAssetId(outAssetIdStr)
902902 let payment = i.payments[0]
903903 let paymentAssetId = payment.assetId
904904 let paymentAmount = payment.amount
905905 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
906906 let userAddress = i.caller
907907 let txId = i.transactionId
908- let $t03630836461 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
909- if (($t03630836461 == $t03630836461))
908+ let $t03631536468 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
909+ if (($t03631536468 == $t03631536468))
910910 then {
911- let outInAmountAsset = $t03630836461._5
912- let bonus = $t03630836461._4
913- let feeAmount = $t03630836461._3
914- let commonState = $t03630836461._2
915- let amountEstimated = $t03630836461._1
911+ let outInAmountAsset = $t03631536468._5
912+ let bonus = $t03631536468._4
913+ let feeAmount = $t03631536468._3
914+ let commonState = $t03631536468._2
915+ let amountEstimated = $t03631536468._1
916916 let amount = if (if ((minOutAmount > 0))
917917 then (minOutAmount > amountEstimated)
918918 else false)
919919 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
920920 else amountEstimated
921921 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
922922 if ((burnInv == burnInv))
923923 then {
924924 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
925925 let sendFee = if ((feeAmount > 0))
926926 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
927927 else nil
928- let $t03696137208 = {
928+ let $t03696837215 = {
929929 let feeAmountForCalc = if ((this == feeCollectorAddress))
930930 then 0
931931 else feeAmount
932932 if (outInAmountAsset)
933933 then $Tuple2(-((amount + feeAmountForCalc)), 0)
934934 else $Tuple2(0, -((amount + feeAmountForCalc)))
935935 }
936- let amountAssetBalanceDelta = $t03696137208._1
937- let priceAssetBalanceDelta = $t03696137208._2
938- let $t03721137319 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
939- let refreshKLpActions = $t03721137319._1
940- let updatedKLp = $t03721137319._2
936+ let amountAssetBalanceDelta = $t03696837215._1
937+ let priceAssetBalanceDelta = $t03696837215._2
938+ let $t03721837326 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
939+ let refreshKLpActions = $t03721837326._1
940+ let updatedKLp = $t03721837326._2
941941 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
942942 if ((isUpdatedKLpValid == isUpdatedKLpValid))
943943 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
944944 else throw("Strict value is not equal to itself.")
945945 }
946946 else throw("Strict value is not equal to itself.")
947947 }
948948 else throw("Strict value is not equal to itself.")
949949 }
950950 else throw("Strict value is not equal to itself.")
951951 }
952952
953953
954954
955955 @Callable(i)
956956 func getOneTknREADONLY (outAssetId,paymentAmount) = {
957- let $t03757637732 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
958- let amountEstimated = $t03757637732._1
959- let commonState = $t03757637732._2
960- let feeAmount = $t03757637732._3
961- let bonus = $t03757637732._4
962- let outInAmountAsset = $t03757637732._5
957+ let $t03758337739 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
958+ let amountEstimated = $t03758337739._1
959+ let commonState = $t03758337739._2
960+ let feeAmount = $t03758337739._3
961+ let bonus = $t03758337739._4
962+ let outInAmountAsset = $t03758337739._5
963963 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
964964 }
965965
966966
967967
968968 @Callable(i)
969969 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
970970 let isPoolOneTokenOperationsDisabled = {
971971 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
972972 if ($isInstanceOf(@, "Boolean"))
973973 then @
974974 else throw(($getType(@) + " couldn't be cast to Boolean"))
975975 }
976976 let isGetDisabled = if (if (isGlobalShutdown())
977977 then true
978978 else (cfgPoolStatus == PoolShutdown))
979979 then true
980980 else isPoolOneTokenOperationsDisabled
981981 let checks = [if (if (!(isGetDisabled))
982982 then true
983983 else isManager(i))
984984 then true
985985 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
986986 then true
987987 else throwErr("no payments are expected")]
988988 if ((checks == checks))
989989 then {
990990 let outAssetId = parseAssetId(outAssetIdStr)
991991 let userAddress = i.caller
992992 let txId = i.transactionId
993993 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
994994 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
995995 if ((unstakeInv == unstakeInv))
996996 then {
997- let $t03863438785 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
998- if (($t03863438785 == $t03863438785))
997+ let $t03864138792 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
998+ if (($t03864138792 == $t03864138792))
999999 then {
1000- let outInAmountAsset = $t03863438785._5
1001- let bonus = $t03863438785._4
1002- let feeAmount = $t03863438785._3
1003- let commonState = $t03863438785._2
1004- let amountEstimated = $t03863438785._1
1000+ let outInAmountAsset = $t03864138792._5
1001+ let bonus = $t03864138792._4
1002+ let feeAmount = $t03864138792._3
1003+ let commonState = $t03864138792._2
1004+ let amountEstimated = $t03864138792._1
10051005 let amount = if (if ((minOutAmount > 0))
10061006 then (minOutAmount > amountEstimated)
10071007 else false)
10081008 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
10091009 else amountEstimated
10101010 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10111011 if ((burnInv == burnInv))
10121012 then {
10131013 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
10141014 let sendFee = if ((feeAmount > 0))
10151015 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10161016 else nil
1017- let $t03928039527 = {
1017+ let $t03928739534 = {
10181018 let feeAmountForCalc = if ((this == feeCollectorAddress))
10191019 then 0
10201020 else feeAmount
10211021 if (outInAmountAsset)
10221022 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10231023 else $Tuple2(0, -((amount + feeAmountForCalc)))
10241024 }
1025- let amountAssetBalanceDelta = $t03928039527._1
1026- let priceAssetBalanceDelta = $t03928039527._2
1027- let $t03953039638 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1028- let refreshKLpActions = $t03953039638._1
1029- let updatedKLp = $t03953039638._2
1025+ let amountAssetBalanceDelta = $t03928739534._1
1026+ let priceAssetBalanceDelta = $t03928739534._2
1027+ let $t03953739645 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1028+ let refreshKLpActions = $t03953739645._1
1029+ let updatedKLp = $t03953739645._2
10301030 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10311031 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10321032 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10331033 else throw("Strict value is not equal to itself.")
10341034 }
10351035 else throw("Strict value is not equal to itself.")
10361036 }
10371037 else throw("Strict value is not equal to itself.")
10381038 }
10391039 else throw("Strict value is not equal to itself.")
10401040 }
10411041 else throw("Strict value is not equal to itself.")
10421042 }
10431043
10441044
10451045
10461046 @Callable(i)
10471047 func get () = {
10481048 let res = commonGet(i)
10491049 let outAmtAmt = res._1
10501050 let outPrAmt = res._2
10511051 let pmtAmt = res._3
10521052 let pmtAssetId = res._4
10531053 let state = res._5
10541054 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10551055 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10561056 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10571057 then {
1058- let $t04058640668 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1059- let refreshKLpActions = $t04058640668._1
1060- let updatedKLp = $t04058640668._2
1058+ let $t04059340675 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1059+ let refreshKLpActions = $t04059340675._1
1060+ let updatedKLp = $t04059340675._2
10611061 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10621062 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10631063 then (state ++ refreshKLpActions)
10641064 else throw("Strict value is not equal to itself.")
10651065 }
10661066 else throw("Strict value is not equal to itself.")
10671067 }
10681068
10691069
10701070
10711071 @Callable(i)
10721072 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
10731073 let res = commonGet(i)
10741074 let outAmAmt = res._1
10751075 let outPrAmt = res._2
10761076 let pmtAmt = res._3
10771077 let pmtAssetId = res._4
10781078 let state = res._5
10791079 if ((noLessThenAmtAsset > outAmAmt))
10801080 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
10811081 else if ((noLessThenPriceAsset > outPrAmt))
10821082 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
10831083 else {
10841084 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10851085 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10861086 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10871087 then {
1088- let $t04161941700 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1089- let refreshKLpActions = $t04161941700._1
1090- let updatedKLp = $t04161941700._2
1088+ let $t04162641707 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1089+ let refreshKLpActions = $t04162641707._1
1090+ let updatedKLp = $t04162641707._2
10911091 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10921092 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10931093 then (state ++ refreshKLpActions)
10941094 else throw("Strict value is not equal to itself.")
10951095 }
10961096 else throw("Strict value is not equal to itself.")
10971097 }
10981098 }
10991099
11001100
11011101
11021102 @Callable(i)
11031103 func unstakeAndGet (amount) = {
11041104 let checkPayments = if ((size(i.payments) != 0))
11051105 then throw("No payments are expected")
11061106 else true
11071107 if ((checkPayments == checkPayments))
11081108 then {
11091109 let cfg = getPoolConfig()
11101110 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11111111 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11121112 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
11131113 if ((unstakeInv == unstakeInv))
11141114 then {
11151115 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
11161116 let outAmAmt = res._1
11171117 let outPrAmt = res._2
11181118 let poolStatus = parseIntValue(res._9)
11191119 let state = res._10
11201120 let checkPoolStatus = if (if (isGlobalShutdown())
11211121 then true
11221122 else (poolStatus == PoolShutdown))
11231123 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
11241124 else true
11251125 if ((checkPoolStatus == checkPoolStatus))
11261126 then {
11271127 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11281128 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11291129 then {
1130- let $t04282342904 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1131- let refreshKLpActions = $t04282342904._1
1132- let updatedKLp = $t04282342904._2
1130+ let $t04283042911 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1131+ let refreshKLpActions = $t04283042911._1
1132+ let updatedKLp = $t04283042911._2
11331133 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11341134 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11351135 then (state ++ refreshKLpActions)
11361136 else throw("Strict value is not equal to itself.")
11371137 }
11381138 else throw("Strict value is not equal to itself.")
11391139 }
11401140 else throw("Strict value is not equal to itself.")
11411141 }
11421142 else throw("Strict value is not equal to itself.")
11431143 }
11441144 else throw("Strict value is not equal to itself.")
11451145 }
11461146
11471147
11481148
11491149 @Callable(i)
11501150 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
11511151 let isGetDisabled = if (isGlobalShutdown())
11521152 then true
11531153 else (cfgPoolStatus == PoolShutdown)
11541154 let checks = [if (!(isGetDisabled))
11551155 then true
11561156 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11571157 then true
11581158 else throw("no payments are expected")]
11591159 if ((checks == checks))
11601160 then {
11611161 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11621162 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11631163 if ((unstakeInv == unstakeInv))
11641164 then {
11651165 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11661166 let outAmAmt = res._1
11671167 let outPrAmt = res._2
11681168 let state = res._10
11691169 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11701170 then true
11711171 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11721172 then true
11731173 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11741174 if ((checkAmounts == checkAmounts))
11751175 then {
11761176 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11771177 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11781178 then {
1179- let $t04419644277 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1180- let refreshKLpActions = $t04419644277._1
1181- let updatedKLp = $t04419644277._2
1179+ let $t04420344284 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1180+ let refreshKLpActions = $t04420344284._1
1181+ let updatedKLp = $t04420344284._2
11821182 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11831183 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11841184 then (state ++ refreshKLpActions)
11851185 else throw("Strict value is not equal to itself.")
11861186 }
11871187 else throw("Strict value is not equal to itself.")
11881188 }
11891189 else throw("Strict value is not equal to itself.")
11901190 }
11911191 else throw("Strict value is not equal to itself.")
11921192 }
11931193 else throw("Strict value is not equal to itself.")
11941194 }
11951195
11961196
11971197
11981198 @Callable(i)
11991199 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
12001200 then throw("permissions denied")
12011201 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
12021202
12031203
12041204
12051205 @Callable(i)
12061206 func refreshKLp () = {
12071207 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
12081208 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
12091209 then unit
12101210 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
12111211 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12121212 then {
12131213 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1214- let $t04546445528 = refreshKLpInternal(0, 0, 0)
1215- let kLpUpdateActions = $t04546445528._1
1216- let updatedKLp = $t04546445528._2
1214+ let $t04547145535 = refreshKLpInternal(0, 0, 0)
1215+ let kLpUpdateActions = $t04547145535._1
1216+ let updatedKLp = $t04547145535._2
12171217 let actions = if ((kLp != updatedKLp))
12181218 then kLpUpdateActions
12191219 else throwErr("nothing to refresh")
12201220 $Tuple2(actions, toString(updatedKLp))
12211221 }
12221222 else throw("Strict value is not equal to itself.")
12231223 }
12241224
12251225
12261226
12271227 @Callable(i)
12281228 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
12291229
12301230
12311231
12321232 @Callable(i)
12331233 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
12341234
12351235
12361236
12371237 @Callable(i)
12381238 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
12391239 let prices = calcPrices(amAmt, prAmt, lpAmt)
12401240 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
12411241 }
12421242
12431243
12441244
12451245 @Callable(i)
12461246 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
12471247
12481248
12491249
12501250 @Callable(i)
12511251 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
12521252
12531253
12541254
12551255 @Callable(i)
12561256 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
12571257
12581258
12591259
12601260 @Callable(i)
12611261 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
12621262
12631263
12641264
12651265 @Callable(i)
12661266 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
12671267 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
12681268 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
12691269 }
12701270
12711271
12721272
12731273 @Callable(i)
12741274 func statsREADONLY () = {
12751275 let cfg = getPoolConfig()
12761276 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12771277 let amtAssetId = cfg[idxAmtAssetId]
12781278 let priceAssetId = cfg[idxPriceAssetId]
12791279 let iAmtAssetId = cfg[idxIAmtAssetId]
12801280 let iPriceAssetId = cfg[idxIPriceAssetId]
12811281 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12821282 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12831283 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12841284 let accAmtAssetBalance = getAccBalance(amtAssetId)
12851285 let accPriceAssetBalance = getAccBalance(priceAssetId)
12861286 let pricesList = if ((poolLPBalance == 0))
12871287 then [zeroBigInt, zeroBigInt, zeroBigInt]
12881288 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
12891289 let curPrice = 0
12901290 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
12911291 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
12921292 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
12931293 $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))
12941294 }
12951295
12961296
12971297
12981298 @Callable(i)
12991299 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
13001300 let cfg = getPoolConfig()
13011301 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13021302 let amAssetIdStr = cfg[idxAmtAssetId]
13031303 let amAssetId = fromBase58String(amAssetIdStr)
13041304 let prAssetIdStr = cfg[idxPriceAssetId]
13051305 let prAssetId = fromBase58String(prAssetIdStr)
13061306 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13071307 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13081308 let poolStatus = cfg[idxPoolStatus]
13091309 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13101310 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
13111311 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
13121312 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
13131313 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
13141314 let curPriceX18 = if ((poolLPBalance == 0))
13151315 then zeroBigInt
13161316 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
13171317 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
13181318 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
13191319 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
13201320 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13211321 let calcLpAmt = estPut._1
13221322 let curPriceCalc = estPut._3
13231323 let amBalance = estPut._4
13241324 let prBalance = estPut._5
13251325 let lpEmission = estPut._6
13261326 $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))
13271327 }
13281328
13291329
13301330
13311331 @Callable(i)
13321332 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
13331333 let cfg = getPoolConfig()
13341334 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13351335 let amAssetIdStr = cfg[idxAmtAssetId]
13361336 let amAssetId = fromBase58String(amAssetIdStr)
13371337 let prAssetIdStr = cfg[idxPriceAssetId]
13381338 let prAssetId = fromBase58String(prAssetIdStr)
13391339 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13401340 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13411341 let poolStatus = cfg[idxPoolStatus]
13421342 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13431343 let amBalanceRaw = getAccBalance(amAssetIdStr)
13441344 let prBalanceRaw = getAccBalance(prAssetIdStr)
13451345 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
13461346 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
13471347 let curPriceX18 = if ((poolLPBalance == 0))
13481348 then zeroBigInt
13491349 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
13501350 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
13511351 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
13521352 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
13531353 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13541354 let calcLpAmt = estPut._1
13551355 let curPriceCalc = estPut._3
13561356 let amBalance = estPut._4
13571357 let prBalance = estPut._5
13581358 let lpEmission = estPut._6
13591359 $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))
13601360 }
13611361
13621362
13631363
13641364 @Callable(i)
13651365 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
13661366 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
13671367 let outAmAmt = res._1
13681368 let outPrAmt = res._2
13691369 let amBalance = res._5
13701370 let prBalance = res._6
13711371 let lpEmission = res._7
13721372 let curPrice = res._8
13731373 let poolStatus = parseIntValue(res._9)
13741374 $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))
13751375 }
13761376
13771377
13781378 @Verifier(tx)
13791379 func verify () = {
13801380 let targetPublicKey = match managerPublicKeyOrUnit() {
13811381 case pk: ByteVector =>
13821382 pk
13831383 case _: Unit =>
13841384 tx.senderPublicKey
13851385 case _ =>
13861386 throw("Match error")
13871387 }
13881388 match tx {
13891389 case order: Order =>
13901390 let matcherPub = getMatcherPubOrFail()
13911391 let orderValid = validateMatcherOrderAllowed(order)
13921392 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
13931393 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
13941394 if (if (if (orderValid)
13951395 then senderValid
13961396 else false)
13971397 then matcherValid
13981398 else false)
13991399 then true
14001400 else throwOrderError(orderValid, senderValid, matcherValid)
14011401 case s: SetScriptTransaction =>
14021402 let newHash = blake2b256(value(s.script))
14031403 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
14041404 let currentHash = scriptHash(this)
14051405 if (if ((allowedHash == newHash))
14061406 then (currentHash != newHash)
14071407 else false)
14081408 then true
14091409 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14101410 case _ =>
14111411 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14121412 }
14131413 }
14141414

github/deemru/w8io/026f985 
183.48 ms