tx · AjcDEoyzRtQhzTjrbyT1NeFREVW1vgTZ7zuuDUucFYdM

3N55kCyUFy8M2ooKRwierKnP7L6viqzScNn:  -0.03500000 Waves

2022.12.16 09:58 [2362523] smart account 3N55kCyUFy8M2ooKRwierKnP7L6viqzScNn > SELF 0.00000000 Waves

{ "type": 13, "id": "AjcDEoyzRtQhzTjrbyT1NeFREVW1vgTZ7zuuDUucFYdM", "fee": 3500000, "feeAssetId": null, "timestamp": 1671173913592, "version": 1, "sender": "3N55kCyUFy8M2ooKRwierKnP7L6viqzScNn", "senderPublicKey": "HpuFV1RhaXZ5gaJNgeLjyAKy3D5q7fMKdNFYYbPDafnb", "proofs": [ "2kqhN2CTruAHxcVmYd5MeKbRW8eLiZiWwrd9epawdkagjeVm2uzTpFLAxDfmtgApvH68cRuytLzSnbyDWJpKDiYS" ], "script": "base64:BgKdLQgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlkeExQQXNzZXREY20i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kAzAgCCQCkAwEFAmNoCQDMCAIJAKQDAQUCY2UJAMwIAgkApgMBBQJjawkAzAgCCQCkAwEFAmNkBQNuaWwFAWoBAmdCAQJnQwAEAmdEBAJkTgkBAmVRAAMJAAECBQJkTgIKQnl0ZVZlY3RvcgQCZVUFAmROBQJlVQMJAAECBQJkTgIEVW5pdAgFAmdCD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yBAJkTgUCZ0IDCQABAgUCZE4CBU9yZGVyBAJkcwUCZE4EAmdFCQECYU8ABAJhQgkBAmRyAQUCZHMEAmFDCQD0AwMIBQJkcwlib2R5Qnl0ZXMJAJEDAggFAmRzBnByb29mcwAACAUCZHMPc2VuZGVyUHVibGljS2V5BAJhRAkA9AMDCAUCZHMJYm9keUJ5dGVzCQCRAwIIBQJkcwZwcm9vZnMAAQUCZ0UDAwMFAmFCBQJhQwcFAmFEBwYJAQJhQQMFAmFCBQJhQwUCYUQDCQABAgUCZE4CFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJlUgUCZE4EAmdGCQD2AwEJAQV2YWx1ZQEIBQJlUgZzY3JpcHQEAmdHCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUwJAQJheQAEAmdICQDxBwEFBHRoaXMDAwkAAAIFAmdHBQJnRgkBAiE9AgUCZ0gFAmdGBwYJAPQDAwgFAmdCCWJvZHlCeXRlcwkAkQMCCAUCZ0IGcHJvb2ZzAAAFAmdECQD0AwMIBQJnQglib2R5Qnl0ZXMJAJEDAggFAmdCBnByb29mcwAABQJnRE1P6gM=", "chainId": 84, "height": 2362523, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FyPDuShMpw6erGAAKPZBZkKSrg4G2nxUK6qBYq4eUaWi Next: f5f6NCKqVPro1iFN1UkzLHomW3xQNaqZFzR6eqp5HFL Diff:
OldNewDifferences
288288 let lpEmissionX18 = toX18(lpEmission, scale8)
289289 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
290290 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
291- let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
292- let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
291+ let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
292+ let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
293293 let state = if ((txId58 == ""))
294294 then nil
295295 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
414414 func validateMatcherOrderAllowed (order) = {
415415 let amountAssetAmount = order.amount
416416 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
417- let $t02077720989 = if ((order.orderType == Buy))
417+ let $t02080121013 = if ((order.orderType == Buy))
418418 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
419419 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
420- let amountAssetBalanceDelta = $t02077720989._1
421- let priceAssetBalanceDelta = $t02077720989._2
420+ let amountAssetBalanceDelta = $t02080121013._1
421+ let priceAssetBalanceDelta = $t02080121013._2
422422 if (if (if (isGlobalShutdown())
423423 then true
424424 else (cfgPoolStatus == PoolMatcherDisabled))
431431 then throw("Wrong order assets.")
432432 else {
433433 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
434- let $t02146021560 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435- let unusedActions = $t02146021560._1
436- let kLpNew = $t02146021560._2
434+ let $t02148421584 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435+ let unusedActions = $t02148421584._1
436+ let kLpNew = $t02148421584._2
437437 let isOrderValid = (kLpNew >= kLp)
438438 isOrderValid
439439 }
509509 else if ((paymentAssetId == cfgPriceAssetId))
510510 then false
511511 else throwErr("invalid asset")
512- let $t02424524538 = if (isEval)
512+ let $t02426924562 = if (isEval)
513513 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
514514 else if (paymentInAmountAsset)
515515 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
516516 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
517- let amountBalanceOld = $t02424524538._1
518- let priceBalanceOld = $t02424524538._2
519- let $t02454224691 = if (paymentInAmountAsset)
517+ let amountBalanceOld = $t02426924562._1
518+ let priceBalanceOld = $t02426924562._2
519+ let $t02456624715 = if (paymentInAmountAsset)
520520 then $Tuple2(paymentAmountRaw, 0)
521521 else $Tuple2(0, paymentAmountRaw)
522- let amountAssetAmountRaw = $t02454224691._1
523- let priceAssetAmountRaw = $t02454224691._2
522+ let amountAssetAmountRaw = $t02456624715._1
523+ let priceAssetAmountRaw = $t02456624715._2
524524 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
525525 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
526- let $t02481324872 = takeFee(paymentAmountRaw)
527- let paymentAmount = $t02481324872._1
528- let feeAmount = $t02481324872._2
526+ let $t02483724896 = takeFee(paymentAmountRaw)
527+ let paymentAmount = $t02483724896._1
528+ let feeAmount = $t02483724896._2
529529 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
530530 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
531531 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
541541 if ((chechSupply == chechSupply))
542542 then {
543543 let depositBigInt = toBigInt(paymentAmount)
544- let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
544+ let issueAmount = max([0, fromX18Round(fraction(supplyBigInt, (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18), scale18), scale8, FLOOR)])
545545 let commonState = if (isEval)
546546 then nil
547547 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))]
548548 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
549549 let priceOld = fromX18(priceOldX18, scale8)
550550 let loss = {
551- let $t02634926516 = if (paymentInAmountAsset)
551+ let $t02639726564 = if (paymentInAmountAsset)
552552 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
553553 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
554- let amount = $t02634926516._1
555- let balance = $t02634926516._2
554+ let amount = $t02639726564._1
555+ let balance = $t02639726564._2
556556 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
557557 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
558558 }
564564
565565 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
566566 let isEval = (txId == unit)
567+ let cfg = getPoolConfig()
568+ let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
569+ let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
567570 let checks = [if ((paymentAssetId == cfgLpAssetId))
568571 then true
569572 else throwErr("invalid lp asset")]
577580 let balanceBigInt = if (outInAmountAsset)
578581 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
579582 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
583+ let outInAmountAssetDecimals = if (outInAmountAsset)
584+ then amtAssetDcm
585+ else priceAssetDcm
580586 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
581587 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
582588 let outBalance = if (outInAmountAsset)
585591 let outBalanceBigInt = toBigInt(outBalance)
586592 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
587593 let redeemedBigInt = toBigInt(paymentAmount)
588- let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
589- let $t02811828168 = takeFee(amountRaw)
590- let totalAmount = $t02811828168._1
591- let feeAmount = $t02811828168._2
592- let $t02817228398 = if (outInAmountAsset)
594+ let amountRaw = max([0, fromX18Round(fraction(balanceBigInt, (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN)), scale18), outInAmountAssetDecimals, FLOOR)])
595+ let $t02846528515 = takeFee(amountRaw)
596+ let totalAmount = $t02846528515._1
597+ let feeAmount = $t02846528515._2
598+ let $t02851928745 = if (outInAmountAsset)
593599 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
594600 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
595- let outAmAmount = $t02817228398._1
596- let outPrAmount = $t02817228398._2
597- let amBalanceNew = $t02817228398._3
598- let prBalanceNew = $t02817228398._4
601+ let outAmAmount = $t02851928745._1
602+ let outPrAmount = $t02851928745._2
603+ let amBalanceNew = $t02851928745._3
604+ let prBalanceNew = $t02851928745._4
599605 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
600606 let priceNew = fromX18(priceNewX18, scale8)
601607 let commonState = if (isEval)
741747 else throw("Strict value is not equal to itself.")
742748 }
743749 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
744- let $t03292633388 = refreshKLpInternal(0, 0, 0)
745- if (($t03292633388 == $t03292633388))
750+ let $t03327333735 = refreshKLpInternal(0, 0, 0)
751+ if (($t03327333735 == $t03327333735))
746752 then {
747- let updatedKLp = $t03292633388._2
748- let refreshKLpActions = $t03292633388._1
753+ let updatedKLp = $t03327333735._2
754+ let refreshKLpActions = $t03327333735._1
749755 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
750756 if ((isUpdatedKLpValid == isUpdatedKLpValid))
751757 then ((state ++ lpTransfer) ++ refreshKLpActions)
777783 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
778784 if ((currentKLp == currentKLp))
779785 then {
780- let $t03395034015 = refreshKLpInternal(0, 0, 0)
781- let refreshKLpActions = $t03395034015._1
782- let updatedKLp = $t03395034015._2
786+ let $t03429734362 = refreshKLpInternal(0, 0, 0)
787+ let refreshKLpActions = $t03429734362._1
788+ let updatedKLp = $t03429734362._2
783789 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
784790 if ((isUpdatedKLpValid == isUpdatedKLpValid))
785791 then (state ++ refreshKLpActions)
824830 else throwErr("payment asset is not supported")
825831 let userAddress = i.caller
826832 let txId = i.transactionId
827- let $t03520035352 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
828- if (($t03520035352 == $t03520035352))
833+ let $t03554735699 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
834+ if (($t03554735699 == $t03554735699))
829835 then {
830- let paymentInAmountAsset = $t03520035352._5
831- let bonus = $t03520035352._4
832- let feeAmount = $t03520035352._3
833- let commonState = $t03520035352._2
834- let emitAmountEstimated = $t03520035352._1
836+ let paymentInAmountAsset = $t03554735699._5
837+ let bonus = $t03554735699._4
838+ let feeAmount = $t03554735699._3
839+ let commonState = $t03554735699._2
840+ let emitAmountEstimated = $t03554735699._1
835841 let emitAmount = if (if ((minOutAmount > 0))
836842 then (minOutAmount > emitAmountEstimated)
837843 else false)
851857 let sendFee = if ((feeAmount > 0))
852858 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
853859 else nil
854- let $t03593836135 = if ((this == feeCollectorAddress))
860+ let $t03628536482 = if ((this == feeCollectorAddress))
855861 then $Tuple2(0, 0)
856862 else if (paymentInAmountAsset)
857863 then $Tuple2(-(feeAmount), 0)
858864 else $Tuple2(0, -(feeAmount))
859- let amountAssetBalanceDelta = $t03593836135._1
860- let priceAssetBalanceDelta = $t03593836135._2
861- let $t03613836246 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
862- let refreshKLpActions = $t03613836246._1
863- let updatedKLp = $t03613836246._2
865+ let amountAssetBalanceDelta = $t03628536482._1
866+ let priceAssetBalanceDelta = $t03628536482._2
867+ let $t03648536593 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
868+ let refreshKLpActions = $t03648536593._1
869+ let updatedKLp = $t03648536593._2
864870 let kLp = value(getString(keyKLp))
865871 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
866872 if ((isUpdatedKLpValid == isUpdatedKLpValid))
878884
879885 @Callable(i)
880886 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
881- let $t03655236709 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
882- let emitAmountEstimated = $t03655236709._1
883- let commonState = $t03655236709._2
884- let feeAmount = $t03655236709._3
885- let bonus = $t03655236709._4
886- let paymentInAmountAsset = $t03655236709._5
887+ let $t03689937056 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
888+ let emitAmountEstimated = $t03689937056._1
889+ let commonState = $t03689937056._2
890+ let feeAmount = $t03689937056._3
891+ let bonus = $t03689937056._4
892+ let paymentInAmountAsset = $t03689937056._5
887893 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
888894 }
889895
918924 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
919925 let userAddress = i.caller
920926 let txId = i.transactionId
921- let $t03760337756 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
922- if (($t03760337756 == $t03760337756))
927+ let $t03795038103 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
928+ if (($t03795038103 == $t03795038103))
923929 then {
924- let outInAmountAsset = $t03760337756._5
925- let bonus = $t03760337756._4
926- let feeAmount = $t03760337756._3
927- let commonState = $t03760337756._2
928- let amountEstimated = $t03760337756._1
930+ let outInAmountAsset = $t03795038103._5
931+ let bonus = $t03795038103._4
932+ let feeAmount = $t03795038103._3
933+ let commonState = $t03795038103._2
934+ let amountEstimated = $t03795038103._1
929935 let amount = if (if ((minOutAmount > 0))
930936 then (minOutAmount > amountEstimated)
931937 else false)
938944 let sendFee = if ((feeAmount > 0))
939945 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
940946 else nil
941- let $t03825638503 = {
947+ let $t03860338850 = {
942948 let feeAmountForCalc = if ((this == feeCollectorAddress))
943949 then 0
944950 else feeAmount
946952 then $Tuple2(-((amount + feeAmountForCalc)), 0)
947953 else $Tuple2(0, -((amount + feeAmountForCalc)))
948954 }
949- let amountAssetBalanceDelta = $t03825638503._1
950- let priceAssetBalanceDelta = $t03825638503._2
951- let $t03850638614 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
952- let refreshKLpActions = $t03850638614._1
953- let updatedKLp = $t03850638614._2
955+ let amountAssetBalanceDelta = $t03860338850._1
956+ let priceAssetBalanceDelta = $t03860338850._2
957+ let $t03885338961 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
958+ let refreshKLpActions = $t03885338961._1
959+ let updatedKLp = $t03885338961._2
954960 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
955961 if ((isUpdatedKLpValid == isUpdatedKLpValid))
956962 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
967973
968974 @Callable(i)
969975 func getOneTknREADONLY (outAssetId,paymentAmount) = {
970- let $t03887139027 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
971- let amountEstimated = $t03887139027._1
972- let commonState = $t03887139027._2
973- let feeAmount = $t03887139027._3
974- let bonus = $t03887139027._4
975- let outInAmountAsset = $t03887139027._5
976+ let $t03921839374 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
977+ let amountEstimated = $t03921839374._1
978+ let commonState = $t03921839374._2
979+ let feeAmount = $t03921839374._3
980+ let bonus = $t03921839374._4
981+ let outInAmountAsset = $t03921839374._5
976982 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
977983 }
978984
10071013 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10081014 if ((unstakeInv == unstakeInv))
10091015 then {
1010- let $t03992940080 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1011- if (($t03992940080 == $t03992940080))
1016+ let $t04027640427 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1017+ if (($t04027640427 == $t04027640427))
10121018 then {
1013- let outInAmountAsset = $t03992940080._5
1014- let bonus = $t03992940080._4
1015- let feeAmount = $t03992940080._3
1016- let commonState = $t03992940080._2
1017- let amountEstimated = $t03992940080._1
1019+ let outInAmountAsset = $t04027640427._5
1020+ let bonus = $t04027640427._4
1021+ let feeAmount = $t04027640427._3
1022+ let commonState = $t04027640427._2
1023+ let amountEstimated = $t04027640427._1
10181024 let amount = if (if ((minOutAmount > 0))
10191025 then (minOutAmount > amountEstimated)
10201026 else false)
10271033 let sendFee = if ((feeAmount > 0))
10281034 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10291035 else nil
1030- let $t04057540822 = {
1036+ let $t04092241169 = {
10311037 let feeAmountForCalc = if ((this == feeCollectorAddress))
10321038 then 0
10331039 else feeAmount
10351041 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10361042 else $Tuple2(0, -((amount + feeAmountForCalc)))
10371043 }
1038- let amountAssetBalanceDelta = $t04057540822._1
1039- let priceAssetBalanceDelta = $t04057540822._2
1040- let $t04082540933 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1041- let refreshKLpActions = $t04082540933._1
1042- let updatedKLp = $t04082540933._2
1044+ let amountAssetBalanceDelta = $t04092241169._1
1045+ let priceAssetBalanceDelta = $t04092241169._2
1046+ let $t04117241280 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1047+ let refreshKLpActions = $t04117241280._1
1048+ let updatedKLp = $t04117241280._2
10431049 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10441050 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10451051 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10681074 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10691075 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10701076 then {
1071- let $t04188141963 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1072- let refreshKLpActions = $t04188141963._1
1073- let updatedKLp = $t04188141963._2
1077+ let $t04222842310 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1078+ let refreshKLpActions = $t04222842310._1
1079+ let updatedKLp = $t04222842310._2
10741080 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10751081 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10761082 then (state ++ refreshKLpActions)
10981104 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10991105 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11001106 then {
1101- let $t04291442995 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1102- let refreshKLpActions = $t04291442995._1
1103- let updatedKLp = $t04291442995._2
1107+ let $t04326143342 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1108+ let refreshKLpActions = $t04326143342._1
1109+ let updatedKLp = $t04326143342._2
11041110 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11051111 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11061112 then (state ++ refreshKLpActions)
11401146 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11411147 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11421148 then {
1143- let $t04411844199 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1144- let refreshKLpActions = $t04411844199._1
1145- let updatedKLp = $t04411844199._2
1149+ let $t04446544546 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1150+ let refreshKLpActions = $t04446544546._1
1151+ let updatedKLp = $t04446544546._2
11461152 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11471153 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11481154 then (state ++ refreshKLpActions)
11891195 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11901196 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11911197 then {
1192- let $t04549145572 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1193- let refreshKLpActions = $t04549145572._1
1194- let updatedKLp = $t04549145572._2
1198+ let $t04583845919 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1199+ let refreshKLpActions = $t04583845919._1
1200+ let updatedKLp = $t04583845919._2
11951201 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11961202 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11971203 then (state ++ refreshKLpActions)
12241230 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12251231 then {
12261232 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1227- let $t04675946823 = refreshKLpInternal(0, 0, 0)
1228- let kLpUpdateActions = $t04675946823._1
1229- let updatedKLp = $t04675946823._2
1233+ let $t04710647170 = refreshKLpInternal(0, 0, 0)
1234+ let kLpUpdateActions = $t04710647170._1
1235+ let updatedKLp = $t04710647170._2
12301236 let actions = if ((kLp != updatedKLp))
12311237 then kLpUpdateActions
12321238 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 fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
6969
7070
7171 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7272
7373
7474 func abs (val) = if ((0 > val))
7575 then -(val)
7676 else val
7777
7878
7979 func absBigInt (val) = if ((zeroBigInt > val))
8080 then -(val)
8181 else val
8282
8383
8484 func fc () = "%s__factoryContract"
8585
8686
8787 func mpk () = "%s__managerPublicKey"
8888
8989
9090 func pmpk () = "%s__pendingManagerPublicKey"
9191
9292
9393 func pl () = "%s%s__price__last"
9494
9595
9696 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
9797
9898
9999 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
100100
101101
102102 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
103103
104104
105105 func aa () = "%s__amountAsset"
106106
107107
108108 func pa () = "%s__priceAsset"
109109
110110
111111 let keyFee = "%s__fee"
112112
113113 let feeDefault = fraction(10, scale8, 10000)
114114
115115 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
116116
117117 let keyKLp = makeString(["%s", "kLp"], SEP)
118118
119119 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
120120
121121 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
122122
123123 let kLpRefreshDelayDefault = 30
124124
125125 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
126126
127127 func keyFactoryConfig () = "%s__factoryConfig"
128128
129129
130130 func keyMatcherPub () = "%s%s__matcher__publicKey"
131131
132132
133133 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
134134
135135
136136 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
137137
138138
139139 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
140140
141141
142142 func keyAllPoolsShutdown () = "%s__shutdown"
143143
144144
145145 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
146146
147147
148148 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
149149
150150
151151 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
152152
153153 func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
154154
155155
156156 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
157157
158158
159159 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
160160
161161
162162 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
163163
164164
165165 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
166166
167167
168168 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
169169
170170 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
171171
172172 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
173173
174174
175175 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
176176
177177
178178 func getPoolConfig () = {
179179 let amtAsset = getStringOrFail(this, aa())
180180 let priceAsset = getStringOrFail(this, pa())
181181 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
182182 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
183183 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
184184 }
185185
186186
187187 func parseAssetId (input) = if ((input == wavesString))
188188 then unit
189189 else fromBase58String(input)
190190
191191
192192 func assetIdToString (input) = if ((input == unit))
193193 then wavesString
194194 else toBase58String(value(input))
195195
196196
197197 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]))
198198
199199
200200 let poolConfigParsed = parsePoolConfig(getPoolConfig())
201201
202202 let $t080588224 = poolConfigParsed
203203
204204 let cfgPoolAddress = $t080588224._1
205205
206206 let cfgPoolStatus = $t080588224._2
207207
208208 let cfgLpAssetId = $t080588224._3
209209
210210 let cfgAmountAssetId = $t080588224._4
211211
212212 let cfgPriceAssetId = $t080588224._5
213213
214214 let cfgAmountAssetDecimals = $t080588224._6
215215
216216 let cfgPriceAssetDecimals = $t080588224._7
217217
218218 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
219219
220220
221221 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
222222
223223 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
224224
225225 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)
226226
227227
228228 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)
229229
230230
231231 func getAccBalance (assetId) = if ((assetId == "WAVES"))
232232 then wavesBalance(this).available
233233 else assetBalance(this, fromBase58String(assetId))
234234
235235
236236 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
237237
238238
239239 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
240240
241241
242242 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
243243 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
244244 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
245245 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
246246 }
247247
248248
249249 func calcPrices (amAmt,prAmt,lpAmt) = {
250250 let cfg = getPoolConfig()
251251 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
252252 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
253253 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
254254 let amAmtX18 = toX18(amAmt, amtAssetDcm)
255255 let prAmtX18 = toX18(prAmt, priceAssetDcm)
256256 let lpAmtX18 = toX18(lpAmt, scale8)
257257 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
258258 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
259259 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
260260 }
261261
262262
263263 func calculatePrices (amAmt,prAmt,lpAmt) = {
264264 let prices = calcPrices(amAmt, prAmt, lpAmt)
265265 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
266266 }
267267
268268
269269 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
270270 let cfg = getPoolConfig()
271271 let lpAssetId = cfg[idxPoolLPAssetId]
272272 let amAssetId = cfg[idxAmtAssetId]
273273 let prAssetId = cfg[idxPriceAssetId]
274274 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
275275 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
276276 let poolStatus = cfg[idxPoolStatus]
277277 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
278278 if ((lpAssetId != pmtAssetId))
279279 then throw("Invalid asset passed.")
280280 else {
281281 let amBalance = getAccBalance(amAssetId)
282282 let amBalanceX18 = toX18(amBalance, amAssetDcm)
283283 let prBalance = getAccBalance(prAssetId)
284284 let prBalanceX18 = toX18(prBalance, prAssetDcm)
285285 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
286286 let curPrice = fromX18(curPriceX18, scale8)
287287 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
288288 let lpEmissionX18 = toX18(lpEmission, scale8)
289289 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
290290 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
291- let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
292- let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
291+ let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
292+ let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
293293 let state = if ((txId58 == ""))
294294 then nil
295295 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
296296 then unit
297297 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
298298 then unit
299299 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)]
300300 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
301301 }
302302 }
303303
304304
305305 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
306306 let cfg = getPoolConfig()
307307 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
308308 let amAssetIdStr = cfg[idxAmtAssetId]
309309 let prAssetIdStr = cfg[idxPriceAssetId]
310310 let iAmtAssetId = cfg[idxIAmtAssetId]
311311 let iPriceAssetId = cfg[idxIPriceAssetId]
312312 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
313313 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
314314 let poolStatus = cfg[idxPoolStatus]
315315 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
316316 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
317317 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
318318 if (if ((amAssetIdStr != inAmAssetIdStr))
319319 then true
320320 else (prAssetIdStr != inPrAssetIdStr))
321321 then throw("Invalid amt or price asset passed.")
322322 else {
323323 let amBalance = if (isEvaluate)
324324 then getAccBalance(amAssetIdStr)
325325 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
326326 let prBalance = if (isEvaluate)
327327 then getAccBalance(prAssetIdStr)
328328 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
329329 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
330330 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
331331 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
332332 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
333333 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
334334 let res = if ((lpEmission == 0))
335335 then {
336336 let curPriceX18 = zeroBigInt
337337 let slippageX18 = zeroBigInt
338338 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
339339 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
340340 }
341341 else {
342342 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
343343 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
344344 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
345345 if (if ((curPriceX18 != zeroBigInt))
346346 then (slippageX18 > slippageToleranceX18)
347347 else false)
348348 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
349349 else {
350350 let lpEmissionX18 = toX18(lpEmission, scale8)
351351 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
352352 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
353353 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
354354 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
355355 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
356356 let expAmtAssetAmtX18 = expectedAmts._1
357357 let expPriceAssetAmtX18 = expectedAmts._2
358358 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
359359 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
360360 }
361361 }
362362 let calcLpAmt = res._1
363363 let calcAmAssetPmt = res._2
364364 let calcPrAssetPmt = res._3
365365 let curPrice = fromX18(res._4, scale8)
366366 let slippageCalc = fromX18(res._5, scale8)
367367 if ((0 >= calcLpAmt))
368368 then throw("Invalid calculations. LP calculated is less than zero.")
369369 else {
370370 let emitLpAmt = if (!(emitLp))
371371 then 0
372372 else calcLpAmt
373373 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
374374 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
375375 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))]
376376 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
377377 }
378378 }
379379 }
380380
381381
382382 func calcKLp (amountBalance,priceBalance,lpEmission) = {
383383 let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
384384 if ((lpEmission == big0))
385385 then big0
386386 else updatedKLp
387387 }
388388
389389
390390 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
391391 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
392392 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
393393 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
394394 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
395395 currentKLp
396396 }
397397
398398
399399 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
400400 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
401401 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
402402 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
403403 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
404404 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
405405 $Tuple2(actions, updatedKLp)
406406 }
407407
408408
409409 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
410410 then true
411411 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
412412
413413
414414 func validateMatcherOrderAllowed (order) = {
415415 let amountAssetAmount = order.amount
416416 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
417- let $t02077720989 = if ((order.orderType == Buy))
417+ let $t02080121013 = if ((order.orderType == Buy))
418418 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
419419 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
420- let amountAssetBalanceDelta = $t02077720989._1
421- let priceAssetBalanceDelta = $t02077720989._2
420+ let amountAssetBalanceDelta = $t02080121013._1
421+ let priceAssetBalanceDelta = $t02080121013._2
422422 if (if (if (isGlobalShutdown())
423423 then true
424424 else (cfgPoolStatus == PoolMatcherDisabled))
425425 then true
426426 else (cfgPoolStatus == PoolShutdown))
427427 then throw("Exchange operations disabled")
428428 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
429429 then true
430430 else (order.assetPair.priceAsset != cfgPriceAssetId))
431431 then throw("Wrong order assets.")
432432 else {
433433 let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
434- let $t02146021560 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435- let unusedActions = $t02146021560._1
436- let kLpNew = $t02146021560._2
434+ let $t02148421584 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435+ let unusedActions = $t02148421584._1
436+ let kLpNew = $t02148421584._2
437437 let isOrderValid = (kLpNew >= kLp)
438438 isOrderValid
439439 }
440440 }
441441
442442
443443 func commonGet (i) = if ((size(i.payments) != 1))
444444 then throw("exactly 1 payment is expected")
445445 else {
446446 let pmt = value(i.payments[0])
447447 let pmtAssetId = value(pmt.assetId)
448448 let pmtAmt = pmt.amount
449449 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
450450 let outAmAmt = res._1
451451 let outPrAmt = res._2
452452 let poolStatus = parseIntValue(res._9)
453453 let state = res._10
454454 if (if (isGlobalShutdown())
455455 then true
456456 else (poolStatus == PoolShutdown))
457457 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
458458 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
459459 }
460460
461461
462462 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
463463 then throw("exactly 2 payments are expected")
464464 else {
465465 let amAssetPmt = value(i.payments[0])
466466 let prAssetPmt = value(i.payments[1])
467467 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
468468 let poolStatus = parseIntValue(estPut._8)
469469 if (if (if (isGlobalShutdown())
470470 then true
471471 else (poolStatus == PoolPutDisabled))
472472 then true
473473 else (poolStatus == PoolShutdown))
474474 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
475475 else estPut
476476 }
477477
478478
479479 func emit (amount) = {
480480 let emitInv = invoke(factoryContract, "emit", [amount], nil)
481481 if ((emitInv == emitInv))
482482 then {
483483 let emitInvLegacy = match emitInv {
484484 case legacyFactoryContract: Address =>
485485 invoke(legacyFactoryContract, "emit", [amount], nil)
486486 case _ =>
487487 unit
488488 }
489489 if ((emitInvLegacy == emitInvLegacy))
490490 then amount
491491 else throw("Strict value is not equal to itself.")
492492 }
493493 else throw("Strict value is not equal to itself.")
494494 }
495495
496496
497497 func takeFee (amount) = {
498498 let feeAmount = fraction(amount, fee, scale8)
499499 $Tuple2((amount - feeAmount), feeAmount)
500500 }
501501
502502
503503 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
504504 let isEval = (txId == unit)
505505 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
506506 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
507507 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
508508 then true
509509 else if ((paymentAssetId == cfgPriceAssetId))
510510 then false
511511 else throwErr("invalid asset")
512- let $t02424524538 = if (isEval)
512+ let $t02426924562 = if (isEval)
513513 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
514514 else if (paymentInAmountAsset)
515515 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
516516 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
517- let amountBalanceOld = $t02424524538._1
518- let priceBalanceOld = $t02424524538._2
519- let $t02454224691 = if (paymentInAmountAsset)
517+ let amountBalanceOld = $t02426924562._1
518+ let priceBalanceOld = $t02426924562._2
519+ let $t02456624715 = if (paymentInAmountAsset)
520520 then $Tuple2(paymentAmountRaw, 0)
521521 else $Tuple2(0, paymentAmountRaw)
522- let amountAssetAmountRaw = $t02454224691._1
523- let priceAssetAmountRaw = $t02454224691._2
522+ let amountAssetAmountRaw = $t02456624715._1
523+ let priceAssetAmountRaw = $t02456624715._2
524524 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
525525 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
526- let $t02481324872 = takeFee(paymentAmountRaw)
527- let paymentAmount = $t02481324872._1
528- let feeAmount = $t02481324872._2
526+ let $t02483724896 = takeFee(paymentAmountRaw)
527+ let paymentAmount = $t02483724896._1
528+ let feeAmount = $t02483724896._2
529529 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
530530 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
531531 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
532532 let priceNew = fromX18(priceNewX18, scale8)
533533 let paymentBalance = if (paymentInAmountAsset)
534534 then amountBalanceOld
535535 else priceBalanceOld
536536 let paymentBalanceBigInt = toBigInt(paymentBalance)
537537 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
538538 let chechSupply = if ((supplyBigInt > big0))
539539 then true
540540 else throwErr("initial deposit requires all coins")
541541 if ((chechSupply == chechSupply))
542542 then {
543543 let depositBigInt = toBigInt(paymentAmount)
544- let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
544+ let issueAmount = max([0, fromX18Round(fraction(supplyBigInt, (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18), scale18), scale8, FLOOR)])
545545 let commonState = if (isEval)
546546 then nil
547547 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))]
548548 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
549549 let priceOld = fromX18(priceOldX18, scale8)
550550 let loss = {
551- let $t02634926516 = if (paymentInAmountAsset)
551+ let $t02639726564 = if (paymentInAmountAsset)
552552 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
553553 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
554- let amount = $t02634926516._1
555- let balance = $t02634926516._2
554+ let amount = $t02639726564._1
555+ let balance = $t02639726564._2
556556 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
557557 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
558558 }
559559 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
560560 }
561561 else throw("Strict value is not equal to itself.")
562562 }
563563
564564
565565 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
566566 let isEval = (txId == unit)
567+ let cfg = getPoolConfig()
568+ let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
569+ let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
567570 let checks = [if ((paymentAssetId == cfgLpAssetId))
568571 then true
569572 else throwErr("invalid lp asset")]
570573 if ((checks == checks))
571574 then {
572575 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
573576 then true
574577 else if ((outAssetId == cfgPriceAssetId))
575578 then false
576579 else throwErr("invalid asset")
577580 let balanceBigInt = if (outInAmountAsset)
578581 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
579582 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
583+ let outInAmountAssetDecimals = if (outInAmountAsset)
584+ then amtAssetDcm
585+ else priceAssetDcm
580586 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
581587 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
582588 let outBalance = if (outInAmountAsset)
583589 then amBalanceOld
584590 else prBalanceOld
585591 let outBalanceBigInt = toBigInt(outBalance)
586592 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
587593 let redeemedBigInt = toBigInt(paymentAmount)
588- let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
589- let $t02811828168 = takeFee(amountRaw)
590- let totalAmount = $t02811828168._1
591- let feeAmount = $t02811828168._2
592- let $t02817228398 = if (outInAmountAsset)
594+ let amountRaw = max([0, fromX18Round(fraction(balanceBigInt, (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN)), scale18), outInAmountAssetDecimals, FLOOR)])
595+ let $t02846528515 = takeFee(amountRaw)
596+ let totalAmount = $t02846528515._1
597+ let feeAmount = $t02846528515._2
598+ let $t02851928745 = if (outInAmountAsset)
593599 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
594600 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
595- let outAmAmount = $t02817228398._1
596- let outPrAmount = $t02817228398._2
597- let amBalanceNew = $t02817228398._3
598- let prBalanceNew = $t02817228398._4
601+ let outAmAmount = $t02851928745._1
602+ let outPrAmount = $t02851928745._2
603+ let amBalanceNew = $t02851928745._3
604+ let prBalanceNew = $t02851928745._4
599605 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
600606 let priceNew = fromX18(priceNewX18, scale8)
601607 let commonState = if (isEval)
602608 then nil
603609 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)]
604610 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
605611 let priceOld = fromX18(priceOldX18, scale8)
606612 let loss = {
607613 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
608614 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
609615 }
610616 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
611617 }
612618 else throw("Strict value is not equal to itself.")
613619 }
614620
615621
616622 func managerPublicKeyOrUnit () = match getString(mpk()) {
617623 case s: String =>
618624 fromBase58String(s)
619625 case _: Unit =>
620626 unit
621627 case _ =>
622628 throw("Match error")
623629 }
624630
625631
626632 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
627633 case s: String =>
628634 fromBase58String(s)
629635 case _: Unit =>
630636 unit
631637 case _ =>
632638 throw("Match error")
633639 }
634640
635641
636642 func isManager (i) = match managerPublicKeyOrUnit() {
637643 case pk: ByteVector =>
638644 (i.callerPublicKey == pk)
639645 case _: Unit =>
640646 (i.caller == this)
641647 case _ =>
642648 throw("Match error")
643649 }
644650
645651
646652 func mustManager (i) = {
647653 let pd = throw("Permission denied")
648654 match managerPublicKeyOrUnit() {
649655 case pk: ByteVector =>
650656 if ((i.callerPublicKey == pk))
651657 then true
652658 else pd
653659 case _: Unit =>
654660 if ((i.caller == this))
655661 then true
656662 else pd
657663 case _ =>
658664 throw("Match error")
659665 }
660666 }
661667
662668
663669 @Callable(i)
664670 func setManager (pendingManagerPublicKey) = {
665671 let checkCaller = mustManager(i)
666672 if ((checkCaller == checkCaller))
667673 then {
668674 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
669675 if ((checkManagerPublicKey == checkManagerPublicKey))
670676 then [StringEntry(pmpk(), pendingManagerPublicKey)]
671677 else throw("Strict value is not equal to itself.")
672678 }
673679 else throw("Strict value is not equal to itself.")
674680 }
675681
676682
677683
678684 @Callable(i)
679685 func confirmManager () = {
680686 let pm = pendingManagerPublicKeyOrUnit()
681687 let hasPM = if (isDefined(pm))
682688 then true
683689 else throw("No pending manager")
684690 if ((hasPM == hasPM))
685691 then {
686692 let checkPM = if ((i.callerPublicKey == value(pm)))
687693 then true
688694 else throw("You are not pending manager")
689695 if ((checkPM == checkPM))
690696 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
691697 else throw("Strict value is not equal to itself.")
692698 }
693699 else throw("Strict value is not equal to itself.")
694700 }
695701
696702
697703
698704 @Callable(i)
699705 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
700706 then throw("Invalid slippageTolerance passed")
701707 else {
702708 let estPut = commonPut(i, slippageTolerance, true)
703709 let emitLpAmt = estPut._2
704710 let lpAssetId = estPut._7
705711 let state = estPut._9
706712 let amDiff = estPut._10
707713 let prDiff = estPut._11
708714 let amId = estPut._12
709715 let prId = estPut._13
710716 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
711717 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
712718 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
713719 if ((currentKLp == currentKLp))
714720 then {
715721 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
716722 if ((emitInv == emitInv))
717723 then {
718724 let emitInvLegacy = match emitInv {
719725 case legacyFactoryContract: Address =>
720726 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
721727 case _ =>
722728 unit
723729 }
724730 if ((emitInvLegacy == emitInvLegacy))
725731 then {
726732 let slippageAInv = if ((amDiff > 0))
727733 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
728734 else nil
729735 if ((slippageAInv == slippageAInv))
730736 then {
731737 let slippagePInv = if ((prDiff > 0))
732738 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
733739 else nil
734740 if ((slippagePInv == slippagePInv))
735741 then {
736742 let lpTransfer = if (shouldAutoStake)
737743 then {
738744 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
739745 if ((slpStakeInv == slpStakeInv))
740746 then nil
741747 else throw("Strict value is not equal to itself.")
742748 }
743749 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
744- let $t03292633388 = refreshKLpInternal(0, 0, 0)
745- if (($t03292633388 == $t03292633388))
750+ let $t03327333735 = refreshKLpInternal(0, 0, 0)
751+ if (($t03327333735 == $t03327333735))
746752 then {
747- let updatedKLp = $t03292633388._2
748- let refreshKLpActions = $t03292633388._1
753+ let updatedKLp = $t03327333735._2
754+ let refreshKLpActions = $t03327333735._1
749755 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
750756 if ((isUpdatedKLpValid == isUpdatedKLpValid))
751757 then ((state ++ lpTransfer) ++ refreshKLpActions)
752758 else throw("Strict value is not equal to itself.")
753759 }
754760 else throw("Strict value is not equal to itself.")
755761 }
756762 else throw("Strict value is not equal to itself.")
757763 }
758764 else throw("Strict value is not equal to itself.")
759765 }
760766 else throw("Strict value is not equal to itself.")
761767 }
762768 else throw("Strict value is not equal to itself.")
763769 }
764770 else throw("Strict value is not equal to itself.")
765771 }
766772
767773
768774
769775 @Callable(i)
770776 func putForFree (maxSlippage) = if ((0 > maxSlippage))
771777 then throw("Invalid value passed")
772778 else {
773779 let estPut = commonPut(i, maxSlippage, false)
774780 let state = estPut._9
775781 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
776782 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
777783 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
778784 if ((currentKLp == currentKLp))
779785 then {
780- let $t03395034015 = refreshKLpInternal(0, 0, 0)
781- let refreshKLpActions = $t03395034015._1
782- let updatedKLp = $t03395034015._2
786+ let $t03429734362 = refreshKLpInternal(0, 0, 0)
787+ let refreshKLpActions = $t03429734362._1
788+ let updatedKLp = $t03429734362._2
783789 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
784790 if ((isUpdatedKLpValid == isUpdatedKLpValid))
785791 then (state ++ refreshKLpActions)
786792 else throw("Strict value is not equal to itself.")
787793 }
788794 else throw("Strict value is not equal to itself.")
789795 }
790796
791797
792798
793799 @Callable(i)
794800 func putOneTkn (minOutAmount,autoStake) = {
795801 let isPoolOneTokenOperationsDisabled = {
796802 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
797803 if ($isInstanceOf(@, "Boolean"))
798804 then @
799805 else throw(($getType(@) + " couldn't be cast to Boolean"))
800806 }
801807 let isPutDisabled = if (if (if (isGlobalShutdown())
802808 then true
803809 else (cfgPoolStatus == PoolPutDisabled))
804810 then true
805811 else (cfgPoolStatus == PoolShutdown))
806812 then true
807813 else isPoolOneTokenOperationsDisabled
808814 let checks = [if (if (!(isPutDisabled))
809815 then true
810816 else isManager(i))
811817 then true
812818 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
813819 then true
814820 else throwErr("exactly 1 payment are expected")]
815821 if ((checks == checks))
816822 then {
817823 let payment = i.payments[0]
818824 let paymentAssetId = payment.assetId
819825 let paymentAmountRaw = payment.amount
820826 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
821827 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
822828 else if ((paymentAssetId == cfgPriceAssetId))
823829 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
824830 else throwErr("payment asset is not supported")
825831 let userAddress = i.caller
826832 let txId = i.transactionId
827- let $t03520035352 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
828- if (($t03520035352 == $t03520035352))
833+ let $t03554735699 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
834+ if (($t03554735699 == $t03554735699))
829835 then {
830- let paymentInAmountAsset = $t03520035352._5
831- let bonus = $t03520035352._4
832- let feeAmount = $t03520035352._3
833- let commonState = $t03520035352._2
834- let emitAmountEstimated = $t03520035352._1
836+ let paymentInAmountAsset = $t03554735699._5
837+ let bonus = $t03554735699._4
838+ let feeAmount = $t03554735699._3
839+ let commonState = $t03554735699._2
840+ let emitAmountEstimated = $t03554735699._1
835841 let emitAmount = if (if ((minOutAmount > 0))
836842 then (minOutAmount > emitAmountEstimated)
837843 else false)
838844 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
839845 else emitAmountEstimated
840846 let emitInv = emit(emitAmount)
841847 if ((emitInv == emitInv))
842848 then {
843849 let lpTransfer = if (autoStake)
844850 then {
845851 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
846852 if ((stakeInv == stakeInv))
847853 then nil
848854 else throw("Strict value is not equal to itself.")
849855 }
850856 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
851857 let sendFee = if ((feeAmount > 0))
852858 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
853859 else nil
854- let $t03593836135 = if ((this == feeCollectorAddress))
860+ let $t03628536482 = if ((this == feeCollectorAddress))
855861 then $Tuple2(0, 0)
856862 else if (paymentInAmountAsset)
857863 then $Tuple2(-(feeAmount), 0)
858864 else $Tuple2(0, -(feeAmount))
859- let amountAssetBalanceDelta = $t03593836135._1
860- let priceAssetBalanceDelta = $t03593836135._2
861- let $t03613836246 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
862- let refreshKLpActions = $t03613836246._1
863- let updatedKLp = $t03613836246._2
865+ let amountAssetBalanceDelta = $t03628536482._1
866+ let priceAssetBalanceDelta = $t03628536482._2
867+ let $t03648536593 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
868+ let refreshKLpActions = $t03648536593._1
869+ let updatedKLp = $t03648536593._2
864870 let kLp = value(getString(keyKLp))
865871 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
866872 if ((isUpdatedKLpValid == isUpdatedKLpValid))
867873 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
868874 else throw("Strict value is not equal to itself.")
869875 }
870876 else throw("Strict value is not equal to itself.")
871877 }
872878 else throw("Strict value is not equal to itself.")
873879 }
874880 else throw("Strict value is not equal to itself.")
875881 }
876882
877883
878884
879885 @Callable(i)
880886 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
881- let $t03655236709 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
882- let emitAmountEstimated = $t03655236709._1
883- let commonState = $t03655236709._2
884- let feeAmount = $t03655236709._3
885- let bonus = $t03655236709._4
886- let paymentInAmountAsset = $t03655236709._5
887+ let $t03689937056 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
888+ let emitAmountEstimated = $t03689937056._1
889+ let commonState = $t03689937056._2
890+ let feeAmount = $t03689937056._3
891+ let bonus = $t03689937056._4
892+ let paymentInAmountAsset = $t03689937056._5
887893 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
888894 }
889895
890896
891897
892898 @Callable(i)
893899 func getOneTkn (outAssetIdStr,minOutAmount) = {
894900 let isPoolOneTokenOperationsDisabled = {
895901 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
896902 if ($isInstanceOf(@, "Boolean"))
897903 then @
898904 else throw(($getType(@) + " couldn't be cast to Boolean"))
899905 }
900906 let isGetDisabled = if (if (isGlobalShutdown())
901907 then true
902908 else (cfgPoolStatus == PoolShutdown))
903909 then true
904910 else isPoolOneTokenOperationsDisabled
905911 let checks = [if (if (!(isGetDisabled))
906912 then true
907913 else isManager(i))
908914 then true
909915 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
910916 then true
911917 else throwErr("exactly 1 payment are expected")]
912918 if ((checks == checks))
913919 then {
914920 let outAssetId = parseAssetId(outAssetIdStr)
915921 let payment = i.payments[0]
916922 let paymentAssetId = payment.assetId
917923 let paymentAmount = payment.amount
918924 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
919925 let userAddress = i.caller
920926 let txId = i.transactionId
921- let $t03760337756 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
922- if (($t03760337756 == $t03760337756))
927+ let $t03795038103 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
928+ if (($t03795038103 == $t03795038103))
923929 then {
924- let outInAmountAsset = $t03760337756._5
925- let bonus = $t03760337756._4
926- let feeAmount = $t03760337756._3
927- let commonState = $t03760337756._2
928- let amountEstimated = $t03760337756._1
930+ let outInAmountAsset = $t03795038103._5
931+ let bonus = $t03795038103._4
932+ let feeAmount = $t03795038103._3
933+ let commonState = $t03795038103._2
934+ let amountEstimated = $t03795038103._1
929935 let amount = if (if ((minOutAmount > 0))
930936 then (minOutAmount > amountEstimated)
931937 else false)
932938 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
933939 else amountEstimated
934940 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
935941 if ((burnInv == burnInv))
936942 then {
937943 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
938944 let sendFee = if ((feeAmount > 0))
939945 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
940946 else nil
941- let $t03825638503 = {
947+ let $t03860338850 = {
942948 let feeAmountForCalc = if ((this == feeCollectorAddress))
943949 then 0
944950 else feeAmount
945951 if (outInAmountAsset)
946952 then $Tuple2(-((amount + feeAmountForCalc)), 0)
947953 else $Tuple2(0, -((amount + feeAmountForCalc)))
948954 }
949- let amountAssetBalanceDelta = $t03825638503._1
950- let priceAssetBalanceDelta = $t03825638503._2
951- let $t03850638614 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
952- let refreshKLpActions = $t03850638614._1
953- let updatedKLp = $t03850638614._2
955+ let amountAssetBalanceDelta = $t03860338850._1
956+ let priceAssetBalanceDelta = $t03860338850._2
957+ let $t03885338961 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
958+ let refreshKLpActions = $t03885338961._1
959+ let updatedKLp = $t03885338961._2
954960 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
955961 if ((isUpdatedKLpValid == isUpdatedKLpValid))
956962 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
957963 else throw("Strict value is not equal to itself.")
958964 }
959965 else throw("Strict value is not equal to itself.")
960966 }
961967 else throw("Strict value is not equal to itself.")
962968 }
963969 else throw("Strict value is not equal to itself.")
964970 }
965971
966972
967973
968974 @Callable(i)
969975 func getOneTknREADONLY (outAssetId,paymentAmount) = {
970- let $t03887139027 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
971- let amountEstimated = $t03887139027._1
972- let commonState = $t03887139027._2
973- let feeAmount = $t03887139027._3
974- let bonus = $t03887139027._4
975- let outInAmountAsset = $t03887139027._5
976+ let $t03921839374 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
977+ let amountEstimated = $t03921839374._1
978+ let commonState = $t03921839374._2
979+ let feeAmount = $t03921839374._3
980+ let bonus = $t03921839374._4
981+ let outInAmountAsset = $t03921839374._5
976982 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
977983 }
978984
979985
980986
981987 @Callable(i)
982988 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
983989 let isPoolOneTokenOperationsDisabled = {
984990 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
985991 if ($isInstanceOf(@, "Boolean"))
986992 then @
987993 else throw(($getType(@) + " couldn't be cast to Boolean"))
988994 }
989995 let isGetDisabled = if (if (isGlobalShutdown())
990996 then true
991997 else (cfgPoolStatus == PoolShutdown))
992998 then true
993999 else isPoolOneTokenOperationsDisabled
9941000 let checks = [if (if (!(isGetDisabled))
9951001 then true
9961002 else isManager(i))
9971003 then true
9981004 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
9991005 then true
10001006 else throwErr("no payments are expected")]
10011007 if ((checks == checks))
10021008 then {
10031009 let outAssetId = parseAssetId(outAssetIdStr)
10041010 let userAddress = i.caller
10051011 let txId = i.transactionId
10061012 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
10071013 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10081014 if ((unstakeInv == unstakeInv))
10091015 then {
1010- let $t03992940080 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1011- if (($t03992940080 == $t03992940080))
1016+ let $t04027640427 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1017+ if (($t04027640427 == $t04027640427))
10121018 then {
1013- let outInAmountAsset = $t03992940080._5
1014- let bonus = $t03992940080._4
1015- let feeAmount = $t03992940080._3
1016- let commonState = $t03992940080._2
1017- let amountEstimated = $t03992940080._1
1019+ let outInAmountAsset = $t04027640427._5
1020+ let bonus = $t04027640427._4
1021+ let feeAmount = $t04027640427._3
1022+ let commonState = $t04027640427._2
1023+ let amountEstimated = $t04027640427._1
10181024 let amount = if (if ((minOutAmount > 0))
10191025 then (minOutAmount > amountEstimated)
10201026 else false)
10211027 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
10221028 else amountEstimated
10231029 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10241030 if ((burnInv == burnInv))
10251031 then {
10261032 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
10271033 let sendFee = if ((feeAmount > 0))
10281034 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10291035 else nil
1030- let $t04057540822 = {
1036+ let $t04092241169 = {
10311037 let feeAmountForCalc = if ((this == feeCollectorAddress))
10321038 then 0
10331039 else feeAmount
10341040 if (outInAmountAsset)
10351041 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10361042 else $Tuple2(0, -((amount + feeAmountForCalc)))
10371043 }
1038- let amountAssetBalanceDelta = $t04057540822._1
1039- let priceAssetBalanceDelta = $t04057540822._2
1040- let $t04082540933 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1041- let refreshKLpActions = $t04082540933._1
1042- let updatedKLp = $t04082540933._2
1044+ let amountAssetBalanceDelta = $t04092241169._1
1045+ let priceAssetBalanceDelta = $t04092241169._2
1046+ let $t04117241280 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1047+ let refreshKLpActions = $t04117241280._1
1048+ let updatedKLp = $t04117241280._2
10431049 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10441050 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10451051 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10461052 else throw("Strict value is not equal to itself.")
10471053 }
10481054 else throw("Strict value is not equal to itself.")
10491055 }
10501056 else throw("Strict value is not equal to itself.")
10511057 }
10521058 else throw("Strict value is not equal to itself.")
10531059 }
10541060 else throw("Strict value is not equal to itself.")
10551061 }
10561062
10571063
10581064
10591065 @Callable(i)
10601066 func get () = {
10611067 let res = commonGet(i)
10621068 let outAmtAmt = res._1
10631069 let outPrAmt = res._2
10641070 let pmtAmt = res._3
10651071 let pmtAssetId = res._4
10661072 let state = res._5
10671073 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10681074 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10691075 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10701076 then {
1071- let $t04188141963 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1072- let refreshKLpActions = $t04188141963._1
1073- let updatedKLp = $t04188141963._2
1077+ let $t04222842310 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1078+ let refreshKLpActions = $t04222842310._1
1079+ let updatedKLp = $t04222842310._2
10741080 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10751081 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10761082 then (state ++ refreshKLpActions)
10771083 else throw("Strict value is not equal to itself.")
10781084 }
10791085 else throw("Strict value is not equal to itself.")
10801086 }
10811087
10821088
10831089
10841090 @Callable(i)
10851091 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
10861092 let res = commonGet(i)
10871093 let outAmAmt = res._1
10881094 let outPrAmt = res._2
10891095 let pmtAmt = res._3
10901096 let pmtAssetId = res._4
10911097 let state = res._5
10921098 if ((noLessThenAmtAsset > outAmAmt))
10931099 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
10941100 else if ((noLessThenPriceAsset > outPrAmt))
10951101 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
10961102 else {
10971103 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10981104 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10991105 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11001106 then {
1101- let $t04291442995 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1102- let refreshKLpActions = $t04291442995._1
1103- let updatedKLp = $t04291442995._2
1107+ let $t04326143342 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1108+ let refreshKLpActions = $t04326143342._1
1109+ let updatedKLp = $t04326143342._2
11041110 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11051111 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11061112 then (state ++ refreshKLpActions)
11071113 else throw("Strict value is not equal to itself.")
11081114 }
11091115 else throw("Strict value is not equal to itself.")
11101116 }
11111117 }
11121118
11131119
11141120
11151121 @Callable(i)
11161122 func unstakeAndGet (amount) = {
11171123 let checkPayments = if ((size(i.payments) != 0))
11181124 then throw("No payments are expected")
11191125 else true
11201126 if ((checkPayments == checkPayments))
11211127 then {
11221128 let cfg = getPoolConfig()
11231129 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11241130 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11251131 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
11261132 if ((unstakeInv == unstakeInv))
11271133 then {
11281134 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
11291135 let outAmAmt = res._1
11301136 let outPrAmt = res._2
11311137 let poolStatus = parseIntValue(res._9)
11321138 let state = res._10
11331139 let checkPoolStatus = if (if (isGlobalShutdown())
11341140 then true
11351141 else (poolStatus == PoolShutdown))
11361142 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
11371143 else true
11381144 if ((checkPoolStatus == checkPoolStatus))
11391145 then {
11401146 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11411147 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11421148 then {
1143- let $t04411844199 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1144- let refreshKLpActions = $t04411844199._1
1145- let updatedKLp = $t04411844199._2
1149+ let $t04446544546 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1150+ let refreshKLpActions = $t04446544546._1
1151+ let updatedKLp = $t04446544546._2
11461152 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11471153 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11481154 then (state ++ refreshKLpActions)
11491155 else throw("Strict value is not equal to itself.")
11501156 }
11511157 else throw("Strict value is not equal to itself.")
11521158 }
11531159 else throw("Strict value is not equal to itself.")
11541160 }
11551161 else throw("Strict value is not equal to itself.")
11561162 }
11571163 else throw("Strict value is not equal to itself.")
11581164 }
11591165
11601166
11611167
11621168 @Callable(i)
11631169 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
11641170 let isGetDisabled = if (isGlobalShutdown())
11651171 then true
11661172 else (cfgPoolStatus == PoolShutdown)
11671173 let checks = [if (!(isGetDisabled))
11681174 then true
11691175 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11701176 then true
11711177 else throw("no payments are expected")]
11721178 if ((checks == checks))
11731179 then {
11741180 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11751181 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11761182 if ((unstakeInv == unstakeInv))
11771183 then {
11781184 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11791185 let outAmAmt = res._1
11801186 let outPrAmt = res._2
11811187 let state = res._10
11821188 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11831189 then true
11841190 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11851191 then true
11861192 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11871193 if ((checkAmounts == checkAmounts))
11881194 then {
11891195 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11901196 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11911197 then {
1192- let $t04549145572 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1193- let refreshKLpActions = $t04549145572._1
1194- let updatedKLp = $t04549145572._2
1198+ let $t04583845919 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1199+ let refreshKLpActions = $t04583845919._1
1200+ let updatedKLp = $t04583845919._2
11951201 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11961202 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11971203 then (state ++ refreshKLpActions)
11981204 else throw("Strict value is not equal to itself.")
11991205 }
12001206 else throw("Strict value is not equal to itself.")
12011207 }
12021208 else throw("Strict value is not equal to itself.")
12031209 }
12041210 else throw("Strict value is not equal to itself.")
12051211 }
12061212 else throw("Strict value is not equal to itself.")
12071213 }
12081214
12091215
12101216
12111217 @Callable(i)
12121218 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
12131219 then throw("permissions denied")
12141220 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
12151221
12161222
12171223
12181224 @Callable(i)
12191225 func refreshKLp () = {
12201226 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
12211227 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
12221228 then unit
12231229 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
12241230 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12251231 then {
12261232 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1227- let $t04675946823 = refreshKLpInternal(0, 0, 0)
1228- let kLpUpdateActions = $t04675946823._1
1229- let updatedKLp = $t04675946823._2
1233+ let $t04710647170 = refreshKLpInternal(0, 0, 0)
1234+ let kLpUpdateActions = $t04710647170._1
1235+ let updatedKLp = $t04710647170._2
12301236 let actions = if ((kLp != updatedKLp))
12311237 then kLpUpdateActions
12321238 else throwErr("nothing to refresh")
12331239 $Tuple2(actions, toString(updatedKLp))
12341240 }
12351241 else throw("Strict value is not equal to itself.")
12361242 }
12371243
12381244
12391245
12401246 @Callable(i)
12411247 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
12421248
12431249
12441250
12451251 @Callable(i)
12461252 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
12471253
12481254
12491255
12501256 @Callable(i)
12511257 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
12521258 let prices = calcPrices(amAmt, prAmt, lpAmt)
12531259 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
12541260 }
12551261
12561262
12571263
12581264 @Callable(i)
12591265 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
12601266
12611267
12621268
12631269 @Callable(i)
12641270 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
12651271
12661272
12671273
12681274 @Callable(i)
12691275 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
12701276
12711277
12721278
12731279 @Callable(i)
12741280 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
12751281
12761282
12771283
12781284 @Callable(i)
12791285 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
12801286 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
12811287 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
12821288 }
12831289
12841290
12851291
12861292 @Callable(i)
12871293 func statsREADONLY () = {
12881294 let cfg = getPoolConfig()
12891295 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12901296 let amtAssetId = cfg[idxAmtAssetId]
12911297 let priceAssetId = cfg[idxPriceAssetId]
12921298 let iAmtAssetId = cfg[idxIAmtAssetId]
12931299 let iPriceAssetId = cfg[idxIPriceAssetId]
12941300 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12951301 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12961302 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12971303 let accAmtAssetBalance = getAccBalance(amtAssetId)
12981304 let accPriceAssetBalance = getAccBalance(priceAssetId)
12991305 let pricesList = if ((poolLPBalance == 0))
13001306 then [zeroBigInt, zeroBigInt, zeroBigInt]
13011307 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
13021308 let curPrice = 0
13031309 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
13041310 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
13051311 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
13061312 $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))
13071313 }
13081314
13091315
13101316
13111317 @Callable(i)
13121318 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
13131319 let cfg = getPoolConfig()
13141320 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13151321 let amAssetIdStr = cfg[idxAmtAssetId]
13161322 let amAssetId = fromBase58String(amAssetIdStr)
13171323 let prAssetIdStr = cfg[idxPriceAssetId]
13181324 let prAssetId = fromBase58String(prAssetIdStr)
13191325 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13201326 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13211327 let poolStatus = cfg[idxPoolStatus]
13221328 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13231329 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
13241330 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
13251331 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
13261332 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
13271333 let curPriceX18 = if ((poolLPBalance == 0))
13281334 then zeroBigInt
13291335 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
13301336 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
13311337 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
13321338 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
13331339 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13341340 let calcLpAmt = estPut._1
13351341 let curPriceCalc = estPut._3
13361342 let amBalance = estPut._4
13371343 let prBalance = estPut._5
13381344 let lpEmission = estPut._6
13391345 $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))
13401346 }
13411347
13421348
13431349
13441350 @Callable(i)
13451351 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
13461352 let cfg = getPoolConfig()
13471353 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13481354 let amAssetIdStr = cfg[idxAmtAssetId]
13491355 let amAssetId = fromBase58String(amAssetIdStr)
13501356 let prAssetIdStr = cfg[idxPriceAssetId]
13511357 let prAssetId = fromBase58String(prAssetIdStr)
13521358 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13531359 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13541360 let poolStatus = cfg[idxPoolStatus]
13551361 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13561362 let amBalanceRaw = getAccBalance(amAssetIdStr)
13571363 let prBalanceRaw = getAccBalance(prAssetIdStr)
13581364 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
13591365 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
13601366 let curPriceX18 = if ((poolLPBalance == 0))
13611367 then zeroBigInt
13621368 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
13631369 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
13641370 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
13651371 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
13661372 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13671373 let calcLpAmt = estPut._1
13681374 let curPriceCalc = estPut._3
13691375 let amBalance = estPut._4
13701376 let prBalance = estPut._5
13711377 let lpEmission = estPut._6
13721378 $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))
13731379 }
13741380
13751381
13761382
13771383 @Callable(i)
13781384 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
13791385 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
13801386 let outAmAmt = res._1
13811387 let outPrAmt = res._2
13821388 let amBalance = res._5
13831389 let prBalance = res._6
13841390 let lpEmission = res._7
13851391 let curPrice = res._8
13861392 let poolStatus = parseIntValue(res._9)
13871393 $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))
13881394 }
13891395
13901396
13911397 @Verifier(tx)
13921398 func verify () = {
13931399 let targetPublicKey = match managerPublicKeyOrUnit() {
13941400 case pk: ByteVector =>
13951401 pk
13961402 case _: Unit =>
13971403 tx.senderPublicKey
13981404 case _ =>
13991405 throw("Match error")
14001406 }
14011407 match tx {
14021408 case order: Order =>
14031409 let matcherPub = getMatcherPubOrFail()
14041410 let orderValid = validateMatcherOrderAllowed(order)
14051411 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14061412 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
14071413 if (if (if (orderValid)
14081414 then senderValid
14091415 else false)
14101416 then matcherValid
14111417 else false)
14121418 then true
14131419 else throwOrderError(orderValid, senderValid, matcherValid)
14141420 case s: SetScriptTransaction =>
14151421 let newHash = blake2b256(value(s.script))
14161422 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
14171423 let currentHash = scriptHash(this)
14181424 if (if ((allowedHash == newHash))
14191425 then (currentHash != newHash)
14201426 else false)
14211427 then true
14221428 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14231429 case _ =>
14241430 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14251431 }
14261432 }
14271433

github/deemru/w8io/026f985 
178.45 ms