tx · AdNcEqQHT6rTT99qwHCPf2Udqc2feLMCUvmLXjtw7NCE

3MsXwm6KeMva32skLvFrFfYYmcxT2ZDc4fD:  -0.03500000 Waves

2022.12.07 18:22 [2350088] smart account 3MsXwm6KeMva32skLvFrFfYYmcxT2ZDc4fD > SELF 0.00000000 Waves

{ "type": 13, "id": "AdNcEqQHT6rTT99qwHCPf2Udqc2feLMCUvmLXjtw7NCE", "fee": 3500000, "feeAssetId": null, "timestamp": 1670426472782, "version": 1, "sender": "3MsXwm6KeMva32skLvFrFfYYmcxT2ZDc4fD", "senderPublicKey": "33aHdznSeq5cGxgbnLJ54tzNfiqS5SCQYHgFGMFsNQzs", "proofs": [ "2kWbp1Sz3bJkpVZ4bja9U54uMVE7Nt4AbxYq5fb2axxUnDbZVqJrkm9hyihaGZ5V3DvG8fmwv7YZsKFTBGTdymJ6" ], "script": "base64:BgKSLQgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlke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CQCdCAIFAmFKCQECYXcABAJnSAkA8QcBBQR0aGlzAwMJAAACBQJnRwUCZ0YJAQIhPQIFAmdIBQJnRgcGCQD0AwMIBQJnQglib2R5Qnl0ZXMJAJEDAggFAmdCBnByb29mcwAABQJnRAkA9AMDCAUCZ0IJYm9keUJ5dGVzCQCRAwIIBQJnQgZwcm9vZnMAAAUCZ0S3keiP", "chainId": 84, "height": 2350088, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7wQUk9yoCoz7zaUcyahc4omHUJNnvR9zi6eX1sPcYph3 Next: 9nHmDSn4h5ukBNcGSyAps7ViRMyn4uyoQJXB9ryNpoKg Diff:
OldNewDifferences
706706 let prId = estPut._13
707707 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
708708 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
709- let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
710- if ((currentKLp == currentKLp))
709+ let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt)
710+ if ((amountAssetBalance == amountAssetBalance))
711711 then {
712- let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
713- if ((emitInv == emitInv))
712+ let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt)
713+ if ((priceAssetBalance == priceAssetBalance))
714714 then {
715- let emitInvLegacy = match emitInv {
716- case legacyFactoryContract: Address =>
717- invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
718- case _ =>
719- unit
720- }
721- if ((emitInvLegacy == emitInvLegacy))
715+ let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity)
716+ if ((lpAssetEmission == lpAssetEmission))
722717 then {
723- let slippageAInv = if ((amDiff > 0))
724- then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
725- else nil
726- if ((slippageAInv == slippageAInv))
718+ let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
719+ if ((currentKLp == currentKLp))
727720 then {
728- let slippagePInv = if ((prDiff > 0))
729- then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
730- else nil
731- if ((slippagePInv == slippagePInv))
721+ let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
722+ if ((emitInv == emitInv))
732723 then {
733- let lpTransfer = if (shouldAutoStake)
724+ let emitInvLegacy = match emitInv {
725+ case legacyFactoryContract: Address =>
726+ invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
727+ case _ =>
728+ unit
729+ }
730+ if ((emitInvLegacy == emitInvLegacy))
734731 then {
735- let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
736- if ((slpStakeInv == slpStakeInv))
737- then nil
738- else throw("Strict value is not equal to itself.")
739- }
740- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
741- let $t03276433226 = refreshKLpInternal(0, 0, 0)
742- if (($t03276433226 == $t03276433226))
743- then {
744- let updatedKLp = $t03276433226._2
745- let refreshKLpActions = $t03276433226._1
746- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
747- if ((isUpdatedKLpValid == isUpdatedKLpValid))
748- then ((state ++ lpTransfer) ++ refreshKLpActions)
732+ let slippageAInv = if ((amDiff > 0))
733+ then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
734+ else nil
735+ if ((slippageAInv == slippageAInv))
736+ then {
737+ let slippagePInv = if ((prDiff > 0))
738+ then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
739+ else nil
740+ if ((slippagePInv == slippagePInv))
741+ then {
742+ let lpTransfer = if (shouldAutoStake)
743+ then {
744+ let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
745+ if ((slpStakeInv == slpStakeInv))
746+ then nil
747+ else throw("Strict value is not equal to itself.")
748+ }
749+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
750+ let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity
751+ if ((lpAssetEmissionAfter == lpAssetEmissionAfter))
752+ then {
753+ let $t03275632824 = refreshKLpInternal(0, 0, 0)
754+ if (($t03275632824 == $t03275632824))
755+ then {
756+ let updatedKLp = $t03275632824._2
757+ let refreshKLpActions = $t03275632824._1
758+ let error = throwErr(makeString([toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentKLp), toString(updatedKLp), toString(emitLpAmt), toString(amDiff), toString(prDiff), toString(lpAssetEmission), toString(lpAssetEmissionAfter)], " "))
759+ if ((error == error))
760+ then {
761+ let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
762+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
763+ then ((state ++ lpTransfer) ++ refreshKLpActions)
764+ else throw("Strict value is not equal to itself.")
765+ }
766+ else throw("Strict value is not equal to itself.")
767+ }
768+ else throw("Strict value is not equal to itself.")
769+ }
770+ else throw("Strict value is not equal to itself.")
771+ }
772+ else throw("Strict value is not equal to itself.")
773+ }
749774 else throw("Strict value is not equal to itself.")
750775 }
751776 else throw("Strict value is not equal to itself.")
774799 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
775800 if ((currentKLp == currentKLp))
776801 then {
777- let $t03378833853 = refreshKLpInternal(0, 0, 0)
778- let refreshKLpActions = $t03378833853._1
779- let updatedKLp = $t03378833853._2
802+ let $t03375633821 = refreshKLpInternal(0, 0, 0)
803+ let refreshKLpActions = $t03375633821._1
804+ let updatedKLp = $t03375633821._2
780805 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
781806 if ((isUpdatedKLpValid == isUpdatedKLpValid))
782807 then (state ++ refreshKLpActions)
821846 else throwErr("payment asset is not supported")
822847 let userAddress = i.caller
823848 let txId = i.transactionId
824- let $t03503835190 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
825- if (($t03503835190 == $t03503835190))
849+ let $t03500635158 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
850+ if (($t03500635158 == $t03500635158))
826851 then {
827- let paymentInAmountAsset = $t03503835190._5
828- let bonus = $t03503835190._4
829- let feeAmount = $t03503835190._3
830- let commonState = $t03503835190._2
831- let emitAmountEstimated = $t03503835190._1
852+ let paymentInAmountAsset = $t03500635158._5
853+ let bonus = $t03500635158._4
854+ let feeAmount = $t03500635158._3
855+ let commonState = $t03500635158._2
856+ let emitAmountEstimated = $t03500635158._1
832857 let emitAmount = if (if ((minOutAmount > 0))
833858 then (minOutAmount > emitAmountEstimated)
834859 else false)
848873 let sendFee = if ((feeAmount > 0))
849874 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
850875 else nil
851- let $t03577635973 = if ((this == feeCollectorAddress))
876+ let $t03574435941 = if ((this == feeCollectorAddress))
852877 then $Tuple2(0, 0)
853878 else if (paymentInAmountAsset)
854879 then $Tuple2(-(feeAmount), 0)
855880 else $Tuple2(0, -(feeAmount))
856- let amountAssetBalanceDelta = $t03577635973._1
857- let priceAssetBalanceDelta = $t03577635973._2
858- let $t03597636084 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
859- let refreshKLpActions = $t03597636084._1
860- let updatedKLp = $t03597636084._2
881+ let amountAssetBalanceDelta = $t03574435941._1
882+ let priceAssetBalanceDelta = $t03574435941._2
883+ let $t03594436052 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
884+ let refreshKLpActions = $t03594436052._1
885+ let updatedKLp = $t03594436052._2
861886 let kLp = value(getString(keyKLp))
862887 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
863888 if ((isUpdatedKLpValid == isUpdatedKLpValid))
875900
876901 @Callable(i)
877902 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
878- let $t03639036547 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
879- let emitAmountEstimated = $t03639036547._1
880- let commonState = $t03639036547._2
881- let feeAmount = $t03639036547._3
882- let bonus = $t03639036547._4
883- let paymentInAmountAsset = $t03639036547._5
903+ let $t03635836515 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
904+ let emitAmountEstimated = $t03635836515._1
905+ let commonState = $t03635836515._2
906+ let feeAmount = $t03635836515._3
907+ let bonus = $t03635836515._4
908+ let paymentInAmountAsset = $t03635836515._5
884909 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
885910 }
886911
915940 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
916941 let userAddress = i.caller
917942 let txId = i.transactionId
918- let $t03744137594 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
919- if (($t03744137594 == $t03744137594))
943+ let $t03740937562 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
944+ if (($t03740937562 == $t03740937562))
920945 then {
921- let outInAmountAsset = $t03744137594._5
922- let bonus = $t03744137594._4
923- let feeAmount = $t03744137594._3
924- let commonState = $t03744137594._2
925- let amountEstimated = $t03744137594._1
946+ let outInAmountAsset = $t03740937562._5
947+ let bonus = $t03740937562._4
948+ let feeAmount = $t03740937562._3
949+ let commonState = $t03740937562._2
950+ let amountEstimated = $t03740937562._1
926951 let amount = if (if ((minOutAmount > 0))
927952 then (minOutAmount > amountEstimated)
928953 else false)
935960 let sendFee = if ((feeAmount > 0))
936961 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
937962 else nil
938- let $t03809438341 = {
963+ let $t03806238309 = {
939964 let feeAmountForCalc = if ((this == feeCollectorAddress))
940965 then 0
941966 else feeAmount
943968 then $Tuple2(-((amount + feeAmountForCalc)), 0)
944969 else $Tuple2(0, -((amount + feeAmountForCalc)))
945970 }
946- let amountAssetBalanceDelta = $t03809438341._1
947- let priceAssetBalanceDelta = $t03809438341._2
948- let $t03834438452 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
949- let refreshKLpActions = $t03834438452._1
950- let updatedKLp = $t03834438452._2
971+ let amountAssetBalanceDelta = $t03806238309._1
972+ let priceAssetBalanceDelta = $t03806238309._2
973+ let $t03831238420 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
974+ let refreshKLpActions = $t03831238420._1
975+ let updatedKLp = $t03831238420._2
951976 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
952977 if ((isUpdatedKLpValid == isUpdatedKLpValid))
953978 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
964989
965990 @Callable(i)
966991 func getOneTknREADONLY (outAssetId,paymentAmount) = {
967- let $t03870938865 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
968- let amountEstimated = $t03870938865._1
969- let commonState = $t03870938865._2
970- let feeAmount = $t03870938865._3
971- let bonus = $t03870938865._4
972- let outInAmountAsset = $t03870938865._5
992+ let $t03867738833 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
993+ let amountEstimated = $t03867738833._1
994+ let commonState = $t03867738833._2
995+ let feeAmount = $t03867738833._3
996+ let bonus = $t03867738833._4
997+ let outInAmountAsset = $t03867738833._5
973998 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
974999 }
9751000
10041029 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10051030 if ((unstakeInv == unstakeInv))
10061031 then {
1007- let $t03976739918 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1008- if (($t03976739918 == $t03976739918))
1032+ let $t03973539886 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1033+ if (($t03973539886 == $t03973539886))
10091034 then {
1010- let outInAmountAsset = $t03976739918._5
1011- let bonus = $t03976739918._4
1012- let feeAmount = $t03976739918._3
1013- let commonState = $t03976739918._2
1014- let amountEstimated = $t03976739918._1
1035+ let outInAmountAsset = $t03973539886._5
1036+ let bonus = $t03973539886._4
1037+ let feeAmount = $t03973539886._3
1038+ let commonState = $t03973539886._2
1039+ let amountEstimated = $t03973539886._1
10151040 let amount = if (if ((minOutAmount > 0))
10161041 then (minOutAmount > amountEstimated)
10171042 else false)
10241049 let sendFee = if ((feeAmount > 0))
10251050 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10261051 else nil
1027- let $t04041340660 = {
1052+ let $t04038140628 = {
10281053 let feeAmountForCalc = if ((this == feeCollectorAddress))
10291054 then 0
10301055 else feeAmount
10321057 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10331058 else $Tuple2(0, -((amount + feeAmountForCalc)))
10341059 }
1035- let amountAssetBalanceDelta = $t04041340660._1
1036- let priceAssetBalanceDelta = $t04041340660._2
1037- let $t04066340771 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1038- let refreshKLpActions = $t04066340771._1
1039- let updatedKLp = $t04066340771._2
1060+ let amountAssetBalanceDelta = $t04038140628._1
1061+ let priceAssetBalanceDelta = $t04038140628._2
1062+ let $t04063140739 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1063+ let refreshKLpActions = $t04063140739._1
1064+ let updatedKLp = $t04063140739._2
10401065 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10411066 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10421067 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10651090 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10661091 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10671092 then {
1068- let $t04171941801 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1069- let refreshKLpActions = $t04171941801._1
1070- let updatedKLp = $t04171941801._2
1093+ let $t04168741769 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1094+ let refreshKLpActions = $t04168741769._1
1095+ let updatedKLp = $t04168741769._2
10711096 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10721097 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10731098 then (state ++ refreshKLpActions)
10951120 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10961121 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10971122 then {
1098- let $t04275242833 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1099- let refreshKLpActions = $t04275242833._1
1100- let updatedKLp = $t04275242833._2
1123+ let $t04272042801 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1124+ let refreshKLpActions = $t04272042801._1
1125+ let updatedKLp = $t04272042801._2
11011126 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11021127 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11031128 then (state ++ refreshKLpActions)
11371162 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11381163 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11391164 then {
1140- let $t04395644037 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1141- let refreshKLpActions = $t04395644037._1
1142- let updatedKLp = $t04395644037._2
1165+ let $t04392444005 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1166+ let refreshKLpActions = $t04392444005._1
1167+ let updatedKLp = $t04392444005._2
11431168 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11441169 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11451170 then (state ++ refreshKLpActions)
11861211 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11871212 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11881213 then {
1189- let $t04532945410 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1190- let refreshKLpActions = $t04532945410._1
1191- let updatedKLp = $t04532945410._2
1214+ let $t04529745378 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1215+ let refreshKLpActions = $t04529745378._1
1216+ let updatedKLp = $t04529745378._2
11921217 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11931218 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11941219 then (state ++ refreshKLpActions)
12211246 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12221247 then {
12231248 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1224- let $t04659746661 = refreshKLpInternal(0, 0, 0)
1225- let kLpUpdateActions = $t04659746661._1
1226- let updatedKLp = $t04659746661._2
1249+ let $t04656546629 = refreshKLpInternal(0, 0, 0)
1250+ let kLpUpdateActions = $t04656546629._1
1251+ let updatedKLp = $t04656546629._2
12271252 let actions = if ((kLp != updatedKLp))
12281253 then kLpUpdateActions
12291254 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 calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
237237
238238
239239 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
240240 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
241241 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
242242 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
243243 }
244244
245245
246246 func calcPrices (amAmt,prAmt,lpAmt) = {
247247 let cfg = getPoolConfig()
248248 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
249249 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
250250 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
251251 let amAmtX18 = toX18(amAmt, amtAssetDcm)
252252 let prAmtX18 = toX18(prAmt, priceAssetDcm)
253253 let lpAmtX18 = toX18(lpAmt, scale8)
254254 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
255255 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
256256 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
257257 }
258258
259259
260260 func calculatePrices (amAmt,prAmt,lpAmt) = {
261261 let prices = calcPrices(amAmt, prAmt, lpAmt)
262262 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
263263 }
264264
265265
266266 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
267267 let cfg = getPoolConfig()
268268 let lpAssetId = cfg[idxPoolLPAssetId]
269269 let amAssetId = cfg[idxAmtAssetId]
270270 let prAssetId = cfg[idxPriceAssetId]
271271 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
272272 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
273273 let poolStatus = cfg[idxPoolStatus]
274274 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
275275 if ((lpAssetId != pmtAssetId))
276276 then throw("Invalid asset passed.")
277277 else {
278278 let amBalance = getAccBalance(amAssetId)
279279 let amBalanceX18 = toX18(amBalance, amAssetDcm)
280280 let prBalance = getAccBalance(prAssetId)
281281 let prBalanceX18 = toX18(prBalance, prAssetDcm)
282282 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
283283 let curPrice = fromX18(curPriceX18, scale8)
284284 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
285285 let lpEmissionX18 = toX18(lpEmission, scale8)
286286 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
287287 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
288288 let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
289289 let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
290290 let state = if ((txId58 == ""))
291291 then nil
292292 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
293293 then unit
294294 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
295295 then unit
296296 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)]
297297 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
298298 }
299299 }
300300
301301
302302 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
303303 let cfg = getPoolConfig()
304304 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
305305 let amAssetIdStr = cfg[idxAmtAssetId]
306306 let prAssetIdStr = cfg[idxPriceAssetId]
307307 let iAmtAssetId = cfg[idxIAmtAssetId]
308308 let iPriceAssetId = cfg[idxIPriceAssetId]
309309 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
310310 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
311311 let poolStatus = cfg[idxPoolStatus]
312312 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
313313 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
314314 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
315315 if (if ((amAssetIdStr != inAmAssetIdStr))
316316 then true
317317 else (prAssetIdStr != inPrAssetIdStr))
318318 then throw("Invalid amt or price asset passed.")
319319 else {
320320 let amBalance = if (isEvaluate)
321321 then getAccBalance(amAssetIdStr)
322322 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
323323 let prBalance = if (isEvaluate)
324324 then getAccBalance(prAssetIdStr)
325325 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
326326 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
327327 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
328328 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
329329 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
330330 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
331331 let res = if ((lpEmission == 0))
332332 then {
333333 let curPriceX18 = zeroBigInt
334334 let slippageX18 = zeroBigInt
335335 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
336336 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
337337 }
338338 else {
339339 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
340340 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
341341 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
342342 if (if ((curPriceX18 != zeroBigInt))
343343 then (slippageX18 > slippageToleranceX18)
344344 else false)
345345 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
346346 else {
347347 let lpEmissionX18 = toX18(lpEmission, scale8)
348348 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
349349 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
350350 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
351351 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
352352 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
353353 let expAmtAssetAmtX18 = expectedAmts._1
354354 let expPriceAssetAmtX18 = expectedAmts._2
355355 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
356356 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
357357 }
358358 }
359359 let calcLpAmt = res._1
360360 let calcAmAssetPmt = res._2
361361 let calcPrAssetPmt = res._3
362362 let curPrice = fromX18(res._4, scale8)
363363 let slippageCalc = fromX18(res._5, scale8)
364364 if ((0 >= calcLpAmt))
365365 then throw("Invalid calculations. LP calculated is less than zero.")
366366 else {
367367 let emitLpAmt = if (!(emitLp))
368368 then 0
369369 else calcLpAmt
370370 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
371371 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
372372 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))]
373373 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
374374 }
375375 }
376376 }
377377
378378
379379 func calcKLp (amountBalance,priceBalance,lpEmission) = {
380380 let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
381381 if ((lpEmission == big0))
382382 then big0
383383 else updatedKLp
384384 }
385385
386386
387387 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
388388 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
389389 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
390390 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
391391 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
392392 currentKLp
393393 }
394394
395395
396396 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
397397 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
398398 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
399399 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
400400 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
401401 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
402402 $Tuple2(actions, updatedKLp)
403403 }
404404
405405
406406 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
407407 then true
408408 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
409409
410410
411411 func validateMatcherOrderAllowed (order) = {
412412 let amountAssetAmount = order.amount
413413 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
414414 let $t02061520827 = if ((order.orderType == Buy))
415415 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
416416 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
417417 let amountAssetBalanceDelta = $t02061520827._1
418418 let priceAssetBalanceDelta = $t02061520827._2
419419 if (if (if (isGlobalShutdown())
420420 then true
421421 else (cfgPoolStatus == PoolMatcherDisabled))
422422 then true
423423 else (cfgPoolStatus == PoolShutdown))
424424 then throw("Exchange operations disabled")
425425 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
426426 then true
427427 else (order.assetPair.priceAsset != cfgPriceAssetId))
428428 then throw("Wrong order assets.")
429429 else {
430430 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
431431 let $t02129821398 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
432432 let unusedActions = $t02129821398._1
433433 let kLpNew = $t02129821398._2
434434 let isOrderValid = (kLpNew >= kLp)
435435 isOrderValid
436436 }
437437 }
438438
439439
440440 func commonGet (i) = if ((size(i.payments) != 1))
441441 then throw("exactly 1 payment is expected")
442442 else {
443443 let pmt = value(i.payments[0])
444444 let pmtAssetId = value(pmt.assetId)
445445 let pmtAmt = pmt.amount
446446 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
447447 let outAmAmt = res._1
448448 let outPrAmt = res._2
449449 let poolStatus = parseIntValue(res._9)
450450 let state = res._10
451451 if (if (isGlobalShutdown())
452452 then true
453453 else (poolStatus == PoolShutdown))
454454 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
455455 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
456456 }
457457
458458
459459 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
460460 then throw("exactly 2 payments are expected")
461461 else {
462462 let amAssetPmt = value(i.payments[0])
463463 let prAssetPmt = value(i.payments[1])
464464 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
465465 let poolStatus = parseIntValue(estPut._8)
466466 if (if (if (isGlobalShutdown())
467467 then true
468468 else (poolStatus == PoolPutDisabled))
469469 then true
470470 else (poolStatus == PoolShutdown))
471471 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
472472 else estPut
473473 }
474474
475475
476476 func emit (amount) = {
477477 let emitInv = invoke(factoryContract, "emit", [amount], nil)
478478 if ((emitInv == emitInv))
479479 then {
480480 let emitInvLegacy = match emitInv {
481481 case legacyFactoryContract: Address =>
482482 invoke(legacyFactoryContract, "emit", [amount], nil)
483483 case _ =>
484484 unit
485485 }
486486 if ((emitInvLegacy == emitInvLegacy))
487487 then amount
488488 else throw("Strict value is not equal to itself.")
489489 }
490490 else throw("Strict value is not equal to itself.")
491491 }
492492
493493
494494 func takeFee (amount) = {
495495 let feeAmount = fraction(amount, fee, scale8)
496496 $Tuple2((amount - feeAmount), feeAmount)
497497 }
498498
499499
500500 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
501501 let isEval = (txId == unit)
502502 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
503503 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
504504 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
505505 then true
506506 else if ((paymentAssetId == cfgPriceAssetId))
507507 then false
508508 else throwErr("invalid asset")
509509 let $t02408324376 = if (isEval)
510510 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
511511 else if (paymentInAmountAsset)
512512 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
513513 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
514514 let amountBalanceOld = $t02408324376._1
515515 let priceBalanceOld = $t02408324376._2
516516 let $t02438024529 = if (paymentInAmountAsset)
517517 then $Tuple2(paymentAmountRaw, 0)
518518 else $Tuple2(0, paymentAmountRaw)
519519 let amountAssetAmountRaw = $t02438024529._1
520520 let priceAssetAmountRaw = $t02438024529._2
521521 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
522522 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
523523 let $t02465124710 = takeFee(paymentAmountRaw)
524524 let paymentAmount = $t02465124710._1
525525 let feeAmount = $t02465124710._2
526526 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
527527 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
528528 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
529529 let priceNew = fromX18(priceNewX18, scale8)
530530 let paymentBalance = if (paymentInAmountAsset)
531531 then amountBalanceOld
532532 else priceBalanceOld
533533 let paymentBalanceBigInt = toBigInt(paymentBalance)
534534 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
535535 let chechSupply = if ((supplyBigInt > big0))
536536 then true
537537 else throwErr("initial deposit requires all coins")
538538 if ((chechSupply == chechSupply))
539539 then {
540540 let depositBigInt = toBigInt(paymentAmount)
541541 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
542542 let commonState = if (isEval)
543543 then nil
544544 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))]
545545 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
546546 let priceOld = fromX18(priceOldX18, scale8)
547547 let loss = {
548548 let $t02618726354 = if (paymentInAmountAsset)
549549 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
550550 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
551551 let amount = $t02618726354._1
552552 let balance = $t02618726354._2
553553 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
554554 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
555555 }
556556 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
557557 }
558558 else throw("Strict value is not equal to itself.")
559559 }
560560
561561
562562 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
563563 let isEval = (txId == unit)
564564 let checks = [if ((paymentAssetId == cfgLpAssetId))
565565 then true
566566 else throwErr("invalid lp asset")]
567567 if ((checks == checks))
568568 then {
569569 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
570570 then true
571571 else if ((outAssetId == cfgPriceAssetId))
572572 then false
573573 else throwErr("invalid asset")
574574 let balanceBigInt = if (outInAmountAsset)
575575 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
576576 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
577577 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
578578 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
579579 let outBalance = if (outInAmountAsset)
580580 then amBalanceOld
581581 else prBalanceOld
582582 let outBalanceBigInt = toBigInt(outBalance)
583583 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
584584 let redeemedBigInt = toBigInt(paymentAmount)
585585 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
586586 let $t02795628006 = takeFee(amountRaw)
587587 let totalAmount = $t02795628006._1
588588 let feeAmount = $t02795628006._2
589589 let $t02801028236 = if (outInAmountAsset)
590590 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
591591 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
592592 let outAmAmount = $t02801028236._1
593593 let outPrAmount = $t02801028236._2
594594 let amBalanceNew = $t02801028236._3
595595 let prBalanceNew = $t02801028236._4
596596 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
597597 let priceNew = fromX18(priceNewX18, scale8)
598598 let commonState = if (isEval)
599599 then nil
600600 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)]
601601 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
602602 let priceOld = fromX18(priceOldX18, scale8)
603603 let loss = {
604604 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
605605 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
606606 }
607607 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
608608 }
609609 else throw("Strict value is not equal to itself.")
610610 }
611611
612612
613613 func managerPublicKeyOrUnit () = match getString(mpk()) {
614614 case s: String =>
615615 fromBase58String(s)
616616 case _: Unit =>
617617 unit
618618 case _ =>
619619 throw("Match error")
620620 }
621621
622622
623623 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
624624 case s: String =>
625625 fromBase58String(s)
626626 case _: Unit =>
627627 unit
628628 case _ =>
629629 throw("Match error")
630630 }
631631
632632
633633 func isManager (i) = match managerPublicKeyOrUnit() {
634634 case pk: ByteVector =>
635635 (i.callerPublicKey == pk)
636636 case _: Unit =>
637637 (i.caller == this)
638638 case _ =>
639639 throw("Match error")
640640 }
641641
642642
643643 func mustManager (i) = {
644644 let pd = throw("Permission denied")
645645 match managerPublicKeyOrUnit() {
646646 case pk: ByteVector =>
647647 if ((i.callerPublicKey == pk))
648648 then true
649649 else pd
650650 case _: Unit =>
651651 if ((i.caller == this))
652652 then true
653653 else pd
654654 case _ =>
655655 throw("Match error")
656656 }
657657 }
658658
659659
660660 @Callable(i)
661661 func setManager (pendingManagerPublicKey) = {
662662 let checkCaller = mustManager(i)
663663 if ((checkCaller == checkCaller))
664664 then {
665665 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
666666 if ((checkManagerPublicKey == checkManagerPublicKey))
667667 then [StringEntry(pmpk(), pendingManagerPublicKey)]
668668 else throw("Strict value is not equal to itself.")
669669 }
670670 else throw("Strict value is not equal to itself.")
671671 }
672672
673673
674674
675675 @Callable(i)
676676 func confirmManager () = {
677677 let pm = pendingManagerPublicKeyOrUnit()
678678 let hasPM = if (isDefined(pm))
679679 then true
680680 else throw("No pending manager")
681681 if ((hasPM == hasPM))
682682 then {
683683 let checkPM = if ((i.callerPublicKey == value(pm)))
684684 then true
685685 else throw("You are not pending manager")
686686 if ((checkPM == checkPM))
687687 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
688688 else throw("Strict value is not equal to itself.")
689689 }
690690 else throw("Strict value is not equal to itself.")
691691 }
692692
693693
694694
695695 @Callable(i)
696696 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
697697 then throw("Invalid slippageTolerance passed")
698698 else {
699699 let estPut = commonPut(i, slippageTolerance, true)
700700 let emitLpAmt = estPut._2
701701 let lpAssetId = estPut._7
702702 let state = estPut._9
703703 let amDiff = estPut._10
704704 let prDiff = estPut._11
705705 let amId = estPut._12
706706 let prId = estPut._13
707707 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
708708 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
709- let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
710- if ((currentKLp == currentKLp))
709+ let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt)
710+ if ((amountAssetBalance == amountAssetBalance))
711711 then {
712- let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
713- if ((emitInv == emitInv))
712+ let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt)
713+ if ((priceAssetBalance == priceAssetBalance))
714714 then {
715- let emitInvLegacy = match emitInv {
716- case legacyFactoryContract: Address =>
717- invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
718- case _ =>
719- unit
720- }
721- if ((emitInvLegacy == emitInvLegacy))
715+ let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity)
716+ if ((lpAssetEmission == lpAssetEmission))
722717 then {
723- let slippageAInv = if ((amDiff > 0))
724- then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
725- else nil
726- if ((slippageAInv == slippageAInv))
718+ let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
719+ if ((currentKLp == currentKLp))
727720 then {
728- let slippagePInv = if ((prDiff > 0))
729- then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
730- else nil
731- if ((slippagePInv == slippagePInv))
721+ let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
722+ if ((emitInv == emitInv))
732723 then {
733- let lpTransfer = if (shouldAutoStake)
724+ let emitInvLegacy = match emitInv {
725+ case legacyFactoryContract: Address =>
726+ invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
727+ case _ =>
728+ unit
729+ }
730+ if ((emitInvLegacy == emitInvLegacy))
734731 then {
735- let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
736- if ((slpStakeInv == slpStakeInv))
737- then nil
738- else throw("Strict value is not equal to itself.")
739- }
740- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
741- let $t03276433226 = refreshKLpInternal(0, 0, 0)
742- if (($t03276433226 == $t03276433226))
743- then {
744- let updatedKLp = $t03276433226._2
745- let refreshKLpActions = $t03276433226._1
746- let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
747- if ((isUpdatedKLpValid == isUpdatedKLpValid))
748- then ((state ++ lpTransfer) ++ refreshKLpActions)
732+ let slippageAInv = if ((amDiff > 0))
733+ then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
734+ else nil
735+ if ((slippageAInv == slippageAInv))
736+ then {
737+ let slippagePInv = if ((prDiff > 0))
738+ then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
739+ else nil
740+ if ((slippagePInv == slippagePInv))
741+ then {
742+ let lpTransfer = if (shouldAutoStake)
743+ then {
744+ let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
745+ if ((slpStakeInv == slpStakeInv))
746+ then nil
747+ else throw("Strict value is not equal to itself.")
748+ }
749+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
750+ let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity
751+ if ((lpAssetEmissionAfter == lpAssetEmissionAfter))
752+ then {
753+ let $t03275632824 = refreshKLpInternal(0, 0, 0)
754+ if (($t03275632824 == $t03275632824))
755+ then {
756+ let updatedKLp = $t03275632824._2
757+ let refreshKLpActions = $t03275632824._1
758+ let error = throwErr(makeString([toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentKLp), toString(updatedKLp), toString(emitLpAmt), toString(amDiff), toString(prDiff), toString(lpAssetEmission), toString(lpAssetEmissionAfter)], " "))
759+ if ((error == error))
760+ then {
761+ let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
762+ if ((isUpdatedKLpValid == isUpdatedKLpValid))
763+ then ((state ++ lpTransfer) ++ refreshKLpActions)
764+ else throw("Strict value is not equal to itself.")
765+ }
766+ else throw("Strict value is not equal to itself.")
767+ }
768+ else throw("Strict value is not equal to itself.")
769+ }
770+ else throw("Strict value is not equal to itself.")
771+ }
772+ else throw("Strict value is not equal to itself.")
773+ }
749774 else throw("Strict value is not equal to itself.")
750775 }
751776 else throw("Strict value is not equal to itself.")
752777 }
753778 else throw("Strict value is not equal to itself.")
754779 }
755780 else throw("Strict value is not equal to itself.")
756781 }
757782 else throw("Strict value is not equal to itself.")
758783 }
759784 else throw("Strict value is not equal to itself.")
760785 }
761786 else throw("Strict value is not equal to itself.")
762787 }
763788
764789
765790
766791 @Callable(i)
767792 func putForFree (maxSlippage) = if ((0 > maxSlippage))
768793 then throw("Invalid value passed")
769794 else {
770795 let estPut = commonPut(i, maxSlippage, false)
771796 let state = estPut._9
772797 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
773798 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
774799 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
775800 if ((currentKLp == currentKLp))
776801 then {
777- let $t03378833853 = refreshKLpInternal(0, 0, 0)
778- let refreshKLpActions = $t03378833853._1
779- let updatedKLp = $t03378833853._2
802+ let $t03375633821 = refreshKLpInternal(0, 0, 0)
803+ let refreshKLpActions = $t03375633821._1
804+ let updatedKLp = $t03375633821._2
780805 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
781806 if ((isUpdatedKLpValid == isUpdatedKLpValid))
782807 then (state ++ refreshKLpActions)
783808 else throw("Strict value is not equal to itself.")
784809 }
785810 else throw("Strict value is not equal to itself.")
786811 }
787812
788813
789814
790815 @Callable(i)
791816 func putOneTkn (minOutAmount,autoStake) = {
792817 let isPoolOneTokenOperationsDisabled = {
793818 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
794819 if ($isInstanceOf(@, "Boolean"))
795820 then @
796821 else throw(($getType(@) + " couldn't be cast to Boolean"))
797822 }
798823 let isPutDisabled = if (if (if (isGlobalShutdown())
799824 then true
800825 else (cfgPoolStatus == PoolPutDisabled))
801826 then true
802827 else (cfgPoolStatus == PoolShutdown))
803828 then true
804829 else isPoolOneTokenOperationsDisabled
805830 let checks = [if (if (!(isPutDisabled))
806831 then true
807832 else isManager(i))
808833 then true
809834 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
810835 then true
811836 else throwErr("exactly 1 payment are expected")]
812837 if ((checks == checks))
813838 then {
814839 let payment = i.payments[0]
815840 let paymentAssetId = payment.assetId
816841 let paymentAmountRaw = payment.amount
817842 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
818843 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
819844 else if ((paymentAssetId == cfgPriceAssetId))
820845 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
821846 else throwErr("payment asset is not supported")
822847 let userAddress = i.caller
823848 let txId = i.transactionId
824- let $t03503835190 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
825- if (($t03503835190 == $t03503835190))
849+ let $t03500635158 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
850+ if (($t03500635158 == $t03500635158))
826851 then {
827- let paymentInAmountAsset = $t03503835190._5
828- let bonus = $t03503835190._4
829- let feeAmount = $t03503835190._3
830- let commonState = $t03503835190._2
831- let emitAmountEstimated = $t03503835190._1
852+ let paymentInAmountAsset = $t03500635158._5
853+ let bonus = $t03500635158._4
854+ let feeAmount = $t03500635158._3
855+ let commonState = $t03500635158._2
856+ let emitAmountEstimated = $t03500635158._1
832857 let emitAmount = if (if ((minOutAmount > 0))
833858 then (minOutAmount > emitAmountEstimated)
834859 else false)
835860 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
836861 else emitAmountEstimated
837862 let emitInv = emit(emitAmount)
838863 if ((emitInv == emitInv))
839864 then {
840865 let lpTransfer = if (autoStake)
841866 then {
842867 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
843868 if ((stakeInv == stakeInv))
844869 then nil
845870 else throw("Strict value is not equal to itself.")
846871 }
847872 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
848873 let sendFee = if ((feeAmount > 0))
849874 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
850875 else nil
851- let $t03577635973 = if ((this == feeCollectorAddress))
876+ let $t03574435941 = if ((this == feeCollectorAddress))
852877 then $Tuple2(0, 0)
853878 else if (paymentInAmountAsset)
854879 then $Tuple2(-(feeAmount), 0)
855880 else $Tuple2(0, -(feeAmount))
856- let amountAssetBalanceDelta = $t03577635973._1
857- let priceAssetBalanceDelta = $t03577635973._2
858- let $t03597636084 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
859- let refreshKLpActions = $t03597636084._1
860- let updatedKLp = $t03597636084._2
881+ let amountAssetBalanceDelta = $t03574435941._1
882+ let priceAssetBalanceDelta = $t03574435941._2
883+ let $t03594436052 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
884+ let refreshKLpActions = $t03594436052._1
885+ let updatedKLp = $t03594436052._2
861886 let kLp = value(getString(keyKLp))
862887 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
863888 if ((isUpdatedKLpValid == isUpdatedKLpValid))
864889 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
865890 else throw("Strict value is not equal to itself.")
866891 }
867892 else throw("Strict value is not equal to itself.")
868893 }
869894 else throw("Strict value is not equal to itself.")
870895 }
871896 else throw("Strict value is not equal to itself.")
872897 }
873898
874899
875900
876901 @Callable(i)
877902 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
878- let $t03639036547 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
879- let emitAmountEstimated = $t03639036547._1
880- let commonState = $t03639036547._2
881- let feeAmount = $t03639036547._3
882- let bonus = $t03639036547._4
883- let paymentInAmountAsset = $t03639036547._5
903+ let $t03635836515 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
904+ let emitAmountEstimated = $t03635836515._1
905+ let commonState = $t03635836515._2
906+ let feeAmount = $t03635836515._3
907+ let bonus = $t03635836515._4
908+ let paymentInAmountAsset = $t03635836515._5
884909 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
885910 }
886911
887912
888913
889914 @Callable(i)
890915 func getOneTkn (outAssetIdStr,minOutAmount) = {
891916 let isPoolOneTokenOperationsDisabled = {
892917 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
893918 if ($isInstanceOf(@, "Boolean"))
894919 then @
895920 else throw(($getType(@) + " couldn't be cast to Boolean"))
896921 }
897922 let isGetDisabled = if (if (isGlobalShutdown())
898923 then true
899924 else (cfgPoolStatus == PoolShutdown))
900925 then true
901926 else isPoolOneTokenOperationsDisabled
902927 let checks = [if (if (!(isGetDisabled))
903928 then true
904929 else isManager(i))
905930 then true
906931 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
907932 then true
908933 else throwErr("exactly 1 payment are expected")]
909934 if ((checks == checks))
910935 then {
911936 let outAssetId = parseAssetId(outAssetIdStr)
912937 let payment = i.payments[0]
913938 let paymentAssetId = payment.assetId
914939 let paymentAmount = payment.amount
915940 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
916941 let userAddress = i.caller
917942 let txId = i.transactionId
918- let $t03744137594 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
919- if (($t03744137594 == $t03744137594))
943+ let $t03740937562 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
944+ if (($t03740937562 == $t03740937562))
920945 then {
921- let outInAmountAsset = $t03744137594._5
922- let bonus = $t03744137594._4
923- let feeAmount = $t03744137594._3
924- let commonState = $t03744137594._2
925- let amountEstimated = $t03744137594._1
946+ let outInAmountAsset = $t03740937562._5
947+ let bonus = $t03740937562._4
948+ let feeAmount = $t03740937562._3
949+ let commonState = $t03740937562._2
950+ let amountEstimated = $t03740937562._1
926951 let amount = if (if ((minOutAmount > 0))
927952 then (minOutAmount > amountEstimated)
928953 else false)
929954 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
930955 else amountEstimated
931956 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
932957 if ((burnInv == burnInv))
933958 then {
934959 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
935960 let sendFee = if ((feeAmount > 0))
936961 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
937962 else nil
938- let $t03809438341 = {
963+ let $t03806238309 = {
939964 let feeAmountForCalc = if ((this == feeCollectorAddress))
940965 then 0
941966 else feeAmount
942967 if (outInAmountAsset)
943968 then $Tuple2(-((amount + feeAmountForCalc)), 0)
944969 else $Tuple2(0, -((amount + feeAmountForCalc)))
945970 }
946- let amountAssetBalanceDelta = $t03809438341._1
947- let priceAssetBalanceDelta = $t03809438341._2
948- let $t03834438452 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
949- let refreshKLpActions = $t03834438452._1
950- let updatedKLp = $t03834438452._2
971+ let amountAssetBalanceDelta = $t03806238309._1
972+ let priceAssetBalanceDelta = $t03806238309._2
973+ let $t03831238420 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
974+ let refreshKLpActions = $t03831238420._1
975+ let updatedKLp = $t03831238420._2
951976 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
952977 if ((isUpdatedKLpValid == isUpdatedKLpValid))
953978 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
954979 else throw("Strict value is not equal to itself.")
955980 }
956981 else throw("Strict value is not equal to itself.")
957982 }
958983 else throw("Strict value is not equal to itself.")
959984 }
960985 else throw("Strict value is not equal to itself.")
961986 }
962987
963988
964989
965990 @Callable(i)
966991 func getOneTknREADONLY (outAssetId,paymentAmount) = {
967- let $t03870938865 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
968- let amountEstimated = $t03870938865._1
969- let commonState = $t03870938865._2
970- let feeAmount = $t03870938865._3
971- let bonus = $t03870938865._4
972- let outInAmountAsset = $t03870938865._5
992+ let $t03867738833 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
993+ let amountEstimated = $t03867738833._1
994+ let commonState = $t03867738833._2
995+ let feeAmount = $t03867738833._3
996+ let bonus = $t03867738833._4
997+ let outInAmountAsset = $t03867738833._5
973998 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
974999 }
9751000
9761001
9771002
9781003 @Callable(i)
9791004 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
9801005 let isPoolOneTokenOperationsDisabled = {
9811006 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
9821007 if ($isInstanceOf(@, "Boolean"))
9831008 then @
9841009 else throw(($getType(@) + " couldn't be cast to Boolean"))
9851010 }
9861011 let isGetDisabled = if (if (isGlobalShutdown())
9871012 then true
9881013 else (cfgPoolStatus == PoolShutdown))
9891014 then true
9901015 else isPoolOneTokenOperationsDisabled
9911016 let checks = [if (if (!(isGetDisabled))
9921017 then true
9931018 else isManager(i))
9941019 then true
9951020 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
9961021 then true
9971022 else throwErr("no payments are expected")]
9981023 if ((checks == checks))
9991024 then {
10001025 let outAssetId = parseAssetId(outAssetIdStr)
10011026 let userAddress = i.caller
10021027 let txId = i.transactionId
10031028 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
10041029 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10051030 if ((unstakeInv == unstakeInv))
10061031 then {
1007- let $t03976739918 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1008- if (($t03976739918 == $t03976739918))
1032+ let $t03973539886 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1033+ if (($t03973539886 == $t03973539886))
10091034 then {
1010- let outInAmountAsset = $t03976739918._5
1011- let bonus = $t03976739918._4
1012- let feeAmount = $t03976739918._3
1013- let commonState = $t03976739918._2
1014- let amountEstimated = $t03976739918._1
1035+ let outInAmountAsset = $t03973539886._5
1036+ let bonus = $t03973539886._4
1037+ let feeAmount = $t03973539886._3
1038+ let commonState = $t03973539886._2
1039+ let amountEstimated = $t03973539886._1
10151040 let amount = if (if ((minOutAmount > 0))
10161041 then (minOutAmount > amountEstimated)
10171042 else false)
10181043 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
10191044 else amountEstimated
10201045 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10211046 if ((burnInv == burnInv))
10221047 then {
10231048 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
10241049 let sendFee = if ((feeAmount > 0))
10251050 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10261051 else nil
1027- let $t04041340660 = {
1052+ let $t04038140628 = {
10281053 let feeAmountForCalc = if ((this == feeCollectorAddress))
10291054 then 0
10301055 else feeAmount
10311056 if (outInAmountAsset)
10321057 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10331058 else $Tuple2(0, -((amount + feeAmountForCalc)))
10341059 }
1035- let amountAssetBalanceDelta = $t04041340660._1
1036- let priceAssetBalanceDelta = $t04041340660._2
1037- let $t04066340771 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1038- let refreshKLpActions = $t04066340771._1
1039- let updatedKLp = $t04066340771._2
1060+ let amountAssetBalanceDelta = $t04038140628._1
1061+ let priceAssetBalanceDelta = $t04038140628._2
1062+ let $t04063140739 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1063+ let refreshKLpActions = $t04063140739._1
1064+ let updatedKLp = $t04063140739._2
10401065 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10411066 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10421067 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10431068 else throw("Strict value is not equal to itself.")
10441069 }
10451070 else throw("Strict value is not equal to itself.")
10461071 }
10471072 else throw("Strict value is not equal to itself.")
10481073 }
10491074 else throw("Strict value is not equal to itself.")
10501075 }
10511076 else throw("Strict value is not equal to itself.")
10521077 }
10531078
10541079
10551080
10561081 @Callable(i)
10571082 func get () = {
10581083 let res = commonGet(i)
10591084 let outAmtAmt = res._1
10601085 let outPrAmt = res._2
10611086 let pmtAmt = res._3
10621087 let pmtAssetId = res._4
10631088 let state = res._5
10641089 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10651090 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10661091 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10671092 then {
1068- let $t04171941801 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1069- let refreshKLpActions = $t04171941801._1
1070- let updatedKLp = $t04171941801._2
1093+ let $t04168741769 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1094+ let refreshKLpActions = $t04168741769._1
1095+ let updatedKLp = $t04168741769._2
10711096 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10721097 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10731098 then (state ++ refreshKLpActions)
10741099 else throw("Strict value is not equal to itself.")
10751100 }
10761101 else throw("Strict value is not equal to itself.")
10771102 }
10781103
10791104
10801105
10811106 @Callable(i)
10821107 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
10831108 let res = commonGet(i)
10841109 let outAmAmt = res._1
10851110 let outPrAmt = res._2
10861111 let pmtAmt = res._3
10871112 let pmtAssetId = res._4
10881113 let state = res._5
10891114 if ((noLessThenAmtAsset > outAmAmt))
10901115 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
10911116 else if ((noLessThenPriceAsset > outPrAmt))
10921117 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
10931118 else {
10941119 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10951120 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10961121 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10971122 then {
1098- let $t04275242833 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1099- let refreshKLpActions = $t04275242833._1
1100- let updatedKLp = $t04275242833._2
1123+ let $t04272042801 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1124+ let refreshKLpActions = $t04272042801._1
1125+ let updatedKLp = $t04272042801._2
11011126 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11021127 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11031128 then (state ++ refreshKLpActions)
11041129 else throw("Strict value is not equal to itself.")
11051130 }
11061131 else throw("Strict value is not equal to itself.")
11071132 }
11081133 }
11091134
11101135
11111136
11121137 @Callable(i)
11131138 func unstakeAndGet (amount) = {
11141139 let checkPayments = if ((size(i.payments) != 0))
11151140 then throw("No payments are expected")
11161141 else true
11171142 if ((checkPayments == checkPayments))
11181143 then {
11191144 let cfg = getPoolConfig()
11201145 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11211146 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11221147 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
11231148 if ((unstakeInv == unstakeInv))
11241149 then {
11251150 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
11261151 let outAmAmt = res._1
11271152 let outPrAmt = res._2
11281153 let poolStatus = parseIntValue(res._9)
11291154 let state = res._10
11301155 let checkPoolStatus = if (if (isGlobalShutdown())
11311156 then true
11321157 else (poolStatus == PoolShutdown))
11331158 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
11341159 else true
11351160 if ((checkPoolStatus == checkPoolStatus))
11361161 then {
11371162 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11381163 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11391164 then {
1140- let $t04395644037 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1141- let refreshKLpActions = $t04395644037._1
1142- let updatedKLp = $t04395644037._2
1165+ let $t04392444005 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1166+ let refreshKLpActions = $t04392444005._1
1167+ let updatedKLp = $t04392444005._2
11431168 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11441169 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11451170 then (state ++ refreshKLpActions)
11461171 else throw("Strict value is not equal to itself.")
11471172 }
11481173 else throw("Strict value is not equal to itself.")
11491174 }
11501175 else throw("Strict value is not equal to itself.")
11511176 }
11521177 else throw("Strict value is not equal to itself.")
11531178 }
11541179 else throw("Strict value is not equal to itself.")
11551180 }
11561181
11571182
11581183
11591184 @Callable(i)
11601185 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
11611186 let isGetDisabled = if (isGlobalShutdown())
11621187 then true
11631188 else (cfgPoolStatus == PoolShutdown)
11641189 let checks = [if (!(isGetDisabled))
11651190 then true
11661191 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11671192 then true
11681193 else throw("no payments are expected")]
11691194 if ((checks == checks))
11701195 then {
11711196 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11721197 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11731198 if ((unstakeInv == unstakeInv))
11741199 then {
11751200 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11761201 let outAmAmt = res._1
11771202 let outPrAmt = res._2
11781203 let state = res._10
11791204 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11801205 then true
11811206 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11821207 then true
11831208 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11841209 if ((checkAmounts == checkAmounts))
11851210 then {
11861211 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11871212 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11881213 then {
1189- let $t04532945410 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1190- let refreshKLpActions = $t04532945410._1
1191- let updatedKLp = $t04532945410._2
1214+ let $t04529745378 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1215+ let refreshKLpActions = $t04529745378._1
1216+ let updatedKLp = $t04529745378._2
11921217 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11931218 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11941219 then (state ++ refreshKLpActions)
11951220 else throw("Strict value is not equal to itself.")
11961221 }
11971222 else throw("Strict value is not equal to itself.")
11981223 }
11991224 else throw("Strict value is not equal to itself.")
12001225 }
12011226 else throw("Strict value is not equal to itself.")
12021227 }
12031228 else throw("Strict value is not equal to itself.")
12041229 }
12051230
12061231
12071232
12081233 @Callable(i)
12091234 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
12101235 then throw("permissions denied")
12111236 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
12121237
12131238
12141239
12151240 @Callable(i)
12161241 func refreshKLp () = {
12171242 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
12181243 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
12191244 then unit
12201245 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
12211246 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12221247 then {
12231248 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1224- let $t04659746661 = refreshKLpInternal(0, 0, 0)
1225- let kLpUpdateActions = $t04659746661._1
1226- let updatedKLp = $t04659746661._2
1249+ let $t04656546629 = refreshKLpInternal(0, 0, 0)
1250+ let kLpUpdateActions = $t04656546629._1
1251+ let updatedKLp = $t04656546629._2
12271252 let actions = if ((kLp != updatedKLp))
12281253 then kLpUpdateActions
12291254 else throwErr("nothing to refresh")
12301255 $Tuple2(actions, toString(updatedKLp))
12311256 }
12321257 else throw("Strict value is not equal to itself.")
12331258 }
12341259
12351260
12361261
12371262 @Callable(i)
12381263 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
12391264
12401265
12411266
12421267 @Callable(i)
12431268 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
12441269
12451270
12461271
12471272 @Callable(i)
12481273 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
12491274 let prices = calcPrices(amAmt, prAmt, lpAmt)
12501275 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
12511276 }
12521277
12531278
12541279
12551280 @Callable(i)
12561281 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
12571282
12581283
12591284
12601285 @Callable(i)
12611286 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
12621287
12631288
12641289
12651290 @Callable(i)
12661291 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
12671292
12681293
12691294
12701295 @Callable(i)
12711296 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
12721297
12731298
12741299
12751300 @Callable(i)
12761301 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
12771302 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
12781303 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
12791304 }
12801305
12811306
12821307
12831308 @Callable(i)
12841309 func statsREADONLY () = {
12851310 let cfg = getPoolConfig()
12861311 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12871312 let amtAssetId = cfg[idxAmtAssetId]
12881313 let priceAssetId = cfg[idxPriceAssetId]
12891314 let iAmtAssetId = cfg[idxIAmtAssetId]
12901315 let iPriceAssetId = cfg[idxIPriceAssetId]
12911316 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12921317 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12931318 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12941319 let accAmtAssetBalance = getAccBalance(amtAssetId)
12951320 let accPriceAssetBalance = getAccBalance(priceAssetId)
12961321 let pricesList = if ((poolLPBalance == 0))
12971322 then [zeroBigInt, zeroBigInt, zeroBigInt]
12981323 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
12991324 let curPrice = 0
13001325 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
13011326 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
13021327 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
13031328 $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))
13041329 }
13051330
13061331
13071332
13081333 @Callable(i)
13091334 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
13101335 let cfg = getPoolConfig()
13111336 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13121337 let amAssetIdStr = cfg[idxAmtAssetId]
13131338 let amAssetId = fromBase58String(amAssetIdStr)
13141339 let prAssetIdStr = cfg[idxPriceAssetId]
13151340 let prAssetId = fromBase58String(prAssetIdStr)
13161341 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13171342 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13181343 let poolStatus = cfg[idxPoolStatus]
13191344 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13201345 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
13211346 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
13221347 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
13231348 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
13241349 let curPriceX18 = if ((poolLPBalance == 0))
13251350 then zeroBigInt
13261351 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
13271352 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
13281353 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
13291354 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
13301355 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13311356 let calcLpAmt = estPut._1
13321357 let curPriceCalc = estPut._3
13331358 let amBalance = estPut._4
13341359 let prBalance = estPut._5
13351360 let lpEmission = estPut._6
13361361 $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))
13371362 }
13381363
13391364
13401365
13411366 @Callable(i)
13421367 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
13431368 let cfg = getPoolConfig()
13441369 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13451370 let amAssetIdStr = cfg[idxAmtAssetId]
13461371 let amAssetId = fromBase58String(amAssetIdStr)
13471372 let prAssetIdStr = cfg[idxPriceAssetId]
13481373 let prAssetId = fromBase58String(prAssetIdStr)
13491374 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13501375 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13511376 let poolStatus = cfg[idxPoolStatus]
13521377 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13531378 let amBalanceRaw = getAccBalance(amAssetIdStr)
13541379 let prBalanceRaw = getAccBalance(prAssetIdStr)
13551380 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
13561381 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
13571382 let curPriceX18 = if ((poolLPBalance == 0))
13581383 then zeroBigInt
13591384 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
13601385 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
13611386 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
13621387 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
13631388 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13641389 let calcLpAmt = estPut._1
13651390 let curPriceCalc = estPut._3
13661391 let amBalance = estPut._4
13671392 let prBalance = estPut._5
13681393 let lpEmission = estPut._6
13691394 $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))
13701395 }
13711396
13721397
13731398
13741399 @Callable(i)
13751400 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
13761401 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
13771402 let outAmAmt = res._1
13781403 let outPrAmt = res._2
13791404 let amBalance = res._5
13801405 let prBalance = res._6
13811406 let lpEmission = res._7
13821407 let curPrice = res._8
13831408 let poolStatus = parseIntValue(res._9)
13841409 $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))
13851410 }
13861411
13871412
13881413 @Verifier(tx)
13891414 func verify () = {
13901415 let targetPublicKey = match managerPublicKeyOrUnit() {
13911416 case pk: ByteVector =>
13921417 pk
13931418 case _: Unit =>
13941419 tx.senderPublicKey
13951420 case _ =>
13961421 throw("Match error")
13971422 }
13981423 match tx {
13991424 case order: Order =>
14001425 let matcherPub = getMatcherPubOrFail()
14011426 let orderValid = validateMatcherOrderAllowed(order)
14021427 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14031428 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
14041429 if (if (if (orderValid)
14051430 then senderValid
14061431 else false)
14071432 then matcherValid
14081433 else false)
14091434 then true
14101435 else throwOrderError(orderValid, senderValid, matcherValid)
14111436 case s: SetScriptTransaction =>
14121437 let newHash = blake2b256(value(s.script))
14131438 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
14141439 let currentHash = scriptHash(this)
14151440 if (if ((allowedHash == newHash))
14161441 then (currentHash != newHash)
14171442 else false)
14181443 then true
14191444 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14201445 case _ =>
14211446 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14221447 }
14231448 }
14241449

github/deemru/w8io/026f985 
198.85 ms