tx · BLBA3vLtiyjHLKUWVmc5JyN14V8SNLfPTG6x3vXsqt3o 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT: -0.03500000 Waves 2022.12.06 18:09 [2348646] smart account 3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT > SELF 0.00000000 Waves
{ "type": 13, "id": "BLBA3vLtiyjHLKUWVmc5JyN14V8SNLfPTG6x3vXsqt3o", "fee": 3500000, "feeAssetId": null, "timestamp": 1670339382661, "version": 1, "sender": "3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT", "senderPublicKey": "D1BL65meykxFZTCuq7jq9HSGLLnWvQamQPUNrguW5w39", "proofs": [ "4unsf7LTYYEnakd78V7uMR4twWN9cV5vkgcZLsAbBdGtr5YfJ8jsYDvDjdvWo9UwJbyBXMBPcW96kZhG8mihGHDY" ], "script": "base64:BgKAKAgCEgMKAQgSAwoBCBIAEgQKAgEEEgQKAgEEEgMKAQESABIECgIIARIAEgQKAggBEgQKAggBEgQKAgEBEgMKAQESBQoDAQEBEgUKAwEIARIECgIBCBIECgIBCBIECgIICBIECgIICBIECgIIARIAEgMKAQgSBQoDAQEBEgQKAggBEgQKAgEBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgAiBnNjYWxlOCIMc2NhbGU4QmlnSW50IgdzY2FsZTE4Igp6ZXJvQmlnSW50IgRiaWcwIgRiaWcxIgRiaWcyIgRiaWczIgRiaWc0IgpzbGlwcGFnZTREIgt3YXZlc1N0cmluZyIFQW11bHQiBURjb252IgNTRVAiBUVNUFRZIgpQb29sQWN0aXZlIgpQb29sUHV0RGlzIg5Qb29sTWF0Y2hlckRpcyIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyIJaWR4UG9vbFN0IglpZHhMUEFzSWQiCWlkeEFtQXNJZCIJaWR4UHJBc0lkIgtpZHhBbXRBc0RjbSINaWR4UHJpY2VBc0RjbSILaWR4SUFtdEFzSWQiDWlkeElQcmljZUFzSWQiD2lkeE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aEYDCQABAgUCYUUCBU9yZGVyBAJlUQUCYUUEAmhJCQECYVEABAJoSgkBAmVQAQUCZVEEAmhLCQD0AwMIBQJlUQlib2R5Qnl0ZXMJAJEDAggFAmVRBnByb29mcwAACAUCZVEPc2VuZGVyUHVibGljS2V5BAJoTAkA9AMDCAUCZVEJYm9keUJ5dGVzCQCRAwIIBQJlUQZwcm9vZnMAAQUCaEkDAwMFAmhKBQJoSwcFAmhMBwYJAQJhegMFAmhKBQJoSwUCaEwDCQABAgUCYUUCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJkSQUCYUUEAmhNCQD2AwEJAQV2YWx1ZQEIBQJkSQZzY3JpcHQEAmhOCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYU4JAQJheAAEAmhPCQDxBwEFBHRoaXMDAwkAAAIFAmhOBQJoTQkBAiE9AgUCaE8FAmhNBwYJAPQDAwgFAmhGCWJvZHlCeXRlcwkAkQMCCAUCaEYGcHJvb2ZzAAAFAmhICQD0AwMIBQJoRglib2R5Qnl0ZXMJAJEDAggFAmhGBnByb29mcwAABQJoSDmji/g=", "chainId": 84, "height": 2348646, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: xmkCj8qLuG41Q2sm6CVKrntUn2QmHnvmDXCPfSQFBAa Next: 8XtwNRnqagiFsG2VJMyMrqKe1KecPcFJcoWiXNXrbZev Diff:
Old | New | Differences | |
---|---|---|---|
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | + | ||
18 | + | let big3 = toBigInt(3) | |
19 | + | ||
20 | + | let big4 = toBigInt(4) | |
17 | 21 | ||
18 | 22 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
19 | 23 | ||
209 | 213 | ||
210 | 214 | let poolConfigParsed = parsePoolConfig(gpc()) | |
211 | 215 | ||
212 | - | let $ | |
216 | + | let $t072567442 = poolConfigParsed | |
213 | 217 | ||
214 | - | let cfgPoolAddress = $ | |
218 | + | let cfgPoolAddress = $t072567442._1 | |
215 | 219 | ||
216 | - | let cfgPoolStatus = $ | |
220 | + | let cfgPoolStatus = $t072567442._2 | |
217 | 221 | ||
218 | - | let cfgLpAssetId = $ | |
222 | + | let cfgLpAssetId = $t072567442._3 | |
219 | 223 | ||
220 | - | let cfgAmountAssetId = $ | |
224 | + | let cfgAmountAssetId = $t072567442._4 | |
221 | 225 | ||
222 | - | let cfgPriceAssetId = $ | |
226 | + | let cfgPriceAssetId = $t072567442._5 | |
223 | 227 | ||
224 | - | let cfgAmountAssetDecimals = $ | |
228 | + | let cfgAmountAssetDecimals = $t072567442._6 | |
225 | 229 | ||
226 | - | let cfgPriceAssetDecimals = $ | |
230 | + | let cfgPriceAssetDecimals = $t072567442._7 | |
227 | 231 | ||
228 | 232 | func gfc () = split(strf(fca, fcfg()), SEP) | |
229 | 233 | ||
418 | 422 | else calcLpAmt | |
419 | 423 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
420 | 424 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
421 | - | let $ | |
425 | + | let $t01787318218 = if (if (isOneAsset) | |
422 | 426 | then (pmtId == amIdStr) | |
423 | 427 | else false) | |
424 | 428 | then $Tuple2(pmtAmt, 0) | |
427 | 431 | else false) | |
428 | 432 | then $Tuple2(0, pmtAmt) | |
429 | 433 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
430 | - | let writeAmAmt = $ | |
431 | - | let writePrAmt = $ | |
434 | + | let writeAmAmt = $t01787318218._1 | |
435 | + | let writePrAmt = $t01787318218._2 | |
432 | 436 | 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))] | |
433 | 437 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
434 | 438 | } | |
435 | 439 | } | |
436 | 440 | ||
437 | 441 | ||
442 | + | func getD (xp) = { | |
443 | + | let xp0 = xp[0] | |
444 | + | let xp1 = xp[1] | |
445 | + | let s = (xp0 + xp1) | |
446 | + | if ((s == big0)) | |
447 | + | then big0 | |
448 | + | else { | |
449 | + | let a = parseIntValue(A) | |
450 | + | let ann = (a * 2) | |
451 | + | let p = fraction(xp0, xp1, big1) | |
452 | + | let xp0_xp1_n_n = fraction(p, big4, big1) | |
453 | + | let ann_s = fraction(toBigInt(ann), s, big1) | |
454 | + | let ann_1 = toBigInt((ann - 1)) | |
455 | + | func calcDNext (d) = { | |
456 | + | let dd = fraction(d, d, big1) | |
457 | + | let ddd = fraction(dd, d, big1) | |
458 | + | let dp = fraction(ddd, big1, xp0_xp1_n_n) | |
459 | + | fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1))) | |
460 | + | } | |
461 | + | ||
462 | + | func calc (acc,i) = if (acc._2) | |
463 | + | then acc | |
464 | + | else { | |
465 | + | let d = acc._1 | |
466 | + | let dNext = calcDNext(d) | |
467 | + | let dDiffRaw = toInt((dNext - value(d))) | |
468 | + | let dDiff = if ((0 > dDiffRaw)) | |
469 | + | then -(dDiffRaw) | |
470 | + | else dDiffRaw | |
471 | + | if ((1 >= dDiff)) | |
472 | + | then $Tuple2(dNext, true) | |
473 | + | else $Tuple2(dNext, false) | |
474 | + | } | |
475 | + | ||
476 | + | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
477 | + | let $t02012920177 = { | |
478 | + | let $l = arr | |
479 | + | let $s = size($l) | |
480 | + | let $acc0 = $Tuple2(s, false) | |
481 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
482 | + | then $a | |
483 | + | else calc($a, $l[$i]) | |
484 | + | ||
485 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
486 | + | then $a | |
487 | + | else throw("List size exceeds 15") | |
488 | + | ||
489 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
490 | + | } | |
491 | + | let d = $t02012920177._1 | |
492 | + | let found = $t02012920177._2 | |
493 | + | if (found) | |
494 | + | then d | |
495 | + | else throw(("D calculation error, D = " + toString(d))) | |
496 | + | } | |
497 | + | } | |
498 | + | ||
499 | + | ||
500 | + | func getYD (xp,i,D) = { | |
501 | + | let n = big2 | |
502 | + | let x = xp[if ((i == 0)) | |
503 | + | then 1 | |
504 | + | else 0] | |
505 | + | let aPrecision = parseBigIntValue(Amult) | |
506 | + | let a = (parseBigIntValue(A) * aPrecision) | |
507 | + | let s = x | |
508 | + | let ann = (a * n) | |
509 | + | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
510 | + | let b = ((s + ((D * aPrecision) / ann)) - D) | |
511 | + | func calc (acc,cur) = { | |
512 | + | let $t02066920689 = acc | |
513 | + | let y = $t02066920689._1 | |
514 | + | let found = $t02066920689._2 | |
515 | + | if ((found != unit)) | |
516 | + | then acc | |
517 | + | else { | |
518 | + | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
519 | + | let yDiff = absBigInt((yNext - value(y))) | |
520 | + | if ((big1 >= yDiff)) | |
521 | + | then $Tuple2(yNext, cur) | |
522 | + | else $Tuple2(yNext, unit) | |
523 | + | } | |
524 | + | } | |
525 | + | ||
526 | + | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
527 | + | let $t02099621043 = { | |
528 | + | let $l = arr | |
529 | + | let $s = size($l) | |
530 | + | let $acc0 = $Tuple2(D, unit) | |
531 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
532 | + | then $a | |
533 | + | else calc($a, $l[$i]) | |
534 | + | ||
535 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
536 | + | then $a | |
537 | + | else throw("List size exceeds 15") | |
538 | + | ||
539 | + | $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) | |
540 | + | } | |
541 | + | let y = $t02099621043._1 | |
542 | + | let found = $t02099621043._2 | |
543 | + | if ((found != unit)) | |
544 | + | then y | |
545 | + | else throw(("Y calculation error, Y = " + toString(y))) | |
546 | + | } | |
547 | + | ||
548 | + | ||
438 | 549 | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
439 | - | let updatedDLp = fraction((amountBalance | |
550 | + | let updatedDLp = fraction(getD([amountBalance, priceBalance]), scale18, lpEmission) | |
440 | 551 | updatedDLp | |
441 | 552 | } | |
442 | 553 | ||
465 | 576 | else throwErr("updated KLp lower than current KLp") | |
466 | 577 | ||
467 | 578 | ||
468 | - | func | |
579 | + | func validateMatcherOrderAllowed (order) = { | |
469 | 580 | let amountAssetAmount = order.amount | |
470 | - | let priceAssetAmount = fraction(order.amount, order.price, scale8) | |
471 | - | let $ | |
581 | + | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
582 | + | let $t02294323155 = if ((order.orderType == Buy)) | |
472 | 583 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
473 | 584 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
474 | - | let amountAssetBalanceDelta = $ | |
475 | - | let priceAssetBalanceDelta = $ | |
585 | + | let amountAssetBalanceDelta = $t02294323155._1 | |
586 | + | let priceAssetBalanceDelta = $t02294323155._2 | |
476 | 587 | if (if (if (igs()) | |
477 | 588 | then true | |
478 | 589 | else (cfgPoolStatus == PoolMatcherDis)) | |
484 | 595 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
485 | 596 | then throw("Wr assets") | |
486 | 597 | else { | |
487 | - | let dLp = | |
488 | - | let $ | |
489 | - | let unusedActions = $ | |
490 | - | let dLpNew = $ | |
598 | + | let dLp = parseBigIntValue(getStringValue(this, keyDLp)) | |
599 | + | let $t02348523585 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
600 | + | let unusedActions = $t02348523585._1 | |
601 | + | let dLpNew = $t02348523585._2 | |
491 | 602 | let isOrderValid = (dLpNew > dLp) | |
492 | 603 | isOrderValid | |
493 | 604 | } | |
526 | 637 | } | |
527 | 638 | ||
528 | 639 | ||
529 | - | func getD (xp) = { | |
530 | - | let n = big2 | |
531 | - | let xp0 = xp[0] | |
532 | - | let xp1 = xp[1] | |
533 | - | let aPrecision = parseBigIntValue(Amult) | |
534 | - | let a = (parseBigIntValue(A) * aPrecision) | |
535 | - | let s = (xp0 + xp1) | |
536 | - | if ((s == big0)) | |
537 | - | then big0 | |
538 | - | else { | |
539 | - | let ann = (a * n) | |
540 | - | let xp0_xp1_n_n = (((xp0 * xp1) * n) * n) | |
541 | - | let ann_s_aPrecision = ((ann * s) / aPrecision) | |
542 | - | let ann_aPrecision = (ann - aPrecision) | |
543 | - | let n1 = (n + big1) | |
544 | - | func calc (acc,cur) = { | |
545 | - | let $t02367023690 = acc | |
546 | - | let d = $t02367023690._1 | |
547 | - | let found = $t02367023690._2 | |
548 | - | if ((found != unit)) | |
549 | - | then acc | |
550 | - | else { | |
551 | - | let dp = (((d * d) * d) / xp0_xp1_n_n) | |
552 | - | let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp))) | |
553 | - | let dDiff = absBigInt((dNext - value(d))) | |
554 | - | if ((big1 >= dDiff)) | |
555 | - | then $Tuple2(dNext, cur) | |
556 | - | else $Tuple2(dNext, unit) | |
557 | - | } | |
558 | - | } | |
559 | - | ||
560 | - | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
561 | - | let $t02411124158 = { | |
562 | - | let $l = arr | |
563 | - | let $s = size($l) | |
564 | - | let $acc0 = $Tuple2(s, unit) | |
565 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
566 | - | then $a | |
567 | - | else calc($a, $l[$i]) | |
568 | - | ||
569 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
570 | - | then $a | |
571 | - | else throw("List size exceeds 15") | |
572 | - | ||
573 | - | $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) | |
574 | - | } | |
575 | - | let d = $t02411124158._1 | |
576 | - | let found = $t02411124158._2 | |
577 | - | if ((found != unit)) | |
578 | - | then d | |
579 | - | else throw(("D calculation error, D = " + toString(d))) | |
580 | - | } | |
581 | - | } | |
582 | - | ||
583 | - | ||
584 | - | func getYD (xp,i,D) = { | |
585 | - | let n = big2 | |
586 | - | let x = xp[if ((i == 0)) | |
587 | - | then 1 | |
588 | - | else 0] | |
589 | - | let aPrecision = parseBigIntValue(Amult) | |
590 | - | let a = (parseBigIntValue(A) * aPrecision) | |
591 | - | let s = x | |
592 | - | let ann = (a * n) | |
593 | - | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
594 | - | let b = ((s + ((D * aPrecision) / ann)) - D) | |
595 | - | func calc (acc,cur) = { | |
596 | - | let $t02465824678 = acc | |
597 | - | let y = $t02465824678._1 | |
598 | - | let found = $t02465824678._2 | |
599 | - | if ((found != unit)) | |
600 | - | then acc | |
601 | - | else { | |
602 | - | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
603 | - | let yDiff = absBigInt((yNext - value(y))) | |
604 | - | if ((big1 >= yDiff)) | |
605 | - | then $Tuple2(yNext, cur) | |
606 | - | else $Tuple2(yNext, unit) | |
607 | - | } | |
608 | - | } | |
609 | - | ||
610 | - | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
611 | - | let $t02498525032 = { | |
612 | - | let $l = arr | |
613 | - | let $s = size($l) | |
614 | - | let $acc0 = $Tuple2(D, unit) | |
615 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
616 | - | then $a | |
617 | - | else calc($a, $l[$i]) | |
618 | - | ||
619 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
620 | - | then $a | |
621 | - | else throw("List size exceeds 15") | |
622 | - | ||
623 | - | $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) | |
624 | - | } | |
625 | - | let y = $t02498525032._1 | |
626 | - | let found = $t02498525032._2 | |
627 | - | if ((found != unit)) | |
628 | - | then y | |
629 | - | else throw(("Y calculation error, Y = " + toString(y))) | |
630 | - | } | |
631 | - | ||
632 | - | ||
633 | 640 | func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = { | |
634 | 641 | let poolConfig = gpc() | |
635 | 642 | let amId = poolConfig[idxAmAsId] | |
645 | 652 | then { | |
646 | 653 | let amBalance = getAccBalance(amId) | |
647 | 654 | let prBalance = getAccBalance(prId) | |
648 | - | let $ | |
655 | + | let $t02590126363 = if ((txId == "")) | |
649 | 656 | then $Tuple2(amBalance, prBalance) | |
650 | 657 | else if ((pmtAssetId == amId)) | |
651 | 658 | then if ((pmtAmtRaw > amBalance)) | |
656 | 663 | then throw("invalid payment amount") | |
657 | 664 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
658 | 665 | else throw("wrong pmtAssetId") | |
659 | - | let amBalanceOld = $ | |
660 | - | let prBalanceOld = $ | |
661 | - | let $ | |
666 | + | let amBalanceOld = $t02590126363._1 | |
667 | + | let prBalanceOld = $t02590126363._2 | |
668 | + | let $t02636926545 = if ((pmtAssetId == amId)) | |
662 | 669 | then $Tuple2(pmtAmtRaw, 0) | |
663 | 670 | else if ((pmtAssetId == prId)) | |
664 | 671 | then $Tuple2(0, pmtAmtRaw) | |
665 | 672 | else throw("invalid payment") | |
666 | - | let amAmountRaw = $ | |
667 | - | let prAmountRaw = $ | |
668 | - | let $ | |
673 | + | let amAmountRaw = $t02636926545._1 | |
674 | + | let prAmountRaw = $t02636926545._2 | |
675 | + | let $t02654926788 = if (withTakeFee) | |
669 | 676 | then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2) | |
670 | 677 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
671 | - | let amAmount = $ | |
672 | - | let prAmount = $ | |
673 | - | let feeAmount = $ | |
678 | + | let amAmount = $t02654926788._1 | |
679 | + | let prAmount = $t02654926788._2 | |
680 | + | let feeAmount = $t02654926788._3 | |
674 | 681 | let amBalanceNew = (amBalanceOld + amAmount) | |
675 | 682 | let prBalanceNew = (prBalanceOld + prAmount) | |
676 | 683 | let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)]) | |
717 | 724 | else { | |
718 | 725 | let amBalance = getAccBalance(amId) | |
719 | 726 | let prBalance = getAccBalance(prId) | |
720 | - | let $ | |
727 | + | let $t02887228983 = { | |
721 | 728 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
722 | 729 | if ($isInstanceOf(@, "(Int, Int)")) | |
723 | 730 | then @ | |
724 | 731 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
725 | 732 | } | |
726 | - | if (($ | |
733 | + | if (($t02887228983 == $t02887228983)) | |
727 | 734 | then { | |
728 | - | let feeAmount = $ | |
729 | - | let totalGet = $ | |
735 | + | let feeAmount = $t02887228983._2 | |
736 | + | let totalGet = $t02887228983._1 | |
730 | 737 | let totalAmount = if (if ((minOutAmount > 0)) | |
731 | 738 | then (minOutAmount > totalGet) | |
732 | 739 | else false) | |
733 | 740 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
734 | 741 | else totalGet | |
735 | - | let $ | |
742 | + | let $t02917329480 = if ((outAssetId == amId)) | |
736 | 743 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
737 | 744 | else if ((outAssetId == prId)) | |
738 | 745 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
739 | 746 | else throw("invalid out asset id") | |
740 | - | let outAm = $ | |
741 | - | let outPr = $ | |
742 | - | let amBalanceNew = $ | |
743 | - | let prBalanceNew = $ | |
747 | + | let outAm = $t02917329480._1 | |
748 | + | let outPr = $t02917329480._2 | |
749 | + | let amBalanceNew = $t02917329480._3 | |
750 | + | let prBalanceNew = $t02917329480._4 | |
744 | 751 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
745 | 752 | let curPr = f1(curPrX18, scale8) | |
746 | 753 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
755 | 762 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
756 | 763 | if ((burn == burn)) | |
757 | 764 | then { | |
758 | - | let $ | |
765 | + | let $t03026530615 = { | |
759 | 766 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
760 | 767 | then 0 | |
761 | 768 | else feeAmount | |
766 | 773 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
767 | 774 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
768 | 775 | } | |
769 | - | let amountAssetBalanceDelta = $ | |
770 | - | let priceAssetBalanceDelta = $ | |
771 | - | let $ | |
772 | - | let refreshDLpActions = $ | |
773 | - | let updatedDLp = $ | |
776 | + | let amountAssetBalanceDelta = $t03026530615._1 | |
777 | + | let priceAssetBalanceDelta = $t03026530615._2 | |
778 | + | let $t03061830726 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
779 | + | let refreshDLpActions = $t03061830726._1 | |
780 | + | let updatedDLp = $t03061830726._2 | |
774 | 781 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
775 | 782 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
776 | 783 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
928 | 935 | else throw("Strict value is not equal to itself.") | |
929 | 936 | } | |
930 | 937 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
931 | - | let $ | |
932 | - | let refreshDLpActions = $ | |
933 | - | let updatedDLp = $ | |
938 | + | let $t03458234647 = refreshDLpInternal(0, 0, 0) | |
939 | + | let refreshDLpActions = $t03458234647._1 | |
940 | + | let updatedDLp = $t03458234647._2 | |
934 | 941 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
935 | 942 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
936 | 943 | then ((state ++ lpTrnsfr) ++ refreshDLpActions) | |
986 | 993 | let pmt = value(i.payments[0]) | |
987 | 994 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
988 | 995 | let pmtAmt = pmt.amount | |
989 | - | let $ | |
990 | - | if (($ | |
996 | + | let $t03578435942 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
997 | + | if (($t03578435942 == $t03578435942)) | |
991 | 998 | then { | |
992 | - | let feeAmount = $ | |
993 | - | let state = $ | |
994 | - | let estimLP = $ | |
999 | + | let feeAmount = $t03578435942._3 | |
1000 | + | let state = $t03578435942._2 | |
1001 | + | let estimLP = $t03578435942._1 | |
995 | 1002 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
996 | 1003 | then (minOutAmount > estimLP) | |
997 | 1004 | else false) | |
1019 | 1026 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1020 | 1027 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1021 | 1028 | else nil | |
1022 | - | let $ | |
1029 | + | let $t03675737106 = if ((this == feeCollectorAddress)) | |
1023 | 1030 | then $Tuple2(0, 0) | |
1024 | 1031 | else { | |
1025 | 1032 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1029 | 1036 | then $Tuple2(-(feeAmount), 0) | |
1030 | 1037 | else $Tuple2(0, -(feeAmount)) | |
1031 | 1038 | } | |
1032 | - | let amountAssetBalanceDelta = $ | |
1033 | - | let priceAssetBalanceDelta = $ | |
1034 | - | let $ | |
1035 | - | let refreshDLpActions = $ | |
1036 | - | let updatedDLp = $ | |
1039 | + | let amountAssetBalanceDelta = $t03675737106._1 | |
1040 | + | let priceAssetBalanceDelta = $t03675737106._2 | |
1041 | + | let $t03710937217 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1042 | + | let refreshDLpActions = $t03710937217._1 | |
1043 | + | let updatedDLp = $t03710937217._2 | |
1037 | 1044 | $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1038 | 1045 | } | |
1039 | 1046 | else throw("Strict value is not equal to itself.") | |
1060 | 1067 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1061 | 1068 | if ((currentDLp == currentDLp)) | |
1062 | 1069 | then { | |
1063 | - | let $ | |
1064 | - | let refreshDLpActions = $ | |
1065 | - | let updatedDLp = $ | |
1070 | + | let $t03817638241 = refreshDLpInternal(0, 0, 0) | |
1071 | + | let refreshDLpActions = $t03817638241._1 | |
1072 | + | let updatedDLp = $t03817638241._2 | |
1066 | 1073 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1067 | 1074 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1068 | 1075 | then (state ++ refreshDLpActions) | |
1085 | 1092 | if ((b == b)) | |
1086 | 1093 | then { | |
1087 | 1094 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt)) | |
1088 | - | let $ | |
1089 | - | let refreshDLpActions = $ | |
1090 | - | let updatedDLp = $ | |
1095 | + | let $t03903039112 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1096 | + | let refreshDLpActions = $t03903039112._1 | |
1097 | + | let updatedDLp = $t03903039112._2 | |
1091 | 1098 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1092 | 1099 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1093 | 1100 | then (state ++ refreshDLpActions) | |
1120 | 1127 | else throwErr("exactly 1 payment are expected")] | |
1121 | 1128 | if ((checks == checks)) | |
1122 | 1129 | then { | |
1123 | - | let $ | |
1124 | - | let state = $ | |
1125 | - | let totalAmount = $ | |
1130 | + | let $t03973039885 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1131 | + | let state = $t03973039885._1 | |
1132 | + | let totalAmount = $t03973039885._2 | |
1126 | 1133 | $Tuple2(state, totalAmount) | |
1127 | 1134 | } | |
1128 | 1135 | else throw("Strict value is not equal to itself.") | |
1139 | 1146 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1140 | 1147 | then { | |
1141 | 1148 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1142 | - | let $ | |
1143 | - | let dLpUpdateActions = $ | |
1144 | - | let updatedDLp = $ | |
1149 | + | let $t04040940473 = refreshDLpInternal(0, 0, 0) | |
1150 | + | let dLpUpdateActions = $t04040940473._1 | |
1151 | + | let updatedDLp = $t04040940473._2 | |
1145 | 1152 | let actions = if ((dLp != updatedDLp)) | |
1146 | 1153 | then dLpUpdateActions | |
1147 | 1154 | else throwErr("nothing to refresh") | |
1170 | 1177 | let newY = getYD(xp, index, D1) | |
1171 | 1178 | let dy = (xp[index] - newY) | |
1172 | 1179 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1173 | - | let $ | |
1174 | - | let totalGet = $ | |
1175 | - | let feeAmount = $ | |
1180 | + | let $t04137341422 = takeFee(totalGetRaw) | |
1181 | + | let totalGet = $t04137341422._1 | |
1182 | + | let feeAmount = $t04137341422._2 | |
1176 | 1183 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1177 | 1184 | } | |
1178 | 1185 | ||
1186 | 1193 | let lpId = poolConfig[idxLPAsId] | |
1187 | 1194 | let amBalance = getAccBalance(amId) | |
1188 | 1195 | let prBalance = getAccBalance(prId) | |
1189 | - | let $ | |
1196 | + | let $t04176741882 = { | |
1190 | 1197 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1191 | 1198 | if ($isInstanceOf(@, "(Int, Int)")) | |
1192 | 1199 | then @ | |
1193 | 1200 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1194 | 1201 | } | |
1195 | - | let totalGet = $ | |
1196 | - | let feeAmount = $ | |
1202 | + | let totalGet = $t04176741882._1 | |
1203 | + | let feeAmount = $t04176741882._2 | |
1197 | 1204 | let r = ego("", lpId, lpAssetAmount, this) | |
1198 | 1205 | let outAmAmt = r._1 | |
1199 | 1206 | let outPrAmt = r._2 | |
1225 | 1232 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1226 | 1233 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1227 | 1234 | then { | |
1228 | - | let $ | |
1229 | - | let refreshDLpActions = $ | |
1230 | - | let updatedDLp = $ | |
1235 | + | let $t04305043131 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1236 | + | let refreshDLpActions = $t04305043131._1 | |
1237 | + | let updatedDLp = $t04305043131._2 | |
1231 | 1238 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1232 | 1239 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1233 | 1240 | then (state ++ refreshDLpActions) | |
1269 | 1276 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1270 | 1277 | if ((burnA == burnA)) | |
1271 | 1278 | then { | |
1272 | - | let $ | |
1273 | - | let refreshDLpActions = $ | |
1274 | - | let updatedDLp = $ | |
1279 | + | let $t04419444275 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1280 | + | let refreshDLpActions = $t04419444275._1 | |
1281 | + | let updatedDLp = $t04419444275._2 | |
1275 | 1282 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1276 | 1283 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1277 | 1284 | then (state ++ refreshDLpActions) | |
1318 | 1325 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1319 | 1326 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1320 | 1327 | then { | |
1321 | - | let $ | |
1322 | - | let refreshDLpActions = $ | |
1323 | - | let updatedDLp = $ | |
1328 | + | let $t04552345604 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1329 | + | let refreshDLpActions = $t04552345604._1 | |
1330 | + | let updatedDLp = $t04552345604._2 | |
1324 | 1331 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1325 | 1332 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1326 | 1333 | then (state ++ refreshDLpActions) | |
1366 | 1373 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1367 | 1374 | if ((unstakeInv == unstakeInv)) | |
1368 | 1375 | then { | |
1369 | - | let $ | |
1370 | - | let state = $ | |
1371 | - | let totalAmount = $ | |
1376 | + | let $t04653846726 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1377 | + | let state = $t04653846726._1 | |
1378 | + | let totalAmount = $t04653846726._2 | |
1372 | 1379 | $Tuple2(state, totalAmount) | |
1373 | 1380 | } | |
1374 | 1381 | else throw("Strict value is not equal to itself.") | |
1384 | 1391 | let amId = poolConfig[idxAmAsId] | |
1385 | 1392 | let prId = poolConfig[idxPrAsId] | |
1386 | 1393 | let lpId = poolConfig[idxLPAsId] | |
1387 | - | let $ | |
1388 | - | let lpAmount = $ | |
1389 | - | let state = $ | |
1390 | - | let feeAmount = $ | |
1391 | - | let bonus = $ | |
1394 | + | let $t04698547088 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1395 | + | let lpAmount = $t04698547088._1 | |
1396 | + | let state = $t04698547088._2 | |
1397 | + | let feeAmount = $t04698547088._3 | |
1398 | + | let bonus = $t04698547088._4 | |
1392 | 1399 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1393 | 1400 | } | |
1394 | 1401 | ||
1400 | 1407 | let amId = poolConfig[idxAmAsId] | |
1401 | 1408 | let prId = poolConfig[idxPrAsId] | |
1402 | 1409 | let lpId = poolConfig[idxLPAsId] | |
1403 | - | let $ | |
1404 | - | let lpAmount = $ | |
1405 | - | let state = $ | |
1406 | - | let feeAmount = $ | |
1407 | - | let bonus = $ | |
1410 | + | let $t04736747471 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1411 | + | let lpAmount = $t04736747471._1 | |
1412 | + | let state = $t04736747471._2 | |
1413 | + | let feeAmount = $t04736747471._3 | |
1414 | + | let bonus = $t04736747471._4 | |
1408 | 1415 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1409 | 1416 | } | |
1410 | 1417 | ||
1494 | 1501 | match tx { | |
1495 | 1502 | case order: Order => | |
1496 | 1503 | let matcherPub = mp() | |
1497 | - | let orderValid = | |
1504 | + | let orderValid = validateMatcherOrderAllowed(order) | |
1498 | 1505 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1499 | 1506 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1500 | 1507 | if (if (if (orderValid) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let scale8BigInt = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | let scale18 = toBigInt(1000000000000000000) | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let big0 = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | + | ||
18 | + | let big3 = toBigInt(3) | |
19 | + | ||
20 | + | let big4 = toBigInt(4) | |
17 | 21 | ||
18 | 22 | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
19 | 23 | ||
20 | 24 | let wavesString = "WAVES" | |
21 | 25 | ||
22 | 26 | let Amult = "100" | |
23 | 27 | ||
24 | 28 | let Dconv = "1" | |
25 | 29 | ||
26 | 30 | let SEP = "__" | |
27 | 31 | ||
28 | 32 | let EMPTY = "" | |
29 | 33 | ||
30 | 34 | let PoolActive = 1 | |
31 | 35 | ||
32 | 36 | let PoolPutDis = 2 | |
33 | 37 | ||
34 | 38 | let PoolMatcherDis = 3 | |
35 | 39 | ||
36 | 40 | let PoolShutdown = 4 | |
37 | 41 | ||
38 | 42 | let idxPoolAddress = 1 | |
39 | 43 | ||
40 | 44 | let idxPoolSt = 2 | |
41 | 45 | ||
42 | 46 | let idxLPAsId = 3 | |
43 | 47 | ||
44 | 48 | let idxAmAsId = 4 | |
45 | 49 | ||
46 | 50 | let idxPrAsId = 5 | |
47 | 51 | ||
48 | 52 | let idxAmtAsDcm = 6 | |
49 | 53 | ||
50 | 54 | let idxPriceAsDcm = 7 | |
51 | 55 | ||
52 | 56 | let idxIAmtAsId = 8 | |
53 | 57 | ||
54 | 58 | let idxIPriceAsId = 9 | |
55 | 59 | ||
56 | 60 | let idxFactStakCntr = 1 | |
57 | 61 | ||
58 | 62 | let idxFactoryRestCntr = 6 | |
59 | 63 | ||
60 | 64 | let idxFactSlippCntr = 7 | |
61 | 65 | ||
62 | 66 | let idxFactGwxRewCntr = 10 | |
63 | 67 | ||
64 | 68 | let feeDefault = fraction(10, scale8, 10000) | |
65 | 69 | ||
66 | 70 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
67 | 71 | ||
68 | 72 | ||
69 | 73 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
70 | 74 | ||
71 | 75 | ||
72 | 76 | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
73 | 77 | ||
74 | 78 | ||
75 | 79 | func abs (val) = if ((zeroBigInt > val)) | |
76 | 80 | then -(val) | |
77 | 81 | else val | |
78 | 82 | ||
79 | 83 | ||
80 | 84 | func absBigInt (val) = if ((zeroBigInt > val)) | |
81 | 85 | then -(val) | |
82 | 86 | else val | |
83 | 87 | ||
84 | 88 | ||
85 | 89 | func fc () = "%s__factoryContract" | |
86 | 90 | ||
87 | 91 | ||
88 | 92 | func mpk () = "%s__managerPublicKey" | |
89 | 93 | ||
90 | 94 | ||
91 | 95 | func pmpk () = "%s__pendingManagerPublicKey" | |
92 | 96 | ||
93 | 97 | ||
94 | 98 | func pl () = "%s%s__price__last" | |
95 | 99 | ||
96 | 100 | ||
97 | 101 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
98 | 102 | ||
99 | 103 | ||
100 | 104 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
101 | 105 | ||
102 | 106 | ||
103 | 107 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
104 | 108 | ||
105 | 109 | ||
106 | 110 | func aa () = "%s__amountAsset" | |
107 | 111 | ||
108 | 112 | ||
109 | 113 | func pa () = "%s__priceAsset" | |
110 | 114 | ||
111 | 115 | ||
112 | 116 | func amp () = "%s__amp" | |
113 | 117 | ||
114 | 118 | ||
115 | 119 | func ada () = "%s__addonAddr" | |
116 | 120 | ||
117 | 121 | ||
118 | 122 | let keyFee = "%s__fee" | |
119 | 123 | ||
120 | 124 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
121 | 125 | ||
122 | 126 | let keyDLp = makeString(["%s", "dLp"], SEP) | |
123 | 127 | ||
124 | 128 | let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP) | |
125 | 129 | ||
126 | 130 | let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP) | |
127 | 131 | ||
128 | 132 | let dLpRefreshDelayDefault = 30 | |
129 | 133 | ||
130 | 134 | let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault) | |
131 | 135 | ||
132 | 136 | func fcfg () = "%s__factoryConfig" | |
133 | 137 | ||
134 | 138 | ||
135 | 139 | func mtpk () = "%s%s__matcher__publicKey" | |
136 | 140 | ||
137 | 141 | ||
138 | 142 | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
139 | 143 | ||
140 | 144 | ||
141 | 145 | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
142 | 146 | ||
143 | 147 | ||
144 | 148 | func aps () = "%s__shutdown" | |
145 | 149 | ||
146 | 150 | ||
147 | 151 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
148 | 152 | ||
149 | 153 | ||
150 | 154 | func keyFeeCollectorAddress () = "%s__feeCollectorAddress" | |
151 | 155 | ||
152 | 156 | ||
153 | 157 | func toe (orV,sendrV,matchV) = throw(((((("Failed: ordValid=" + toString(orV)) + " sndrValid=") + toString(sendrV)) + " mtchrValid=") + toString(matchV))) | |
154 | 158 | ||
155 | 159 | ||
156 | 160 | func str (val) = match val { | |
157 | 161 | case valStr: String => | |
158 | 162 | valStr | |
159 | 163 | case _ => | |
160 | 164 | throw("fail cast to String") | |
161 | 165 | } | |
162 | 166 | ||
163 | 167 | ||
164 | 168 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
165 | 169 | ||
166 | 170 | ||
167 | 171 | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
168 | 172 | ||
169 | 173 | ||
170 | 174 | func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " ")) | |
171 | 175 | ||
172 | 176 | ||
173 | 177 | func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ") | |
174 | 178 | ||
175 | 179 | ||
176 | 180 | let fca = addressFromStringValue(strf(this, fc())) | |
177 | 181 | ||
178 | 182 | let A = strf(this, amp()) | |
179 | 183 | ||
180 | 184 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
181 | 185 | ||
182 | 186 | ||
183 | 187 | func mp () = fromBase58String(strf(fca, mtpk())) | |
184 | 188 | ||
185 | 189 | ||
186 | 190 | let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress())) | |
187 | 191 | ||
188 | 192 | func gpc () = { | |
189 | 193 | let amtAs = strf(this, aa()) | |
190 | 194 | let priceAs = strf(this, pa()) | |
191 | 195 | let iPriceAs = intf(fca, mba(priceAs)) | |
192 | 196 | let iAmtAs = intf(fca, mba(amtAs)) | |
193 | 197 | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
194 | 198 | } | |
195 | 199 | ||
196 | 200 | ||
197 | 201 | func parseAssetId (input) = if ((input == wavesString)) | |
198 | 202 | then unit | |
199 | 203 | else fromBase58String(input) | |
200 | 204 | ||
201 | 205 | ||
202 | 206 | func assetIdToString (input) = if ((input == unit)) | |
203 | 207 | then wavesString | |
204 | 208 | else toBase58String(value(input)) | |
205 | 209 | ||
206 | 210 | ||
207 | 211 | 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])) | |
208 | 212 | ||
209 | 213 | ||
210 | 214 | let poolConfigParsed = parsePoolConfig(gpc()) | |
211 | 215 | ||
212 | - | let $ | |
216 | + | let $t072567442 = poolConfigParsed | |
213 | 217 | ||
214 | - | let cfgPoolAddress = $ | |
218 | + | let cfgPoolAddress = $t072567442._1 | |
215 | 219 | ||
216 | - | let cfgPoolStatus = $ | |
220 | + | let cfgPoolStatus = $t072567442._2 | |
217 | 221 | ||
218 | - | let cfgLpAssetId = $ | |
222 | + | let cfgLpAssetId = $t072567442._3 | |
219 | 223 | ||
220 | - | let cfgAmountAssetId = $ | |
224 | + | let cfgAmountAssetId = $t072567442._4 | |
221 | 225 | ||
222 | - | let cfgPriceAssetId = $ | |
226 | + | let cfgPriceAssetId = $t072567442._5 | |
223 | 227 | ||
224 | - | let cfgAmountAssetDecimals = $ | |
228 | + | let cfgAmountAssetDecimals = $t072567442._6 | |
225 | 229 | ||
226 | - | let cfgPriceAssetDecimals = $ | |
230 | + | let cfgPriceAssetDecimals = $t072567442._7 | |
227 | 231 | ||
228 | 232 | func gfc () = split(strf(fca, fcfg()), SEP) | |
229 | 233 | ||
230 | 234 | ||
231 | 235 | let factoryConfig = gfc() | |
232 | 236 | ||
233 | 237 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
234 | 238 | ||
235 | 239 | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
236 | 240 | ||
237 | 241 | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
238 | 242 | ||
239 | 243 | let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address") | |
240 | 244 | ||
241 | 245 | 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) | |
242 | 246 | ||
243 | 247 | ||
244 | 248 | 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) | |
245 | 249 | ||
246 | 250 | ||
247 | 251 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
248 | 252 | then wavesBalance(this).available | |
249 | 253 | else assetBalance(this, fromBase58String(assetId)) | |
250 | 254 | ||
251 | 255 | ||
252 | 256 | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
253 | 257 | ||
254 | 258 | ||
255 | 259 | func vad (A1,A2,slippage) = { | |
256 | 260 | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
257 | 261 | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
258 | 262 | if (!(pass)) | |
259 | 263 | then throw(("Big slpg: " + toString(diff))) | |
260 | 264 | else $Tuple2(pass, min([A1, A2])) | |
261 | 265 | } | |
262 | 266 | ||
263 | 267 | ||
264 | 268 | func vd (D1,D0,slpg) = { | |
265 | 269 | let diff = fraction(D0, scale8BigInt, D1) | |
266 | 270 | let fail = (slpg > diff) | |
267 | 271 | if (if (fail) | |
268 | 272 | then true | |
269 | 273 | else (D0 > D1)) | |
270 | 274 | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
271 | 275 | else fail | |
272 | 276 | } | |
273 | 277 | ||
274 | 278 | ||
275 | 279 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
276 | 280 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
277 | 281 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
278 | 282 | cpbi(prAsAmtX18, amtAsAmtX18) | |
279 | 283 | } | |
280 | 284 | ||
281 | 285 | ||
282 | 286 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
283 | 287 | let cfg = gpc() | |
284 | 288 | let amtAsDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
285 | 289 | let prAsDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
286 | 290 | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
287 | 291 | let amAmtX18 = t1(amAmt, amtAsDcm) | |
288 | 292 | let prAmtX18 = t1(prAmt, prAsDcm) | |
289 | 293 | let lpAmtX18 = t1(lpAmt, scale8) | |
290 | 294 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
291 | 295 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
292 | 296 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
293 | 297 | } | |
294 | 298 | ||
295 | 299 | ||
296 | 300 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
297 | 301 | let p = calcPrices(amAmt, prAmt, lpAmt) | |
298 | 302 | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
299 | 303 | } | |
300 | 304 | ||
301 | 305 | ||
302 | 306 | func takeFee (amount) = { | |
303 | 307 | let feeAmount = fraction(amount, fee, scale8) | |
304 | 308 | $Tuple2((amount - feeAmount), feeAmount) | |
305 | 309 | } | |
306 | 310 | ||
307 | 311 | ||
308 | 312 | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
309 | 313 | let cfg = gpc() | |
310 | 314 | let lpId = cfg[idxLPAsId] | |
311 | 315 | let amId = cfg[idxAmAsId] | |
312 | 316 | let prId = cfg[idxPrAsId] | |
313 | 317 | let amDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
314 | 318 | let prDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
315 | 319 | let sts = cfg[idxPoolSt] | |
316 | 320 | let lpEmiss = valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "Wrong LP id").quantity | |
317 | 321 | if ((lpId != pmtAssetId)) | |
318 | 322 | then throw("Wrong pmt asset") | |
319 | 323 | else { | |
320 | 324 | let amBalance = getAccBalance(amId) | |
321 | 325 | let amBalanceX18 = t1(amBalance, amDcm) | |
322 | 326 | let prBalance = getAccBalance(prId) | |
323 | 327 | let prBalanceX18 = t1(prBalance, prDcm) | |
324 | 328 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
325 | 329 | let curPrice = f1(curPriceX18, scale8) | |
326 | 330 | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
327 | 331 | let lpEmissX18 = t1(lpEmiss, scale8) | |
328 | 332 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
329 | 333 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
330 | 334 | let outAmAmt = f1(outAmAmtX18, amDcm) | |
331 | 335 | let outPrAmt = f1(outPrAmtX18, prDcm) | |
332 | 336 | let state = if ((txId58 == "")) | |
333 | 337 | then nil | |
334 | 338 | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
335 | 339 | then unit | |
336 | 340 | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
337 | 341 | then unit | |
338 | 342 | 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)] | |
339 | 343 | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
340 | 344 | } | |
341 | 345 | } | |
342 | 346 | ||
343 | 347 | ||
344 | 348 | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
345 | 349 | let cfg = gpc() | |
346 | 350 | let lpId = fromBase58String(cfg[idxLPAsId]) | |
347 | 351 | let amIdStr = cfg[idxAmAsId] | |
348 | 352 | let prIdStr = cfg[idxPrAsId] | |
349 | 353 | let inAmIdStr = cfg[idxIAmtAsId] | |
350 | 354 | let inPrIdStr = cfg[idxIPriceAsId] | |
351 | 355 | let amtDcm = parseIntValue(cfg[idxAmtAsDcm]) | |
352 | 356 | let priceDcm = parseIntValue(cfg[idxPriceAsDcm]) | |
353 | 357 | let sts = cfg[idxPoolSt] | |
354 | 358 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
355 | 359 | let amBalance = if (isEval) | |
356 | 360 | then getAccBalance(amIdStr) | |
357 | 361 | else if (if (isOneAsset) | |
358 | 362 | then (pmtId == amIdStr) | |
359 | 363 | else false) | |
360 | 364 | then (getAccBalance(amIdStr) - pmtAmt) | |
361 | 365 | else if (isOneAsset) | |
362 | 366 | then getAccBalance(amIdStr) | |
363 | 367 | else (getAccBalance(amIdStr) - inAmAmt) | |
364 | 368 | let prBalance = if (isEval) | |
365 | 369 | then getAccBalance(prIdStr) | |
366 | 370 | else if (if (isOneAsset) | |
367 | 371 | then (pmtId == prIdStr) | |
368 | 372 | else false) | |
369 | 373 | then (getAccBalance(prIdStr) - pmtAmt) | |
370 | 374 | else if (isOneAsset) | |
371 | 375 | then getAccBalance(prIdStr) | |
372 | 376 | else (getAccBalance(prIdStr) - inPrAmt) | |
373 | 377 | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
374 | 378 | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
375 | 379 | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
376 | 380 | let amBalanceX18 = t1(amBalance, amtDcm) | |
377 | 381 | let prBalanceX18 = t1(prBalance, priceDcm) | |
378 | 382 | let r = if ((lpEm == 0)) | |
379 | 383 | then { | |
380 | 384 | let curPriceX18 = zeroBigInt | |
381 | 385 | let slippageX18 = zeroBigInt | |
382 | 386 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
383 | 387 | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
384 | 388 | } | |
385 | 389 | else { | |
386 | 390 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
387 | 391 | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
388 | 392 | let slippageX18 = t1(slippage, scale8) | |
389 | 393 | if (if (if (validateSlippage) | |
390 | 394 | then (curPriceX18 != zeroBigInt) | |
391 | 395 | else false) | |
392 | 396 | then (slippageRealX18 > slippageX18) | |
393 | 397 | else false) | |
394 | 398 | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
395 | 399 | else { | |
396 | 400 | let lpEmissionX18 = t1(lpEm, scale8) | |
397 | 401 | let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
398 | 402 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
399 | 403 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
400 | 404 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
401 | 405 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
402 | 406 | let expAmtAssetAmtX18 = expectedAmts._1 | |
403 | 407 | let expPriceAssetAmtX18 = expectedAmts._2 | |
404 | 408 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18) | |
405 | 409 | $Tuple5(f1(lpAmtX18, scale8), f1(expAmtAssetAmtX18, amtDcm), f1(expPriceAssetAmtX18, priceDcm), curPriceX18, slippageX18) | |
406 | 410 | } | |
407 | 411 | } | |
408 | 412 | let calcLpAmt = r._1 | |
409 | 413 | let calcAmAssetPmt = r._2 | |
410 | 414 | let calcPrAssetPmt = r._3 | |
411 | 415 | let curPrice = f1(r._4, scale8) | |
412 | 416 | let slippageCalc = f1(r._5, scale8) | |
413 | 417 | if ((0 >= calcLpAmt)) | |
414 | 418 | then throw("LP <= 0") | |
415 | 419 | else { | |
416 | 420 | let emitLpAmt = if (!(emitLp)) | |
417 | 421 | then 0 | |
418 | 422 | else calcLpAmt | |
419 | 423 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
420 | 424 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
421 | - | let $ | |
425 | + | let $t01787318218 = if (if (isOneAsset) | |
422 | 426 | then (pmtId == amIdStr) | |
423 | 427 | else false) | |
424 | 428 | then $Tuple2(pmtAmt, 0) | |
425 | 429 | else if (if (isOneAsset) | |
426 | 430 | then (pmtId == prIdStr) | |
427 | 431 | else false) | |
428 | 432 | then $Tuple2(0, pmtAmt) | |
429 | 433 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
430 | - | let writeAmAmt = $ | |
431 | - | let writePrAmt = $ | |
434 | + | let writeAmAmt = $t01787318218._1 | |
435 | + | let writePrAmt = $t01787318218._2 | |
432 | 436 | 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))] | |
433 | 437 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
434 | 438 | } | |
435 | 439 | } | |
436 | 440 | ||
437 | 441 | ||
442 | + | func getD (xp) = { | |
443 | + | let xp0 = xp[0] | |
444 | + | let xp1 = xp[1] | |
445 | + | let s = (xp0 + xp1) | |
446 | + | if ((s == big0)) | |
447 | + | then big0 | |
448 | + | else { | |
449 | + | let a = parseIntValue(A) | |
450 | + | let ann = (a * 2) | |
451 | + | let p = fraction(xp0, xp1, big1) | |
452 | + | let xp0_xp1_n_n = fraction(p, big4, big1) | |
453 | + | let ann_s = fraction(toBigInt(ann), s, big1) | |
454 | + | let ann_1 = toBigInt((ann - 1)) | |
455 | + | func calcDNext (d) = { | |
456 | + | let dd = fraction(d, d, big1) | |
457 | + | let ddd = fraction(dd, d, big1) | |
458 | + | let dp = fraction(ddd, big1, xp0_xp1_n_n) | |
459 | + | fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1))) | |
460 | + | } | |
461 | + | ||
462 | + | func calc (acc,i) = if (acc._2) | |
463 | + | then acc | |
464 | + | else { | |
465 | + | let d = acc._1 | |
466 | + | let dNext = calcDNext(d) | |
467 | + | let dDiffRaw = toInt((dNext - value(d))) | |
468 | + | let dDiff = if ((0 > dDiffRaw)) | |
469 | + | then -(dDiffRaw) | |
470 | + | else dDiffRaw | |
471 | + | if ((1 >= dDiff)) | |
472 | + | then $Tuple2(dNext, true) | |
473 | + | else $Tuple2(dNext, false) | |
474 | + | } | |
475 | + | ||
476 | + | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
477 | + | let $t02012920177 = { | |
478 | + | let $l = arr | |
479 | + | let $s = size($l) | |
480 | + | let $acc0 = $Tuple2(s, false) | |
481 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
482 | + | then $a | |
483 | + | else calc($a, $l[$i]) | |
484 | + | ||
485 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
486 | + | then $a | |
487 | + | else throw("List size exceeds 15") | |
488 | + | ||
489 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
490 | + | } | |
491 | + | let d = $t02012920177._1 | |
492 | + | let found = $t02012920177._2 | |
493 | + | if (found) | |
494 | + | then d | |
495 | + | else throw(("D calculation error, D = " + toString(d))) | |
496 | + | } | |
497 | + | } | |
498 | + | ||
499 | + | ||
500 | + | func getYD (xp,i,D) = { | |
501 | + | let n = big2 | |
502 | + | let x = xp[if ((i == 0)) | |
503 | + | then 1 | |
504 | + | else 0] | |
505 | + | let aPrecision = parseBigIntValue(Amult) | |
506 | + | let a = (parseBigIntValue(A) * aPrecision) | |
507 | + | let s = x | |
508 | + | let ann = (a * n) | |
509 | + | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
510 | + | let b = ((s + ((D * aPrecision) / ann)) - D) | |
511 | + | func calc (acc,cur) = { | |
512 | + | let $t02066920689 = acc | |
513 | + | let y = $t02066920689._1 | |
514 | + | let found = $t02066920689._2 | |
515 | + | if ((found != unit)) | |
516 | + | then acc | |
517 | + | else { | |
518 | + | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
519 | + | let yDiff = absBigInt((yNext - value(y))) | |
520 | + | if ((big1 >= yDiff)) | |
521 | + | then $Tuple2(yNext, cur) | |
522 | + | else $Tuple2(yNext, unit) | |
523 | + | } | |
524 | + | } | |
525 | + | ||
526 | + | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
527 | + | let $t02099621043 = { | |
528 | + | let $l = arr | |
529 | + | let $s = size($l) | |
530 | + | let $acc0 = $Tuple2(D, unit) | |
531 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
532 | + | then $a | |
533 | + | else calc($a, $l[$i]) | |
534 | + | ||
535 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
536 | + | then $a | |
537 | + | else throw("List size exceeds 15") | |
538 | + | ||
539 | + | $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) | |
540 | + | } | |
541 | + | let y = $t02099621043._1 | |
542 | + | let found = $t02099621043._2 | |
543 | + | if ((found != unit)) | |
544 | + | then y | |
545 | + | else throw(("Y calculation error, Y = " + toString(y))) | |
546 | + | } | |
547 | + | ||
548 | + | ||
438 | 549 | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
439 | - | let updatedDLp = fraction((amountBalance | |
550 | + | let updatedDLp = fraction(getD([amountBalance, priceBalance]), scale18, lpEmission) | |
440 | 551 | updatedDLp | |
441 | 552 | } | |
442 | 553 | ||
443 | 554 | ||
444 | 555 | func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
445 | 556 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
446 | 557 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
447 | 558 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
448 | 559 | let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
449 | 560 | currentDLp | |
450 | 561 | } | |
451 | 562 | ||
452 | 563 | ||
453 | 564 | func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
454 | 565 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
455 | 566 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
456 | 567 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
457 | 568 | let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
458 | 569 | let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))] | |
459 | 570 | $Tuple2(actions, updatedDLp) | |
460 | 571 | } | |
461 | 572 | ||
462 | 573 | ||
463 | 574 | func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp)) | |
464 | 575 | then true | |
465 | 576 | else throwErr("updated KLp lower than current KLp") | |
466 | 577 | ||
467 | 578 | ||
468 | - | func | |
579 | + | func validateMatcherOrderAllowed (order) = { | |
469 | 580 | let amountAssetAmount = order.amount | |
470 | - | let priceAssetAmount = fraction(order.amount, order.price, scale8) | |
471 | - | let $ | |
581 | + | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
582 | + | let $t02294323155 = if ((order.orderType == Buy)) | |
472 | 583 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
473 | 584 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
474 | - | let amountAssetBalanceDelta = $ | |
475 | - | let priceAssetBalanceDelta = $ | |
585 | + | let amountAssetBalanceDelta = $t02294323155._1 | |
586 | + | let priceAssetBalanceDelta = $t02294323155._2 | |
476 | 587 | if (if (if (igs()) | |
477 | 588 | then true | |
478 | 589 | else (cfgPoolStatus == PoolMatcherDis)) | |
479 | 590 | then true | |
480 | 591 | else (cfgPoolStatus == PoolShutdown)) | |
481 | 592 | then throw("Admin blocked") | |
482 | 593 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
483 | 594 | then true | |
484 | 595 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
485 | 596 | then throw("Wr assets") | |
486 | 597 | else { | |
487 | - | let dLp = | |
488 | - | let $ | |
489 | - | let unusedActions = $ | |
490 | - | let dLpNew = $ | |
598 | + | let dLp = parseBigIntValue(getStringValue(this, keyDLp)) | |
599 | + | let $t02348523585 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
600 | + | let unusedActions = $t02348523585._1 | |
601 | + | let dLpNew = $t02348523585._2 | |
491 | 602 | let isOrderValid = (dLpNew > dLp) | |
492 | 603 | isOrderValid | |
493 | 604 | } | |
494 | 605 | } | |
495 | 606 | ||
496 | 607 | ||
497 | 608 | func cg (i) = if ((size(i.payments) != 1)) | |
498 | 609 | then throw("1 pmnt exp") | |
499 | 610 | else { | |
500 | 611 | let pmt = value(i.payments[0]) | |
501 | 612 | let pmtAssetId = value(pmt.assetId) | |
502 | 613 | let pmtAmt = pmt.amount | |
503 | 614 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
504 | 615 | let outAmAmt = r._1 | |
505 | 616 | let outPrAmt = r._2 | |
506 | 617 | let sts = parseIntValue(r._9) | |
507 | 618 | let state = r._10 | |
508 | 619 | if (if (igs()) | |
509 | 620 | then true | |
510 | 621 | else (sts == PoolShutdown)) | |
511 | 622 | then throw(("Admin blocked: " + toString(sts))) | |
512 | 623 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
513 | 624 | } | |
514 | 625 | ||
515 | 626 | ||
516 | 627 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
517 | 628 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
518 | 629 | let sts = parseIntValue(r._8) | |
519 | 630 | if (if (if (igs()) | |
520 | 631 | then true | |
521 | 632 | else (sts == PoolPutDis)) | |
522 | 633 | then true | |
523 | 634 | else (sts == PoolShutdown)) | |
524 | 635 | then throw(("Blocked:" + toString(sts))) | |
525 | 636 | else r | |
526 | 637 | } | |
527 | 638 | ||
528 | 639 | ||
529 | - | func getD (xp) = { | |
530 | - | let n = big2 | |
531 | - | let xp0 = xp[0] | |
532 | - | let xp1 = xp[1] | |
533 | - | let aPrecision = parseBigIntValue(Amult) | |
534 | - | let a = (parseBigIntValue(A) * aPrecision) | |
535 | - | let s = (xp0 + xp1) | |
536 | - | if ((s == big0)) | |
537 | - | then big0 | |
538 | - | else { | |
539 | - | let ann = (a * n) | |
540 | - | let xp0_xp1_n_n = (((xp0 * xp1) * n) * n) | |
541 | - | let ann_s_aPrecision = ((ann * s) / aPrecision) | |
542 | - | let ann_aPrecision = (ann - aPrecision) | |
543 | - | let n1 = (n + big1) | |
544 | - | func calc (acc,cur) = { | |
545 | - | let $t02367023690 = acc | |
546 | - | let d = $t02367023690._1 | |
547 | - | let found = $t02367023690._2 | |
548 | - | if ((found != unit)) | |
549 | - | then acc | |
550 | - | else { | |
551 | - | let dp = (((d * d) * d) / xp0_xp1_n_n) | |
552 | - | let dNext = (((ann_s_aPrecision + (dp * n)) * d) / (((ann_aPrecision * d) / aPrecision) + (n1 * dp))) | |
553 | - | let dDiff = absBigInt((dNext - value(d))) | |
554 | - | if ((big1 >= dDiff)) | |
555 | - | then $Tuple2(dNext, cur) | |
556 | - | else $Tuple2(dNext, unit) | |
557 | - | } | |
558 | - | } | |
559 | - | ||
560 | - | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
561 | - | let $t02411124158 = { | |
562 | - | let $l = arr | |
563 | - | let $s = size($l) | |
564 | - | let $acc0 = $Tuple2(s, unit) | |
565 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
566 | - | then $a | |
567 | - | else calc($a, $l[$i]) | |
568 | - | ||
569 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
570 | - | then $a | |
571 | - | else throw("List size exceeds 15") | |
572 | - | ||
573 | - | $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) | |
574 | - | } | |
575 | - | let d = $t02411124158._1 | |
576 | - | let found = $t02411124158._2 | |
577 | - | if ((found != unit)) | |
578 | - | then d | |
579 | - | else throw(("D calculation error, D = " + toString(d))) | |
580 | - | } | |
581 | - | } | |
582 | - | ||
583 | - | ||
584 | - | func getYD (xp,i,D) = { | |
585 | - | let n = big2 | |
586 | - | let x = xp[if ((i == 0)) | |
587 | - | then 1 | |
588 | - | else 0] | |
589 | - | let aPrecision = parseBigIntValue(Amult) | |
590 | - | let a = (parseBigIntValue(A) * aPrecision) | |
591 | - | let s = x | |
592 | - | let ann = (a * n) | |
593 | - | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
594 | - | let b = ((s + ((D * aPrecision) / ann)) - D) | |
595 | - | func calc (acc,cur) = { | |
596 | - | let $t02465824678 = acc | |
597 | - | let y = $t02465824678._1 | |
598 | - | let found = $t02465824678._2 | |
599 | - | if ((found != unit)) | |
600 | - | then acc | |
601 | - | else { | |
602 | - | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
603 | - | let yDiff = absBigInt((yNext - value(y))) | |
604 | - | if ((big1 >= yDiff)) | |
605 | - | then $Tuple2(yNext, cur) | |
606 | - | else $Tuple2(yNext, unit) | |
607 | - | } | |
608 | - | } | |
609 | - | ||
610 | - | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
611 | - | let $t02498525032 = { | |
612 | - | let $l = arr | |
613 | - | let $s = size($l) | |
614 | - | let $acc0 = $Tuple2(D, unit) | |
615 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
616 | - | then $a | |
617 | - | else calc($a, $l[$i]) | |
618 | - | ||
619 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
620 | - | then $a | |
621 | - | else throw("List size exceeds 15") | |
622 | - | ||
623 | - | $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) | |
624 | - | } | |
625 | - | let y = $t02498525032._1 | |
626 | - | let found = $t02498525032._2 | |
627 | - | if ((found != unit)) | |
628 | - | then y | |
629 | - | else throw(("Y calculation error, Y = " + toString(y))) | |
630 | - | } | |
631 | - | ||
632 | - | ||
633 | 640 | func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = { | |
634 | 641 | let poolConfig = gpc() | |
635 | 642 | let amId = poolConfig[idxAmAsId] | |
636 | 643 | let prId = poolConfig[idxPrAsId] | |
637 | 644 | let lpId = poolConfig[idxLPAsId] | |
638 | 645 | let amtDcm = parseIntValue(poolConfig[idxAmtAsDcm]) | |
639 | 646 | let priceDcm = parseIntValue(poolConfig[idxPriceAsDcm]) | |
640 | 647 | let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
641 | 648 | let chechEmission = if ((lpAssetEmission > big0)) | |
642 | 649 | then true | |
643 | 650 | else throw("initial deposit requires all coins") | |
644 | 651 | if ((chechEmission == chechEmission)) | |
645 | 652 | then { | |
646 | 653 | let amBalance = getAccBalance(amId) | |
647 | 654 | let prBalance = getAccBalance(prId) | |
648 | - | let $ | |
655 | + | let $t02590126363 = if ((txId == "")) | |
649 | 656 | then $Tuple2(amBalance, prBalance) | |
650 | 657 | else if ((pmtAssetId == amId)) | |
651 | 658 | then if ((pmtAmtRaw > amBalance)) | |
652 | 659 | then throw("invalid payment amount") | |
653 | 660 | else $Tuple2((amBalance - pmtAmtRaw), prBalance) | |
654 | 661 | else if ((pmtAssetId == prId)) | |
655 | 662 | then if ((pmtAmtRaw > prBalance)) | |
656 | 663 | then throw("invalid payment amount") | |
657 | 664 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
658 | 665 | else throw("wrong pmtAssetId") | |
659 | - | let amBalanceOld = $ | |
660 | - | let prBalanceOld = $ | |
661 | - | let $ | |
666 | + | let amBalanceOld = $t02590126363._1 | |
667 | + | let prBalanceOld = $t02590126363._2 | |
668 | + | let $t02636926545 = if ((pmtAssetId == amId)) | |
662 | 669 | then $Tuple2(pmtAmtRaw, 0) | |
663 | 670 | else if ((pmtAssetId == prId)) | |
664 | 671 | then $Tuple2(0, pmtAmtRaw) | |
665 | 672 | else throw("invalid payment") | |
666 | - | let amAmountRaw = $ | |
667 | - | let prAmountRaw = $ | |
668 | - | let $ | |
673 | + | let amAmountRaw = $t02636926545._1 | |
674 | + | let prAmountRaw = $t02636926545._2 | |
675 | + | let $t02654926788 = if (withTakeFee) | |
669 | 676 | then $Tuple3(takeFee(amAmountRaw)._1, takeFee(prAmountRaw)._1, takeFee(pmtAmtRaw)._2) | |
670 | 677 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
671 | - | let amAmount = $ | |
672 | - | let prAmount = $ | |
673 | - | let feeAmount = $ | |
678 | + | let amAmount = $t02654926788._1 | |
679 | + | let prAmount = $t02654926788._2 | |
680 | + | let feeAmount = $t02654926788._3 | |
674 | 681 | let amBalanceNew = (amBalanceOld + amAmount) | |
675 | 682 | let prBalanceNew = (prBalanceOld + prAmount) | |
676 | 683 | let D0 = getD([toBigInt(amBalanceOld), toBigInt(prBalanceOld)]) | |
677 | 684 | let D1 = getD([toBigInt(amBalanceNew), toBigInt(prBalanceNew)]) | |
678 | 685 | let checkD = if ((D1 > D0)) | |
679 | 686 | then true | |
680 | 687 | else throw() | |
681 | 688 | if ((checkD == checkD)) | |
682 | 689 | then { | |
683 | 690 | let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0) | |
684 | 691 | let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8) | |
685 | 692 | 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))] | |
686 | 693 | let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld) | |
687 | 694 | let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8)) | |
688 | 695 | let priceAssetPart = (pmtAmtRaw - amountAssetPart) | |
689 | 696 | let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld)) | |
690 | 697 | let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)) | |
691 | 698 | $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus) | |
692 | 699 | } | |
693 | 700 | else throw("Strict value is not equal to itself.") | |
694 | 701 | } | |
695 | 702 | else throw("Strict value is not equal to itself.") | |
696 | 703 | } | |
697 | 704 | ||
698 | 705 | ||
699 | 706 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = { | |
700 | 707 | let poolConfig = gpc() | |
701 | 708 | let lpId = poolConfig[idxLPAsId] | |
702 | 709 | let amId = poolConfig[idxAmAsId] | |
703 | 710 | let prId = poolConfig[idxPrAsId] | |
704 | 711 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
705 | 712 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
706 | 713 | let poolStatus = poolConfig[idxPoolSt] | |
707 | 714 | let userAddress = if ((caller == restContract)) | |
708 | 715 | then originCaller | |
709 | 716 | else caller | |
710 | 717 | let pmt = value(payments[0]) | |
711 | 718 | let pmtAssetId = value(pmt.assetId) | |
712 | 719 | let pmtAmt = pmt.amount | |
713 | 720 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt)) | |
714 | 721 | let txId58 = toBase58String(transactionId) | |
715 | 722 | if ((lpId != toBase58String(pmtAssetId))) | |
716 | 723 | then throw("Wrong LP") | |
717 | 724 | else { | |
718 | 725 | let amBalance = getAccBalance(amId) | |
719 | 726 | let prBalance = getAccBalance(prId) | |
720 | - | let $ | |
727 | + | let $t02887228983 = { | |
721 | 728 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
722 | 729 | if ($isInstanceOf(@, "(Int, Int)")) | |
723 | 730 | then @ | |
724 | 731 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
725 | 732 | } | |
726 | - | if (($ | |
733 | + | if (($t02887228983 == $t02887228983)) | |
727 | 734 | then { | |
728 | - | let feeAmount = $ | |
729 | - | let totalGet = $ | |
735 | + | let feeAmount = $t02887228983._2 | |
736 | + | let totalGet = $t02887228983._1 | |
730 | 737 | let totalAmount = if (if ((minOutAmount > 0)) | |
731 | 738 | then (minOutAmount > totalGet) | |
732 | 739 | else false) | |
733 | 740 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
734 | 741 | else totalGet | |
735 | - | let $ | |
742 | + | let $t02917329480 = if ((outAssetId == amId)) | |
736 | 743 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
737 | 744 | else if ((outAssetId == prId)) | |
738 | 745 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
739 | 746 | else throw("invalid out asset id") | |
740 | - | let outAm = $ | |
741 | - | let outPr = $ | |
742 | - | let amBalanceNew = $ | |
743 | - | let prBalanceNew = $ | |
747 | + | let outAm = $t02917329480._1 | |
748 | + | let outPr = $t02917329480._2 | |
749 | + | let amBalanceNew = $t02917329480._3 | |
750 | + | let prBalanceNew = $t02917329480._4 | |
744 | 751 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
745 | 752 | let curPr = f1(curPrX18, scale8) | |
746 | 753 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
747 | 754 | then unit | |
748 | 755 | else fromBase58String(outAssetId) | |
749 | 756 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
750 | 757 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
751 | 758 | else nil | |
752 | 759 | 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) | |
753 | 760 | if ((state == state)) | |
754 | 761 | then { | |
755 | 762 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
756 | 763 | if ((burn == burn)) | |
757 | 764 | then { | |
758 | - | let $ | |
765 | + | let $t03026530615 = { | |
759 | 766 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
760 | 767 | then 0 | |
761 | 768 | else feeAmount | |
762 | 769 | let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId)) | |
763 | 770 | then true | |
764 | 771 | else false | |
765 | 772 | if (outInAmountAsset) | |
766 | 773 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
767 | 774 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
768 | 775 | } | |
769 | - | let amountAssetBalanceDelta = $ | |
770 | - | let priceAssetBalanceDelta = $ | |
771 | - | let $ | |
772 | - | let refreshDLpActions = $ | |
773 | - | let updatedDLp = $ | |
776 | + | let amountAssetBalanceDelta = $t03026530615._1 | |
777 | + | let priceAssetBalanceDelta = $t03026530615._2 | |
778 | + | let $t03061830726 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
779 | + | let refreshDLpActions = $t03061830726._1 | |
780 | + | let updatedDLp = $t03061830726._2 | |
774 | 781 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
775 | 782 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
776 | 783 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
777 | 784 | else throw("Strict value is not equal to itself.") | |
778 | 785 | } | |
779 | 786 | else throw("Strict value is not equal to itself.") | |
780 | 787 | } | |
781 | 788 | else throw("Strict value is not equal to itself.") | |
782 | 789 | } | |
783 | 790 | else throw("Strict value is not equal to itself.") | |
784 | 791 | } | |
785 | 792 | } | |
786 | 793 | ||
787 | 794 | ||
788 | 795 | func m () = match getString(mpk()) { | |
789 | 796 | case s: String => | |
790 | 797 | fromBase58String(s) | |
791 | 798 | case _: Unit => | |
792 | 799 | unit | |
793 | 800 | case _ => | |
794 | 801 | throw("Match error") | |
795 | 802 | } | |
796 | 803 | ||
797 | 804 | ||
798 | 805 | func pm () = match getString(pmpk()) { | |
799 | 806 | case s: String => | |
800 | 807 | fromBase58String(s) | |
801 | 808 | case _: Unit => | |
802 | 809 | unit | |
803 | 810 | case _ => | |
804 | 811 | throw("Match error") | |
805 | 812 | } | |
806 | 813 | ||
807 | 814 | ||
808 | 815 | let pd = throw("Permission denied") | |
809 | 816 | ||
810 | 817 | func isManager (i) = match m() { | |
811 | 818 | case pk: ByteVector => | |
812 | 819 | (i.callerPublicKey == pk) | |
813 | 820 | case _: Unit => | |
814 | 821 | (i.caller == this) | |
815 | 822 | case _ => | |
816 | 823 | throw("Match error") | |
817 | 824 | } | |
818 | 825 | ||
819 | 826 | ||
820 | 827 | func mm (i) = match m() { | |
821 | 828 | case pk: ByteVector => | |
822 | 829 | if ((i.callerPublicKey == pk)) | |
823 | 830 | then true | |
824 | 831 | else pd | |
825 | 832 | case _: Unit => | |
826 | 833 | if ((i.caller == this)) | |
827 | 834 | then true | |
828 | 835 | else pd | |
829 | 836 | case _ => | |
830 | 837 | throw("Match error") | |
831 | 838 | } | |
832 | 839 | ||
833 | 840 | ||
834 | 841 | @Callable(i) | |
835 | 842 | func constructor (fc) = { | |
836 | 843 | let c = mm(i) | |
837 | 844 | if ((c == c)) | |
838 | 845 | then [StringEntry(fc(), fc)] | |
839 | 846 | else throw("Strict value is not equal to itself.") | |
840 | 847 | } | |
841 | 848 | ||
842 | 849 | ||
843 | 850 | ||
844 | 851 | @Callable(i) | |
845 | 852 | func setManager (pendingManagerPublicKey) = { | |
846 | 853 | let c = mm(i) | |
847 | 854 | if ((c == c)) | |
848 | 855 | then { | |
849 | 856 | let cm = fromBase58String(pendingManagerPublicKey) | |
850 | 857 | if ((cm == cm)) | |
851 | 858 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
852 | 859 | else throw("Strict value is not equal to itself.") | |
853 | 860 | } | |
854 | 861 | else throw("Strict value is not equal to itself.") | |
855 | 862 | } | |
856 | 863 | ||
857 | 864 | ||
858 | 865 | ||
859 | 866 | @Callable(i) | |
860 | 867 | func confirmManager () = { | |
861 | 868 | let p = pm() | |
862 | 869 | let hpm = if (isDefined(p)) | |
863 | 870 | then true | |
864 | 871 | else throw("No pending manager") | |
865 | 872 | if ((hpm == hpm)) | |
866 | 873 | then { | |
867 | 874 | let cpm = if ((i.callerPublicKey == value(p))) | |
868 | 875 | then true | |
869 | 876 | else throw("You are not pending manager") | |
870 | 877 | if ((cpm == cpm)) | |
871 | 878 | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
872 | 879 | else throw("Strict value is not equal to itself.") | |
873 | 880 | } | |
874 | 881 | else throw("Strict value is not equal to itself.") | |
875 | 882 | } | |
876 | 883 | ||
877 | 884 | ||
878 | 885 | ||
879 | 886 | @Callable(i) | |
880 | 887 | func put (slip,autoStake) = { | |
881 | 888 | let factCfg = gfc() | |
882 | 889 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
883 | 890 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
884 | 891 | if ((0 > slip)) | |
885 | 892 | then throw("Wrong slippage") | |
886 | 893 | else if ((size(i.payments) != 2)) | |
887 | 894 | then throw("2 pmnts expd") | |
888 | 895 | else { | |
889 | 896 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
890 | 897 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
891 | 898 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
892 | 899 | if ((currentDLp == currentDLp)) | |
893 | 900 | then { | |
894 | 901 | 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, "") | |
895 | 902 | let emitLpAmt = e._2 | |
896 | 903 | let lpAssetId = e._7 | |
897 | 904 | let state = e._9 | |
898 | 905 | let amDiff = e._10 | |
899 | 906 | let prDiff = e._11 | |
900 | 907 | let amId = e._12 | |
901 | 908 | let prId = e._13 | |
902 | 909 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
903 | 910 | if ((r == r)) | |
904 | 911 | then { | |
905 | 912 | let el = match r { | |
906 | 913 | case legacy: Address => | |
907 | 914 | invoke(legacy, "emit", [emitLpAmt], nil) | |
908 | 915 | case _ => | |
909 | 916 | unit | |
910 | 917 | } | |
911 | 918 | if ((el == el)) | |
912 | 919 | then { | |
913 | 920 | let sa = if ((amDiff > 0)) | |
914 | 921 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
915 | 922 | else nil | |
916 | 923 | if ((sa == sa)) | |
917 | 924 | then { | |
918 | 925 | let sp = if ((prDiff > 0)) | |
919 | 926 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
920 | 927 | else nil | |
921 | 928 | if ((sp == sp)) | |
922 | 929 | then { | |
923 | 930 | let lpTrnsfr = if (autoStake) | |
924 | 931 | then { | |
925 | 932 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
926 | 933 | if ((ss == ss)) | |
927 | 934 | then nil | |
928 | 935 | else throw("Strict value is not equal to itself.") | |
929 | 936 | } | |
930 | 937 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
931 | - | let $ | |
932 | - | let refreshDLpActions = $ | |
933 | - | let updatedDLp = $ | |
938 | + | let $t03458234647 = refreshDLpInternal(0, 0, 0) | |
939 | + | let refreshDLpActions = $t03458234647._1 | |
940 | + | let updatedDLp = $t03458234647._2 | |
934 | 941 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
935 | 942 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
936 | 943 | then ((state ++ lpTrnsfr) ++ refreshDLpActions) | |
937 | 944 | else throw("Strict value is not equal to itself.") | |
938 | 945 | } | |
939 | 946 | else throw("Strict value is not equal to itself.") | |
940 | 947 | } | |
941 | 948 | else throw("Strict value is not equal to itself.") | |
942 | 949 | } | |
943 | 950 | else throw("Strict value is not equal to itself.") | |
944 | 951 | } | |
945 | 952 | else throw("Strict value is not equal to itself.") | |
946 | 953 | } | |
947 | 954 | else throw("Strict value is not equal to itself.") | |
948 | 955 | } | |
949 | 956 | } | |
950 | 957 | ||
951 | 958 | ||
952 | 959 | ||
953 | 960 | @Callable(i) | |
954 | 961 | func putOneTknV2 (minOutAmount,autoStake) = { | |
955 | 962 | let isPoolOneTokenOperationsDisabled = { | |
956 | 963 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
957 | 964 | if ($isInstanceOf(@, "Boolean")) | |
958 | 965 | then @ | |
959 | 966 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
960 | 967 | } | |
961 | 968 | let isPutDisabled = if (if (if (igs()) | |
962 | 969 | then true | |
963 | 970 | else (cfgPoolStatus == PoolPutDis)) | |
964 | 971 | then true | |
965 | 972 | else (cfgPoolStatus == PoolShutdown)) | |
966 | 973 | then true | |
967 | 974 | else isPoolOneTokenOperationsDisabled | |
968 | 975 | let checks = [if (if (!(isPutDisabled)) | |
969 | 976 | then true | |
970 | 977 | else isManager(i)) | |
971 | 978 | then true | |
972 | 979 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
973 | 980 | then true | |
974 | 981 | else throwErr("exactly 1 payment are expected")] | |
975 | 982 | if ((checks == checks)) | |
976 | 983 | then { | |
977 | 984 | let poolConfig = gpc() | |
978 | 985 | let amId = poolConfig[idxAmAsId] | |
979 | 986 | let prId = poolConfig[idxPrAsId] | |
980 | 987 | let lpId = fromBase58String(poolConfig[idxLPAsId]) | |
981 | 988 | let amDecimals = parseIntValue(poolConfig[idxAmtAsDcm]) | |
982 | 989 | let prDecimals = parseIntValue(poolConfig[idxPriceAsDcm]) | |
983 | 990 | let userAddress = if ((i.caller == this)) | |
984 | 991 | then i.originCaller | |
985 | 992 | else i.caller | |
986 | 993 | let pmt = value(i.payments[0]) | |
987 | 994 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
988 | 995 | let pmtAmt = pmt.amount | |
989 | - | let $ | |
990 | - | if (($ | |
996 | + | let $t03578435942 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
997 | + | if (($t03578435942 == $t03578435942)) | |
991 | 998 | then { | |
992 | - | let feeAmount = $ | |
993 | - | let state = $ | |
994 | - | let estimLP = $ | |
999 | + | let feeAmount = $t03578435942._3 | |
1000 | + | let state = $t03578435942._2 | |
1001 | + | let estimLP = $t03578435942._1 | |
995 | 1002 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
996 | 1003 | then (minOutAmount > estimLP) | |
997 | 1004 | else false) | |
998 | 1005 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
999 | 1006 | else estimLP | |
1000 | 1007 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
1001 | 1008 | if ((e == e)) | |
1002 | 1009 | then { | |
1003 | 1010 | let el = match e { | |
1004 | 1011 | case legacy: Address => | |
1005 | 1012 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1006 | 1013 | case _ => | |
1007 | 1014 | unit | |
1008 | 1015 | } | |
1009 | 1016 | if ((el == el)) | |
1010 | 1017 | then { | |
1011 | 1018 | let lpTrnsfr = if (autoStake) | |
1012 | 1019 | then { | |
1013 | 1020 | let ss = invoke(stakingContract, "stake", nil, [AttachedPayment(lpId, emitLpAmt)]) | |
1014 | 1021 | if ((ss == ss)) | |
1015 | 1022 | then nil | |
1016 | 1023 | else throw("Strict value is not equal to itself.") | |
1017 | 1024 | } | |
1018 | 1025 | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
1019 | 1026 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1020 | 1027 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1021 | 1028 | else nil | |
1022 | - | let $ | |
1029 | + | let $t03675737106 = if ((this == feeCollectorAddress)) | |
1023 | 1030 | then $Tuple2(0, 0) | |
1024 | 1031 | else { | |
1025 | 1032 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1026 | 1033 | then true | |
1027 | 1034 | else false | |
1028 | 1035 | if (paymentInAmountAsset) | |
1029 | 1036 | then $Tuple2(-(feeAmount), 0) | |
1030 | 1037 | else $Tuple2(0, -(feeAmount)) | |
1031 | 1038 | } | |
1032 | - | let amountAssetBalanceDelta = $ | |
1033 | - | let priceAssetBalanceDelta = $ | |
1034 | - | let $ | |
1035 | - | let refreshDLpActions = $ | |
1036 | - | let updatedDLp = $ | |
1039 | + | let amountAssetBalanceDelta = $t03675737106._1 | |
1040 | + | let priceAssetBalanceDelta = $t03675737106._2 | |
1041 | + | let $t03710937217 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1042 | + | let refreshDLpActions = $t03710937217._1 | |
1043 | + | let updatedDLp = $t03710937217._2 | |
1037 | 1044 | $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1038 | 1045 | } | |
1039 | 1046 | else throw("Strict value is not equal to itself.") | |
1040 | 1047 | } | |
1041 | 1048 | else throw("Strict value is not equal to itself.") | |
1042 | 1049 | } | |
1043 | 1050 | else throw("Strict value is not equal to itself.") | |
1044 | 1051 | } | |
1045 | 1052 | else throw("Strict value is not equal to itself.") | |
1046 | 1053 | } | |
1047 | 1054 | ||
1048 | 1055 | ||
1049 | 1056 | ||
1050 | 1057 | @Callable(i) | |
1051 | 1058 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
1052 | 1059 | then throw("Wrong slpg") | |
1053 | 1060 | else if ((size(i.payments) != 2)) | |
1054 | 1061 | then throw("2 pmnts expd") | |
1055 | 1062 | else { | |
1056 | 1063 | 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, "") | |
1057 | 1064 | let state = estPut._9 | |
1058 | 1065 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1059 | 1066 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1060 | 1067 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1061 | 1068 | if ((currentDLp == currentDLp)) | |
1062 | 1069 | then { | |
1063 | - | let $ | |
1064 | - | let refreshDLpActions = $ | |
1065 | - | let updatedDLp = $ | |
1070 | + | let $t03817638241 = refreshDLpInternal(0, 0, 0) | |
1071 | + | let refreshDLpActions = $t03817638241._1 | |
1072 | + | let updatedDLp = $t03817638241._2 | |
1066 | 1073 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1067 | 1074 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1068 | 1075 | then (state ++ refreshDLpActions) | |
1069 | 1076 | else throw("Strict value is not equal to itself.") | |
1070 | 1077 | } | |
1071 | 1078 | else throw("Strict value is not equal to itself.") | |
1072 | 1079 | } | |
1073 | 1080 | ||
1074 | 1081 | ||
1075 | 1082 | ||
1076 | 1083 | @Callable(i) | |
1077 | 1084 | func get () = { | |
1078 | 1085 | let r = cg(i) | |
1079 | 1086 | let outAmtAmt = r._1 | |
1080 | 1087 | let outPrAmt = r._2 | |
1081 | 1088 | let pmtAmt = r._3 | |
1082 | 1089 | let pmtAssetId = r._4 | |
1083 | 1090 | let state = r._5 | |
1084 | 1091 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1085 | 1092 | if ((b == b)) | |
1086 | 1093 | then { | |
1087 | 1094 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt)) | |
1088 | - | let $ | |
1089 | - | let refreshDLpActions = $ | |
1090 | - | let updatedDLp = $ | |
1095 | + | let $t03903039112 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1096 | + | let refreshDLpActions = $t03903039112._1 | |
1097 | + | let updatedDLp = $t03903039112._2 | |
1091 | 1098 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1092 | 1099 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1093 | 1100 | then (state ++ refreshDLpActions) | |
1094 | 1101 | else throw("Strict value is not equal to itself.") | |
1095 | 1102 | } | |
1096 | 1103 | else throw("Strict value is not equal to itself.") | |
1097 | 1104 | } | |
1098 | 1105 | ||
1099 | 1106 | ||
1100 | 1107 | ||
1101 | 1108 | @Callable(i) | |
1102 | 1109 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1103 | 1110 | let isPoolOneTokenOperationsDisabled = { | |
1104 | 1111 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1105 | 1112 | if ($isInstanceOf(@, "Boolean")) | |
1106 | 1113 | then @ | |
1107 | 1114 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1108 | 1115 | } | |
1109 | 1116 | let isGetDisabled = if (if (igs()) | |
1110 | 1117 | then true | |
1111 | 1118 | else (cfgPoolStatus == PoolShutdown)) | |
1112 | 1119 | then true | |
1113 | 1120 | else isPoolOneTokenOperationsDisabled | |
1114 | 1121 | let checks = [if (if (!(isGetDisabled)) | |
1115 | 1122 | then true | |
1116 | 1123 | else isManager(i)) | |
1117 | 1124 | then true | |
1118 | 1125 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1119 | 1126 | then true | |
1120 | 1127 | else throwErr("exactly 1 payment are expected")] | |
1121 | 1128 | if ((checks == checks)) | |
1122 | 1129 | then { | |
1123 | - | let $ | |
1124 | - | let state = $ | |
1125 | - | let totalAmount = $ | |
1130 | + | let $t03973039885 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1131 | + | let state = $t03973039885._1 | |
1132 | + | let totalAmount = $t03973039885._2 | |
1126 | 1133 | $Tuple2(state, totalAmount) | |
1127 | 1134 | } | |
1128 | 1135 | else throw("Strict value is not equal to itself.") | |
1129 | 1136 | } | |
1130 | 1137 | ||
1131 | 1138 | ||
1132 | 1139 | ||
1133 | 1140 | @Callable(i) | |
1134 | 1141 | func refreshDLp () = { | |
1135 | 1142 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0) | |
1136 | 1143 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay)) | |
1137 | 1144 | then unit | |
1138 | 1145 | else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1139 | 1146 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1140 | 1147 | then { | |
1141 | 1148 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1142 | - | let $ | |
1143 | - | let dLpUpdateActions = $ | |
1144 | - | let updatedDLp = $ | |
1149 | + | let $t04040940473 = refreshDLpInternal(0, 0, 0) | |
1150 | + | let dLpUpdateActions = $t04040940473._1 | |
1151 | + | let updatedDLp = $t04040940473._2 | |
1145 | 1152 | let actions = if ((dLp != updatedDLp)) | |
1146 | 1153 | then dLpUpdateActions | |
1147 | 1154 | else throwErr("nothing to refresh") | |
1148 | 1155 | $Tuple2(actions, toString(updatedDLp)) | |
1149 | 1156 | } | |
1150 | 1157 | else throw("Strict value is not equal to itself.") | |
1151 | 1158 | } | |
1152 | 1159 | ||
1153 | 1160 | ||
1154 | 1161 | ||
1155 | 1162 | @Callable(i) | |
1156 | 1163 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1157 | 1164 | let poolConfig = gpc() | |
1158 | 1165 | let amId = poolConfig[idxAmAsId] | |
1159 | 1166 | let prId = poolConfig[idxPrAsId] | |
1160 | 1167 | let lpId = poolConfig[idxLPAsId] | |
1161 | 1168 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
1162 | 1169 | let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
1163 | 1170 | let D0 = getD(xp) | |
1164 | 1171 | let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission)) | |
1165 | 1172 | let index = if ((outAssetId == amId)) | |
1166 | 1173 | then 0 | |
1167 | 1174 | else if ((outAssetId == prId)) | |
1168 | 1175 | then 1 | |
1169 | 1176 | else throw("invalid out asset id") | |
1170 | 1177 | let newY = getYD(xp, index, D1) | |
1171 | 1178 | let dy = (xp[index] - newY) | |
1172 | 1179 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1173 | - | let $ | |
1174 | - | let totalGet = $ | |
1175 | - | let feeAmount = $ | |
1180 | + | let $t04137341422 = takeFee(totalGetRaw) | |
1181 | + | let totalGet = $t04137341422._1 | |
1182 | + | let feeAmount = $t04137341422._2 | |
1176 | 1183 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1177 | 1184 | } | |
1178 | 1185 | ||
1179 | 1186 | ||
1180 | 1187 | ||
1181 | 1188 | @Callable(i) | |
1182 | 1189 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1183 | 1190 | let poolConfig = gpc() | |
1184 | 1191 | let amId = poolConfig[idxAmAsId] | |
1185 | 1192 | let prId = poolConfig[idxPrAsId] | |
1186 | 1193 | let lpId = poolConfig[idxLPAsId] | |
1187 | 1194 | let amBalance = getAccBalance(amId) | |
1188 | 1195 | let prBalance = getAccBalance(prId) | |
1189 | - | let $ | |
1196 | + | let $t04176741882 = { | |
1190 | 1197 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1191 | 1198 | if ($isInstanceOf(@, "(Int, Int)")) | |
1192 | 1199 | then @ | |
1193 | 1200 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1194 | 1201 | } | |
1195 | - | let totalGet = $ | |
1196 | - | let feeAmount = $ | |
1202 | + | let totalGet = $t04176741882._1 | |
1203 | + | let feeAmount = $t04176741882._2 | |
1197 | 1204 | let r = ego("", lpId, lpAssetAmount, this) | |
1198 | 1205 | let outAmAmt = r._1 | |
1199 | 1206 | let outPrAmt = r._2 | |
1200 | 1207 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1201 | 1208 | let bonus = if ((sumOfGetAssets == 0)) | |
1202 | 1209 | then if ((totalGet == 0)) | |
1203 | 1210 | then 0 | |
1204 | 1211 | else throw("bonus calculation error") | |
1205 | 1212 | else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1206 | 1213 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1207 | 1214 | } | |
1208 | 1215 | ||
1209 | 1216 | ||
1210 | 1217 | ||
1211 | 1218 | @Callable(i) | |
1212 | 1219 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1213 | 1220 | let r = cg(i) | |
1214 | 1221 | let outAmAmt = r._1 | |
1215 | 1222 | let outPrAmt = r._2 | |
1216 | 1223 | let pmtAmt = r._3 | |
1217 | 1224 | let pmtAssetId = r._4 | |
1218 | 1225 | let state = r._5 | |
1219 | 1226 | if ((noLessThenAmtAsset > outAmAmt)) | |
1220 | 1227 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1221 | 1228 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1222 | 1229 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1223 | 1230 | else { | |
1224 | 1231 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(pmtAmt)) | |
1225 | 1232 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1226 | 1233 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1227 | 1234 | then { | |
1228 | - | let $ | |
1229 | - | let refreshDLpActions = $ | |
1230 | - | let updatedDLp = $ | |
1235 | + | let $t04305043131 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1236 | + | let refreshDLpActions = $t04305043131._1 | |
1237 | + | let updatedDLp = $t04305043131._2 | |
1231 | 1238 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1232 | 1239 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1233 | 1240 | then (state ++ refreshDLpActions) | |
1234 | 1241 | else throw("Strict value is not equal to itself.") | |
1235 | 1242 | } | |
1236 | 1243 | else throw("Strict value is not equal to itself.") | |
1237 | 1244 | } | |
1238 | 1245 | } | |
1239 | 1246 | ||
1240 | 1247 | ||
1241 | 1248 | ||
1242 | 1249 | @Callable(i) | |
1243 | 1250 | func unstakeAndGet (amount) = { | |
1244 | 1251 | let checkPayments = if ((size(i.payments) != 0)) | |
1245 | 1252 | then throw("No pmnts expd") | |
1246 | 1253 | else true | |
1247 | 1254 | if ((checkPayments == checkPayments)) | |
1248 | 1255 | then { | |
1249 | 1256 | let cfg = gpc() | |
1250 | 1257 | let factoryCfg = gfc() | |
1251 | 1258 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1252 | 1259 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1253 | 1260 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1254 | 1261 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1255 | 1262 | if ((unstakeInv == unstakeInv)) | |
1256 | 1263 | then { | |
1257 | 1264 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1258 | 1265 | let outAmAmt = r._1 | |
1259 | 1266 | let outPrAmt = r._2 | |
1260 | 1267 | let sts = parseIntValue(r._9) | |
1261 | 1268 | let state = r._10 | |
1262 | 1269 | let v = if (if (igs()) | |
1263 | 1270 | then true | |
1264 | 1271 | else (sts == PoolShutdown)) | |
1265 | 1272 | then throw(("Blocked: " + toString(sts))) | |
1266 | 1273 | else true | |
1267 | 1274 | if ((v == v)) | |
1268 | 1275 | then { | |
1269 | 1276 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1270 | 1277 | if ((burnA == burnA)) | |
1271 | 1278 | then { | |
1272 | - | let $ | |
1273 | - | let refreshDLpActions = $ | |
1274 | - | let updatedDLp = $ | |
1279 | + | let $t04419444275 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1280 | + | let refreshDLpActions = $t04419444275._1 | |
1281 | + | let updatedDLp = $t04419444275._2 | |
1275 | 1282 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1276 | 1283 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1277 | 1284 | then (state ++ refreshDLpActions) | |
1278 | 1285 | else throw("Strict value is not equal to itself.") | |
1279 | 1286 | } | |
1280 | 1287 | else throw("Strict value is not equal to itself.") | |
1281 | 1288 | } | |
1282 | 1289 | else throw("Strict value is not equal to itself.") | |
1283 | 1290 | } | |
1284 | 1291 | else throw("Strict value is not equal to itself.") | |
1285 | 1292 | } | |
1286 | 1293 | else throw("Strict value is not equal to itself.") | |
1287 | 1294 | } | |
1288 | 1295 | ||
1289 | 1296 | ||
1290 | 1297 | ||
1291 | 1298 | @Callable(i) | |
1292 | 1299 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1293 | 1300 | let isGetDisabled = if (igs()) | |
1294 | 1301 | then true | |
1295 | 1302 | else (cfgPoolStatus == PoolShutdown) | |
1296 | 1303 | let checks = [if (!(isGetDisabled)) | |
1297 | 1304 | then true | |
1298 | 1305 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1299 | 1306 | then true | |
1300 | 1307 | else throw("no payments are expected")] | |
1301 | 1308 | if ((checks == checks)) | |
1302 | 1309 | then { | |
1303 | 1310 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1304 | 1311 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1305 | 1312 | if ((unstakeInv == unstakeInv)) | |
1306 | 1313 | then { | |
1307 | 1314 | let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1308 | 1315 | let outAmAmt = res._1 | |
1309 | 1316 | let outPrAmt = res._2 | |
1310 | 1317 | let state = res._10 | |
1311 | 1318 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1312 | 1319 | then true | |
1313 | 1320 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1314 | 1321 | then true | |
1315 | 1322 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1316 | 1323 | if ((checkAmounts == checkAmounts)) | |
1317 | 1324 | then { | |
1318 | 1325 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1319 | 1326 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1320 | 1327 | then { | |
1321 | - | let $ | |
1322 | - | let refreshDLpActions = $ | |
1323 | - | let updatedDLp = $ | |
1328 | + | let $t04552345604 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1329 | + | let refreshDLpActions = $t04552345604._1 | |
1330 | + | let updatedDLp = $t04552345604._2 | |
1324 | 1331 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1325 | 1332 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1326 | 1333 | then (state ++ refreshDLpActions) | |
1327 | 1334 | else throw("Strict value is not equal to itself.") | |
1328 | 1335 | } | |
1329 | 1336 | else throw("Strict value is not equal to itself.") | |
1330 | 1337 | } | |
1331 | 1338 | else throw("Strict value is not equal to itself.") | |
1332 | 1339 | } | |
1333 | 1340 | else throw("Strict value is not equal to itself.") | |
1334 | 1341 | } | |
1335 | 1342 | else throw("Strict value is not equal to itself.") | |
1336 | 1343 | } | |
1337 | 1344 | ||
1338 | 1345 | ||
1339 | 1346 | ||
1340 | 1347 | @Callable(i) | |
1341 | 1348 | func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = { | |
1342 | 1349 | let isPoolOneTokenOperationsDisabled = { | |
1343 | 1350 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1344 | 1351 | if ($isInstanceOf(@, "Boolean")) | |
1345 | 1352 | then @ | |
1346 | 1353 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1347 | 1354 | } | |
1348 | 1355 | let isGetDisabled = if (if (igs()) | |
1349 | 1356 | then true | |
1350 | 1357 | else (cfgPoolStatus == PoolShutdown)) | |
1351 | 1358 | then true | |
1352 | 1359 | else isPoolOneTokenOperationsDisabled | |
1353 | 1360 | let checks = [if (if (!(isGetDisabled)) | |
1354 | 1361 | then true | |
1355 | 1362 | else isManager(i)) | |
1356 | 1363 | then true | |
1357 | 1364 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1358 | 1365 | then true | |
1359 | 1366 | else throwErr("no payments are expected")] | |
1360 | 1367 | if ((checks == checks)) | |
1361 | 1368 | then { | |
1362 | 1369 | let cfg = gpc() | |
1363 | 1370 | let factoryCfg = gfc() | |
1364 | 1371 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
1365 | 1372 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1366 | 1373 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), unstakeAmount], nil) | |
1367 | 1374 | if ((unstakeInv == unstakeInv)) | |
1368 | 1375 | then { | |
1369 | - | let $ | |
1370 | - | let state = $ | |
1371 | - | let totalAmount = $ | |
1376 | + | let $t04653846726 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1377 | + | let state = $t04653846726._1 | |
1378 | + | let totalAmount = $t04653846726._2 | |
1372 | 1379 | $Tuple2(state, totalAmount) | |
1373 | 1380 | } | |
1374 | 1381 | else throw("Strict value is not equal to itself.") | |
1375 | 1382 | } | |
1376 | 1383 | else throw("Strict value is not equal to itself.") | |
1377 | 1384 | } | |
1378 | 1385 | ||
1379 | 1386 | ||
1380 | 1387 | ||
1381 | 1388 | @Callable(i) | |
1382 | 1389 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1383 | 1390 | let poolConfig = gpc() | |
1384 | 1391 | let amId = poolConfig[idxAmAsId] | |
1385 | 1392 | let prId = poolConfig[idxPrAsId] | |
1386 | 1393 | let lpId = poolConfig[idxLPAsId] | |
1387 | - | let $ | |
1388 | - | let lpAmount = $ | |
1389 | - | let state = $ | |
1390 | - | let feeAmount = $ | |
1391 | - | let bonus = $ | |
1394 | + | let $t04698547088 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1395 | + | let lpAmount = $t04698547088._1 | |
1396 | + | let state = $t04698547088._2 | |
1397 | + | let feeAmount = $t04698547088._3 | |
1398 | + | let bonus = $t04698547088._4 | |
1392 | 1399 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1393 | 1400 | } | |
1394 | 1401 | ||
1395 | 1402 | ||
1396 | 1403 | ||
1397 | 1404 | @Callable(i) | |
1398 | 1405 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1399 | 1406 | let poolConfig = gpc() | |
1400 | 1407 | let amId = poolConfig[idxAmAsId] | |
1401 | 1408 | let prId = poolConfig[idxPrAsId] | |
1402 | 1409 | let lpId = poolConfig[idxLPAsId] | |
1403 | - | let $ | |
1404 | - | let lpAmount = $ | |
1405 | - | let state = $ | |
1406 | - | let feeAmount = $ | |
1407 | - | let bonus = $ | |
1410 | + | let $t04736747471 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1411 | + | let lpAmount = $t04736747471._1 | |
1412 | + | let state = $t04736747471._2 | |
1413 | + | let feeAmount = $t04736747471._3 | |
1414 | + | let bonus = $t04736747471._4 | |
1408 | 1415 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1409 | 1416 | } | |
1410 | 1417 | ||
1411 | 1418 | ||
1412 | 1419 | ||
1413 | 1420 | @Callable(i) | |
1414 | 1421 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1415 | 1422 | then throw("denied") | |
1416 | 1423 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr)], "success") | |
1417 | 1424 | ||
1418 | 1425 | ||
1419 | 1426 | ||
1420 | 1427 | @Callable(i) | |
1421 | 1428 | func setS (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1422 | 1429 | then pd | |
1423 | 1430 | else [StringEntry(k, v)] | |
1424 | 1431 | ||
1425 | 1432 | ||
1426 | 1433 | ||
1427 | 1434 | @Callable(i) | |
1428 | 1435 | func setI (k,v) = if ((toString(i.caller) != strf(this, ada()))) | |
1429 | 1436 | then pd | |
1430 | 1437 | else [IntegerEntry(k, v)] | |
1431 | 1438 | ||
1432 | 1439 | ||
1433 | 1440 | ||
1434 | 1441 | @Callable(i) | |
1435 | 1442 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1436 | 1443 | ||
1437 | 1444 | ||
1438 | 1445 | ||
1439 | 1446 | @Callable(i) | |
1440 | 1447 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1441 | 1448 | ||
1442 | 1449 | ||
1443 | 1450 | ||
1444 | 1451 | @Callable(i) | |
1445 | 1452 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1446 | 1453 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1447 | 1454 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1448 | 1455 | } | |
1449 | 1456 | ||
1450 | 1457 | ||
1451 | 1458 | ||
1452 | 1459 | @Callable(i) | |
1453 | 1460 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1454 | 1461 | ||
1455 | 1462 | ||
1456 | 1463 | ||
1457 | 1464 | @Callable(i) | |
1458 | 1465 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1459 | 1466 | ||
1460 | 1467 | ||
1461 | 1468 | ||
1462 | 1469 | @Callable(i) | |
1463 | 1470 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1464 | 1471 | ||
1465 | 1472 | ||
1466 | 1473 | ||
1467 | 1474 | @Callable(i) | |
1468 | 1475 | 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, "")) | |
1469 | 1476 | ||
1470 | 1477 | ||
1471 | 1478 | ||
1472 | 1479 | @Callable(i) | |
1473 | 1480 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1474 | 1481 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1475 | 1482 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1476 | 1483 | } | |
1477 | 1484 | ||
1478 | 1485 | ||
1479 | 1486 | ||
1480 | 1487 | @Callable(i) | |
1481 | 1488 | func getFeeREADONLY () = $Tuple2(nil, fee) | |
1482 | 1489 | ||
1483 | 1490 | ||
1484 | 1491 | @Verifier(tx) | |
1485 | 1492 | func verify () = { | |
1486 | 1493 | let targetPublicKey = match m() { | |
1487 | 1494 | case pk: ByteVector => | |
1488 | 1495 | pk | |
1489 | 1496 | case _: Unit => | |
1490 | 1497 | tx.senderPublicKey | |
1491 | 1498 | case _ => | |
1492 | 1499 | throw("Match error") | |
1493 | 1500 | } | |
1494 | 1501 | match tx { | |
1495 | 1502 | case order: Order => | |
1496 | 1503 | let matcherPub = mp() | |
1497 | - | let orderValid = | |
1504 | + | let orderValid = validateMatcherOrderAllowed(order) | |
1498 | 1505 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1499 | 1506 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1500 | 1507 | if (if (if (orderValid) | |
1501 | 1508 | then senderValid | |
1502 | 1509 | else false) | |
1503 | 1510 | then matcherValid | |
1504 | 1511 | else false) | |
1505 | 1512 | then true | |
1506 | 1513 | else toe(orderValid, senderValid, matcherValid) | |
1507 | 1514 | case s: SetScriptTransaction => | |
1508 | 1515 | let newHash = blake2b256(value(s.script)) | |
1509 | 1516 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1510 | 1517 | let currentHash = scriptHash(this) | |
1511 | 1518 | if (if ((allowedHash == newHash)) | |
1512 | 1519 | then (currentHash != newHash) | |
1513 | 1520 | else false) | |
1514 | 1521 | then true | |
1515 | 1522 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1516 | 1523 | case _ => | |
1517 | 1524 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1518 | 1525 | } | |
1519 | 1526 | } | |
1520 | 1527 |
github/deemru/w8io/026f985 202.66 ms ◑