tx · FKvPfQvQiY6qRZesJvxsxDwDQogHB9Ezh3omV24kuoC2

3N8cKL8uHT2sFedwsSdD7u7zFPD7iM2WSo4:  -0.03300000 Waves

2022.11.28 14:41 [2336904] smart account 3N8cKL8uHT2sFedwsSdD7u7zFPD7iM2WSo4 > SELF 0.00000000 Waves

{ "type": 13, "id": "FKvPfQvQiY6qRZesJvxsxDwDQogHB9Ezh3omV24kuoC2", "fee": 3300000, "feeAssetId": null, "timestamp": 1669635680556, "version": 1, "sender": "3N8cKL8uHT2sFedwsSdD7u7zFPD7iM2WSo4", "senderPublicKey": "5uqTFe1tdb9qAXgGRerTFeiZvA8oaXqKKAHGzaHKAnwu", "proofs": [ "3msHmzMLAmfB7jdookaHv5MssAWdaX7uS55Va5X14PtWjNLauTG4SDtZsazNNmH5RrNP9X5Cam5Uxm6rCeueCuLY" ], "script": "base64:BgKRLAgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlkeExQQXN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mNHAl83BAJjaAgFAmNHAl84BAJjYQkBDXBhcnNlSW50VmFsdWUBCAUCY0cCXzkJAJQKAgUDbmlsCQC5CQIJAMwIAgIOJWQlZCVkJWQlZCVkJWQJAMwIAgkApAMBBQJjbQkAzAgCCQCkAwEFAmNuCQDMCAIJAKQDAQUCY2MJAMwIAgkApAMBBQJjZQkAzAgCCQCkAwEFAmNiCQDMCAIJAKYDAQUCY2gJAMwIAgkApAMBBQJjYQUDbmlsBQFqAQJncgECZ3MABAJndAQCZHcJAQJlTQADCQABAgUCZHcCCkJ5dGVWZWN0b3IEAmVRBQJkdwUCZVEDCQABAgUCZHcCBFVuaXQIBQJncg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgQCZHcFAmdyAwkAAQIFAmR3AgVPcmRlcgQCY1gFAmR3BAJndQkBAmFNAAQCYXoJAQJjVwEFAmNYBAJhQQkA9AMDCAUCY1gJYm9keUJ5dGVzCQCRAwIIBQJjWAZwcm9vZnMAAAgFAmNYD3NlbmRlclB1YmxpY0tleQQCYUIJAPQDAwgFAmNYCWJvZHlCeXRlcwkAkQMCCAUCY1gGcHJvb2ZzAAEFAmd1AwMDBQJhegUCYUEHBQJhQgcGCQECYXkDBQJhegUCYUEFAmFCAwkAAQIFAmR3AhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCZU4FAmR3BAJndgkA9gMBCQEFdmFsdWUBCAUCZU4Gc2NyaXB0BAJndwkA2wQBCQEFdmFsdWUBCQCdCAIFAmFKCQECYXcABAJneAkA8QcBBQR0aGlzAwMJAAACBQJndwUCZ3YJAQIhPQIFAmd4BQJndgcGCQD0AwMIBQJncglib2R5Qnl0ZXMJAJEDAggFAmdyBnByb29mcwAABQJndAkA9AMDCAUCZ3IJYm9keUJ5dGVzCQCRAwIIBQJncgZwcm9vZnMAAAUCZ3SQlvL/", "chainId": 84, "height": 2336904, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HcSELP25DX5LD9AHRuCfgf2JKTsG98L3sEXEebm8p2M3 Next: 6myE28DBrJZK5cr8HN1sCgz972icTQ6w6mnsyAq3kymf Diff:
OldNewDifferences
534534 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
535535 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
536536 }
537- $Tuple4(issueAmount, commonState, feeAmount, loss)
537+ $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
538538 }
539539 else throw("Strict value is not equal to itself.")
540540 }
564564 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
565565 let redeemedBigInt = toBigInt(paymentAmount)
566566 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
567- let $t02679326843 = takeFee(amountRaw)
568- let totalAmount = $t02679326843._1
569- let feeAmount = $t02679326843._2
570- let $t02684727073 = if (outInAmountAsset)
567+ let $t02681526865 = takeFee(amountRaw)
568+ let totalAmount = $t02681526865._1
569+ let feeAmount = $t02681526865._2
570+ let $t02686927095 = if (outInAmountAsset)
571571 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
572572 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
573- let outAmAmount = $t02684727073._1
574- let outPrAmount = $t02684727073._2
575- let amBalanceNew = $t02684727073._3
576- let prBalanceNew = $t02684727073._4
573+ let outAmAmount = $t02686927095._1
574+ let outPrAmount = $t02686927095._2
575+ let amBalanceNew = $t02686927095._3
576+ let prBalanceNew = $t02686927095._4
577577 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
578578 let priceNew = fromX18(priceNewX18, scale8)
579579 let commonState = if (isEval)
585585 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
586586 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
587587 }
588- $Tuple4(totalAmount, commonState, feeAmount, loss)
588+ $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
589589 }
590590 else throw("Strict value is not equal to itself.")
591+ }
592+
593+
594+func calcKLp (amountBalance,priceBalance,lpEmission) = {
595+ let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpEmission)
596+ updatedKLp
597+ }
598+
599+
600+func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
601+ let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
602+ let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
603+ let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
604+ let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
605+ let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
606+ $Tuple2(actions, updatedKLp)
591607 }
592608
593609
714730 else throw("Strict value is not equal to itself.")
715731 }
716732 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
717- (state ++ lpTransfer)
733+ let $t03199632061 = refreshKLpInternal(0, 0, 0)
734+ let refreshKLpActions = $t03199632061._1
735+ let updatedKLp = $t03199632061._2
736+ ((state ++ lpTransfer) ++ refreshKLpActions)
718737 }
719738 else throw("Strict value is not equal to itself.")
720739 }
732751 then throw("Invalid value passed")
733752 else {
734753 let estPut = commonPut(i, maxSlippage, false)
735- estPut._9
754+ let state = estPut._9
755+ let $t03234732412 = refreshKLpInternal(0, 0, 0)
756+ let refreshKLpActions = $t03234732412._1
757+ let updatedKLp = $t03234732412._2
758+ (state ++ refreshKLpActions)
736759 }
737760
738761
766789 let paymentAmountRaw = payment.amount
767790 let userAddress = i.caller
768791 let txId = i.transactionId
769- let $t03198032107 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
770- let emitAmountEstimated = $t03198032107._1
771- let commonState = $t03198032107._2
772- let feeAmount = $t03198032107._3
773- let bonus = $t03198032107._4
792+ let $t03318833337 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
793+ let emitAmountEstimated = $t03318833337._1
794+ let commonState = $t03318833337._2
795+ let feeAmount = $t03318833337._3
796+ let bonus = $t03318833337._4
797+ let paymentInAmountAsset = $t03318833337._5
774798 let emitAmount = if (if ((minOutAmount > 0))
775799 then (minOutAmount > emitAmountEstimated)
776800 else false)
790814 let sendFee = if ((feeAmount > 0))
791815 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
792816 else nil
793- $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount)
817+ let $t03392334120 = if ((this == feeCollectorAddress))
818+ then $Tuple2(0, 0)
819+ else if (paymentInAmountAsset)
820+ then $Tuple2(-(feeAmount), 0)
821+ else $Tuple2(0, -(feeAmount))
822+ let amountAssetBalanceDelta = $t03392334120._1
823+ let priceAssetBalanceDelta = $t03392334120._2
824+ let $t03412334231 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
825+ let refreshKLpActions = $t03412334231._1
826+ let updatedKLp = $t03412334231._2
827+ $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
794828 }
795829 else throw("Strict value is not equal to itself.")
796830 }
801835
802836 @Callable(i)
803837 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
804- let $t03283632971 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
805- let emitAmountEstimated = $t03283632971._1
806- let commonState = $t03283632971._2
807- let feeAmount = $t03283632971._3
808- let bonus = $t03283632971._4
838+ let $t03442434581 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
839+ let emitAmountEstimated = $t03442434581._1
840+ let commonState = $t03442434581._2
841+ let feeAmount = $t03442434581._3
842+ let bonus = $t03442434581._4
843+ let paymentInAmountAsset = $t03442434581._5
809844 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
810845 }
811846
839874 let paymentAmount = payment.amount
840875 let userAddress = i.caller
841876 let txId = i.transactionId
842- let $t03377633908 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
843- let amountEstimated = $t03377633908._1
844- let commonState = $t03377633908._2
845- let feeAmount = $t03377633908._3
846- let bonus = $t03377633908._4
877+ let $t03538635536 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
878+ let amountEstimated = $t03538635536._1
879+ let commonState = $t03538635536._2
880+ let feeAmount = $t03538635536._3
881+ let bonus = $t03538635536._4
882+ let outInAmountAsset = $t03538635536._5
847883 let amount = if (if ((minOutAmount > 0))
848884 then (minOutAmount > amountEstimated)
849885 else false)
856892 let sendFee = if ((feeAmount > 0))
857893 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
858894 else nil
859- $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
895+ let $t03603636283 = {
896+ let feeAmountForCalc = if ((this == feeCollectorAddress))
897+ then 0
898+ else feeAmount
899+ if (outInAmountAsset)
900+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
901+ else $Tuple2(0, -((amount + feeAmountForCalc)))
902+ }
903+ let amountAssetBalanceDelta = $t03603636283._1
904+ let priceAssetBalanceDelta = $t03603636283._2
905+ let $t03628636394 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
906+ let refreshKLpActions = $t03628636394._1
907+ let updatedKLp = $t03628636394._2
908+ $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
860909 }
861910 else throw("Strict value is not equal to itself.")
862911 }
867916
868917 @Callable(i)
869918 func getOneTknREADONLY (outAssetId,paymentAmount) = {
870- let $t03454334681 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
871- let amountEstimated = $t03454334681._1
872- let commonState = $t03454334681._2
873- let feeAmount = $t03454334681._3
874- let bonus = $t03454334681._4
919+ let $t03657836734 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
920+ let amountEstimated = $t03657836734._1
921+ let commonState = $t03657836734._2
922+ let feeAmount = $t03657836734._3
923+ let bonus = $t03657836734._4
924+ let outInAmountAsset = $t03657836734._5
875925 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
876926 }
877927
905955 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
906956 if ((unstakeInv == unstakeInv))
907957 then {
908- let $t03550635636 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
909- let amountEstimated = $t03550635636._1
910- let commonState = $t03550635636._2
911- let feeAmount = $t03550635636._3
912- let bonus = $t03550635636._4
958+ let $t03755937707 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
959+ let amountEstimated = $t03755937707._1
960+ let commonState = $t03755937707._2
961+ let feeAmount = $t03755937707._3
962+ let bonus = $t03755937707._4
963+ let outInAmountAsset = $t03755937707._5
913964 let amount = if (if ((minOutAmount > 0))
914965 then (minOutAmount > amountEstimated)
915966 else false)
922973 let sendFee = if ((feeAmount > 0))
923974 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
924975 else nil
925- $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
976+ let $t03820238449 = {
977+ let feeAmountForCalc = if ((this == feeCollectorAddress))
978+ then 0
979+ else feeAmount
980+ if (outInAmountAsset)
981+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
982+ else $Tuple2(0, -((amount + feeAmountForCalc)))
983+ }
984+ let amountAssetBalanceDelta = $t03820238449._1
985+ let priceAssetBalanceDelta = $t03820238449._2
986+ let $t03845238560 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
987+ let refreshKLpActions = $t03845238560._1
988+ let updatedKLp = $t03845238560._2
989+ $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
926990 }
927991 else throw("Strict value is not equal to itself.")
928992 }
9431007 let state = res._5
9441008 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
9451009 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
946- then state
1010+ then {
1011+ let $t03935239434 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1012+ let refreshKLpActions = $t03935239434._1
1013+ let updatedKLp = $t03935239434._2
1014+ (state ++ refreshKLpActions)
1015+ }
9471016 else throw("Strict value is not equal to itself.")
9481017 }
9491018
9641033 else {
9651034 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
9661035 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
967- then state
1036+ then {
1037+ let $t04023040311 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1038+ let refreshKLpActions = $t04023040311._1
1039+ let updatedKLp = $t04023040311._2
1040+ (state ++ refreshKLpActions)
1041+ }
9681042 else throw("Strict value is not equal to itself.")
9691043 }
9701044 }
9841058 if ((unstakeInv == unstakeInv))
9851059 then {
9861060 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1061+ let outAmAmt = res._1
1062+ let outPrAmt = res._2
9871063 let poolStatus = parseIntValue(res._9)
9881064 let state = res._10
9891065 let checkPoolStatus = if (if (isGlobalShutdown())
9951071 then {
9961072 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
9971073 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
998- then state
1074+ then {
1075+ let $t04128441365 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1076+ let refreshKLpActions = $t04128441365._1
1077+ let updatedKLp = $t04128441365._2
1078+ (state ++ refreshKLpActions)
1079+ }
9991080 else throw("Strict value is not equal to itself.")
10001081 }
10011082 else throw("Strict value is not equal to itself.")
10351116 then {
10361117 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10371118 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1038- then state
1119+ then {
1120+ let $t04250542586 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1121+ let refreshKLpActions = $t04250542586._1
1122+ let updatedKLp = $t04250542586._2
1123+ (state ++ refreshKLpActions)
1124+ }
10391125 else throw("Strict value is not equal to itself.")
10401126 }
10411127 else throw("Strict value is not equal to itself.")
10621148 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
10631149 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
10641150 then {
1065- let amountAssetBalance = toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
1066- let priceAssetBalance = toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
1067- let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity)
1068- let updatedKLp = fraction(pow((amountAssetBalance * priceAssetBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpAssetEmission)
1069- let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
1151+ let $t04357443629 = refreshKLpInternal(0, 0, 0)
1152+ let actions = $t04357443629._1
1153+ let updatedKLp = $t04357443629._2
10701154 $Tuple2(actions, toString(updatedKLp))
10711155 }
10721156 else throw("Strict value is not equal to itself.")
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 validateMatcherOrderAllowed (order) = {
377377 let cfg = getPoolConfig()
378378 let amtAssetId = cfg[idxAmtAssetId]
379379 let priceAssetId = cfg[idxPriceAssetId]
380380 let poolStatus = parseIntValue(cfg[idxPoolStatus])
381381 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
382382 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
383383 let accAmtAssetBalance = getAccBalance(amtAssetId)
384384 let accPriceAssetBalance = getAccBalance(priceAssetId)
385385 let curPriceX18 = if ((order.orderType == Buy))
386386 then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance)
387387 else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance)
388388 let curPrice = fromX18(curPriceX18, scale8)
389389 if (if (if (isGlobalShutdown())
390390 then true
391391 else (poolStatus == PoolMatcherDisabled))
392392 then true
393393 else (poolStatus == PoolShutdown))
394394 then throw("Exchange operations disabled")
395395 else {
396396 let orderAmtAsset = order.assetPair.amountAsset
397397 let orderAmtAssetStr = if ((orderAmtAsset == unit))
398398 then "WAVES"
399399 else toBase58String(value(orderAmtAsset))
400400 let orderPriceAsset = order.assetPair.priceAsset
401401 let orderPriceAssetStr = if ((orderPriceAsset == unit))
402402 then "WAVES"
403403 else toBase58String(value(orderPriceAsset))
404404 if (if ((orderAmtAssetStr != amtAssetId))
405405 then true
406406 else (orderPriceAssetStr != priceAssetId))
407407 then throw("Wrong order assets.")
408408 else {
409409 let orderPrice = order.price
410410 let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm)
411411 let castedOrderPrice = toScale(orderPrice, scale8, priceDcm)
412412 let isOrderPriceValid = if ((order.orderType == Buy))
413413 then (curPrice >= castedOrderPrice)
414414 else (castedOrderPrice >= curPrice)
415415 true
416416 }
417417 }
418418 }
419419
420420
421421 func commonGet (i) = if ((size(i.payments) != 1))
422422 then throw("exactly 1 payment is expected")
423423 else {
424424 let pmt = value(i.payments[0])
425425 let pmtAssetId = value(pmt.assetId)
426426 let pmtAmt = pmt.amount
427427 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
428428 let outAmAmt = res._1
429429 let outPrAmt = res._2
430430 let poolStatus = parseIntValue(res._9)
431431 let state = res._10
432432 if (if (isGlobalShutdown())
433433 then true
434434 else (poolStatus == PoolShutdown))
435435 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
436436 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
437437 }
438438
439439
440440 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
441441 then throw("exactly 2 payments are expected")
442442 else {
443443 let amAssetPmt = value(i.payments[0])
444444 let prAssetPmt = value(i.payments[1])
445445 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
446446 let poolStatus = parseIntValue(estPut._8)
447447 if (if (if (isGlobalShutdown())
448448 then true
449449 else (poolStatus == PoolPutDisabled))
450450 then true
451451 else (poolStatus == PoolShutdown))
452452 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
453453 else estPut
454454 }
455455
456456
457457 func emit (amount) = {
458458 let emitInv = invoke(factoryContract, "emit", [amount], nil)
459459 if ((emitInv == emitInv))
460460 then {
461461 let emitInvLegacy = match emitInv {
462462 case legacyFactoryContract: Address =>
463463 invoke(legacyFactoryContract, "emit", [amount], nil)
464464 case _ =>
465465 unit
466466 }
467467 if ((emitInvLegacy == emitInvLegacy))
468468 then amount
469469 else throw("Strict value is not equal to itself.")
470470 }
471471 else throw("Strict value is not equal to itself.")
472472 }
473473
474474
475475 func takeFee (amount) = {
476476 let feeAmount = fraction(amount, fee, scale8)
477477 $Tuple2((amount - feeAmount), feeAmount)
478478 }
479479
480480
481481 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
482482 let isEval = (txId == unit)
483483 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
484484 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
485485 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
486486 then true
487487 else if ((paymentAssetId == cfgPriceAssetId))
488488 then false
489489 else throwErr("invalid asset")
490490 let $t02294223235 = if (isEval)
491491 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
492492 else if (paymentInAmountAsset)
493493 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
494494 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
495495 let amountBalanceOld = $t02294223235._1
496496 let priceBalanceOld = $t02294223235._2
497497 let $t02323923388 = if (paymentInAmountAsset)
498498 then $Tuple2(paymentAmountRaw, 0)
499499 else $Tuple2(0, paymentAmountRaw)
500500 let amountAssetAmountRaw = $t02323923388._1
501501 let priceAssetAmountRaw = $t02323923388._2
502502 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
503503 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
504504 let $t02351023569 = takeFee(paymentAmountRaw)
505505 let paymentAmount = $t02351023569._1
506506 let feeAmount = $t02351023569._2
507507 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
508508 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
509509 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
510510 let priceNew = fromX18(priceNewX18, scale8)
511511 let paymentBalance = if (paymentInAmountAsset)
512512 then amountBalanceOld
513513 else priceBalanceOld
514514 let paymentBalanceBigInt = toBigInt(paymentBalance)
515515 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
516516 let chechSupply = if ((supplyBigInt > big0))
517517 then true
518518 else throwErr("initial deposit requires all coins")
519519 if ((chechSupply == chechSupply))
520520 then {
521521 let depositBigInt = toBigInt(paymentAmount)
522522 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
523523 let commonState = if (isEval)
524524 then nil
525525 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))]
526526 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
527527 let priceOld = fromX18(priceOldX18, scale8)
528528 let loss = {
529529 let $t02504625213 = if (paymentInAmountAsset)
530530 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
531531 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
532532 let amount = $t02504625213._1
533533 let balance = $t02504625213._2
534534 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
535535 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
536536 }
537- $Tuple4(issueAmount, commonState, feeAmount, loss)
537+ $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
538538 }
539539 else throw("Strict value is not equal to itself.")
540540 }
541541
542542
543543 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
544544 let isEval = (txId == unit)
545545 let checks = [if ((paymentAssetId == cfgLpAssetId))
546546 then true
547547 else throwErr("invalid lp asset")]
548548 if ((checks == checks))
549549 then {
550550 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
551551 then true
552552 else if ((outAssetId == cfgPriceAssetId))
553553 then false
554554 else throwErr("invalid asset")
555555 let balanceBigInt = if (outInAmountAsset)
556556 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
557557 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
558558 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
559559 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
560560 let outBalance = if (outInAmountAsset)
561561 then amBalanceOld
562562 else prBalanceOld
563563 let outBalanceBigInt = toBigInt(outBalance)
564564 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
565565 let redeemedBigInt = toBigInt(paymentAmount)
566566 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
567- let $t02679326843 = takeFee(amountRaw)
568- let totalAmount = $t02679326843._1
569- let feeAmount = $t02679326843._2
570- let $t02684727073 = if (outInAmountAsset)
567+ let $t02681526865 = takeFee(amountRaw)
568+ let totalAmount = $t02681526865._1
569+ let feeAmount = $t02681526865._2
570+ let $t02686927095 = if (outInAmountAsset)
571571 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
572572 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
573- let outAmAmount = $t02684727073._1
574- let outPrAmount = $t02684727073._2
575- let amBalanceNew = $t02684727073._3
576- let prBalanceNew = $t02684727073._4
573+ let outAmAmount = $t02686927095._1
574+ let outPrAmount = $t02686927095._2
575+ let amBalanceNew = $t02686927095._3
576+ let prBalanceNew = $t02686927095._4
577577 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
578578 let priceNew = fromX18(priceNewX18, scale8)
579579 let commonState = if (isEval)
580580 then nil
581581 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)]
582582 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
583583 let priceOld = fromX18(priceOldX18, scale8)
584584 let loss = {
585585 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
586586 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
587587 }
588- $Tuple4(totalAmount, commonState, feeAmount, loss)
588+ $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
589589 }
590590 else throw("Strict value is not equal to itself.")
591+ }
592+
593+
594+func calcKLp (amountBalance,priceBalance,lpEmission) = {
595+ let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpEmission)
596+ updatedKLp
597+ }
598+
599+
600+func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
601+ let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
602+ let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
603+ let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
604+ let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
605+ let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
606+ $Tuple2(actions, updatedKLp)
591607 }
592608
593609
594610 func managerPublicKeyOrUnit () = match getString(mpk()) {
595611 case s: String =>
596612 fromBase58String(s)
597613 case _: Unit =>
598614 unit
599615 case _ =>
600616 throw("Match error")
601617 }
602618
603619
604620 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
605621 case s: String =>
606622 fromBase58String(s)
607623 case _: Unit =>
608624 unit
609625 case _ =>
610626 throw("Match error")
611627 }
612628
613629
614630 func isManager (i) = match managerPublicKeyOrUnit() {
615631 case pk: ByteVector =>
616632 (i.callerPublicKey == pk)
617633 case _: Unit =>
618634 (i.caller == this)
619635 case _ =>
620636 throw("Match error")
621637 }
622638
623639
624640 func mustManager (i) = {
625641 let pd = throw("Permission denied")
626642 match managerPublicKeyOrUnit() {
627643 case pk: ByteVector =>
628644 if ((i.callerPublicKey == pk))
629645 then true
630646 else pd
631647 case _: Unit =>
632648 if ((i.caller == this))
633649 then true
634650 else pd
635651 case _ =>
636652 throw("Match error")
637653 }
638654 }
639655
640656
641657 @Callable(i)
642658 func setManager (pendingManagerPublicKey) = {
643659 let checkCaller = mustManager(i)
644660 if ((checkCaller == checkCaller))
645661 then {
646662 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
647663 if ((checkManagerPublicKey == checkManagerPublicKey))
648664 then [StringEntry(pmpk(), pendingManagerPublicKey)]
649665 else throw("Strict value is not equal to itself.")
650666 }
651667 else throw("Strict value is not equal to itself.")
652668 }
653669
654670
655671
656672 @Callable(i)
657673 func confirmManager () = {
658674 let pm = pendingManagerPublicKeyOrUnit()
659675 let hasPM = if (isDefined(pm))
660676 then true
661677 else throw("No pending manager")
662678 if ((hasPM == hasPM))
663679 then {
664680 let checkPM = if ((i.callerPublicKey == value(pm)))
665681 then true
666682 else throw("You are not pending manager")
667683 if ((checkPM == checkPM))
668684 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
669685 else throw("Strict value is not equal to itself.")
670686 }
671687 else throw("Strict value is not equal to itself.")
672688 }
673689
674690
675691
676692 @Callable(i)
677693 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
678694 then throw("Invalid slippageTolerance passed")
679695 else {
680696 let estPut = commonPut(i, slippageTolerance, true)
681697 let emitLpAmt = estPut._2
682698 let lpAssetId = estPut._7
683699 let state = estPut._9
684700 let amDiff = estPut._10
685701 let prDiff = estPut._11
686702 let amId = estPut._12
687703 let prId = estPut._13
688704 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
689705 if ((emitInv == emitInv))
690706 then {
691707 let emitInvLegacy = match emitInv {
692708 case legacyFactoryContract: Address =>
693709 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
694710 case _ =>
695711 unit
696712 }
697713 if ((emitInvLegacy == emitInvLegacy))
698714 then {
699715 let slippageAInv = if ((amDiff > 0))
700716 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
701717 else nil
702718 if ((slippageAInv == slippageAInv))
703719 then {
704720 let slippagePInv = if ((prDiff > 0))
705721 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
706722 else nil
707723 if ((slippagePInv == slippagePInv))
708724 then {
709725 let lpTransfer = if (shouldAutoStake)
710726 then {
711727 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
712728 if ((slpStakeInv == slpStakeInv))
713729 then nil
714730 else throw("Strict value is not equal to itself.")
715731 }
716732 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
717- (state ++ lpTransfer)
733+ let $t03199632061 = refreshKLpInternal(0, 0, 0)
734+ let refreshKLpActions = $t03199632061._1
735+ let updatedKLp = $t03199632061._2
736+ ((state ++ lpTransfer) ++ refreshKLpActions)
718737 }
719738 else throw("Strict value is not equal to itself.")
720739 }
721740 else throw("Strict value is not equal to itself.")
722741 }
723742 else throw("Strict value is not equal to itself.")
724743 }
725744 else throw("Strict value is not equal to itself.")
726745 }
727746
728747
729748
730749 @Callable(i)
731750 func putForFree (maxSlippage) = if ((0 > maxSlippage))
732751 then throw("Invalid value passed")
733752 else {
734753 let estPut = commonPut(i, maxSlippage, false)
735- estPut._9
754+ let state = estPut._9
755+ let $t03234732412 = refreshKLpInternal(0, 0, 0)
756+ let refreshKLpActions = $t03234732412._1
757+ let updatedKLp = $t03234732412._2
758+ (state ++ refreshKLpActions)
736759 }
737760
738761
739762
740763 @Callable(i)
741764 func putOneTkn (minOutAmount,autoStake) = {
742765 let isPoolOneTokenOperationsDisabled = {
743766 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
744767 if ($isInstanceOf(@, "Boolean"))
745768 then @
746769 else throw(($getType(@) + " couldn't be cast to Boolean"))
747770 }
748771 let isPutDisabled = if (if (if (isGlobalShutdown())
749772 then true
750773 else (cfgPoolStatus == PoolPutDisabled))
751774 then true
752775 else (cfgPoolStatus == PoolShutdown))
753776 then true
754777 else isPoolOneTokenOperationsDisabled
755778 let checks = [if (if (!(isPutDisabled))
756779 then true
757780 else isManager(i))
758781 then true
759782 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
760783 then true
761784 else throwErr("exactly 1 payment are expected")]
762785 if ((checks == checks))
763786 then {
764787 let payment = i.payments[0]
765788 let paymentAssetId = payment.assetId
766789 let paymentAmountRaw = payment.amount
767790 let userAddress = i.caller
768791 let txId = i.transactionId
769- let $t03198032107 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
770- let emitAmountEstimated = $t03198032107._1
771- let commonState = $t03198032107._2
772- let feeAmount = $t03198032107._3
773- let bonus = $t03198032107._4
792+ let $t03318833337 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
793+ let emitAmountEstimated = $t03318833337._1
794+ let commonState = $t03318833337._2
795+ let feeAmount = $t03318833337._3
796+ let bonus = $t03318833337._4
797+ let paymentInAmountAsset = $t03318833337._5
774798 let emitAmount = if (if ((minOutAmount > 0))
775799 then (minOutAmount > emitAmountEstimated)
776800 else false)
777801 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
778802 else emitAmountEstimated
779803 let emitInv = emit(emitAmount)
780804 if ((emitInv == emitInv))
781805 then {
782806 let lpTransfer = if (autoStake)
783807 then {
784808 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
785809 if ((stakeInv == stakeInv))
786810 then nil
787811 else throw("Strict value is not equal to itself.")
788812 }
789813 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
790814 let sendFee = if ((feeAmount > 0))
791815 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
792816 else nil
793- $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount)
817+ let $t03392334120 = if ((this == feeCollectorAddress))
818+ then $Tuple2(0, 0)
819+ else if (paymentInAmountAsset)
820+ then $Tuple2(-(feeAmount), 0)
821+ else $Tuple2(0, -(feeAmount))
822+ let amountAssetBalanceDelta = $t03392334120._1
823+ let priceAssetBalanceDelta = $t03392334120._2
824+ let $t03412334231 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
825+ let refreshKLpActions = $t03412334231._1
826+ let updatedKLp = $t03412334231._2
827+ $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
794828 }
795829 else throw("Strict value is not equal to itself.")
796830 }
797831 else throw("Strict value is not equal to itself.")
798832 }
799833
800834
801835
802836 @Callable(i)
803837 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
804- let $t03283632971 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
805- let emitAmountEstimated = $t03283632971._1
806- let commonState = $t03283632971._2
807- let feeAmount = $t03283632971._3
808- let bonus = $t03283632971._4
838+ let $t03442434581 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
839+ let emitAmountEstimated = $t03442434581._1
840+ let commonState = $t03442434581._2
841+ let feeAmount = $t03442434581._3
842+ let bonus = $t03442434581._4
843+ let paymentInAmountAsset = $t03442434581._5
809844 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
810845 }
811846
812847
813848
814849 @Callable(i)
815850 func getOneTkn (outAssetIdStr,minOutAmount) = {
816851 let isPoolOneTokenOperationsDisabled = {
817852 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
818853 if ($isInstanceOf(@, "Boolean"))
819854 then @
820855 else throw(($getType(@) + " couldn't be cast to Boolean"))
821856 }
822857 let isGetDisabled = if (if (isGlobalShutdown())
823858 then true
824859 else (cfgPoolStatus == PoolShutdown))
825860 then true
826861 else isPoolOneTokenOperationsDisabled
827862 let checks = [if (if (!(isGetDisabled))
828863 then true
829864 else isManager(i))
830865 then true
831866 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
832867 then true
833868 else throwErr("exactly 1 payment are expected")]
834869 if ((checks == checks))
835870 then {
836871 let outAssetId = parseAssetId(outAssetIdStr)
837872 let payment = i.payments[0]
838873 let paymentAssetId = payment.assetId
839874 let paymentAmount = payment.amount
840875 let userAddress = i.caller
841876 let txId = i.transactionId
842- let $t03377633908 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
843- let amountEstimated = $t03377633908._1
844- let commonState = $t03377633908._2
845- let feeAmount = $t03377633908._3
846- let bonus = $t03377633908._4
877+ let $t03538635536 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
878+ let amountEstimated = $t03538635536._1
879+ let commonState = $t03538635536._2
880+ let feeAmount = $t03538635536._3
881+ let bonus = $t03538635536._4
882+ let outInAmountAsset = $t03538635536._5
847883 let amount = if (if ((minOutAmount > 0))
848884 then (minOutAmount > amountEstimated)
849885 else false)
850886 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
851887 else amountEstimated
852888 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
853889 if ((burnInv == burnInv))
854890 then {
855891 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
856892 let sendFee = if ((feeAmount > 0))
857893 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
858894 else nil
859- $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
895+ let $t03603636283 = {
896+ let feeAmountForCalc = if ((this == feeCollectorAddress))
897+ then 0
898+ else feeAmount
899+ if (outInAmountAsset)
900+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
901+ else $Tuple2(0, -((amount + feeAmountForCalc)))
902+ }
903+ let amountAssetBalanceDelta = $t03603636283._1
904+ let priceAssetBalanceDelta = $t03603636283._2
905+ let $t03628636394 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
906+ let refreshKLpActions = $t03628636394._1
907+ let updatedKLp = $t03628636394._2
908+ $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
860909 }
861910 else throw("Strict value is not equal to itself.")
862911 }
863912 else throw("Strict value is not equal to itself.")
864913 }
865914
866915
867916
868917 @Callable(i)
869918 func getOneTknREADONLY (outAssetId,paymentAmount) = {
870- let $t03454334681 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
871- let amountEstimated = $t03454334681._1
872- let commonState = $t03454334681._2
873- let feeAmount = $t03454334681._3
874- let bonus = $t03454334681._4
919+ let $t03657836734 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
920+ let amountEstimated = $t03657836734._1
921+ let commonState = $t03657836734._2
922+ let feeAmount = $t03657836734._3
923+ let bonus = $t03657836734._4
924+ let outInAmountAsset = $t03657836734._5
875925 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
876926 }
877927
878928
879929
880930 @Callable(i)
881931 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
882932 let isPoolOneTokenOperationsDisabled = {
883933 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
884934 if ($isInstanceOf(@, "Boolean"))
885935 then @
886936 else throw(($getType(@) + " couldn't be cast to Boolean"))
887937 }
888938 let isGetDisabled = if (if (isGlobalShutdown())
889939 then true
890940 else (cfgPoolStatus == PoolShutdown))
891941 then true
892942 else isPoolOneTokenOperationsDisabled
893943 let checks = [if (if (!(isGetDisabled))
894944 then true
895945 else isManager(i))
896946 then true
897947 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
898948 then true
899949 else throwErr("no payments are expected")]
900950 if ((checks == checks))
901951 then {
902952 let outAssetId = parseAssetId(outAssetIdStr)
903953 let userAddress = i.caller
904954 let txId = i.transactionId
905955 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
906956 if ((unstakeInv == unstakeInv))
907957 then {
908- let $t03550635636 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
909- let amountEstimated = $t03550635636._1
910- let commonState = $t03550635636._2
911- let feeAmount = $t03550635636._3
912- let bonus = $t03550635636._4
958+ let $t03755937707 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
959+ let amountEstimated = $t03755937707._1
960+ let commonState = $t03755937707._2
961+ let feeAmount = $t03755937707._3
962+ let bonus = $t03755937707._4
963+ let outInAmountAsset = $t03755937707._5
913964 let amount = if (if ((minOutAmount > 0))
914965 then (minOutAmount > amountEstimated)
915966 else false)
916967 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
917968 else amountEstimated
918969 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
919970 if ((burnInv == burnInv))
920971 then {
921972 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
922973 let sendFee = if ((feeAmount > 0))
923974 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
924975 else nil
925- $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
976+ let $t03820238449 = {
977+ let feeAmountForCalc = if ((this == feeCollectorAddress))
978+ then 0
979+ else feeAmount
980+ if (outInAmountAsset)
981+ then $Tuple2(-((amount + feeAmountForCalc)), 0)
982+ else $Tuple2(0, -((amount + feeAmountForCalc)))
983+ }
984+ let amountAssetBalanceDelta = $t03820238449._1
985+ let priceAssetBalanceDelta = $t03820238449._2
986+ let $t03845238560 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
987+ let refreshKLpActions = $t03845238560._1
988+ let updatedKLp = $t03845238560._2
989+ $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
926990 }
927991 else throw("Strict value is not equal to itself.")
928992 }
929993 else throw("Strict value is not equal to itself.")
930994 }
931995 else throw("Strict value is not equal to itself.")
932996 }
933997
934998
935999
9361000 @Callable(i)
9371001 func get () = {
9381002 let res = commonGet(i)
9391003 let outAmtAmt = res._1
9401004 let outPrAmt = res._2
9411005 let pmtAmt = res._3
9421006 let pmtAssetId = res._4
9431007 let state = res._5
9441008 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
9451009 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
946- then state
1010+ then {
1011+ let $t03935239434 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1012+ let refreshKLpActions = $t03935239434._1
1013+ let updatedKLp = $t03935239434._2
1014+ (state ++ refreshKLpActions)
1015+ }
9471016 else throw("Strict value is not equal to itself.")
9481017 }
9491018
9501019
9511020
9521021 @Callable(i)
9531022 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
9541023 let res = commonGet(i)
9551024 let outAmAmt = res._1
9561025 let outPrAmt = res._2
9571026 let pmtAmt = res._3
9581027 let pmtAssetId = res._4
9591028 let state = res._5
9601029 if ((noLessThenAmtAsset > outAmAmt))
9611030 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
9621031 else if ((noLessThenPriceAsset > outPrAmt))
9631032 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
9641033 else {
9651034 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
9661035 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
967- then state
1036+ then {
1037+ let $t04023040311 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1038+ let refreshKLpActions = $t04023040311._1
1039+ let updatedKLp = $t04023040311._2
1040+ (state ++ refreshKLpActions)
1041+ }
9681042 else throw("Strict value is not equal to itself.")
9691043 }
9701044 }
9711045
9721046
9731047
9741048 @Callable(i)
9751049 func unstakeAndGet (amount) = {
9761050 let checkPayments = if ((size(i.payments) != 0))
9771051 then throw("No payments are expected")
9781052 else true
9791053 if ((checkPayments == checkPayments))
9801054 then {
9811055 let cfg = getPoolConfig()
9821056 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
9831057 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
9841058 if ((unstakeInv == unstakeInv))
9851059 then {
9861060 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1061+ let outAmAmt = res._1
1062+ let outPrAmt = res._2
9871063 let poolStatus = parseIntValue(res._9)
9881064 let state = res._10
9891065 let checkPoolStatus = if (if (isGlobalShutdown())
9901066 then true
9911067 else (poolStatus == PoolShutdown))
9921068 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
9931069 else true
9941070 if ((checkPoolStatus == checkPoolStatus))
9951071 then {
9961072 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
9971073 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
998- then state
1074+ then {
1075+ let $t04128441365 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1076+ let refreshKLpActions = $t04128441365._1
1077+ let updatedKLp = $t04128441365._2
1078+ (state ++ refreshKLpActions)
1079+ }
9991080 else throw("Strict value is not equal to itself.")
10001081 }
10011082 else throw("Strict value is not equal to itself.")
10021083 }
10031084 else throw("Strict value is not equal to itself.")
10041085 }
10051086 else throw("Strict value is not equal to itself.")
10061087 }
10071088
10081089
10091090
10101091 @Callable(i)
10111092 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
10121093 let isGetDisabled = if (isGlobalShutdown())
10131094 then true
10141095 else (cfgPoolStatus == PoolShutdown)
10151096 let checks = [if (!(isGetDisabled))
10161097 then true
10171098 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
10181099 then true
10191100 else throw("no payments are expected")]
10201101 if ((checks == checks))
10211102 then {
10221103 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10231104 if ((unstakeInv == unstakeInv))
10241105 then {
10251106 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
10261107 let outAmAmt = res._1
10271108 let outPrAmt = res._2
10281109 let state = res._10
10291110 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
10301111 then true
10311112 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
10321113 then true
10331114 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
10341115 if ((checkAmounts == checkAmounts))
10351116 then {
10361117 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10371118 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1038- then state
1119+ then {
1120+ let $t04250542586 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1121+ let refreshKLpActions = $t04250542586._1
1122+ let updatedKLp = $t04250542586._2
1123+ (state ++ refreshKLpActions)
1124+ }
10391125 else throw("Strict value is not equal to itself.")
10401126 }
10411127 else throw("Strict value is not equal to itself.")
10421128 }
10431129 else throw("Strict value is not equal to itself.")
10441130 }
10451131 else throw("Strict value is not equal to itself.")
10461132 }
10471133
10481134
10491135
10501136 @Callable(i)
10511137 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
10521138 then throw("permissions denied")
10531139 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
10541140
10551141
10561142
10571143 @Callable(i)
10581144 func refreshKLp () = {
10591145 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
10601146 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
10611147 then unit
10621148 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
10631149 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
10641150 then {
1065- let amountAssetBalance = toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
1066- let priceAssetBalance = toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
1067- let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity)
1068- let updatedKLp = fraction(pow((amountAssetBalance * priceAssetBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpAssetEmission)
1069- let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
1151+ let $t04357443629 = refreshKLpInternal(0, 0, 0)
1152+ let actions = $t04357443629._1
1153+ let updatedKLp = $t04357443629._2
10701154 $Tuple2(actions, toString(updatedKLp))
10711155 }
10721156 else throw("Strict value is not equal to itself.")
10731157 }
10741158
10751159
10761160
10771161 @Callable(i)
10781162 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
10791163
10801164
10811165
10821166 @Callable(i)
10831167 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
10841168
10851169
10861170
10871171 @Callable(i)
10881172 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
10891173 let prices = calcPrices(amAmt, prAmt, lpAmt)
10901174 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
10911175 }
10921176
10931177
10941178
10951179 @Callable(i)
10961180 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
10971181
10981182
10991183
11001184 @Callable(i)
11011185 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
11021186
11031187
11041188
11051189 @Callable(i)
11061190 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
11071191
11081192
11091193
11101194 @Callable(i)
11111195 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
11121196
11131197
11141198
11151199 @Callable(i)
11161200 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
11171201 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
11181202 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
11191203 }
11201204
11211205
11221206
11231207 @Callable(i)
11241208 func statsREADONLY () = {
11251209 let cfg = getPoolConfig()
11261210 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11271211 let amtAssetId = cfg[idxAmtAssetId]
11281212 let priceAssetId = cfg[idxPriceAssetId]
11291213 let iAmtAssetId = cfg[idxIAmtAssetId]
11301214 let iPriceAssetId = cfg[idxIPriceAssetId]
11311215 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
11321216 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
11331217 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
11341218 let accAmtAssetBalance = getAccBalance(amtAssetId)
11351219 let accPriceAssetBalance = getAccBalance(priceAssetId)
11361220 let pricesList = if ((poolLPBalance == 0))
11371221 then [zeroBigInt, zeroBigInt, zeroBigInt]
11381222 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
11391223 let curPrice = 0
11401224 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
11411225 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
11421226 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
11431227 $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))
11441228 }
11451229
11461230
11471231
11481232 @Callable(i)
11491233 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
11501234 let cfg = getPoolConfig()
11511235 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11521236 let amAssetIdStr = cfg[idxAmtAssetId]
11531237 let amAssetId = fromBase58String(amAssetIdStr)
11541238 let prAssetIdStr = cfg[idxPriceAssetId]
11551239 let prAssetId = fromBase58String(prAssetIdStr)
11561240 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
11571241 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
11581242 let poolStatus = cfg[idxPoolStatus]
11591243 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
11601244 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
11611245 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
11621246 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
11631247 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
11641248 let curPriceX18 = if ((poolLPBalance == 0))
11651249 then zeroBigInt
11661250 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
11671251 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
11681252 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
11691253 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
11701254 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
11711255 let calcLpAmt = estPut._1
11721256 let curPriceCalc = estPut._3
11731257 let amBalance = estPut._4
11741258 let prBalance = estPut._5
11751259 let lpEmission = estPut._6
11761260 $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))
11771261 }
11781262
11791263
11801264
11811265 @Callable(i)
11821266 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
11831267 let cfg = getPoolConfig()
11841268 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11851269 let amAssetIdStr = cfg[idxAmtAssetId]
11861270 let amAssetId = fromBase58String(amAssetIdStr)
11871271 let prAssetIdStr = cfg[idxPriceAssetId]
11881272 let prAssetId = fromBase58String(prAssetIdStr)
11891273 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
11901274 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
11911275 let poolStatus = cfg[idxPoolStatus]
11921276 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
11931277 let amBalanceRaw = getAccBalance(amAssetIdStr)
11941278 let prBalanceRaw = getAccBalance(prAssetIdStr)
11951279 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
11961280 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
11971281 let curPriceX18 = if ((poolLPBalance == 0))
11981282 then zeroBigInt
11991283 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
12001284 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
12011285 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
12021286 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
12031287 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
12041288 let calcLpAmt = estPut._1
12051289 let curPriceCalc = estPut._3
12061290 let amBalance = estPut._4
12071291 let prBalance = estPut._5
12081292 let lpEmission = estPut._6
12091293 $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))
12101294 }
12111295
12121296
12131297
12141298 @Callable(i)
12151299 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
12161300 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
12171301 let outAmAmt = res._1
12181302 let outPrAmt = res._2
12191303 let amBalance = res._5
12201304 let prBalance = res._6
12211305 let lpEmission = res._7
12221306 let curPrice = res._8
12231307 let poolStatus = parseIntValue(res._9)
12241308 $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))
12251309 }
12261310
12271311
12281312 @Verifier(tx)
12291313 func verify () = {
12301314 let targetPublicKey = match managerPublicKeyOrUnit() {
12311315 case pk: ByteVector =>
12321316 pk
12331317 case _: Unit =>
12341318 tx.senderPublicKey
12351319 case _ =>
12361320 throw("Match error")
12371321 }
12381322 match tx {
12391323 case order: Order =>
12401324 let matcherPub = getMatcherPubOrFail()
12411325 let orderValid = validateMatcherOrderAllowed(order)
12421326 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
12431327 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
12441328 if (if (if (orderValid)
12451329 then senderValid
12461330 else false)
12471331 then matcherValid
12481332 else false)
12491333 then true
12501334 else throwOrderError(orderValid, senderValid, matcherValid)
12511335 case s: SetScriptTransaction =>
12521336 let newHash = blake2b256(value(s.script))
12531337 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
12541338 let currentHash = scriptHash(this)
12551339 if (if ((allowedHash == newHash))
12561340 then (currentHash != newHash)
12571341 else false)
12581342 then true
12591343 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
12601344 case _ =>
12611345 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
12621346 }
12631347 }
12641348

github/deemru/w8io/169f3d6 
122.80 ms