tx · 3DiPSmYNmnjCS2ZbnJHKvnMGAwNdqeH9m2jrpnvmZDcS

3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA:  -0.03100000 Waves

2022.11.30 15:12 [2339820] smart account 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA > SELF 0.00000000 Waves

{ "type": 13, "id": "3DiPSmYNmnjCS2ZbnJHKvnMGAwNdqeH9m2jrpnvmZDcS", "fee": 3100000, "feeAssetId": null, "timestamp": 1669810293184, "version": 1, "sender": "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA", "senderPublicKey": "35yd3qw1gxKDxKwGAykHN9fANbXNWwseaUwbWDj24o3x", "proofs": [ "bkEq2XWYZFTGL1rLhAMteZ7P2pnKHTuaXw59kM3BzUBNCpkiPHiaje9qTZVZ6Q6ZjJsKMdmdKNAFAvPVguqJXq3" ], "script": "base64:BgKhIggCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIECgIIARIECgIIARIECgIBARIDCgEBEgUKAwEBARIFCgMBCAESBAoCAQgSBAoCAQgSBAoCCAgSBAoCCAgSBAoCCAESABIDCgEIEgUKAwEBARIECgIIARIECgIBARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiIKc2xpcHBhZ2U0RCILd2F2ZXNTdHJpbmciBUFtdWx0IgVEY29udiIDU0VQIgVFTVBUWSIKUG9vbEFjdGl2ZSIKUG9vbFB1dERpcyIOUG9vbE1hdGNoZXJEaXMiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiCWlkeFBvb2xTdCIJaWR4TFBBc0lkIglpZHhBbUFzSWQiCWlkeFByQXNJZCILaWR4QW10QXNEY20iDWlkeFByaWNlQXNEY20iC2lkeElBbXRBc0lkIg1pZHhJUHJpY2VBc0lkIg9pZHhG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AACBQJnVQUCZ1QJAQIhPQIFAmdWBQJnVAcGCQD0AwMIBQJnTQlib2R5Qnl0ZXMJAJEDAggFAmdNBnByb29mcwAABQJnTwkA9AMDCAUCZ00JYm9keUJ5dGVzCQCRAwIIBQJnTQZwcm9vZnMAAAUCZ0/KmQhj", "chainId": 84, "height": 2339820, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Fi8un1UKHBk695ebUZscYp4DXUtftbc3iAgXbooTkEqS Next: 6ij588byJfSNd3WD2Mp2ZDgvxg2vThCXUQFzcT3Bszf5 Diff:
OldNewDifferences
119119
120120 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
121121
122-let keyDLp = makeString(["%s", "dLp"], SEP)
123-
124-let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP)
125-
126-let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP)
127-
128-let dLpRefreshDelayDefault = 30
129-
130-let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault)
131-
132122 func fcfg () = "%s__factoryConfig"
133123
134124
170160 func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " "))
171161
172162
173-func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ")
174-
175-
176163 let fca = addressFromStringValue(strf(this, fc()))
177164
178165 let A = strf(this, amp())
209196
210197 let poolConfigParsed = parsePoolConfig(gpc())
211198
212-let $t072087394 = poolConfigParsed
199+let $t068307016 = poolConfigParsed
213200
214-let cfgPoolAddress = $t072087394._1
201+let cfgPoolAddress = $t068307016._1
215202
216-let cfgPoolStatus = $t072087394._2
203+let cfgPoolStatus = $t068307016._2
217204
218-let cfgLpAssetId = $t072087394._3
205+let cfgLpAssetId = $t068307016._3
219206
220-let cfgAmountAssetId = $t072087394._4
207+let cfgAmountAssetId = $t068307016._4
221208
222-let cfgPriceAssetId = $t072087394._5
209+let cfgPriceAssetId = $t068307016._5
223210
224-let cfgAmountAssetDecimals = $t072087394._6
211+let cfgAmountAssetDecimals = $t068307016._6
225212
226-let cfgPriceAssetDecimals = $t072087394._7
213+let cfgPriceAssetDecimals = $t068307016._7
227214
228215 func gfc () = split(strf(fca, fcfg()), SEP)
229216
418405 else calcLpAmt
419406 let amDiff = (inAmAmt - calcAmAssetPmt)
420407 let prDiff = (inPrAmt - calcPrAssetPmt)
421- let $t01782518170 = if (if (isOneAsset)
408+ let $t01744717792 = if (if (isOneAsset)
422409 then (pmtId == amIdStr)
423410 else false)
424411 then $Tuple2(pmtAmt, 0)
427414 else false)
428415 then $Tuple2(0, pmtAmt)
429416 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
430- let writeAmAmt = $t01782518170._1
431- let writePrAmt = $t01782518170._2
417+ let writeAmAmt = $t01744717792._1
418+ let writePrAmt = $t01744717792._2
432419 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
433420 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
434421 }
435422 }
436423
437424
438-func calcDLp (amountBalance,priceBalance,lpEmission) = {
439- let updatedDLp = fraction((amountBalance * priceBalance), scale18, lpEmission)
440- updatedDLp
441- }
442-
443-
444-func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
445- let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
446- let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
447- let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
448- let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
449- let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))]
450- $Tuple2(actions, updatedDLp)
451- }
452-
453-
454425 func moa (order) = {
455- let amountAssetAmount = order.amount
456- let priceAssetAmount = fraction(order.amount, order.price, scale8)
457- let $t02011920331 = if ((order.orderType == Buy))
458- then $Tuple2(amountAssetAmount, -(priceAssetAmount))
459- else $Tuple2(-(amountAssetAmount), priceAssetAmount)
460- let amountAssetBalanceDelta = $t02011920331._1
461- let priceAssetBalanceDelta = $t02011920331._2
426+ let cfg = gpc()
427+ let amtAsId = cfg[idxAmAsId]
428+ let prAsId = cfg[idxPrAsId]
429+ let sts = parseIntValue(cfg[idxPoolSt])
430+ let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
431+ let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
432+ let accAmtAsBalance = getAccBalance(amtAsId)
433+ let accPrAsBalance = getAccBalance(prAsId)
434+ let curPriceX18 = if ((order.orderType == Buy))
435+ then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance)
436+ else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance)
437+ let curPrice = f1(curPriceX18, scale8)
462438 if (if (if (igs())
463439 then true
464- else (cfgPoolStatus == PoolMatcherDis))
440+ else (sts == PoolMatcherDis))
465441 then true
466- else (cfgPoolStatus == PoolShutdown))
442+ else (sts == PoolShutdown))
467443 then throw("Admin blocked")
468- else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
469- then true
470- else (order.assetPair.priceAsset != cfgPriceAssetId))
471- then throw("Wr assets")
472- else {
473- let dLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyDLp), fmtErr("dLp is required"))), fmtErr("invalid dLp"))
474- let $t02075820858 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
475- let unusedActions = $t02075820858._1
476- let dLpNew = $t02075820858._2
477- let isOrderValid = (dLpNew > dLp)
478- isOrderValid
479- }
444+ else {
445+ let orAmtAsset = order.assetPair.amountAsset
446+ let orAmtAsStr = if ((orAmtAsset == unit))
447+ then "WAVES"
448+ else toBase58String(value(orAmtAsset))
449+ let orPrAsset = order.assetPair.priceAsset
450+ let orPrAsStr = if ((orPrAsset == unit))
451+ then "WAVES"
452+ else toBase58String(value(orPrAsset))
453+ if (if ((orAmtAsStr != amtAsId))
454+ then true
455+ else (orPrAsStr != prAsId))
456+ then throw("Wr assets")
457+ else {
458+ let orderPrice = order.price
459+ let priceDcm = fraction(scale8, prAsDcm, amtAsDcm)
460+ let castOrderPrice = ts(orderPrice, scale8, priceDcm)
461+ let isOrderPriceValid = if ((order.orderType == Buy))
462+ then (curPrice >= castOrderPrice)
463+ else (castOrderPrice >= curPrice)
464+ true
465+ }
466+ }
480467 }
481468
482469
528515 let ann_aPrecision = (ann - aPrecision)
529516 let n1 = (n + big1)
530517 func calc (acc,cur) = {
531- let $t02301123031 = acc
532- let d = $t02301123031._1
533- let found = $t02301123031._2
518+ let $t02234422364 = acc
519+ let d = $t02234422364._1
520+ let found = $t02234422364._2
534521 if ((found != unit))
535522 then acc
536523 else {
544531 }
545532
546533 let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
547- let $t02345223499 = {
534+ let $t02278522832 = {
548535 let $l = arr
549536 let $s = size($l)
550537 let $acc0 = $Tuple2(s, unit)
558545
559546 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
560547 }
561- let d = $t02345223499._1
562- let found = $t02345223499._2
548+ let d = $t02278522832._1
549+ let found = $t02278522832._2
563550 if ((found != unit))
564551 then d
565552 else throw(("D calculation error, D = " + toString(d)))
579566 let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
580567 let b = ((s + ((D * aPrecision) / ann)) - D)
581568 func calc (acc,cur) = {
582- let $t02399924019 = acc
583- let y = $t02399924019._1
584- let found = $t02399924019._2
569+ let $t02333223352 = acc
570+ let y = $t02333223352._1
571+ let found = $t02333223352._2
585572 if ((found != unit))
586573 then acc
587574 else {
594581 }
595582
596583 let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
597- let $t02432624373 = {
584+ let $t02365923706 = {
598585 let $l = arr
599586 let $s = size($l)
600587 let $acc0 = $Tuple2(D, unit)
608595
609596 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
610597 }
611- let y = $t02432624373._1
612- let found = $t02432624373._2
598+ let y = $t02365923706._1
599+ let found = $t02365923706._2
613600 if ((found != unit))
614601 then y
615602 else throw(("Y calculation error, Y = " + toString(y)))
631618 then {
632619 let amBalance = getAccBalance(amId)
633620 let prBalance = getAccBalance(prId)
634- let $t02515625618 = if ((txId == ""))
621+ let $t02448924951 = if ((txId == ""))
635622 then $Tuple2(amBalance, prBalance)
636623 else if ((pmtAssetId == amId))
637624 then if ((pmtAmtRaw > amBalance))
642629 then throw("invalid payment amount")
643630 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
644631 else throw("wrong pmtAssetId")
645- let amBalanceOld = $t02515625618._1
646- let prBalanceOld = $t02515625618._2
647- let $t02562425800 = if ((pmtAssetId == amId))
632+ let amBalanceOld = $t02448924951._1
633+ let prBalanceOld = $t02448924951._2
634+ let $t02495725133 = if ((pmtAssetId == amId))
648635 then $Tuple2(pmtAmtRaw, 0)
649636 else if ((pmtAssetId == prId))
650637 then $Tuple2(0, pmtAmtRaw)
651638 else throw("invalid payment")
652- let amAmountRaw = $t02562425800._1
653- let prAmountRaw = $t02562425800._2
654- let $t02580426043 = if (withTakeFee)
639+ let amAmountRaw = $t02495725133._1
640+ let prAmountRaw = $t02495725133._2
641+ let $t02513725376 = if (withTakeFee)
655642 then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
656643 else $Tuple3(amAmountRaw, prAmountRaw, 0)
657- let amAmount = $t02580426043._1
658- let prAmount = $t02580426043._2
659- let feeAmount = $t02580426043._3
644+ let amAmount = $t02513725376._1
645+ let prAmount = $t02513725376._2
646+ let feeAmount = $t02513725376._3
660647 let amBalanceNew = (amBalanceOld + amAmount)
661648 let prBalanceNew = (prBalanceOld + prAmount)
662649 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
702689 else {
703690 let amBalance = getAccBalance(amId)
704691 let prBalance = getAccBalance(prId)
705- let $t02804528156 = {
692+ let $t02737827486 = {
706693 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
707694 if ($isInstanceOf(@, "(Int, Int)"))
708695 then @
709696 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
710697 }
711- if (($t02804528156 == $t02804528156))
698+ let totalGet = $t02737827486._1
699+ let feeAmount = $t02737827486._2
700+ let totalAmount = if (if ((minOutAmount > 0))
701+ then (minOutAmount > totalGet)
702+ else false)
703+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
704+ else totalGet
705+ let $t02767627983 = if ((outAssetId == amId))
706+ then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
707+ else if ((outAssetId == prId))
708+ then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
709+ else throw("invalid out asset id")
710+ let outAm = $t02767627983._1
711+ let outPr = $t02767627983._2
712+ let amBalanceNew = $t02767627983._3
713+ let prBalanceNew = $t02767627983._4
714+ let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
715+ let curPr = f1(curPrX18, scale8)
716+ let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
717+ then unit
718+ else fromBase58String(outAssetId)
719+ let sendFeeToMatcher = if ((feeAmount > 0))
720+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
721+ else nil
722+ let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher)
723+ if ((state == state))
712724 then {
713- let feeAmount = $t02804528156._2
714- let totalGet = $t02804528156._1
715- let totalAmount = if (if ((minOutAmount > 0))
716- then (minOutAmount > totalGet)
717- else false)
718- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
719- else totalGet
720- let $t02834628653 = if ((outAssetId == amId))
721- then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
722- else if ((outAssetId == prId))
723- then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
724- else throw("invalid out asset id")
725- let outAm = $t02834628653._1
726- let outPr = $t02834628653._2
727- let amBalanceNew = $t02834628653._3
728- let prBalanceNew = $t02834628653._4
729- let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
730- let curPr = f1(curPrX18, scale8)
731- let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
732- then unit
733- else fromBase58String(outAssetId)
734- let sendFeeToMatcher = if ((feeAmount > 0))
735- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
736- else nil
737- let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher)
738- if ((state == state))
739- then {
740- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
741- if ((burn == burn))
742- then {
743- let $t02943829788 = {
744- let feeAmountForCalc = if ((this == feeCollectorAddress))
745- then 0
746- else feeAmount
747- let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId))
748- then true
749- else false
750- if (outInAmountAsset)
751- then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
752- else $Tuple2(0, -((totalGet + feeAmountForCalc)))
753- }
754- let amountAssetBalanceDelta = $t02943829788._1
755- let priceAssetBalanceDelta = $t02943829788._2
756- let $t02979129899 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
757- let refreshDLpActions = $t02979129899._1
758- let updatedDLp = $t02979129899._2
759- $Tuple2((state ++ refreshDLpActions), totalAmount)
760- }
761- else throw("Strict value is not equal to itself.")
762- }
725+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
726+ if ((burn == burn))
727+ then $Tuple2(state, totalAmount)
763728 else throw("Strict value is not equal to itself.")
764729 }
765730 else throw("Strict value is not equal to itself.")
905870 else throw("Strict value is not equal to itself.")
906871 }
907872 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
908- let $t03348133546 = refreshDLpInternal(0, 0, 0)
909- let refreshDLpActions = $t03348133546._1
910- let updatedDLp = $t03348133546._2
911- ((state ++ lpTrnsfr) ++ refreshDLpActions)
873+ (state ++ lpTrnsfr)
912874 }
913875 else throw("Strict value is not equal to itself.")
914876 }
958920 let pmt = value(i.payments[0])
959921 let pmtAssetId = toBase58String(value(pmt.assetId))
960922 let pmtAmt = pmt.amount
961- let $t03460834766 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
962- if (($t03460834766 == $t03460834766))
923+ let $t03334533500 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
924+ let estimLP = $t03334533500._1
925+ let state = $t03334533500._2
926+ let feeAmount = $t03334533500._3
927+ let emitLpAmt = if (if ((minOutAmount > 0))
928+ then (minOutAmount > estimLP)
929+ else false)
930+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
931+ else estimLP
932+ let e = invoke(fca, "emit", [emitLpAmt], nil)
933+ if ((e == e))
963934 then {
964- let feeAmount = $t03460834766._3
965- let state = $t03460834766._2
966- let estimLP = $t03460834766._1
967- let emitLpAmt = if (if ((minOutAmount > 0))
968- then (minOutAmount > estimLP)
969- else false)
970- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
971- else estimLP
972- let e = invoke(fca, "emit", [emitLpAmt], nil)
973- if ((e == e))
935+ let el = match e {
936+ case legacy: Address =>
937+ invoke(legacy, "emit", [emitLpAmt], nil)
938+ case _ =>
939+ unit
940+ }
941+ if ((el == el))
974942 then {
975- let el = match e {
976- case legacy: Address =>
977- invoke(legacy, "emit", [emitLpAmt], nil)
978- case _ =>
979- unit
980- }
981- if ((el == el))
943+ let lpTrnsfr = if (autoStake)
982944 then {
983- let lpTrnsfr = if (autoStake)
984- then {
985- let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
986- if ((ss == ss))
987- then nil
988- else throw("Strict value is not equal to itself.")
989- }
990- else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
991- let sendFeeToMatcher = if ((feeAmount > 0))
992- then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
993- else nil
994- let $t03558135930 = if ((this == feeCollectorAddress))
995- then $Tuple2(0, 0)
996- else {
997- let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
998- then true
999- else false
1000- if (paymentInAmountAsset)
1001- then $Tuple2(-(feeAmount), 0)
1002- else $Tuple2(0, -(feeAmount))
1003- }
1004- let amountAssetBalanceDelta = $t03558135930._1
1005- let priceAssetBalanceDelta = $t03558135930._2
1006- let $t03593336041 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1007- let refreshDLpActions = $t03593336041._1
1008- let updatedDLp = $t03593336041._2
1009- $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
945+ let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
946+ if ((ss == ss))
947+ then nil
948+ else throw("Strict value is not equal to itself.")
1010949 }
1011- else throw("Strict value is not equal to itself.")
950+ else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
951+ let sendFeeToMatcher = if ((feeAmount > 0))
952+ then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
953+ else nil
954+ $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
1012955 }
1013956 else throw("Strict value is not equal to itself.")
1014957 }
1026969 then throw("2 pmnts expd")
1027970 else {
1028971 let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "")
1029- let state = estPut._9
1030- let $t03679736862 = refreshDLpInternal(0, 0, 0)
1031- let refreshDLpActions = $t03679736862._1
1032- let updatedKLp = $t03679736862._2
1033- (state ++ refreshDLpActions)
972+ estPut._9
1034973 }
1035974
1036975
1045984 let state = r._5
1046985 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1047986 if ((b == b))
1048- then {
1049- let $t03749437576 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1050- let refreshDLpActions = $t03749437576._1
1051- let updatedDLp = $t03749437576._2
1052- (state ++ refreshDLpActions)
1053- }
987+ then state
1054988 else throw("Strict value is not equal to itself.")
1055989 }
1056990
10781012 else throwErr("exactly 1 payment are expected")]
10791013 if ((checks == checks))
10801014 then {
1081- let $t03812138276 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1082- let state = $t03812138276._1
1083- let totalAmount = $t03812138276._2
1015+ let $t03612236277 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1016+ let state = $t03612236277._1
1017+ let totalAmount = $t03612236277._2
10841018 $Tuple2(state, totalAmount)
1085- }
1086- else throw("Strict value is not equal to itself.")
1087- }
1088-
1089-
1090-
1091-@Callable(i)
1092-func refreshDLp () = {
1093- let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
1094- let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
1095- then unit
1096- else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1097- if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1098- then {
1099- let $t03867438729 = refreshDLpInternal(0, 0, 0)
1100- let actions = $t03867438729._1
1101- let updatedKLp = $t03867438729._2
1102- $Tuple2(actions, toString(updatedKLp))
11031019 }
11041020 else throw("Strict value is not equal to itself.")
11051021 }
11241040 let newY = getYD(xp, index, D1)
11251041 let dy = (xp[index] - newY)
11261042 let totalGetRaw = max([0, toInt((dy - big1))])
1127- let $t03953139580 = takeFee(totalGetRaw)
1128- let totalGet = $t03953139580._1
1129- let feeAmount = $t03953139580._2
1043+ let $t03706737116 = takeFee(totalGetRaw)
1044+ let totalGet = $t03706737116._1
1045+ let feeAmount = $t03706737116._2
11301046 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
11311047 }
11321048
11401056 let lpId = poolConfig[idxLPAsId]
11411057 let amBalance = getAccBalance(amId)
11421058 let prBalance = getAccBalance(prId)
1143- let $t03992540040 = {
1059+ let $t03746137576 = {
11441060 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
11451061 if ($isInstanceOf(@, "(Int, Int)"))
11461062 then @
11471063 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
11481064 }
1149- let totalGet = $t03992540040._1
1150- let feeAmount = $t03992540040._2
1065+ let totalGet = $t03746137576._1
1066+ let feeAmount = $t03746137576._2
11511067 let r = ego("", lpId, lpAssetAmount, this)
11521068 let outAmAmt = r._1
11531069 let outPrAmt = r._2
11771093 else {
11781094 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11791095 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1180- then {
1181- let $t04112641207 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1182- let refreshDLpActions = $t04112641207._1
1183- let updatedDLp = $t04112641207._2
1184- (state ++ refreshDLpActions)
1185- }
1096+ then state
11861097 else throw("Strict value is not equal to itself.")
11871098 }
11881099 }
12041115 if ((unstakeInv == unstakeInv))
12051116 then {
12061117 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1207- let outAmAmt = r._1
1208- let outPrAmt = r._2
12091118 let sts = parseIntValue(r._9)
12101119 let state = r._10
12111120 let v = if (if (igs())
12171126 then {
12181127 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
12191128 if ((burnA == burnA))
1220- then {
1221- let $t04212042201 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1222- let refreshDLpActions = $t04212042201._1
1223- let updatedDLp = $t04212042201._2
1224- (state ++ refreshDLpActions)
1225- }
1129+ then state
12261130 else throw("Strict value is not equal to itself.")
12271131 }
12281132 else throw("Strict value is not equal to itself.")
12621166 then {
12631167 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
12641168 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1265- then {
1266- let $t04329943380 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1267- let refreshDLpActions = $t04329943380._1
1268- let updatedDLp = $t04329943380._2
1269- (state ++ refreshDLpActions)
1270- }
1169+ then state
12711170 else throw("Strict value is not equal to itself.")
12721171 }
12731172 else throw("Strict value is not equal to itself.")
13081207 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
13091208 if ((unstakeInv == unstakeInv))
13101209 then {
1311- let $t04424144429 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1312- let state = $t04424144429._1
1313- let totalAmount = $t04424144429._2
1210+ let $t04141441602 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1211+ let state = $t04141441602._1
1212+ let totalAmount = $t04141441602._2
13141213 $Tuple2(state, totalAmount)
13151214 }
13161215 else throw("Strict value is not equal to itself.")
13261225 let amId = poolConfig[idxAmAsId]
13271226 let prId = poolConfig[idxPrAsId]
13281227 let lpId = poolConfig[idxLPAsId]
1329- let $t04468844791 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1330- let lpAmount = $t04468844791._1
1331- let state = $t04468844791._2
1332- let feeAmount = $t04468844791._3
1333- let bonus = $t04468844791._4
1228+ let $t04186141964 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1229+ let lpAmount = $t04186141964._1
1230+ let state = $t04186141964._2
1231+ let feeAmount = $t04186141964._3
1232+ let bonus = $t04186141964._4
13341233 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13351234 }
13361235
13421241 let amId = poolConfig[idxAmAsId]
13431242 let prId = poolConfig[idxPrAsId]
13441243 let lpId = poolConfig[idxLPAsId]
1345- let $t04507045174 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1346- let lpAmount = $t04507045174._1
1347- let state = $t04507045174._2
1348- let feeAmount = $t04507045174._3
1349- let bonus = $t04507045174._4
1244+ let $t04224342347 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1245+ let lpAmount = $t04224342347._1
1246+ let state = $t04224342347._2
1247+ let feeAmount = $t04224342347._3
1248+ let bonus = $t04224342347._4
13501249 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13511250 }
13521251
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let scale8 = 100000000
55
66 let scale8BigInt = toBigInt(100000000)
77
88 let scale18 = toBigInt(1000000000000000000)
99
1010 let zeroBigInt = toBigInt(0)
1111
1212 let big0 = toBigInt(0)
1313
1414 let big1 = toBigInt(1)
1515
1616 let big2 = toBigInt(2)
1717
1818 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
1919
2020 let wavesString = "WAVES"
2121
2222 let Amult = "100"
2323
2424 let Dconv = "1"
2525
2626 let SEP = "__"
2727
2828 let EMPTY = ""
2929
3030 let PoolActive = 1
3131
3232 let PoolPutDis = 2
3333
3434 let PoolMatcherDis = 3
3535
3636 let PoolShutdown = 4
3737
3838 let idxPoolAddress = 1
3939
4040 let idxPoolSt = 2
4141
4242 let idxLPAsId = 3
4343
4444 let idxAmAsId = 4
4545
4646 let idxPrAsId = 5
4747
4848 let idxAmtAsDcm = 6
4949
5050 let idxPriceAsDcm = 7
5151
5252 let idxIAmtAsId = 8
5353
5454 let idxIPriceAsId = 9
5555
5656 let idxFactStakCntr = 1
5757
5858 let idxFactoryRestCntr = 6
5959
6060 let idxFactSlippCntr = 7
6161
6262 let idxFactGwxRewCntr = 10
6363
6464 let feeDefault = fraction(10, scale8, 10000)
6565
6666 func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6767
6868
6969 func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
7070
7171
7272 func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7373
7474
7575 func abs (val) = if ((zeroBigInt > val))
7676 then -(val)
7777 else val
7878
7979
8080 func absBigInt (val) = if ((zeroBigInt > val))
8181 then -(val)
8282 else val
8383
8484
8585 func fc () = "%s__factoryContract"
8686
8787
8888 func mpk () = "%s__managerPublicKey"
8989
9090
9191 func pmpk () = "%s__pendingManagerPublicKey"
9292
9393
9494 func pl () = "%s%s__price__last"
9595
9696
9797 func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
9898
9999
100100 func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
101101
102102
103103 func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
104104
105105
106106 func aa () = "%s__amountAsset"
107107
108108
109109 func pa () = "%s__priceAsset"
110110
111111
112112 func amp () = "%s__amp"
113113
114114
115115 func ada () = "%s__addonAddr"
116116
117117
118118 let keyFee = "%s__fee"
119119
120120 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
121121
122-let keyDLp = makeString(["%s", "dLp"], SEP)
123-
124-let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP)
125-
126-let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP)
127-
128-let dLpRefreshDelayDefault = 30
129-
130-let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault)
131-
132122 func fcfg () = "%s__factoryConfig"
133123
134124
135125 func mtpk () = "%s%s__matcher__publicKey"
136126
137127
138128 func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
139129
140130
141131 func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
142132
143133
144134 func aps () = "%s__shutdown"
145135
146136
147137 func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash"
148138
149139
150140 func keyFeeCollectorAddress () = "%s__feeCollectorAddress"
151141
152142
153143 func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
154144
155145
156146 func str (val) = match val {
157147 case valStr: String =>
158148 valStr
159149 case _ =>
160150 throw("fail cast to String")
161151 }
162152
163153
164154 func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
165155
166156
167157 func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
168158
169159
170160 func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " "))
171161
172162
173-func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ")
174-
175-
176163 let fca = addressFromStringValue(strf(this, fc()))
177164
178165 let A = strf(this, amp())
179166
180167 func igs () = valueOrElse(getBoolean(fca, aps()), false)
181168
182169
183170 func mp () = fromBase58String(strf(fca, mtpk()))
184171
185172
186173 let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress()))
187174
188175 func gpc () = {
189176 let amtAs = strf(this, aa())
190177 let priceAs = strf(this, pa())
191178 let iPriceAs = intf(fca, mba(priceAs))
192179 let iAmtAs = intf(fca, mba(amtAs))
193180 split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
194181 }
195182
196183
197184 func parseAssetId (input) = if ((input == wavesString))
198185 then unit
199186 else fromBase58String(input)
200187
201188
202189 func assetIdToString (input) = if ((input == unit))
203190 then wavesString
204191 else toBase58String(value(input))
205192
206193
207194 func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm]))
208195
209196
210197 let poolConfigParsed = parsePoolConfig(gpc())
211198
212-let $t072087394 = poolConfigParsed
199+let $t068307016 = poolConfigParsed
213200
214-let cfgPoolAddress = $t072087394._1
201+let cfgPoolAddress = $t068307016._1
215202
216-let cfgPoolStatus = $t072087394._2
203+let cfgPoolStatus = $t068307016._2
217204
218-let cfgLpAssetId = $t072087394._3
205+let cfgLpAssetId = $t068307016._3
219206
220-let cfgAmountAssetId = $t072087394._4
207+let cfgAmountAssetId = $t068307016._4
221208
222-let cfgPriceAssetId = $t072087394._5
209+let cfgPriceAssetId = $t068307016._5
223210
224-let cfgAmountAssetDecimals = $t072087394._6
211+let cfgAmountAssetDecimals = $t068307016._6
225212
226-let cfgPriceAssetDecimals = $t072087394._7
213+let cfgPriceAssetDecimals = $t068307016._7
227214
228215 func gfc () = split(strf(fca, fcfg()), SEP)
229216
230217
231218 let factoryConfig = gfc()
232219
233220 let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address")
234221
235222 let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address")
236223
237224 let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address")
238225
239226 let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address")
240227
241228 func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP)
242229
243230
244231 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)
245232
246233
247234 func getAccBalance (assetId) = if ((assetId == "WAVES"))
248235 then wavesBalance(this).available
249236 else assetBalance(this, fromBase58String(assetId))
250237
251238
252239 func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
253240
254241
255242 func vad (A1,A2,slippage) = {
256243 let diff = fraction((A1 - A2), scale8BigInt, A2)
257244 let pass = ((slippage - abs(diff)) > zeroBigInt)
258245 if (!(pass))
259246 then throw(("Big slpg: " + toString(diff)))
260247 else $Tuple2(pass, min([A1, A2]))
261248 }
262249
263250
264251 func vd (D1,D0,slpg) = {
265252 let diff = fraction(D0, scale8BigInt, D1)
266253 let fail = (slpg > diff)
267254 if (if (fail)
268255 then true
269256 else (D0 > D1))
270257 then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
271258 else fail
272259 }
273260
274261
275262 func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
276263 let amtAsAmtX18 = t1(amAmt, amAssetDcm)
277264 let prAsAmtX18 = t1(prAmt, prAssetDcm)
278265 cpbi(prAsAmtX18, amtAsAmtX18)
279266 }
280267
281268
282269 func calcPrices (amAmt,prAmt,lpAmt) = {
283270 let cfg = gpc()
284271 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
285272 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
286273 let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
287274 let amAmtX18 = t1(amAmt, amtAsDcm)
288275 let prAmtX18 = t1(prAmt, prAsDcm)
289276 let lpAmtX18 = t1(lpAmt, scale8)
290277 let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
291278 let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
292279 [priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
293280 }
294281
295282
296283 func calculatePrices (amAmt,prAmt,lpAmt) = {
297284 let p = calcPrices(amAmt, prAmt, lpAmt)
298285 [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
299286 }
300287
301288
302289 func takeFee (amount) = {
303290 let feeAmount = fraction(amount, fee, scale8)
304291 $Tuple2((amount - feeAmount), feeAmount)
305292 }
306293
307294
308295 func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
309296 let cfg = gpc()
310297 let lpId = cfg[idxLPAsId]
311298 let amId = cfg[idxAmAsId]
312299 let prId = cfg[idxPrAsId]
313300 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
314301 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
315302 let sts = cfg[idxPoolSt]
316303 let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
317304 if ((lpId != pmtAssetId))
318305 then throw("Wrong pmt asset")
319306 else {
320307 let amBalance = getAccBalance(amId)
321308 let amBalanceX18 = t1(amBalance, amDcm)
322309 let prBalance = getAccBalance(prId)
323310 let prBalanceX18 = t1(prBalance, prDcm)
324311 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
325312 let curPrice = f1(curPriceX18, scale8)
326313 let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
327314 let lpEmissX18 = t1(lpEmiss, scale8)
328315 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
329316 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
330317 let outAmAmt = f1(outAmAmtX18, amDcm)
331318 let outPrAmt = f1(outPrAmtX18, prDcm)
332319 let state = if ((txId58 == ""))
333320 then nil
334321 else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
335322 then unit
336323 else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
337324 then unit
338325 else fromBase58String(prId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)]
339326 $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
340327 }
341328 }
342329
343330
344331 func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
345332 let cfg = gpc()
346333 let lpId = fromBase58String(cfg[idxLPAsId])
347334 let amIdStr = cfg[idxAmAsId]
348335 let prIdStr = cfg[idxPrAsId]
349336 let inAmIdStr = cfg[idxIAmtAsId]
350337 let inPrIdStr = cfg[idxIPriceAsId]
351338 let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
352339 let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
353340 let sts = cfg[idxPoolSt]
354341 let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
355342 let amBalance = if (isEval)
356343 then getAccBalance(amIdStr)
357344 else if (if (isOneAsset)
358345 then (pmtId == amIdStr)
359346 else false)
360347 then (getAccBalance(amIdStr) - pmtAmt)
361348 else if (isOneAsset)
362349 then getAccBalance(amIdStr)
363350 else (getAccBalance(amIdStr) - inAmAmt)
364351 let prBalance = if (isEval)
365352 then getAccBalance(prIdStr)
366353 else if (if (isOneAsset)
367354 then (pmtId == prIdStr)
368355 else false)
369356 then (getAccBalance(prIdStr) - pmtAmt)
370357 else if (isOneAsset)
371358 then getAccBalance(prIdStr)
372359 else (getAccBalance(prIdStr) - inPrAmt)
373360 let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
374361 let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
375362 let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
376363 let amBalanceX18 = t1(amBalance, amtDcm)
377364 let prBalanceX18 = t1(prBalance, priceDcm)
378365 let r = if ((lpEm == 0))
379366 then {
380367 let curPriceX18 = zeroBigInt
381368 let slippageX18 = zeroBigInt
382369 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
383370 $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
384371 }
385372 else {
386373 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
387374 let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
388375 let slippageX18 = t1(slippage, scale8)
389376 if (if (if (validateSlippage)
390377 then (curPriceX18 != zeroBigInt)
391378 else false)
392379 then (slippageRealX18 > slippageX18)
393380 else false)
394381 then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
395382 else {
396383 let lpEmissionX18 = t1(lpEm, scale8)
397384 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
398385 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
399386 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
400387 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
401388 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
402389 let expAmtAssetAmtX18 = expectedAmts._1
403390 let expPriceAssetAmtX18 = expectedAmts._2
404391 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
405392 $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
406393 }
407394 }
408395 let calcLpAmt = r._1
409396 let calcAmAssetPmt = r._2
410397 let calcPrAssetPmt = r._3
411398 let curPrice = f1(r._4, scale8)
412399 let slippageCalc = f1(r._5, scale8)
413400 if ((0 >= calcLpAmt))
414401 then throw("LP <= 0")
415402 else {
416403 let emitLpAmt = if (!(emitLp))
417404 then 0
418405 else calcLpAmt
419406 let amDiff = (inAmAmt - calcAmAssetPmt)
420407 let prDiff = (inPrAmt - calcPrAssetPmt)
421- let $t01782518170 = if (if (isOneAsset)
408+ let $t01744717792 = if (if (isOneAsset)
422409 then (pmtId == amIdStr)
423410 else false)
424411 then $Tuple2(pmtAmt, 0)
425412 else if (if (isOneAsset)
426413 then (pmtId == prIdStr)
427414 else false)
428415 then $Tuple2(0, pmtAmt)
429416 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
430- let writeAmAmt = $t01782518170._1
431- let writePrAmt = $t01782518170._2
417+ let writeAmAmt = $t01744717792._1
418+ let writePrAmt = $t01744717792._2
432419 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))]
433420 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
434421 }
435422 }
436423
437424
438-func calcDLp (amountBalance,priceBalance,lpEmission) = {
439- let updatedDLp = fraction((amountBalance * priceBalance), scale18, lpEmission)
440- updatedDLp
441- }
442-
443-
444-func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
445- let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
446- let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
447- let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
448- let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
449- let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))]
450- $Tuple2(actions, updatedDLp)
451- }
452-
453-
454425 func moa (order) = {
455- let amountAssetAmount = order.amount
456- let priceAssetAmount = fraction(order.amount, order.price, scale8)
457- let $t02011920331 = if ((order.orderType == Buy))
458- then $Tuple2(amountAssetAmount, -(priceAssetAmount))
459- else $Tuple2(-(amountAssetAmount), priceAssetAmount)
460- let amountAssetBalanceDelta = $t02011920331._1
461- let priceAssetBalanceDelta = $t02011920331._2
426+ let cfg = gpc()
427+ let amtAsId = cfg[idxAmAsId]
428+ let prAsId = cfg[idxPrAsId]
429+ let sts = parseIntValue(cfg[idxPoolSt])
430+ let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
431+ let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
432+ let accAmtAsBalance = getAccBalance(amtAsId)
433+ let accPrAsBalance = getAccBalance(prAsId)
434+ let curPriceX18 = if ((order.orderType == Buy))
435+ then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance)
436+ else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance)
437+ let curPrice = f1(curPriceX18, scale8)
462438 if (if (if (igs())
463439 then true
464- else (cfgPoolStatus == PoolMatcherDis))
440+ else (sts == PoolMatcherDis))
465441 then true
466- else (cfgPoolStatus == PoolShutdown))
442+ else (sts == PoolShutdown))
467443 then throw("Admin blocked")
468- else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
469- then true
470- else (order.assetPair.priceAsset != cfgPriceAssetId))
471- then throw("Wr assets")
472- else {
473- let dLp = valueOrErrorMessage(parseBigInt(valueOrErrorMessage(getString(this, keyDLp), fmtErr("dLp is required"))), fmtErr("invalid dLp"))
474- let $t02075820858 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
475- let unusedActions = $t02075820858._1
476- let dLpNew = $t02075820858._2
477- let isOrderValid = (dLpNew > dLp)
478- isOrderValid
479- }
444+ else {
445+ let orAmtAsset = order.assetPair.amountAsset
446+ let orAmtAsStr = if ((orAmtAsset == unit))
447+ then "WAVES"
448+ else toBase58String(value(orAmtAsset))
449+ let orPrAsset = order.assetPair.priceAsset
450+ let orPrAsStr = if ((orPrAsset == unit))
451+ then "WAVES"
452+ else toBase58String(value(orPrAsset))
453+ if (if ((orAmtAsStr != amtAsId))
454+ then true
455+ else (orPrAsStr != prAsId))
456+ then throw("Wr assets")
457+ else {
458+ let orderPrice = order.price
459+ let priceDcm = fraction(scale8, prAsDcm, amtAsDcm)
460+ let castOrderPrice = ts(orderPrice, scale8, priceDcm)
461+ let isOrderPriceValid = if ((order.orderType == Buy))
462+ then (curPrice >= castOrderPrice)
463+ else (castOrderPrice >= curPrice)
464+ true
465+ }
466+ }
480467 }
481468
482469
483470 func cg (i) = if ((size(i.payments) != 1))
484471 then throw("1 pmnt exp")
485472 else {
486473 let pmt = value(i.payments[0])
487474 let pmtAssetId = value(pmt.assetId)
488475 let pmtAmt = pmt.amount
489476 let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
490477 let outAmAmt = r._1
491478 let outPrAmt = r._2
492479 let sts = parseIntValue(r._9)
493480 let state = r._10
494481 if (if (igs())
495482 then true
496483 else (sts == PoolShutdown))
497484 then throw(("Admin blocked: " + toString(sts)))
498485 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
499486 }
500487
501488
502489 func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
503490 let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId)
504491 let sts = parseIntValue(r._8)
505492 if (if (if (igs())
506493 then true
507494 else (sts == PoolPutDis))
508495 then true
509496 else (sts == PoolShutdown))
510497 then throw(("Blocked:" + toString(sts)))
511498 else r
512499 }
513500
514501
515502 func getD (xp) = {
516503 let n = big2
517504 let xp0 = xp[0]
518505 let xp1 = xp[1]
519506 let aPrecision = parseBigIntValue(Amult)
520507 let a = (parseBigIntValue(A) * aPrecision)
521508 let s = (xp0 + xp1)
522509 if ((s == big0))
523510 then big0
524511 else {
525512 let ann = (a * n)
526513 let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
527514 let ann_s_aPrecision = ((ann * s) / aPrecision)
528515 let ann_aPrecision = (ann - aPrecision)
529516 let n1 = (n + big1)
530517 func calc (acc,cur) = {
531- let $t02301123031 = acc
532- let d = $t02301123031._1
533- let found = $t02301123031._2
518+ let $t02234422364 = acc
519+ let d = $t02234422364._1
520+ let found = $t02234422364._2
534521 if ((found != unit))
535522 then acc
536523 else {
537524 let dp = (((d * d) * d) / xp0_xp1_n_n)
538525 let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
539526 let dDiff = absBigInt((dNext - value(d)))
540527 if ((big1 >= dDiff))
541528 then $Tuple2(dNext, cur)
542529 else $Tuple2(dNext, unit)
543530 }
544531 }
545532
546533 let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
547- let $t02345223499 = {
534+ let $t02278522832 = {
548535 let $l = arr
549536 let $s = size($l)
550537 let $acc0 = $Tuple2(s, unit)
551538 func $f0_1 ($a,$i) = if (($i >= $s))
552539 then $a
553540 else calc($a, $l[$i])
554541
555542 func $f0_2 ($a,$i) = if (($i >= $s))
556543 then $a
557544 else throw("List size exceeds 15")
558545
559546 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
560547 }
561- let d = $t02345223499._1
562- let found = $t02345223499._2
548+ let d = $t02278522832._1
549+ let found = $t02278522832._2
563550 if ((found != unit))
564551 then d
565552 else throw(("D calculation error, D = " + toString(d)))
566553 }
567554 }
568555
569556
570557 func getYD (xp,i,D) = {
571558 let n = big2
572559 let x = xp[if ((i == 0))
573560 then 1
574561 else 0]
575562 let aPrecision = parseBigIntValue(Amult)
576563 let a = (parseBigIntValue(A) * aPrecision)
577564 let s = x
578565 let ann = (a * n)
579566 let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
580567 let b = ((s + ((D * aPrecision) / ann)) - D)
581568 func calc (acc,cur) = {
582- let $t02399924019 = acc
583- let y = $t02399924019._1
584- let found = $t02399924019._2
569+ let $t02333223352 = acc
570+ let y = $t02333223352._1
571+ let found = $t02333223352._2
585572 if ((found != unit))
586573 then acc
587574 else {
588575 let yNext = (((y * y) + c) / ((big2 * y) + b))
589576 let yDiff = absBigInt((yNext - value(y)))
590577 if ((big1 >= yDiff))
591578 then $Tuple2(yNext, cur)
592579 else $Tuple2(yNext, unit)
593580 }
594581 }
595582
596583 let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
597- let $t02432624373 = {
584+ let $t02365923706 = {
598585 let $l = arr
599586 let $s = size($l)
600587 let $acc0 = $Tuple2(D, unit)
601588 func $f0_1 ($a,$i) = if (($i >= $s))
602589 then $a
603590 else calc($a, $l[$i])
604591
605592 func $f0_2 ($a,$i) = if (($i >= $s))
606593 then $a
607594 else throw("List size exceeds 15")
608595
609596 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15)
610597 }
611- let y = $t02432624373._1
612- let found = $t02432624373._2
598+ let y = $t02365923706._1
599+ let found = $t02365923706._2
613600 if ((found != unit))
614601 then y
615602 else throw(("Y calculation error, Y = " + toString(y)))
616603 }
617604
618605
619606 func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = {
620607 let poolConfig = gpc()
621608 let amId = poolConfig[idxAmAsId]
622609 let prId = poolConfig[idxPrAsId]
623610 let lpId = poolConfig[idxLPAsId]
624611 let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm])
625612 let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm])
626613 let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
627614 let chechEmission = if ((lpAssetEmission > big0))
628615 then true
629616 else throw("initial deposit requires all coins")
630617 if ((chechEmission == chechEmission))
631618 then {
632619 let amBalance = getAccBalance(amId)
633620 let prBalance = getAccBalance(prId)
634- let $t02515625618 = if ((txId == ""))
621+ let $t02448924951 = if ((txId == ""))
635622 then $Tuple2(amBalance, prBalance)
636623 else if ((pmtAssetId == amId))
637624 then if ((pmtAmtRaw > amBalance))
638625 then throw("invalid payment amount")
639626 else $Tuple2((amBalance - pmtAmtRaw), prBalance)
640627 else if ((pmtAssetId == prId))
641628 then if ((pmtAmtRaw > prBalance))
642629 then throw("invalid payment amount")
643630 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
644631 else throw("wrong pmtAssetId")
645- let amBalanceOld = $t02515625618._1
646- let prBalanceOld = $t02515625618._2
647- let $t02562425800 = if ((pmtAssetId == amId))
632+ let amBalanceOld = $t02448924951._1
633+ let prBalanceOld = $t02448924951._2
634+ let $t02495725133 = if ((pmtAssetId == amId))
648635 then $Tuple2(pmtAmtRaw, 0)
649636 else if ((pmtAssetId == prId))
650637 then $Tuple2(0, pmtAmtRaw)
651638 else throw("invalid payment")
652- let amAmountRaw = $t02562425800._1
653- let prAmountRaw = $t02562425800._2
654- let $t02580426043 = if (withTakeFee)
639+ let amAmountRaw = $t02495725133._1
640+ let prAmountRaw = $t02495725133._2
641+ let $t02513725376 = if (withTakeFee)
655642 then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
656643 else $Tuple3(amAmountRaw, prAmountRaw, 0)
657- let amAmount = $t02580426043._1
658- let prAmount = $t02580426043._2
659- let feeAmount = $t02580426043._3
644+ let amAmount = $t02513725376._1
645+ let prAmount = $t02513725376._2
646+ let feeAmount = $t02513725376._3
660647 let amBalanceNew = (amBalanceOld + amAmount)
661648 let prBalanceNew = (prBalanceOld + prAmount)
662649 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
663650 let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
664651 let checkD = if ((D1 > D0))
665652 then true
666653 else throw()
667654 if ((checkD == checkD))
668655 then {
669656 let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0)
670657 let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8)
671658 let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmountRaw, prAmountRaw, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))]
672659 let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
673660 let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8))
674661 let priceAssetPart = (pmtAmtRaw - amountAssetPart)
675662 let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
676663 let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth))
677664 $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus)
678665 }
679666 else throw("Strict value is not equal to itself.")
680667 }
681668 else throw("Strict value is not equal to itself.")
682669 }
683670
684671
685672 func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = {
686673 let poolConfig = gpc()
687674 let lpId = poolConfig[idxLPAsId]
688675 let amId = poolConfig[idxAmAsId]
689676 let prId = poolConfig[idxPrAsId]
690677 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
691678 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
692679 let poolStatus = poolConfig[idxPoolSt]
693680 let userAddress = if ((caller == restContract))
694681 then originCaller
695682 else caller
696683 let pmt = value(payments[0])
697684 let pmtAssetId = value(pmt.assetId)
698685 let pmtAmt = pmt.amount
699686 let txId58 = toBase58String(transactionId)
700687 if ((lpId != toBase58String(pmtAssetId)))
701688 then throw("Wrong LP")
702689 else {
703690 let amBalance = getAccBalance(amId)
704691 let prBalance = getAccBalance(prId)
705- let $t02804528156 = {
692+ let $t02737827486 = {
706693 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
707694 if ($isInstanceOf(@, "(Int, Int)"))
708695 then @
709696 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
710697 }
711- if (($t02804528156 == $t02804528156))
698+ let totalGet = $t02737827486._1
699+ let feeAmount = $t02737827486._2
700+ let totalAmount = if (if ((minOutAmount > 0))
701+ then (minOutAmount > totalGet)
702+ else false)
703+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
704+ else totalGet
705+ let $t02767627983 = if ((outAssetId == amId))
706+ then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
707+ else if ((outAssetId == prId))
708+ then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
709+ else throw("invalid out asset id")
710+ let outAm = $t02767627983._1
711+ let outPr = $t02767627983._2
712+ let amBalanceNew = $t02767627983._3
713+ let prBalanceNew = $t02767627983._4
714+ let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
715+ let curPr = f1(curPrX18, scale8)
716+ let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
717+ then unit
718+ else fromBase58String(outAssetId)
719+ let sendFeeToMatcher = if ((feeAmount > 0))
720+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
721+ else nil
722+ let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher)
723+ if ((state == state))
712724 then {
713- let feeAmount = $t02804528156._2
714- let totalGet = $t02804528156._1
715- let totalAmount = if (if ((minOutAmount > 0))
716- then (minOutAmount > totalGet)
717- else false)
718- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
719- else totalGet
720- let $t02834628653 = if ((outAssetId == amId))
721- then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
722- else if ((outAssetId == prId))
723- then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
724- else throw("invalid out asset id")
725- let outAm = $t02834628653._1
726- let outPr = $t02834628653._2
727- let amBalanceNew = $t02834628653._3
728- let prBalanceNew = $t02834628653._4
729- let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
730- let curPr = f1(curPrX18, scale8)
731- let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
732- then unit
733- else fromBase58String(outAssetId)
734- let sendFeeToMatcher = if ((feeAmount > 0))
735- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
736- else nil
737- let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher)
738- if ((state == state))
739- then {
740- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
741- if ((burn == burn))
742- then {
743- let $t02943829788 = {
744- let feeAmountForCalc = if ((this == feeCollectorAddress))
745- then 0
746- else feeAmount
747- let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId))
748- then true
749- else false
750- if (outInAmountAsset)
751- then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
752- else $Tuple2(0, -((totalGet + feeAmountForCalc)))
753- }
754- let amountAssetBalanceDelta = $t02943829788._1
755- let priceAssetBalanceDelta = $t02943829788._2
756- let $t02979129899 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
757- let refreshDLpActions = $t02979129899._1
758- let updatedDLp = $t02979129899._2
759- $Tuple2((state ++ refreshDLpActions), totalAmount)
760- }
761- else throw("Strict value is not equal to itself.")
762- }
725+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
726+ if ((burn == burn))
727+ then $Tuple2(state, totalAmount)
763728 else throw("Strict value is not equal to itself.")
764729 }
765730 else throw("Strict value is not equal to itself.")
766731 }
767732 }
768733
769734
770735 func m () = match getString(mpk()) {
771736 case s: String =>
772737 fromBase58String(s)
773738 case _: Unit =>
774739 unit
775740 case _ =>
776741 throw("Match error")
777742 }
778743
779744
780745 func pm () = match getString(pmpk()) {
781746 case s: String =>
782747 fromBase58String(s)
783748 case _: Unit =>
784749 unit
785750 case _ =>
786751 throw("Match error")
787752 }
788753
789754
790755 let pd = throw("Permission denied")
791756
792757 func isManager (i) = match m() {
793758 case pk: ByteVector =>
794759 (i.callerPublicKey == pk)
795760 case _: Unit =>
796761 (i.caller == this)
797762 case _ =>
798763 throw("Match error")
799764 }
800765
801766
802767 func mm (i) = match m() {
803768 case pk: ByteVector =>
804769 if ((i.callerPublicKey == pk))
805770 then true
806771 else pd
807772 case _: Unit =>
808773 if ((i.caller == this))
809774 then true
810775 else pd
811776 case _ =>
812777 throw("Match error")
813778 }
814779
815780
816781 @Callable(i)
817782 func constructor (fc) = {
818783 let c = mm(i)
819784 if ((c == c))
820785 then [StringEntry(fc(), fc)]
821786 else throw("Strict value is not equal to itself.")
822787 }
823788
824789
825790
826791 @Callable(i)
827792 func setManager (pendingManagerPublicKey) = {
828793 let c = mm(i)
829794 if ((c == c))
830795 then {
831796 let cm = fromBase58String(pendingManagerPublicKey)
832797 if ((cm == cm))
833798 then [StringEntry(pmpk(), pendingManagerPublicKey)]
834799 else throw("Strict value is not equal to itself.")
835800 }
836801 else throw("Strict value is not equal to itself.")
837802 }
838803
839804
840805
841806 @Callable(i)
842807 func confirmManager () = {
843808 let p = pm()
844809 let hpm = if (isDefined(p))
845810 then true
846811 else throw("No pending manager")
847812 if ((hpm == hpm))
848813 then {
849814 let cpm = if ((i.callerPublicKey == value(p)))
850815 then true
851816 else throw("You are not pending manager")
852817 if ((cpm == cpm))
853818 then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
854819 else throw("Strict value is not equal to itself.")
855820 }
856821 else throw("Strict value is not equal to itself.")
857822 }
858823
859824
860825
861826 @Callable(i)
862827 func put (slip,autoStake) = {
863828 let factCfg = gfc()
864829 let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
865830 let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
866831 if ((0 > slip))
867832 then throw("Wrong slippage")
868833 else if ((size(i.payments) != 2))
869834 then throw("2 pmnts expd")
870835 else {
871836 let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "")
872837 let emitLpAmt = e._2
873838 let lpAssetId = e._7
874839 let state = e._9
875840 let amDiff = e._10
876841 let prDiff = e._11
877842 let amId = e._12
878843 let prId = e._13
879844 let r = invoke(fca, "emit", [emitLpAmt], nil)
880845 if ((r == r))
881846 then {
882847 let el = match r {
883848 case legacy: Address =>
884849 invoke(legacy, "emit", [emitLpAmt], nil)
885850 case _ =>
886851 unit
887852 }
888853 if ((el == el))
889854 then {
890855 let sa = if ((amDiff > 0))
891856 then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
892857 else nil
893858 if ((sa == sa))
894859 then {
895860 let sp = if ((prDiff > 0))
896861 then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
897862 else nil
898863 if ((sp == sp))
899864 then {
900865 let lpTrnsfr = if (autoStake)
901866 then {
902867 let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
903868 if ((ss == ss))
904869 then nil
905870 else throw("Strict value is not equal to itself.")
906871 }
907872 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
908- let $t03348133546 = refreshDLpInternal(0, 0, 0)
909- let refreshDLpActions = $t03348133546._1
910- let updatedDLp = $t03348133546._2
911- ((state ++ lpTrnsfr) ++ refreshDLpActions)
873+ (state ++ lpTrnsfr)
912874 }
913875 else throw("Strict value is not equal to itself.")
914876 }
915877 else throw("Strict value is not equal to itself.")
916878 }
917879 else throw("Strict value is not equal to itself.")
918880 }
919881 else throw("Strict value is not equal to itself.")
920882 }
921883 }
922884
923885
924886
925887 @Callable(i)
926888 func putOneTknV2 (minOutAmount,autoStake) = {
927889 let isPoolOneTokenOperationsDisabled = {
928890 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
929891 if ($isInstanceOf(@, "Boolean"))
930892 then @
931893 else throw(($getType(@) + " couldn't be cast to Boolean"))
932894 }
933895 let isPutDisabled = if (if (if (igs())
934896 then true
935897 else (cfgPoolStatus == PoolPutDis))
936898 then true
937899 else (cfgPoolStatus == PoolShutdown))
938900 then true
939901 else isPoolOneTokenOperationsDisabled
940902 let checks = [if (if (!(isPutDisabled))
941903 then true
942904 else isManager(i))
943905 then true
944906 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
945907 then true
946908 else throwErr("exactly 1 payment are expected")]
947909 if ((checks == checks))
948910 then {
949911 let poolConfig = gpc()
950912 let amId = poolConfig[idxAmAsId]
951913 let prId = poolConfig[idxPrAsId]
952914 let lpId = fromBase58String(poolConfig[idxLPAsId])
953915 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
954916 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
955917 let userAddress = if ((i.caller == this))
956918 then i.originCaller
957919 else i.caller
958920 let pmt = value(i.payments[0])
959921 let pmtAssetId = toBase58String(value(pmt.assetId))
960922 let pmtAmt = pmt.amount
961- let $t03460834766 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
962- if (($t03460834766 == $t03460834766))
923+ let $t03334533500 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
924+ let estimLP = $t03334533500._1
925+ let state = $t03334533500._2
926+ let feeAmount = $t03334533500._3
927+ let emitLpAmt = if (if ((minOutAmount > 0))
928+ then (minOutAmount > estimLP)
929+ else false)
930+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
931+ else estimLP
932+ let e = invoke(fca, "emit", [emitLpAmt], nil)
933+ if ((e == e))
963934 then {
964- let feeAmount = $t03460834766._3
965- let state = $t03460834766._2
966- let estimLP = $t03460834766._1
967- let emitLpAmt = if (if ((minOutAmount > 0))
968- then (minOutAmount > estimLP)
969- else false)
970- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
971- else estimLP
972- let e = invoke(fca, "emit", [emitLpAmt], nil)
973- if ((e == e))
935+ let el = match e {
936+ case legacy: Address =>
937+ invoke(legacy, "emit", [emitLpAmt], nil)
938+ case _ =>
939+ unit
940+ }
941+ if ((el == el))
974942 then {
975- let el = match e {
976- case legacy: Address =>
977- invoke(legacy, "emit", [emitLpAmt], nil)
978- case _ =>
979- unit
980- }
981- if ((el == el))
943+ let lpTrnsfr = if (autoStake)
982944 then {
983- let lpTrnsfr = if (autoStake)
984- then {
985- let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
986- if ((ss == ss))
987- then nil
988- else throw("Strict value is not equal to itself.")
989- }
990- else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
991- let sendFeeToMatcher = if ((feeAmount > 0))
992- then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
993- else nil
994- let $t03558135930 = if ((this == feeCollectorAddress))
995- then $Tuple2(0, 0)
996- else {
997- let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
998- then true
999- else false
1000- if (paymentInAmountAsset)
1001- then $Tuple2(-(feeAmount), 0)
1002- else $Tuple2(0, -(feeAmount))
1003- }
1004- let amountAssetBalanceDelta = $t03558135930._1
1005- let priceAssetBalanceDelta = $t03558135930._2
1006- let $t03593336041 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1007- let refreshDLpActions = $t03593336041._1
1008- let updatedDLp = $t03593336041._2
1009- $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
945+ let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
946+ if ((ss == ss))
947+ then nil
948+ else throw("Strict value is not equal to itself.")
1010949 }
1011- else throw("Strict value is not equal to itself.")
950+ else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
951+ let sendFeeToMatcher = if ((feeAmount > 0))
952+ then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
953+ else nil
954+ $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
1012955 }
1013956 else throw("Strict value is not equal to itself.")
1014957 }
1015958 else throw("Strict value is not equal to itself.")
1016959 }
1017960 else throw("Strict value is not equal to itself.")
1018961 }
1019962
1020963
1021964
1022965 @Callable(i)
1023966 func putForFree (maxSlpg) = if ((0 > maxSlpg))
1024967 then throw("Wrong slpg")
1025968 else if ((size(i.payments) != 2))
1026969 then throw("2 pmnts expd")
1027970 else {
1028971 let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "")
1029- let state = estPut._9
1030- let $t03679736862 = refreshDLpInternal(0, 0, 0)
1031- let refreshDLpActions = $t03679736862._1
1032- let updatedKLp = $t03679736862._2
1033- (state ++ refreshDLpActions)
972+ estPut._9
1034973 }
1035974
1036975
1037976
1038977 @Callable(i)
1039978 func get () = {
1040979 let r = cg(i)
1041980 let outAmtAmt = r._1
1042981 let outPrAmt = r._2
1043982 let pmtAmt = r._3
1044983 let pmtAssetId = r._4
1045984 let state = r._5
1046985 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1047986 if ((b == b))
1048- then {
1049- let $t03749437576 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1050- let refreshDLpActions = $t03749437576._1
1051- let updatedDLp = $t03749437576._2
1052- (state ++ refreshDLpActions)
1053- }
987+ then state
1054988 else throw("Strict value is not equal to itself.")
1055989 }
1056990
1057991
1058992
1059993 @Callable(i)
1060994 func getOneTknV2 (outAssetId,minOutAmount) = {
1061995 let isPoolOneTokenOperationsDisabled = {
1062996 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
1063997 if ($isInstanceOf(@, "Boolean"))
1064998 then @
1065999 else throw(($getType(@) + " couldn't be cast to Boolean"))
10661000 }
10671001 let isGetDisabled = if (if (igs())
10681002 then true
10691003 else (cfgPoolStatus == PoolShutdown))
10701004 then true
10711005 else isPoolOneTokenOperationsDisabled
10721006 let checks = [if (if (!(isGetDisabled))
10731007 then true
10741008 else isManager(i))
10751009 then true
10761010 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
10771011 then true
10781012 else throwErr("exactly 1 payment are expected")]
10791013 if ((checks == checks))
10801014 then {
1081- let $t03812138276 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1082- let state = $t03812138276._1
1083- let totalAmount = $t03812138276._2
1015+ let $t03612236277 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1016+ let state = $t03612236277._1
1017+ let totalAmount = $t03612236277._2
10841018 $Tuple2(state, totalAmount)
1085- }
1086- else throw("Strict value is not equal to itself.")
1087- }
1088-
1089-
1090-
1091-@Callable(i)
1092-func refreshDLp () = {
1093- let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
1094- let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
1095- then unit
1096- else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1097- if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1098- then {
1099- let $t03867438729 = refreshDLpInternal(0, 0, 0)
1100- let actions = $t03867438729._1
1101- let updatedKLp = $t03867438729._2
1102- $Tuple2(actions, toString(updatedKLp))
11031019 }
11041020 else throw("Strict value is not equal to itself.")
11051021 }
11061022
11071023
11081024
11091025 @Callable(i)
11101026 func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
11111027 let poolConfig = gpc()
11121028 let amId = poolConfig[idxAmAsId]
11131029 let prId = poolConfig[idxPrAsId]
11141030 let lpId = poolConfig[idxLPAsId]
11151031 let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))]
11161032 let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
11171033 let D0 = getD(xp)
11181034 let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission))
11191035 let index = if ((outAssetId == amId))
11201036 then 0
11211037 else if ((outAssetId == prId))
11221038 then 1
11231039 else throw("invalid out asset id")
11241040 let newY = getYD(xp, index, D1)
11251041 let dy = (xp[index] - newY)
11261042 let totalGetRaw = max([0, toInt((dy - big1))])
1127- let $t03953139580 = takeFee(totalGetRaw)
1128- let totalGet = $t03953139580._1
1129- let feeAmount = $t03953139580._2
1043+ let $t03706737116 = takeFee(totalGetRaw)
1044+ let totalGet = $t03706737116._1
1045+ let feeAmount = $t03706737116._2
11301046 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
11311047 }
11321048
11331049
11341050
11351051 @Callable(i)
11361052 func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = {
11371053 let poolConfig = gpc()
11381054 let amId = poolConfig[idxAmAsId]
11391055 let prId = poolConfig[idxPrAsId]
11401056 let lpId = poolConfig[idxLPAsId]
11411057 let amBalance = getAccBalance(amId)
11421058 let prBalance = getAccBalance(prId)
1143- let $t03992540040 = {
1059+ let $t03746137576 = {
11441060 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
11451061 if ($isInstanceOf(@, "(Int, Int)"))
11461062 then @
11471063 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
11481064 }
1149- let totalGet = $t03992540040._1
1150- let feeAmount = $t03992540040._2
1065+ let totalGet = $t03746137576._1
1066+ let feeAmount = $t03746137576._2
11511067 let r = ego("", lpId, lpAssetAmount, this)
11521068 let outAmAmt = r._1
11531069 let outPrAmt = r._2
11541070 let sumOfGetAssets = (outAmAmt + outPrAmt)
11551071 let bonus = if ((sumOfGetAssets == 0))
11561072 then if ((totalGet == 0))
11571073 then 0
11581074 else throw("bonus calculation error")
11591075 else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets)
11601076 $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus))
11611077 }
11621078
11631079
11641080
11651081 @Callable(i)
11661082 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
11671083 let r = cg(i)
11681084 let outAmAmt = r._1
11691085 let outPrAmt = r._2
11701086 let pmtAmt = r._3
11711087 let pmtAssetId = r._4
11721088 let state = r._5
11731089 if ((noLessThenAmtAsset > outAmAmt))
11741090 then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
11751091 else if ((noLessThenPriceAsset > outPrAmt))
11761092 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
11771093 else {
11781094 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11791095 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1180- then {
1181- let $t04112641207 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1182- let refreshDLpActions = $t04112641207._1
1183- let updatedDLp = $t04112641207._2
1184- (state ++ refreshDLpActions)
1185- }
1096+ then state
11861097 else throw("Strict value is not equal to itself.")
11871098 }
11881099 }
11891100
11901101
11911102
11921103 @Callable(i)
11931104 func unstakeAndGet (amount) = {
11941105 let checkPayments = if ((size(i.payments) != 0))
11951106 then throw("No pmnts expd")
11961107 else true
11971108 if ((checkPayments == checkPayments))
11981109 then {
11991110 let cfg = gpc()
12001111 let factoryCfg = gfc()
12011112 let lpAssetId = fromBase58String(cfg[idxLPAsId])
12021113 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
12031114 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
12041115 if ((unstakeInv == unstakeInv))
12051116 then {
12061117 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1207- let outAmAmt = r._1
1208- let outPrAmt = r._2
12091118 let sts = parseIntValue(r._9)
12101119 let state = r._10
12111120 let v = if (if (igs())
12121121 then true
12131122 else (sts == PoolShutdown))
12141123 then throw(("Blocked: " + toString(sts)))
12151124 else true
12161125 if ((v == v))
12171126 then {
12181127 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
12191128 if ((burnA == burnA))
1220- then {
1221- let $t04212042201 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1222- let refreshDLpActions = $t04212042201._1
1223- let updatedDLp = $t04212042201._2
1224- (state ++ refreshDLpActions)
1225- }
1129+ then state
12261130 else throw("Strict value is not equal to itself.")
12271131 }
12281132 else throw("Strict value is not equal to itself.")
12291133 }
12301134 else throw("Strict value is not equal to itself.")
12311135 }
12321136 else throw("Strict value is not equal to itself.")
12331137 }
12341138
12351139
12361140
12371141 @Callable(i)
12381142 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
12391143 let isGetDisabled = if (igs())
12401144 then true
12411145 else (cfgPoolStatus == PoolShutdown)
12421146 let checks = [if (!(isGetDisabled))
12431147 then true
12441148 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
12451149 then true
12461150 else throw("no payments are expected")]
12471151 if ((checks == checks))
12481152 then {
12491153 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
12501154 if ((unstakeInv == unstakeInv))
12511155 then {
12521156 let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
12531157 let outAmAmt = res._1
12541158 let outPrAmt = res._2
12551159 let state = res._10
12561160 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
12571161 then true
12581162 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
12591163 then true
12601164 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
12611165 if ((checkAmounts == checkAmounts))
12621166 then {
12631167 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
12641168 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1265- then {
1266- let $t04329943380 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1267- let refreshDLpActions = $t04329943380._1
1268- let updatedDLp = $t04329943380._2
1269- (state ++ refreshDLpActions)
1270- }
1169+ then state
12711170 else throw("Strict value is not equal to itself.")
12721171 }
12731172 else throw("Strict value is not equal to itself.")
12741173 }
12751174 else throw("Strict value is not equal to itself.")
12761175 }
12771176 else throw("Strict value is not equal to itself.")
12781177 }
12791178
12801179
12811180
12821181 @Callable(i)
12831182 func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = {
12841183 let isPoolOneTokenOperationsDisabled = {
12851184 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12861185 if ($isInstanceOf(@, "Boolean"))
12871186 then @
12881187 else throw(($getType(@) + " couldn't be cast to Boolean"))
12891188 }
12901189 let isGetDisabled = if (if (igs())
12911190 then true
12921191 else (cfgPoolStatus == PoolShutdown))
12931192 then true
12941193 else isPoolOneTokenOperationsDisabled
12951194 let checks = [if (if (!(isGetDisabled))
12961195 then true
12971196 else isManager(i))
12981197 then true
12991198 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13001199 then true
13011200 else throwErr("no payments are expected")]
13021201 if ((checks == checks))
13031202 then {
13041203 let cfg = gpc()
13051204 let factoryCfg = gfc()
13061205 let lpAssetId = fromBase58String(cfg[idxLPAsId])
13071206 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
13081207 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
13091208 if ((unstakeInv == unstakeInv))
13101209 then {
1311- let $t04424144429 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1312- let state = $t04424144429._1
1313- let totalAmount = $t04424144429._2
1210+ let $t04141441602 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1211+ let state = $t04141441602._1
1212+ let totalAmount = $t04141441602._2
13141213 $Tuple2(state, totalAmount)
13151214 }
13161215 else throw("Strict value is not equal to itself.")
13171216 }
13181217 else throw("Strict value is not equal to itself.")
13191218 }
13201219
13211220
13221221
13231222 @Callable(i)
13241223 func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = {
13251224 let poolConfig = gpc()
13261225 let amId = poolConfig[idxAmAsId]
13271226 let prId = poolConfig[idxPrAsId]
13281227 let lpId = poolConfig[idxLPAsId]
1329- let $t04468844791 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1330- let lpAmount = $t04468844791._1
1331- let state = $t04468844791._2
1332- let feeAmount = $t04468844791._3
1333- let bonus = $t04468844791._4
1228+ let $t04186141964 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1229+ let lpAmount = $t04186141964._1
1230+ let state = $t04186141964._2
1231+ let feeAmount = $t04186141964._3
1232+ let bonus = $t04186141964._4
13341233 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13351234 }
13361235
13371236
13381237
13391238 @Callable(i)
13401239 func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = {
13411240 let poolConfig = gpc()
13421241 let amId = poolConfig[idxAmAsId]
13431242 let prId = poolConfig[idxPrAsId]
13441243 let lpId = poolConfig[idxLPAsId]
1345- let $t04507045174 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1346- let lpAmount = $t04507045174._1
1347- let state = $t04507045174._2
1348- let feeAmount = $t04507045174._3
1349- let bonus = $t04507045174._4
1244+ let $t04224342347 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1245+ let lpAmount = $t04224342347._1
1246+ let state = $t04224342347._2
1247+ let feeAmount = $t04224342347._3
1248+ let bonus = $t04224342347._4
13501249 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
13511250 }
13521251
13531252
13541253
13551254 @Callable(i)
13561255 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
13571256 then throw("denied")
13581257 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
13591258
13601259
13611260
13621261 @Callable(i)
13631262 func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
13641263 then pd
13651264 else [StringEntry(k, v)]
13661265
13671266
13681267
13691268 @Callable(i)
13701269 func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
13711270 then pd
13721271 else [IntegerEntry(k, v)]
13731272
13741273
13751274
13761275 @Callable(i)
13771276 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
13781277
13791278
13801279
13811280 @Callable(i)
13821281 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
13831282
13841283
13851284
13861285 @Callable(i)
13871286 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
13881287 let pr = calcPrices(amAmt, prAmt, lpAmt)
13891288 $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
13901289 }
13911290
13921291
13931292
13941293 @Callable(i)
13951294 func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
13961295
13971296
13981297
13991298 @Callable(i)
14001299 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
14011300
14021301
14031302
14041303 @Callable(i)
14051304 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
14061305
14071306
14081307
14091308 @Callable(i)
14101309 func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, ""))
14111310
14121311
14131312
14141313 @Callable(i)
14151314 func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
14161315 let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
14171316 $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
14181317 }
14191318
14201319
14211320
14221321 @Callable(i)
14231322 func getFeeREADONLY () = $Tuple2(nil, fee)
14241323
14251324
14261325 @Verifier(tx)
14271326 func verify () = {
14281327 let targetPublicKey = match m() {
14291328 case pk: ByteVector =>
14301329 pk
14311330 case _: Unit =>
14321331 tx.senderPublicKey
14331332 case _ =>
14341333 throw("Match error")
14351334 }
14361335 match tx {
14371336 case order: Order =>
14381337 let matcherPub = mp()
14391338 let orderValid = moa(order)
14401339 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
14411340 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
14421341 if (if (if (orderValid)
14431342 then senderValid
14441343 else false)
14451344 then matcherValid
14461345 else false)
14471346 then true
14481347 else toe(orderValid, senderValid, matcherValid)
14491348 case s: SetScriptTransaction =>
14501349 let newHash = blake2b256(value(s.script))
14511350 let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash())))
14521351 let currentHash = scriptHash(this)
14531352 if (if ((allowedHash == newHash))
14541353 then (currentHash != newHash)
14551354 else false)
14561355 then true
14571356 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14581357 case _ =>
14591358 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
14601359 }
14611360 }
14621361

github/deemru/w8io/026f985 
160.58 ms