tx · 5YqmQs9LJgvf7CqAUrmjmKwzHDu7sfBp3M44qepzouva

3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA:  -0.03700000 Waves

2022.12.16 18:16 [2363028] smart account 3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA > SELF 0.00000000 Waves

{ "type": 13, "id": "5YqmQs9LJgvf7CqAUrmjmKwzHDu7sfBp3M44qepzouva", "fee": 3700000, "feeAssetId": null, "timestamp": 1671203838850, "version": 1, "sender": "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA", "senderPublicKey": "35yd3qw1gxKDxKwGAykHN9fANbXNWwseaUwbWDj24o3x", "proofs": [ "5ePfkGLVo8kQKGda1zh7gQoJL43jyx97xAJyCn4tAh6kq8BXpTFWCaasXqSoGcysTTSSMxWAgz5Ckh8td6psJp9v" ], "script": "base64:BgL/KAgCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgRiaWczIgRiaWc0IgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2lk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HVlAQkAnQgCBQJhUAkBAmF6AAQCaFkJAPEHAQUEdGhpcwMDCQAAAgUCaFgFAmhXCQECIT0CBQJoWQUCaFcHBgkA9AMDCAUCaFAJYm9keUJ5dGVzCQCRAwIIBQJoUAZwcm9vZnMAAAUCaFIJAPQDAwgFAmhQCWJvZHlCeXRlcwkAkQMCCAUCaFAGcHJvb2ZzAAAFAmhSC5PaDA==", "chainId": 84, "height": 2363028, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2hTmsaGUW3EFaABBUbkxfF9dPYX9UKq6MGd83K7jJHiE Next: 4fqMMhfmDYkLB5AgNKBfUefnLTX5cmRyGZJyGErAz2aF 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 amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt)
963+ if ((amountAssetBalance == amountAssetBalance))
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 priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt)
966+ if ((priceAssetBalance == priceAssetBalance))
870967 then {
871- let sa = if ((amDiff > 0))
872- then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
873- else nil
874- if ((sa == sa))
968+ let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity)
969+ if ((lpAssetEmission == lpAssetEmission))
875970 then {
876- let sp = if ((prDiff > 0))
877- then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
878- else nil
879- if ((sp == sp))
971+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
972+ if ((currentDLp == currentDLp))
880973 then {
881- let lpTrnsfr = if (autoStake)
974+ 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, "")
975+ let emitLpAmt = e._2
976+ let lpAssetId = e._7
977+ let state = e._9
978+ let amDiff = e._10
979+ let prDiff = e._11
980+ let amId = e._12
981+ let prId = e._13
982+ let r = invoke(fca, "emit", [emitLpAmt], nil)
983+ if ((r == r))
882984 then {
883- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
884- if ((ss == ss))
885- then nil
985+ let el = match r {
986+ case legacy: Address =>
987+ invoke(legacy, "emit", [emitLpAmt], nil)
988+ case _ =>
989+ unit
990+ }
991+ if ((el == el))
992+ then {
993+ let sa = if ((amDiff > 0))
994+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
995+ else nil
996+ if ((sa == sa))
997+ then {
998+ let sp = if ((prDiff > 0))
999+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
1000+ else nil
1001+ if ((sp == sp))
1002+ then {
1003+ let lpTrnsfr = if (autoStake)
1004+ then {
1005+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
1006+ if ((ss == ss))
1007+ then nil
1008+ else throw("Strict value is not equal to itself.")
1009+ }
1010+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1011+ let $t03627736516 = refreshDLpInternal(0, 0, 0)
1012+ let refreshDLpActions = $t03627736516._1
1013+ let updatedDLp = $t03627736516._2
1014+ let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity
1015+ if ((lpAssetEmissionAfter == lpAssetEmissionAfter))
1016+ then {
1017+ let error = if ((updatedDLp >= currentDLp))
1018+ then true
1019+ else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(emitLpAmt), toString(amDiff), toString(prDiff), toString(lpAssetEmission), toString(lpAssetEmissionAfter)], " "))
1020+ if ((error == error))
1021+ then ((state ++ lpTrnsfr) ++ refreshDLpActions)
1022+ else throw("Strict value is not equal to itself.")
1023+ }
1024+ else throw("Strict value is not equal to itself.")
1025+ }
1026+ else throw("Strict value is not equal to itself.")
1027+ }
1028+ else throw("Strict value is not equal to itself.")
1029+ }
8861030 else throw("Strict value is not equal to itself.")
8871031 }
888- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
889- (state ++ lpTrnsfr)
1032+ else throw("Strict value is not equal to itself.")
8901033 }
8911034 else throw("Strict value is not equal to itself.")
8921035 }
9361079 let pmt = value(i.payments[0])
9371080 let pmtAssetId = toBase58String(value(pmt.assetId))
9381081 let pmtAmt = pmt.amount
939- let $t03347833636 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
940- if (($t03347833636 == $t03347833636))
1082+ let currentDLp = if ((pmt.assetId == cfgAmountAssetId))
1083+ then calcCurrentDLp(toBigInt(pmtAmt), toBigInt(0), toBigInt(0))
1084+ else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0))
1085+ if ((currentDLp == currentDLp))
9411086 then {
942- let feeAmount = $t03347833636._3
943- let state = $t03347833636._2
944- let estimLP = $t03347833636._1
945- let emitLpAmt = if (if ((minOutAmount > 0))
946- then (minOutAmount > estimLP)
947- else false)
948- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
949- else estimLP
950- let e = invoke(fca, "emit", [emitLpAmt], nil)
951- if ((e == e))
1087+ let $t03831038468 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
1088+ if (($t03831038468 == $t03831038468))
9521089 then {
953- let el = match e {
954- case legacy: Address =>
955- invoke(legacy, "emit", [emitLpAmt], nil)
956- case _ =>
957- unit
958- }
959- if ((el == el))
1090+ let feeAmount = $t03831038468._3
1091+ let state = $t03831038468._2
1092+ let estimLP = $t03831038468._1
1093+ let emitLpAmt = if (if ((minOutAmount > 0))
1094+ then (minOutAmount > estimLP)
1095+ else false)
1096+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
1097+ else estimLP
1098+ let e = invoke(fca, "emit", [emitLpAmt], nil)
1099+ if ((e == e))
9601100 then {
961- let lpTrnsfr = if (autoStake)
1101+ let el = match e {
1102+ case legacy: Address =>
1103+ invoke(legacy, "emit", [emitLpAmt], nil)
1104+ case _ =>
1105+ unit
1106+ }
1107+ if ((el == el))
9621108 then {
963- let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
964- if ((ss == ss))
965- then nil
1109+ let lpTrnsfr = if (autoStake)
1110+ then {
1111+ let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
1112+ if ((ss == ss))
1113+ then nil
1114+ else throw("Strict value is not equal to itself.")
1115+ }
1116+ else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
1117+ let sendFeeToMatcher = if ((feeAmount > 0))
1118+ then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
1119+ else nil
1120+ let $t03928339632 = if ((this == feeCollectorAddress))
1121+ then $Tuple2(0, 0)
1122+ else {
1123+ let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
1124+ then true
1125+ else false
1126+ if (paymentInAmountAsset)
1127+ then $Tuple2(-(feeAmount), 0)
1128+ else $Tuple2(0, -(feeAmount))
1129+ }
1130+ let amountAssetBalanceDelta = $t03928339632._1
1131+ let priceAssetBalanceDelta = $t03928339632._2
1132+ let $t03963539743 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1133+ let refreshDLpActions = $t03963539743._1
1134+ let updatedDLp = $t03963539743._2
1135+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1136+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1137+ then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
9661138 else throw("Strict value is not equal to itself.")
9671139 }
968- else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
969- let sendFeeToMatcher = if ((feeAmount > 0))
970- then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
971- else nil
972- $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
1140+ else throw("Strict value is not equal to itself.")
9731141 }
9741142 else throw("Strict value is not equal to itself.")
9751143 }
9891157 then throw("2 pmnts expd")
9901158 else {
9911159 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
1160+ let state = estPut._9
1161+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1162+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1163+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
1164+ if ((currentDLp == currentDLp))
1165+ then {
1166+ let $t04077340838 = refreshDLpInternal(0, 0, 0)
1167+ let refreshDLpActions = $t04077340838._1
1168+ let updatedDLp = $t04077340838._2
1169+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1170+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1171+ then (state ++ refreshDLpActions)
1172+ else throw("Strict value is not equal to itself.")
1173+ }
1174+ else throw("Strict value is not equal to itself.")
9931175 }
9941176
9951177
9961178
9971179 @Callable(i)
9981180 func get () = {
999- let r = cg(i)
1000- let outAmtAmt = r._1
1001- let outPrAmt = r._2
1002- let pmtAmt = r._3
1003- let pmtAssetId = r._4
1004- let state = r._5
1005- let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1006- if ((b == b))
1007- then state
1181+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
1182+ if ((currentDLp == currentDLp))
1183+ then {
1184+ let r = cg(i)
1185+ let outAmtAmt = r._1
1186+ let outPrAmt = r._2
1187+ let pmtAmt = r._3
1188+ let pmtAssetId = r._4
1189+ let state = r._5
1190+ let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1191+ if ((b == b))
1192+ then {
1193+ let $t04162541707 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1194+ let refreshDLpActions = $t04162541707._1
1195+ let updatedDLp = $t04162541707._2
1196+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1197+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1198+ then (state ++ refreshDLpActions)
1199+ else throw("Strict value is not equal to itself.")
1200+ }
1201+ else throw("Strict value is not equal to itself.")
1202+ }
10081203 else throw("Strict value is not equal to itself.")
10091204 }
10101205
10321227 else throwErr("exactly 1 payment are expected")]
10331228 if ((checks == checks))
10341229 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
1230+ let $t04232542480 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1231+ let state = $t04232542480._1
1232+ let totalAmount = $t04232542480._2
10381233 $Tuple2(state, totalAmount)
1234+ }
1235+ else throw("Strict value is not equal to itself.")
1236+ }
1237+
1238+
1239+
1240+@Callable(i)
1241+func refreshDLp () = {
1242+ let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
1243+ let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
1244+ then unit
1245+ else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1246+ if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1247+ then {
1248+ let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1249+ let $t04300443068 = refreshDLpInternal(0, 0, 0)
1250+ let dLpUpdateActions = $t04300443068._1
1251+ let updatedDLp = $t04300443068._2
1252+ let actions = if ((dLp != updatedDLp))
1253+ then dLpUpdateActions
1254+ else throwErr("nothing to refresh")
1255+ $Tuple2(actions, toString(updatedDLp))
10391256 }
10401257 else throw("Strict value is not equal to itself.")
10411258 }
10601277 let newY = getYD(xp, index, D1)
10611278 let dy = (xp[index] - newY)
10621279 let totalGetRaw = max([0, toInt((dy - big1))])
1063- let $t03720337258 = takeFee(totalGetRaw, outFee)
1064- let totalGet = $t03720337258._1
1065- let feeAmount = $t03720337258._2
1280+ let $t04396844017 = takeFee(totalGetRaw)
1281+ let totalGet = $t04396844017._1
1282+ let feeAmount = $t04396844017._2
10661283 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
10671284 }
10681285
10761293 let lpId = poolConfig[idxLPAsId]
10771294 let amBalance = getAccBalance(amId)
10781295 let prBalance = getAccBalance(prId)
1079- let $t03760337718 = {
1296+ let $t04436244477 = {
10801297 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
10811298 if ($isInstanceOf(@, "(Int, Int)"))
10821299 then @
10831300 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
10841301 }
1085- let totalGet = $t03760337718._1
1086- let feeAmount = $t03760337718._2
1302+ let totalGet = $t04436244477._1
1303+ let feeAmount = $t04436244477._2
10871304 let r = ego("", lpId, lpAssetAmount, this)
10881305 let outAmAmt = r._1
10891306 let outPrAmt = r._2
11111328 else if ((noLessThenPriceAsset > outPrAmt))
11121329 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
11131330 else {
1331+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
11141332 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11151333 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1116- then state
1334+ then {
1335+ let $t04564545726 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1336+ let refreshDLpActions = $t04564545726._1
1337+ let updatedDLp = $t04564545726._2
1338+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1339+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1340+ then (state ++ refreshDLpActions)
1341+ else throw("Strict value is not equal to itself.")
1342+ }
11171343 else throw("Strict value is not equal to itself.")
11181344 }
11191345 }
11311357 let factoryCfg = gfc()
11321358 let lpAssetId = fromBase58String(cfg[idxLPAsId])
11331359 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1360+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
11341361 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
11351362 if ((unstakeInv == unstakeInv))
11361363 then {
11371364 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1365+ let outAmAmt = r._1
1366+ let outPrAmt = r._2
11381367 let sts = parseIntValue(r._9)
11391368 let state = r._10
11401369 let v = if (if (igs())
11461375 then {
11471376 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11481377 if ((burnA == burnA))
1149- then state
1378+ then {
1379+ let $t04678946870 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1380+ let refreshDLpActions = $t04678946870._1
1381+ let updatedDLp = $t04678946870._2
1382+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1383+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1384+ then (state ++ refreshDLpActions)
1385+ else throw("Strict value is not equal to itself.")
1386+ }
11501387 else throw("Strict value is not equal to itself.")
11511388 }
11521389 else throw("Strict value is not equal to itself.")
11701407 else throw("no payments are expected")]
11711408 if ((checks == checks))
11721409 then {
1410+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
11731411 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11741412 if ((unstakeInv == unstakeInv))
11751413 then {
11861424 then {
11871425 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11881426 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1189- then state
1427+ then {
1428+ let $t04811848199 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1429+ let refreshDLpActions = $t04811848199._1
1430+ let updatedDLp = $t04811848199._2
1431+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1432+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1433+ then (state ++ refreshDLpActions)
1434+ else throw("Strict value is not equal to itself.")
1435+ }
11901436 else throw("Strict value is not equal to itself.")
11911437 }
11921438 else throw("Strict value is not equal to itself.")
12271473 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
12281474 if ((unstakeInv == unstakeInv))
12291475 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
1476+ let $t04913349321 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1477+ let state = $t04913349321._1
1478+ let totalAmount = $t04913349321._2
12331479 $Tuple2(state, totalAmount)
12341480 }
12351481 else throw("Strict value is not equal to itself.")
12451491 let amId = poolConfig[idxAmAsId]
12461492 let prId = poolConfig[idxPrAsId]
12471493 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
1494+ let $t04958049683 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1495+ let lpAmount = $t04958049683._1
1496+ let state = $t04958049683._2
1497+ let feeAmount = $t04958049683._3
1498+ let bonus = $t04958049683._4
12531499 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
12541500 }
12551501
12611507 let amId = poolConfig[idxAmAsId]
12621508 let prId = poolConfig[idxPrAsId]
12631509 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
1510+ let $t04996250066 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1511+ let lpAmount = $t04996250066._1
1512+ let state = $t04996250066._2
1513+ let feeAmount = $t04996250066._3
1514+ let bonus = $t04996250066._4
12691515 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
12701516 }
12711517
13371583 }
13381584
13391585
1586+
1587+@Callable(i)
1588+func getFeeREADONLY () = $Tuple2(nil, fee)
1589+
1590+
13401591 @Verifier(tx)
13411592 func verify () = {
13421593 let targetPublicKey = match m() {
13501601 match tx {
13511602 case order: Order =>
13521603 let matcherPub = mp()
1353- let orderValid = moa(order)
1604+ let orderValid = validateMatcherOrderAllowed(order)
13541605 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
13551606 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
13561607 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 amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt)
963+ if ((amountAssetBalance == amountAssetBalance))
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 priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt)
966+ if ((priceAssetBalance == priceAssetBalance))
870967 then {
871- let sa = if ((amDiff > 0))
872- then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
873- else nil
874- if ((sa == sa))
968+ let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity)
969+ if ((lpAssetEmission == lpAssetEmission))
875970 then {
876- let sp = if ((prDiff > 0))
877- then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
878- else nil
879- if ((sp == sp))
971+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
972+ if ((currentDLp == currentDLp))
880973 then {
881- let lpTrnsfr = if (autoStake)
974+ 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, "")
975+ let emitLpAmt = e._2
976+ let lpAssetId = e._7
977+ let state = e._9
978+ let amDiff = e._10
979+ let prDiff = e._11
980+ let amId = e._12
981+ let prId = e._13
982+ let r = invoke(fca, "emit", [emitLpAmt], nil)
983+ if ((r == r))
882984 then {
883- let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
884- if ((ss == ss))
885- then nil
985+ let el = match r {
986+ case legacy: Address =>
987+ invoke(legacy, "emit", [emitLpAmt], nil)
988+ case _ =>
989+ unit
990+ }
991+ if ((el == el))
992+ then {
993+ let sa = if ((amDiff > 0))
994+ then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)])
995+ else nil
996+ if ((sa == sa))
997+ then {
998+ let sp = if ((prDiff > 0))
999+ then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)])
1000+ else nil
1001+ if ((sp == sp))
1002+ then {
1003+ let lpTrnsfr = if (autoStake)
1004+ then {
1005+ let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
1006+ if ((ss == ss))
1007+ then nil
1008+ else throw("Strict value is not equal to itself.")
1009+ }
1010+ else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1011+ let $t03627736516 = refreshDLpInternal(0, 0, 0)
1012+ let refreshDLpActions = $t03627736516._1
1013+ let updatedDLp = $t03627736516._2
1014+ let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity
1015+ if ((lpAssetEmissionAfter == lpAssetEmissionAfter))
1016+ then {
1017+ let error = if ((updatedDLp >= currentDLp))
1018+ then true
1019+ else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(emitLpAmt), toString(amDiff), toString(prDiff), toString(lpAssetEmission), toString(lpAssetEmissionAfter)], " "))
1020+ if ((error == error))
1021+ then ((state ++ lpTrnsfr) ++ refreshDLpActions)
1022+ else throw("Strict value is not equal to itself.")
1023+ }
1024+ else throw("Strict value is not equal to itself.")
1025+ }
1026+ else throw("Strict value is not equal to itself.")
1027+ }
1028+ else throw("Strict value is not equal to itself.")
1029+ }
8861030 else throw("Strict value is not equal to itself.")
8871031 }
888- else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
889- (state ++ lpTrnsfr)
1032+ else throw("Strict value is not equal to itself.")
8901033 }
8911034 else throw("Strict value is not equal to itself.")
8921035 }
8931036 else throw("Strict value is not equal to itself.")
8941037 }
8951038 else throw("Strict value is not equal to itself.")
8961039 }
8971040 else throw("Strict value is not equal to itself.")
8981041 }
8991042 }
9001043
9011044
9021045
9031046 @Callable(i)
9041047 func putOneTknV2 (minOutAmount,autoStake) = {
9051048 let isPoolOneTokenOperationsDisabled = {
9061049 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
9071050 if ($isInstanceOf(@, "Boolean"))
9081051 then @
9091052 else throw(($getType(@) + " couldn't be cast to Boolean"))
9101053 }
9111054 let isPutDisabled = if (if (if (igs())
9121055 then true
9131056 else (cfgPoolStatus == PoolPutDis))
9141057 then true
9151058 else (cfgPoolStatus == PoolShutdown))
9161059 then true
9171060 else isPoolOneTokenOperationsDisabled
9181061 let checks = [if (if (!(isPutDisabled))
9191062 then true
9201063 else isManager(i))
9211064 then true
9221065 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
9231066 then true
9241067 else throwErr("exactly 1 payment are expected")]
9251068 if ((checks == checks))
9261069 then {
9271070 let poolConfig = gpc()
9281071 let amId = poolConfig[idxAmAsId]
9291072 let prId = poolConfig[idxPrAsId]
9301073 let lpId = fromBase58String(poolConfig[idxLPAsId])
9311074 let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm])
9321075 let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm])
9331076 let userAddress = if ((i.caller == this))
9341077 then i.originCaller
9351078 else i.caller
9361079 let pmt = value(i.payments[0])
9371080 let pmtAssetId = toBase58String(value(pmt.assetId))
9381081 let pmtAmt = pmt.amount
939- let $t03347833636 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
940- if (($t03347833636 == $t03347833636))
1082+ let currentDLp = if ((pmt.assetId == cfgAmountAssetId))
1083+ then calcCurrentDLp(toBigInt(pmtAmt), toBigInt(0), toBigInt(0))
1084+ else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0))
1085+ if ((currentDLp == currentDLp))
9411086 then {
942- let feeAmount = $t03347833636._3
943- let state = $t03347833636._2
944- let estimLP = $t03347833636._1
945- let emitLpAmt = if (if ((minOutAmount > 0))
946- then (minOutAmount > estimLP)
947- else false)
948- then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
949- else estimLP
950- let e = invoke(fca, "emit", [emitLpAmt], nil)
951- if ((e == e))
1087+ let $t03831038468 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true)
1088+ if (($t03831038468 == $t03831038468))
9521089 then {
953- let el = match e {
954- case legacy: Address =>
955- invoke(legacy, "emit", [emitLpAmt], nil)
956- case _ =>
957- unit
958- }
959- if ((el == el))
1090+ let feeAmount = $t03831038468._3
1091+ let state = $t03831038468._2
1092+ let estimLP = $t03831038468._1
1093+ let emitLpAmt = if (if ((minOutAmount > 0))
1094+ then (minOutAmount > estimLP)
1095+ else false)
1096+ then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
1097+ else estimLP
1098+ let e = invoke(fca, "emit", [emitLpAmt], nil)
1099+ if ((e == e))
9601100 then {
961- let lpTrnsfr = if (autoStake)
1101+ let el = match e {
1102+ case legacy: Address =>
1103+ invoke(legacy, "emit", [emitLpAmt], nil)
1104+ case _ =>
1105+ unit
1106+ }
1107+ if ((el == el))
9621108 then {
963- let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
964- if ((ss == ss))
965- then nil
1109+ let lpTrnsfr = if (autoStake)
1110+ then {
1111+ let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)])
1112+ if ((ss == ss))
1113+ then nil
1114+ else throw("Strict value is not equal to itself.")
1115+ }
1116+ else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
1117+ let sendFeeToMatcher = if ((feeAmount > 0))
1118+ then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
1119+ else nil
1120+ let $t03928339632 = if ((this == feeCollectorAddress))
1121+ then $Tuple2(0, 0)
1122+ else {
1123+ let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId))
1124+ then true
1125+ else false
1126+ if (paymentInAmountAsset)
1127+ then $Tuple2(-(feeAmount), 0)
1128+ else $Tuple2(0, -(feeAmount))
1129+ }
1130+ let amountAssetBalanceDelta = $t03928339632._1
1131+ let priceAssetBalanceDelta = $t03928339632._2
1132+ let $t03963539743 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1133+ let refreshDLpActions = $t03963539743._1
1134+ let updatedDLp = $t03963539743._2
1135+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1136+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1137+ then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt)
9661138 else throw("Strict value is not equal to itself.")
9671139 }
968- else [ScriptTransfer(i.caller, emitLpAmt, lpId)]
969- let sendFeeToMatcher = if ((feeAmount > 0))
970- then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))]
971- else nil
972- $Tuple2(((state ++ lpTrnsfr) ++ sendFeeToMatcher), emitLpAmt)
1140+ else throw("Strict value is not equal to itself.")
9731141 }
9741142 else throw("Strict value is not equal to itself.")
9751143 }
9761144 else throw("Strict value is not equal to itself.")
9771145 }
9781146 else throw("Strict value is not equal to itself.")
9791147 }
9801148 else throw("Strict value is not equal to itself.")
9811149 }
9821150
9831151
9841152
9851153 @Callable(i)
9861154 func putForFree (maxSlpg) = if ((0 > maxSlpg))
9871155 then throw("Wrong slpg")
9881156 else if ((size(i.payments) != 2))
9891157 then throw("2 pmnts expd")
9901158 else {
9911159 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
1160+ let state = estPut._9
1161+ let amAssetPmt = toBigInt(value(i.payments[0]).amount)
1162+ let prAssetPmt = toBigInt(value(i.payments[1]).amount)
1163+ let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0))
1164+ if ((currentDLp == currentDLp))
1165+ then {
1166+ let $t04077340838 = refreshDLpInternal(0, 0, 0)
1167+ let refreshDLpActions = $t04077340838._1
1168+ let updatedDLp = $t04077340838._2
1169+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1170+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1171+ then (state ++ refreshDLpActions)
1172+ else throw("Strict value is not equal to itself.")
1173+ }
1174+ else throw("Strict value is not equal to itself.")
9931175 }
9941176
9951177
9961178
9971179 @Callable(i)
9981180 func get () = {
999- let r = cg(i)
1000- let outAmtAmt = r._1
1001- let outPrAmt = r._2
1002- let pmtAmt = r._3
1003- let pmtAssetId = r._4
1004- let state = r._5
1005- let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1006- if ((b == b))
1007- then state
1181+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
1182+ if ((currentDLp == currentDLp))
1183+ then {
1184+ let r = cg(i)
1185+ let outAmtAmt = r._1
1186+ let outPrAmt = r._2
1187+ let pmtAmt = r._3
1188+ let pmtAssetId = r._4
1189+ let state = r._5
1190+ let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
1191+ if ((b == b))
1192+ then {
1193+ let $t04162541707 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1194+ let refreshDLpActions = $t04162541707._1
1195+ let updatedDLp = $t04162541707._2
1196+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1197+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1198+ then (state ++ refreshDLpActions)
1199+ else throw("Strict value is not equal to itself.")
1200+ }
1201+ else throw("Strict value is not equal to itself.")
1202+ }
10081203 else throw("Strict value is not equal to itself.")
10091204 }
10101205
10111206
10121207
10131208 @Callable(i)
10141209 func getOneTknV2 (outAssetId,minOutAmount) = {
10151210 let isPoolOneTokenOperationsDisabled = {
10161211 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
10171212 if ($isInstanceOf(@, "Boolean"))
10181213 then @
10191214 else throw(($getType(@) + " couldn't be cast to Boolean"))
10201215 }
10211216 let isGetDisabled = if (if (igs())
10221217 then true
10231218 else (cfgPoolStatus == PoolShutdown))
10241219 then true
10251220 else isPoolOneTokenOperationsDisabled
10261221 let checks = [if (if (!(isGetDisabled))
10271222 then true
10281223 else isManager(i))
10291224 then true
10301225 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
10311226 then true
10321227 else throwErr("exactly 1 payment are expected")]
10331228 if ((checks == checks))
10341229 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
1230+ let $t04232542480 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId)
1231+ let state = $t04232542480._1
1232+ let totalAmount = $t04232542480._2
10381233 $Tuple2(state, totalAmount)
1234+ }
1235+ else throw("Strict value is not equal to itself.")
1236+ }
1237+
1238+
1239+
1240+@Callable(i)
1241+func refreshDLp () = {
1242+ let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0)
1243+ let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay))
1244+ then unit
1245+ else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], ""))
1246+ if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
1247+ then {
1248+ let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp"))
1249+ let $t04300443068 = refreshDLpInternal(0, 0, 0)
1250+ let dLpUpdateActions = $t04300443068._1
1251+ let updatedDLp = $t04300443068._2
1252+ let actions = if ((dLp != updatedDLp))
1253+ then dLpUpdateActions
1254+ else throwErr("nothing to refresh")
1255+ $Tuple2(actions, toString(updatedDLp))
10391256 }
10401257 else throw("Strict value is not equal to itself.")
10411258 }
10421259
10431260
10441261
10451262 @Callable(i)
10461263 func getOneTknV2READONLY (outAssetId,lpAssetAmount) = {
10471264 let poolConfig = gpc()
10481265 let amId = poolConfig[idxAmAsId]
10491266 let prId = poolConfig[idxPrAsId]
10501267 let lpId = poolConfig[idxLPAsId]
10511268 let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))]
10521269 let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity)
10531270 let D0 = getD(xp)
10541271 let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission))
10551272 let index = if ((outAssetId == amId))
10561273 then 0
10571274 else if ((outAssetId == prId))
10581275 then 1
10591276 else throw("invalid out asset id")
10601277 let newY = getYD(xp, index, D1)
10611278 let dy = (xp[index] - newY)
10621279 let totalGetRaw = max([0, toInt((dy - big1))])
1063- let $t03720337258 = takeFee(totalGetRaw, outFee)
1064- let totalGet = $t03720337258._1
1065- let feeAmount = $t03720337258._2
1280+ let $t04396844017 = takeFee(totalGetRaw)
1281+ let totalGet = $t04396844017._1
1282+ let feeAmount = $t04396844017._2
10661283 $Tuple2(nil, $Tuple2(totalGet, feeAmount))
10671284 }
10681285
10691286
10701287
10711288 @Callable(i)
10721289 func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = {
10731290 let poolConfig = gpc()
10741291 let amId = poolConfig[idxAmAsId]
10751292 let prId = poolConfig[idxPrAsId]
10761293 let lpId = poolConfig[idxLPAsId]
10771294 let amBalance = getAccBalance(amId)
10781295 let prBalance = getAccBalance(prId)
1079- let $t03760337718 = {
1296+ let $t04436244477 = {
10801297 let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil)
10811298 if ($isInstanceOf(@, "(Int, Int)"))
10821299 then @
10831300 else throw(($getType(@) + " couldn't be cast to (Int, Int)"))
10841301 }
1085- let totalGet = $t03760337718._1
1086- let feeAmount = $t03760337718._2
1302+ let totalGet = $t04436244477._1
1303+ let feeAmount = $t04436244477._2
10871304 let r = ego("", lpId, lpAssetAmount, this)
10881305 let outAmAmt = r._1
10891306 let outPrAmt = r._2
10901307 let sumOfGetAssets = (outAmAmt + outPrAmt)
10911308 let bonus = if ((sumOfGetAssets == 0))
10921309 then if ((totalGet == 0))
10931310 then 0
10941311 else throw("bonus calculation error")
10951312 else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets)
10961313 $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus))
10971314 }
10981315
10991316
11001317
11011318 @Callable(i)
11021319 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
11031320 let r = cg(i)
11041321 let outAmAmt = r._1
11051322 let outPrAmt = r._2
11061323 let pmtAmt = r._3
11071324 let pmtAssetId = r._4
11081325 let state = r._5
11091326 if ((noLessThenAmtAsset > outAmAmt))
11101327 then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
11111328 else if ((noLessThenPriceAsset > outPrAmt))
11121329 then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
11131330 else {
1331+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt))
11141332 let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11151333 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1116- then state
1334+ then {
1335+ let $t04564545726 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1336+ let refreshDLpActions = $t04564545726._1
1337+ let updatedDLp = $t04564545726._2
1338+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1339+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1340+ then (state ++ refreshDLpActions)
1341+ else throw("Strict value is not equal to itself.")
1342+ }
11171343 else throw("Strict value is not equal to itself.")
11181344 }
11191345 }
11201346
11211347
11221348
11231349 @Callable(i)
11241350 func unstakeAndGet (amount) = {
11251351 let checkPayments = if ((size(i.payments) != 0))
11261352 then throw("No pmnts expd")
11271353 else true
11281354 if ((checkPayments == checkPayments))
11291355 then {
11301356 let cfg = gpc()
11311357 let factoryCfg = gfc()
11321358 let lpAssetId = fromBase58String(cfg[idxLPAsId])
11331359 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
1360+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
11341361 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
11351362 if ((unstakeInv == unstakeInv))
11361363 then {
11371364 let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
1365+ let outAmAmt = r._1
1366+ let outPrAmt = r._2
11381367 let sts = parseIntValue(r._9)
11391368 let state = r._10
11401369 let v = if (if (igs())
11411370 then true
11421371 else (sts == PoolShutdown))
11431372 then throw(("Blocked: " + toString(sts)))
11441373 else true
11451374 if ((v == v))
11461375 then {
11471376 let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
11481377 if ((burnA == burnA))
1149- then state
1378+ then {
1379+ let $t04678946870 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1380+ let refreshDLpActions = $t04678946870._1
1381+ let updatedDLp = $t04678946870._2
1382+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1383+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1384+ then (state ++ refreshDLpActions)
1385+ else throw("Strict value is not equal to itself.")
1386+ }
11501387 else throw("Strict value is not equal to itself.")
11511388 }
11521389 else throw("Strict value is not equal to itself.")
11531390 }
11541391 else throw("Strict value is not equal to itself.")
11551392 }
11561393 else throw("Strict value is not equal to itself.")
11571394 }
11581395
11591396
11601397
11611398 @Callable(i)
11621399 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
11631400 let isGetDisabled = if (igs())
11641401 then true
11651402 else (cfgPoolStatus == PoolShutdown)
11661403 let checks = [if (!(isGetDisabled))
11671404 then true
11681405 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
11691406 then true
11701407 else throw("no payments are expected")]
11711408 if ((checks == checks))
11721409 then {
1410+ let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0))
11731411 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11741412 if ((unstakeInv == unstakeInv))
11751413 then {
11761414 let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
11771415 let outAmAmt = res._1
11781416 let outPrAmt = res._2
11791417 let state = res._10
11801418 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
11811419 then true
11821420 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
11831421 then true
11841422 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
11851423 if ((checkAmounts == checkAmounts))
11861424 then {
11871425 let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11881426 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
1189- then state
1427+ then {
1428+ let $t04811848199 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0)
1429+ let refreshDLpActions = $t04811848199._1
1430+ let updatedDLp = $t04811848199._2
1431+ let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp)
1432+ if ((isUpdatedDLpValid == isUpdatedDLpValid))
1433+ then (state ++ refreshDLpActions)
1434+ else throw("Strict value is not equal to itself.")
1435+ }
11901436 else throw("Strict value is not equal to itself.")
11911437 }
11921438 else throw("Strict value is not equal to itself.")
11931439 }
11941440 else throw("Strict value is not equal to itself.")
11951441 }
11961442 else throw("Strict value is not equal to itself.")
11971443 }
11981444
11991445
12001446
12011447 @Callable(i)
12021448 func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = {
12031449 let isPoolOneTokenOperationsDisabled = {
12041450 let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12051451 if ($isInstanceOf(@, "Boolean"))
12061452 then @
12071453 else throw(($getType(@) + " couldn't be cast to Boolean"))
12081454 }
12091455 let isGetDisabled = if (if (igs())
12101456 then true
12111457 else (cfgPoolStatus == PoolShutdown))
12121458 then true
12131459 else isPoolOneTokenOperationsDisabled
12141460 let checks = [if (if (!(isGetDisabled))
12151461 then true
12161462 else isManager(i))
12171463 then true
12181464 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
12191465 then true
12201466 else throwErr("no payments are expected")]
12211467 if ((checks == checks))
12221468 then {
12231469 let cfg = gpc()
12241470 let factoryCfg = gfc()
12251471 let lpAssetId = fromBase58String(cfg[idxLPAsId])
12261472 let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
12271473 let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil)
12281474 if ((unstakeInv == unstakeInv))
12291475 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
1476+ let $t04913349321 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId)
1477+ let state = $t04913349321._1
1478+ let totalAmount = $t04913349321._2
12331479 $Tuple2(state, totalAmount)
12341480 }
12351481 else throw("Strict value is not equal to itself.")
12361482 }
12371483 else throw("Strict value is not equal to itself.")
12381484 }
12391485
12401486
12411487
12421488 @Callable(i)
12431489 func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = {
12441490 let poolConfig = gpc()
12451491 let amId = poolConfig[idxAmAsId]
12461492 let prId = poolConfig[idxPrAsId]
12471493 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
1494+ let $t04958049683 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true)
1495+ let lpAmount = $t04958049683._1
1496+ let state = $t04958049683._2
1497+ let feeAmount = $t04958049683._3
1498+ let bonus = $t04958049683._4
12531499 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
12541500 }
12551501
12561502
12571503
12581504 @Callable(i)
12591505 func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = {
12601506 let poolConfig = gpc()
12611507 let amId = poolConfig[idxAmAsId]
12621508 let prId = poolConfig[idxPrAsId]
12631509 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
1510+ let $t04996250066 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false)
1511+ let lpAmount = $t04996250066._1
1512+ let state = $t04996250066._2
1513+ let feeAmount = $t04996250066._3
1514+ let bonus = $t04996250066._4
12691515 $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus))
12701516 }
12711517
12721518
12731519
12741520 @Callable(i)
12751521 func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca)))
12761522 then throw("denied")
12771523 else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success")
12781524
12791525
12801526
12811527 @Callable(i)
12821528 func setS (k,v) = if ((toString(i.caller) != strf(this, ada())))
12831529 then pd
12841530 else [StringEntry(k, v)]
12851531
12861532
12871533
12881534 @Callable(i)
12891535 func setI (k,v) = if ((toString(i.caller) != strf(this, ada())))
12901536 then pd
12911537 else [IntegerEntry(k, v)]
12921538
12931539
12941540
12951541 @Callable(i)
12961542 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc())
12971543
12981544
12991545
13001546 @Callable(i)
13011547 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
13021548
13031549
13041550
13051551 @Callable(i)
13061552 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
13071553 let pr = calcPrices(amAmt, prAmt, lpAmt)
13081554 $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])])
13091555 }
13101556
13111557
13121558
13131559 @Callable(i)
13141560 func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult))
13151561
13161562
13171563
13181564 @Callable(i)
13191565 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult)))
13201566
13211567
13221568
13231569 @Callable(i)
13241570 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
13251571
13261572
13271573
13281574 @Callable(i)
13291575 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, ""))
13301576
13311577
13321578
13331579 @Callable(i)
13341580 func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = {
13351581 let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr))
13361582 $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10))
13371583 }
13381584
13391585
1586+
1587+@Callable(i)
1588+func getFeeREADONLY () = $Tuple2(nil, fee)
1589+
1590+
13401591 @Verifier(tx)
13411592 func verify () = {
13421593 let targetPublicKey = match m() {
13431594 case pk: ByteVector =>
13441595 pk
13451596 case _: Unit =>
13461597 tx.senderPublicKey
13471598 case _ =>
13481599 throw("Match error")
13491600 }
13501601 match tx {
13511602 case order: Order =>
13521603 let matcherPub = mp()
1353- let orderValid = moa(order)
1604+ let orderValid = validateMatcherOrderAllowed(order)
13541605 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
13551606 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
13561607 if (if (if (orderValid)
13571608 then senderValid
13581609 else false)
13591610 then matcherValid
13601611 else false)
13611612 then true
13621613 else toe(orderValid, senderValid, matcherValid)
13631614 case s: SetScriptTransaction =>
13641615 let newHash = blake2b256(value(s.script))
13651616 let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash())))
13661617 let currentHash = scriptHash(this)
13671618 if (if ((allowedHash == newHash))
13681619 then (currentHash != newHash)
13691620 else false)
13701621 then true
13711622 else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13721623 case _ =>
13731624 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
13741625 }
13751626 }
13761627

github/deemru/w8io/169f3d6 
216.49 ms