tx · D3HqXfxmoJK1aYh6j8DmK6VQ4Ev4jvdMm6Djso6Xqcos

3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT:  -0.03100000 Waves

2022.12.09 09:33 [2352430] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves

{ "type": 13, "id": "D3HqXfxmoJK1aYh6j8DmK6VQ4Ev4jvdMm6Djso6Xqcos", "fee": 3100000, "feeAssetId": null, "timestamp": 1670567515976, "version": 1, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "nqwcqTvEEXjTh8vMa8NNU7B3wjXHz7UY1Eih5UDdhr8oMhHtGiFYJx5J64cdAsjjyVEb98PxqiHNb46apXr1Qb6" ], "script": "base64:BgKhIggCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIECgIIARIECgIIARIECgIBARIDCgEBEgUKAwEBARIFCgMBCAESBAoCAQgSBAoCAQgSBAoCCAgSBAoCCAgSBAoCCAESABIDCgEIEgUKAwEBARIECgIIARIECgIBARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiIKc2xpcHBhZ2U0RCILd2F2ZXNTdHJpbmciBUFtdWx0IgVEY29udiIDU0VQIgVFTVBUWSIKUG9vbEFjdGl2ZSIKUG9vbFB1dERpcyIOUG9vbE1hdGNoZXJEaXMiDFBvb2xTaHV0ZG93biIOaWR4UG9vbEFkZHJlc3MiCWlkeFBvb2xTdCIJaWR4TFBBc0lkIglpZHhBbUFzSWQiCWlkeFByQXNJZCILaWR4QW10QXNEY20iDWlkeFByaWNlQXNEY20iC2lkeElBbXRBc0lkIg1pZHhJUHJpY2VBc0lkIg9pZHhGYWN0U3Rha0N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kWAZzY3JpcHQEAmdVCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUYJAQJhcQAEAmdWCQDxBwEFBHRoaXMDAwkAAAIFAmdVBQJnVAkBAiE9AgUCZ1YFAmdUBwYJAPQDAwgFAmdNCWJvZHlCeXRlcwkAkQMCCAUCZ00GcHJvb2ZzAAAFAmdPCQD0AwMIBQJnTQlib2R5Qnl0ZXMJAJEDAggFAmdNBnByb29mcwAABQJnT6kdqhQ=", "chainId": 84, "height": 2352430, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HtqZBdmkGa8XV7JaW6AFRiLZcB3LzjdoLC8XUgTUtmd7 Next: 2C6YVhaGZyj5ZAEGQDBGjGVhoV13tJvK2cAYiNeWRdaJ Diff:
OldNewDifferences
1414 let big1 = toBigInt(1)
1515
1616 let big2 = toBigInt(2)
17-
18-let big3 = toBigInt(3)
19-
20-let big4 = toBigInt(4)
2117
2218 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
2319
123119
124120 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
125121
126-let keyDLp = makeString(["%s", "dLp"], SEP)
127-
128-let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP)
129-
130-let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP)
131-
132-let dLpRefreshDelayDefault = 1
133-
134-let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault)
135-
136122 func fcfg () = "%s__factoryConfig"
137123
138124
174160 func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " "))
175161
176162
177-func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ")
178-
179-
180163 let fca = addressFromStringValue(strf(this, fc()))
181164
182165 let A = strf(this, amp())
213196
214197 let poolConfigParsed = parsePoolConfig(gpc())
215198
216-let $t072557441 = poolConfigParsed
199+let $t068307016 = poolConfigParsed
217200
218-let cfgPoolAddress = $t072557441._1
201+let cfgPoolAddress = $t068307016._1
219202
220-let cfgPoolStatus = $t072557441._2
203+let cfgPoolStatus = $t068307016._2
221204
222-let cfgLpAssetId = $t072557441._3
205+let cfgLpAssetId = $t068307016._3
223206
224-let cfgAmountAssetId = $t072557441._4
207+let cfgAmountAssetId = $t068307016._4
225208
226-let cfgPriceAssetId = $t072557441._5
209+let cfgPriceAssetId = $t068307016._5
227210
228-let cfgAmountAssetDecimals = $t072557441._6
211+let cfgAmountAssetDecimals = $t068307016._6
229212
230-let cfgPriceAssetDecimals = $t072557441._7
213+let cfgPriceAssetDecimals = $t068307016._7
231214
232215 func gfc () = split(strf(fca, fcfg()), SEP)
233216
422405 else calcLpAmt
423406 let amDiff = (inAmAmt - calcAmAssetPmt)
424407 let prDiff = (inPrAmt - calcPrAssetPmt)
425- let $t01787218217 = if (if (isOneAsset)
408+ let $t01744717792 = if (if (isOneAsset)
426409 then (pmtId == amIdStr)
427410 else false)
428411 then $Tuple2(pmtAmt, 0)
431414 else false)
432415 then $Tuple2(0, pmtAmt)
433416 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
434- let writeAmAmt = $t01787218217._1
435- let writePrAmt = $t01787218217._2
417+ let writeAmAmt = $t01744717792._1
418+ let writePrAmt = $t01744717792._2
436419 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))]
437420 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
438421 }
439422 }
440423
441424
442-func getD (xp) = {
443- let xp0 = xp[0]
444- let xp1 = xp[1]
445- let s = (xp0 + xp1)
446- if ((s == big0))
447- then big0
448- else {
449- let a = parseIntValue(A)
450- let ann = (a * 2)
451- let p = fraction(xp0, xp1, big1)
452- let xp0_xp1_n_n = fraction(p, big4, big1)
453- let ann_s = fraction(toBigInt(ann), s, big1)
454- let ann_1 = toBigInt((ann - 1))
455- func calcDNext (d) = {
456- let dd = fraction(d, d, big1)
457- let ddd = fraction(dd, d, big1)
458- let dp = fraction(ddd, big1, xp0_xp1_n_n)
459- fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1)), CEILING)
460- }
461-
462- func calc (acc,i) = if (acc._2)
463- then acc
464- else {
465- let d = acc._1
466- let dNext = calcDNext(d)
467- let dDiffRaw = toInt((dNext - value(d)))
468- let dDiff = if ((0 > dDiffRaw))
469- then -(dDiffRaw)
470- else dDiffRaw
471- if ((1 >= dDiff))
472- then $Tuple2(dNext, true)
473- else $Tuple2(dNext, false)
474- }
475-
476- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
477- let $t02014520193 = {
478- let $l = arr
479- let $s = size($l)
480- let $acc0 = $Tuple2(s, false)
481- func $f0_1 ($a,$i) = if (($i >= $s))
482- then $a
483- else calc($a, $l[$i])
484-
485- func $f0_2 ($a,$i) = if (($i >= $s))
486- then $a
487- else throw("List size exceeds 15")
488-
489- $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)
490- }
491- let d = $t02014520193._1
492- let found = $t02014520193._2
493- if (found)
494- then d
495- else throw(("D calculation error, D = " + toString(d)))
496- }
497- }
498-
499-
500-func getDOld (xp) = {
501- let n = big2
502- let xp0 = xp[0]
503- let xp1 = xp[1]
504- let aPrecision = parseBigIntValue(Amult)
505- let a = (parseBigIntValue(A) * aPrecision)
506- let s = (xp0 + xp1)
507- if ((s == big0))
508- then big0
509- else {
510- let ann = (a * n)
511- let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
512- let ann_s_aPrecision = ((ann * s) / aPrecision)
513- let ann_aPrecision = (ann - aPrecision)
514- let n1 = (n + big1)
515- func calc (acc,cur) = {
516- let $t02082220842 = acc
517- let d = $t02082220842._1
518- let found = $t02082220842._2
519- if ((found != unit))
520- then acc
521- else {
522- let dp = (((d * d) * d) / xp0_xp1_n_n)
523- let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
524- let dDiff = absBigInt((dNext - value(d)))
525- if ((big1 >= dDiff))
526- then $Tuple2(dNext, cur)
527- else $Tuple2(dNext, unit)
528- }
529- }
530-
531- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
532- let $t02126321310 = {
533- let $l = arr
534- let $s = size($l)
535- let $acc0 = $Tuple2(s, unit)
536- func $f0_1 ($a,$i) = if (($i >= $s))
537- then $a
538- else calc($a, $l[$i])
539-
540- func $f0_2 ($a,$i) = if (($i >= $s))
541- then $a
542- else throw("List size exceeds 15")
543-
544- $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)
545- }
546- let d = $t02126321310._1
547- let found = $t02126321310._2
548- if ((found != unit))
549- then d
550- else throw(("D calculation error, D = " + toString(d)))
551- }
552- }
553-
554-
555-func getYD (xp,i,D) = {
556- let n = big2
557- let x = xp[if ((i == 0))
558- then 1
559- else 0]
560- let aPrecision = parseBigIntValue(Amult)
561- let a = (parseBigIntValue(A) * aPrecision)
562- let s = x
563- let ann = (a * n)
564- let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
565- let b = ((s + ((D * aPrecision) / ann)) - D)
566- func calc (acc,cur) = {
567- let $t02181021830 = acc
568- let y = $t02181021830._1
569- let found = $t02181021830._2
570- if ((found != unit))
571- then acc
572- else {
573- let yNext = (((y * y) + c) / ((big2 * y) + b))
574- let yDiff = absBigInt((yNext - value(y)))
575- if ((big1 >= yDiff))
576- then $Tuple2(yNext, cur)
577- else $Tuple2(yNext, unit)
578- }
579- }
580-
581- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
582- let $t02213722184 = {
583- let $l = arr
584- let $s = size($l)
585- let $acc0 = $Tuple2(D, unit)
586- func $f0_1 ($a,$i) = if (($i >= $s))
587- then $a
588- else calc($a, $l[$i])
589-
590- func $f0_2 ($a,$i) = if (($i >= $s))
591- then $a
592- else throw("List size exceeds 15")
593-
594- $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)
595- }
596- let y = $t02213722184._1
597- let found = $t02213722184._2
598- if ((found != unit))
599- then y
600- else throw(("Y calculation error, Y = " + toString(y)))
601- }
602-
603-
604-func calcDLp (amountBalance,priceBalance,lpEmission) = {
605- let updatedDLp = fraction(getD([amountBalance, priceBalance]), scale18, lpEmission)
606- if ((lpEmission == big0))
607- then big0
608- else updatedDLp
609- }
610-
611-
612-func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
613- let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
614- let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
615- let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
616- let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
617- currentDLp
618- }
619-
620-
621-func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
622- let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
623- let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
624- let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
625- let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
626- let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))]
627- $Tuple2(actions, updatedDLp)
628- }
629-
630-
631-func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp))
632- then true
633- else throwErr("updated DLp lower than current DLp")
634-
635-
636-func validateMatcherOrderAllowed (order) = {
637- let amountAssetAmount = order.amount
638- let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
639- let $t02412324335 = if ((order.orderType == Buy))
640- then $Tuple2(amountAssetAmount, -(priceAssetAmount))
641- else $Tuple2(-(amountAssetAmount), priceAssetAmount)
642- let amountAssetBalanceDelta = $t02412324335._1
643- let priceAssetBalanceDelta = $t02412324335._2
425+func moa (order) = {
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)
644438 if (if (if (igs())
645439 then true
646- else (cfgPoolStatus == PoolMatcherDis))
440+ else (sts == PoolMatcherDis))
647441 then true
648- else (cfgPoolStatus == PoolShutdown))
442+ else (sts == PoolShutdown))
649443 then throw("Admin blocked")
650- else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
651- then true
652- else (order.assetPair.priceAsset != cfgPriceAssetId))
653- then throw("Wr assets")
654- else {
655- let dLp = parseBigIntValue(getStringValue(this, keyDLp))
656- let $t02466524765 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
657- let unusedActions = $t02466524765._1
658- let dLpNew = $t02466524765._2
659- let isOrderValid = (dLpNew >= dLp)
660- isOrderValid
661- }
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+ }
662467 }
663468
664469
694499 }
695500
696501
502+func getD (xp) = {
503+ let n = big2
504+ let xp0 = xp[0]
505+ let xp1 = xp[1]
506+ let aPrecision = parseBigIntValue(Amult)
507+ let a = (parseBigIntValue(A) * aPrecision)
508+ let s = (xp0 + xp1)
509+ if ((s == big0))
510+ then big0
511+ else {
512+ let ann = (a * n)
513+ let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
514+ let ann_s_aPrecision = ((ann * s) / aPrecision)
515+ let ann_aPrecision = (ann - aPrecision)
516+ let n1 = (n + big1)
517+ func calc (acc,cur) = {
518+ let $t02234422364 = acc
519+ let d = $t02234422364._1
520+ let found = $t02234422364._2
521+ if ((found != unit))
522+ then acc
523+ else {
524+ let dp = (((d * d) * d) / xp0_xp1_n_n)
525+ let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
526+ let dDiff = absBigInt((dNext - value(d)))
527+ if ((big1 >= dDiff))
528+ then $Tuple2(dNext, cur)
529+ else $Tuple2(dNext, unit)
530+ }
531+ }
532+
533+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
534+ let $t02278522832 = {
535+ let $l = arr
536+ let $s = size($l)
537+ let $acc0 = $Tuple2(s, unit)
538+ func $f0_1 ($a,$i) = if (($i >= $s))
539+ then $a
540+ else calc($a, $l[$i])
541+
542+ func $f0_2 ($a,$i) = if (($i >= $s))
543+ then $a
544+ else throw("List size exceeds 15")
545+
546+ $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)
547+ }
548+ let d = $t02278522832._1
549+ let found = $t02278522832._2
550+ if ((found != unit))
551+ then d
552+ else throw(("D calculation error, D = " + toString(d)))
553+ }
554+ }
555+
556+
557+func getYD (xp,i,D) = {
558+ let n = big2
559+ let x = xp[if ((i == 0))
560+ then 1
561+ else 0]
562+ let aPrecision = parseBigIntValue(Amult)
563+ let a = (parseBigIntValue(A) * aPrecision)
564+ let s = x
565+ let ann = (a * n)
566+ let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
567+ let b = ((s + ((D * aPrecision) / ann)) - D)
568+ func calc (acc,cur) = {
569+ let $t02333223352 = acc
570+ let y = $t02333223352._1
571+ let found = $t02333223352._2
572+ if ((found != unit))
573+ then acc
574+ else {
575+ let yNext = (((y * y) + c) / ((big2 * y) + b))
576+ let yDiff = absBigInt((yNext - value(y)))
577+ if ((big1 >= yDiff))
578+ then $Tuple2(yNext, cur)
579+ else $Tuple2(yNext, unit)
580+ }
581+ }
582+
583+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
584+ let $t02365923706 = {
585+ let $l = arr
586+ let $s = size($l)
587+ let $acc0 = $Tuple2(D, unit)
588+ func $f0_1 ($a,$i) = if (($i >= $s))
589+ then $a
590+ else calc($a, $l[$i])
591+
592+ func $f0_2 ($a,$i) = if (($i >= $s))
593+ then $a
594+ else throw("List size exceeds 15")
595+
596+ $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)
597+ }
598+ let y = $t02365923706._1
599+ let found = $t02365923706._2
600+ if ((found != unit))
601+ then y
602+ else throw(("Y calculation error, Y = " + toString(y)))
603+ }
604+
605+
697606 func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = {
698607 let poolConfig = gpc()
699608 let amId = poolConfig[idxAmAsId]
709618 then {
710619 let amBalance = getAccBalance(amId)
711620 let prBalance = getAccBalance(prId)
712- let $t02708227544 = if ((txId == ""))
621+ let $t02448924951 = if ((txId == ""))
713622 then $Tuple2(amBalance, prBalance)
714623 else if ((pmtAssetId == amId))
715624 then if ((pmtAmtRaw > amBalance))
720629 then throw("invalid payment amount")
721630 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
722631 else throw("wrong pmtAssetId")
723- let amBalanceOld = $t02708227544._1
724- let prBalanceOld = $t02708227544._2
725- let $t02755027726 = if ((pmtAssetId == amId))
632+ let amBalanceOld = $t02448924951._1
633+ let prBalanceOld = $t02448924951._2
634+ let $t02495725133 = if ((pmtAssetId == amId))
726635 then $Tuple2(pmtAmtRaw, 0)
727636 else if ((pmtAssetId == prId))
728637 then $Tuple2(0, pmtAmtRaw)
729638 else throw("invalid payment")
730- let amAmountRaw = $t02755027726._1
731- let prAmountRaw = $t02755027726._2
732- let $t02773027969 = if (withTakeFee)
639+ let amAmountRaw = $t02495725133._1
640+ let prAmountRaw = $t02495725133._2
641+ let $t02513725376 = if (withTakeFee)
733642 then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
734643 else $Tuple3(amAmountRaw, prAmountRaw, 0)
735- let amAmount = $t02773027969._1
736- let prAmount = $t02773027969._2
737- let feeAmount = $t02773027969._3
644+ let amAmount = $t02513725376._1
645+ let prAmount = $t02513725376._2
646+ let feeAmount = $t02513725376._3
738647 let amBalanceNew = (amBalanceOld + amAmount)
739648 let prBalanceNew = (prBalanceOld + prAmount)
740649 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
744653 else throw()
745654 if ((checkD == checkD))
746655 then {
747- let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR)
656+ let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0)
748657 let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8)
749658 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))]
750659 let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
774683 let pmt = value(payments[0])
775684 let pmtAssetId = value(pmt.assetId)
776685 let pmtAmt = pmt.amount
777- let currentDLp = calcCurrentDLp(big0, big0, big0)
778- if ((currentDLp == currentDLp))
779- then {
780- let txId58 = toBase58String(transactionId)
781- if ((lpId != toBase58String(pmtAssetId)))
782- then throw("Wrong LP")
783- else {
784- let amBalance = getAccBalance(amId)
785- let prBalance = getAccBalance(prId)
786- let $t03003430145 = {
787- let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
788- if ($isInstanceOf(@, "(Int, Int)"))
789- then @
790- else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
791- }
792- if (($t03003430145 == $t03003430145))
686+ let txId58 = toBase58String(transactionId)
687+ if ((lpId != toBase58String(pmtAssetId)))
688+ then throw("Wrong LP")
689+ else {
690+ let amBalance = getAccBalance(amId)
691+ let prBalance = getAccBalance(prId)
692+ let $t02737827489 = {
693+ let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
694+ if ($isInstanceOf(@, "(Int, Int)"))
695+ then @
696+ else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
697+ }
698+ if (($t02737827489 == $t02737827489))
699+ then {
700+ let feeAmount = $t02737827489._2
701+ let totalGet = $t02737827489._1
702+ let totalAmount = if (if ((minOutAmount > 0))
703+ then (minOutAmount > totalGet)
704+ else false)
705+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
706+ else totalGet
707+ let $t02767927986 = if ((outAssetId == amId))
708+ then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
709+ else if ((outAssetId == prId))
710+ then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
711+ else throw("invalid out asset id")
712+ let outAm = $t02767927986._1
713+ let outPr = $t02767927986._2
714+ let amBalanceNew = $t02767927986._3
715+ let prBalanceNew = $t02767927986._4
716+ let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
717+ let curPr = f1(curPrX18, scale8)
718+ let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
719+ then unit
720+ else fromBase58String(outAssetId)
721+ let sendFeeToMatcher = if ((feeAmount > 0))
722+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
723+ else nil
724+ 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)
725+ if ((state == state))
793726 then {
794- let feeAmount = $t03003430145._2
795- let totalGet = $t03003430145._1
796- let totalAmount = if (if ((minOutAmount > 0))
797- then (minOutAmount > totalGet)
798- else false)
799- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
800- else totalGet
801- let $t03033530642 = if ((outAssetId == amId))
802- then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
803- else if ((outAssetId == prId))
804- then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
805- else throw("invalid out asset id")
806- let outAm = $t03033530642._1
807- let outPr = $t03033530642._2
808- let amBalanceNew = $t03033530642._3
809- let prBalanceNew = $t03033530642._4
810- let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
811- let curPr = f1(curPrX18, scale8)
812- let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
813- then unit
814- else fromBase58String(outAssetId)
815- let sendFeeToMatcher = if ((feeAmount > 0))
816- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
817- else nil
818- 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)
819- if ((state == state))
820- then {
821- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
822- if ((burn == burn))
823- then {
824- let $t03142731777 = {
825- let feeAmountForCalc = if ((this == feeCollectorAddress))
826- then 0
827- else feeAmount
828- let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId))
829- then true
830- else false
831- if (outInAmountAsset)
832- then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
833- else $Tuple2(0, -((totalGet + feeAmountForCalc)))
834- }
835- let amountAssetBalanceDelta = $t03142731777._1
836- let priceAssetBalanceDelta = $t03142731777._2
837- let $t03178031888 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
838- let refreshDLpActions = $t03178031888._1
839- let updatedDLp = $t03178031888._2
840- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
841- if ((isUpdatedDLpValid == isUpdatedDLpValid))
842- then $Tuple2((state ++ refreshDLpActions), totalAmount)
843- else throw("Strict value is not equal to itself.")
844- }
845- else throw("Strict value is not equal to itself.")
846- }
727+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
728+ if ((burn == burn))
729+ then $Tuple2(state, totalAmount)
847730 else throw("Strict value is not equal to itself.")
848731 }
849732 else throw("Strict value is not equal to itself.")
850733 }
734+ else throw("Strict value is not equal to itself.")
851735 }
852- else throw("Strict value is not equal to itself.")
853736 }
854737
855738
954837 else if ((size(i.payments) != 2))
955838 then throw("2 pmnts expd")
956839 else {
957- let amAssetPmt = toBigInt(value(i.payments[0]).amount)
958- let prAssetPmt = toBigInt(value(i.payments[1]).amount)
959- let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
960- if ((currentDLp == currentDLp))
840+ 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, "")
841+ let emitLpAmt = e._2
842+ let lpAssetId = e._7
843+ let state = e._9
844+ let amDiff = e._10
845+ let prDiff = e._11
846+ let amId = e._12
847+ let prId = e._13
848+ let r = invoke(fca, "emit", [emitLpAmt], nil)
849+ if ((r == r))
961850 then {
962- 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, "")
963- let emitLpAmt = e._2
964- let lpAssetId = e._7
965- let state = e._9
966- let amDiff = e._10
967- let prDiff = e._11
968- let amId = e._12
969- let prId = e._13
970- let r = invoke(fca, "emit", [emitLpAmt], nil)
971- if ((r == r))
851+ let el = match r {
852+ case legacy: Address =>
853+ invoke(legacy, "emit", [emitLpAmt], nil)
854+ case _ =>
855+ unit
856+ }
857+ if ((el == el))
972858 then {
973- let el = match r {
974- case legacy: Address =>
975- invoke(legacy, "emit", [emitLpAmt], nil)
976- case _ =>
977- unit
978- }
979- if ((el == el))
859+ let sa = if ((amDiff > 0))
860+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
861+ else nil
862+ if ((sa == sa))
980863 then {
981- let sa = if ((amDiff > 0))
982- then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
864+ let sp = if ((prDiff > 0))
865+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
983866 else nil
984- if ((sa == sa))
867+ if ((sp == sp))
985868 then {
986- let sp = if ((prDiff > 0))
987- then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
988- else nil
989- if ((sp == sp))
869+ let lpTrnsfr = if (autoStake)
990870 then {
991- let lpTrnsfr = if (autoStake)
992- then {
993- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
994- if ((ss == ss))
995- then nil
996- else throw("Strict value is not equal to itself.")
997- }
998- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
999- let $t03574435809 = refreshDLpInternal(0, 0, 0)
1000- let refreshDLpActions = $t03574435809._1
1001- let updatedDLp = $t03574435809._2
1002- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1003- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1004- then ((state ++ lpTrnsfr) ++ refreshDLpActions)
871+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
872+ if ((ss == ss))
873+ then nil
1005874 else throw("Strict value is not equal to itself.")
1006875 }
1007- else throw("Strict value is not equal to itself.")
876+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
877+ (state ++ lpTrnsfr)
1008878 }
1009879 else throw("Strict value is not equal to itself.")
1010880 }
1054924 let pmt = value(i.payments[0])
1055925 let pmtAssetId = toBase58String(value(pmt.assetId))
1056926 let pmtAmt = pmt.amount
1057- let $t03694637104 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
1058- if (($t03694637104 == $t03694637104))
927+ let $t03334833506 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
928+ if (($t03334833506 == $t03334833506))
1059929 then {
1060- let feeAmount = $t03694637104._3
1061- let state = $t03694637104._2
1062- let estimLP = $t03694637104._1
930+ let feeAmount = $t03334833506._3
931+ let state = $t03334833506._2
932+ let estimLP = $t03334833506._1
1063933 let emitLpAmt = if (if ((minOutAmount > 0))
1064934 then (minOutAmount > estimLP)
1065935 else false)
1087957 let sendFeeToMatcher = if ((feeAmount > 0))
1088958 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
1089959 else nil
1090- let $t03791938268 = if ((this == feeCollectorAddress))
1091- then $Tuple2(0, 0)
1092- else {
1093- let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
1094- then true
1095- else false
1096- if (paymentInAmountAsset)
1097- then $Tuple2(-(feeAmount), 0)
1098- else $Tuple2(0, -(feeAmount))
1099- }
1100- let amountAssetBalanceDelta = $t03791938268._1
1101- let priceAssetBalanceDelta = $t03791938268._2
1102- let $t03827138379 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1103- let refreshDLpActions = $t03827138379._1
1104- let updatedDLp = $t03827138379._2
1105- $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
960+ $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
1106961 }
1107962 else throw("Strict value is not equal to itself.")
1108963 }
1122977 then throw("2 pmnts expd")
1123978 else {
1124979 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, "")
1125- let state = estPut._9
1126- let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1127- let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1128- let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
1129- if ((currentDLp == currentDLp))
1130- then {
1131- let $t03933839403 = refreshDLpInternal(0, 0, 0)
1132- let refreshDLpActions = $t03933839403._1
1133- let updatedDLp = $t03933839403._2
1134- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1135- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1136- then (state ++ refreshDLpActions)
1137- else throw("Strict value is not equal to itself.")
1138- }
1139- else throw("Strict value is not equal to itself.")
980+ estPut._9
1140981 }
1141982
1142983
1151992 let state = r._5
1152993 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1153994 if ((b == b))
1154- then {
1155- let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
1156- let $t04019240274 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1157- let refreshDLpActions = $t04019240274._1
1158- let updatedDLp = $t04019240274._2
1159- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1160- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1161- then (state ++ refreshDLpActions)
1162- else throw("Strict value is not equal to itself.")
1163- }
995+ then state
1164996 else throw("Strict value is not equal to itself.")
1165997 }
1166998
11881020 else throwErr("exactly 1 payment are expected")]
11891021 if ((checks == checks))
11901022 then {
1191- let $t04089241047 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1192- let state = $t04089241047._1
1193- let totalAmount = $t04089241047._2
1023+ let $t03612836283 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1024+ let state = $t03612836283._1
1025+ let totalAmount = $t03612836283._2
11941026 $Tuple2(state, totalAmount)
1195- }
1196- else throw("Strict value is not equal to itself.")
1197- }
1198-
1199-
1200-
1201-@Callable(i)
1202-func refreshDLp () = {
1203- let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
1204- let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
1205- then unit
1206- else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1207- if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1208- then {
1209- let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1210- let $t04157141635 = refreshDLpInternal(0, 0, 0)
1211- let dLpUpdateActions = $t04157141635._1
1212- let updatedDLp = $t04157141635._2
1213- let actions = if ((dLp != updatedDLp))
1214- then dLpUpdateActions
1215- else throwErr("nothing to refresh")
1216- $Tuple2(actions, toString(updatedDLp))
12171027 }
12181028 else throw("Strict value is not equal to itself.")
12191029 }
12381048 let newY = getYD(xp, index, D1)
12391049 let dy = (xp[index] - newY)
12401050 let totalGetRaw = max([0, toInt((dy - big1))])
1241- let $t04253542584 = takeFee(totalGetRaw)
1242- let totalGet = $t04253542584._1
1243- let feeAmount = $t04253542584._2
1051+ let $t03707337122 = takeFee(totalGetRaw)
1052+ let totalGet = $t03707337122._1
1053+ let feeAmount = $t03707337122._2
12441054 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
12451055 }
12461056
12541064 let lpId = poolConfig[idxLPAsId]
12551065 let amBalance = getAccBalance(amId)
12561066 let prBalance = getAccBalance(prId)
1257- let $t04292943044 = {
1067+ let $t03746737582 = {
12581068 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
12591069 if ($isInstanceOf(@, "(Int, Int)"))
12601070 then @
12611071 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
12621072 }
1263- let totalGet = $t04292943044._1
1264- let feeAmount = $t04292943044._2
1073+ let totalGet = $t03746737582._1
1074+ let feeAmount = $t03746737582._2
12651075 let r = ego("", lpId, lpAssetAmount, this)
12661076 let outAmAmt = r._1
12671077 let outPrAmt = r._2
12891099 else if ((noLessThenPriceAsset > outPrAmt))
12901100 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
12911101 else {
1292- let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
12931102 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12941103 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1295- then {
1296- let $t04421244293 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1297- let refreshDLpActions = $t04421244293._1
1298- let updatedDLp = $t04421244293._2
1299- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1300- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1301- then (state ++ refreshDLpActions)
1302- else throw("Strict value is not equal to itself.")
1303- }
1104+ then state
13041105 else throw("Strict value is not equal to itself.")
13051106 }
13061107 }
13181119 let factoryCfg = gfc()
13191120 let lpAssetId = fromBase58String(cfg[idxLPAsId])
13201121 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1321- let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
13221122 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
13231123 if ((unstakeInv == unstakeInv))
13241124 then {
13251125 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1326- let outAmAmt = r._1
1327- let outPrAmt = r._2
13281126 let sts = parseIntValue(r._9)
13291127 let state = r._10
13301128 let v = if (if (igs())
13361134 then {
13371135 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
13381136 if ((burnA == burnA))
1339- then {
1340- let $t04535645437 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1341- let refreshDLpActions = $t04535645437._1
1342- let updatedDLp = $t04535645437._2
1343- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1344- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1345- then (state ++ refreshDLpActions)
1346- else throw("Strict value is not equal to itself.")
1347- }
1137+ then state
13481138 else throw("Strict value is not equal to itself.")
13491139 }
13501140 else throw("Strict value is not equal to itself.")
13681158 else throw("no payments are expected")]
13691159 if ((checks == checks))
13701160 then {
1371- let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
13721161 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13731162 if ((unstakeInv == unstakeInv))
13741163 then {
13851174 then {
13861175 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13871176 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1388- then {
1389- let $t04668546766 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1390- let refreshDLpActions = $t04668546766._1
1391- let updatedDLp = $t04668546766._2
1392- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1393- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1394- then (state ++ refreshDLpActions)
1395- else throw("Strict value is not equal to itself.")
1396- }
1177+ then state
13971178 else throw("Strict value is not equal to itself.")
13981179 }
13991180 else throw("Strict value is not equal to itself.")
14341215 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
14351216 if ((unstakeInv == unstakeInv))
14361217 then {
1437- let $t04770047888 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1438- let state = $t04770047888._1
1439- let totalAmount = $t04770047888._2
1218+ let $t04142041608 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1219+ let state = $t04142041608._1
1220+ let totalAmount = $t04142041608._2
14401221 $Tuple2(state, totalAmount)
14411222 }
14421223 else throw("Strict value is not equal to itself.")
14521233 let amId = poolConfig[idxAmAsId]
14531234 let prId = poolConfig[idxPrAsId]
14541235 let lpId = poolConfig[idxLPAsId]
1455- let $t04814748250 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1456- let lpAmount = $t04814748250._1
1457- let state = $t04814748250._2
1458- let feeAmount = $t04814748250._3
1459- let bonus = $t04814748250._4
1236+ let $t04186741970 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1237+ let lpAmount = $t04186741970._1
1238+ let state = $t04186741970._2
1239+ let feeAmount = $t04186741970._3
1240+ let bonus = $t04186741970._4
14601241 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
14611242 }
14621243
14681249 let amId = poolConfig[idxAmAsId]
14691250 let prId = poolConfig[idxPrAsId]
14701251 let lpId = poolConfig[idxLPAsId]
1471- let $t04852948633 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1472- let lpAmount = $t04852948633._1
1473- let state = $t04852948633._2
1474- let feeAmount = $t04852948633._3
1475- let bonus = $t04852948633._4
1252+ let $t04224942353 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1253+ let lpAmount = $t04224942353._1
1254+ let state = $t04224942353._2
1255+ let feeAmount = $t04224942353._3
1256+ let bonus = $t04224942353._4
14761257 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
14771258 }
14781259
15621343 match tx {
15631344 case order: Order =>
15641345 let matcherPub = mp()
1565- let orderValid = validateMatcherOrderAllowed(order)
1346+ let orderValid = moa(order)
15661347 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
15671348 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
15681349 if (if (if (orderValid)
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)
17-
18-let big3 = toBigInt(3)
19-
20-let big4 = toBigInt(4)
2117
2218 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
2319
2420 let wavesString = "WAVES"
2521
2622 let Amult = "100"
2723
2824 let Dconv = "1"
2925
3026 let SEP = "__"
3127
3228 let EMPTY = ""
3329
3430 let PoolActive = 1
3531
3632 let PoolPutDis = 2
3733
3834 let PoolMatcherDis = 3
3935
4036 let PoolShutdown = 4
4137
4238 let idxPoolAddress = 1
4339
4440 let idxPoolSt = 2
4541
4642 let idxLPAsId = 3
4743
4844 let idxAmAsId = 4
4945
5046 let idxPrAsId = 5
5147
5248 let idxAmtAsDcm = 6
5349
5450 let idxPriceAsDcm = 7
5551
5652 let idxIAmtAsId = 8
5753
5854 let idxIPriceAsId = 9
5955
6056 let idxFactStakCntr = 1
6157
6258 let idxFactoryRestCntr = 6
6359
6460 let idxFactSlippCntr = 7
6561
6662 let idxFactGwxRewCntr = 10
6763
6864 let feeDefault = fraction(10, scale8, 10000)
6965
7066 func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
7167
7268
7369 func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
7470
7571
7672 func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7773
7874
7975 func abs (val) = if ((zeroBigInt > val))
8076 then -(val)
8177 else val
8278
8379
8480 func absBigInt (val) = if ((zeroBigInt > val))
8581 then -(val)
8682 else val
8783
8884
8985 func fc () = "%s__factoryContract"
9086
9187
9288 func mpk () = "%s__managerPublicKey"
9389
9490
9591 func pmpk () = "%s__pendingManagerPublicKey"
9692
9793
9894 func pl () = "%s%s__price__last"
9995
10096
10197 func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
10298
10399
104100 func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
105101
106102
107103 func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
108104
109105
110106 func aa () = "%s__amountAsset"
111107
112108
113109 func pa () = "%s__priceAsset"
114110
115111
116112 func amp () = "%s__amp"
117113
118114
119115 func ada () = "%s__addonAddr"
120116
121117
122118 let keyFee = "%s__fee"
123119
124120 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
125121
126-let keyDLp = makeString(["%s", "dLp"], SEP)
127-
128-let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP)
129-
130-let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP)
131-
132-let dLpRefreshDelayDefault = 1
133-
134-let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault)
135-
136122 func fcfg () = "%s__factoryConfig"
137123
138124
139125 func mtpk () = "%s%s__matcher__publicKey"
140126
141127
142128 func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
143129
144130
145131 func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
146132
147133
148134 func aps () = "%s__shutdown"
149135
150136
151137 func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash"
152138
153139
154140 func keyFeeCollectorAddress () = "%s__feeCollectorAddress"
155141
156142
157143 func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
158144
159145
160146 func str (val) = match val {
161147 case valStr: String =>
162148 valStr
163149 case _ =>
164150 throw("fail cast to String")
165151 }
166152
167153
168154 func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
169155
170156
171157 func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
172158
173159
174160 func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " "))
175161
176162
177-func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ")
178-
179-
180163 let fca = addressFromStringValue(strf(this, fc()))
181164
182165 let A = strf(this, amp())
183166
184167 func igs () = valueOrElse(getBoolean(fca, aps()), false)
185168
186169
187170 func mp () = fromBase58String(strf(fca, mtpk()))
188171
189172
190173 let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress()))
191174
192175 func gpc () = {
193176 let amtAs = strf(this, aa())
194177 let priceAs = strf(this, pa())
195178 let iPriceAs = intf(fca, mba(priceAs))
196179 let iAmtAs = intf(fca, mba(amtAs))
197180 split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
198181 }
199182
200183
201184 func parseAssetId (input) = if ((input == wavesString))
202185 then unit
203186 else fromBase58String(input)
204187
205188
206189 func assetIdToString (input) = if ((input == unit))
207190 then wavesString
208191 else toBase58String(value(input))
209192
210193
211194 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]))
212195
213196
214197 let poolConfigParsed = parsePoolConfig(gpc())
215198
216-let $t072557441 = poolConfigParsed
199+let $t068307016 = poolConfigParsed
217200
218-let cfgPoolAddress = $t072557441._1
201+let cfgPoolAddress = $t068307016._1
219202
220-let cfgPoolStatus = $t072557441._2
203+let cfgPoolStatus = $t068307016._2
221204
222-let cfgLpAssetId = $t072557441._3
205+let cfgLpAssetId = $t068307016._3
223206
224-let cfgAmountAssetId = $t072557441._4
207+let cfgAmountAssetId = $t068307016._4
225208
226-let cfgPriceAssetId = $t072557441._5
209+let cfgPriceAssetId = $t068307016._5
227210
228-let cfgAmountAssetDecimals = $t072557441._6
211+let cfgAmountAssetDecimals = $t068307016._6
229212
230-let cfgPriceAssetDecimals = $t072557441._7
213+let cfgPriceAssetDecimals = $t068307016._7
231214
232215 func gfc () = split(strf(fca, fcfg()), SEP)
233216
234217
235218 let factoryConfig = gfc()
236219
237220 let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address")
238221
239222 let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address")
240223
241224 let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address")
242225
243226 let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address")
244227
245228 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)
246229
247230
248231 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)
249232
250233
251234 func getAccBalance (assetId) = if ((assetId == "WAVES"))
252235 then wavesBalance(this).available
253236 else assetBalance(this, fromBase58String(assetId))
254237
255238
256239 func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
257240
258241
259242 func vad (A1,A2,slippage) = {
260243 let diff = fraction((A1 - A2), scale8BigInt, A2)
261244 let pass = ((slippage - abs(diff)) > zeroBigInt)
262245 if (!(pass))
263246 then throw(("Big slpg: " + toString(diff)))
264247 else $Tuple2(pass, min([A1, A2]))
265248 }
266249
267250
268251 func vd (D1,D0,slpg) = {
269252 let diff = fraction(D0, scale8BigInt, D1)
270253 let fail = (slpg > diff)
271254 if (if (fail)
272255 then true
273256 else (D0 > D1))
274257 then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
275258 else fail
276259 }
277260
278261
279262 func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
280263 let amtAsAmtX18 = t1(amAmt, amAssetDcm)
281264 let prAsAmtX18 = t1(prAmt, prAssetDcm)
282265 cpbi(prAsAmtX18, amtAsAmtX18)
283266 }
284267
285268
286269 func calcPrices (amAmt,prAmt,lpAmt) = {
287270 let cfg = gpc()
288271 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
289272 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
290273 let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
291274 let amAmtX18 = t1(amAmt, amtAsDcm)
292275 let prAmtX18 = t1(prAmt, prAsDcm)
293276 let lpAmtX18 = t1(lpAmt, scale8)
294277 let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
295278 let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
296279 [priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
297280 }
298281
299282
300283 func calculatePrices (amAmt,prAmt,lpAmt) = {
301284 let p = calcPrices(amAmt, prAmt, lpAmt)
302285 [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
303286 }
304287
305288
306289 func takeFee (amount) = {
307290 let feeAmount = fraction(amount, fee, scale8)
308291 $Tuple2((amount - feeAmount), feeAmount)
309292 }
310293
311294
312295 func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
313296 let cfg = gpc()
314297 let lpId = cfg[idxLPAsId]
315298 let amId = cfg[idxAmAsId]
316299 let prId = cfg[idxPrAsId]
317300 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
318301 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
319302 let sts = cfg[idxPoolSt]
320303 let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
321304 if ((lpId != pmtAssetId))
322305 then throw("Wrong pmt asset")
323306 else {
324307 let amBalance = getAccBalance(amId)
325308 let amBalanceX18 = t1(amBalance, amDcm)
326309 let prBalance = getAccBalance(prId)
327310 let prBalanceX18 = t1(prBalance, prDcm)
328311 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
329312 let curPrice = f1(curPriceX18, scale8)
330313 let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
331314 let lpEmissX18 = t1(lpEmiss, scale8)
332315 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
333316 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
334317 let outAmAmt = f1(outAmAmtX18, amDcm)
335318 let outPrAmt = f1(outPrAmtX18, prDcm)
336319 let state = if ((txId58 == ""))
337320 then nil
338321 else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
339322 then unit
340323 else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
341324 then unit
342325 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)]
343326 $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
344327 }
345328 }
346329
347330
348331 func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
349332 let cfg = gpc()
350333 let lpId = fromBase58String(cfg[idxLPAsId])
351334 let amIdStr = cfg[idxAmAsId]
352335 let prIdStr = cfg[idxPrAsId]
353336 let inAmIdStr = cfg[idxIAmtAsId]
354337 let inPrIdStr = cfg[idxIPriceAsId]
355338 let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
356339 let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
357340 let sts = cfg[idxPoolSt]
358341 let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
359342 let amBalance = if (isEval)
360343 then getAccBalance(amIdStr)
361344 else if (if (isOneAsset)
362345 then (pmtId == amIdStr)
363346 else false)
364347 then (getAccBalance(amIdStr) - pmtAmt)
365348 else if (isOneAsset)
366349 then getAccBalance(amIdStr)
367350 else (getAccBalance(amIdStr) - inAmAmt)
368351 let prBalance = if (isEval)
369352 then getAccBalance(prIdStr)
370353 else if (if (isOneAsset)
371354 then (pmtId == prIdStr)
372355 else false)
373356 then (getAccBalance(prIdStr) - pmtAmt)
374357 else if (isOneAsset)
375358 then getAccBalance(prIdStr)
376359 else (getAccBalance(prIdStr) - inPrAmt)
377360 let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
378361 let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
379362 let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
380363 let amBalanceX18 = t1(amBalance, amtDcm)
381364 let prBalanceX18 = t1(prBalance, priceDcm)
382365 let r = if ((lpEm == 0))
383366 then {
384367 let curPriceX18 = zeroBigInt
385368 let slippageX18 = zeroBigInt
386369 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
387370 $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
388371 }
389372 else {
390373 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
391374 let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
392375 let slippageX18 = t1(slippage, scale8)
393376 if (if (if (validateSlippage)
394377 then (curPriceX18 != zeroBigInt)
395378 else false)
396379 then (slippageRealX18 > slippageX18)
397380 else false)
398381 then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
399382 else {
400383 let lpEmissionX18 = t1(lpEm, scale8)
401384 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
402385 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
403386 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
404387 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
405388 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
406389 let expAmtAssetAmtX18 = expectedAmts._1
407390 let expPriceAssetAmtX18 = expectedAmts._2
408391 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
409392 $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
410393 }
411394 }
412395 let calcLpAmt = r._1
413396 let calcAmAssetPmt = r._2
414397 let calcPrAssetPmt = r._3
415398 let curPrice = f1(r._4, scale8)
416399 let slippageCalc = f1(r._5, scale8)
417400 if ((0 >= calcLpAmt))
418401 then throw("LP <= 0")
419402 else {
420403 let emitLpAmt = if (!(emitLp))
421404 then 0
422405 else calcLpAmt
423406 let amDiff = (inAmAmt - calcAmAssetPmt)
424407 let prDiff = (inPrAmt - calcPrAssetPmt)
425- let $t01787218217 = if (if (isOneAsset)
408+ let $t01744717792 = if (if (isOneAsset)
426409 then (pmtId == amIdStr)
427410 else false)
428411 then $Tuple2(pmtAmt, 0)
429412 else if (if (isOneAsset)
430413 then (pmtId == prIdStr)
431414 else false)
432415 then $Tuple2(0, pmtAmt)
433416 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
434- let writeAmAmt = $t01787218217._1
435- let writePrAmt = $t01787218217._2
417+ let writeAmAmt = $t01744717792._1
418+ let writePrAmt = $t01744717792._2
436419 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))]
437420 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
438421 }
439422 }
440423
441424
442-func getD (xp) = {
443- let xp0 = xp[0]
444- let xp1 = xp[1]
445- let s = (xp0 + xp1)
446- if ((s == big0))
447- then big0
448- else {
449- let a = parseIntValue(A)
450- let ann = (a * 2)
451- let p = fraction(xp0, xp1, big1)
452- let xp0_xp1_n_n = fraction(p, big4, big1)
453- let ann_s = fraction(toBigInt(ann), s, big1)
454- let ann_1 = toBigInt((ann - 1))
455- func calcDNext (d) = {
456- let dd = fraction(d, d, big1)
457- let ddd = fraction(dd, d, big1)
458- let dp = fraction(ddd, big1, xp0_xp1_n_n)
459- fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1)), CEILING)
460- }
461-
462- func calc (acc,i) = if (acc._2)
463- then acc
464- else {
465- let d = acc._1
466- let dNext = calcDNext(d)
467- let dDiffRaw = toInt((dNext - value(d)))
468- let dDiff = if ((0 > dDiffRaw))
469- then -(dDiffRaw)
470- else dDiffRaw
471- if ((1 >= dDiff))
472- then $Tuple2(dNext, true)
473- else $Tuple2(dNext, false)
474- }
475-
476- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
477- let $t02014520193 = {
478- let $l = arr
479- let $s = size($l)
480- let $acc0 = $Tuple2(s, false)
481- func $f0_1 ($a,$i) = if (($i >= $s))
482- then $a
483- else calc($a, $l[$i])
484-
485- func $f0_2 ($a,$i) = if (($i >= $s))
486- then $a
487- else throw("List size exceeds 15")
488-
489- $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)
490- }
491- let d = $t02014520193._1
492- let found = $t02014520193._2
493- if (found)
494- then d
495- else throw(("D calculation error, D = " + toString(d)))
496- }
497- }
498-
499-
500-func getDOld (xp) = {
501- let n = big2
502- let xp0 = xp[0]
503- let xp1 = xp[1]
504- let aPrecision = parseBigIntValue(Amult)
505- let a = (parseBigIntValue(A) * aPrecision)
506- let s = (xp0 + xp1)
507- if ((s == big0))
508- then big0
509- else {
510- let ann = (a * n)
511- let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
512- let ann_s_aPrecision = ((ann * s) / aPrecision)
513- let ann_aPrecision = (ann - aPrecision)
514- let n1 = (n + big1)
515- func calc (acc,cur) = {
516- let $t02082220842 = acc
517- let d = $t02082220842._1
518- let found = $t02082220842._2
519- if ((found != unit))
520- then acc
521- else {
522- let dp = (((d * d) * d) / xp0_xp1_n_n)
523- let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
524- let dDiff = absBigInt((dNext - value(d)))
525- if ((big1 >= dDiff))
526- then $Tuple2(dNext, cur)
527- else $Tuple2(dNext, unit)
528- }
529- }
530-
531- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
532- let $t02126321310 = {
533- let $l = arr
534- let $s = size($l)
535- let $acc0 = $Tuple2(s, unit)
536- func $f0_1 ($a,$i) = if (($i >= $s))
537- then $a
538- else calc($a, $l[$i])
539-
540- func $f0_2 ($a,$i) = if (($i >= $s))
541- then $a
542- else throw("List size exceeds 15")
543-
544- $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)
545- }
546- let d = $t02126321310._1
547- let found = $t02126321310._2
548- if ((found != unit))
549- then d
550- else throw(("D calculation error, D = " + toString(d)))
551- }
552- }
553-
554-
555-func getYD (xp,i,D) = {
556- let n = big2
557- let x = xp[if ((i == 0))
558- then 1
559- else 0]
560- let aPrecision = parseBigIntValue(Amult)
561- let a = (parseBigIntValue(A) * aPrecision)
562- let s = x
563- let ann = (a * n)
564- let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
565- let b = ((s + ((D * aPrecision) / ann)) - D)
566- func calc (acc,cur) = {
567- let $t02181021830 = acc
568- let y = $t02181021830._1
569- let found = $t02181021830._2
570- if ((found != unit))
571- then acc
572- else {
573- let yNext = (((y * y) + c) / ((big2 * y) + b))
574- let yDiff = absBigInt((yNext - value(y)))
575- if ((big1 >= yDiff))
576- then $Tuple2(yNext, cur)
577- else $Tuple2(yNext, unit)
578- }
579- }
580-
581- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
582- let $t02213722184 = {
583- let $l = arr
584- let $s = size($l)
585- let $acc0 = $Tuple2(D, unit)
586- func $f0_1 ($a,$i) = if (($i >= $s))
587- then $a
588- else calc($a, $l[$i])
589-
590- func $f0_2 ($a,$i) = if (($i >= $s))
591- then $a
592- else throw("List size exceeds 15")
593-
594- $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)
595- }
596- let y = $t02213722184._1
597- let found = $t02213722184._2
598- if ((found != unit))
599- then y
600- else throw(("Y calculation error, Y = " + toString(y)))
601- }
602-
603-
604-func calcDLp (amountBalance,priceBalance,lpEmission) = {
605- let updatedDLp = fraction(getD([amountBalance, priceBalance]), scale18, lpEmission)
606- if ((lpEmission == big0))
607- then big0
608- else updatedDLp
609- }
610-
611-
612-func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
613- let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
614- let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
615- let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
616- let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
617- currentDLp
618- }
619-
620-
621-func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
622- let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
623- let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
624- let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
625- let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
626- let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))]
627- $Tuple2(actions, updatedDLp)
628- }
629-
630-
631-func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp))
632- then true
633- else throwErr("updated DLp lower than current DLp")
634-
635-
636-func validateMatcherOrderAllowed (order) = {
637- let amountAssetAmount = order.amount
638- let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
639- let $t02412324335 = if ((order.orderType == Buy))
640- then $Tuple2(amountAssetAmount, -(priceAssetAmount))
641- else $Tuple2(-(amountAssetAmount), priceAssetAmount)
642- let amountAssetBalanceDelta = $t02412324335._1
643- let priceAssetBalanceDelta = $t02412324335._2
425+func moa (order) = {
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)
644438 if (if (if (igs())
645439 then true
646- else (cfgPoolStatus == PoolMatcherDis))
440+ else (sts == PoolMatcherDis))
647441 then true
648- else (cfgPoolStatus == PoolShutdown))
442+ else (sts == PoolShutdown))
649443 then throw("Admin blocked")
650- else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
651- then true
652- else (order.assetPair.priceAsset != cfgPriceAssetId))
653- then throw("Wr assets")
654- else {
655- let dLp = parseBigIntValue(getStringValue(this, keyDLp))
656- let $t02466524765 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
657- let unusedActions = $t02466524765._1
658- let dLpNew = $t02466524765._2
659- let isOrderValid = (dLpNew >= dLp)
660- isOrderValid
661- }
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+ }
662467 }
663468
664469
665470 func cg (i) = if ((size(i.payments) != 1))
666471 then throw("1 pmnt exp")
667472 else {
668473 let pmt = value(i.payments[0])
669474 let pmtAssetId = value(pmt.assetId)
670475 let pmtAmt = pmt.amount
671476 let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
672477 let outAmAmt = r._1
673478 let outPrAmt = r._2
674479 let sts = parseIntValue(r._9)
675480 let state = r._10
676481 if (if (igs())
677482 then true
678483 else (sts == PoolShutdown))
679484 then throw(("Admin blocked: " + toString(sts)))
680485 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
681486 }
682487
683488
684489 func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
685490 let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId)
686491 let sts = parseIntValue(r._8)
687492 if (if (if (igs())
688493 then true
689494 else (sts == PoolPutDis))
690495 then true
691496 else (sts == PoolShutdown))
692497 then throw(("Blocked:" + toString(sts)))
693498 else r
694499 }
695500
696501
502+func getD (xp) = {
503+ let n = big2
504+ let xp0 = xp[0]
505+ let xp1 = xp[1]
506+ let aPrecision = parseBigIntValue(Amult)
507+ let a = (parseBigIntValue(A) * aPrecision)
508+ let s = (xp0 + xp1)
509+ if ((s == big0))
510+ then big0
511+ else {
512+ let ann = (a * n)
513+ let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
514+ let ann_s_aPrecision = ((ann * s) / aPrecision)
515+ let ann_aPrecision = (ann - aPrecision)
516+ let n1 = (n + big1)
517+ func calc (acc,cur) = {
518+ let $t02234422364 = acc
519+ let d = $t02234422364._1
520+ let found = $t02234422364._2
521+ if ((found != unit))
522+ then acc
523+ else {
524+ let dp = (((d * d) * d) / xp0_xp1_n_n)
525+ let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
526+ let dDiff = absBigInt((dNext - value(d)))
527+ if ((big1 >= dDiff))
528+ then $Tuple2(dNext, cur)
529+ else $Tuple2(dNext, unit)
530+ }
531+ }
532+
533+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
534+ let $t02278522832 = {
535+ let $l = arr
536+ let $s = size($l)
537+ let $acc0 = $Tuple2(s, unit)
538+ func $f0_1 ($a,$i) = if (($i >= $s))
539+ then $a
540+ else calc($a, $l[$i])
541+
542+ func $f0_2 ($a,$i) = if (($i >= $s))
543+ then $a
544+ else throw("List size exceeds 15")
545+
546+ $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)
547+ }
548+ let d = $t02278522832._1
549+ let found = $t02278522832._2
550+ if ((found != unit))
551+ then d
552+ else throw(("D calculation error, D = " + toString(d)))
553+ }
554+ }
555+
556+
557+func getYD (xp,i,D) = {
558+ let n = big2
559+ let x = xp[if ((i == 0))
560+ then 1
561+ else 0]
562+ let aPrecision = parseBigIntValue(Amult)
563+ let a = (parseBigIntValue(A) * aPrecision)
564+ let s = x
565+ let ann = (a * n)
566+ let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
567+ let b = ((s + ((D * aPrecision) / ann)) - D)
568+ func calc (acc,cur) = {
569+ let $t02333223352 = acc
570+ let y = $t02333223352._1
571+ let found = $t02333223352._2
572+ if ((found != unit))
573+ then acc
574+ else {
575+ let yNext = (((y * y) + c) / ((big2 * y) + b))
576+ let yDiff = absBigInt((yNext - value(y)))
577+ if ((big1 >= yDiff))
578+ then $Tuple2(yNext, cur)
579+ else $Tuple2(yNext, unit)
580+ }
581+ }
582+
583+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
584+ let $t02365923706 = {
585+ let $l = arr
586+ let $s = size($l)
587+ let $acc0 = $Tuple2(D, unit)
588+ func $f0_1 ($a,$i) = if (($i >= $s))
589+ then $a
590+ else calc($a, $l[$i])
591+
592+ func $f0_2 ($a,$i) = if (($i >= $s))
593+ then $a
594+ else throw("List size exceeds 15")
595+
596+ $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)
597+ }
598+ let y = $t02365923706._1
599+ let found = $t02365923706._2
600+ if ((found != unit))
601+ then y
602+ else throw(("Y calculation error, Y = " + toString(y)))
603+ }
604+
605+
697606 func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = {
698607 let poolConfig = gpc()
699608 let amId = poolConfig[idxAmAsId]
700609 let prId = poolConfig[idxPrAsId]
701610 let lpId = poolConfig[idxLPAsId]
702611 let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm])
703612 let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm])
704613 let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
705614 let chechEmission = if ((lpAssetEmission > big0))
706615 then true
707616 else throw("initial deposit requires all coins")
708617 if ((chechEmission == chechEmission))
709618 then {
710619 let amBalance = getAccBalance(amId)
711620 let prBalance = getAccBalance(prId)
712- let $t02708227544 = if ((txId == ""))
621+ let $t02448924951 = if ((txId == ""))
713622 then $Tuple2(amBalance, prBalance)
714623 else if ((pmtAssetId == amId))
715624 then if ((pmtAmtRaw > amBalance))
716625 then throw("invalid payment amount")
717626 else $Tuple2((amBalance - pmtAmtRaw), prBalance)
718627 else if ((pmtAssetId == prId))
719628 then if ((pmtAmtRaw > prBalance))
720629 then throw("invalid payment amount")
721630 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
722631 else throw("wrong pmtAssetId")
723- let amBalanceOld = $t02708227544._1
724- let prBalanceOld = $t02708227544._2
725- let $t02755027726 = if ((pmtAssetId == amId))
632+ let amBalanceOld = $t02448924951._1
633+ let prBalanceOld = $t02448924951._2
634+ let $t02495725133 = if ((pmtAssetId == amId))
726635 then $Tuple2(pmtAmtRaw, 0)
727636 else if ((pmtAssetId == prId))
728637 then $Tuple2(0, pmtAmtRaw)
729638 else throw("invalid payment")
730- let amAmountRaw = $t02755027726._1
731- let prAmountRaw = $t02755027726._2
732- let $t02773027969 = if (withTakeFee)
639+ let amAmountRaw = $t02495725133._1
640+ let prAmountRaw = $t02495725133._2
641+ let $t02513725376 = if (withTakeFee)
733642 then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
734643 else $Tuple3(amAmountRaw, prAmountRaw, 0)
735- let amAmount = $t02773027969._1
736- let prAmount = $t02773027969._2
737- let feeAmount = $t02773027969._3
644+ let amAmount = $t02513725376._1
645+ let prAmount = $t02513725376._2
646+ let feeAmount = $t02513725376._3
738647 let amBalanceNew = (amBalanceOld + amAmount)
739648 let prBalanceNew = (prBalanceOld + prAmount)
740649 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
741650 let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
742651 let checkD = if ((D1 > D0))
743652 then true
744653 else throw()
745654 if ((checkD == checkD))
746655 then {
747- let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR)
656+ let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0)
748657 let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8)
749658 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))]
750659 let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
751660 let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8))
752661 let priceAssetPart = (pmtAmtRaw - amountAssetPart)
753662 let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
754663 let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth))
755664 $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus)
756665 }
757666 else throw("Strict value is not equal to itself.")
758667 }
759668 else throw("Strict value is not equal to itself.")
760669 }
761670
762671
763672 func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = {
764673 let poolConfig = gpc()
765674 let lpId = poolConfig[idxLPAsId]
766675 let amId = poolConfig[idxAmAsId]
767676 let prId = poolConfig[idxPrAsId]
768677 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
769678 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
770679 let poolStatus = poolConfig[idxPoolSt]
771680 let userAddress = if ((caller == restContract))
772681 then originCaller
773682 else caller
774683 let pmt = value(payments[0])
775684 let pmtAssetId = value(pmt.assetId)
776685 let pmtAmt = pmt.amount
777- let currentDLp = calcCurrentDLp(big0, big0, big0)
778- if ((currentDLp == currentDLp))
779- then {
780- let txId58 = toBase58String(transactionId)
781- if ((lpId != toBase58String(pmtAssetId)))
782- then throw("Wrong LP")
783- else {
784- let amBalance = getAccBalance(amId)
785- let prBalance = getAccBalance(prId)
786- let $t03003430145 = {
787- let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
788- if ($isInstanceOf(@, "(Int, Int)"))
789- then @
790- else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
791- }
792- if (($t03003430145 == $t03003430145))
686+ let txId58 = toBase58String(transactionId)
687+ if ((lpId != toBase58String(pmtAssetId)))
688+ then throw("Wrong LP")
689+ else {
690+ let amBalance = getAccBalance(amId)
691+ let prBalance = getAccBalance(prId)
692+ let $t02737827489 = {
693+ let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
694+ if ($isInstanceOf(@, "(Int, Int)"))
695+ then @
696+ else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
697+ }
698+ if (($t02737827489 == $t02737827489))
699+ then {
700+ let feeAmount = $t02737827489._2
701+ let totalGet = $t02737827489._1
702+ let totalAmount = if (if ((minOutAmount > 0))
703+ then (minOutAmount > totalGet)
704+ else false)
705+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
706+ else totalGet
707+ let $t02767927986 = if ((outAssetId == amId))
708+ then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
709+ else if ((outAssetId == prId))
710+ then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
711+ else throw("invalid out asset id")
712+ let outAm = $t02767927986._1
713+ let outPr = $t02767927986._2
714+ let amBalanceNew = $t02767927986._3
715+ let prBalanceNew = $t02767927986._4
716+ let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
717+ let curPr = f1(curPrX18, scale8)
718+ let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
719+ then unit
720+ else fromBase58String(outAssetId)
721+ let sendFeeToMatcher = if ((feeAmount > 0))
722+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
723+ else nil
724+ 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)
725+ if ((state == state))
793726 then {
794- let feeAmount = $t03003430145._2
795- let totalGet = $t03003430145._1
796- let totalAmount = if (if ((minOutAmount > 0))
797- then (minOutAmount > totalGet)
798- else false)
799- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
800- else totalGet
801- let $t03033530642 = if ((outAssetId == amId))
802- then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
803- else if ((outAssetId == prId))
804- then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
805- else throw("invalid out asset id")
806- let outAm = $t03033530642._1
807- let outPr = $t03033530642._2
808- let amBalanceNew = $t03033530642._3
809- let prBalanceNew = $t03033530642._4
810- let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
811- let curPr = f1(curPrX18, scale8)
812- let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
813- then unit
814- else fromBase58String(outAssetId)
815- let sendFeeToMatcher = if ((feeAmount > 0))
816- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
817- else nil
818- 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)
819- if ((state == state))
820- then {
821- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
822- if ((burn == burn))
823- then {
824- let $t03142731777 = {
825- let feeAmountForCalc = if ((this == feeCollectorAddress))
826- then 0
827- else feeAmount
828- let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId))
829- then true
830- else false
831- if (outInAmountAsset)
832- then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
833- else $Tuple2(0, -((totalGet + feeAmountForCalc)))
834- }
835- let amountAssetBalanceDelta = $t03142731777._1
836- let priceAssetBalanceDelta = $t03142731777._2
837- let $t03178031888 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
838- let refreshDLpActions = $t03178031888._1
839- let updatedDLp = $t03178031888._2
840- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
841- if ((isUpdatedDLpValid == isUpdatedDLpValid))
842- then $Tuple2((state ++ refreshDLpActions), totalAmount)
843- else throw("Strict value is not equal to itself.")
844- }
845- else throw("Strict value is not equal to itself.")
846- }
727+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
728+ if ((burn == burn))
729+ then $Tuple2(state, totalAmount)
847730 else throw("Strict value is not equal to itself.")
848731 }
849732 else throw("Strict value is not equal to itself.")
850733 }
734+ else throw("Strict value is not equal to itself.")
851735 }
852- else throw("Strict value is not equal to itself.")
853736 }
854737
855738
856739 func m () = match getString(mpk()) {
857740 case s: String =>
858741 fromBase58String(s)
859742 case _: Unit =>
860743 unit
861744 case _ =>
862745 throw("Match error")
863746 }
864747
865748
866749 func pm () = match getString(pmpk()) {
867750 case s: String =>
868751 fromBase58String(s)
869752 case _: Unit =>
870753 unit
871754 case _ =>
872755 throw("Match error")
873756 }
874757
875758
876759 let pd = throw("Permission denied")
877760
878761 func isManager (i) = match m() {
879762 case pk: ByteVector =>
880763 (i.callerPublicKey == pk)
881764 case _: Unit =>
882765 (i.caller == this)
883766 case _ =>
884767 throw("Match error")
885768 }
886769
887770
888771 func mm (i) = match m() {
889772 case pk: ByteVector =>
890773 if ((i.callerPublicKey == pk))
891774 then true
892775 else pd
893776 case _: Unit =>
894777 if ((i.caller == this))
895778 then true
896779 else pd
897780 case _ =>
898781 throw("Match error")
899782 }
900783
901784
902785 @Callable(i)
903786 func constructor (fc) = {
904787 let c = mm(i)
905788 if ((c == c))
906789 then [StringEntry(fc(), fc)]
907790 else throw("Strict value is not equal to itself.")
908791 }
909792
910793
911794
912795 @Callable(i)
913796 func setManager (pendingManagerPublicKey) = {
914797 let c = mm(i)
915798 if ((c == c))
916799 then {
917800 let cm = fromBase58String(pendingManagerPublicKey)
918801 if ((cm == cm))
919802 then [StringEntry(pmpk(), pendingManagerPublicKey)]
920803 else throw("Strict value is not equal to itself.")
921804 }
922805 else throw("Strict value is not equal to itself.")
923806 }
924807
925808
926809
927810 @Callable(i)
928811 func confirmManager () = {
929812 let p = pm()
930813 let hpm = if (isDefined(p))
931814 then true
932815 else throw("No pending manager")
933816 if ((hpm == hpm))
934817 then {
935818 let cpm = if ((i.callerPublicKey == value(p)))
936819 then true
937820 else throw("You are not pending manager")
938821 if ((cpm == cpm))
939822 then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
940823 else throw("Strict value is not equal to itself.")
941824 }
942825 else throw("Strict value is not equal to itself.")
943826 }
944827
945828
946829
947830 @Callable(i)
948831 func put (slip,autoStake) = {
949832 let factCfg = gfc()
950833 let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
951834 let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
952835 if ((0 > slip))
953836 then throw("Wrong slippage")
954837 else if ((size(i.payments) != 2))
955838 then throw("2 pmnts expd")
956839 else {
957- let amAssetPmt = toBigInt(value(i.payments[0]).amount)
958- let prAssetPmt = toBigInt(value(i.payments[1]).amount)
959- let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
960- if ((currentDLp == currentDLp))
840+ 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, "")
841+ let emitLpAmt = e._2
842+ let lpAssetId = e._7
843+ let state = e._9
844+ let amDiff = e._10
845+ let prDiff = e._11
846+ let amId = e._12
847+ let prId = e._13
848+ let r = invoke(fca, "emit", [emitLpAmt], nil)
849+ if ((r == r))
961850 then {
962- 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, "")
963- let emitLpAmt = e._2
964- let lpAssetId = e._7
965- let state = e._9
966- let amDiff = e._10
967- let prDiff = e._11
968- let amId = e._12
969- let prId = e._13
970- let r = invoke(fca, "emit", [emitLpAmt], nil)
971- if ((r == r))
851+ let el = match r {
852+ case legacy: Address =>
853+ invoke(legacy, "emit", [emitLpAmt], nil)
854+ case _ =>
855+ unit
856+ }
857+ if ((el == el))
972858 then {
973- let el = match r {
974- case legacy: Address =>
975- invoke(legacy, "emit", [emitLpAmt], nil)
976- case _ =>
977- unit
978- }
979- if ((el == el))
859+ let sa = if ((amDiff > 0))
860+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
861+ else nil
862+ if ((sa == sa))
980863 then {
981- let sa = if ((amDiff > 0))
982- then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
864+ let sp = if ((prDiff > 0))
865+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
983866 else nil
984- if ((sa == sa))
867+ if ((sp == sp))
985868 then {
986- let sp = if ((prDiff > 0))
987- then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
988- else nil
989- if ((sp == sp))
869+ let lpTrnsfr = if (autoStake)
990870 then {
991- let lpTrnsfr = if (autoStake)
992- then {
993- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
994- if ((ss == ss))
995- then nil
996- else throw("Strict value is not equal to itself.")
997- }
998- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
999- let $t03574435809 = refreshDLpInternal(0, 0, 0)
1000- let refreshDLpActions = $t03574435809._1
1001- let updatedDLp = $t03574435809._2
1002- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1003- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1004- then ((state ++ lpTrnsfr) ++ refreshDLpActions)
871+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
872+ if ((ss == ss))
873+ then nil
1005874 else throw("Strict value is not equal to itself.")
1006875 }
1007- else throw("Strict value is not equal to itself.")
876+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
877+ (state ++ lpTrnsfr)
1008878 }
1009879 else throw("Strict value is not equal to itself.")
1010880 }
1011881 else throw("Strict value is not equal to itself.")
1012882 }
1013883 else throw("Strict value is not equal to itself.")
1014884 }
1015885 else throw("Strict value is not equal to itself.")
1016886 }
1017887 }
1018888
1019889
1020890
1021891 @Callable(i)
1022892 func putOneTknV2 (minOutAmount,autoStake) = {
1023893 let isPoolOneTokenOperationsDisabled = {
1024894 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
1025895 if ($isInstanceOf(@, "Boolean"))
1026896 then @
1027897 else throw(($getType(@) + " couldn't be cast to Boolean"))
1028898 }
1029899 let isPutDisabled = if (if (if (igs())
1030900 then true
1031901 else (cfgPoolStatus == PoolPutDis))
1032902 then true
1033903 else (cfgPoolStatus == PoolShutdown))
1034904 then true
1035905 else isPoolOneTokenOperationsDisabled
1036906 let checks = [if (if (!(isPutDisabled))
1037907 then true
1038908 else isManager(i))
1039909 then true
1040910 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
1041911 then true
1042912 else throwErr("exactly 1 payment are expected")]
1043913 if ((checks == checks))
1044914 then {
1045915 let poolConfig = gpc()
1046916 let amId = poolConfig[idxAmAsId]
1047917 let prId = poolConfig[idxPrAsId]
1048918 let lpId = fromBase58String(poolConfig[idxLPAsId])
1049919 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
1050920 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
1051921 let userAddress = if ((i.caller == this))
1052922 then i.originCaller
1053923 else i.caller
1054924 let pmt = value(i.payments[0])
1055925 let pmtAssetId = toBase58String(value(pmt.assetId))
1056926 let pmtAmt = pmt.amount
1057- let $t03694637104 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
1058- if (($t03694637104 == $t03694637104))
927+ let $t03334833506 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
928+ if (($t03334833506 == $t03334833506))
1059929 then {
1060- let feeAmount = $t03694637104._3
1061- let state = $t03694637104._2
1062- let estimLP = $t03694637104._1
930+ let feeAmount = $t03334833506._3
931+ let state = $t03334833506._2
932+ let estimLP = $t03334833506._1
1063933 let emitLpAmt = if (if ((minOutAmount > 0))
1064934 then (minOutAmount > estimLP)
1065935 else false)
1066936 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
1067937 else estimLP
1068938 let e = invoke(fca, "emit", [emitLpAmt], nil)
1069939 if ((e == e))
1070940 then {
1071941 let el = match e {
1072942 case legacy: Address =>
1073943 invoke(legacy, "emit", [emitLpAmt], nil)
1074944 case _ =>
1075945 unit
1076946 }
1077947 if ((el == el))
1078948 then {
1079949 let lpTrnsfr = if (autoStake)
1080950 then {
1081951 let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
1082952 if ((ss == ss))
1083953 then nil
1084954 else throw("Strict value is not equal to itself.")
1085955 }
1086956 else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
1087957 let sendFeeToMatcher = if ((feeAmount > 0))
1088958 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
1089959 else nil
1090- let $t03791938268 = if ((this == feeCollectorAddress))
1091- then $Tuple2(0, 0)
1092- else {
1093- let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
1094- then true
1095- else false
1096- if (paymentInAmountAsset)
1097- then $Tuple2(-(feeAmount), 0)
1098- else $Tuple2(0, -(feeAmount))
1099- }
1100- let amountAssetBalanceDelta = $t03791938268._1
1101- let priceAssetBalanceDelta = $t03791938268._2
1102- let $t03827138379 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1103- let refreshDLpActions = $t03827138379._1
1104- let updatedDLp = $t03827138379._2
1105- $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
960+ $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
1106961 }
1107962 else throw("Strict value is not equal to itself.")
1108963 }
1109964 else throw("Strict value is not equal to itself.")
1110965 }
1111966 else throw("Strict value is not equal to itself.")
1112967 }
1113968 else throw("Strict value is not equal to itself.")
1114969 }
1115970
1116971
1117972
1118973 @Callable(i)
1119974 func putForFree (maxSlpg) = if ((0 > maxSlpg))
1120975 then throw("Wrong slpg")
1121976 else if ((size(i.payments) != 2))
1122977 then throw("2 pmnts expd")
1123978 else {
1124979 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, "")
1125- let state = estPut._9
1126- let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1127- let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1128- let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
1129- if ((currentDLp == currentDLp))
1130- then {
1131- let $t03933839403 = refreshDLpInternal(0, 0, 0)
1132- let refreshDLpActions = $t03933839403._1
1133- let updatedDLp = $t03933839403._2
1134- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1135- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1136- then (state ++ refreshDLpActions)
1137- else throw("Strict value is not equal to itself.")
1138- }
1139- else throw("Strict value is not equal to itself.")
980+ estPut._9
1140981 }
1141982
1142983
1143984
1144985 @Callable(i)
1145986 func get () = {
1146987 let r = cg(i)
1147988 let outAmtAmt = r._1
1148989 let outPrAmt = r._2
1149990 let pmtAmt = r._3
1150991 let pmtAssetId = r._4
1151992 let state = r._5
1152993 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1153994 if ((b == b))
1154- then {
1155- let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
1156- let $t04019240274 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1157- let refreshDLpActions = $t04019240274._1
1158- let updatedDLp = $t04019240274._2
1159- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1160- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1161- then (state ++ refreshDLpActions)
1162- else throw("Strict value is not equal to itself.")
1163- }
995+ then state
1164996 else throw("Strict value is not equal to itself.")
1165997 }
1166998
1167999
11681000
11691001 @Callable(i)
11701002 func getOneTknV2 (outAssetId,minOutAmount) = {
11711003 let isPoolOneTokenOperationsDisabled = {
11721004 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11731005 if ($isInstanceOf(@, "Boolean"))
11741006 then @
11751007 else throw(($getType(@) + " couldn't be cast to Boolean"))
11761008 }
11771009 let isGetDisabled = if (if (igs())
11781010 then true
11791011 else (cfgPoolStatus == PoolShutdown))
11801012 then true
11811013 else isPoolOneTokenOperationsDisabled
11821014 let checks = [if (if (!(isGetDisabled))
11831015 then true
11841016 else isManager(i))
11851017 then true
11861018 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
11871019 then true
11881020 else throwErr("exactly 1 payment are expected")]
11891021 if ((checks == checks))
11901022 then {
1191- let $t04089241047 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1192- let state = $t04089241047._1
1193- let totalAmount = $t04089241047._2
1023+ let $t03612836283 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1024+ let state = $t03612836283._1
1025+ let totalAmount = $t03612836283._2
11941026 $Tuple2(state, totalAmount)
1195- }
1196- else throw("Strict value is not equal to itself.")
1197- }
1198-
1199-
1200-
1201-@Callable(i)
1202-func refreshDLp () = {
1203- let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
1204- let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
1205- then unit
1206- else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1207- if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1208- then {
1209- let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1210- let $t04157141635 = refreshDLpInternal(0, 0, 0)
1211- let dLpUpdateActions = $t04157141635._1
1212- let updatedDLp = $t04157141635._2
1213- let actions = if ((dLp != updatedDLp))
1214- then dLpUpdateActions
1215- else throwErr("nothing to refresh")
1216- $Tuple2(actions, toString(updatedDLp))
12171027 }
12181028 else throw("Strict value is not equal to itself.")
12191029 }
12201030
12211031
12221032
12231033 @Callable(i)
12241034 func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
12251035 let poolConfig = gpc()
12261036 let amId = poolConfig[idxAmAsId]
12271037 let prId = poolConfig[idxPrAsId]
12281038 let lpId = poolConfig[idxLPAsId]
12291039 let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))]
12301040 let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
12311041 let D0 = getD(xp)
12321042 let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission))
12331043 let index = if ((outAssetId == amId))
12341044 then 0
12351045 else if ((outAssetId == prId))
12361046 then 1
12371047 else throw("invalid out asset id")
12381048 let newY = getYD(xp, index, D1)
12391049 let dy = (xp[index] - newY)
12401050 let totalGetRaw = max([0, toInt((dy - big1))])
1241- let $t04253542584 = takeFee(totalGetRaw)
1242- let totalGet = $t04253542584._1
1243- let feeAmount = $t04253542584._2
1051+ let $t03707337122 = takeFee(totalGetRaw)
1052+ let totalGet = $t03707337122._1
1053+ let feeAmount = $t03707337122._2
12441054 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
12451055 }
12461056
12471057
12481058
12491059 @Callable(i)
12501060 func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = {
12511061 let poolConfig = gpc()
12521062 let amId = poolConfig[idxAmAsId]
12531063 let prId = poolConfig[idxPrAsId]
12541064 let lpId = poolConfig[idxLPAsId]
12551065 let amBalance = getAccBalance(amId)
12561066 let prBalance = getAccBalance(prId)
1257- let $t04292943044 = {
1067+ let $t03746737582 = {
12581068 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
12591069 if ($isInstanceOf(@, "(Int, Int)"))
12601070 then @
12611071 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
12621072 }
1263- let totalGet = $t04292943044._1
1264- let feeAmount = $t04292943044._2
1073+ let totalGet = $t03746737582._1
1074+ let feeAmount = $t03746737582._2
12651075 let r = ego("", lpId, lpAssetAmount, this)
12661076 let outAmAmt = r._1
12671077 let outPrAmt = r._2
12681078 let sumOfGetAssets = (outAmAmt + outPrAmt)
12691079 let bonus = if ((sumOfGetAssets == 0))
12701080 then if ((totalGet == 0))
12711081 then 0
12721082 else throw("bonus calculation error")
12731083 else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets)
12741084 $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus))
12751085 }
12761086
12771087
12781088
12791089 @Callable(i)
12801090 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
12811091 let r = cg(i)
12821092 let outAmAmt = r._1
12831093 let outPrAmt = r._2
12841094 let pmtAmt = r._3
12851095 let pmtAssetId = r._4
12861096 let state = r._5
12871097 if ((noLessThenAmtAsset > outAmAmt))
12881098 then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
12891099 else if ((noLessThenPriceAsset > outPrAmt))
12901100 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
12911101 else {
1292- let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
12931102 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12941103 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1295- then {
1296- let $t04421244293 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1297- let refreshDLpActions = $t04421244293._1
1298- let updatedDLp = $t04421244293._2
1299- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1300- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1301- then (state ++ refreshDLpActions)
1302- else throw("Strict value is not equal to itself.")
1303- }
1104+ then state
13041105 else throw("Strict value is not equal to itself.")
13051106 }
13061107 }
13071108
13081109
13091110
13101111 @Callable(i)
13111112 func unstakeAndGet (amount) = {
13121113 let checkPayments = if ((size(i.payments) != 0))
13131114 then throw("No pmnts expd")
13141115 else true
13151116 if ((checkPayments == checkPayments))
13161117 then {
13171118 let cfg = gpc()
13181119 let factoryCfg = gfc()
13191120 let lpAssetId = fromBase58String(cfg[idxLPAsId])
13201121 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1321- let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
13221122 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
13231123 if ((unstakeInv == unstakeInv))
13241124 then {
13251125 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1326- let outAmAmt = r._1
1327- let outPrAmt = r._2
13281126 let sts = parseIntValue(r._9)
13291127 let state = r._10
13301128 let v = if (if (igs())
13311129 then true
13321130 else (sts == PoolShutdown))
13331131 then throw(("Blocked: " + toString(sts)))
13341132 else true
13351133 if ((v == v))
13361134 then {
13371135 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
13381136 if ((burnA == burnA))
1339- then {
1340- let $t04535645437 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1341- let refreshDLpActions = $t04535645437._1
1342- let updatedDLp = $t04535645437._2
1343- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1344- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1345- then (state ++ refreshDLpActions)
1346- else throw("Strict value is not equal to itself.")
1347- }
1137+ then state
13481138 else throw("Strict value is not equal to itself.")
13491139 }
13501140 else throw("Strict value is not equal to itself.")
13511141 }
13521142 else throw("Strict value is not equal to itself.")
13531143 }
13541144 else throw("Strict value is not equal to itself.")
13551145 }
13561146
13571147
13581148
13591149 @Callable(i)
13601150 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
13611151 let isGetDisabled = if (igs())
13621152 then true
13631153 else (cfgPoolStatus == PoolShutdown)
13641154 let checks = [if (!(isGetDisabled))
13651155 then true
13661156 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
13671157 then true
13681158 else throw("no payments are expected")]
13691159 if ((checks == checks))
13701160 then {
1371- let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
13721161 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13731162 if ((unstakeInv == unstakeInv))
13741163 then {
13751164 let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
13761165 let outAmAmt = res._1
13771166 let outPrAmt = res._2
13781167 let state = res._10
13791168 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
13801169 then true
13811170 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
13821171 then true
13831172 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
13841173 if ((checkAmounts == checkAmounts))
13851174 then {
13861175 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13871176 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1388- then {
1389- let $t04668546766 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1390- let refreshDLpActions = $t04668546766._1
1391- let updatedDLp = $t04668546766._2
1392- let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1393- if ((isUpdatedDLpValid == isUpdatedDLpValid))
1394- then (state ++ refreshDLpActions)
1395- else throw("Strict value is not equal to itself.")
1396- }
1177+ then state
13971178 else throw("Strict value is not equal to itself.")
13981179 }
13991180 else throw("Strict value is not equal to itself.")
14001181 }
14011182 else throw("Strict value is not equal to itself.")
14021183 }
14031184 else throw("Strict value is not equal to itself.")
14041185 }
14051186
14061187
14071188
14081189 @Callable(i)
14091190 func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = {
14101191 let isPoolOneTokenOperationsDisabled = {
14111192 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
14121193 if ($isInstanceOf(@, "Boolean"))
14131194 then @
14141195 else throw(($getType(@) + " couldn't be cast to Boolean"))
14151196 }
14161197 let isGetDisabled = if (if (igs())
14171198 then true
14181199 else (cfgPoolStatus == PoolShutdown))
14191200 then true
14201201 else isPoolOneTokenOperationsDisabled
14211202 let checks = [if (if (!(isGetDisabled))
14221203 then true
14231204 else isManager(i))
14241205 then true
14251206 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
14261207 then true
14271208 else throwErr("no payments are expected")]
14281209 if ((checks == checks))
14291210 then {
14301211 let cfg = gpc()
14311212 let factoryCfg = gfc()
14321213 let lpAssetId = fromBase58String(cfg[idxLPAsId])
14331214 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
14341215 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
14351216 if ((unstakeInv == unstakeInv))
14361217 then {
1437- let $t04770047888 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1438- let state = $t04770047888._1
1439- let totalAmount = $t04770047888._2
1218+ let $t04142041608 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1219+ let state = $t04142041608._1
1220+ let totalAmount = $t04142041608._2
14401221 $Tuple2(state, totalAmount)
14411222 }
14421223 else throw("Strict value is not equal to itself.")
14431224 }
14441225 else throw("Strict value is not equal to itself.")
14451226 }
14461227
14471228
14481229
14491230 @Callable(i)
14501231 func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = {
14511232 let poolConfig = gpc()
14521233 let amId = poolConfig[idxAmAsId]
14531234 let prId = poolConfig[idxPrAsId]
14541235 let lpId = poolConfig[idxLPAsId]
1455- let $t04814748250 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1456- let lpAmount = $t04814748250._1
1457- let state = $t04814748250._2
1458- let feeAmount = $t04814748250._3
1459- let bonus = $t04814748250._4
1236+ let $t04186741970 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1237+ let lpAmount = $t04186741970._1
1238+ let state = $t04186741970._2
1239+ let feeAmount = $t04186741970._3
1240+ let bonus = $t04186741970._4
14601241 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
14611242 }
14621243
14631244
14641245
14651246 @Callable(i)
14661247 func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = {
14671248 let poolConfig = gpc()
14681249 let amId = poolConfig[idxAmAsId]
14691250 let prId = poolConfig[idxPrAsId]
14701251 let lpId = poolConfig[idxLPAsId]
1471- let $t04852948633 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1472- let lpAmount = $t04852948633._1
1473- let state = $t04852948633._2
1474- let feeAmount = $t04852948633._3
1475- let bonus = $t04852948633._4
1252+ let $t04224942353 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1253+ let lpAmount = $t04224942353._1
1254+ let state = $t04224942353._2
1255+ let feeAmount = $t04224942353._3
1256+ let bonus = $t04224942353._4
14761257 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
14771258 }
14781259
14791260
14801261
14811262 @Callable(i)
14821263 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
14831264 then throw("denied")
14841265 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
14851266
14861267
14871268
14881269 @Callable(i)
14891270 func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
14901271 then pd
14911272 else [StringEntry(k, v)]
14921273
14931274
14941275
14951276 @Callable(i)
14961277 func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
14971278 then pd
14981279 else [IntegerEntry(k, v)]
14991280
15001281
15011282
15021283 @Callable(i)
15031284 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
15041285
15051286
15061287
15071288 @Callable(i)
15081289 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
15091290
15101291
15111292
15121293 @Callable(i)
15131294 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
15141295 let pr = calcPrices(amAmt, prAmt, lpAmt)
15151296 $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
15161297 }
15171298
15181299
15191300
15201301 @Callable(i)
15211302 func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
15221303
15231304
15241305
15251306 @Callable(i)
15261307 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
15271308
15281309
15291310
15301311 @Callable(i)
15311312 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
15321313
15331314
15341315
15351316 @Callable(i)
15361317 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, ""))
15371318
15381319
15391320
15401321 @Callable(i)
15411322 func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
15421323 let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
15431324 $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
15441325 }
15451326
15461327
15471328
15481329 @Callable(i)
15491330 func getFeeREADONLY () = $Tuple2(nil, fee)
15501331
15511332
15521333 @Verifier(tx)
15531334 func verify () = {
15541335 let targetPublicKey = match m() {
15551336 case pk: ByteVector =>
15561337 pk
15571338 case _: Unit =>
15581339 tx.senderPublicKey
15591340 case _ =>
15601341 throw("Match error")
15611342 }
15621343 match tx {
15631344 case order: Order =>
15641345 let matcherPub = mp()
1565- let orderValid = validateMatcherOrderAllowed(order)
1346+ let orderValid = moa(order)
15661347 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
15671348 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
15681349 if (if (if (orderValid)
15691350 then senderValid
15701351 else false)
15711352 then matcherValid
15721353 else false)
15731354 then true
15741355 else toe(orderValid, senderValid, matcherValid)
15751356 case s: SetScriptTransaction =>
15761357 let newHash = blake2b256(value(s.script))
15771358 let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash())))
15781359 let currentHash = scriptHash(this)
15791360 if (if ((allowedHash == newHash))
15801361 then (currentHash != newHash)
15811362 else false)
15821363 then true
15831364 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
15841365 case _ =>
15851366 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
15861367 }
15871368 }
15881369

github/deemru/w8io/169f3d6 
190.40 ms