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