tx · HaCm9rH4DQY94cT8vVtvKsaUsAHAQdqTassK9GhdcJqb

3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA:  -0.03600000 Waves

2022.12.16 09:28 [2362493] smart account 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA > SELF 0.00000000 Waves

{ "type": 13, "id": "HaCm9rH4DQY94cT8vVtvKsaUsAHAQdqTassK9GhdcJqb", "fee": 3600000, "feeAssetId": null, "timestamp": 1671172029988, "version": 1, "sender": "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA", "senderPublicKey": "35yd3qw1gxKDxKwGAykHN9fANbXNWwseaUwbWDj24o3x", "proofs": [ "yxFRYzmPZ74fjzCLwEfkznzdMSUJ8zCViVTqfUdbG83JdXMScaDXE72UGfUBMmo5JqGJq6y8Q43jcXcmBCdzoJh" ], "script": "base64:BgLiKAgCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgRiaWczIgRiaWc0IgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2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0CBQJoVwUCaFUHBgkA9AMDCAUCaE4JYm9keUJ5dGVzCQCRAwIIBQJoTgZwcm9vZnMAAAUCaFAJAPQDAwgFAmhOCWJvZHlCeXRlcwkAkQMCCAUCaE4GcHJvb2ZzAAAFAmhQpomYwQ==", "chainId": 84, "height": 2362493, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7H7PFEizq66vK856b2PANgiYbvGLVrMixjzFMaamd9G2 Next: HjsH5rQaUnzwmTQBwsTcPXASbdeV3777gCMb9j3WuJac 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)
1721
1822 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
1923
6973 func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
7074
7175
76+func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
77+
78+
7279 func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7380
7481
115122 func ada () = "%s__addonAddr"
116123
117124
125+let keyFee = "%s__fee"
126+
127+let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
128+
129+let keyDLp = makeString(["%s", "dLp"], SEP)
130+
131+let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP)
132+
133+let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP)
134+
135+let dLpRefreshDelayDefault = 1
136+
137+let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault)
138+
118139 func fcfg () = "%s__factoryConfig"
119140
120141
156177 func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " "))
157178
158179
180+func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ")
181+
182+
159183 let fca = addressFromStringValue(strf(this, fc()))
160-
161-let inFee = {
162- let @ = invoke(fca, "getInFeeREADONLY", [toString(this)], nil)
163- if ($isInstanceOf(@, "Int"))
164- then @
165- else throw(($getType(@) + " couldn't be cast to Int"))
166- }
167-
168-let outFee = {
169- let @ = invoke(fca, "getOutFeeREADONLY", [toString(this)], nil)
170- if ($isInstanceOf(@, "Int"))
171- then @
172- else throw(($getType(@) + " couldn't be cast to Int"))
173- }
174184
175185 let A = strf(this, amp())
176186
206216
207217 let poolConfigParsed = parsePoolConfig(gpc())
208218
209-let $t069097095 = poolConfigParsed
219+let $t074067592 = poolConfigParsed
210220
211-let cfgPoolAddress = $t069097095._1
221+let cfgPoolAddress = $t074067592._1
212222
213-let cfgPoolStatus = $t069097095._2
223+let cfgPoolStatus = $t074067592._2
214224
215-let cfgLpAssetId = $t069097095._3
225+let cfgLpAssetId = $t074067592._3
216226
217-let cfgAmountAssetId = $t069097095._4
227+let cfgAmountAssetId = $t074067592._4
218228
219-let cfgPriceAssetId = $t069097095._5
229+let cfgPriceAssetId = $t074067592._5
220230
221-let cfgAmountAssetDecimals = $t069097095._6
231+let cfgAmountAssetDecimals = $t074067592._6
222232
223-let cfgPriceAssetDecimals = $t069097095._7
233+let cfgPriceAssetDecimals = $t074067592._7
224234
225235 func gfc () = split(strf(fca, fcfg()), SEP)
226236
296306 }
297307
298308
299-func takeFee (amount,fee) = {
300- let feeAmount = if ((fee == 0))
301- then 0
302- else fraction(amount, fee, scale8)
309+func takeFee (amount) = {
310+ let feeAmount = fraction(amount, fee, scale8)
303311 $Tuple2((amount - feeAmount), feeAmount)
304312 }
305313
326334 let lpEmissX18 = t1(lpEmiss, scale8)
327335 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
328336 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
329- let outAmAmt = f1(outAmAmtX18, amDcm)
330- let outPrAmt = f1(outPrAmtX18, prDcm)
337+ let outAmAmt = fromX18Round(outAmAmtX18, amDcm, FLOOR)
338+ let outPrAmt = fromX18Round(outPrAmtX18, prDcm, FLOOR)
331339 let state = if ((txId58 == ""))
332340 then nil
333341 else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
401409 let expAmtAssetAmtX18 = expectedAmts._1
402410 let expPriceAssetAmtX18 = expectedAmts._2
403411 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
404- $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
412+ $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18)
405413 }
406414 }
407415 let calcLpAmt = r._1
417425 else calcLpAmt
418426 let amDiff = (inAmAmt - calcAmAssetPmt)
419427 let prDiff = (inPrAmt - calcPrAssetPmt)
420- let $t01756217907 = if (if (isOneAsset)
428+ let $t01811218457 = if (if (isOneAsset)
421429 then (pmtId == amIdStr)
422430 else false)
423431 then $Tuple2(pmtAmt, 0)
426434 else false)
427435 then $Tuple2(0, pmtAmt)
428436 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
429- let writeAmAmt = $t01756217907._1
430- let writePrAmt = $t01756217907._2
437+ let writeAmAmt = $t01811218457._1
438+ let writePrAmt = $t01811218457._2
431439 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))]
432440 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
433441 }
434442 }
435443
436444
437-func moa (order) = {
438- let cfg = gpc()
439- let amtAsId = cfg[idxAmAsId]
440- let prAsId = cfg[idxPrAsId]
441- let sts = parseIntValue(cfg[idxPoolSt])
442- let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
443- let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
444- let accAmtAsBalance = getAccBalance(amtAsId)
445- let accPrAsBalance = getAccBalance(prAsId)
446- let curPriceX18 = if ((order.orderType == Buy))
447- then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance)
448- else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance)
449- let curPrice = f1(curPriceX18, scale8)
445+func getD (xp) = {
446+ let xp0 = xp[0]
447+ let xp1 = xp[1]
448+ let s = (xp0 + xp1)
449+ if ((s == big0))
450+ then big0
451+ else {
452+ let a = parseIntValue(A)
453+ let ann = (a * 2)
454+ let p = fraction(xp0, xp1, big1)
455+ let xp0_xp1_n_n = fraction(p, big4, big1)
456+ let ann_s = fraction(toBigInt(ann), s, big1)
457+ let ann_1 = toBigInt((ann - 1))
458+ func calcDNext (d) = {
459+ let dd = fraction(d, d, big1)
460+ let ddd = fraction(dd, d, big1)
461+ let dp = fraction(ddd, big1, xp0_xp1_n_n)
462+ fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1)), CEILING)
463+ }
464+
465+ func calc (acc,i) = if (acc._2)
466+ then acc
467+ else {
468+ let d = acc._1
469+ let dNext = calcDNext(d)
470+ let dDiffRaw = toInt((dNext - value(d)))
471+ let dDiff = if ((0 > dDiffRaw))
472+ then -(dDiffRaw)
473+ else dDiffRaw
474+ if ((1 >= dDiff))
475+ then $Tuple2(dNext, true)
476+ else $Tuple2(dNext, false)
477+ }
478+
479+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
480+ let $t02038520433 = {
481+ let $l = arr
482+ let $s = size($l)
483+ let $acc0 = $Tuple2(s, false)
484+ func $f0_1 ($a,$i) = if (($i >= $s))
485+ then $a
486+ else calc($a, $l[$i])
487+
488+ func $f0_2 ($a,$i) = if (($i >= $s))
489+ then $a
490+ else throw("List size exceeds 15")
491+
492+ $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)
493+ }
494+ let d = $t02038520433._1
495+ let found = $t02038520433._2
496+ if (found)
497+ then d
498+ else throw(("D calculation error, D = " + toString(d)))
499+ }
500+ }
501+
502+
503+func getDOld (xp) = {
504+ let n = big2
505+ let xp0 = xp[0]
506+ let xp1 = xp[1]
507+ let aPrecision = parseBigIntValue(Amult)
508+ let a = (parseBigIntValue(A) * aPrecision)
509+ let s = (xp0 + xp1)
510+ if ((s == big0))
511+ then big0
512+ else {
513+ let ann = (a * n)
514+ let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
515+ let ann_s_aPrecision = ((ann * s) / aPrecision)
516+ let ann_aPrecision = (ann - aPrecision)
517+ let n1 = (n + big1)
518+ func calc (acc,cur) = {
519+ let $t02106221082 = acc
520+ let d = $t02106221082._1
521+ let found = $t02106221082._2
522+ if ((found != unit))
523+ then acc
524+ else {
525+ let dp = (((d * d) * d) / xp0_xp1_n_n)
526+ let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
527+ let dDiff = absBigInt((dNext - value(d)))
528+ if ((big1 >= dDiff))
529+ then $Tuple2(dNext, cur)
530+ else $Tuple2(dNext, unit)
531+ }
532+ }
533+
534+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
535+ let $t02150321550 = {
536+ let $l = arr
537+ let $s = size($l)
538+ let $acc0 = $Tuple2(s, unit)
539+ func $f0_1 ($a,$i) = if (($i >= $s))
540+ then $a
541+ else calc($a, $l[$i])
542+
543+ func $f0_2 ($a,$i) = if (($i >= $s))
544+ then $a
545+ else throw("List size exceeds 15")
546+
547+ $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)
548+ }
549+ let d = $t02150321550._1
550+ let found = $t02150321550._2
551+ if ((found != unit))
552+ then d
553+ else throw(("D calculation error, D = " + toString(d)))
554+ }
555+ }
556+
557+
558+func getYD (xp,i,D) = {
559+ let n = big2
560+ let x = xp[if ((i == 0))
561+ then 1
562+ else 0]
563+ let aPrecision = parseBigIntValue(Amult)
564+ let a = (parseBigIntValue(A) * aPrecision)
565+ let s = x
566+ let ann = (a * n)
567+ let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
568+ let b = ((s + ((D * aPrecision) / ann)) - D)
569+ func calc (acc,cur) = {
570+ let $t02205022070 = acc
571+ let y = $t02205022070._1
572+ let found = $t02205022070._2
573+ if ((found != unit))
574+ then acc
575+ else {
576+ let yNext = (((y * y) + c) / ((big2 * y) + b))
577+ let yDiff = absBigInt((yNext - value(y)))
578+ if ((big1 >= yDiff))
579+ then $Tuple2(yNext, cur)
580+ else $Tuple2(yNext, unit)
581+ }
582+ }
583+
584+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
585+ let $t02237722424 = {
586+ let $l = arr
587+ let $s = size($l)
588+ let $acc0 = $Tuple2(D, unit)
589+ func $f0_1 ($a,$i) = if (($i >= $s))
590+ then $a
591+ else calc($a, $l[$i])
592+
593+ func $f0_2 ($a,$i) = if (($i >= $s))
594+ then $a
595+ else throw("List size exceeds 15")
596+
597+ $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)
598+ }
599+ let y = $t02237722424._1
600+ let found = $t02237722424._2
601+ if ((found != unit))
602+ then y
603+ else throw(("Y calculation error, Y = " + toString(y)))
604+ }
605+
606+
607+func calcDLp (amountBalance,priceBalance,lpEmission) = {
608+ let updatedDLp = fraction(getD([amountBalance, priceBalance]), scale18, lpEmission)
609+ if ((lpEmission == big0))
610+ then big0
611+ else updatedDLp
612+ }
613+
614+
615+func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
616+ let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
617+ let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
618+ let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
619+ let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
620+ currentDLp
621+ }
622+
623+
624+func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
625+ let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
626+ let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
627+ let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
628+ let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
629+ let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))]
630+ $Tuple2(actions, updatedDLp)
631+ }
632+
633+
634+func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp))
635+ then true
636+ else throwErr("updated DLp lower than current DLp")
637+
638+
639+func validateMatcherOrderAllowed (order) = {
640+ let amountAssetAmount = order.amount
641+ let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
642+ let $t02436324575 = if ((order.orderType == Buy))
643+ then $Tuple2(amountAssetAmount, -(priceAssetAmount))
644+ else $Tuple2(-(amountAssetAmount), priceAssetAmount)
645+ let amountAssetBalanceDelta = $t02436324575._1
646+ let priceAssetBalanceDelta = $t02436324575._2
450647 if (if (if (igs())
451648 then true
452- else (sts == PoolMatcherDis))
649+ else (cfgPoolStatus == PoolMatcherDis))
453650 then true
454- else (sts == PoolShutdown))
651+ else (cfgPoolStatus == PoolShutdown))
455652 then throw("Admin blocked")
456- else {
457- let orAmtAsset = order.assetPair.amountAsset
458- let orAmtAsStr = if ((orAmtAsset == unit))
459- then "WAVES"
460- else toBase58String(value(orAmtAsset))
461- let orPrAsset = order.assetPair.priceAsset
462- let orPrAsStr = if ((orPrAsset == unit))
463- then "WAVES"
464- else toBase58String(value(orPrAsset))
465- if (if ((orAmtAsStr != amtAsId))
466- then true
467- else (orPrAsStr != prAsId))
468- then throw("Wr assets")
469- else {
470- let orderPrice = order.price
471- let priceDcm = fraction(scale8, prAsDcm, amtAsDcm)
472- let castOrderPrice = ts(orderPrice, scale8, priceDcm)
473- let isOrderPriceValid = if ((order.orderType == Buy))
474- then (curPrice >= castOrderPrice)
475- else (castOrderPrice >= curPrice)
476- true
477- }
478- }
653+ else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
654+ then true
655+ else (order.assetPair.priceAsset != cfgPriceAssetId))
656+ then throw("Wr assets")
657+ else {
658+ let dLp = parseBigIntValue(getStringValue(this, keyDLp))
659+ let $t02490525005 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
660+ let unusedActions = $t02490525005._1
661+ let dLpNew = $t02490525005._2
662+ let isOrderValid = (dLpNew >= dLp)
663+ isOrderValid
664+ }
479665 }
480666
481667
511697 }
512698
513699
514-func getD (xp) = {
515- let n = big2
516- let xp0 = xp[0]
517- let xp1 = xp[1]
518- let aPrecision = parseBigIntValue(Amult)
519- let a = (parseBigIntValue(A) * aPrecision)
520- let s = (xp0 + xp1)
521- if ((s == big0))
522- then big0
523- else {
524- let ann = (a * n)
525- let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
526- let ann_s_aPrecision = ((ann * s) / aPrecision)
527- let ann_aPrecision = (ann - aPrecision)
528- let n1 = (n + big1)
529- func calc (acc,cur) = {
530- let $t02245922479 = acc
531- let d = $t02245922479._1
532- let found = $t02245922479._2
533- if ((found != unit))
534- then acc
535- else {
536- let dp = (((d * d) * d) / xp0_xp1_n_n)
537- let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
538- let dDiff = absBigInt((dNext - value(d)))
539- if ((big1 >= dDiff))
540- then $Tuple2(dNext, cur)
541- else $Tuple2(dNext, unit)
542- }
543- }
544-
545- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
546- let $t02290022947 = {
547- let $l = arr
548- let $s = size($l)
549- let $acc0 = $Tuple2(s, unit)
550- func $f0_1 ($a,$i) = if (($i >= $s))
551- then $a
552- else calc($a, $l[$i])
553-
554- func $f0_2 ($a,$i) = if (($i >= $s))
555- then $a
556- else throw("List size exceeds 15")
557-
558- $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)
559- }
560- let d = $t02290022947._1
561- let found = $t02290022947._2
562- if ((found != unit))
563- then d
564- else throw(("D calculation error, D = " + toString(d)))
565- }
566- }
567-
568-
569-func getYD (xp,i,D) = {
570- let n = big2
571- let x = xp[if ((i == 0))
572- then 1
573- else 0]
574- let aPrecision = parseBigIntValue(Amult)
575- let a = (parseBigIntValue(A) * aPrecision)
576- let s = x
577- let ann = (a * n)
578- let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
579- let b = ((s + ((D * aPrecision) / ann)) - D)
580- func calc (acc,cur) = {
581- let $t02344723467 = acc
582- let y = $t02344723467._1
583- let found = $t02344723467._2
584- if ((found != unit))
585- then acc
586- else {
587- let yNext = (((y * y) + c) / ((big2 * y) + b))
588- let yDiff = absBigInt((yNext - value(y)))
589- if ((big1 >= yDiff))
590- then $Tuple2(yNext, cur)
591- else $Tuple2(yNext, unit)
592- }
593- }
594-
595- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
596- let $t02377423821 = {
597- let $l = arr
598- let $s = size($l)
599- let $acc0 = $Tuple2(D, unit)
600- func $f0_1 ($a,$i) = if (($i >= $s))
601- then $a
602- else calc($a, $l[$i])
603-
604- func $f0_2 ($a,$i) = if (($i >= $s))
605- then $a
606- else throw("List size exceeds 15")
607-
608- $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)
609- }
610- let y = $t02377423821._1
611- let found = $t02377423821._2
612- if ((found != unit))
613- then y
614- else throw(("Y calculation error, Y = " + toString(y)))
615- }
616-
617-
618700 func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = {
619701 let poolConfig = gpc()
620702 let amId = poolConfig[idxAmAsId]
630712 then {
631713 let amBalance = getAccBalance(amId)
632714 let prBalance = getAccBalance(prId)
633- let $t02460425066 = if ((txId == ""))
715+ let $t02732227784 = if ((txId == ""))
634716 then $Tuple2(amBalance, prBalance)
635717 else if ((pmtAssetId == amId))
636718 then if ((pmtAmtRaw > amBalance))
641723 then throw("invalid payment amount")
642724 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
643725 else throw("wrong pmtAssetId")
644- let amBalanceOld = $t02460425066._1
645- let prBalanceOld = $t02460425066._2
646- let $t02507225248 = if ((pmtAssetId == amId))
726+ let amBalanceOld = $t02732227784._1
727+ let prBalanceOld = $t02732227784._2
728+ let $t02779027966 = if ((pmtAssetId == amId))
647729 then $Tuple2(pmtAmtRaw, 0)
648730 else if ((pmtAssetId == prId))
649731 then $Tuple2(0, pmtAmtRaw)
650732 else throw("invalid payment")
651- let amAmountRaw = $t02507225248._1
652- let prAmountRaw = $t02507225248._2
653- let $t02525225506 = if (withTakeFee)
654- then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2)
733+ let amAmountRaw = $t02779027966._1
734+ let prAmountRaw = $t02779027966._2
735+ let $t02797028209 = if (withTakeFee)
736+ then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
655737 else $Tuple3(amAmountRaw, prAmountRaw, 0)
656- let amAmount = $t02525225506._1
657- let prAmount = $t02525225506._2
658- let feeAmount = $t02525225506._3
738+ let amAmount = $t02797028209._1
739+ let prAmount = $t02797028209._2
740+ let feeAmount = $t02797028209._3
659741 let amBalanceNew = (amBalanceOld + amAmount)
660742 let prBalanceNew = (prBalanceOld + prAmount)
661743 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
665747 else throw()
666748 if ((checkD == checkD))
667749 then {
668- let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0)
750+ let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR)
669751 let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8)
670752 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))]
671753 let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
695777 let pmt = value(payments[0])
696778 let pmtAssetId = value(pmt.assetId)
697779 let pmtAmt = pmt.amount
698- let txId58 = toBase58String(transactionId)
699- if ((lpId != toBase58String(pmtAssetId)))
700- then throw("Wrong LP")
701- else {
702- let amBalance = getAccBalance(amId)
703- let prBalance = getAccBalance(prId)
704- let $t02750827619 = {
705- let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
706- if ($isInstanceOf(@, "(Int, Int)"))
707- then @
708- else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
709- }
710- if (($t02750827619 == $t02750827619))
711- then {
712- let feeAmount = $t02750827619._2
713- let totalGet = $t02750827619._1
714- let totalAmount = if (if ((minOutAmount > 0))
715- then (minOutAmount > totalGet)
716- else false)
717- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
718- else totalGet
719- let $t02780928116 = if ((outAssetId == amId))
720- then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
721- else if ((outAssetId == prId))
722- then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
723- else throw("invalid out asset id")
724- let outAm = $t02780928116._1
725- let outPr = $t02780928116._2
726- let amBalanceNew = $t02780928116._3
727- let prBalanceNew = $t02780928116._4
728- let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
729- let curPr = f1(curPrX18, scale8)
730- let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
731- then unit
732- else fromBase58String(outAssetId)
733- let sendFeeToMatcher = if ((feeAmount > 0))
734- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
735- else nil
736- 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)
737- if ((state == state))
780+ let currentDLp = calcCurrentDLp(big0, big0, big0)
781+ if ((currentDLp == currentDLp))
782+ then {
783+ let txId58 = toBase58String(transactionId)
784+ if ((lpId != toBase58String(pmtAssetId)))
785+ then throw("Wrong LP")
786+ else {
787+ let amBalance = getAccBalance(amId)
788+ let prBalance = getAccBalance(prId)
789+ let $t03027430385 = {
790+ let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
791+ if ($isInstanceOf(@, "(Int, Int)"))
792+ then @
793+ else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
794+ }
795+ if (($t03027430385 == $t03027430385))
738796 then {
739- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
740- if ((burn == burn))
741- then $Tuple2(state, totalAmount)
797+ let feeAmount = $t03027430385._2
798+ let totalGet = $t03027430385._1
799+ let totalAmount = if (if ((minOutAmount > 0))
800+ then (minOutAmount > totalGet)
801+ else false)
802+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
803+ else totalGet
804+ let $t03057530882 = if ((outAssetId == amId))
805+ then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
806+ else if ((outAssetId == prId))
807+ then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
808+ else throw("invalid out asset id")
809+ let outAm = $t03057530882._1
810+ let outPr = $t03057530882._2
811+ let amBalanceNew = $t03057530882._3
812+ let prBalanceNew = $t03057530882._4
813+ let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
814+ let curPr = f1(curPrX18, scale8)
815+ let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
816+ then unit
817+ else fromBase58String(outAssetId)
818+ let sendFeeToMatcher = if ((feeAmount > 0))
819+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
820+ else nil
821+ 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)
822+ if ((state == state))
823+ then {
824+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
825+ if ((burn == burn))
826+ then {
827+ let $t03166732017 = {
828+ let feeAmountForCalc = if ((this == feeCollectorAddress))
829+ then 0
830+ else feeAmount
831+ let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId))
832+ then true
833+ else false
834+ if (outInAmountAsset)
835+ then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
836+ else $Tuple2(0, -((totalGet + feeAmountForCalc)))
837+ }
838+ let amountAssetBalanceDelta = $t03166732017._1
839+ let priceAssetBalanceDelta = $t03166732017._2
840+ let $t03202032128 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
841+ let refreshDLpActions = $t03202032128._1
842+ let updatedDLp = $t03202032128._2
843+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
844+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
845+ then $Tuple2((state ++ refreshDLpActions), totalAmount)
846+ else throw("Strict value is not equal to itself.")
847+ }
848+ else throw("Strict value is not equal to itself.")
849+ }
742850 else throw("Strict value is not equal to itself.")
743851 }
744852 else throw("Strict value is not equal to itself.")
745853 }
746- else throw("Strict value is not equal to itself.")
747854 }
855+ else throw("Strict value is not equal to itself.")
748856 }
749857
750858
849957 else if ((size(i.payments) != 2))
850958 then throw("2 pmnts expd")
851959 else {
852- 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, "")
853- let emitLpAmt = e._2
854- let lpAssetId = e._7
855- let state = e._9
856- let amDiff = e._10
857- let prDiff = e._11
858- let amId = e._12
859- let prId = e._13
860- let r = invoke(fca, "emit", [emitLpAmt], nil)
861- if ((r == r))
960+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
961+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
962+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
963+ if ((currentDLp == currentDLp))
862964 then {
863- let el = match r {
864- case legacy: Address =>
865- invoke(legacy, "emit", [emitLpAmt], nil)
866- case _ =>
867- unit
868- }
869- if ((el == el))
965+ 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, "")
966+ let emitLpAmt = e._2
967+ let lpAssetId = e._7
968+ let state = e._9
969+ let amDiff = e._10
970+ let prDiff = e._11
971+ let amId = e._12
972+ let prId = e._13
973+ let r = invoke(fca, "emit", [emitLpAmt], nil)
974+ if ((r == r))
870975 then {
871- let sa = if ((amDiff > 0))
872- then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
873- else nil
874- if ((sa == sa))
976+ let el = match r {
977+ case legacy: Address =>
978+ invoke(legacy, "emit", [emitLpAmt], nil)
979+ case _ =>
980+ unit
981+ }
982+ if ((el == el))
875983 then {
876- let sp = if ((prDiff > 0))
877- then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
984+ let sa = if ((amDiff > 0))
985+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
878986 else nil
879- if ((sp == sp))
987+ if ((sa == sa))
880988 then {
881- let lpTrnsfr = if (autoStake)
989+ let sp = if ((prDiff > 0))
990+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
991+ else nil
992+ if ((sp == sp))
882993 then {
883- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
884- if ((ss == ss))
885- then nil
994+ let lpTrnsfr = if (autoStake)
995+ then {
996+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
997+ if ((ss == ss))
998+ then nil
999+ else throw("Strict value is not equal to itself.")
1000+ }
1001+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1002+ let $t03598436049 = refreshDLpInternal(0, 0, 0)
1003+ let refreshDLpActions = $t03598436049._1
1004+ let updatedDLp = $t03598436049._2
1005+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1006+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1007+ then ((state ++ lpTrnsfr) ++ refreshDLpActions)
8861008 else throw("Strict value is not equal to itself.")
8871009 }
888- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
889- (state ++ lpTrnsfr)
1010+ else throw("Strict value is not equal to itself.")
8901011 }
8911012 else throw("Strict value is not equal to itself.")
8921013 }
9361057 let pmt = value(i.payments[0])
9371058 let pmtAssetId = toBase58String(value(pmt.assetId))
9381059 let pmtAmt = pmt.amount
939- let $t03347833636 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
940- if (($t03347833636 == $t03347833636))
1060+ let $t03718637344 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
1061+ if (($t03718637344 == $t03718637344))
9411062 then {
942- let feeAmount = $t03347833636._3
943- let state = $t03347833636._2
944- let estimLP = $t03347833636._1
1063+ let feeAmount = $t03718637344._3
1064+ let state = $t03718637344._2
1065+ let estimLP = $t03718637344._1
9451066 let emitLpAmt = if (if ((minOutAmount > 0))
9461067 then (minOutAmount > estimLP)
9471068 else false)
9691090 let sendFeeToMatcher = if ((feeAmount > 0))
9701091 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
9711092 else nil
972- $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
1093+ let $t03815938508 = if ((this == feeCollectorAddress))
1094+ then $Tuple2(0, 0)
1095+ else {
1096+ let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
1097+ then true
1098+ else false
1099+ if (paymentInAmountAsset)
1100+ then $Tuple2(-(feeAmount), 0)
1101+ else $Tuple2(0, -(feeAmount))
1102+ }
1103+ let amountAssetBalanceDelta = $t03815938508._1
1104+ let priceAssetBalanceDelta = $t03815938508._2
1105+ let $t03851138619 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1106+ let refreshDLpActions = $t03851138619._1
1107+ let updatedDLp = $t03851138619._2
1108+ $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
9731109 }
9741110 else throw("Strict value is not equal to itself.")
9751111 }
9891125 then throw("2 pmnts expd")
9901126 else {
9911127 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, "")
992- estPut._9
1128+ let state = estPut._9
1129+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1130+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1131+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
1132+ if ((currentDLp == currentDLp))
1133+ then {
1134+ let $t03957839643 = refreshDLpInternal(0, 0, 0)
1135+ let refreshDLpActions = $t03957839643._1
1136+ let updatedDLp = $t03957839643._2
1137+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1138+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1139+ then (state ++ refreshDLpActions)
1140+ else throw("Strict value is not equal to itself.")
1141+ }
1142+ else throw("Strict value is not equal to itself.")
9931143 }
9941144
9951145
10041154 let state = r._5
10051155 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10061156 if ((b == b))
1007- then state
1157+ then {
1158+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
1159+ let $t04043240514 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1160+ let refreshDLpActions = $t04043240514._1
1161+ let updatedDLp = $t04043240514._2
1162+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1163+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1164+ then (state ++ refreshDLpActions)
1165+ else throw("Strict value is not equal to itself.")
1166+ }
10081167 else throw("Strict value is not equal to itself.")
10091168 }
10101169
10321191 else throwErr("exactly 1 payment are expected")]
10331192 if ((checks == checks))
10341193 then {
1035- let $t03625836413 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1036- let state = $t03625836413._1
1037- let totalAmount = $t03625836413._2
1194+ let $t04113241287 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1195+ let state = $t04113241287._1
1196+ let totalAmount = $t04113241287._2
10381197 $Tuple2(state, totalAmount)
1198+ }
1199+ else throw("Strict value is not equal to itself.")
1200+ }
1201+
1202+
1203+
1204+@Callable(i)
1205+func refreshDLp () = {
1206+ let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
1207+ let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
1208+ then unit
1209+ else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1210+ if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1211+ then {
1212+ let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1213+ let $t04181141875 = refreshDLpInternal(0, 0, 0)
1214+ let dLpUpdateActions = $t04181141875._1
1215+ let updatedDLp = $t04181141875._2
1216+ let actions = if ((dLp != updatedDLp))
1217+ then dLpUpdateActions
1218+ else throwErr("nothing to refresh")
1219+ $Tuple2(actions, toString(updatedDLp))
10391220 }
10401221 else throw("Strict value is not equal to itself.")
10411222 }
10601241 let newY = getYD(xp, index, D1)
10611242 let dy = (xp[index] - newY)
10621243 let totalGetRaw = max([0, toInt((dy - big1))])
1063- let $t03720337258 = takeFee(totalGetRaw, outFee)
1064- let totalGet = $t03720337258._1
1065- let feeAmount = $t03720337258._2
1244+ let $t04277542824 = takeFee(totalGetRaw)
1245+ let totalGet = $t04277542824._1
1246+ let feeAmount = $t04277542824._2
10661247 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
10671248 }
10681249
10761257 let lpId = poolConfig[idxLPAsId]
10771258 let amBalance = getAccBalance(amId)
10781259 let prBalance = getAccBalance(prId)
1079- let $t03760337718 = {
1260+ let $t04316943284 = {
10801261 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
10811262 if ($isInstanceOf(@, "(Int, Int)"))
10821263 then @
10831264 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
10841265 }
1085- let totalGet = $t03760337718._1
1086- let feeAmount = $t03760337718._2
1266+ let totalGet = $t04316943284._1
1267+ let feeAmount = $t04316943284._2
10871268 let r = ego("", lpId, lpAssetAmount, this)
10881269 let outAmAmt = r._1
10891270 let outPrAmt = r._2
11111292 else if ((noLessThenPriceAsset > outPrAmt))
11121293 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
11131294 else {
1295+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
11141296 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11151297 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1116- then state
1298+ then {
1299+ let $t04445244533 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1300+ let refreshDLpActions = $t04445244533._1
1301+ let updatedDLp = $t04445244533._2
1302+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1303+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1304+ then (state ++ refreshDLpActions)
1305+ else throw("Strict value is not equal to itself.")
1306+ }
11171307 else throw("Strict value is not equal to itself.")
11181308 }
11191309 }
11311321 let factoryCfg = gfc()
11321322 let lpAssetId = fromBase58String(cfg[idxLPAsId])
11331323 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1324+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
11341325 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
11351326 if ((unstakeInv == unstakeInv))
11361327 then {
11371328 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1329+ let outAmAmt = r._1
1330+ let outPrAmt = r._2
11381331 let sts = parseIntValue(r._9)
11391332 let state = r._10
11401333 let v = if (if (igs())
11461339 then {
11471340 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11481341 if ((burnA == burnA))
1149- then state
1342+ then {
1343+ let $t04559645677 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1344+ let refreshDLpActions = $t04559645677._1
1345+ let updatedDLp = $t04559645677._2
1346+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1347+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1348+ then (state ++ refreshDLpActions)
1349+ else throw("Strict value is not equal to itself.")
1350+ }
11501351 else throw("Strict value is not equal to itself.")
11511352 }
11521353 else throw("Strict value is not equal to itself.")
11701371 else throw("no payments are expected")]
11711372 if ((checks == checks))
11721373 then {
1374+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
11731375 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11741376 if ((unstakeInv == unstakeInv))
11751377 then {
11861388 then {
11871389 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11881390 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1189- then state
1391+ then {
1392+ let $t04692547006 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1393+ let refreshDLpActions = $t04692547006._1
1394+ let updatedDLp = $t04692547006._2
1395+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1396+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1397+ then (state ++ refreshDLpActions)
1398+ else throw("Strict value is not equal to itself.")
1399+ }
11901400 else throw("Strict value is not equal to itself.")
11911401 }
11921402 else throw("Strict value is not equal to itself.")
12271437 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
12281438 if ((unstakeInv == unstakeInv))
12291439 then {
1230- let $t04155641744 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1231- let state = $t04155641744._1
1232- let totalAmount = $t04155641744._2
1440+ let $t04794048128 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1441+ let state = $t04794048128._1
1442+ let totalAmount = $t04794048128._2
12331443 $Tuple2(state, totalAmount)
12341444 }
12351445 else throw("Strict value is not equal to itself.")
12451455 let amId = poolConfig[idxAmAsId]
12461456 let prId = poolConfig[idxPrAsId]
12471457 let lpId = poolConfig[idxLPAsId]
1248- let $t04200342106 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1249- let lpAmount = $t04200342106._1
1250- let state = $t04200342106._2
1251- let feeAmount = $t04200342106._3
1252- let bonus = $t04200342106._4
1458+ let $t04838748490 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1459+ let lpAmount = $t04838748490._1
1460+ let state = $t04838748490._2
1461+ let feeAmount = $t04838748490._3
1462+ let bonus = $t04838748490._4
12531463 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
12541464 }
12551465
12611471 let amId = poolConfig[idxAmAsId]
12621472 let prId = poolConfig[idxPrAsId]
12631473 let lpId = poolConfig[idxLPAsId]
1264- let $t04238542489 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1265- let lpAmount = $t04238542489._1
1266- let state = $t04238542489._2
1267- let feeAmount = $t04238542489._3
1268- let bonus = $t04238542489._4
1474+ let $t04876948873 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1475+ let lpAmount = $t04876948873._1
1476+ let state = $t04876948873._2
1477+ let feeAmount = $t04876948873._3
1478+ let bonus = $t04876948873._4
12691479 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
12701480 }
12711481
13371547 }
13381548
13391549
1550+
1551+@Callable(i)
1552+func getFeeREADONLY () = $Tuple2(nil, fee)
1553+
1554+
13401555 @Verifier(tx)
13411556 func verify () = {
13421557 let targetPublicKey = match m() {
13501565 match tx {
13511566 case order: Order =>
13521567 let matcherPub = mp()
1353- let orderValid = moa(order)
1568+ let orderValid = validateMatcherOrderAllowed(order)
13541569 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
13551570 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
13561571 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)
1721
1822 let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8)))
1923
2024 let wavesString = "WAVES"
2125
2226 let Amult = "100"
2327
2428 let Dconv = "1"
2529
2630 let SEP = "__"
2731
2832 let EMPTY = ""
2933
3034 let PoolActive = 1
3135
3236 let PoolPutDis = 2
3337
3438 let PoolMatcherDis = 3
3539
3640 let PoolShutdown = 4
3741
3842 let idxPoolAddress = 1
3943
4044 let idxPoolSt = 2
4145
4246 let idxLPAsId = 3
4347
4448 let idxAmAsId = 4
4549
4650 let idxPrAsId = 5
4751
4852 let idxAmtAsDcm = 6
4953
5054 let idxPriceAsDcm = 7
5155
5256 let idxIAmtAsId = 8
5357
5458 let idxIPriceAsId = 9
5559
5660 let idxFactStakCntr = 1
5761
5862 let idxFactoryRestCntr = 6
5963
6064 let idxFactSlippCntr = 7
6165
6266 let idxFactGwxRewCntr = 10
6367
6468 let feeDefault = fraction(10, scale8, 10000)
6569
6670 func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6771
6872
6973 func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
7074
7175
76+func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
77+
78+
7279 func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7380
7481
7582 func abs (val) = if ((zeroBigInt > val))
7683 then -(val)
7784 else val
7885
7986
8087 func absBigInt (val) = if ((zeroBigInt > val))
8188 then -(val)
8289 else val
8390
8491
8592 func fc () = "%s__factoryContract"
8693
8794
8895 func mpk () = "%s__managerPublicKey"
8996
9097
9198 func pmpk () = "%s__pendingManagerPublicKey"
9299
93100
94101 func pl () = "%s%s__price__last"
95102
96103
97104 func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP)
98105
99106
100107 func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId)
101108
102109
103110 func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId)
104111
105112
106113 func aa () = "%s__amountAsset"
107114
108115
109116 func pa () = "%s__priceAsset"
110117
111118
112119 func amp () = "%s__amp"
113120
114121
115122 func ada () = "%s__addonAddr"
116123
117124
125+let keyFee = "%s__fee"
126+
127+let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
128+
129+let keyDLp = makeString(["%s", "dLp"], SEP)
130+
131+let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP)
132+
133+let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP)
134+
135+let dLpRefreshDelayDefault = 1
136+
137+let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault)
138+
118139 func fcfg () = "%s__factoryConfig"
119140
120141
121142 func mtpk () = "%s%s__matcher__publicKey"
122143
123144
124145 func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
125146
126147
127148 func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
128149
129150
130151 func aps () = "%s__shutdown"
131152
132153
133154 func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash"
134155
135156
136157 func keyFeeCollectorAddress () = "%s__feeCollectorAddress"
137158
138159
139160 func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV)))
140161
141162
142163 func str (val) = match val {
143164 case valStr: String =>
144165 valStr
145166 case _ =>
146167 throw("fail cast to String")
147168 }
148169
149170
150171 func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
151172
152173
153174 func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
154175
155176
156177 func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " "))
157178
158179
180+func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ")
181+
182+
159183 let fca = addressFromStringValue(strf(this, fc()))
160-
161-let inFee = {
162- let @ = invoke(fca, "getInFeeREADONLY", [toString(this)], nil)
163- if ($isInstanceOf(@, "Int"))
164- then @
165- else throw(($getType(@) + " couldn't be cast to Int"))
166- }
167-
168-let outFee = {
169- let @ = invoke(fca, "getOutFeeREADONLY", [toString(this)], nil)
170- if ($isInstanceOf(@, "Int"))
171- then @
172- else throw(($getType(@) + " couldn't be cast to Int"))
173- }
174184
175185 let A = strf(this, amp())
176186
177187 func igs () = valueOrElse(getBoolean(fca, aps()), false)
178188
179189
180190 func mp () = fromBase58String(strf(fca, mtpk()))
181191
182192
183193 let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress()))
184194
185195 func gpc () = {
186196 let amtAs = strf(this, aa())
187197 let priceAs = strf(this, pa())
188198 let iPriceAs = intf(fca, mba(priceAs))
189199 let iAmtAs = intf(fca, mba(amtAs))
190200 split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP)
191201 }
192202
193203
194204 func parseAssetId (input) = if ((input == wavesString))
195205 then unit
196206 else fromBase58String(input)
197207
198208
199209 func assetIdToString (input) = if ((input == unit))
200210 then wavesString
201211 else toBase58String(value(input))
202212
203213
204214 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]))
205215
206216
207217 let poolConfigParsed = parsePoolConfig(gpc())
208218
209-let $t069097095 = poolConfigParsed
219+let $t074067592 = poolConfigParsed
210220
211-let cfgPoolAddress = $t069097095._1
221+let cfgPoolAddress = $t074067592._1
212222
213-let cfgPoolStatus = $t069097095._2
223+let cfgPoolStatus = $t074067592._2
214224
215-let cfgLpAssetId = $t069097095._3
225+let cfgLpAssetId = $t074067592._3
216226
217-let cfgAmountAssetId = $t069097095._4
227+let cfgAmountAssetId = $t074067592._4
218228
219-let cfgPriceAssetId = $t069097095._5
229+let cfgPriceAssetId = $t074067592._5
220230
221-let cfgAmountAssetDecimals = $t069097095._6
231+let cfgAmountAssetDecimals = $t074067592._6
222232
223-let cfgPriceAssetDecimals = $t069097095._7
233+let cfgPriceAssetDecimals = $t074067592._7
224234
225235 func gfc () = split(strf(fca, fcfg()), SEP)
226236
227237
228238 let factoryConfig = gfc()
229239
230240 let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address")
231241
232242 let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address")
233243
234244 let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address")
235245
236246 let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address")
237247
238248 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)
239249
240250
241251 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)
242252
243253
244254 func getAccBalance (assetId) = if ((assetId == "WAVES"))
245255 then wavesBalance(this).available
246256 else assetBalance(this, fromBase58String(assetId))
247257
248258
249259 func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
250260
251261
252262 func vad (A1,A2,slippage) = {
253263 let diff = fraction((A1 - A2), scale8BigInt, A2)
254264 let pass = ((slippage - abs(diff)) > zeroBigInt)
255265 if (!(pass))
256266 then throw(("Big slpg: " + toString(diff)))
257267 else $Tuple2(pass, min([A1, A2]))
258268 }
259269
260270
261271 func vd (D1,D0,slpg) = {
262272 let diff = fraction(D0, scale8BigInt, D1)
263273 let fail = (slpg > diff)
264274 if (if (fail)
265275 then true
266276 else (D0 > D1))
267277 then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg)))
268278 else fail
269279 }
270280
271281
272282 func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
273283 let amtAsAmtX18 = t1(amAmt, amAssetDcm)
274284 let prAsAmtX18 = t1(prAmt, prAssetDcm)
275285 cpbi(prAsAmtX18, amtAsAmtX18)
276286 }
277287
278288
279289 func calcPrices (amAmt,prAmt,lpAmt) = {
280290 let cfg = gpc()
281291 let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
282292 let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
283293 let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt)
284294 let amAmtX18 = t1(amAmt, amtAsDcm)
285295 let prAmtX18 = t1(prAmt, prAsDcm)
286296 let lpAmtX18 = t1(lpAmt, scale8)
287297 let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18)
288298 let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18)
289299 [priceX18, lpPrInAmAsX18, lpPrInPrAsX18]
290300 }
291301
292302
293303 func calculatePrices (amAmt,prAmt,lpAmt) = {
294304 let p = calcPrices(amAmt, prAmt, lpAmt)
295305 [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)]
296306 }
297307
298308
299-func takeFee (amount,fee) = {
300- let feeAmount = if ((fee == 0))
301- then 0
302- else fraction(amount, fee, scale8)
309+func takeFee (amount) = {
310+ let feeAmount = fraction(amount, fee, scale8)
303311 $Tuple2((amount - feeAmount), feeAmount)
304312 }
305313
306314
307315 func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
308316 let cfg = gpc()
309317 let lpId = cfg[idxLPAsId]
310318 let amId = cfg[idxAmAsId]
311319 let prId = cfg[idxPrAsId]
312320 let amDcm = parseIntValue(cfg[idxAmtAsDcm])
313321 let prDcm = parseIntValue(cfg[idxPriceAsDcm])
314322 let sts = cfg[idxPoolSt]
315323 let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity
316324 if ((lpId != pmtAssetId))
317325 then throw("Wrong pmt asset")
318326 else {
319327 let amBalance = getAccBalance(amId)
320328 let amBalanceX18 = t1(amBalance, amDcm)
321329 let prBalance = getAccBalance(prId)
322330 let prBalanceX18 = t1(prBalance, prDcm)
323331 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
324332 let curPrice = f1(curPriceX18, scale8)
325333 let pmtLpAmtX18 = t1(pmtLpAmt, scale8)
326334 let lpEmissX18 = t1(lpEmiss, scale8)
327335 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18)
328336 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18)
329- let outAmAmt = f1(outAmAmtX18, amDcm)
330- let outPrAmt = f1(outPrAmtX18, prDcm)
337+ let outAmAmt = fromX18Round(outAmAmtX18, amDcm, FLOOR)
338+ let outPrAmt = fromX18Round(outPrAmtX18, prDcm, FLOOR)
331339 let state = if ((txId58 == ""))
332340 then nil
333341 else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES"))
334342 then unit
335343 else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES"))
336344 then unit
337345 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)]
338346 $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state)
339347 }
340348 }
341349
342350
343351 func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
344352 let cfg = gpc()
345353 let lpId = fromBase58String(cfg[idxLPAsId])
346354 let amIdStr = cfg[idxAmAsId]
347355 let prIdStr = cfg[idxPrAsId]
348356 let inAmIdStr = cfg[idxIAmtAsId]
349357 let inPrIdStr = cfg[idxIPriceAsId]
350358 let amtDcm = parseIntValue(cfg[idxAmtAsDcm])
351359 let priceDcm = parseIntValue(cfg[idxPriceAsDcm])
352360 let sts = cfg[idxPoolSt]
353361 let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity
354362 let amBalance = if (isEval)
355363 then getAccBalance(amIdStr)
356364 else if (if (isOneAsset)
357365 then (pmtId == amIdStr)
358366 else false)
359367 then (getAccBalance(amIdStr) - pmtAmt)
360368 else if (isOneAsset)
361369 then getAccBalance(amIdStr)
362370 else (getAccBalance(amIdStr) - inAmAmt)
363371 let prBalance = if (isEval)
364372 then getAccBalance(prIdStr)
365373 else if (if (isOneAsset)
366374 then (pmtId == prIdStr)
367375 else false)
368376 then (getAccBalance(prIdStr) - pmtAmt)
369377 else if (isOneAsset)
370378 then getAccBalance(prIdStr)
371379 else (getAccBalance(prIdStr) - inPrAmt)
372380 let inAmAssetAmtX18 = t1(inAmAmt, amtDcm)
373381 let inPrAssetAmtX18 = t1(inPrAmt, priceDcm)
374382 let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18)
375383 let amBalanceX18 = t1(amBalance, amtDcm)
376384 let prBalanceX18 = t1(prBalance, priceDcm)
377385 let r = if ((lpEm == 0))
378386 then {
379387 let curPriceX18 = zeroBigInt
380388 let slippageX18 = zeroBigInt
381389 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
382390 $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
383391 }
384392 else {
385393 let curPriceX18 = cpbi(prBalanceX18, amBalanceX18)
386394 let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18)
387395 let slippageX18 = t1(slippage, scale8)
388396 if (if (if (validateSlippage)
389397 then (curPriceX18 != zeroBigInt)
390398 else false)
391399 then (slippageRealX18 > slippageX18)
392400 else false)
393401 then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18)))
394402 else {
395403 let lpEmissionX18 = t1(lpEm, scale8)
396404 let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
397405 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
398406 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
399407 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
400408 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
401409 let expAmtAssetAmtX18 = expectedAmts._1
402410 let expPriceAssetAmtX18 = expectedAmts._2
403411 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18)
404- $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18)
412+ $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18)
405413 }
406414 }
407415 let calcLpAmt = r._1
408416 let calcAmAssetPmt = r._2
409417 let calcPrAssetPmt = r._3
410418 let curPrice = f1(r._4, scale8)
411419 let slippageCalc = f1(r._5, scale8)
412420 if ((0 >= calcLpAmt))
413421 then throw("LP <= 0")
414422 else {
415423 let emitLpAmt = if (!(emitLp))
416424 then 0
417425 else calcLpAmt
418426 let amDiff = (inAmAmt - calcAmAssetPmt)
419427 let prDiff = (inPrAmt - calcPrAssetPmt)
420- let $t01756217907 = if (if (isOneAsset)
428+ let $t01811218457 = if (if (isOneAsset)
421429 then (pmtId == amIdStr)
422430 else false)
423431 then $Tuple2(pmtAmt, 0)
424432 else if (if (isOneAsset)
425433 then (pmtId == prIdStr)
426434 else false)
427435 then $Tuple2(0, pmtAmt)
428436 else $Tuple2(calcAmAssetPmt, calcPrAssetPmt)
429- let writeAmAmt = $t01756217907._1
430- let writePrAmt = $t01756217907._2
437+ let writeAmAmt = $t01811218457._1
438+ let writePrAmt = $t01811218457._2
431439 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))]
432440 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId)
433441 }
434442 }
435443
436444
437-func moa (order) = {
438- let cfg = gpc()
439- let amtAsId = cfg[idxAmAsId]
440- let prAsId = cfg[idxPrAsId]
441- let sts = parseIntValue(cfg[idxPoolSt])
442- let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm])
443- let prAsDcm = parseIntValue(cfg[idxPriceAsDcm])
444- let accAmtAsBalance = getAccBalance(amtAsId)
445- let accPrAsBalance = getAccBalance(prAsId)
446- let curPriceX18 = if ((order.orderType == Buy))
447- then pcp(amtAsDcm, prAsDcm, (accAmtAsBalance + order.amount), accPrAsBalance)
448- else pcp(amtAsDcm, prAsDcm, (accAmtAsBalance - order.amount), accPrAsBalance)
449- let curPrice = f1(curPriceX18, scale8)
445+func getD (xp) = {
446+ let xp0 = xp[0]
447+ let xp1 = xp[1]
448+ let s = (xp0 + xp1)
449+ if ((s == big0))
450+ then big0
451+ else {
452+ let a = parseIntValue(A)
453+ let ann = (a * 2)
454+ let p = fraction(xp0, xp1, big1)
455+ let xp0_xp1_n_n = fraction(p, big4, big1)
456+ let ann_s = fraction(toBigInt(ann), s, big1)
457+ let ann_1 = toBigInt((ann - 1))
458+ func calcDNext (d) = {
459+ let dd = fraction(d, d, big1)
460+ let ddd = fraction(dd, d, big1)
461+ let dp = fraction(ddd, big1, xp0_xp1_n_n)
462+ fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1)), CEILING)
463+ }
464+
465+ func calc (acc,i) = if (acc._2)
466+ then acc
467+ else {
468+ let d = acc._1
469+ let dNext = calcDNext(d)
470+ let dDiffRaw = toInt((dNext - value(d)))
471+ let dDiff = if ((0 > dDiffRaw))
472+ then -(dDiffRaw)
473+ else dDiffRaw
474+ if ((1 >= dDiff))
475+ then $Tuple2(dNext, true)
476+ else $Tuple2(dNext, false)
477+ }
478+
479+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
480+ let $t02038520433 = {
481+ let $l = arr
482+ let $s = size($l)
483+ let $acc0 = $Tuple2(s, false)
484+ func $f0_1 ($a,$i) = if (($i >= $s))
485+ then $a
486+ else calc($a, $l[$i])
487+
488+ func $f0_2 ($a,$i) = if (($i >= $s))
489+ then $a
490+ else throw("List size exceeds 15")
491+
492+ $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)
493+ }
494+ let d = $t02038520433._1
495+ let found = $t02038520433._2
496+ if (found)
497+ then d
498+ else throw(("D calculation error, D = " + toString(d)))
499+ }
500+ }
501+
502+
503+func getDOld (xp) = {
504+ let n = big2
505+ let xp0 = xp[0]
506+ let xp1 = xp[1]
507+ let aPrecision = parseBigIntValue(Amult)
508+ let a = (parseBigIntValue(A) * aPrecision)
509+ let s = (xp0 + xp1)
510+ if ((s == big0))
511+ then big0
512+ else {
513+ let ann = (a * n)
514+ let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
515+ let ann_s_aPrecision = ((ann * s) / aPrecision)
516+ let ann_aPrecision = (ann - aPrecision)
517+ let n1 = (n + big1)
518+ func calc (acc,cur) = {
519+ let $t02106221082 = acc
520+ let d = $t02106221082._1
521+ let found = $t02106221082._2
522+ if ((found != unit))
523+ then acc
524+ else {
525+ let dp = (((d * d) * d) / xp0_xp1_n_n)
526+ let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
527+ let dDiff = absBigInt((dNext - value(d)))
528+ if ((big1 >= dDiff))
529+ then $Tuple2(dNext, cur)
530+ else $Tuple2(dNext, unit)
531+ }
532+ }
533+
534+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
535+ let $t02150321550 = {
536+ let $l = arr
537+ let $s = size($l)
538+ let $acc0 = $Tuple2(s, unit)
539+ func $f0_1 ($a,$i) = if (($i >= $s))
540+ then $a
541+ else calc($a, $l[$i])
542+
543+ func $f0_2 ($a,$i) = if (($i >= $s))
544+ then $a
545+ else throw("List size exceeds 15")
546+
547+ $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)
548+ }
549+ let d = $t02150321550._1
550+ let found = $t02150321550._2
551+ if ((found != unit))
552+ then d
553+ else throw(("D calculation error, D = " + toString(d)))
554+ }
555+ }
556+
557+
558+func getYD (xp,i,D) = {
559+ let n = big2
560+ let x = xp[if ((i == 0))
561+ then 1
562+ else 0]
563+ let aPrecision = parseBigIntValue(Amult)
564+ let a = (parseBigIntValue(A) * aPrecision)
565+ let s = x
566+ let ann = (a * n)
567+ let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
568+ let b = ((s + ((D * aPrecision) / ann)) - D)
569+ func calc (acc,cur) = {
570+ let $t02205022070 = acc
571+ let y = $t02205022070._1
572+ let found = $t02205022070._2
573+ if ((found != unit))
574+ then acc
575+ else {
576+ let yNext = (((y * y) + c) / ((big2 * y) + b))
577+ let yDiff = absBigInt((yNext - value(y)))
578+ if ((big1 >= yDiff))
579+ then $Tuple2(yNext, cur)
580+ else $Tuple2(yNext, unit)
581+ }
582+ }
583+
584+ let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
585+ let $t02237722424 = {
586+ let $l = arr
587+ let $s = size($l)
588+ let $acc0 = $Tuple2(D, unit)
589+ func $f0_1 ($a,$i) = if (($i >= $s))
590+ then $a
591+ else calc($a, $l[$i])
592+
593+ func $f0_2 ($a,$i) = if (($i >= $s))
594+ then $a
595+ else throw("List size exceeds 15")
596+
597+ $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)
598+ }
599+ let y = $t02237722424._1
600+ let found = $t02237722424._2
601+ if ((found != unit))
602+ then y
603+ else throw(("Y calculation error, Y = " + toString(y)))
604+ }
605+
606+
607+func calcDLp (amountBalance,priceBalance,lpEmission) = {
608+ let updatedDLp = fraction(getD([amountBalance, priceBalance]), scale18, lpEmission)
609+ if ((lpEmission == big0))
610+ then big0
611+ else updatedDLp
612+ }
613+
614+
615+func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
616+ let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
617+ let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
618+ let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
619+ let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
620+ currentDLp
621+ }
622+
623+
624+func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
625+ let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
626+ let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
627+ let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
628+ let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
629+ let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))]
630+ $Tuple2(actions, updatedDLp)
631+ }
632+
633+
634+func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp))
635+ then true
636+ else throwErr("updated DLp lower than current DLp")
637+
638+
639+func validateMatcherOrderAllowed (order) = {
640+ let amountAssetAmount = order.amount
641+ let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
642+ let $t02436324575 = if ((order.orderType == Buy))
643+ then $Tuple2(amountAssetAmount, -(priceAssetAmount))
644+ else $Tuple2(-(amountAssetAmount), priceAssetAmount)
645+ let amountAssetBalanceDelta = $t02436324575._1
646+ let priceAssetBalanceDelta = $t02436324575._2
450647 if (if (if (igs())
451648 then true
452- else (sts == PoolMatcherDis))
649+ else (cfgPoolStatus == PoolMatcherDis))
453650 then true
454- else (sts == PoolShutdown))
651+ else (cfgPoolStatus == PoolShutdown))
455652 then throw("Admin blocked")
456- else {
457- let orAmtAsset = order.assetPair.amountAsset
458- let orAmtAsStr = if ((orAmtAsset == unit))
459- then "WAVES"
460- else toBase58String(value(orAmtAsset))
461- let orPrAsset = order.assetPair.priceAsset
462- let orPrAsStr = if ((orPrAsset == unit))
463- then "WAVES"
464- else toBase58String(value(orPrAsset))
465- if (if ((orAmtAsStr != amtAsId))
466- then true
467- else (orPrAsStr != prAsId))
468- then throw("Wr assets")
469- else {
470- let orderPrice = order.price
471- let priceDcm = fraction(scale8, prAsDcm, amtAsDcm)
472- let castOrderPrice = ts(orderPrice, scale8, priceDcm)
473- let isOrderPriceValid = if ((order.orderType == Buy))
474- then (curPrice >= castOrderPrice)
475- else (castOrderPrice >= curPrice)
476- true
477- }
478- }
653+ else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
654+ then true
655+ else (order.assetPair.priceAsset != cfgPriceAssetId))
656+ then throw("Wr assets")
657+ else {
658+ let dLp = parseBigIntValue(getStringValue(this, keyDLp))
659+ let $t02490525005 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
660+ let unusedActions = $t02490525005._1
661+ let dLpNew = $t02490525005._2
662+ let isOrderValid = (dLpNew >= dLp)
663+ isOrderValid
664+ }
479665 }
480666
481667
482668 func cg (i) = if ((size(i.payments) != 1))
483669 then throw("1 pmnt exp")
484670 else {
485671 let pmt = value(i.payments[0])
486672 let pmtAssetId = value(pmt.assetId)
487673 let pmtAmt = pmt.amount
488674 let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
489675 let outAmAmt = r._1
490676 let outPrAmt = r._2
491677 let sts = parseIntValue(r._9)
492678 let state = r._10
493679 if (if (igs())
494680 then true
495681 else (sts == PoolShutdown))
496682 then throw(("Admin blocked: " + toString(sts)))
497683 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
498684 }
499685
500686
501687 func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = {
502688 let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId)
503689 let sts = parseIntValue(r._8)
504690 if (if (if (igs())
505691 then true
506692 else (sts == PoolPutDis))
507693 then true
508694 else (sts == PoolShutdown))
509695 then throw(("Blocked:" + toString(sts)))
510696 else r
511697 }
512698
513699
514-func getD (xp) = {
515- let n = big2
516- let xp0 = xp[0]
517- let xp1 = xp[1]
518- let aPrecision = parseBigIntValue(Amult)
519- let a = (parseBigIntValue(A) * aPrecision)
520- let s = (xp0 + xp1)
521- if ((s == big0))
522- then big0
523- else {
524- let ann = (a * n)
525- let xp0_xp1_n_n = (((xp0 * xp1) * n) * n)
526- let ann_s_aPrecision = ((ann * s) / aPrecision)
527- let ann_aPrecision = (ann - aPrecision)
528- let n1 = (n + big1)
529- func calc (acc,cur) = {
530- let $t02245922479 = acc
531- let d = $t02245922479._1
532- let found = $t02245922479._2
533- if ((found != unit))
534- then acc
535- else {
536- let dp = (((d * d) * d) / xp0_xp1_n_n)
537- let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp)))
538- let dDiff = absBigInt((dNext - value(d)))
539- if ((big1 >= dDiff))
540- then $Tuple2(dNext, cur)
541- else $Tuple2(dNext, unit)
542- }
543- }
544-
545- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
546- let $t02290022947 = {
547- let $l = arr
548- let $s = size($l)
549- let $acc0 = $Tuple2(s, unit)
550- func $f0_1 ($a,$i) = if (($i >= $s))
551- then $a
552- else calc($a, $l[$i])
553-
554- func $f0_2 ($a,$i) = if (($i >= $s))
555- then $a
556- else throw("List size exceeds 15")
557-
558- $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)
559- }
560- let d = $t02290022947._1
561- let found = $t02290022947._2
562- if ((found != unit))
563- then d
564- else throw(("D calculation error, D = " + toString(d)))
565- }
566- }
567-
568-
569-func getYD (xp,i,D) = {
570- let n = big2
571- let x = xp[if ((i == 0))
572- then 1
573- else 0]
574- let aPrecision = parseBigIntValue(Amult)
575- let a = (parseBigIntValue(A) * aPrecision)
576- let s = x
577- let ann = (a * n)
578- let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n))
579- let b = ((s + ((D * aPrecision) / ann)) - D)
580- func calc (acc,cur) = {
581- let $t02344723467 = acc
582- let y = $t02344723467._1
583- let found = $t02344723467._2
584- if ((found != unit))
585- then acc
586- else {
587- let yNext = (((y * y) + c) / ((big2 * y) + b))
588- let yDiff = absBigInt((yNext - value(y)))
589- if ((big1 >= yDiff))
590- then $Tuple2(yNext, cur)
591- else $Tuple2(yNext, unit)
592- }
593- }
594-
595- let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
596- let $t02377423821 = {
597- let $l = arr
598- let $s = size($l)
599- let $acc0 = $Tuple2(D, unit)
600- func $f0_1 ($a,$i) = if (($i >= $s))
601- then $a
602- else calc($a, $l[$i])
603-
604- func $f0_2 ($a,$i) = if (($i >= $s))
605- then $a
606- else throw("List size exceeds 15")
607-
608- $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)
609- }
610- let y = $t02377423821._1
611- let found = $t02377423821._2
612- if ((found != unit))
613- then y
614- else throw(("Y calculation error, Y = " + toString(y)))
615- }
616-
617-
618700 func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = {
619701 let poolConfig = gpc()
620702 let amId = poolConfig[idxAmAsId]
621703 let prId = poolConfig[idxPrAsId]
622704 let lpId = poolConfig[idxLPAsId]
623705 let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm])
624706 let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm])
625707 let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
626708 let chechEmission = if ((lpAssetEmission > big0))
627709 then true
628710 else throw("initial deposit requires all coins")
629711 if ((chechEmission == chechEmission))
630712 then {
631713 let amBalance = getAccBalance(amId)
632714 let prBalance = getAccBalance(prId)
633- let $t02460425066 = if ((txId == ""))
715+ let $t02732227784 = if ((txId == ""))
634716 then $Tuple2(amBalance, prBalance)
635717 else if ((pmtAssetId == amId))
636718 then if ((pmtAmtRaw > amBalance))
637719 then throw("invalid payment amount")
638720 else $Tuple2((amBalance - pmtAmtRaw), prBalance)
639721 else if ((pmtAssetId == prId))
640722 then if ((pmtAmtRaw > prBalance))
641723 then throw("invalid payment amount")
642724 else $Tuple2(amBalance, (prBalance - pmtAmtRaw))
643725 else throw("wrong pmtAssetId")
644- let amBalanceOld = $t02460425066._1
645- let prBalanceOld = $t02460425066._2
646- let $t02507225248 = if ((pmtAssetId == amId))
726+ let amBalanceOld = $t02732227784._1
727+ let prBalanceOld = $t02732227784._2
728+ let $t02779027966 = if ((pmtAssetId == amId))
647729 then $Tuple2(pmtAmtRaw, 0)
648730 else if ((pmtAssetId == prId))
649731 then $Tuple2(0, pmtAmtRaw)
650732 else throw("invalid payment")
651- let amAmountRaw = $t02507225248._1
652- let prAmountRaw = $t02507225248._2
653- let $t02525225506 = if (withTakeFee)
654- then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2)
733+ let amAmountRaw = $t02779027966._1
734+ let prAmountRaw = $t02779027966._2
735+ let $t02797028209 = if (withTakeFee)
736+ then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2)
655737 else $Tuple3(amAmountRaw, prAmountRaw, 0)
656- let amAmount = $t02525225506._1
657- let prAmount = $t02525225506._2
658- let feeAmount = $t02525225506._3
738+ let amAmount = $t02797028209._1
739+ let prAmount = $t02797028209._2
740+ let feeAmount = $t02797028209._3
659741 let amBalanceNew = (amBalanceOld + amAmount)
660742 let prBalanceNew = (prBalanceOld + prAmount)
661743 let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)])
662744 let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)])
663745 let checkD = if ((D1 > D0))
664746 then true
665747 else throw()
666748 if ((checkD == checkD))
667749 then {
668- let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0)
750+ let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR)
669751 let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8)
670752 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))]
671753 let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld)
672754 let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8))
673755 let priceAssetPart = (pmtAmtRaw - amountAssetPart)
674756 let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld))
675757 let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth))
676758 $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus)
677759 }
678760 else throw("Strict value is not equal to itself.")
679761 }
680762 else throw("Strict value is not equal to itself.")
681763 }
682764
683765
684766 func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = {
685767 let poolConfig = gpc()
686768 let lpId = poolConfig[idxLPAsId]
687769 let amId = poolConfig[idxAmAsId]
688770 let prId = poolConfig[idxPrAsId]
689771 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
690772 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
691773 let poolStatus = poolConfig[idxPoolSt]
692774 let userAddress = if ((caller == restContract))
693775 then originCaller
694776 else caller
695777 let pmt = value(payments[0])
696778 let pmtAssetId = value(pmt.assetId)
697779 let pmtAmt = pmt.amount
698- let txId58 = toBase58String(transactionId)
699- if ((lpId != toBase58String(pmtAssetId)))
700- then throw("Wrong LP")
701- else {
702- let amBalance = getAccBalance(amId)
703- let prBalance = getAccBalance(prId)
704- let $t02750827619 = {
705- let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
706- if ($isInstanceOf(@, "(Int, Int)"))
707- then @
708- else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
709- }
710- if (($t02750827619 == $t02750827619))
711- then {
712- let feeAmount = $t02750827619._2
713- let totalGet = $t02750827619._1
714- let totalAmount = if (if ((minOutAmount > 0))
715- then (minOutAmount > totalGet)
716- else false)
717- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
718- else totalGet
719- let $t02780928116 = if ((outAssetId == amId))
720- then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
721- else if ((outAssetId == prId))
722- then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
723- else throw("invalid out asset id")
724- let outAm = $t02780928116._1
725- let outPr = $t02780928116._2
726- let amBalanceNew = $t02780928116._3
727- let prBalanceNew = $t02780928116._4
728- let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
729- let curPr = f1(curPrX18, scale8)
730- let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
731- then unit
732- else fromBase58String(outAssetId)
733- let sendFeeToMatcher = if ((feeAmount > 0))
734- then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
735- else nil
736- 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)
737- if ((state == state))
780+ let currentDLp = calcCurrentDLp(big0, big0, big0)
781+ if ((currentDLp == currentDLp))
782+ then {
783+ let txId58 = toBase58String(transactionId)
784+ if ((lpId != toBase58String(pmtAssetId)))
785+ then throw("Wrong LP")
786+ else {
787+ let amBalance = getAccBalance(amId)
788+ let prBalance = getAccBalance(prId)
789+ let $t03027430385 = {
790+ let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil)
791+ if ($isInstanceOf(@, "(Int, Int)"))
792+ then @
793+ else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
794+ }
795+ if (($t03027430385 == $t03027430385))
738796 then {
739- let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
740- if ((burn == burn))
741- then $Tuple2(state, totalAmount)
797+ let feeAmount = $t03027430385._2
798+ let totalGet = $t03027430385._1
799+ let totalAmount = if (if ((minOutAmount > 0))
800+ then (minOutAmount > totalGet)
801+ else false)
802+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
803+ else totalGet
804+ let $t03057530882 = if ((outAssetId == amId))
805+ then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance)
806+ else if ((outAssetId == prId))
807+ then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount))
808+ else throw("invalid out asset id")
809+ let outAm = $t03057530882._1
810+ let outPr = $t03057530882._2
811+ let amBalanceNew = $t03057530882._3
812+ let prBalanceNew = $t03057530882._4
813+ let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals))
814+ let curPr = f1(curPrX18, scale8)
815+ let outAssetIdOrWaves = if ((outAssetId == "WAVES"))
816+ then unit
817+ else fromBase58String(outAssetId)
818+ let sendFeeToMatcher = if ((feeAmount > 0))
819+ then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)]
820+ else nil
821+ 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)
822+ if ((state == state))
823+ then {
824+ let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
825+ if ((burn == burn))
826+ then {
827+ let $t03166732017 = {
828+ let feeAmountForCalc = if ((this == feeCollectorAddress))
829+ then 0
830+ else feeAmount
831+ let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId))
832+ then true
833+ else false
834+ if (outInAmountAsset)
835+ then $Tuple2(-((totalGet + feeAmountForCalc)), 0)
836+ else $Tuple2(0, -((totalGet + feeAmountForCalc)))
837+ }
838+ let amountAssetBalanceDelta = $t03166732017._1
839+ let priceAssetBalanceDelta = $t03166732017._2
840+ let $t03202032128 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
841+ let refreshDLpActions = $t03202032128._1
842+ let updatedDLp = $t03202032128._2
843+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
844+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
845+ then $Tuple2((state ++ refreshDLpActions), totalAmount)
846+ else throw("Strict value is not equal to itself.")
847+ }
848+ else throw("Strict value is not equal to itself.")
849+ }
742850 else throw("Strict value is not equal to itself.")
743851 }
744852 else throw("Strict value is not equal to itself.")
745853 }
746- else throw("Strict value is not equal to itself.")
747854 }
855+ else throw("Strict value is not equal to itself.")
748856 }
749857
750858
751859 func m () = match getString(mpk()) {
752860 case s: String =>
753861 fromBase58String(s)
754862 case _: Unit =>
755863 unit
756864 case _ =>
757865 throw("Match error")
758866 }
759867
760868
761869 func pm () = match getString(pmpk()) {
762870 case s: String =>
763871 fromBase58String(s)
764872 case _: Unit =>
765873 unit
766874 case _ =>
767875 throw("Match error")
768876 }
769877
770878
771879 let pd = throw("Permission denied")
772880
773881 func isManager (i) = match m() {
774882 case pk: ByteVector =>
775883 (i.callerPublicKey == pk)
776884 case _: Unit =>
777885 (i.caller == this)
778886 case _ =>
779887 throw("Match error")
780888 }
781889
782890
783891 func mm (i) = match m() {
784892 case pk: ByteVector =>
785893 if ((i.callerPublicKey == pk))
786894 then true
787895 else pd
788896 case _: Unit =>
789897 if ((i.caller == this))
790898 then true
791899 else pd
792900 case _ =>
793901 throw("Match error")
794902 }
795903
796904
797905 @Callable(i)
798906 func constructor (fc) = {
799907 let c = mm(i)
800908 if ((c == c))
801909 then [StringEntry(fc(), fc)]
802910 else throw("Strict value is not equal to itself.")
803911 }
804912
805913
806914
807915 @Callable(i)
808916 func setManager (pendingManagerPublicKey) = {
809917 let c = mm(i)
810918 if ((c == c))
811919 then {
812920 let cm = fromBase58String(pendingManagerPublicKey)
813921 if ((cm == cm))
814922 then [StringEntry(pmpk(), pendingManagerPublicKey)]
815923 else throw("Strict value is not equal to itself.")
816924 }
817925 else throw("Strict value is not equal to itself.")
818926 }
819927
820928
821929
822930 @Callable(i)
823931 func confirmManager () = {
824932 let p = pm()
825933 let hpm = if (isDefined(p))
826934 then true
827935 else throw("No pending manager")
828936 if ((hpm == hpm))
829937 then {
830938 let cpm = if ((i.callerPublicKey == value(p)))
831939 then true
832940 else throw("You are not pending manager")
833941 if ((cpm == cpm))
834942 then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())]
835943 else throw("Strict value is not equal to itself.")
836944 }
837945 else throw("Strict value is not equal to itself.")
838946 }
839947
840948
841949
842950 @Callable(i)
843951 func put (slip,autoStake) = {
844952 let factCfg = gfc()
845953 let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr")
846954 let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr")
847955 if ((0 > slip))
848956 then throw("Wrong slippage")
849957 else if ((size(i.payments) != 2))
850958 then throw("2 pmnts expd")
851959 else {
852- 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, "")
853- let emitLpAmt = e._2
854- let lpAssetId = e._7
855- let state = e._9
856- let amDiff = e._10
857- let prDiff = e._11
858- let amId = e._12
859- let prId = e._13
860- let r = invoke(fca, "emit", [emitLpAmt], nil)
861- if ((r == r))
960+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
961+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
962+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
963+ if ((currentDLp == currentDLp))
862964 then {
863- let el = match r {
864- case legacy: Address =>
865- invoke(legacy, "emit", [emitLpAmt], nil)
866- case _ =>
867- unit
868- }
869- if ((el == el))
965+ 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, "")
966+ let emitLpAmt = e._2
967+ let lpAssetId = e._7
968+ let state = e._9
969+ let amDiff = e._10
970+ let prDiff = e._11
971+ let amId = e._12
972+ let prId = e._13
973+ let r = invoke(fca, "emit", [emitLpAmt], nil)
974+ if ((r == r))
870975 then {
871- let sa = if ((amDiff > 0))
872- then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
873- else nil
874- if ((sa == sa))
976+ let el = match r {
977+ case legacy: Address =>
978+ invoke(legacy, "emit", [emitLpAmt], nil)
979+ case _ =>
980+ unit
981+ }
982+ if ((el == el))
875983 then {
876- let sp = if ((prDiff > 0))
877- then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
984+ let sa = if ((amDiff > 0))
985+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
878986 else nil
879- if ((sp == sp))
987+ if ((sa == sa))
880988 then {
881- let lpTrnsfr = if (autoStake)
989+ let sp = if ((prDiff > 0))
990+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
991+ else nil
992+ if ((sp == sp))
882993 then {
883- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
884- if ((ss == ss))
885- then nil
994+ let lpTrnsfr = if (autoStake)
995+ then {
996+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
997+ if ((ss == ss))
998+ then nil
999+ else throw("Strict value is not equal to itself.")
1000+ }
1001+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1002+ let $t03598436049 = refreshDLpInternal(0, 0, 0)
1003+ let refreshDLpActions = $t03598436049._1
1004+ let updatedDLp = $t03598436049._2
1005+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1006+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1007+ then ((state ++ lpTrnsfr) ++ refreshDLpActions)
8861008 else throw("Strict value is not equal to itself.")
8871009 }
888- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
889- (state ++ lpTrnsfr)
1010+ else throw("Strict value is not equal to itself.")
8901011 }
8911012 else throw("Strict value is not equal to itself.")
8921013 }
8931014 else throw("Strict value is not equal to itself.")
8941015 }
8951016 else throw("Strict value is not equal to itself.")
8961017 }
8971018 else throw("Strict value is not equal to itself.")
8981019 }
8991020 }
9001021
9011022
9021023
9031024 @Callable(i)
9041025 func putOneTknV2 (minOutAmount,autoStake) = {
9051026 let isPoolOneTokenOperationsDisabled = {
9061027 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
9071028 if ($isInstanceOf(@, "Boolean"))
9081029 then @
9091030 else throw(($getType(@) + " couldn't be cast to Boolean"))
9101031 }
9111032 let isPutDisabled = if (if (if (igs())
9121033 then true
9131034 else (cfgPoolStatus == PoolPutDis))
9141035 then true
9151036 else (cfgPoolStatus == PoolShutdown))
9161037 then true
9171038 else isPoolOneTokenOperationsDisabled
9181039 let checks = [if (if (!(isPutDisabled))
9191040 then true
9201041 else isManager(i))
9211042 then true
9221043 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
9231044 then true
9241045 else throwErr("exactly 1 payment are expected")]
9251046 if ((checks == checks))
9261047 then {
9271048 let poolConfig = gpc()
9281049 let amId = poolConfig[idxAmAsId]
9291050 let prId = poolConfig[idxPrAsId]
9301051 let lpId = fromBase58String(poolConfig[idxLPAsId])
9311052 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
9321053 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
9331054 let userAddress = if ((i.caller == this))
9341055 then i.originCaller
9351056 else i.caller
9361057 let pmt = value(i.payments[0])
9371058 let pmtAssetId = toBase58String(value(pmt.assetId))
9381059 let pmtAmt = pmt.amount
939- let $t03347833636 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
940- if (($t03347833636 == $t03347833636))
1060+ let $t03718637344 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
1061+ if (($t03718637344 == $t03718637344))
9411062 then {
942- let feeAmount = $t03347833636._3
943- let state = $t03347833636._2
944- let estimLP = $t03347833636._1
1063+ let feeAmount = $t03718637344._3
1064+ let state = $t03718637344._2
1065+ let estimLP = $t03718637344._1
9451066 let emitLpAmt = if (if ((minOutAmount > 0))
9461067 then (minOutAmount > estimLP)
9471068 else false)
9481069 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
9491070 else estimLP
9501071 let e = invoke(fca, "emit", [emitLpAmt], nil)
9511072 if ((e == e))
9521073 then {
9531074 let el = match e {
9541075 case legacy: Address =>
9551076 invoke(legacy, "emit", [emitLpAmt], nil)
9561077 case _ =>
9571078 unit
9581079 }
9591080 if ((el == el))
9601081 then {
9611082 let lpTrnsfr = if (autoStake)
9621083 then {
9631084 let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
9641085 if ((ss == ss))
9651086 then nil
9661087 else throw("Strict value is not equal to itself.")
9671088 }
9681089 else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
9691090 let sendFeeToMatcher = if ((feeAmount > 0))
9701091 then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
9711092 else nil
972- $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
1093+ let $t03815938508 = if ((this == feeCollectorAddress))
1094+ then $Tuple2(0, 0)
1095+ else {
1096+ let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
1097+ then true
1098+ else false
1099+ if (paymentInAmountAsset)
1100+ then $Tuple2(-(feeAmount), 0)
1101+ else $Tuple2(0, -(feeAmount))
1102+ }
1103+ let amountAssetBalanceDelta = $t03815938508._1
1104+ let priceAssetBalanceDelta = $t03815938508._2
1105+ let $t03851138619 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1106+ let refreshDLpActions = $t03851138619._1
1107+ let updatedDLp = $t03851138619._2
1108+ $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
9731109 }
9741110 else throw("Strict value is not equal to itself.")
9751111 }
9761112 else throw("Strict value is not equal to itself.")
9771113 }
9781114 else throw("Strict value is not equal to itself.")
9791115 }
9801116 else throw("Strict value is not equal to itself.")
9811117 }
9821118
9831119
9841120
9851121 @Callable(i)
9861122 func putForFree (maxSlpg) = if ((0 > maxSlpg))
9871123 then throw("Wrong slpg")
9881124 else if ((size(i.payments) != 2))
9891125 then throw("2 pmnts expd")
9901126 else {
9911127 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, "")
992- estPut._9
1128+ let state = estPut._9
1129+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1130+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1131+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
1132+ if ((currentDLp == currentDLp))
1133+ then {
1134+ let $t03957839643 = refreshDLpInternal(0, 0, 0)
1135+ let refreshDLpActions = $t03957839643._1
1136+ let updatedDLp = $t03957839643._2
1137+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1138+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1139+ then (state ++ refreshDLpActions)
1140+ else throw("Strict value is not equal to itself.")
1141+ }
1142+ else throw("Strict value is not equal to itself.")
9931143 }
9941144
9951145
9961146
9971147 @Callable(i)
9981148 func get () = {
9991149 let r = cg(i)
10001150 let outAmtAmt = r._1
10011151 let outPrAmt = r._2
10021152 let pmtAmt = r._3
10031153 let pmtAssetId = r._4
10041154 let state = r._5
10051155 let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
10061156 if ((b == b))
1007- then state
1157+ then {
1158+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
1159+ let $t04043240514 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1160+ let refreshDLpActions = $t04043240514._1
1161+ let updatedDLp = $t04043240514._2
1162+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1163+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1164+ then (state ++ refreshDLpActions)
1165+ else throw("Strict value is not equal to itself.")
1166+ }
10081167 else throw("Strict value is not equal to itself.")
10091168 }
10101169
10111170
10121171
10131172 @Callable(i)
10141173 func getOneTknV2 (outAssetId,minOutAmount) = {
10151174 let isPoolOneTokenOperationsDisabled = {
10161175 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
10171176 if ($isInstanceOf(@, "Boolean"))
10181177 then @
10191178 else throw(($getType(@) + " couldn't be cast to Boolean"))
10201179 }
10211180 let isGetDisabled = if (if (igs())
10221181 then true
10231182 else (cfgPoolStatus == PoolShutdown))
10241183 then true
10251184 else isPoolOneTokenOperationsDisabled
10261185 let checks = [if (if (!(isGetDisabled))
10271186 then true
10281187 else isManager(i))
10291188 then true
10301189 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
10311190 then true
10321191 else throwErr("exactly 1 payment are expected")]
10331192 if ((checks == checks))
10341193 then {
1035- let $t03625836413 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1036- let state = $t03625836413._1
1037- let totalAmount = $t03625836413._2
1194+ let $t04113241287 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1195+ let state = $t04113241287._1
1196+ let totalAmount = $t04113241287._2
10381197 $Tuple2(state, totalAmount)
1198+ }
1199+ else throw("Strict value is not equal to itself.")
1200+ }
1201+
1202+
1203+
1204+@Callable(i)
1205+func refreshDLp () = {
1206+ let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
1207+ let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
1208+ then unit
1209+ else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1210+ if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1211+ then {
1212+ let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1213+ let $t04181141875 = refreshDLpInternal(0, 0, 0)
1214+ let dLpUpdateActions = $t04181141875._1
1215+ let updatedDLp = $t04181141875._2
1216+ let actions = if ((dLp != updatedDLp))
1217+ then dLpUpdateActions
1218+ else throwErr("nothing to refresh")
1219+ $Tuple2(actions, toString(updatedDLp))
10391220 }
10401221 else throw("Strict value is not equal to itself.")
10411222 }
10421223
10431224
10441225
10451226 @Callable(i)
10461227 func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
10471228 let poolConfig = gpc()
10481229 let amId = poolConfig[idxAmAsId]
10491230 let prId = poolConfig[idxPrAsId]
10501231 let lpId = poolConfig[idxLPAsId]
10511232 let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))]
10521233 let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
10531234 let D0 = getD(xp)
10541235 let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission))
10551236 let index = if ((outAssetId == amId))
10561237 then 0
10571238 else if ((outAssetId == prId))
10581239 then 1
10591240 else throw("invalid out asset id")
10601241 let newY = getYD(xp, index, D1)
10611242 let dy = (xp[index] - newY)
10621243 let totalGetRaw = max([0, toInt((dy - big1))])
1063- let $t03720337258 = takeFee(totalGetRaw, outFee)
1064- let totalGet = $t03720337258._1
1065- let feeAmount = $t03720337258._2
1244+ let $t04277542824 = takeFee(totalGetRaw)
1245+ let totalGet = $t04277542824._1
1246+ let feeAmount = $t04277542824._2
10661247 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
10671248 }
10681249
10691250
10701251
10711252 @Callable(i)
10721253 func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = {
10731254 let poolConfig = gpc()
10741255 let amId = poolConfig[idxAmAsId]
10751256 let prId = poolConfig[idxPrAsId]
10761257 let lpId = poolConfig[idxLPAsId]
10771258 let amBalance = getAccBalance(amId)
10781259 let prBalance = getAccBalance(prId)
1079- let $t03760337718 = {
1260+ let $t04316943284 = {
10801261 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
10811262 if ($isInstanceOf(@, "(Int, Int)"))
10821263 then @
10831264 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
10841265 }
1085- let totalGet = $t03760337718._1
1086- let feeAmount = $t03760337718._2
1266+ let totalGet = $t04316943284._1
1267+ let feeAmount = $t04316943284._2
10871268 let r = ego("", lpId, lpAssetAmount, this)
10881269 let outAmAmt = r._1
10891270 let outPrAmt = r._2
10901271 let sumOfGetAssets = (outAmAmt + outPrAmt)
10911272 let bonus = if ((sumOfGetAssets == 0))
10921273 then if ((totalGet == 0))
10931274 then 0
10941275 else throw("bonus calculation error")
10951276 else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets)
10961277 $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus))
10971278 }
10981279
10991280
11001281
11011282 @Callable(i)
11021283 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
11031284 let r = cg(i)
11041285 let outAmAmt = r._1
11051286 let outPrAmt = r._2
11061287 let pmtAmt = r._3
11071288 let pmtAssetId = r._4
11081289 let state = r._5
11091290 if ((noLessThenAmtAsset > outAmAmt))
11101291 then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
11111292 else if ((noLessThenPriceAsset > outPrAmt))
11121293 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
11131294 else {
1295+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
11141296 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11151297 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1116- then state
1298+ then {
1299+ let $t04445244533 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1300+ let refreshDLpActions = $t04445244533._1
1301+ let updatedDLp = $t04445244533._2
1302+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1303+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1304+ then (state ++ refreshDLpActions)
1305+ else throw("Strict value is not equal to itself.")
1306+ }
11171307 else throw("Strict value is not equal to itself.")
11181308 }
11191309 }
11201310
11211311
11221312
11231313 @Callable(i)
11241314 func unstakeAndGet (amount) = {
11251315 let checkPayments = if ((size(i.payments) != 0))
11261316 then throw("No pmnts expd")
11271317 else true
11281318 if ((checkPayments == checkPayments))
11291319 then {
11301320 let cfg = gpc()
11311321 let factoryCfg = gfc()
11321322 let lpAssetId = fromBase58String(cfg[idxLPAsId])
11331323 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1324+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
11341325 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
11351326 if ((unstakeInv == unstakeInv))
11361327 then {
11371328 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1329+ let outAmAmt = r._1
1330+ let outPrAmt = r._2
11381331 let sts = parseIntValue(r._9)
11391332 let state = r._10
11401333 let v = if (if (igs())
11411334 then true
11421335 else (sts == PoolShutdown))
11431336 then throw(("Blocked: " + toString(sts)))
11441337 else true
11451338 if ((v == v))
11461339 then {
11471340 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11481341 if ((burnA == burnA))
1149- then state
1342+ then {
1343+ let $t04559645677 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1344+ let refreshDLpActions = $t04559645677._1
1345+ let updatedDLp = $t04559645677._2
1346+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1347+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1348+ then (state ++ refreshDLpActions)
1349+ else throw("Strict value is not equal to itself.")
1350+ }
11501351 else throw("Strict value is not equal to itself.")
11511352 }
11521353 else throw("Strict value is not equal to itself.")
11531354 }
11541355 else throw("Strict value is not equal to itself.")
11551356 }
11561357 else throw("Strict value is not equal to itself.")
11571358 }
11581359
11591360
11601361
11611362 @Callable(i)
11621363 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
11631364 let isGetDisabled = if (igs())
11641365 then true
11651366 else (cfgPoolStatus == PoolShutdown)
11661367 let checks = [if (!(isGetDisabled))
11671368 then true
11681369 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11691370 then true
11701371 else throw("no payments are expected")]
11711372 if ((checks == checks))
11721373 then {
1374+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
11731375 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11741376 if ((unstakeInv == unstakeInv))
11751377 then {
11761378 let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11771379 let outAmAmt = res._1
11781380 let outPrAmt = res._2
11791381 let state = res._10
11801382 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11811383 then true
11821384 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11831385 then true
11841386 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11851387 if ((checkAmounts == checkAmounts))
11861388 then {
11871389 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11881390 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1189- then state
1391+ then {
1392+ let $t04692547006 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1393+ let refreshDLpActions = $t04692547006._1
1394+ let updatedDLp = $t04692547006._2
1395+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1396+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1397+ then (state ++ refreshDLpActions)
1398+ else throw("Strict value is not equal to itself.")
1399+ }
11901400 else throw("Strict value is not equal to itself.")
11911401 }
11921402 else throw("Strict value is not equal to itself.")
11931403 }
11941404 else throw("Strict value is not equal to itself.")
11951405 }
11961406 else throw("Strict value is not equal to itself.")
11971407 }
11981408
11991409
12001410
12011411 @Callable(i)
12021412 func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = {
12031413 let isPoolOneTokenOperationsDisabled = {
12041414 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12051415 if ($isInstanceOf(@, "Boolean"))
12061416 then @
12071417 else throw(($getType(@) + " couldn't be cast to Boolean"))
12081418 }
12091419 let isGetDisabled = if (if (igs())
12101420 then true
12111421 else (cfgPoolStatus == PoolShutdown))
12121422 then true
12131423 else isPoolOneTokenOperationsDisabled
12141424 let checks = [if (if (!(isGetDisabled))
12151425 then true
12161426 else isManager(i))
12171427 then true
12181428 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
12191429 then true
12201430 else throwErr("no payments are expected")]
12211431 if ((checks == checks))
12221432 then {
12231433 let cfg = gpc()
12241434 let factoryCfg = gfc()
12251435 let lpAssetId = fromBase58String(cfg[idxLPAsId])
12261436 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
12271437 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
12281438 if ((unstakeInv == unstakeInv))
12291439 then {
1230- let $t04155641744 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1231- let state = $t04155641744._1
1232- let totalAmount = $t04155641744._2
1440+ let $t04794048128 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1441+ let state = $t04794048128._1
1442+ let totalAmount = $t04794048128._2
12331443 $Tuple2(state, totalAmount)
12341444 }
12351445 else throw("Strict value is not equal to itself.")
12361446 }
12371447 else throw("Strict value is not equal to itself.")
12381448 }
12391449
12401450
12411451
12421452 @Callable(i)
12431453 func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = {
12441454 let poolConfig = gpc()
12451455 let amId = poolConfig[idxAmAsId]
12461456 let prId = poolConfig[idxPrAsId]
12471457 let lpId = poolConfig[idxLPAsId]
1248- let $t04200342106 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1249- let lpAmount = $t04200342106._1
1250- let state = $t04200342106._2
1251- let feeAmount = $t04200342106._3
1252- let bonus = $t04200342106._4
1458+ let $t04838748490 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1459+ let lpAmount = $t04838748490._1
1460+ let state = $t04838748490._2
1461+ let feeAmount = $t04838748490._3
1462+ let bonus = $t04838748490._4
12531463 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
12541464 }
12551465
12561466
12571467
12581468 @Callable(i)
12591469 func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = {
12601470 let poolConfig = gpc()
12611471 let amId = poolConfig[idxAmAsId]
12621472 let prId = poolConfig[idxPrAsId]
12631473 let lpId = poolConfig[idxLPAsId]
1264- let $t04238542489 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1265- let lpAmount = $t04238542489._1
1266- let state = $t04238542489._2
1267- let feeAmount = $t04238542489._3
1268- let bonus = $t04238542489._4
1474+ let $t04876948873 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1475+ let lpAmount = $t04876948873._1
1476+ let state = $t04876948873._2
1477+ let feeAmount = $t04876948873._3
1478+ let bonus = $t04876948873._4
12691479 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
12701480 }
12711481
12721482
12731483
12741484 @Callable(i)
12751485 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
12761486 then throw("denied")
12771487 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
12781488
12791489
12801490
12811491 @Callable(i)
12821492 func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
12831493 then pd
12841494 else [StringEntry(k, v)]
12851495
12861496
12871497
12881498 @Callable(i)
12891499 func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
12901500 then pd
12911501 else [IntegerEntry(k, v)]
12921502
12931503
12941504
12951505 @Callable(i)
12961506 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
12971507
12981508
12991509
13001510 @Callable(i)
13011511 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
13021512
13031513
13041514
13051515 @Callable(i)
13061516 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
13071517 let pr = calcPrices(amAmt, prAmt, lpAmt)
13081518 $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
13091519 }
13101520
13111521
13121522
13131523 @Callable(i)
13141524 func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
13151525
13161526
13171527
13181528 @Callable(i)
13191529 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
13201530
13211531
13221532
13231533 @Callable(i)
13241534 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
13251535
13261536
13271537
13281538 @Callable(i)
13291539 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, ""))
13301540
13311541
13321542
13331543 @Callable(i)
13341544 func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
13351545 let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
13361546 $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
13371547 }
13381548
13391549
1550+
1551+@Callable(i)
1552+func getFeeREADONLY () = $Tuple2(nil, fee)
1553+
1554+
13401555 @Verifier(tx)
13411556 func verify () = {
13421557 let targetPublicKey = match m() {
13431558 case pk: ByteVector =>
13441559 pk
13451560 case _: Unit =>
13461561 tx.senderPublicKey
13471562 case _ =>
13481563 throw("Match error")
13491564 }
13501565 match tx {
13511566 case order: Order =>
13521567 let matcherPub = mp()
1353- let orderValid = moa(order)
1568+ let orderValid = validateMatcherOrderAllowed(order)
13541569 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
13551570 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
13561571 if (if (if (orderValid)
13571572 then senderValid
13581573 else false)
13591574 then matcherValid
13601575 else false)
13611576 then true
13621577 else toe(orderValid, senderValid, matcherValid)
13631578 case s: SetScriptTransaction =>
13641579 let newHash = blake2b256(value(s.script))
13651580 let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash())))
13661581 let currentHash = scriptHash(this)
13671582 if (if ((allowedHash == newHash))
13681583 then (currentHash != newHash)
13691584 else false)
13701585 then true
13711586 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13721587 case _ =>
13731588 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13741589 }
13751590 }
13761591

github/deemru/w8io/169f3d6 
180.82 ms