tx · A2PtpnEqYV4tJUkjeLUDB5V6v6EiaquacwHEyUChnnHi

3N4ig26JgHMJuLfZ1cdm2Rvy7oWg7pMnxjy:  -0.03500000 Waves

2022.12.16 12:16 [2362664] smart account 3N4ig26JgHMJuLfZ1cdm2Rvy7oWg7pMnxjy > SELF 0.00000000 Waves

{ "type": 13, "id": "A2PtpnEqYV4tJUkjeLUDB5V6v6EiaquacwHEyUChnnHi", "fee": 3500000, "feeAssetId": null, "timestamp": 1671182154567, "version": 1, "sender": "3N4ig26JgHMJuLfZ1cdm2Rvy7oWg7pMnxjy", "senderPublicKey": "1Q1fBqTqxTRfxwxvQhDYXVLbyoJeM9hnAHUUhKLbQ3K", "proofs": [ "Tj18mt7ZtJPxoCHaLnytvGVntZJC4s8vHuSK48S8SttPQFguT575JkCEeseEMaW1gNV4saDzDkiiT8qDMfoJyuL" ], "script": "base64:BgKDLQgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlk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JkTgIEVW5pdAgFAmdBD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yBAJkTgUCZ0EDCQABAgUCZE4CBU9yZGVyBAJkcwUCZE4EAmdECQECYU8ABAJhQgkBAmRyAQUCZHMEAmFDCQD0AwMIBQJkcwlib2R5Qnl0ZXMJAJEDAggFAmRzBnByb29mcwAACAUCZHMPc2VuZGVyUHVibGljS2V5BAJhRAkA9AMDCAUCZHMJYm9keUJ5dGVzCQCRAwIIBQJkcwZwcm9vZnMAAQUCZ0QDAwMFAmFCBQJhQwcFAmFEBwYJAQJhQQMFAmFCBQJhQwUCYUQDCQABAgUCZE4CFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJlUQUCZE4EAmdFCQD2AwEJAQV2YWx1ZQEIBQJlUQZzY3JpcHQEAmdGCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUwJAQJheQAEAmdHCQDxBwEFBHRoaXMDAwkAAAIFAmdGBQJnRQkBAiE9AgUCZ0cFAmdFBwYJAPQDAwgFAmdBCWJvZHlCeXRlcwkAkQMCCAUCZ0EGcHJvb2ZzAAAFAmdDCQD0AwMIBQJnQQlib2R5Qnl0ZXMJAJEDAggFAmdBBnByb29mcwAABQJnQ3+fCEw=", "chainId": 84, "height": 2362664, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AawYirNS8v4vbzykc3DCLH9fQY6yk1R1ANFrpFU8K3KN Next: qCnC2fr4XrXYcrL7b8dxUwCCgAPardLSBccS2juQsZQ 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 = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
292- let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
291+ let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
292+ let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
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 $t02080121013 = if ((order.orderType == Buy))
417+ let $t02077720989 = if ((order.orderType == Buy))
418418 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
419419 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
420- let amountAssetBalanceDelta = $t02080121013._1
421- let priceAssetBalanceDelta = $t02080121013._2
420+ let amountAssetBalanceDelta = $t02077720989._1
421+ let priceAssetBalanceDelta = $t02077720989._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 $t02148421584 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435- let unusedActions = $t02148421584._1
436- let kLpNew = $t02148421584._2
434+ let $t02146021560 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435+ let unusedActions = $t02146021560._1
436+ let kLpNew = $t02146021560._2
437437 let isOrderValid = (kLpNew >= kLp)
438438 isOrderValid
439439 }
509509 else if ((paymentAssetId == cfgPriceAssetId))
510510 then false
511511 else throwErr("invalid asset")
512- let $t02426924562 = if (isEval)
512+ let $t02424524538 = 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 = $t02426924562._1
518- let priceBalanceOld = $t02426924562._2
519- let $t02456624715 = if (paymentInAmountAsset)
517+ let amountBalanceOld = $t02424524538._1
518+ let priceBalanceOld = $t02424524538._2
519+ let $t02454224691 = if (paymentInAmountAsset)
520520 then $Tuple2(paymentAmountRaw, 0)
521521 else $Tuple2(0, paymentAmountRaw)
522- let amountAssetAmountRaw = $t02456624715._1
523- let priceAssetAmountRaw = $t02456624715._2
522+ let amountAssetAmountRaw = $t02454224691._1
523+ let priceAssetAmountRaw = $t02454224691._2
524524 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
525525 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
526- let $t02483724896 = takeFee(paymentAmountRaw)
527- let paymentAmount = $t02483724896._1
528- let feeAmount = $t02483724896._2
526+ let $t02481324872 = takeFee(paymentAmountRaw)
527+ let paymentAmount = $t02481324872._1
528+ let feeAmount = $t02481324872._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, fromX18Round(fraction(supplyBigInt, (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18), scale18), scale8, FLOOR)])
544+ let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
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 $t02639726564 = if (paymentInAmountAsset)
551+ let $t02634926516 = if (paymentInAmountAsset)
552552 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
553553 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
554- let amount = $t02639726564._1
555- let balance = $t02639726564._2
554+ let amount = $t02634926516._1
555+ let balance = $t02634926516._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])
570567 let checks = [if ((paymentAssetId == cfgLpAssetId))
571568 then true
572569 else throwErr("invalid lp asset")]
580577 let balanceBigInt = if (outInAmountAsset)
581578 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
582579 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
583- let outInAmountAssetDecimals = if (outInAmountAsset)
584- then amtAssetDcm
585- else priceAssetDcm
586580 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
587581 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
588582 let outBalance = if (outInAmountAsset)
591585 let outBalanceBigInt = toBigInt(outBalance)
592586 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
593587 let redeemedBigInt = toBigInt(paymentAmount)
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)
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)
599593 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
600594 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
601- let outAmAmount = $t02851928745._1
602- let outPrAmount = $t02851928745._2
603- let amBalanceNew = $t02851928745._3
604- let prBalanceNew = $t02851928745._4
595+ let outAmAmount = $t02817228398._1
596+ let outPrAmount = $t02817228398._2
597+ let amBalanceNew = $t02817228398._3
598+ let prBalanceNew = $t02817228398._4
605599 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
606600 let priceNew = fromX18(priceNewX18, scale8)
607601 let commonState = if (isEval)
747741 else throw("Strict value is not equal to itself.")
748742 }
749743 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
750- let $t03327333735 = refreshKLpInternal(0, 0, 0)
751- if (($t03327333735 == $t03327333735))
744+ let $t03292633388 = refreshKLpInternal(0, 0, 0)
745+ if (($t03292633388 == $t03292633388))
752746 then {
753- let updatedKLp = $t03327333735._2
754- let refreshKLpActions = $t03327333735._1
747+ let updatedKLp = $t03292633388._2
748+ let refreshKLpActions = $t03292633388._1
755749 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
756750 if ((isUpdatedKLpValid == isUpdatedKLpValid))
757751 then ((state ++ lpTransfer) ++ refreshKLpActions)
783777 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
784778 if ((currentKLp == currentKLp))
785779 then {
786- let $t03429734362 = refreshKLpInternal(0, 0, 0)
787- let refreshKLpActions = $t03429734362._1
788- let updatedKLp = $t03429734362._2
780+ let $t03395034015 = refreshKLpInternal(0, 0, 0)
781+ let refreshKLpActions = $t03395034015._1
782+ let updatedKLp = $t03395034015._2
789783 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
790784 if ((isUpdatedKLpValid == isUpdatedKLpValid))
791785 then (state ++ refreshKLpActions)
830824 else throwErr("payment asset is not supported")
831825 let userAddress = i.caller
832826 let txId = i.transactionId
833- let $t03554735699 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
834- if (($t03554735699 == $t03554735699))
827+ let $t03520035352 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
828+ if (($t03520035352 == $t03520035352))
835829 then {
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
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
841835 let emitAmount = if (if ((minOutAmount > 0))
842836 then (minOutAmount > emitAmountEstimated)
843837 else false)
857851 let sendFee = if ((feeAmount > 0))
858852 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
859853 else nil
860- let $t03628536482 = if ((this == feeCollectorAddress))
854+ let $t03593836135 = if ((this == feeCollectorAddress))
861855 then $Tuple2(0, 0)
862856 else if (paymentInAmountAsset)
863857 then $Tuple2(-(feeAmount), 0)
864858 else $Tuple2(0, -(feeAmount))
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
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
870864 let kLp = value(getString(keyKLp))
871865 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
872866 if ((isUpdatedKLpValid == isUpdatedKLpValid))
884878
885879 @Callable(i)
886880 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
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
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
893887 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
894888 }
895889
924918 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
925919 let userAddress = i.caller
926920 let txId = i.transactionId
927- let $t03795038103 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
928- if (($t03795038103 == $t03795038103))
921+ let $t03760337756 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
922+ if (($t03760337756 == $t03760337756))
929923 then {
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
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
935929 let amount = if (if ((minOutAmount > 0))
936930 then (minOutAmount > amountEstimated)
937931 else false)
944938 let sendFee = if ((feeAmount > 0))
945939 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
946940 else nil
947- let $t03860338850 = {
941+ let $t03825638503 = {
948942 let feeAmountForCalc = if ((this == feeCollectorAddress))
949943 then 0
950944 else feeAmount
952946 then $Tuple2(-((amount + feeAmountForCalc)), 0)
953947 else $Tuple2(0, -((amount + feeAmountForCalc)))
954948 }
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
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
960954 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
961955 if ((isUpdatedKLpValid == isUpdatedKLpValid))
962956 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
973967
974968 @Callable(i)
975969 func getOneTknREADONLY (outAssetId,paymentAmount) = {
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
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
982976 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
983977 }
984978
10131007 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10141008 if ((unstakeInv == unstakeInv))
10151009 then {
1016- let $t04027640427 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1017- if (($t04027640427 == $t04027640427))
1010+ let $t03992940080 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1011+ if (($t03992940080 == $t03992940080))
10181012 then {
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
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
10241018 let amount = if (if ((minOutAmount > 0))
10251019 then (minOutAmount > amountEstimated)
10261020 else false)
10331027 let sendFee = if ((feeAmount > 0))
10341028 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10351029 else nil
1036- let $t04092241169 = {
1030+ let $t04057540822 = {
10371031 let feeAmountForCalc = if ((this == feeCollectorAddress))
10381032 then 0
10391033 else feeAmount
10411035 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10421036 else $Tuple2(0, -((amount + feeAmountForCalc)))
10431037 }
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
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
10491043 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10501044 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10511045 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10741068 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10751069 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10761070 then {
1077- let $t04222842310 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1078- let refreshKLpActions = $t04222842310._1
1079- let updatedKLp = $t04222842310._2
1071+ let $t04188141963 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1072+ let refreshKLpActions = $t04188141963._1
1073+ let updatedKLp = $t04188141963._2
10801074 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10811075 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10821076 then (state ++ refreshKLpActions)
11041098 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11051099 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11061100 then {
1107- let $t04326143342 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1108- let refreshKLpActions = $t04326143342._1
1109- let updatedKLp = $t04326143342._2
1101+ let $t04291442995 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1102+ let refreshKLpActions = $t04291442995._1
1103+ let updatedKLp = $t04291442995._2
11101104 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11111105 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11121106 then (state ++ refreshKLpActions)
11461140 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11471141 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11481142 then {
1149- let $t04446544546 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1150- let refreshKLpActions = $t04446544546._1
1151- let updatedKLp = $t04446544546._2
1143+ let $t04411844199 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1144+ let refreshKLpActions = $t04411844199._1
1145+ let updatedKLp = $t04411844199._2
11521146 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11531147 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11541148 then (state ++ refreshKLpActions)
11951189 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11961190 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11971191 then {
1198- let $t04583845919 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1199- let refreshKLpActions = $t04583845919._1
1200- let updatedKLp = $t04583845919._2
1192+ let $t04549145572 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1193+ let refreshKLpActions = $t04549145572._1
1194+ let updatedKLp = $t04549145572._2
12011195 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12021196 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12031197 then (state ++ refreshKLpActions)
12301224 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12311225 then {
12321226 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1233- let $t04710647170 = refreshKLpInternal(0, 0, 0)
1234- let kLpUpdateActions = $t04710647170._1
1235- let updatedKLp = $t04710647170._2
1227+ let $t04675946823 = refreshKLpInternal(0, 0, 0)
1228+ let kLpUpdateActions = $t04675946823._1
1229+ let updatedKLp = $t04675946823._2
12361230 let actions = if ((kLp != updatedKLp))
12371231 then kLpUpdateActions
12381232 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 = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
292- let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
291+ let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
292+ let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
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 $t02080121013 = if ((order.orderType == Buy))
417+ let $t02077720989 = if ((order.orderType == Buy))
418418 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
419419 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
420- let amountAssetBalanceDelta = $t02080121013._1
421- let priceAssetBalanceDelta = $t02080121013._2
420+ let amountAssetBalanceDelta = $t02077720989._1
421+ let priceAssetBalanceDelta = $t02077720989._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 $t02148421584 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435- let unusedActions = $t02148421584._1
436- let kLpNew = $t02148421584._2
434+ let $t02146021560 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
435+ let unusedActions = $t02146021560._1
436+ let kLpNew = $t02146021560._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 $t02426924562 = if (isEval)
512+ let $t02424524538 = 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 = $t02426924562._1
518- let priceBalanceOld = $t02426924562._2
519- let $t02456624715 = if (paymentInAmountAsset)
517+ let amountBalanceOld = $t02424524538._1
518+ let priceBalanceOld = $t02424524538._2
519+ let $t02454224691 = if (paymentInAmountAsset)
520520 then $Tuple2(paymentAmountRaw, 0)
521521 else $Tuple2(0, paymentAmountRaw)
522- let amountAssetAmountRaw = $t02456624715._1
523- let priceAssetAmountRaw = $t02456624715._2
522+ let amountAssetAmountRaw = $t02454224691._1
523+ let priceAssetAmountRaw = $t02454224691._2
524524 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
525525 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
526- let $t02483724896 = takeFee(paymentAmountRaw)
527- let paymentAmount = $t02483724896._1
528- let feeAmount = $t02483724896._2
526+ let $t02481324872 = takeFee(paymentAmountRaw)
527+ let paymentAmount = $t02481324872._1
528+ let feeAmount = $t02481324872._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, fromX18Round(fraction(supplyBigInt, (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18), scale18), scale8, FLOOR)])
544+ let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
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 $t02639726564 = if (paymentInAmountAsset)
551+ let $t02634926516 = if (paymentInAmountAsset)
552552 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
553553 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
554- let amount = $t02639726564._1
555- let balance = $t02639726564._2
554+ let amount = $t02634926516._1
555+ let balance = $t02634926516._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])
570567 let checks = [if ((paymentAssetId == cfgLpAssetId))
571568 then true
572569 else throwErr("invalid lp asset")]
573570 if ((checks == checks))
574571 then {
575572 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
576573 then true
577574 else if ((outAssetId == cfgPriceAssetId))
578575 then false
579576 else throwErr("invalid asset")
580577 let balanceBigInt = if (outInAmountAsset)
581578 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
582579 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
583- let outInAmountAssetDecimals = if (outInAmountAsset)
584- then amtAssetDcm
585- else priceAssetDcm
586580 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
587581 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
588582 let outBalance = if (outInAmountAsset)
589583 then amBalanceOld
590584 else prBalanceOld
591585 let outBalanceBigInt = toBigInt(outBalance)
592586 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
593587 let redeemedBigInt = toBigInt(paymentAmount)
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)
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)
599593 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
600594 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
601- let outAmAmount = $t02851928745._1
602- let outPrAmount = $t02851928745._2
603- let amBalanceNew = $t02851928745._3
604- let prBalanceNew = $t02851928745._4
595+ let outAmAmount = $t02817228398._1
596+ let outPrAmount = $t02817228398._2
597+ let amBalanceNew = $t02817228398._3
598+ let prBalanceNew = $t02817228398._4
605599 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
606600 let priceNew = fromX18(priceNewX18, scale8)
607601 let commonState = if (isEval)
608602 then nil
609603 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)]
610604 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
611605 let priceOld = fromX18(priceOldX18, scale8)
612606 let loss = {
613607 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
614608 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
615609 }
616610 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
617611 }
618612 else throw("Strict value is not equal to itself.")
619613 }
620614
621615
622616 func managerPublicKeyOrUnit () = match getString(mpk()) {
623617 case s: String =>
624618 fromBase58String(s)
625619 case _: Unit =>
626620 unit
627621 case _ =>
628622 throw("Match error")
629623 }
630624
631625
632626 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
633627 case s: String =>
634628 fromBase58String(s)
635629 case _: Unit =>
636630 unit
637631 case _ =>
638632 throw("Match error")
639633 }
640634
641635
642636 func isManager (i) = match managerPublicKeyOrUnit() {
643637 case pk: ByteVector =>
644638 (i.callerPublicKey == pk)
645639 case _: Unit =>
646640 (i.caller == this)
647641 case _ =>
648642 throw("Match error")
649643 }
650644
651645
652646 func mustManager (i) = {
653647 let pd = throw("Permission denied")
654648 match managerPublicKeyOrUnit() {
655649 case pk: ByteVector =>
656650 if ((i.callerPublicKey == pk))
657651 then true
658652 else pd
659653 case _: Unit =>
660654 if ((i.caller == this))
661655 then true
662656 else pd
663657 case _ =>
664658 throw("Match error")
665659 }
666660 }
667661
668662
669663 @Callable(i)
670664 func setManager (pendingManagerPublicKey) = {
671665 let checkCaller = mustManager(i)
672666 if ((checkCaller == checkCaller))
673667 then {
674668 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
675669 if ((checkManagerPublicKey == checkManagerPublicKey))
676670 then [StringEntry(pmpk(), pendingManagerPublicKey)]
677671 else throw("Strict value is not equal to itself.")
678672 }
679673 else throw("Strict value is not equal to itself.")
680674 }
681675
682676
683677
684678 @Callable(i)
685679 func confirmManager () = {
686680 let pm = pendingManagerPublicKeyOrUnit()
687681 let hasPM = if (isDefined(pm))
688682 then true
689683 else throw("No pending manager")
690684 if ((hasPM == hasPM))
691685 then {
692686 let checkPM = if ((i.callerPublicKey == value(pm)))
693687 then true
694688 else throw("You are not pending manager")
695689 if ((checkPM == checkPM))
696690 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
697691 else throw("Strict value is not equal to itself.")
698692 }
699693 else throw("Strict value is not equal to itself.")
700694 }
701695
702696
703697
704698 @Callable(i)
705699 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
706700 then throw("Invalid slippageTolerance passed")
707701 else {
708702 let estPut = commonPut(i, slippageTolerance, true)
709703 let emitLpAmt = estPut._2
710704 let lpAssetId = estPut._7
711705 let state = estPut._9
712706 let amDiff = estPut._10
713707 let prDiff = estPut._11
714708 let amId = estPut._12
715709 let prId = estPut._13
716710 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
717711 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
718712 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
719713 if ((currentKLp == currentKLp))
720714 then {
721715 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
722716 if ((emitInv == emitInv))
723717 then {
724718 let emitInvLegacy = match emitInv {
725719 case legacyFactoryContract: Address =>
726720 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
727721 case _ =>
728722 unit
729723 }
730724 if ((emitInvLegacy == emitInvLegacy))
731725 then {
732726 let slippageAInv = if ((amDiff > 0))
733727 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
734728 else nil
735729 if ((slippageAInv == slippageAInv))
736730 then {
737731 let slippagePInv = if ((prDiff > 0))
738732 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
739733 else nil
740734 if ((slippagePInv == slippagePInv))
741735 then {
742736 let lpTransfer = if (shouldAutoStake)
743737 then {
744738 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
745739 if ((slpStakeInv == slpStakeInv))
746740 then nil
747741 else throw("Strict value is not equal to itself.")
748742 }
749743 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
750- let $t03327333735 = refreshKLpInternal(0, 0, 0)
751- if (($t03327333735 == $t03327333735))
744+ let $t03292633388 = refreshKLpInternal(0, 0, 0)
745+ if (($t03292633388 == $t03292633388))
752746 then {
753- let updatedKLp = $t03327333735._2
754- let refreshKLpActions = $t03327333735._1
747+ let updatedKLp = $t03292633388._2
748+ let refreshKLpActions = $t03292633388._1
755749 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
756750 if ((isUpdatedKLpValid == isUpdatedKLpValid))
757751 then ((state ++ lpTransfer) ++ refreshKLpActions)
758752 else throw("Strict value is not equal to itself.")
759753 }
760754 else throw("Strict value is not equal to itself.")
761755 }
762756 else throw("Strict value is not equal to itself.")
763757 }
764758 else throw("Strict value is not equal to itself.")
765759 }
766760 else throw("Strict value is not equal to itself.")
767761 }
768762 else throw("Strict value is not equal to itself.")
769763 }
770764 else throw("Strict value is not equal to itself.")
771765 }
772766
773767
774768
775769 @Callable(i)
776770 func putForFree (maxSlippage) = if ((0 > maxSlippage))
777771 then throw("Invalid value passed")
778772 else {
779773 let estPut = commonPut(i, maxSlippage, false)
780774 let state = estPut._9
781775 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
782776 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
783777 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
784778 if ((currentKLp == currentKLp))
785779 then {
786- let $t03429734362 = refreshKLpInternal(0, 0, 0)
787- let refreshKLpActions = $t03429734362._1
788- let updatedKLp = $t03429734362._2
780+ let $t03395034015 = refreshKLpInternal(0, 0, 0)
781+ let refreshKLpActions = $t03395034015._1
782+ let updatedKLp = $t03395034015._2
789783 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
790784 if ((isUpdatedKLpValid == isUpdatedKLpValid))
791785 then (state ++ refreshKLpActions)
792786 else throw("Strict value is not equal to itself.")
793787 }
794788 else throw("Strict value is not equal to itself.")
795789 }
796790
797791
798792
799793 @Callable(i)
800794 func putOneTkn (minOutAmount,autoStake) = {
801795 let isPoolOneTokenOperationsDisabled = {
802796 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
803797 if ($isInstanceOf(@, "Boolean"))
804798 then @
805799 else throw(($getType(@) + " couldn't be cast to Boolean"))
806800 }
807801 let isPutDisabled = if (if (if (isGlobalShutdown())
808802 then true
809803 else (cfgPoolStatus == PoolPutDisabled))
810804 then true
811805 else (cfgPoolStatus == PoolShutdown))
812806 then true
813807 else isPoolOneTokenOperationsDisabled
814808 let checks = [if (if (!(isPutDisabled))
815809 then true
816810 else isManager(i))
817811 then true
818812 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
819813 then true
820814 else throwErr("exactly 1 payment are expected")]
821815 if ((checks == checks))
822816 then {
823817 let payment = i.payments[0]
824818 let paymentAssetId = payment.assetId
825819 let paymentAmountRaw = payment.amount
826820 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
827821 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
828822 else if ((paymentAssetId == cfgPriceAssetId))
829823 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
830824 else throwErr("payment asset is not supported")
831825 let userAddress = i.caller
832826 let txId = i.transactionId
833- let $t03554735699 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
834- if (($t03554735699 == $t03554735699))
827+ let $t03520035352 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
828+ if (($t03520035352 == $t03520035352))
835829 then {
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
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
841835 let emitAmount = if (if ((minOutAmount > 0))
842836 then (minOutAmount > emitAmountEstimated)
843837 else false)
844838 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
845839 else emitAmountEstimated
846840 let emitInv = emit(emitAmount)
847841 if ((emitInv == emitInv))
848842 then {
849843 let lpTransfer = if (autoStake)
850844 then {
851845 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
852846 if ((stakeInv == stakeInv))
853847 then nil
854848 else throw("Strict value is not equal to itself.")
855849 }
856850 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
857851 let sendFee = if ((feeAmount > 0))
858852 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
859853 else nil
860- let $t03628536482 = if ((this == feeCollectorAddress))
854+ let $t03593836135 = if ((this == feeCollectorAddress))
861855 then $Tuple2(0, 0)
862856 else if (paymentInAmountAsset)
863857 then $Tuple2(-(feeAmount), 0)
864858 else $Tuple2(0, -(feeAmount))
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
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
870864 let kLp = value(getString(keyKLp))
871865 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
872866 if ((isUpdatedKLpValid == isUpdatedKLpValid))
873867 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
874868 else throw("Strict value is not equal to itself.")
875869 }
876870 else throw("Strict value is not equal to itself.")
877871 }
878872 else throw("Strict value is not equal to itself.")
879873 }
880874 else throw("Strict value is not equal to itself.")
881875 }
882876
883877
884878
885879 @Callable(i)
886880 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
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
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
893887 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
894888 }
895889
896890
897891
898892 @Callable(i)
899893 func getOneTkn (outAssetIdStr,minOutAmount) = {
900894 let isPoolOneTokenOperationsDisabled = {
901895 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
902896 if ($isInstanceOf(@, "Boolean"))
903897 then @
904898 else throw(($getType(@) + " couldn't be cast to Boolean"))
905899 }
906900 let isGetDisabled = if (if (isGlobalShutdown())
907901 then true
908902 else (cfgPoolStatus == PoolShutdown))
909903 then true
910904 else isPoolOneTokenOperationsDisabled
911905 let checks = [if (if (!(isGetDisabled))
912906 then true
913907 else isManager(i))
914908 then true
915909 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
916910 then true
917911 else throwErr("exactly 1 payment are expected")]
918912 if ((checks == checks))
919913 then {
920914 let outAssetId = parseAssetId(outAssetIdStr)
921915 let payment = i.payments[0]
922916 let paymentAssetId = payment.assetId
923917 let paymentAmount = payment.amount
924918 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(paymentAmount))
925919 let userAddress = i.caller
926920 let txId = i.transactionId
927- let $t03795038103 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
928- if (($t03795038103 == $t03795038103))
921+ let $t03760337756 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
922+ if (($t03760337756 == $t03760337756))
929923 then {
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
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
935929 let amount = if (if ((minOutAmount > 0))
936930 then (minOutAmount > amountEstimated)
937931 else false)
938932 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
939933 else amountEstimated
940934 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
941935 if ((burnInv == burnInv))
942936 then {
943937 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
944938 let sendFee = if ((feeAmount > 0))
945939 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
946940 else nil
947- let $t03860338850 = {
941+ let $t03825638503 = {
948942 let feeAmountForCalc = if ((this == feeCollectorAddress))
949943 then 0
950944 else feeAmount
951945 if (outInAmountAsset)
952946 then $Tuple2(-((amount + feeAmountForCalc)), 0)
953947 else $Tuple2(0, -((amount + feeAmountForCalc)))
954948 }
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
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
960954 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
961955 if ((isUpdatedKLpValid == isUpdatedKLpValid))
962956 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
963957 else throw("Strict value is not equal to itself.")
964958 }
965959 else throw("Strict value is not equal to itself.")
966960 }
967961 else throw("Strict value is not equal to itself.")
968962 }
969963 else throw("Strict value is not equal to itself.")
970964 }
971965
972966
973967
974968 @Callable(i)
975969 func getOneTknREADONLY (outAssetId,paymentAmount) = {
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
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
982976 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
983977 }
984978
985979
986980
987981 @Callable(i)
988982 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
989983 let isPoolOneTokenOperationsDisabled = {
990984 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
991985 if ($isInstanceOf(@, "Boolean"))
992986 then @
993987 else throw(($getType(@) + " couldn't be cast to Boolean"))
994988 }
995989 let isGetDisabled = if (if (isGlobalShutdown())
996990 then true
997991 else (cfgPoolStatus == PoolShutdown))
998992 then true
999993 else isPoolOneTokenOperationsDisabled
1000994 let checks = [if (if (!(isGetDisabled))
1001995 then true
1002996 else isManager(i))
1003997 then true
1004998 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
1005999 then true
10061000 else throwErr("no payments are expected")]
10071001 if ((checks == checks))
10081002 then {
10091003 let outAssetId = parseAssetId(outAssetIdStr)
10101004 let userAddress = i.caller
10111005 let txId = i.transactionId
10121006 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
10131007 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
10141008 if ((unstakeInv == unstakeInv))
10151009 then {
1016- let $t04027640427 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1017- if (($t04027640427 == $t04027640427))
1010+ let $t03992940080 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1011+ if (($t03992940080 == $t03992940080))
10181012 then {
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
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
10241018 let amount = if (if ((minOutAmount > 0))
10251019 then (minOutAmount > amountEstimated)
10261020 else false)
10271021 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
10281022 else amountEstimated
10291023 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
10301024 if ((burnInv == burnInv))
10311025 then {
10321026 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
10331027 let sendFee = if ((feeAmount > 0))
10341028 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10351029 else nil
1036- let $t04092241169 = {
1030+ let $t04057540822 = {
10371031 let feeAmountForCalc = if ((this == feeCollectorAddress))
10381032 then 0
10391033 else feeAmount
10401034 if (outInAmountAsset)
10411035 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10421036 else $Tuple2(0, -((amount + feeAmountForCalc)))
10431037 }
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
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
10491043 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10501044 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10511045 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
10521046 else throw("Strict value is not equal to itself.")
10531047 }
10541048 else throw("Strict value is not equal to itself.")
10551049 }
10561050 else throw("Strict value is not equal to itself.")
10571051 }
10581052 else throw("Strict value is not equal to itself.")
10591053 }
10601054 else throw("Strict value is not equal to itself.")
10611055 }
10621056
10631057
10641058
10651059 @Callable(i)
10661060 func get () = {
10671061 let res = commonGet(i)
10681062 let outAmtAmt = res._1
10691063 let outPrAmt = res._2
10701064 let pmtAmt = res._3
10711065 let pmtAssetId = res._4
10721066 let state = res._5
10731067 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
10741068 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10751069 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10761070 then {
1077- let $t04222842310 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1078- let refreshKLpActions = $t04222842310._1
1079- let updatedKLp = $t04222842310._2
1071+ let $t04188141963 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1072+ let refreshKLpActions = $t04188141963._1
1073+ let updatedKLp = $t04188141963._2
10801074 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10811075 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10821076 then (state ++ refreshKLpActions)
10831077 else throw("Strict value is not equal to itself.")
10841078 }
10851079 else throw("Strict value is not equal to itself.")
10861080 }
10871081
10881082
10891083
10901084 @Callable(i)
10911085 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
10921086 let res = commonGet(i)
10931087 let outAmAmt = res._1
10941088 let outPrAmt = res._2
10951089 let pmtAmt = res._3
10961090 let pmtAssetId = res._4
10971091 let state = res._5
10981092 if ((noLessThenAmtAsset > outAmAmt))
10991093 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
11001094 else if ((noLessThenPriceAsset > outPrAmt))
11011095 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
11021096 else {
11031097 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
11041098 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11051099 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11061100 then {
1107- let $t04326143342 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1108- let refreshKLpActions = $t04326143342._1
1109- let updatedKLp = $t04326143342._2
1101+ let $t04291442995 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1102+ let refreshKLpActions = $t04291442995._1
1103+ let updatedKLp = $t04291442995._2
11101104 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11111105 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11121106 then (state ++ refreshKLpActions)
11131107 else throw("Strict value is not equal to itself.")
11141108 }
11151109 else throw("Strict value is not equal to itself.")
11161110 }
11171111 }
11181112
11191113
11201114
11211115 @Callable(i)
11221116 func unstakeAndGet (amount) = {
11231117 let checkPayments = if ((size(i.payments) != 0))
11241118 then throw("No payments are expected")
11251119 else true
11261120 if ((checkPayments == checkPayments))
11271121 then {
11281122 let cfg = getPoolConfig()
11291123 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
11301124 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11311125 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
11321126 if ((unstakeInv == unstakeInv))
11331127 then {
11341128 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
11351129 let outAmAmt = res._1
11361130 let outPrAmt = res._2
11371131 let poolStatus = parseIntValue(res._9)
11381132 let state = res._10
11391133 let checkPoolStatus = if (if (isGlobalShutdown())
11401134 then true
11411135 else (poolStatus == PoolShutdown))
11421136 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
11431137 else true
11441138 if ((checkPoolStatus == checkPoolStatus))
11451139 then {
11461140 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11471141 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11481142 then {
1149- let $t04446544546 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1150- let refreshKLpActions = $t04446544546._1
1151- let updatedKLp = $t04446544546._2
1143+ let $t04411844199 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1144+ let refreshKLpActions = $t04411844199._1
1145+ let updatedKLp = $t04411844199._2
11521146 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11531147 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11541148 then (state ++ refreshKLpActions)
11551149 else throw("Strict value is not equal to itself.")
11561150 }
11571151 else throw("Strict value is not equal to itself.")
11581152 }
11591153 else throw("Strict value is not equal to itself.")
11601154 }
11611155 else throw("Strict value is not equal to itself.")
11621156 }
11631157 else throw("Strict value is not equal to itself.")
11641158 }
11651159
11661160
11671161
11681162 @Callable(i)
11691163 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
11701164 let isGetDisabled = if (isGlobalShutdown())
11711165 then true
11721166 else (cfgPoolStatus == PoolShutdown)
11731167 let checks = [if (!(isGetDisabled))
11741168 then true
11751169 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11761170 then true
11771171 else throw("no payments are expected")]
11781172 if ((checks == checks))
11791173 then {
11801174 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11811175 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11821176 if ((unstakeInv == unstakeInv))
11831177 then {
11841178 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11851179 let outAmAmt = res._1
11861180 let outPrAmt = res._2
11871181 let state = res._10
11881182 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11891183 then true
11901184 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11911185 then true
11921186 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11931187 if ((checkAmounts == checkAmounts))
11941188 then {
11951189 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11961190 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11971191 then {
1198- let $t04583845919 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1199- let refreshKLpActions = $t04583845919._1
1200- let updatedKLp = $t04583845919._2
1192+ let $t04549145572 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1193+ let refreshKLpActions = $t04549145572._1
1194+ let updatedKLp = $t04549145572._2
12011195 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12021196 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12031197 then (state ++ refreshKLpActions)
12041198 else throw("Strict value is not equal to itself.")
12051199 }
12061200 else throw("Strict value is not equal to itself.")
12071201 }
12081202 else throw("Strict value is not equal to itself.")
12091203 }
12101204 else throw("Strict value is not equal to itself.")
12111205 }
12121206 else throw("Strict value is not equal to itself.")
12131207 }
12141208
12151209
12161210
12171211 @Callable(i)
12181212 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
12191213 then throw("permissions denied")
12201214 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
12211215
12221216
12231217
12241218 @Callable(i)
12251219 func refreshKLp () = {
12261220 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
12271221 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
12281222 then unit
12291223 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
12301224 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
12311225 then {
12321226 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1233- let $t04710647170 = refreshKLpInternal(0, 0, 0)
1234- let kLpUpdateActions = $t04710647170._1
1235- let updatedKLp = $t04710647170._2
1227+ let $t04675946823 = refreshKLpInternal(0, 0, 0)
1228+ let kLpUpdateActions = $t04675946823._1
1229+ let updatedKLp = $t04675946823._2
12361230 let actions = if ((kLp != updatedKLp))
12371231 then kLpUpdateActions
12381232 else throwErr("nothing to refresh")
12391233 $Tuple2(actions, toString(updatedKLp))
12401234 }
12411235 else throw("Strict value is not equal to itself.")
12421236 }
12431237
12441238
12451239
12461240 @Callable(i)
12471241 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
12481242
12491243
12501244
12511245 @Callable(i)
12521246 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
12531247
12541248
12551249
12561250 @Callable(i)
12571251 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
12581252 let prices = calcPrices(amAmt, prAmt, lpAmt)
12591253 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
12601254 }
12611255
12621256
12631257
12641258 @Callable(i)
12651259 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
12661260
12671261
12681262
12691263 @Callable(i)
12701264 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
12711265
12721266
12731267
12741268 @Callable(i)
12751269 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
12761270
12771271
12781272
12791273 @Callable(i)
12801274 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
12811275
12821276
12831277
12841278 @Callable(i)
12851279 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
12861280 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
12871281 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
12881282 }
12891283
12901284
12911285
12921286 @Callable(i)
12931287 func statsREADONLY () = {
12941288 let cfg = getPoolConfig()
12951289 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12961290 let amtAssetId = cfg[idxAmtAssetId]
12971291 let priceAssetId = cfg[idxPriceAssetId]
12981292 let iAmtAssetId = cfg[idxIAmtAssetId]
12991293 let iPriceAssetId = cfg[idxIPriceAssetId]
13001294 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13011295 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13021296 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13031297 let accAmtAssetBalance = getAccBalance(amtAssetId)
13041298 let accPriceAssetBalance = getAccBalance(priceAssetId)
13051299 let pricesList = if ((poolLPBalance == 0))
13061300 then [zeroBigInt, zeroBigInt, zeroBigInt]
13071301 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
13081302 let curPrice = 0
13091303 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
13101304 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
13111305 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
13121306 $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))
13131307 }
13141308
13151309
13161310
13171311 @Callable(i)
13181312 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
13191313 let cfg = getPoolConfig()
13201314 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13211315 let amAssetIdStr = cfg[idxAmtAssetId]
13221316 let amAssetId = fromBase58String(amAssetIdStr)
13231317 let prAssetIdStr = cfg[idxPriceAssetId]
13241318 let prAssetId = fromBase58String(prAssetIdStr)
13251319 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13261320 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13271321 let poolStatus = cfg[idxPoolStatus]
13281322 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13291323 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
13301324 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
13311325 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
13321326 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
13331327 let curPriceX18 = if ((poolLPBalance == 0))
13341328 then zeroBigInt
13351329 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
13361330 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
13371331 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
13381332 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
13391333 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13401334 let calcLpAmt = estPut._1
13411335 let curPriceCalc = estPut._3
13421336 let amBalance = estPut._4
13431337 let prBalance = estPut._5
13441338 let lpEmission = estPut._6
13451339 $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))
13461340 }
13471341
13481342
13491343
13501344 @Callable(i)
13511345 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
13521346 let cfg = getPoolConfig()
13531347 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
13541348 let amAssetIdStr = cfg[idxAmtAssetId]
13551349 let amAssetId = fromBase58String(amAssetIdStr)
13561350 let prAssetIdStr = cfg[idxPriceAssetId]
13571351 let prAssetId = fromBase58String(prAssetIdStr)
13581352 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
13591353 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
13601354 let poolStatus = cfg[idxPoolStatus]
13611355 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
13621356 let amBalanceRaw = getAccBalance(amAssetIdStr)
13631357 let prBalanceRaw = getAccBalance(prAssetIdStr)
13641358 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
13651359 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
13661360 let curPriceX18 = if ((poolLPBalance == 0))
13671361 then zeroBigInt
13681362 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
13691363 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
13701364 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
13711365 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
13721366 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
13731367 let calcLpAmt = estPut._1
13741368 let curPriceCalc = estPut._3
13751369 let amBalance = estPut._4
13761370 let prBalance = estPut._5
13771371 let lpEmission = estPut._6
13781372 $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))
13791373 }
13801374
13811375
13821376
13831377 @Callable(i)
13841378 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
13851379 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
13861380 let outAmAmt = res._1
13871381 let outPrAmt = res._2
13881382 let amBalance = res._5
13891383 let prBalance = res._6
13901384 let lpEmission = res._7
13911385 let curPrice = res._8
13921386 let poolStatus = parseIntValue(res._9)
13931387 $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))
13941388 }
13951389
13961390
13971391 @Verifier(tx)
13981392 func verify () = {
13991393 let targetPublicKey = match managerPublicKeyOrUnit() {
14001394 case pk: ByteVector =>
14011395 pk
14021396 case _: Unit =>
14031397 tx.senderPublicKey
14041398 case _ =>
14051399 throw("Match error")
14061400 }
14071401 match tx {
14081402 case order: Order =>
14091403 let matcherPub = getMatcherPubOrFail()
14101404 let orderValid = validateMatcherOrderAllowed(order)
14111405 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14121406 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
14131407 if (if (if (orderValid)
14141408 then senderValid
14151409 else false)
14161410 then matcherValid
14171411 else false)
14181412 then true
14191413 else throwOrderError(orderValid, senderValid, matcherValid)
14201414 case s: SetScriptTransaction =>
14211415 let newHash = blake2b256(value(s.script))
14221416 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
14231417 let currentHash = scriptHash(this)
14241418 if (if ((allowedHash == newHash))
14251419 then (currentHash != newHash)
14261420 else false)
14271421 then true
14281422 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14291423 case _ =>
14301424 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14311425 }
14321426 }
14331427

github/deemru/w8io/026f985 
190.06 ms