tx · HpF7B15eEQ1cYRDCTsUWm8BppA3DDrJEkUbiYyvDb8Mm

3N3oJ29jrZz2cSdsiH3oJSrDm1QnAeKJPZe:  -0.03000000 Waves

2022.11.30 15:12 [2339819] smart account 3N3oJ29jrZz2cSdsiH3oJSrDm1QnAeKJPZe > SELF 0.00000000 Waves

{ "type": 13, "id": "HpF7B15eEQ1cYRDCTsUWm8BppA3DDrJEkUbiYyvDb8Mm", "fee": 3000000, "feeAssetId": null, "timestamp": 1669810282273, "version": 1, "sender": "3N3oJ29jrZz2cSdsiH3oJSrDm1QnAeKJPZe", "senderPublicKey": "49f2aBjLx6yH8T5J4Ejuk3yo7gz8E7A8zYqssmv8MbSN", "proofs": [ "3PxEBtwd9QyLy6QY2oR2xjTXuwoBUmhiq4WnNjc354mKShDRU2pr9RvAaLvGT61AuWsXJvaR5VvN6rJYUFtbozSc" ], "script": "base64:BgK8JwgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASAwoBCBIFCgMBAQESBAoCAQESBAoCCAESBAoCCAgSCwoJCAEBAgECCAQEEgYKBAgIAQgSABIDCgEBEgMKAQESBAoCCAEiCmxQZGVjaW1hbHMiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgt3YXZlc1N0cmluZyIDU0VQIgpQb29sQWN0aXZlIg9Qb29sUHV0RGlzYWJsZWQiE1Bvb2xNYXRjaGVyRGlzYWJsZWQiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiDWlkeFBvb2xTdGF0dXMiEGlkeFBvb2xMUEFzc2V0SWQiDWlkeEFtdEFzc2V0SWQiD2lkeFByaWNlQXNzZXRJZCIOaWR4QW10QXNzZXREY20iEGlkeFByaWNlQXNzZXREY20iDmlkeElBbXRBc3NldElkIhBpZHhJUHJ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Id": 84, "height": 2339819, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6Fb53pZknQayCmbStom8dchz6YzR2toFJ5ziJj3ZBcxp Next: AaUSsE8DxdQeUPqSzCFre6L7SvxPsfBvuj17dMsVUnN Diff:
OldNewDifferences
111111
112112 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
113113
114-let keyKLp = makeString(["%s", "kLp"], SEP)
115-
116-let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
117-
118-let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
119-
120-let kLpRefreshDelayDefault = 30
121-
122-let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
123-
124114 func keyFactoryConfig () = "%s__factoryConfig"
125115
126116
159149 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
160150
161151
162-func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
163-
164-
165152 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
166153
167154 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
196183
197184 let poolConfigParsed = parsePoolConfig(getPoolConfig())
198185
199-let $t079158081 = poolConfigParsed
186+let $t075447710 = poolConfigParsed
200187
201-let cfgPoolAddress = $t079158081._1
188+let cfgPoolAddress = $t075447710._1
202189
203-let cfgPoolStatus = $t079158081._2
190+let cfgPoolStatus = $t075447710._2
204191
205-let cfgLpAssetId = $t079158081._3
192+let cfgLpAssetId = $t075447710._3
206193
207-let cfgAmountAssetId = $t079158081._4
194+let cfgAmountAssetId = $t075447710._4
208195
209-let cfgPriceAssetId = $t079158081._5
196+let cfgPriceAssetId = $t075447710._5
210197
211-let cfgAmountAssetDecimals = $t079158081._6
198+let cfgAmountAssetDecimals = $t075447710._6
212199
213-let cfgPriceAssetDecimals = $t079158081._7
200+let cfgPriceAssetDecimals = $t075447710._7
214201
215202 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
216203
373360 }
374361
375362
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-
392363 func validateMatcherOrderAllowed (order) = {
393- let amountAssetAmount = order.amount
394- let priceAssetAmount = fraction(order.amount, order.price, scale8)
395- let $t01955919771 = if ((order.orderType == Buy))
396- then $Tuple2(amountAssetAmount, -(priceAssetAmount))
397- else $Tuple2(-(amountAssetAmount), priceAssetAmount)
398- let amountAssetBalanceDelta = $t01955919771._1
399- let priceAssetBalanceDelta = $t01955919771._2
364+ let cfg = getPoolConfig()
365+ let amtAssetId = cfg[idxAmtAssetId]
366+ let priceAssetId = cfg[idxPriceAssetId]
367+ let poolStatus = parseIntValue(cfg[idxPoolStatus])
368+ let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
369+ let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
370+ let accAmtAssetBalance = getAccBalance(amtAssetId)
371+ let accPriceAssetBalance = getAccBalance(priceAssetId)
372+ let curPriceX18 = if ((order.orderType == Buy))
373+ then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance)
374+ else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance)
375+ let curPrice = fromX18(curPriceX18, scale8)
400376 if (if (if (isGlobalShutdown())
401377 then true
402- else (cfgPoolStatus == PoolMatcherDisabled))
378+ else (poolStatus == PoolMatcherDisabled))
403379 then true
404- else (cfgPoolStatus == PoolShutdown))
380+ else (poolStatus == PoolShutdown))
405381 then throw("Exchange operations disabled")
406- else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
407- then true
408- else (order.assetPair.priceAsset != cfgPriceAssetId))
409- then throw("Wrong order assets.")
410- else {
411- let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
412- let $t02024220342 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
413- let unusedActions = $t02024220342._1
414- let kLpNew = $t02024220342._2
415- let isOrderValid = (kLpNew > kLp)
416- isOrderValid
417- }
382+ else {
383+ let orderAmtAsset = order.assetPair.amountAsset
384+ let orderAmtAssetStr = if ((orderAmtAsset == unit))
385+ then "WAVES"
386+ else toBase58String(value(orderAmtAsset))
387+ let orderPriceAsset = order.assetPair.priceAsset
388+ let orderPriceAssetStr = if ((orderPriceAsset == unit))
389+ then "WAVES"
390+ else toBase58String(value(orderPriceAsset))
391+ if (if ((orderAmtAssetStr != amtAssetId))
392+ then true
393+ else (orderPriceAssetStr != priceAssetId))
394+ then throw("Wrong order assets.")
395+ else {
396+ let orderPrice = order.price
397+ let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm)
398+ let castedOrderPrice = toScale(orderPrice, scale8, priceDcm)
399+ let isOrderPriceValid = if ((order.orderType == Buy))
400+ then (curPrice >= castedOrderPrice)
401+ else (castedOrderPrice >= curPrice)
402+ true
403+ }
404+ }
418405 }
419406
420407
487474 else if ((paymentAssetId == cfgPriceAssetId))
488475 then false
489476 else throwErr("invalid asset")
490- let $t02302623319 = if (isEval)
477+ let $t02257122864 = if (isEval)
491478 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
492479 else if (paymentInAmountAsset)
493480 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
494481 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
495- let amountBalanceOld = $t02302623319._1
496- let priceBalanceOld = $t02302623319._2
497- let $t02332323472 = if (paymentInAmountAsset)
482+ let amountBalanceOld = $t02257122864._1
483+ let priceBalanceOld = $t02257122864._2
484+ let $t02286823017 = if (paymentInAmountAsset)
498485 then $Tuple2(paymentAmountRaw, 0)
499486 else $Tuple2(0, paymentAmountRaw)
500- let amountAssetAmountRaw = $t02332323472._1
501- let priceAssetAmountRaw = $t02332323472._2
487+ let amountAssetAmountRaw = $t02286823017._1
488+ let priceAssetAmountRaw = $t02286823017._2
502489 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
503490 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
504- let $t02359423653 = takeFee(paymentAmountRaw)
505- let paymentAmount = $t02359423653._1
506- let feeAmount = $t02359423653._2
491+ let $t02313923198 = takeFee(paymentAmountRaw)
492+ let paymentAmount = $t02313923198._1
493+ let feeAmount = $t02313923198._2
507494 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
508495 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
509496 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
526513 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
527514 let priceOld = fromX18(priceOldX18, scale8)
528515 let loss = {
529- let $t02513025297 = if (paymentInAmountAsset)
516+ let $t02467524842 = if (paymentInAmountAsset)
530517 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
531518 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
532- let amount = $t02513025297._1
533- let balance = $t02513025297._2
519+ let amount = $t02467524842._1
520+ let balance = $t02467524842._2
534521 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
535522 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
536523 }
537- $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
524+ $Tuple4(issueAmount, commonState, feeAmount, loss)
538525 }
539526 else throw("Strict value is not equal to itself.")
540527 }
564551 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
565552 let redeemedBigInt = toBigInt(paymentAmount)
566553 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
567- let $t02689926949 = takeFee(amountRaw)
568- let totalAmount = $t02689926949._1
569- let feeAmount = $t02689926949._2
570- let $t02695327179 = if (outInAmountAsset)
554+ let $t02642226472 = takeFee(amountRaw)
555+ let totalAmount = $t02642226472._1
556+ let feeAmount = $t02642226472._2
557+ let $t02647626702 = if (outInAmountAsset)
571558 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
572559 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
573- let outAmAmount = $t02695327179._1
574- let outPrAmount = $t02695327179._2
575- let amBalanceNew = $t02695327179._3
576- let prBalanceNew = $t02695327179._4
560+ let outAmAmount = $t02647626702._1
561+ let outPrAmount = $t02647626702._2
562+ let amBalanceNew = $t02647626702._3
563+ let prBalanceNew = $t02647626702._4
577564 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
578565 let priceNew = fromX18(priceNewX18, scale8)
579566 let commonState = if (isEval)
585572 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
586573 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
587574 }
588- $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
575+ $Tuple4(totalAmount, commonState, feeAmount, loss)
589576 }
590577 else throw("Strict value is not equal to itself.")
591578 }
714701 else throw("Strict value is not equal to itself.")
715702 }
716703 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
717- let $t03113031195 = refreshKLpInternal(0, 0, 0)
718- let refreshKLpActions = $t03113031195._1
719- let updatedKLp = $t03113031195._2
720- ((state ++ lpTransfer) ++ refreshKLpActions)
704+ (state ++ lpTransfer)
721705 }
722706 else throw("Strict value is not equal to itself.")
723707 }
735719 then throw("Invalid value passed")
736720 else {
737721 let estPut = commonPut(i, maxSlippage, false)
738- let state = estPut._9
739- let $t03148131546 = refreshKLpInternal(0, 0, 0)
740- let refreshKLpActions = $t03148131546._1
741- let updatedKLp = $t03148131546._2
742- (state ++ refreshKLpActions)
722+ estPut._9
743723 }
744724
745725
773753 let paymentAmountRaw = payment.amount
774754 let userAddress = i.caller
775755 let txId = i.transactionId
776- let $t03232232474 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
777- if (($t03232232474 == $t03232232474))
756+ let $t03160931736 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
757+ let emitAmountEstimated = $t03160931736._1
758+ let commonState = $t03160931736._2
759+ let feeAmount = $t03160931736._3
760+ let bonus = $t03160931736._4
761+ let emitAmount = if (if ((minOutAmount > 0))
762+ then (minOutAmount > emitAmountEstimated)
763+ else false)
764+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
765+ else emitAmountEstimated
766+ let emitInv = emit(emitAmount)
767+ if ((emitInv == emitInv))
778768 then {
779- let paymentInAmountAsset = $t03232232474._5
780- let bonus = $t03232232474._4
781- let feeAmount = $t03232232474._3
782- let commonState = $t03232232474._2
783- let emitAmountEstimated = $t03232232474._1
784- let emitAmount = if (if ((minOutAmount > 0))
785- then (minOutAmount > emitAmountEstimated)
786- else false)
787- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
788- else emitAmountEstimated
789- let emitInv = emit(emitAmount)
790- if ((emitInv == emitInv))
769+ let lpTransfer = if (autoStake)
791770 then {
792- let lpTransfer = if (autoStake)
793- then {
794- let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
795- if ((stakeInv == stakeInv))
796- then nil
797- else throw("Strict value is not equal to itself.")
798- }
799- else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
800- let sendFee = if ((feeAmount > 0))
801- then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
802- else nil
803- let $t03306033257 = if ((this == feeCollectorAddress))
804- then $Tuple2(0, 0)
805- else if (paymentInAmountAsset)
806- then $Tuple2(-(feeAmount), 0)
807- else $Tuple2(0, -(feeAmount))
808- let amountAssetBalanceDelta = $t03306033257._1
809- let priceAssetBalanceDelta = $t03306033257._2
810- let $t03326033368 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
811- let refreshKLpActions = $t03326033368._1
812- let updatedKLp = $t03326033368._2
813- $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
771+ let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
772+ if ((stakeInv == stakeInv))
773+ then nil
774+ else throw("Strict value is not equal to itself.")
814775 }
815- else throw("Strict value is not equal to itself.")
776+ else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
777+ let sendFee = if ((feeAmount > 0))
778+ then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
779+ else nil
780+ $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount)
816781 }
817782 else throw("Strict value is not equal to itself.")
818783 }
823788
824789 @Callable(i)
825790 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
826- let $t03356133718 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
827- let emitAmountEstimated = $t03356133718._1
828- let commonState = $t03356133718._2
829- let feeAmount = $t03356133718._3
830- let bonus = $t03356133718._4
831- let paymentInAmountAsset = $t03356133718._5
791+ let $t03246532600 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
792+ let emitAmountEstimated = $t03246532600._1
793+ let commonState = $t03246532600._2
794+ let feeAmount = $t03246532600._3
795+ let bonus = $t03246532600._4
832796 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
833797 }
834798
862826 let paymentAmount = payment.amount
863827 let userAddress = i.caller
864828 let txId = i.transactionId
865- let $t03452334676 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
866- if (($t03452334676 == $t03452334676))
829+ let $t03340533537 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
830+ let amountEstimated = $t03340533537._1
831+ let commonState = $t03340533537._2
832+ let feeAmount = $t03340533537._3
833+ let bonus = $t03340533537._4
834+ let amount = if (if ((minOutAmount > 0))
835+ then (minOutAmount > amountEstimated)
836+ else false)
837+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
838+ else amountEstimated
839+ let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
840+ if ((burnInv == burnInv))
867841 then {
868- let outInAmountAsset = $t03452334676._5
869- let bonus = $t03452334676._4
870- let feeAmount = $t03452334676._3
871- let commonState = $t03452334676._2
872- let amountEstimated = $t03452334676._1
873- let amount = if (if ((minOutAmount > 0))
874- then (minOutAmount > amountEstimated)
875- else false)
876- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
877- else amountEstimated
878- let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
879- if ((burnInv == burnInv))
880- then {
881- let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
882- let sendFee = if ((feeAmount > 0))
883- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
884- else nil
885- let $t03517635423 = {
886- let feeAmountForCalc = if ((this == feeCollectorAddress))
887- then 0
888- else feeAmount
889- if (outInAmountAsset)
890- then $Tuple2(-((amount + feeAmountForCalc)), 0)
891- else $Tuple2(0, -((amount + feeAmountForCalc)))
892- }
893- let amountAssetBalanceDelta = $t03517635423._1
894- let priceAssetBalanceDelta = $t03517635423._2
895- let $t03542635534 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
896- let refreshKLpActions = $t03542635534._1
897- let updatedKLp = $t03542635534._2
898- $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
899- }
900- else throw("Strict value is not equal to itself.")
842+ let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
843+ let sendFee = if ((feeAmount > 0))
844+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
845+ else nil
846+ $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
901847 }
902848 else throw("Strict value is not equal to itself.")
903849 }
908854
909855 @Callable(i)
910856 func getOneTknREADONLY (outAssetId,paymentAmount) = {
911- let $t03571835874 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
912- let amountEstimated = $t03571835874._1
913- let commonState = $t03571835874._2
914- let feeAmount = $t03571835874._3
915- let bonus = $t03571835874._4
916- let outInAmountAsset = $t03571835874._5
857+ let $t03417234310 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
858+ let amountEstimated = $t03417234310._1
859+ let commonState = $t03417234310._2
860+ let feeAmount = $t03417234310._3
861+ let bonus = $t03417234310._4
917862 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
918863 }
919864
947892 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
948893 if ((unstakeInv == unstakeInv))
949894 then {
950- let $t03669936850 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
951- if (($t03669936850 == $t03669936850))
895+ let $t03513535265 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
896+ let amountEstimated = $t03513535265._1
897+ let commonState = $t03513535265._2
898+ let feeAmount = $t03513535265._3
899+ let bonus = $t03513535265._4
900+ let amount = if (if ((minOutAmount > 0))
901+ then (minOutAmount > amountEstimated)
902+ else false)
903+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
904+ else amountEstimated
905+ let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
906+ if ((burnInv == burnInv))
952907 then {
953- let outInAmountAsset = $t03669936850._5
954- let bonus = $t03669936850._4
955- let feeAmount = $t03669936850._3
956- let commonState = $t03669936850._2
957- let amountEstimated = $t03669936850._1
958- let amount = if (if ((minOutAmount > 0))
959- then (minOutAmount > amountEstimated)
960- else false)
961- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
962- else amountEstimated
963- let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
964- if ((burnInv == burnInv))
965- then {
966- let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
967- let sendFee = if ((feeAmount > 0))
968- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
969- else nil
970- let $t03734537592 = {
971- let feeAmountForCalc = if ((this == feeCollectorAddress))
972- then 0
973- else feeAmount
974- if (outInAmountAsset)
975- then $Tuple2(-((amount + feeAmountForCalc)), 0)
976- else $Tuple2(0, -((amount + feeAmountForCalc)))
977- }
978- let amountAssetBalanceDelta = $t03734537592._1
979- let priceAssetBalanceDelta = $t03734537592._2
980- let $t03759537703 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
981- let refreshKLpActions = $t03759537703._1
982- let updatedKLp = $t03759537703._2
983- $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
984- }
985- else throw("Strict value is not equal to itself.")
908+ let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
909+ let sendFee = if ((feeAmount > 0))
910+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
911+ else nil
912+ $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
986913 }
987914 else throw("Strict value is not equal to itself.")
988915 }
1003930 let state = res._5
1004931 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1005932 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1006- then {
1007- let $t03849538577 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1008- let refreshKLpActions = $t03849538577._1
1009- let updatedKLp = $t03849538577._2
1010- (state ++ refreshKLpActions)
1011- }
933+ then state
1012934 else throw("Strict value is not equal to itself.")
1013935 }
1014936
1029951 else {
1030952 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1031953 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1032- then {
1033- let $t03937339454 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1034- let refreshKLpActions = $t03937339454._1
1035- let updatedKLp = $t03937339454._2
1036- (state ++ refreshKLpActions)
1037- }
954+ then state
1038955 else throw("Strict value is not equal to itself.")
1039956 }
1040957 }
1054971 if ((unstakeInv == unstakeInv))
1055972 then {
1056973 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1057- let outAmAmt = res._1
1058- let outPrAmt = res._2
1059974 let poolStatus = parseIntValue(res._9)
1060975 let state = res._10
1061976 let checkPoolStatus = if (if (isGlobalShutdown())
1067982 then {
1068983 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
1069984 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1070- then {
1071- let $t04042740508 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1072- let refreshKLpActions = $t04042740508._1
1073- let updatedKLp = $t04042740508._2
1074- (state ++ refreshKLpActions)
1075- }
985+ then state
1076986 else throw("Strict value is not equal to itself.")
1077987 }
1078988 else throw("Strict value is not equal to itself.")
11121022 then {
11131023 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11141024 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1115- then {
1116- let $t04164841729 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1117- let refreshKLpActions = $t04164841729._1
1118- let updatedKLp = $t04164841729._2
1119- (state ++ refreshKLpActions)
1120- }
1025+ then state
11211026 else throw("Strict value is not equal to itself.")
11221027 }
11231028 else throw("Strict value is not equal to itself.")
11331038 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
11341039 then throw("permissions denied")
11351040 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
1136-
1137-
1138-
1139-@Callable(i)
1140-func refreshKLp () = {
1141- let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
1142- let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
1143- then unit
1144- else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1145- if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1146- then {
1147- let $t04271742772 = refreshKLpInternal(0, 0, 0)
1148- let actions = $t04271742772._1
1149- let updatedKLp = $t04271742772._2
1150- $Tuple2(actions, toString(updatedKLp))
1151- }
1152- else throw("Strict value is not equal to itself.")
1153- }
11541041
11551042
11561043
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
114-let keyKLp = makeString(["%s", "kLp"], SEP)
115-
116-let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
117-
118-let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
119-
120-let kLpRefreshDelayDefault = 30
121-
122-let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
123-
124114 func keyFactoryConfig () = "%s__factoryConfig"
125115
126116
127117 func keyMatcherPub () = "%s%s__matcher__publicKey"
128118
129119
130120 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
131121
132122
133123 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
134124
135125
136126 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
137127
138128
139129 func keyAllPoolsShutdown () = "%s__shutdown"
140130
141131
142132 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
143133
144134
145135 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
146136
147137
148138 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
149139
150140 func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
151141
152142
153143 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
154144
155145
156146 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
157147
158148
159149 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
160150
161151
162-func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
163-
164-
165152 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
166153
167154 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
168155
169156 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
170157
171158
172159 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
173160
174161
175162 func getPoolConfig () = {
176163 let amtAsset = getStringOrFail(this, aa())
177164 let priceAsset = getStringOrFail(this, pa())
178165 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
179166 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
180167 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
181168 }
182169
183170
184171 func parseAssetId (input) = if ((input == wavesString))
185172 then unit
186173 else fromBase58String(input)
187174
188175
189176 func assetIdToString (input) = if ((input == unit))
190177 then wavesString
191178 else toBase58String(value(input))
192179
193180
194181 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]))
195182
196183
197184 let poolConfigParsed = parsePoolConfig(getPoolConfig())
198185
199-let $t079158081 = poolConfigParsed
186+let $t075447710 = poolConfigParsed
200187
201-let cfgPoolAddress = $t079158081._1
188+let cfgPoolAddress = $t075447710._1
202189
203-let cfgPoolStatus = $t079158081._2
190+let cfgPoolStatus = $t075447710._2
204191
205-let cfgLpAssetId = $t079158081._3
192+let cfgLpAssetId = $t075447710._3
206193
207-let cfgAmountAssetId = $t079158081._4
194+let cfgAmountAssetId = $t075447710._4
208195
209-let cfgPriceAssetId = $t079158081._5
196+let cfgPriceAssetId = $t075447710._5
210197
211-let cfgAmountAssetDecimals = $t079158081._6
198+let cfgAmountAssetDecimals = $t075447710._6
212199
213-let cfgPriceAssetDecimals = $t079158081._7
200+let cfgPriceAssetDecimals = $t075447710._7
214201
215202 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
216203
217204
218205 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
219206
220207 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
221208
222209 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)
223210
224211
225212 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)
226213
227214
228215 func getAccBalance (assetId) = if ((assetId == "WAVES"))
229216 then wavesBalance(this).available
230217 else assetBalance(this, fromBase58String(assetId))
231218
232219
233220 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
234221
235222
236223 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
237224 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
238225 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
239226 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
240227 }
241228
242229
243230 func calcPrices (amAmt,prAmt,lpAmt) = {
244231 let cfg = getPoolConfig()
245232 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
246233 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
247234 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
248235 let amAmtX18 = toX18(amAmt, amtAssetDcm)
249236 let prAmtX18 = toX18(prAmt, priceAssetDcm)
250237 let lpAmtX18 = toX18(lpAmt, scale8)
251238 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
252239 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
253240 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
254241 }
255242
256243
257244 func calculatePrices (amAmt,prAmt,lpAmt) = {
258245 let prices = calcPrices(amAmt, prAmt, lpAmt)
259246 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
260247 }
261248
262249
263250 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
264251 let cfg = getPoolConfig()
265252 let lpAssetId = cfg[idxPoolLPAssetId]
266253 let amAssetId = cfg[idxAmtAssetId]
267254 let prAssetId = cfg[idxPriceAssetId]
268255 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
269256 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
270257 let poolStatus = cfg[idxPoolStatus]
271258 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
272259 if ((lpAssetId != pmtAssetId))
273260 then throw("Invalid asset passed.")
274261 else {
275262 let amBalance = getAccBalance(amAssetId)
276263 let amBalanceX18 = toX18(amBalance, amAssetDcm)
277264 let prBalance = getAccBalance(prAssetId)
278265 let prBalanceX18 = toX18(prBalance, prAssetDcm)
279266 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
280267 let curPrice = fromX18(curPriceX18, scale8)
281268 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
282269 let lpEmissionX18 = toX18(lpEmission, scale8)
283270 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
284271 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
285272 let outAmAmt = fromX18(outAmAmtX18, amAssetDcm)
286273 let outPrAmt = fromX18(outPrAmtX18, prAssetDcm)
287274 let state = if ((txId58 == ""))
288275 then nil
289276 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
290277 then unit
291278 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
292279 then unit
293280 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)]
294281 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
295282 }
296283 }
297284
298285
299286 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
300287 let cfg = getPoolConfig()
301288 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
302289 let amAssetIdStr = cfg[idxAmtAssetId]
303290 let prAssetIdStr = cfg[idxPriceAssetId]
304291 let iAmtAssetId = cfg[idxIAmtAssetId]
305292 let iPriceAssetId = cfg[idxIPriceAssetId]
306293 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
307294 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
308295 let poolStatus = cfg[idxPoolStatus]
309296 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
310297 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
311298 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
312299 if (if ((amAssetIdStr != inAmAssetIdStr))
313300 then true
314301 else (prAssetIdStr != inPrAssetIdStr))
315302 then throw("Invalid amt or price asset passed.")
316303 else {
317304 let amBalance = if (isEvaluate)
318305 then getAccBalance(amAssetIdStr)
319306 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
320307 let prBalance = if (isEvaluate)
321308 then getAccBalance(prAssetIdStr)
322309 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
323310 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
324311 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
325312 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
326313 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
327314 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
328315 let res = if ((lpEmission == 0))
329316 then {
330317 let curPriceX18 = zeroBigInt
331318 let slippageX18 = zeroBigInt
332319 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
333320 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
334321 }
335322 else {
336323 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
337324 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
338325 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
339326 if (if ((curPriceX18 != zeroBigInt))
340327 then (slippageX18 > slippageToleranceX18)
341328 else false)
342329 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
343330 else {
344331 let lpEmissionX18 = toX18(lpEmission, scale8)
345332 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
346333 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
347334 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
348335 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
349336 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
350337 let expAmtAssetAmtX18 = expectedAmts._1
351338 let expPriceAssetAmtX18 = expectedAmts._2
352339 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
353340 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18)
354341 }
355342 }
356343 let calcLpAmt = res._1
357344 let calcAmAssetPmt = res._2
358345 let calcPrAssetPmt = res._3
359346 let curPrice = fromX18(res._4, scale8)
360347 let slippageCalc = fromX18(res._5, scale8)
361348 if ((0 >= calcLpAmt))
362349 then throw("Invalid calculations. LP calculated is less than zero.")
363350 else {
364351 let emitLpAmt = if (!(emitLp))
365352 then 0
366353 else calcLpAmt
367354 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
368355 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
369356 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))]
370357 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
371358 }
372359 }
373360 }
374361
375362
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-
392363 func validateMatcherOrderAllowed (order) = {
393- let amountAssetAmount = order.amount
394- let priceAssetAmount = fraction(order.amount, order.price, scale8)
395- let $t01955919771 = if ((order.orderType == Buy))
396- then $Tuple2(amountAssetAmount, -(priceAssetAmount))
397- else $Tuple2(-(amountAssetAmount), priceAssetAmount)
398- let amountAssetBalanceDelta = $t01955919771._1
399- let priceAssetBalanceDelta = $t01955919771._2
364+ let cfg = getPoolConfig()
365+ let amtAssetId = cfg[idxAmtAssetId]
366+ let priceAssetId = cfg[idxPriceAssetId]
367+ let poolStatus = parseIntValue(cfg[idxPoolStatus])
368+ let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
369+ let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
370+ let accAmtAssetBalance = getAccBalance(amtAssetId)
371+ let accPriceAssetBalance = getAccBalance(priceAssetId)
372+ let curPriceX18 = if ((order.orderType == Buy))
373+ then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance)
374+ else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance)
375+ let curPrice = fromX18(curPriceX18, scale8)
400376 if (if (if (isGlobalShutdown())
401377 then true
402- else (cfgPoolStatus == PoolMatcherDisabled))
378+ else (poolStatus == PoolMatcherDisabled))
403379 then true
404- else (cfgPoolStatus == PoolShutdown))
380+ else (poolStatus == PoolShutdown))
405381 then throw("Exchange operations disabled")
406- else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
407- then true
408- else (order.assetPair.priceAsset != cfgPriceAssetId))
409- then throw("Wrong order assets.")
410- else {
411- let kLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyKLp), fmtErr("kLp is required"))), fmtErr("invalid kLp"))
412- let $t02024220342 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
413- let unusedActions = $t02024220342._1
414- let kLpNew = $t02024220342._2
415- let isOrderValid = (kLpNew > kLp)
416- isOrderValid
417- }
382+ else {
383+ let orderAmtAsset = order.assetPair.amountAsset
384+ let orderAmtAssetStr = if ((orderAmtAsset == unit))
385+ then "WAVES"
386+ else toBase58String(value(orderAmtAsset))
387+ let orderPriceAsset = order.assetPair.priceAsset
388+ let orderPriceAssetStr = if ((orderPriceAsset == unit))
389+ then "WAVES"
390+ else toBase58String(value(orderPriceAsset))
391+ if (if ((orderAmtAssetStr != amtAssetId))
392+ then true
393+ else (orderPriceAssetStr != priceAssetId))
394+ then throw("Wrong order assets.")
395+ else {
396+ let orderPrice = order.price
397+ let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm)
398+ let castedOrderPrice = toScale(orderPrice, scale8, priceDcm)
399+ let isOrderPriceValid = if ((order.orderType == Buy))
400+ then (curPrice >= castedOrderPrice)
401+ else (castedOrderPrice >= curPrice)
402+ true
403+ }
404+ }
418405 }
419406
420407
421408 func commonGet (i) = if ((size(i.payments) != 1))
422409 then throw("exactly 1 payment is expected")
423410 else {
424411 let pmt = value(i.payments[0])
425412 let pmtAssetId = value(pmt.assetId)
426413 let pmtAmt = pmt.amount
427414 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
428415 let outAmAmt = res._1
429416 let outPrAmt = res._2
430417 let poolStatus = parseIntValue(res._9)
431418 let state = res._10
432419 if (if (isGlobalShutdown())
433420 then true
434421 else (poolStatus == PoolShutdown))
435422 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
436423 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
437424 }
438425
439426
440427 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
441428 then throw("exactly 2 payments are expected")
442429 else {
443430 let amAssetPmt = value(i.payments[0])
444431 let prAssetPmt = value(i.payments[1])
445432 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
446433 let poolStatus = parseIntValue(estPut._8)
447434 if (if (if (isGlobalShutdown())
448435 then true
449436 else (poolStatus == PoolPutDisabled))
450437 then true
451438 else (poolStatus == PoolShutdown))
452439 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
453440 else estPut
454441 }
455442
456443
457444 func emit (amount) = {
458445 let emitInv = invoke(factoryContract, "emit", [amount], nil)
459446 if ((emitInv == emitInv))
460447 then {
461448 let emitInvLegacy = match emitInv {
462449 case legacyFactoryContract: Address =>
463450 invoke(legacyFactoryContract, "emit", [amount], nil)
464451 case _ =>
465452 unit
466453 }
467454 if ((emitInvLegacy == emitInvLegacy))
468455 then amount
469456 else throw("Strict value is not equal to itself.")
470457 }
471458 else throw("Strict value is not equal to itself.")
472459 }
473460
474461
475462 func takeFee (amount) = {
476463 let feeAmount = fraction(amount, fee, scale8)
477464 $Tuple2((amount - feeAmount), feeAmount)
478465 }
479466
480467
481468 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
482469 let isEval = (txId == unit)
483470 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
484471 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
485472 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
486473 then true
487474 else if ((paymentAssetId == cfgPriceAssetId))
488475 then false
489476 else throwErr("invalid asset")
490- let $t02302623319 = if (isEval)
477+ let $t02257122864 = if (isEval)
491478 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
492479 else if (paymentInAmountAsset)
493480 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
494481 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
495- let amountBalanceOld = $t02302623319._1
496- let priceBalanceOld = $t02302623319._2
497- let $t02332323472 = if (paymentInAmountAsset)
482+ let amountBalanceOld = $t02257122864._1
483+ let priceBalanceOld = $t02257122864._2
484+ let $t02286823017 = if (paymentInAmountAsset)
498485 then $Tuple2(paymentAmountRaw, 0)
499486 else $Tuple2(0, paymentAmountRaw)
500- let amountAssetAmountRaw = $t02332323472._1
501- let priceAssetAmountRaw = $t02332323472._2
487+ let amountAssetAmountRaw = $t02286823017._1
488+ let priceAssetAmountRaw = $t02286823017._2
502489 let amountAssetAmount = takeFee(amountAssetAmountRaw)._1
503490 let priceAssetAmount = takeFee(priceAssetAmountRaw)._1
504- let $t02359423653 = takeFee(paymentAmountRaw)
505- let paymentAmount = $t02359423653._1
506- let feeAmount = $t02359423653._2
491+ let $t02313923198 = takeFee(paymentAmountRaw)
492+ let paymentAmount = $t02313923198._1
493+ let feeAmount = $t02313923198._2
507494 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
508495 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
509496 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
510497 let priceNew = fromX18(priceNewX18, scale8)
511498 let paymentBalance = if (paymentInAmountAsset)
512499 then amountBalanceOld
513500 else priceBalanceOld
514501 let paymentBalanceBigInt = toBigInt(paymentBalance)
515502 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
516503 let chechSupply = if ((supplyBigInt > big0))
517504 then true
518505 else throwErr("initial deposit requires all coins")
519506 if ((chechSupply == chechSupply))
520507 then {
521508 let depositBigInt = toBigInt(paymentAmount)
522509 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
523510 let commonState = if (isEval)
524511 then nil
525512 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))]
526513 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
527514 let priceOld = fromX18(priceOldX18, scale8)
528515 let loss = {
529- let $t02513025297 = if (paymentInAmountAsset)
516+ let $t02467524842 = if (paymentInAmountAsset)
530517 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
531518 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
532- let amount = $t02513025297._1
533- let balance = $t02513025297._2
519+ let amount = $t02467524842._1
520+ let balance = $t02467524842._2
534521 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
535522 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
536523 }
537- $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
524+ $Tuple4(issueAmount, commonState, feeAmount, loss)
538525 }
539526 else throw("Strict value is not equal to itself.")
540527 }
541528
542529
543530 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
544531 let isEval = (txId == unit)
545532 let checks = [if ((paymentAssetId == cfgLpAssetId))
546533 then true
547534 else throwErr("invalid lp asset")]
548535 if ((checks == checks))
549536 then {
550537 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
551538 then true
552539 else if ((outAssetId == cfgPriceAssetId))
553540 then false
554541 else throwErr("invalid asset")
555542 let balanceBigInt = if (outInAmountAsset)
556543 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
557544 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
558545 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
559546 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
560547 let outBalance = if (outInAmountAsset)
561548 then amBalanceOld
562549 else prBalanceOld
563550 let outBalanceBigInt = toBigInt(outBalance)
564551 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
565552 let redeemedBigInt = toBigInt(paymentAmount)
566553 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
567- let $t02689926949 = takeFee(amountRaw)
568- let totalAmount = $t02689926949._1
569- let feeAmount = $t02689926949._2
570- let $t02695327179 = if (outInAmountAsset)
554+ let $t02642226472 = takeFee(amountRaw)
555+ let totalAmount = $t02642226472._1
556+ let feeAmount = $t02642226472._2
557+ let $t02647626702 = if (outInAmountAsset)
571558 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
572559 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
573- let outAmAmount = $t02695327179._1
574- let outPrAmount = $t02695327179._2
575- let amBalanceNew = $t02695327179._3
576- let prBalanceNew = $t02695327179._4
560+ let outAmAmount = $t02647626702._1
561+ let outPrAmount = $t02647626702._2
562+ let amBalanceNew = $t02647626702._3
563+ let prBalanceNew = $t02647626702._4
577564 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
578565 let priceNew = fromX18(priceNewX18, scale8)
579566 let commonState = if (isEval)
580567 then nil
581568 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)]
582569 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
583570 let priceOld = fromX18(priceOldX18, scale8)
584571 let loss = {
585572 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
586573 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
587574 }
588- $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
575+ $Tuple4(totalAmount, commonState, feeAmount, loss)
589576 }
590577 else throw("Strict value is not equal to itself.")
591578 }
592579
593580
594581 func managerPublicKeyOrUnit () = match getString(mpk()) {
595582 case s: String =>
596583 fromBase58String(s)
597584 case _: Unit =>
598585 unit
599586 case _ =>
600587 throw("Match error")
601588 }
602589
603590
604591 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
605592 case s: String =>
606593 fromBase58String(s)
607594 case _: Unit =>
608595 unit
609596 case _ =>
610597 throw("Match error")
611598 }
612599
613600
614601 func isManager (i) = match managerPublicKeyOrUnit() {
615602 case pk: ByteVector =>
616603 (i.callerPublicKey == pk)
617604 case _: Unit =>
618605 (i.caller == this)
619606 case _ =>
620607 throw("Match error")
621608 }
622609
623610
624611 func mustManager (i) = {
625612 let pd = throw("Permission denied")
626613 match managerPublicKeyOrUnit() {
627614 case pk: ByteVector =>
628615 if ((i.callerPublicKey == pk))
629616 then true
630617 else pd
631618 case _: Unit =>
632619 if ((i.caller == this))
633620 then true
634621 else pd
635622 case _ =>
636623 throw("Match error")
637624 }
638625 }
639626
640627
641628 @Callable(i)
642629 func setManager (pendingManagerPublicKey) = {
643630 let checkCaller = mustManager(i)
644631 if ((checkCaller == checkCaller))
645632 then {
646633 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
647634 if ((checkManagerPublicKey == checkManagerPublicKey))
648635 then [StringEntry(pmpk(), pendingManagerPublicKey)]
649636 else throw("Strict value is not equal to itself.")
650637 }
651638 else throw("Strict value is not equal to itself.")
652639 }
653640
654641
655642
656643 @Callable(i)
657644 func confirmManager () = {
658645 let pm = pendingManagerPublicKeyOrUnit()
659646 let hasPM = if (isDefined(pm))
660647 then true
661648 else throw("No pending manager")
662649 if ((hasPM == hasPM))
663650 then {
664651 let checkPM = if ((i.callerPublicKey == value(pm)))
665652 then true
666653 else throw("You are not pending manager")
667654 if ((checkPM == checkPM))
668655 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
669656 else throw("Strict value is not equal to itself.")
670657 }
671658 else throw("Strict value is not equal to itself.")
672659 }
673660
674661
675662
676663 @Callable(i)
677664 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
678665 then throw("Invalid slippageTolerance passed")
679666 else {
680667 let estPut = commonPut(i, slippageTolerance, true)
681668 let emitLpAmt = estPut._2
682669 let lpAssetId = estPut._7
683670 let state = estPut._9
684671 let amDiff = estPut._10
685672 let prDiff = estPut._11
686673 let amId = estPut._12
687674 let prId = estPut._13
688675 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
689676 if ((emitInv == emitInv))
690677 then {
691678 let emitInvLegacy = match emitInv {
692679 case legacyFactoryContract: Address =>
693680 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
694681 case _ =>
695682 unit
696683 }
697684 if ((emitInvLegacy == emitInvLegacy))
698685 then {
699686 let slippageAInv = if ((amDiff > 0))
700687 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
701688 else nil
702689 if ((slippageAInv == slippageAInv))
703690 then {
704691 let slippagePInv = if ((prDiff > 0))
705692 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
706693 else nil
707694 if ((slippagePInv == slippagePInv))
708695 then {
709696 let lpTransfer = if (shouldAutoStake)
710697 then {
711698 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
712699 if ((slpStakeInv == slpStakeInv))
713700 then nil
714701 else throw("Strict value is not equal to itself.")
715702 }
716703 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
717- let $t03113031195 = refreshKLpInternal(0, 0, 0)
718- let refreshKLpActions = $t03113031195._1
719- let updatedKLp = $t03113031195._2
720- ((state ++ lpTransfer) ++ refreshKLpActions)
704+ (state ++ lpTransfer)
721705 }
722706 else throw("Strict value is not equal to itself.")
723707 }
724708 else throw("Strict value is not equal to itself.")
725709 }
726710 else throw("Strict value is not equal to itself.")
727711 }
728712 else throw("Strict value is not equal to itself.")
729713 }
730714
731715
732716
733717 @Callable(i)
734718 func putForFree (maxSlippage) = if ((0 > maxSlippage))
735719 then throw("Invalid value passed")
736720 else {
737721 let estPut = commonPut(i, maxSlippage, false)
738- let state = estPut._9
739- let $t03148131546 = refreshKLpInternal(0, 0, 0)
740- let refreshKLpActions = $t03148131546._1
741- let updatedKLp = $t03148131546._2
742- (state ++ refreshKLpActions)
722+ estPut._9
743723 }
744724
745725
746726
747727 @Callable(i)
748728 func putOneTkn (minOutAmount,autoStake) = {
749729 let isPoolOneTokenOperationsDisabled = {
750730 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
751731 if ($isInstanceOf(@, "Boolean"))
752732 then @
753733 else throw(($getType(@) + " couldn't be cast to Boolean"))
754734 }
755735 let isPutDisabled = if (if (if (isGlobalShutdown())
756736 then true
757737 else (cfgPoolStatus == PoolPutDisabled))
758738 then true
759739 else (cfgPoolStatus == PoolShutdown))
760740 then true
761741 else isPoolOneTokenOperationsDisabled
762742 let checks = [if (if (!(isPutDisabled))
763743 then true
764744 else isManager(i))
765745 then true
766746 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
767747 then true
768748 else throwErr("exactly 1 payment are expected")]
769749 if ((checks == checks))
770750 then {
771751 let payment = i.payments[0]
772752 let paymentAssetId = payment.assetId
773753 let paymentAmountRaw = payment.amount
774754 let userAddress = i.caller
775755 let txId = i.transactionId
776- let $t03232232474 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
777- if (($t03232232474 == $t03232232474))
756+ let $t03160931736 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
757+ let emitAmountEstimated = $t03160931736._1
758+ let commonState = $t03160931736._2
759+ let feeAmount = $t03160931736._3
760+ let bonus = $t03160931736._4
761+ let emitAmount = if (if ((minOutAmount > 0))
762+ then (minOutAmount > emitAmountEstimated)
763+ else false)
764+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
765+ else emitAmountEstimated
766+ let emitInv = emit(emitAmount)
767+ if ((emitInv == emitInv))
778768 then {
779- let paymentInAmountAsset = $t03232232474._5
780- let bonus = $t03232232474._4
781- let feeAmount = $t03232232474._3
782- let commonState = $t03232232474._2
783- let emitAmountEstimated = $t03232232474._1
784- let emitAmount = if (if ((minOutAmount > 0))
785- then (minOutAmount > emitAmountEstimated)
786- else false)
787- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
788- else emitAmountEstimated
789- let emitInv = emit(emitAmount)
790- if ((emitInv == emitInv))
769+ let lpTransfer = if (autoStake)
791770 then {
792- let lpTransfer = if (autoStake)
793- then {
794- let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
795- if ((stakeInv == stakeInv))
796- then nil
797- else throw("Strict value is not equal to itself.")
798- }
799- else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
800- let sendFee = if ((feeAmount > 0))
801- then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
802- else nil
803- let $t03306033257 = if ((this == feeCollectorAddress))
804- then $Tuple2(0, 0)
805- else if (paymentInAmountAsset)
806- then $Tuple2(-(feeAmount), 0)
807- else $Tuple2(0, -(feeAmount))
808- let amountAssetBalanceDelta = $t03306033257._1
809- let priceAssetBalanceDelta = $t03306033257._2
810- let $t03326033368 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
811- let refreshKLpActions = $t03326033368._1
812- let updatedKLp = $t03326033368._2
813- $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
771+ let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
772+ if ((stakeInv == stakeInv))
773+ then nil
774+ else throw("Strict value is not equal to itself.")
814775 }
815- else throw("Strict value is not equal to itself.")
776+ else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
777+ let sendFee = if ((feeAmount > 0))
778+ then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
779+ else nil
780+ $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount)
816781 }
817782 else throw("Strict value is not equal to itself.")
818783 }
819784 else throw("Strict value is not equal to itself.")
820785 }
821786
822787
823788
824789 @Callable(i)
825790 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
826- let $t03356133718 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
827- let emitAmountEstimated = $t03356133718._1
828- let commonState = $t03356133718._2
829- let feeAmount = $t03356133718._3
830- let bonus = $t03356133718._4
831- let paymentInAmountAsset = $t03356133718._5
791+ let $t03246532600 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
792+ let emitAmountEstimated = $t03246532600._1
793+ let commonState = $t03246532600._2
794+ let feeAmount = $t03246532600._3
795+ let bonus = $t03246532600._4
832796 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
833797 }
834798
835799
836800
837801 @Callable(i)
838802 func getOneTkn (outAssetIdStr,minOutAmount) = {
839803 let isPoolOneTokenOperationsDisabled = {
840804 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
841805 if ($isInstanceOf(@, "Boolean"))
842806 then @
843807 else throw(($getType(@) + " couldn't be cast to Boolean"))
844808 }
845809 let isGetDisabled = if (if (isGlobalShutdown())
846810 then true
847811 else (cfgPoolStatus == PoolShutdown))
848812 then true
849813 else isPoolOneTokenOperationsDisabled
850814 let checks = [if (if (!(isGetDisabled))
851815 then true
852816 else isManager(i))
853817 then true
854818 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
855819 then true
856820 else throwErr("exactly 1 payment are expected")]
857821 if ((checks == checks))
858822 then {
859823 let outAssetId = parseAssetId(outAssetIdStr)
860824 let payment = i.payments[0]
861825 let paymentAssetId = payment.assetId
862826 let paymentAmount = payment.amount
863827 let userAddress = i.caller
864828 let txId = i.transactionId
865- let $t03452334676 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
866- if (($t03452334676 == $t03452334676))
829+ let $t03340533537 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
830+ let amountEstimated = $t03340533537._1
831+ let commonState = $t03340533537._2
832+ let feeAmount = $t03340533537._3
833+ let bonus = $t03340533537._4
834+ let amount = if (if ((minOutAmount > 0))
835+ then (minOutAmount > amountEstimated)
836+ else false)
837+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
838+ else amountEstimated
839+ let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
840+ if ((burnInv == burnInv))
867841 then {
868- let outInAmountAsset = $t03452334676._5
869- let bonus = $t03452334676._4
870- let feeAmount = $t03452334676._3
871- let commonState = $t03452334676._2
872- let amountEstimated = $t03452334676._1
873- let amount = if (if ((minOutAmount > 0))
874- then (minOutAmount > amountEstimated)
875- else false)
876- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
877- else amountEstimated
878- let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
879- if ((burnInv == burnInv))
880- then {
881- let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
882- let sendFee = if ((feeAmount > 0))
883- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
884- else nil
885- let $t03517635423 = {
886- let feeAmountForCalc = if ((this == feeCollectorAddress))
887- then 0
888- else feeAmount
889- if (outInAmountAsset)
890- then $Tuple2(-((amount + feeAmountForCalc)), 0)
891- else $Tuple2(0, -((amount + feeAmountForCalc)))
892- }
893- let amountAssetBalanceDelta = $t03517635423._1
894- let priceAssetBalanceDelta = $t03517635423._2
895- let $t03542635534 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
896- let refreshKLpActions = $t03542635534._1
897- let updatedKLp = $t03542635534._2
898- $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
899- }
900- else throw("Strict value is not equal to itself.")
842+ let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
843+ let sendFee = if ((feeAmount > 0))
844+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
845+ else nil
846+ $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
901847 }
902848 else throw("Strict value is not equal to itself.")
903849 }
904850 else throw("Strict value is not equal to itself.")
905851 }
906852
907853
908854
909855 @Callable(i)
910856 func getOneTknREADONLY (outAssetId,paymentAmount) = {
911- let $t03571835874 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
912- let amountEstimated = $t03571835874._1
913- let commonState = $t03571835874._2
914- let feeAmount = $t03571835874._3
915- let bonus = $t03571835874._4
916- let outInAmountAsset = $t03571835874._5
857+ let $t03417234310 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
858+ let amountEstimated = $t03417234310._1
859+ let commonState = $t03417234310._2
860+ let feeAmount = $t03417234310._3
861+ let bonus = $t03417234310._4
917862 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
918863 }
919864
920865
921866
922867 @Callable(i)
923868 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
924869 let isPoolOneTokenOperationsDisabled = {
925870 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
926871 if ($isInstanceOf(@, "Boolean"))
927872 then @
928873 else throw(($getType(@) + " couldn't be cast to Boolean"))
929874 }
930875 let isGetDisabled = if (if (isGlobalShutdown())
931876 then true
932877 else (cfgPoolStatus == PoolShutdown))
933878 then true
934879 else isPoolOneTokenOperationsDisabled
935880 let checks = [if (if (!(isGetDisabled))
936881 then true
937882 else isManager(i))
938883 then true
939884 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
940885 then true
941886 else throwErr("no payments are expected")]
942887 if ((checks == checks))
943888 then {
944889 let outAssetId = parseAssetId(outAssetIdStr)
945890 let userAddress = i.caller
946891 let txId = i.transactionId
947892 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
948893 if ((unstakeInv == unstakeInv))
949894 then {
950- let $t03669936850 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
951- if (($t03669936850 == $t03669936850))
895+ let $t03513535265 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
896+ let amountEstimated = $t03513535265._1
897+ let commonState = $t03513535265._2
898+ let feeAmount = $t03513535265._3
899+ let bonus = $t03513535265._4
900+ let amount = if (if ((minOutAmount > 0))
901+ then (minOutAmount > amountEstimated)
902+ else false)
903+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
904+ else amountEstimated
905+ let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
906+ if ((burnInv == burnInv))
952907 then {
953- let outInAmountAsset = $t03669936850._5
954- let bonus = $t03669936850._4
955- let feeAmount = $t03669936850._3
956- let commonState = $t03669936850._2
957- let amountEstimated = $t03669936850._1
958- let amount = if (if ((minOutAmount > 0))
959- then (minOutAmount > amountEstimated)
960- else false)
961- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
962- else amountEstimated
963- let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
964- if ((burnInv == burnInv))
965- then {
966- let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
967- let sendFee = if ((feeAmount > 0))
968- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
969- else nil
970- let $t03734537592 = {
971- let feeAmountForCalc = if ((this == feeCollectorAddress))
972- then 0
973- else feeAmount
974- if (outInAmountAsset)
975- then $Tuple2(-((amount + feeAmountForCalc)), 0)
976- else $Tuple2(0, -((amount + feeAmountForCalc)))
977- }
978- let amountAssetBalanceDelta = $t03734537592._1
979- let priceAssetBalanceDelta = $t03734537592._2
980- let $t03759537703 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
981- let refreshKLpActions = $t03759537703._1
982- let updatedKLp = $t03759537703._2
983- $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
984- }
985- else throw("Strict value is not equal to itself.")
908+ let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
909+ let sendFee = if ((feeAmount > 0))
910+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
911+ else nil
912+ $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount)
986913 }
987914 else throw("Strict value is not equal to itself.")
988915 }
989916 else throw("Strict value is not equal to itself.")
990917 }
991918 else throw("Strict value is not equal to itself.")
992919 }
993920
994921
995922
996923 @Callable(i)
997924 func get () = {
998925 let res = commonGet(i)
999926 let outAmtAmt = res._1
1000927 let outPrAmt = res._2
1001928 let pmtAmt = res._3
1002929 let pmtAssetId = res._4
1003930 let state = res._5
1004931 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1005932 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1006- then {
1007- let $t03849538577 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1008- let refreshKLpActions = $t03849538577._1
1009- let updatedKLp = $t03849538577._2
1010- (state ++ refreshKLpActions)
1011- }
933+ then state
1012934 else throw("Strict value is not equal to itself.")
1013935 }
1014936
1015937
1016938
1017939 @Callable(i)
1018940 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
1019941 let res = commonGet(i)
1020942 let outAmAmt = res._1
1021943 let outPrAmt = res._2
1022944 let pmtAmt = res._3
1023945 let pmtAssetId = res._4
1024946 let state = res._5
1025947 if ((noLessThenAmtAsset > outAmAmt))
1026948 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
1027949 else if ((noLessThenPriceAsset > outPrAmt))
1028950 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
1029951 else {
1030952 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1031953 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1032- then {
1033- let $t03937339454 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1034- let refreshKLpActions = $t03937339454._1
1035- let updatedKLp = $t03937339454._2
1036- (state ++ refreshKLpActions)
1037- }
954+ then state
1038955 else throw("Strict value is not equal to itself.")
1039956 }
1040957 }
1041958
1042959
1043960
1044961 @Callable(i)
1045962 func unstakeAndGet (amount) = {
1046963 let checkPayments = if ((size(i.payments) != 0))
1047964 then throw("No payments are expected")
1048965 else true
1049966 if ((checkPayments == checkPayments))
1050967 then {
1051968 let cfg = getPoolConfig()
1052969 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
1053970 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
1054971 if ((unstakeInv == unstakeInv))
1055972 then {
1056973 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1057- let outAmAmt = res._1
1058- let outPrAmt = res._2
1059974 let poolStatus = parseIntValue(res._9)
1060975 let state = res._10
1061976 let checkPoolStatus = if (if (isGlobalShutdown())
1062977 then true
1063978 else (poolStatus == PoolShutdown))
1064979 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
1065980 else true
1066981 if ((checkPoolStatus == checkPoolStatus))
1067982 then {
1068983 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
1069984 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1070- then {
1071- let $t04042740508 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1072- let refreshKLpActions = $t04042740508._1
1073- let updatedKLp = $t04042740508._2
1074- (state ++ refreshKLpActions)
1075- }
985+ then state
1076986 else throw("Strict value is not equal to itself.")
1077987 }
1078988 else throw("Strict value is not equal to itself.")
1079989 }
1080990 else throw("Strict value is not equal to itself.")
1081991 }
1082992 else throw("Strict value is not equal to itself.")
1083993 }
1084994
1085995
1086996
1087997 @Callable(i)
1088998 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
1089999 let isGetDisabled = if (isGlobalShutdown())
10901000 then true
10911001 else (cfgPoolStatus == PoolShutdown)
10921002 let checks = [if (!(isGetDisabled))
10931003 then true
10941004 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
10951005 then true
10961006 else throw("no payments are expected")]
10971007 if ((checks == checks))
10981008 then {
10991009 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11001010 if ((unstakeInv == unstakeInv))
11011011 then {
11021012 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11031013 let outAmAmt = res._1
11041014 let outPrAmt = res._2
11051015 let state = res._10
11061016 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11071017 then true
11081018 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11091019 then true
11101020 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11111021 if ((checkAmounts == checkAmounts))
11121022 then {
11131023 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11141024 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1115- then {
1116- let $t04164841729 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1117- let refreshKLpActions = $t04164841729._1
1118- let updatedKLp = $t04164841729._2
1119- (state ++ refreshKLpActions)
1120- }
1025+ then state
11211026 else throw("Strict value is not equal to itself.")
11221027 }
11231028 else throw("Strict value is not equal to itself.")
11241029 }
11251030 else throw("Strict value is not equal to itself.")
11261031 }
11271032 else throw("Strict value is not equal to itself.")
11281033 }
11291034
11301035
11311036
11321037 @Callable(i)
11331038 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
11341039 then throw("permissions denied")
11351040 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
1136-
1137-
1138-
1139-@Callable(i)
1140-func refreshKLp () = {
1141- let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
1142- let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
1143- then unit
1144- else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1145- if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1146- then {
1147- let $t04271742772 = refreshKLpInternal(0, 0, 0)
1148- let actions = $t04271742772._1
1149- let updatedKLp = $t04271742772._2
1150- $Tuple2(actions, toString(updatedKLp))
1151- }
1152- else throw("Strict value is not equal to itself.")
1153- }
11541041
11551042
11561043
11571044 @Callable(i)
11581045 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
11591046
11601047
11611048
11621049 @Callable(i)
11631050 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
11641051
11651052
11661053
11671054 @Callable(i)
11681055 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
11691056 let prices = calcPrices(amAmt, prAmt, lpAmt)
11701057 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
11711058 }
11721059
11731060
11741061
11751062 @Callable(i)
11761063 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
11771064
11781065
11791066
11801067 @Callable(i)
11811068 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
11821069
11831070
11841071
11851072 @Callable(i)
11861073 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
11871074
11881075
11891076
11901077 @Callable(i)
11911078 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
11921079
11931080
11941081
11951082 @Callable(i)
11961083 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
11971084 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
11981085 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
11991086 }
12001087
12011088
12021089
12031090 @Callable(i)
12041091 func statsREADONLY () = {
12051092 let cfg = getPoolConfig()
12061093 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12071094 let amtAssetId = cfg[idxAmtAssetId]
12081095 let priceAssetId = cfg[idxPriceAssetId]
12091096 let iAmtAssetId = cfg[idxIAmtAssetId]
12101097 let iPriceAssetId = cfg[idxIPriceAssetId]
12111098 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12121099 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12131100 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12141101 let accAmtAssetBalance = getAccBalance(amtAssetId)
12151102 let accPriceAssetBalance = getAccBalance(priceAssetId)
12161103 let pricesList = if ((poolLPBalance == 0))
12171104 then [zeroBigInt, zeroBigInt, zeroBigInt]
12181105 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
12191106 let curPrice = 0
12201107 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
12211108 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
12221109 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
12231110 $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))
12241111 }
12251112
12261113
12271114
12281115 @Callable(i)
12291116 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
12301117 let cfg = getPoolConfig()
12311118 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12321119 let amAssetIdStr = cfg[idxAmtAssetId]
12331120 let amAssetId = fromBase58String(amAssetIdStr)
12341121 let prAssetIdStr = cfg[idxPriceAssetId]
12351122 let prAssetId = fromBase58String(prAssetIdStr)
12361123 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12371124 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12381125 let poolStatus = cfg[idxPoolStatus]
12391126 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12401127 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
12411128 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
12421129 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
12431130 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
12441131 let curPriceX18 = if ((poolLPBalance == 0))
12451132 then zeroBigInt
12461133 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
12471134 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
12481135 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
12491136 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
12501137 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
12511138 let calcLpAmt = estPut._1
12521139 let curPriceCalc = estPut._3
12531140 let amBalance = estPut._4
12541141 let prBalance = estPut._5
12551142 let lpEmission = estPut._6
12561143 $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))
12571144 }
12581145
12591146
12601147
12611148 @Callable(i)
12621149 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
12631150 let cfg = getPoolConfig()
12641151 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12651152 let amAssetIdStr = cfg[idxAmtAssetId]
12661153 let amAssetId = fromBase58String(amAssetIdStr)
12671154 let prAssetIdStr = cfg[idxPriceAssetId]
12681155 let prAssetId = fromBase58String(prAssetIdStr)
12691156 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
12701157 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
12711158 let poolStatus = cfg[idxPoolStatus]
12721159 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
12731160 let amBalanceRaw = getAccBalance(amAssetIdStr)
12741161 let prBalanceRaw = getAccBalance(prAssetIdStr)
12751162 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
12761163 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
12771164 let curPriceX18 = if ((poolLPBalance == 0))
12781165 then zeroBigInt
12791166 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
12801167 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
12811168 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
12821169 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
12831170 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
12841171 let calcLpAmt = estPut._1
12851172 let curPriceCalc = estPut._3
12861173 let amBalance = estPut._4
12871174 let prBalance = estPut._5
12881175 let lpEmission = estPut._6
12891176 $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))
12901177 }
12911178
12921179
12931180
12941181 @Callable(i)
12951182 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
12961183 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
12971184 let outAmAmt = res._1
12981185 let outPrAmt = res._2
12991186 let amBalance = res._5
13001187 let prBalance = res._6
13011188 let lpEmission = res._7
13021189 let curPrice = res._8
13031190 let poolStatus = parseIntValue(res._9)
13041191 $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))
13051192 }
13061193
13071194
13081195 @Verifier(tx)
13091196 func verify () = {
13101197 let targetPublicKey = match managerPublicKeyOrUnit() {
13111198 case pk: ByteVector =>
13121199 pk
13131200 case _: Unit =>
13141201 tx.senderPublicKey
13151202 case _ =>
13161203 throw("Match error")
13171204 }
13181205 match tx {
13191206 case order: Order =>
13201207 let matcherPub = getMatcherPubOrFail()
13211208 let orderValid = validateMatcherOrderAllowed(order)
13221209 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
13231210 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
13241211 if (if (if (orderValid)
13251212 then senderValid
13261213 else false)
13271214 then matcherValid
13281215 else false)
13291216 then true
13301217 else throwOrderError(orderValid, senderValid, matcherValid)
13311218 case s: SetScriptTransaction =>
13321219 let newHash = blake2b256(value(s.script))
13331220 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
13341221 let currentHash = scriptHash(this)
13351222 if (if ((allowedHash == newHash))
13361223 then (currentHash != newHash)
13371224 else false)
13381225 then true
13391226 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13401227 case _ =>
13411228 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13421229 }
13431230 }
13441231

github/deemru/w8io/026f985 
183.76 ms