tx · 3MaV78JAsXwZShWoJvGTTkPLtfVv2qCf3pHpMkZAVmom

3N1UzzyDKhjKyRH3eZ8ZNf1j9Uo4gJjFxor:  -0.03300000 Waves

2022.11.28 16:01 [2336989] smart account 3N1UzzyDKhjKyRH3eZ8ZNf1j9Uo4gJjFxor > SELF 0.00000000 Waves

{ "type": 13, "id": "3MaV78JAsXwZShWoJvGTTkPLtfVv2qCf3pHpMkZAVmom", "fee": 3300000, "feeAssetId": null, "timestamp": 1669640381604, "version": 1, "sender": "3N1UzzyDKhjKyRH3eZ8ZNf1j9Uo4gJjFxor", "senderPublicKey": "CVCizwVtaT9i3E82rNofS5vLyaXDwddyUhjsNF3EoCeV", "proofs": [ "4BmHjuCiti3VFkE1w41fpd1aahs71v9h1YH2iBjTq3KtPG79HgBSK644BCNJzYUoqyzJXBQBmrwXz7sCkouSVz81" ], "script": "base64:BgL+KwgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlke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JQKAgUDbmlsCQC5CQIJAMwIAgIOJWQlZCVkJWQlZCVkJWQJAMwIAgkApAMBBQJjbQkAzAgCCQCkAwEFAmNuCQDMCAIJAKQDAQUCY2MJAMwIAgkApAMBBQJjZQkAzAgCCQCkAwEFAmNiCQDMCAIJAKYDAQUCY2gJAMwIAgkApAMBBQJjYQUDbmlsBQFqAQJncgECZ3MABAJndAQCZEkJAQJlSwADCQABAgUCZEkCCkJ5dGVWZWN0b3IEAmVPBQJkSQUCZU8DCQABAgUCZEkCBFVuaXQIBQJncg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgQCZEkFAmdyAwkAAQIFAmRJAgVPcmRlcgQCZGoFAmRJBAJndQkBAmFNAAQCYXoJAQJkaQEFAmRqBAJhQQkA9AMDCAUCZGoJYm9keUJ5dGVzCQCRAwIIBQJkagZwcm9vZnMAAAgFAmRqD3NlbmRlclB1YmxpY0tleQQCYUIJAPQDAwgFAmRqCWJvZHlCeXRlcwkAkQMCCAUCZGoGcHJvb2ZzAAEFAmd1AwMDBQJhegUCYUEHBQJhQgcGCQECYXkDBQJhegUCYUEFAmFCAwkAAQIFAmRJAhRTZXRTY3JpcHRUcmFuc2FjdGlvbgQCZUwFAmRJBAJndgkA9gMBCQEFdmFsdWUBCAUCZUwGc2NyaXB0BAJndwkA2wQBCQEFdmFsdWUBCQCdCAIFAmFKCQECYXcABAJneAkA8QcBBQR0aGlzAwMJAAACBQJndwUCZ3YJAQIhPQIFAmd4BQJndgcGCQD0AwMIBQJncglib2R5Qnl0ZXMJAJEDAggFAmdyBnByb29mcwAABQJndAkA9AMDCAUCZ3IJYm9keUJ5dGVzCQCRAwIIBQJncgZwcm9vZnMAAAUCZ3RFDX3+", "chainId": 84, "height": 2336989, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 31P5YtQukrJKwuLQCzAFYFQAQ11Ra44ZcWzgy926mKte Next: 2qRABEi1MQBdMetcPF4eSNousSxXex7FcETHDRZDj3tc Diff:
OldNewDifferences
373373 }
374374
375375
376+func calcKLp (amountBalance,priceBalance,lpEmission) = {
377+ let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpEmission)
378+ updatedKLp
379+ }
380+
381+
382+func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
383+ let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
384+ let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
385+ let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
386+ let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
387+ let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
388+ $Tuple2(actions, updatedKLp)
389+ }
390+
391+
376392 func validateMatcherOrderAllowed (order) = {
377393 let cfg = getPoolConfig()
378394 let amtAssetId = cfg[idxAmtAssetId]
380396 let poolStatus = parseIntValue(cfg[idxPoolStatus])
381397 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
382398 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
383- let accAmtAssetBalance = getAccBalance(amtAssetId)
384- let accPriceAssetBalance = getAccBalance(priceAssetId)
385- let curPriceX18 = if ((order.orderType == Buy))
386- then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance)
387- else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance)
388- let curPrice = fromX18(curPriceX18, scale8)
399+ let amountAssetAmount = order.amount
400+ let priceAssetAmount = fraction(order.amount, order.price, scale8)
401+ let $t01983820050 = if ((order.orderType == Buy))
402+ then $Tuple2(amountAssetAmount, -(priceAssetAmount))
403+ else $Tuple2(-(amountAssetAmount), priceAssetAmount)
404+ let amountAssetBalanceDelta = $t01983820050._1
405+ let priceAssetBalanceDelta = $t01983820050._2
389406 if (if (if (isGlobalShutdown())
390407 then true
391408 else (poolStatus == PoolMatcherDisabled))
393410 else (poolStatus == PoolShutdown))
394411 then throw("Exchange operations disabled")
395412 else {
396- let orderAmtAsset = order.assetPair.amountAsset
397- let orderAmtAssetStr = if ((orderAmtAsset == unit))
398- then "WAVES"
399- else toBase58String(value(orderAmtAsset))
400- let orderPriceAsset = order.assetPair.priceAsset
401- let orderPriceAssetStr = if ((orderPriceAsset == unit))
402- then "WAVES"
403- else toBase58String(value(orderPriceAsset))
413+ let orderAmtAssetStr = assetIdToString(value(order.assetPair.amountAsset))
414+ let orderPriceAssetStr = assetIdToString(value(order.assetPair.priceAsset))
404415 if (if ((orderAmtAssetStr != amtAssetId))
405416 then true
406417 else (orderPriceAssetStr != priceAssetId))
407418 then throw("Wrong order assets.")
408419 else {
409- let orderPrice = order.price
410- let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm)
411- let castedOrderPrice = toScale(orderPrice, scale8, priceDcm)
412- let isOrderPriceValid = if ((order.orderType == Buy))
413- then (curPrice >= castedOrderPrice)
414- else (castedOrderPrice >= curPrice)
415- let kLp = valueOrErrorMessage(getInteger(this, keyKLp), fmtErr("kLp is required"))
416- let kLpNew = 0
420+ let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
421+ let $t02064520745 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
422+ let unusedActions = $t02064520745._1
423+ let kLpNew = $t02064520745._2
417424 let isOrderValid = (kLpNew > kLp)
418425 isOrderValid
419426 }
490497 else if ((paymentAssetId == cfgPriceAssetId))
491498 then false
492499 else throwErr("invalid asset")
493- let $t02309923392 = if (isEval)
500+ let $t02342923722 = if (isEval)
494501 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
495502 else if (paymentInAmountAsset)
496503 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
497504 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
498- let amountBalanceOld = $t02309923392._1
499- let priceBalanceOld = $t02309923392._2
500- let $t02339623545 = if (paymentInAmountAsset)
505+ let amountBalanceOld = $t02342923722._1
506+ let priceBalanceOld = $t02342923722._2
507+ let $t02372623875 = if (paymentInAmountAsset)
501508 then $Tuple2(paymentAmountRaw, 0)
502509 else $Tuple2(0, paymentAmountRaw)
503- let amountAssetAmountRaw = $t02339623545._1
504- let priceAssetAmountRaw = $t02339623545._2
510+ let amountAssetAmountRaw = $t02372623875._1
511+ let priceAssetAmountRaw = $t02372623875._2
505512 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
506513 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
507- let $t02366723726 = takeFee(paymentAmountRaw)
508- let paymentAmount = $t02366723726._1
509- let feeAmount = $t02366723726._2
514+ let $t02399724056 = takeFee(paymentAmountRaw)
515+ let paymentAmount = $t02399724056._1
516+ let feeAmount = $t02399724056._2
510517 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
511518 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
512519 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
529536 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
530537 let priceOld = fromX18(priceOldX18, scale8)
531538 let loss = {
532- let $t02520325370 = if (paymentInAmountAsset)
539+ let $t02553325700 = if (paymentInAmountAsset)
533540 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
534541 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
535- let amount = $t02520325370._1
536- let balance = $t02520325370._2
542+ let amount = $t02553325700._1
543+ let balance = $t02553325700._2
537544 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
538545 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
539546 }
567574 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
568575 let redeemedBigInt = toBigInt(paymentAmount)
569576 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
570- let $t02697227022 = takeFee(amountRaw)
571- let totalAmount = $t02697227022._1
572- let feeAmount = $t02697227022._2
573- let $t02702627252 = if (outInAmountAsset)
577+ let $t02730227352 = takeFee(amountRaw)
578+ let totalAmount = $t02730227352._1
579+ let feeAmount = $t02730227352._2
580+ let $t02735627582 = if (outInAmountAsset)
574581 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
575582 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
576- let outAmAmount = $t02702627252._1
577- let outPrAmount = $t02702627252._2
578- let amBalanceNew = $t02702627252._3
579- let prBalanceNew = $t02702627252._4
583+ let outAmAmount = $t02735627582._1
584+ let outPrAmount = $t02735627582._2
585+ let amBalanceNew = $t02735627582._3
586+ let prBalanceNew = $t02735627582._4
580587 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
581588 let priceNew = fromX18(priceNewX18, scale8)
582589 let commonState = if (isEval)
591598 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
592599 }
593600 else throw("Strict value is not equal to itself.")
594- }
595-
596-
597-func calcKLp (amountBalance,priceBalance,lpEmission) = {
598- let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpEmission)
599- updatedKLp
600- }
601-
602-
603-func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
604- let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
605- let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
606- let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
607- let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
608- let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
609- $Tuple2(actions, updatedKLp)
610601 }
611602
612603
733724 else throw("Strict value is not equal to itself.")
734725 }
735726 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
736- let $t03215332218 = refreshKLpInternal(0, 0, 0)
737- let refreshKLpActions = $t03215332218._1
738- let updatedKLp = $t03215332218._2
727+ let $t03153331598 = refreshKLpInternal(0, 0, 0)
728+ let refreshKLpActions = $t03153331598._1
729+ let updatedKLp = $t03153331598._2
739730 ((state ++ lpTransfer) ++ refreshKLpActions)
740731 }
741732 else throw("Strict value is not equal to itself.")
755746 else {
756747 let estPut = commonPut(i, maxSlippage, false)
757748 let state = estPut._9
758- let $t03250432569 = refreshKLpInternal(0, 0, 0)
759- let refreshKLpActions = $t03250432569._1
760- let updatedKLp = $t03250432569._2
749+ let $t03188431949 = refreshKLpInternal(0, 0, 0)
750+ let refreshKLpActions = $t03188431949._1
751+ let updatedKLp = $t03188431949._2
761752 (state ++ refreshKLpActions)
762753 }
763754
792783 let paymentAmountRaw = payment.amount
793784 let userAddress = i.caller
794785 let txId = i.transactionId
795- let $t03334533494 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
796- let emitAmountEstimated = $t03334533494._1
797- let commonState = $t03334533494._2
798- let feeAmount = $t03334533494._3
799- let bonus = $t03334533494._4
800- let paymentInAmountAsset = $t03334533494._5
786+ let $t03272532874 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
787+ let emitAmountEstimated = $t03272532874._1
788+ let commonState = $t03272532874._2
789+ let feeAmount = $t03272532874._3
790+ let bonus = $t03272532874._4
791+ let paymentInAmountAsset = $t03272532874._5
801792 let emitAmount = if (if ((minOutAmount > 0))
802793 then (minOutAmount > emitAmountEstimated)
803794 else false)
817808 let sendFee = if ((feeAmount > 0))
818809 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
819810 else nil
820- let $t03408034277 = if ((this == feeCollectorAddress))
811+ let $t03346033657 = if ((this == feeCollectorAddress))
821812 then $Tuple2(0, 0)
822813 else if (paymentInAmountAsset)
823814 then $Tuple2(-(feeAmount), 0)
824815 else $Tuple2(0, -(feeAmount))
825- let amountAssetBalanceDelta = $t03408034277._1
826- let priceAssetBalanceDelta = $t03408034277._2
827- let $t03428034388 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
828- let refreshKLpActions = $t03428034388._1
829- let updatedKLp = $t03428034388._2
816+ let amountAssetBalanceDelta = $t03346033657._1
817+ let priceAssetBalanceDelta = $t03346033657._2
818+ let $t03366033768 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
819+ let refreshKLpActions = $t03366033768._1
820+ let updatedKLp = $t03366033768._2
830821 $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
831822 }
832823 else throw("Strict value is not equal to itself.")
838829
839830 @Callable(i)
840831 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
841- let $t03458134738 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
842- let emitAmountEstimated = $t03458134738._1
843- let commonState = $t03458134738._2
844- let feeAmount = $t03458134738._3
845- let bonus = $t03458134738._4
846- let paymentInAmountAsset = $t03458134738._5
832+ let $t03396134118 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
833+ let emitAmountEstimated = $t03396134118._1
834+ let commonState = $t03396134118._2
835+ let feeAmount = $t03396134118._3
836+ let bonus = $t03396134118._4
837+ let paymentInAmountAsset = $t03396134118._5
847838 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
848839 }
849840
877868 let paymentAmount = payment.amount
878869 let userAddress = i.caller
879870 let txId = i.transactionId
880- let $t03554335693 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
881- let amountEstimated = $t03554335693._1
882- let commonState = $t03554335693._2
883- let feeAmount = $t03554335693._3
884- let bonus = $t03554335693._4
885- let outInAmountAsset = $t03554335693._5
871+ let $t03492335073 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
872+ let amountEstimated = $t03492335073._1
873+ let commonState = $t03492335073._2
874+ let feeAmount = $t03492335073._3
875+ let bonus = $t03492335073._4
876+ let outInAmountAsset = $t03492335073._5
886877 let amount = if (if ((minOutAmount > 0))
887878 then (minOutAmount > amountEstimated)
888879 else false)
895886 let sendFee = if ((feeAmount > 0))
896887 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
897888 else nil
898- let $t03619336440 = {
889+ let $t03557335820 = {
899890 let feeAmountForCalc = if ((this == feeCollectorAddress))
900891 then 0
901892 else feeAmount
903894 then $Tuple2(-((amount + feeAmountForCalc)), 0)
904895 else $Tuple2(0, -((amount + feeAmountForCalc)))
905896 }
906- let amountAssetBalanceDelta = $t03619336440._1
907- let priceAssetBalanceDelta = $t03619336440._2
908- let $t03644336551 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
909- let refreshKLpActions = $t03644336551._1
910- let updatedKLp = $t03644336551._2
897+ let amountAssetBalanceDelta = $t03557335820._1
898+ let priceAssetBalanceDelta = $t03557335820._2
899+ let $t03582335931 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
900+ let refreshKLpActions = $t03582335931._1
901+ let updatedKLp = $t03582335931._2
911902 $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
912903 }
913904 else throw("Strict value is not equal to itself.")
919910
920911 @Callable(i)
921912 func getOneTknREADONLY (outAssetId,paymentAmount) = {
922- let $t03673536891 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
923- let amountEstimated = $t03673536891._1
924- let commonState = $t03673536891._2
925- let feeAmount = $t03673536891._3
926- let bonus = $t03673536891._4
927- let outInAmountAsset = $t03673536891._5
913+ let $t03611536271 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
914+ let amountEstimated = $t03611536271._1
915+ let commonState = $t03611536271._2
916+ let feeAmount = $t03611536271._3
917+ let bonus = $t03611536271._4
918+ let outInAmountAsset = $t03611536271._5
928919 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
929920 }
930921
958949 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
959950 if ((unstakeInv == unstakeInv))
960951 then {
961- let $t03771637864 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
962- let amountEstimated = $t03771637864._1
963- let commonState = $t03771637864._2
964- let feeAmount = $t03771637864._3
965- let bonus = $t03771637864._4
966- let outInAmountAsset = $t03771637864._5
952+ let $t03709637244 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
953+ let amountEstimated = $t03709637244._1
954+ let commonState = $t03709637244._2
955+ let feeAmount = $t03709637244._3
956+ let bonus = $t03709637244._4
957+ let outInAmountAsset = $t03709637244._5
967958 let amount = if (if ((minOutAmount > 0))
968959 then (minOutAmount > amountEstimated)
969960 else false)
976967 let sendFee = if ((feeAmount > 0))
977968 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
978969 else nil
979- let $t03835938606 = {
970+ let $t03773937986 = {
980971 let feeAmountForCalc = if ((this == feeCollectorAddress))
981972 then 0
982973 else feeAmount
984975 then $Tuple2(-((amount + feeAmountForCalc)), 0)
985976 else $Tuple2(0, -((amount + feeAmountForCalc)))
986977 }
987- let amountAssetBalanceDelta = $t03835938606._1
988- let priceAssetBalanceDelta = $t03835938606._2
989- let $t03860938717 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
990- let refreshKLpActions = $t03860938717._1
991- let updatedKLp = $t03860938717._2
978+ let amountAssetBalanceDelta = $t03773937986._1
979+ let priceAssetBalanceDelta = $t03773937986._2
980+ let $t03798938097 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
981+ let refreshKLpActions = $t03798938097._1
982+ let updatedKLp = $t03798938097._2
992983 $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
993984 }
994985 else throw("Strict value is not equal to itself.")
10111002 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10121003 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10131004 then {
1014- let $t03950939591 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1015- let refreshKLpActions = $t03950939591._1
1016- let updatedKLp = $t03950939591._2
1005+ let $t03888938971 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1006+ let refreshKLpActions = $t03888938971._1
1007+ let updatedKLp = $t03888938971._2
10171008 (state ++ refreshKLpActions)
10181009 }
10191010 else throw("Strict value is not equal to itself.")
10371028 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10381029 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10391030 then {
1040- let $t04038740468 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1041- let refreshKLpActions = $t04038740468._1
1042- let updatedKLp = $t04038740468._2
1031+ let $t03976739848 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1032+ let refreshKLpActions = $t03976739848._1
1033+ let updatedKLp = $t03976739848._2
10431034 (state ++ refreshKLpActions)
10441035 }
10451036 else throw("Strict value is not equal to itself.")
10751066 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
10761067 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10771068 then {
1078- let $t04144141522 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1079- let refreshKLpActions = $t04144141522._1
1080- let updatedKLp = $t04144141522._2
1069+ let $t04082140902 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1070+ let refreshKLpActions = $t04082140902._1
1071+ let updatedKLp = $t04082140902._2
10811072 (state ++ refreshKLpActions)
10821073 }
10831074 else throw("Strict value is not equal to itself.")
11201111 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11211112 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11221113 then {
1123- let $t04266242743 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1124- let refreshKLpActions = $t04266242743._1
1125- let updatedKLp = $t04266242743._2
1114+ let $t04204242123 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1115+ let refreshKLpActions = $t04204242123._1
1116+ let updatedKLp = $t04204242123._2
11261117 (state ++ refreshKLpActions)
11271118 }
11281119 else throw("Strict value is not equal to itself.")
11511142 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
11521143 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
11531144 then {
1154- let $t04373143786 = refreshKLpInternal(0, 0, 0)
1155- let actions = $t04373143786._1
1156- let updatedKLp = $t04373143786._2
1145+ let $t04311143166 = refreshKLpInternal(0, 0, 0)
1146+ let actions = $t04311143166._1
1147+ let updatedKLp = $t04311143166._2
11571148 $Tuple2(actions, toString(updatedKLp))
11581149 }
11591150 else throw("Strict value is not equal to itself.")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lPdecimals = 8
55
66 let scale8 = 100000000
77
88 let scale8BigInt = toBigInt(100000000)
99
1010 let scale18 = toBigInt(1000000000000000000)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let big0 = toBigInt(0)
1515
1616 let big1 = toBigInt(1)
1717
1818 let big2 = toBigInt(2)
1919
2020 let wavesString = "WAVES"
2121
2222 let SEP = "__"
2323
2424 let PoolActive = 1
2525
2626 let PoolPutDisabled = 2
2727
2828 let PoolMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
3232 let idxPoolAddress = 1
3333
3434 let idxPoolStatus = 2
3535
3636 let idxPoolLPAssetId = 3
3737
3838 let idxAmtAssetId = 4
3939
4040 let idxPriceAssetId = 5
4141
4242 let idxAmtAssetDcm = 6
4343
4444 let idxPriceAssetDcm = 7
4545
4646 let idxIAmtAssetId = 8
4747
4848 let idxIPriceAssetId = 9
4949
5050 let idxLPAssetDcm = 10
5151
5252 let idxPoolAmtAssetAmt = 1
5353
5454 let idxPoolPriceAssetAmt = 2
5555
5656 let idxPoolLPAssetAmt = 3
5757
5858 let idxFactoryStakingContract = 1
5959
6060 let idxFactorySlippageContract = 7
6161
6262 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6666
6767
6868 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
6969
7070
7171 func abs (val) = if ((0 > val))
7272 then -(val)
7373 else val
7474
7575
7676 func absBigInt (val) = if ((zeroBigInt > val))
7777 then -(val)
7878 else val
7979
8080
8181 func fc () = "%s__factoryContract"
8282
8383
8484 func mpk () = "%s__managerPublicKey"
8585
8686
8787 func pmpk () = "%s__pendingManagerPublicKey"
8888
8989
9090 func pl () = "%s%s__price__last"
9191
9292
9393 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
9494
9595
9696 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
9797
9898
9999 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
100100
101101
102102 func aa () = "%s__amountAsset"
103103
104104
105105 func pa () = "%s__priceAsset"
106106
107107
108108 let keyFee = "%s__fee"
109109
110110 let feeDefault = fraction(10, scale8, 10000)
111111
112112 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
113113
114114 let keyKLp = makeString(["%s", "kLp"], SEP)
115115
116116 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
117117
118118 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
119119
120120 let kLpRefreshDelayDefault = 30
121121
122122 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
123123
124124 func keyFactoryConfig () = "%s__factoryConfig"
125125
126126
127127 func keyMatcherPub () = "%s%s__matcher__publicKey"
128128
129129
130130 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
131131
132132
133133 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
134134
135135
136136 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
137137
138138
139139 func keyAllPoolsShutdown () = "%s__shutdown"
140140
141141
142142 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
143143
144144
145145 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
146146
147147
148148 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
149149
150150 func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
151151
152152
153153 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
154154
155155
156156 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
157157
158158
159159 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
160160
161161
162162 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
163163
164164
165165 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
166166
167167 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
168168
169169 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
170170
171171
172172 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
173173
174174
175175 func getPoolConfig () = {
176176 let amtAsset = getStringOrFail(this, aa())
177177 let priceAsset = getStringOrFail(this, pa())
178178 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
179179 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
180180 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
181181 }
182182
183183
184184 func parseAssetId (input) = if ((input == wavesString))
185185 then unit
186186 else fromBase58String(input)
187187
188188
189189 func assetIdToString (input) = if ((input == unit))
190190 then wavesString
191191 else toBase58String(value(input))
192192
193193
194194 func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolStatus]), fromBase58String(poolConfig[idxPoolLPAssetId]), parseAssetId(poolConfig[idxAmtAssetId]), parseAssetId(poolConfig[idxPriceAssetId]), parseIntValue(poolConfig[idxAmtAssetDcm]), parseIntValue(poolConfig[idxPriceAssetDcm]))
195195
196196
197197 let poolConfigParsed = parsePoolConfig(getPoolConfig())
198198
199199 let $t079158081 = poolConfigParsed
200200
201201 let cfgPoolAddress = $t079158081._1
202202
203203 let cfgPoolStatus = $t079158081._2
204204
205205 let cfgLpAssetId = $t079158081._3
206206
207207 let cfgAmountAssetId = $t079158081._4
208208
209209 let cfgPriceAssetId = $t079158081._5
210210
211211 let cfgAmountAssetDecimals = $t079158081._6
212212
213213 let cfgPriceAssetDecimals = $t079158081._7
214214
215215 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
216216
217217
218218 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
219219
220220 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
221221
222222 func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp,slipageAmtAssetAmt,slipagePriceAssetAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp), toString(slipageAmtAssetAmt), toString(slipagePriceAssetAmt)], SEP)
223223
224224
225225 func dataGetActionInfo (outAmtAssetAmt,outPriceAssetAmt,inLpAmt,price,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d", toString(outAmtAssetAmt), toString(outPriceAssetAmt), toString(inLpAmt), toString(price), toString(txHeight), toString(txTimestamp)], SEP)
226226
227227
228228 func getAccBalance (assetId) = if ((assetId == "WAVES"))
229229 then wavesBalance(this).available
230230 else assetBalance(this, fromBase58String(assetId))
231231
232232
233233 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
234234
235235
236236 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
237237 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
238238 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
239239 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
240240 }
241241
242242
243243 func calcPrices (amAmt,prAmt,lpAmt) = {
244244 let cfg = getPoolConfig()
245245 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
246246 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
247247 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
248248 let amAmtX18 = toX18(amAmt, amtAssetDcm)
249249 let prAmtX18 = toX18(prAmt, priceAssetDcm)
250250 let lpAmtX18 = toX18(lpAmt, scale8)
251251 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
252252 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
253253 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
254254 }
255255
256256
257257 func calculatePrices (amAmt,prAmt,lpAmt) = {
258258 let prices = calcPrices(amAmt, prAmt, lpAmt)
259259 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
260260 }
261261
262262
263263 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
264264 let cfg = getPoolConfig()
265265 let lpAssetId = cfg[idxPoolLPAssetId]
266266 let amAssetId = cfg[idxAmtAssetId]
267267 let prAssetId = cfg[idxPriceAssetId]
268268 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
269269 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
270270 let poolStatus = cfg[idxPoolStatus]
271271 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
272272 if ((lpAssetId != pmtAssetId))
273273 then throw("Invalid asset passed.")
274274 else {
275275 let amBalance = getAccBalance(amAssetId)
276276 let amBalanceX18 = toX18(amBalance, amAssetDcm)
277277 let prBalance = getAccBalance(prAssetId)
278278 let prBalanceX18 = toX18(prBalance, prAssetDcm)
279279 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
280280 let curPrice = fromX18(curPriceX18, scale8)
281281 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
282282 let lpEmissionX18 = toX18(lpEmission, scale8)
283283 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
284284 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
285285 let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
286286 let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
287287 let state = if ((txId58 == ""))
288288 then nil
289289 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
290290 then unit
291291 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
292292 then unit
293293 else fromBase58String(prAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)]
294294 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
295295 }
296296 }
297297
298298
299299 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
300300 let cfg = getPoolConfig()
301301 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
302302 let amAssetIdStr = cfg[idxAmtAssetId]
303303 let prAssetIdStr = cfg[idxPriceAssetId]
304304 let iAmtAssetId = cfg[idxIAmtAssetId]
305305 let iPriceAssetId = cfg[idxIPriceAssetId]
306306 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
307307 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
308308 let poolStatus = cfg[idxPoolStatus]
309309 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
310310 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
311311 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
312312 if (if ((amAssetIdStr != inAmAssetIdStr))
313313 then true
314314 else (prAssetIdStr != inPrAssetIdStr))
315315 then throw("Invalid amt or price asset passed.")
316316 else {
317317 let amBalance = if (isEvaluate)
318318 then getAccBalance(amAssetIdStr)
319319 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
320320 let prBalance = if (isEvaluate)
321321 then getAccBalance(prAssetIdStr)
322322 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
323323 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
324324 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
325325 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
326326 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
327327 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
328328 let res = if ((lpEmission == 0))
329329 then {
330330 let curPriceX18 = zeroBigInt
331331 let slippageX18 = zeroBigInt
332332 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
333333 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
334334 }
335335 else {
336336 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
337337 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
338338 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
339339 if (if ((curPriceX18 != zeroBigInt))
340340 then (slippageX18 > slippageToleranceX18)
341341 else false)
342342 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
343343 else {
344344 let lpEmissionX18 = toX18(lpEmission, scale8)
345345 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
346346 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
347347 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
348348 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
349349 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
350350 let expAmtAssetAmtX18 = expectedAmts._1
351351 let expPriceAssetAmtX18 = expectedAmts._2
352352 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
353353 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
354354 }
355355 }
356356 let calcLpAmt = res._1
357357 let calcAmAssetPmt = res._2
358358 let calcPrAssetPmt = res._3
359359 let curPrice = fromX18(res._4, scale8)
360360 let slippageCalc = fromX18(res._5, scale8)
361361 if ((0 >= calcLpAmt))
362362 then throw("Invalid calculations. LP calculated is less than zero.")
363363 else {
364364 let emitLpAmt = if (!(emitLp))
365365 then 0
366366 else calcLpAmt
367367 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
368368 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
369369 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(calcAmAssetPmt, calcPrAssetPmt, emitLpAmt, curPrice, slippageTolerance, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
370370 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
371371 }
372372 }
373373 }
374374
375375
376+func calcKLp (amountBalance,priceBalance,lpEmission) = {
377+ let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpEmission)
378+ updatedKLp
379+ }
380+
381+
382+func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
383+ let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
384+ let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
385+ let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
386+ let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
387+ let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
388+ $Tuple2(actions, updatedKLp)
389+ }
390+
391+
376392 func validateMatcherOrderAllowed (order) = {
377393 let cfg = getPoolConfig()
378394 let amtAssetId = cfg[idxAmtAssetId]
379395 let priceAssetId = cfg[idxPriceAssetId]
380396 let poolStatus = parseIntValue(cfg[idxPoolStatus])
381397 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
382398 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
383- let accAmtAssetBalance = getAccBalance(amtAssetId)
384- let accPriceAssetBalance = getAccBalance(priceAssetId)
385- let curPriceX18 = if ((order.orderType == Buy))
386- then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance)
387- else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance)
388- let curPrice = fromX18(curPriceX18, scale8)
399+ let amountAssetAmount = order.amount
400+ let priceAssetAmount = fraction(order.amount, order.price, scale8)
401+ let $t01983820050 = if ((order.orderType == Buy))
402+ then $Tuple2(amountAssetAmount, -(priceAssetAmount))
403+ else $Tuple2(-(amountAssetAmount), priceAssetAmount)
404+ let amountAssetBalanceDelta = $t01983820050._1
405+ let priceAssetBalanceDelta = $t01983820050._2
389406 if (if (if (isGlobalShutdown())
390407 then true
391408 else (poolStatus == PoolMatcherDisabled))
392409 then true
393410 else (poolStatus == PoolShutdown))
394411 then throw("Exchange operations disabled")
395412 else {
396- let orderAmtAsset = order.assetPair.amountAsset
397- let orderAmtAssetStr = if ((orderAmtAsset == unit))
398- then "WAVES"
399- else toBase58String(value(orderAmtAsset))
400- let orderPriceAsset = order.assetPair.priceAsset
401- let orderPriceAssetStr = if ((orderPriceAsset == unit))
402- then "WAVES"
403- else toBase58String(value(orderPriceAsset))
413+ let orderAmtAssetStr = assetIdToString(value(order.assetPair.amountAsset))
414+ let orderPriceAssetStr = assetIdToString(value(order.assetPair.priceAsset))
404415 if (if ((orderAmtAssetStr != amtAssetId))
405416 then true
406417 else (orderPriceAssetStr != priceAssetId))
407418 then throw("Wrong order assets.")
408419 else {
409- let orderPrice = order.price
410- let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm)
411- let castedOrderPrice = toScale(orderPrice, scale8, priceDcm)
412- let isOrderPriceValid = if ((order.orderType == Buy))
413- then (curPrice >= castedOrderPrice)
414- else (castedOrderPrice >= curPrice)
415- let kLp = valueOrErrorMessage(getInteger(this, keyKLp), fmtErr("kLp is required"))
416- let kLpNew = 0
420+ let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
421+ let $t02064520745 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
422+ let unusedActions = $t02064520745._1
423+ let kLpNew = $t02064520745._2
417424 let isOrderValid = (kLpNew > kLp)
418425 isOrderValid
419426 }
420427 }
421428 }
422429
423430
424431 func commonGet (i) = if ((size(i.payments) != 1))
425432 then throw("exactly 1 payment is expected")
426433 else {
427434 let pmt = value(i.payments[0])
428435 let pmtAssetId = value(pmt.assetId)
429436 let pmtAmt = pmt.amount
430437 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
431438 let outAmAmt = res._1
432439 let outPrAmt = res._2
433440 let poolStatus = parseIntValue(res._9)
434441 let state = res._10
435442 if (if (isGlobalShutdown())
436443 then true
437444 else (poolStatus == PoolShutdown))
438445 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
439446 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
440447 }
441448
442449
443450 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
444451 then throw("exactly 2 payments are expected")
445452 else {
446453 let amAssetPmt = value(i.payments[0])
447454 let prAssetPmt = value(i.payments[1])
448455 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
449456 let poolStatus = parseIntValue(estPut._8)
450457 if (if (if (isGlobalShutdown())
451458 then true
452459 else (poolStatus == PoolPutDisabled))
453460 then true
454461 else (poolStatus == PoolShutdown))
455462 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
456463 else estPut
457464 }
458465
459466
460467 func emit (amount) = {
461468 let emitInv = invoke(factoryContract, "emit", [amount], nil)
462469 if ((emitInv == emitInv))
463470 then {
464471 let emitInvLegacy = match emitInv {
465472 case legacyFactoryContract: Address =>
466473 invoke(legacyFactoryContract, "emit", [amount], nil)
467474 case _ =>
468475 unit
469476 }
470477 if ((emitInvLegacy == emitInvLegacy))
471478 then amount
472479 else throw("Strict value is not equal to itself.")
473480 }
474481 else throw("Strict value is not equal to itself.")
475482 }
476483
477484
478485 func takeFee (amount) = {
479486 let feeAmount = fraction(amount, fee, scale8)
480487 $Tuple2((amount - feeAmount), feeAmount)
481488 }
482489
483490
484491 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
485492 let isEval = (txId == unit)
486493 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
487494 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
488495 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
489496 then true
490497 else if ((paymentAssetId == cfgPriceAssetId))
491498 then false
492499 else throwErr("invalid asset")
493- let $t02309923392 = if (isEval)
500+ let $t02342923722 = if (isEval)
494501 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
495502 else if (paymentInAmountAsset)
496503 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
497504 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
498- let amountBalanceOld = $t02309923392._1
499- let priceBalanceOld = $t02309923392._2
500- let $t02339623545 = if (paymentInAmountAsset)
505+ let amountBalanceOld = $t02342923722._1
506+ let priceBalanceOld = $t02342923722._2
507+ let $t02372623875 = if (paymentInAmountAsset)
501508 then $Tuple2(paymentAmountRaw, 0)
502509 else $Tuple2(0, paymentAmountRaw)
503- let amountAssetAmountRaw = $t02339623545._1
504- let priceAssetAmountRaw = $t02339623545._2
510+ let amountAssetAmountRaw = $t02372623875._1
511+ let priceAssetAmountRaw = $t02372623875._2
505512 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
506513 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
507- let $t02366723726 = takeFee(paymentAmountRaw)
508- let paymentAmount = $t02366723726._1
509- let feeAmount = $t02366723726._2
514+ let $t02399724056 = takeFee(paymentAmountRaw)
515+ let paymentAmount = $t02399724056._1
516+ let feeAmount = $t02399724056._2
510517 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
511518 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
512519 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
513520 let priceNew = fromX18(priceNewX18, scale8)
514521 let paymentBalance = if (paymentInAmountAsset)
515522 then amountBalanceOld
516523 else priceBalanceOld
517524 let paymentBalanceBigInt = toBigInt(paymentBalance)
518525 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
519526 let chechSupply = if ((supplyBigInt > big0))
520527 then true
521528 else throwErr("initial deposit requires all coins")
522529 if ((chechSupply == chechSupply))
523530 then {
524531 let depositBigInt = toBigInt(paymentAmount)
525532 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
526533 let commonState = if (isEval)
527534 then nil
528535 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))]
529536 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
530537 let priceOld = fromX18(priceOldX18, scale8)
531538 let loss = {
532- let $t02520325370 = if (paymentInAmountAsset)
539+ let $t02553325700 = if (paymentInAmountAsset)
533540 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
534541 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
535- let amount = $t02520325370._1
536- let balance = $t02520325370._2
542+ let amount = $t02553325700._1
543+ let balance = $t02553325700._2
537544 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
538545 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
539546 }
540547 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
541548 }
542549 else throw("Strict value is not equal to itself.")
543550 }
544551
545552
546553 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
547554 let isEval = (txId == unit)
548555 let checks = [if ((paymentAssetId == cfgLpAssetId))
549556 then true
550557 else throwErr("invalid lp asset")]
551558 if ((checks == checks))
552559 then {
553560 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
554561 then true
555562 else if ((outAssetId == cfgPriceAssetId))
556563 then false
557564 else throwErr("invalid asset")
558565 let balanceBigInt = if (outInAmountAsset)
559566 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
560567 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
561568 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
562569 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
563570 let outBalance = if (outInAmountAsset)
564571 then amBalanceOld
565572 else prBalanceOld
566573 let outBalanceBigInt = toBigInt(outBalance)
567574 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
568575 let redeemedBigInt = toBigInt(paymentAmount)
569576 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
570- let $t02697227022 = takeFee(amountRaw)
571- let totalAmount = $t02697227022._1
572- let feeAmount = $t02697227022._2
573- let $t02702627252 = if (outInAmountAsset)
577+ let $t02730227352 = takeFee(amountRaw)
578+ let totalAmount = $t02730227352._1
579+ let feeAmount = $t02730227352._2
580+ let $t02735627582 = if (outInAmountAsset)
574581 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
575582 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
576- let outAmAmount = $t02702627252._1
577- let outPrAmount = $t02702627252._2
578- let amBalanceNew = $t02702627252._3
579- let prBalanceNew = $t02702627252._4
583+ let outAmAmount = $t02735627582._1
584+ let outPrAmount = $t02735627582._2
585+ let amBalanceNew = $t02735627582._3
586+ let prBalanceNew = $t02735627582._4
580587 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
581588 let priceNew = fromX18(priceNewX18, scale8)
582589 let commonState = if (isEval)
583590 then nil
584591 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)]
585592 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
586593 let priceOld = fromX18(priceOldX18, scale8)
587594 let loss = {
588595 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
589596 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
590597 }
591598 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
592599 }
593600 else throw("Strict value is not equal to itself.")
594- }
595-
596-
597-func calcKLp (amountBalance,priceBalance,lpEmission) = {
598- let updatedKLp = fraction(pow((amountBalance * priceBalance), 0, toBigInt(5), 1, 0, DOWN), scale18, lpEmission)
599- updatedKLp
600- }
601-
602-
603-func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
604- let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
605- let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
606- let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
607- let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
608- let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
609- $Tuple2(actions, updatedKLp)
610601 }
611602
612603
613604 func managerPublicKeyOrUnit () = match getString(mpk()) {
614605 case s: String =>
615606 fromBase58String(s)
616607 case _: Unit =>
617608 unit
618609 case _ =>
619610 throw("Match error")
620611 }
621612
622613
623614 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
624615 case s: String =>
625616 fromBase58String(s)
626617 case _: Unit =>
627618 unit
628619 case _ =>
629620 throw("Match error")
630621 }
631622
632623
633624 func isManager (i) = match managerPublicKeyOrUnit() {
634625 case pk: ByteVector =>
635626 (i.callerPublicKey == pk)
636627 case _: Unit =>
637628 (i.caller == this)
638629 case _ =>
639630 throw("Match error")
640631 }
641632
642633
643634 func mustManager (i) = {
644635 let pd = throw("Permission denied")
645636 match managerPublicKeyOrUnit() {
646637 case pk: ByteVector =>
647638 if ((i.callerPublicKey == pk))
648639 then true
649640 else pd
650641 case _: Unit =>
651642 if ((i.caller == this))
652643 then true
653644 else pd
654645 case _ =>
655646 throw("Match error")
656647 }
657648 }
658649
659650
660651 @Callable(i)
661652 func setManager (pendingManagerPublicKey) = {
662653 let checkCaller = mustManager(i)
663654 if ((checkCaller == checkCaller))
664655 then {
665656 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
666657 if ((checkManagerPublicKey == checkManagerPublicKey))
667658 then [StringEntry(pmpk(), pendingManagerPublicKey)]
668659 else throw("Strict value is not equal to itself.")
669660 }
670661 else throw("Strict value is not equal to itself.")
671662 }
672663
673664
674665
675666 @Callable(i)
676667 func confirmManager () = {
677668 let pm = pendingManagerPublicKeyOrUnit()
678669 let hasPM = if (isDefined(pm))
679670 then true
680671 else throw("No pending manager")
681672 if ((hasPM == hasPM))
682673 then {
683674 let checkPM = if ((i.callerPublicKey == value(pm)))
684675 then true
685676 else throw("You are not pending manager")
686677 if ((checkPM == checkPM))
687678 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
688679 else throw("Strict value is not equal to itself.")
689680 }
690681 else throw("Strict value is not equal to itself.")
691682 }
692683
693684
694685
695686 @Callable(i)
696687 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
697688 then throw("Invalid slippageTolerance passed")
698689 else {
699690 let estPut = commonPut(i, slippageTolerance, true)
700691 let emitLpAmt = estPut._2
701692 let lpAssetId = estPut._7
702693 let state = estPut._9
703694 let amDiff = estPut._10
704695 let prDiff = estPut._11
705696 let amId = estPut._12
706697 let prId = estPut._13
707698 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
708699 if ((emitInv == emitInv))
709700 then {
710701 let emitInvLegacy = match emitInv {
711702 case legacyFactoryContract: Address =>
712703 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
713704 case _ =>
714705 unit
715706 }
716707 if ((emitInvLegacy == emitInvLegacy))
717708 then {
718709 let slippageAInv = if ((amDiff > 0))
719710 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
720711 else nil
721712 if ((slippageAInv == slippageAInv))
722713 then {
723714 let slippagePInv = if ((prDiff > 0))
724715 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
725716 else nil
726717 if ((slippagePInv == slippagePInv))
727718 then {
728719 let lpTransfer = if (shouldAutoStake)
729720 then {
730721 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
731722 if ((slpStakeInv == slpStakeInv))
732723 then nil
733724 else throw("Strict value is not equal to itself.")
734725 }
735726 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
736- let $t03215332218 = refreshKLpInternal(0, 0, 0)
737- let refreshKLpActions = $t03215332218._1
738- let updatedKLp = $t03215332218._2
727+ let $t03153331598 = refreshKLpInternal(0, 0, 0)
728+ let refreshKLpActions = $t03153331598._1
729+ let updatedKLp = $t03153331598._2
739730 ((state ++ lpTransfer) ++ refreshKLpActions)
740731 }
741732 else throw("Strict value is not equal to itself.")
742733 }
743734 else throw("Strict value is not equal to itself.")
744735 }
745736 else throw("Strict value is not equal to itself.")
746737 }
747738 else throw("Strict value is not equal to itself.")
748739 }
749740
750741
751742
752743 @Callable(i)
753744 func putForFree (maxSlippage) = if ((0 > maxSlippage))
754745 then throw("Invalid value passed")
755746 else {
756747 let estPut = commonPut(i, maxSlippage, false)
757748 let state = estPut._9
758- let $t03250432569 = refreshKLpInternal(0, 0, 0)
759- let refreshKLpActions = $t03250432569._1
760- let updatedKLp = $t03250432569._2
749+ let $t03188431949 = refreshKLpInternal(0, 0, 0)
750+ let refreshKLpActions = $t03188431949._1
751+ let updatedKLp = $t03188431949._2
761752 (state ++ refreshKLpActions)
762753 }
763754
764755
765756
766757 @Callable(i)
767758 func putOneTkn (minOutAmount,autoStake) = {
768759 let isPoolOneTokenOperationsDisabled = {
769760 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
770761 if ($isInstanceOf(@, "Boolean"))
771762 then @
772763 else throw(($getType(@) + " couldn't be cast to Boolean"))
773764 }
774765 let isPutDisabled = if (if (if (isGlobalShutdown())
775766 then true
776767 else (cfgPoolStatus == PoolPutDisabled))
777768 then true
778769 else (cfgPoolStatus == PoolShutdown))
779770 then true
780771 else isPoolOneTokenOperationsDisabled
781772 let checks = [if (if (!(isPutDisabled))
782773 then true
783774 else isManager(i))
784775 then true
785776 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
786777 then true
787778 else throwErr("exactly 1 payment are expected")]
788779 if ((checks == checks))
789780 then {
790781 let payment = i.payments[0]
791782 let paymentAssetId = payment.assetId
792783 let paymentAmountRaw = payment.amount
793784 let userAddress = i.caller
794785 let txId = i.transactionId
795- let $t03334533494 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
796- let emitAmountEstimated = $t03334533494._1
797- let commonState = $t03334533494._2
798- let feeAmount = $t03334533494._3
799- let bonus = $t03334533494._4
800- let paymentInAmountAsset = $t03334533494._5
786+ let $t03272532874 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
787+ let emitAmountEstimated = $t03272532874._1
788+ let commonState = $t03272532874._2
789+ let feeAmount = $t03272532874._3
790+ let bonus = $t03272532874._4
791+ let paymentInAmountAsset = $t03272532874._5
801792 let emitAmount = if (if ((minOutAmount > 0))
802793 then (minOutAmount > emitAmountEstimated)
803794 else false)
804795 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
805796 else emitAmountEstimated
806797 let emitInv = emit(emitAmount)
807798 if ((emitInv == emitInv))
808799 then {
809800 let lpTransfer = if (autoStake)
810801 then {
811802 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
812803 if ((stakeInv == stakeInv))
813804 then nil
814805 else throw("Strict value is not equal to itself.")
815806 }
816807 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
817808 let sendFee = if ((feeAmount > 0))
818809 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
819810 else nil
820- let $t03408034277 = if ((this == feeCollectorAddress))
811+ let $t03346033657 = if ((this == feeCollectorAddress))
821812 then $Tuple2(0, 0)
822813 else if (paymentInAmountAsset)
823814 then $Tuple2(-(feeAmount), 0)
824815 else $Tuple2(0, -(feeAmount))
825- let amountAssetBalanceDelta = $t03408034277._1
826- let priceAssetBalanceDelta = $t03408034277._2
827- let $t03428034388 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
828- let refreshKLpActions = $t03428034388._1
829- let updatedKLp = $t03428034388._2
816+ let amountAssetBalanceDelta = $t03346033657._1
817+ let priceAssetBalanceDelta = $t03346033657._2
818+ let $t03366033768 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
819+ let refreshKLpActions = $t03366033768._1
820+ let updatedKLp = $t03366033768._2
830821 $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
831822 }
832823 else throw("Strict value is not equal to itself.")
833824 }
834825 else throw("Strict value is not equal to itself.")
835826 }
836827
837828
838829
839830 @Callable(i)
840831 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
841- let $t03458134738 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
842- let emitAmountEstimated = $t03458134738._1
843- let commonState = $t03458134738._2
844- let feeAmount = $t03458134738._3
845- let bonus = $t03458134738._4
846- let paymentInAmountAsset = $t03458134738._5
832+ let $t03396134118 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
833+ let emitAmountEstimated = $t03396134118._1
834+ let commonState = $t03396134118._2
835+ let feeAmount = $t03396134118._3
836+ let bonus = $t03396134118._4
837+ let paymentInAmountAsset = $t03396134118._5
847838 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
848839 }
849840
850841
851842
852843 @Callable(i)
853844 func getOneTkn (outAssetIdStr,minOutAmount) = {
854845 let isPoolOneTokenOperationsDisabled = {
855846 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
856847 if ($isInstanceOf(@, "Boolean"))
857848 then @
858849 else throw(($getType(@) + " couldn't be cast to Boolean"))
859850 }
860851 let isGetDisabled = if (if (isGlobalShutdown())
861852 then true
862853 else (cfgPoolStatus == PoolShutdown))
863854 then true
864855 else isPoolOneTokenOperationsDisabled
865856 let checks = [if (if (!(isGetDisabled))
866857 then true
867858 else isManager(i))
868859 then true
869860 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
870861 then true
871862 else throwErr("exactly 1 payment are expected")]
872863 if ((checks == checks))
873864 then {
874865 let outAssetId = parseAssetId(outAssetIdStr)
875866 let payment = i.payments[0]
876867 let paymentAssetId = payment.assetId
877868 let paymentAmount = payment.amount
878869 let userAddress = i.caller
879870 let txId = i.transactionId
880- let $t03554335693 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
881- let amountEstimated = $t03554335693._1
882- let commonState = $t03554335693._2
883- let feeAmount = $t03554335693._3
884- let bonus = $t03554335693._4
885- let outInAmountAsset = $t03554335693._5
871+ let $t03492335073 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
872+ let amountEstimated = $t03492335073._1
873+ let commonState = $t03492335073._2
874+ let feeAmount = $t03492335073._3
875+ let bonus = $t03492335073._4
876+ let outInAmountAsset = $t03492335073._5
886877 let amount = if (if ((minOutAmount > 0))
887878 then (minOutAmount > amountEstimated)
888879 else false)
889880 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
890881 else amountEstimated
891882 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
892883 if ((burnInv == burnInv))
893884 then {
894885 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
895886 let sendFee = if ((feeAmount > 0))
896887 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
897888 else nil
898- let $t03619336440 = {
889+ let $t03557335820 = {
899890 let feeAmountForCalc = if ((this == feeCollectorAddress))
900891 then 0
901892 else feeAmount
902893 if (outInAmountAsset)
903894 then $Tuple2(-((amount + feeAmountForCalc)), 0)
904895 else $Tuple2(0, -((amount + feeAmountForCalc)))
905896 }
906- let amountAssetBalanceDelta = $t03619336440._1
907- let priceAssetBalanceDelta = $t03619336440._2
908- let $t03644336551 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
909- let refreshKLpActions = $t03644336551._1
910- let updatedKLp = $t03644336551._2
897+ let amountAssetBalanceDelta = $t03557335820._1
898+ let priceAssetBalanceDelta = $t03557335820._2
899+ let $t03582335931 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
900+ let refreshKLpActions = $t03582335931._1
901+ let updatedKLp = $t03582335931._2
911902 $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
912903 }
913904 else throw("Strict value is not equal to itself.")
914905 }
915906 else throw("Strict value is not equal to itself.")
916907 }
917908
918909
919910
920911 @Callable(i)
921912 func getOneTknREADONLY (outAssetId,paymentAmount) = {
922- let $t03673536891 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
923- let amountEstimated = $t03673536891._1
924- let commonState = $t03673536891._2
925- let feeAmount = $t03673536891._3
926- let bonus = $t03673536891._4
927- let outInAmountAsset = $t03673536891._5
913+ let $t03611536271 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
914+ let amountEstimated = $t03611536271._1
915+ let commonState = $t03611536271._2
916+ let feeAmount = $t03611536271._3
917+ let bonus = $t03611536271._4
918+ let outInAmountAsset = $t03611536271._5
928919 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
929920 }
930921
931922
932923
933924 @Callable(i)
934925 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
935926 let isPoolOneTokenOperationsDisabled = {
936927 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
937928 if ($isInstanceOf(@, "Boolean"))
938929 then @
939930 else throw(($getType(@) + " couldn't be cast to Boolean"))
940931 }
941932 let isGetDisabled = if (if (isGlobalShutdown())
942933 then true
943934 else (cfgPoolStatus == PoolShutdown))
944935 then true
945936 else isPoolOneTokenOperationsDisabled
946937 let checks = [if (if (!(isGetDisabled))
947938 then true
948939 else isManager(i))
949940 then true
950941 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
951942 then true
952943 else throwErr("no payments are expected")]
953944 if ((checks == checks))
954945 then {
955946 let outAssetId = parseAssetId(outAssetIdStr)
956947 let userAddress = i.caller
957948 let txId = i.transactionId
958949 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
959950 if ((unstakeInv == unstakeInv))
960951 then {
961- let $t03771637864 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
962- let amountEstimated = $t03771637864._1
963- let commonState = $t03771637864._2
964- let feeAmount = $t03771637864._3
965- let bonus = $t03771637864._4
966- let outInAmountAsset = $t03771637864._5
952+ let $t03709637244 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
953+ let amountEstimated = $t03709637244._1
954+ let commonState = $t03709637244._2
955+ let feeAmount = $t03709637244._3
956+ let bonus = $t03709637244._4
957+ let outInAmountAsset = $t03709637244._5
967958 let amount = if (if ((minOutAmount > 0))
968959 then (minOutAmount > amountEstimated)
969960 else false)
970961 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
971962 else amountEstimated
972963 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
973964 if ((burnInv == burnInv))
974965 then {
975966 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
976967 let sendFee = if ((feeAmount > 0))
977968 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
978969 else nil
979- let $t03835938606 = {
970+ let $t03773937986 = {
980971 let feeAmountForCalc = if ((this == feeCollectorAddress))
981972 then 0
982973 else feeAmount
983974 if (outInAmountAsset)
984975 then $Tuple2(-((amount + feeAmountForCalc)), 0)
985976 else $Tuple2(0, -((amount + feeAmountForCalc)))
986977 }
987- let amountAssetBalanceDelta = $t03835938606._1
988- let priceAssetBalanceDelta = $t03835938606._2
989- let $t03860938717 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
990- let refreshKLpActions = $t03860938717._1
991- let updatedKLp = $t03860938717._2
978+ let amountAssetBalanceDelta = $t03773937986._1
979+ let priceAssetBalanceDelta = $t03773937986._2
980+ let $t03798938097 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
981+ let refreshKLpActions = $t03798938097._1
982+ let updatedKLp = $t03798938097._2
992983 $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
993984 }
994985 else throw("Strict value is not equal to itself.")
995986 }
996987 else throw("Strict value is not equal to itself.")
997988 }
998989 else throw("Strict value is not equal to itself.")
999990 }
1000991
1001992
1002993
1003994 @Callable(i)
1004995 func get () = {
1005996 let res = commonGet(i)
1006997 let outAmtAmt = res._1
1007998 let outPrAmt = res._2
1008999 let pmtAmt = res._3
10091000 let pmtAssetId = res._4
10101001 let state = res._5
10111002 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10121003 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10131004 then {
1014- let $t03950939591 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1015- let refreshKLpActions = $t03950939591._1
1016- let updatedKLp = $t03950939591._2
1005+ let $t03888938971 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1006+ let refreshKLpActions = $t03888938971._1
1007+ let updatedKLp = $t03888938971._2
10171008 (state ++ refreshKLpActions)
10181009 }
10191010 else throw("Strict value is not equal to itself.")
10201011 }
10211012
10221013
10231014
10241015 @Callable(i)
10251016 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
10261017 let res = commonGet(i)
10271018 let outAmAmt = res._1
10281019 let outPrAmt = res._2
10291020 let pmtAmt = res._3
10301021 let pmtAssetId = res._4
10311022 let state = res._5
10321023 if ((noLessThenAmtAsset > outAmAmt))
10331024 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
10341025 else if ((noLessThenPriceAsset > outPrAmt))
10351026 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
10361027 else {
10371028 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10381029 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10391030 then {
1040- let $t04038740468 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1041- let refreshKLpActions = $t04038740468._1
1042- let updatedKLp = $t04038740468._2
1031+ let $t03976739848 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1032+ let refreshKLpActions = $t03976739848._1
1033+ let updatedKLp = $t03976739848._2
10431034 (state ++ refreshKLpActions)
10441035 }
10451036 else throw("Strict value is not equal to itself.")
10461037 }
10471038 }
10481039
10491040
10501041
10511042 @Callable(i)
10521043 func unstakeAndGet (amount) = {
10531044 let checkPayments = if ((size(i.payments) != 0))
10541045 then throw("No payments are expected")
10551046 else true
10561047 if ((checkPayments == checkPayments))
10571048 then {
10581049 let cfg = getPoolConfig()
10591050 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
10601051 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
10611052 if ((unstakeInv == unstakeInv))
10621053 then {
10631054 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
10641055 let outAmAmt = res._1
10651056 let outPrAmt = res._2
10661057 let poolStatus = parseIntValue(res._9)
10671058 let state = res._10
10681059 let checkPoolStatus = if (if (isGlobalShutdown())
10691060 then true
10701061 else (poolStatus == PoolShutdown))
10711062 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
10721063 else true
10731064 if ((checkPoolStatus == checkPoolStatus))
10741065 then {
10751066 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
10761067 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
10771068 then {
1078- let $t04144141522 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1079- let refreshKLpActions = $t04144141522._1
1080- let updatedKLp = $t04144141522._2
1069+ let $t04082140902 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1070+ let refreshKLpActions = $t04082140902._1
1071+ let updatedKLp = $t04082140902._2
10811072 (state ++ refreshKLpActions)
10821073 }
10831074 else throw("Strict value is not equal to itself.")
10841075 }
10851076 else throw("Strict value is not equal to itself.")
10861077 }
10871078 else throw("Strict value is not equal to itself.")
10881079 }
10891080 else throw("Strict value is not equal to itself.")
10901081 }
10911082
10921083
10931084
10941085 @Callable(i)
10951086 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
10961087 let isGetDisabled = if (isGlobalShutdown())
10971088 then true
10981089 else (cfgPoolStatus == PoolShutdown)
10991090 let checks = [if (!(isGetDisabled))
11001091 then true
11011092 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11021093 then true
11031094 else throw("no payments are expected")]
11041095 if ((checks == checks))
11051096 then {
11061097 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11071098 if ((unstakeInv == unstakeInv))
11081099 then {
11091100 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11101101 let outAmAmt = res._1
11111102 let outPrAmt = res._2
11121103 let state = res._10
11131104 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11141105 then true
11151106 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11161107 then true
11171108 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11181109 if ((checkAmounts == checkAmounts))
11191110 then {
11201111 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11211112 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11221113 then {
1123- let $t04266242743 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1124- let refreshKLpActions = $t04266242743._1
1125- let updatedKLp = $t04266242743._2
1114+ let $t04204242123 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1115+ let refreshKLpActions = $t04204242123._1
1116+ let updatedKLp = $t04204242123._2
11261117 (state ++ refreshKLpActions)
11271118 }
11281119 else throw("Strict value is not equal to itself.")
11291120 }
11301121 else throw("Strict value is not equal to itself.")
11311122 }
11321123 else throw("Strict value is not equal to itself.")
11331124 }
11341125 else throw("Strict value is not equal to itself.")
11351126 }
11361127
11371128
11381129
11391130 @Callable(i)
11401131 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
11411132 then throw("permissions denied")
11421133 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
11431134
11441135
11451136
11461137 @Callable(i)
11471138 func refreshKLp () = {
11481139 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
11491140 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
11501141 then unit
11511142 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
11521143 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
11531144 then {
1154- let $t04373143786 = refreshKLpInternal(0, 0, 0)
1155- let actions = $t04373143786._1
1156- let updatedKLp = $t04373143786._2
1145+ let $t04311143166 = refreshKLpInternal(0, 0, 0)
1146+ let actions = $t04311143166._1
1147+ let updatedKLp = $t04311143166._2
11571148 $Tuple2(actions, toString(updatedKLp))
11581149 }
11591150 else throw("Strict value is not equal to itself.")
11601151 }
11611152
11621153
11631154
11641155 @Callable(i)
11651156 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
11661157
11671158
11681159
11691160 @Callable(i)
11701161 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
11711162
11721163
11731164
11741165 @Callable(i)
11751166 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
11761167 let prices = calcPrices(amAmt, prAmt, lpAmt)
11771168 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
11781169 }
11791170
11801171
11811172
11821173 @Callable(i)
11831174 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
11841175
11851176
11861177
11871178 @Callable(i)
11881179 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
11891180
11901181
11911182
11921183 @Callable(i)
11931184 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
11941185
11951186
11961187
11971188 @Callable(i)
11981189 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
11991190
12001191
12011192
12021193 @Callable(i)
12031194 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
12041195 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
12051196 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
12061197 }
12071198
12081199
12091200
12101201 @Callable(i)
12111202 func statsREADONLY () = {
12121203 let cfg = getPoolConfig()
12131204 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12141205 let amtAssetId = cfg[idxAmtAssetId]
12151206 let priceAssetId = cfg[idxPriceAssetId]
12161207 let iAmtAssetId = cfg[idxIAmtAssetId]
12171208 let iPriceAssetId = cfg[idxIPriceAssetId]
12181209 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12191210 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12201211 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12211212 let accAmtAssetBalance = getAccBalance(amtAssetId)
12221213 let accPriceAssetBalance = getAccBalance(priceAssetId)
12231214 let pricesList = if ((poolLPBalance == 0))
12241215 then [zeroBigInt, zeroBigInt, zeroBigInt]
12251216 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
12261217 let curPrice = 0
12271218 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
12281219 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
12291220 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
12301221 $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))
12311222 }
12321223
12331224
12341225
12351226 @Callable(i)
12361227 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
12371228 let cfg = getPoolConfig()
12381229 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12391230 let amAssetIdStr = cfg[idxAmtAssetId]
12401231 let amAssetId = fromBase58String(amAssetIdStr)
12411232 let prAssetIdStr = cfg[idxPriceAssetId]
12421233 let prAssetId = fromBase58String(prAssetIdStr)
12431234 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12441235 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12451236 let poolStatus = cfg[idxPoolStatus]
12461237 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12471238 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
12481239 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
12491240 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
12501241 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
12511242 let curPriceX18 = if ((poolLPBalance == 0))
12521243 then zeroBigInt
12531244 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
12541245 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
12551246 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
12561247 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
12571248 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
12581249 let calcLpAmt = estPut._1
12591250 let curPriceCalc = estPut._3
12601251 let amBalance = estPut._4
12611252 let prBalance = estPut._5
12621253 let lpEmission = estPut._6
12631254 $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))
12641255 }
12651256
12661257
12671258
12681259 @Callable(i)
12691260 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
12701261 let cfg = getPoolConfig()
12711262 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12721263 let amAssetIdStr = cfg[idxAmtAssetId]
12731264 let amAssetId = fromBase58String(amAssetIdStr)
12741265 let prAssetIdStr = cfg[idxPriceAssetId]
12751266 let prAssetId = fromBase58String(prAssetIdStr)
12761267 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12771268 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12781269 let poolStatus = cfg[idxPoolStatus]
12791270 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12801271 let amBalanceRaw = getAccBalance(amAssetIdStr)
12811272 let prBalanceRaw = getAccBalance(prAssetIdStr)
12821273 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
12831274 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
12841275 let curPriceX18 = if ((poolLPBalance == 0))
12851276 then zeroBigInt
12861277 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
12871278 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
12881279 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
12891280 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
12901281 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
12911282 let calcLpAmt = estPut._1
12921283 let curPriceCalc = estPut._3
12931284 let amBalance = estPut._4
12941285 let prBalance = estPut._5
12951286 let lpEmission = estPut._6
12961287 $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))
12971288 }
12981289
12991290
13001291
13011292 @Callable(i)
13021293 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
13031294 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
13041295 let outAmAmt = res._1
13051296 let outPrAmt = res._2
13061297 let amBalance = res._5
13071298 let prBalance = res._6
13081299 let lpEmission = res._7
13091300 let curPrice = res._8
13101301 let poolStatus = parseIntValue(res._9)
13111302 $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))
13121303 }
13131304
13141305
13151306 @Verifier(tx)
13161307 func verify () = {
13171308 let targetPublicKey = match managerPublicKeyOrUnit() {
13181309 case pk: ByteVector =>
13191310 pk
13201311 case _: Unit =>
13211312 tx.senderPublicKey
13221313 case _ =>
13231314 throw("Match error")
13241315 }
13251316 match tx {
13261317 case order: Order =>
13271318 let matcherPub = getMatcherPubOrFail()
13281319 let orderValid = validateMatcherOrderAllowed(order)
13291320 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
13301321 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
13311322 if (if (if (orderValid)
13321323 then senderValid
13331324 else false)
13341325 then matcherValid
13351326 else false)
13361327 then true
13371328 else throwOrderError(orderValid, senderValid, matcherValid)
13381329 case s: SetScriptTransaction =>
13391330 let newHash = blake2b256(value(s.script))
13401331 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
13411332 let currentHash = scriptHash(this)
13421333 if (if ((allowedHash == newHash))
13431334 then (currentHash != newHash)
13441335 else false)
13451336 then true
13461337 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13471338 case _ =>
13481339 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13491340 }
13501341 }
13511342

github/deemru/w8io/026f985 
170.62 ms