tx · 39TFbC5mtxkszWZnZGrJZdY5VTSohx4Hbh2QmrWm16oU 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS: -0.28000000 Waves 2023.04.19 20:28 [2541735] smart account 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS > SELF 0.00000000 Waves
{ "type": 13, "id": "39TFbC5mtxkszWZnZGrJZdY5VTSohx4Hbh2QmrWm16oU", "fee": 28000000, "feeAssetId": null, "timestamp": 1681925359249, "version": 2, "chainId": 84, "sender": "3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS", "senderPublicKey": "HP8sssVq1866F7CaPQJwgFrt6fsqhQjKwM84cL1wjD2a", "proofs": [ "4wVCznkrtq5bpgHqv97ierf3gssEoczXrrzZ4C7ueUrjHQ3KD5FdGxzGvrBgW5DePgKpGbYCmsfstJtKcHUUunoH" ], "script": "base64:BgJaCAISBQoDCAEIEgMKAQgSBQoDCAEIEgMKAQgSBAoCCAESAwoBCBIOCgwICAgBBBEYGBEBARgSCgoICAgIAQQIARgSDgoMCAgIAQQYGBgYGAEYEgcKBQgIAQEBRAAHU0ZfUE9PTAICU0YAB1dYX1BPT0wCAldYAAdDQVBfRkVFAgNjYXAACExPQU5fRkVFAgRsb2FuAAtOT19MT0FOX0ZFRQIGbm9Mb2FuAAZTQ0FMRTgAgMLXLwAHU0NBTEUxMACAyK+gJQAKRkVFX1NDQUxFNgDAhD0AFGtTRlBvb2xBQXNzZXRCYWxhbmNlAg9BX2Fzc2V0X2JhbGFuY2UAFGtTRlBvb2xCQXNzZXRCYWxhbmNlAg9CX2Fzc2V0X2JhbGFuY2UAD2tTRlBvb2xBQXNzZXRJZAIKQV9hc3NldF9pZAAPa1NGUG9vbEJBc3NldElkAgpCX2Fzc2V0X2lkAA5rU0ZQb29sU2hhcmVJZAIOc2hhcmVfYXNzZXRfaWQACmtTRlBvb2xGZWUCCmNvbW1pc3Npb24ADWtVc2VyUG9zaXRpb24CDl91c2VyX3Bvc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C1N0cmluZ0VudHJ5AgkArAICBQVrUG9vbAUIcG9vbEFkZHIFBHR5cGUFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXmkTWIo", "height": 2541735, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4xywBKP5PNVxYfCzvzWiAYkzdUtQmzuKRVtWZoWcHg3V Next: AzvBKi1Rn5LX2nwRd14t6BCsXiXzBeT5W435XQM3bkaV Diff:
Old | New | Differences | |
---|---|---|---|
336 | 336 | } | |
337 | 337 | ||
338 | 338 | ||
339 | + | func replenishByType (type,pool,feeType,pmtA,AId,pmtB,BId,balA,balB,shareId) = if ((type == SF_POOL)) | |
340 | + | then replenishSwopFi(pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
341 | + | else if ((type == WX_POOL)) | |
342 | + | then replenishWX(pool, LOAN_FEE, pmtA, AId, pmtB, BId, shareId) | |
343 | + | else throw("Wrong pool type") | |
344 | + | ||
345 | + | ||
339 | 346 | func replenishEntries (pool,user,stakedAmount,axlyFeeAmount,posNum,shareId,type) = { | |
340 | 347 | let totalAmount = getPoolTotalShare(pool) | |
341 | 348 | let curPoolInterest = getIntegerValue(this, (pool + kPoolInterest)) | |
415 | 422 | } | |
416 | 423 | ||
417 | 424 | ||
418 | - | func capitalize (pool, | |
425 | + | func capitalize (pool,pType,tokenId,tokenAmount) = { | |
419 | 426 | let poolAddr = Address(fromBase58String(pool)) | |
420 | - | let $ | |
421 | - | let AId = $ | |
422 | - | let BId = $ | |
423 | - | let balA = $ | |
424 | - | let balB = $ | |
425 | - | let shareId = $ | |
426 | - | let $ | |
427 | + | let $t01382413903 = getPoolData(poolAddr, pType) | |
428 | + | let AId = $t01382413903._1 | |
429 | + | let BId = $t01382413903._2 | |
430 | + | let balA = $t01382413903._3 | |
431 | + | let balB = $t01382413903._4 | |
432 | + | let shareId = $t01382413903._5 | |
433 | + | let $t01390613986 = if ((tokenId == AId)) | |
427 | 434 | then $Tuple2(tokenAmount, 0) | |
428 | 435 | else $Tuple2(0, tokenAmount) | |
429 | - | let pmtA = $t01327113351._1 | |
430 | - | let pmtB = $t01327113351._2 | |
431 | - | let $t01335413715 = if ((type == SF_POOL)) | |
432 | - | then replenishSwopFi(pool, CAP_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
433 | - | else replenishWX(pool, CAP_FEE, pmtA, AId, pmtB, BId, shareId) | |
434 | - | let stakedAmount = $t01335413715._1 | |
435 | - | let axlyFee = $t01335413715._2 | |
436 | + | let pmtA = $t01390613986._1 | |
437 | + | let pmtB = $t01390613986._2 | |
438 | + | let $t01398914099 = replenishByType(pType, pool, CAP_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
439 | + | let stakedAmount = $t01398914099._1 | |
440 | + | let axlyFee = $t01398914099._2 | |
436 | 441 | let curPoolInterest = valueOrElse(getInteger(this, (pool + kPoolInterest)), 0) | |
437 | 442 | let totalShareAmount = getPoolTotalShare(pool) | |
438 | 443 | let newInterest = (curPoolInterest + fraction(stakedAmount, SCALE10, totalShareAmount)) | |
445 | 450 | let feeScale6 = 1000000 | |
446 | 451 | let fee = getIntegerValue(poolAddr, kSFPoolFee) | |
447 | 452 | let amntGetNoFee = fraction(amountTokenToGet, feeScale6, (feeScale6 - fee)) | |
448 | - | let $ | |
453 | + | let $t01479215080 = if ((assetTokenToGet == assetIdA)) | |
449 | 454 | then { | |
450 | 455 | let amountToPay = fraction(balA, amntGetNoFee, (balB - amntGetNoFee)) | |
451 | 456 | $Tuple2(amountToPay, assetIdB) | |
454 | 459 | let amountToPay = fraction(balB, amntGetNoFee, (balA - amntGetNoFee)) | |
455 | 460 | $Tuple2(amountToPay, assetIdA) | |
456 | 461 | } | |
457 | - | let amountToPay = $ | |
458 | - | let assetToPay = $ | |
462 | + | let amountToPay = $t01479215080._1 | |
463 | + | let assetToPay = $t01479215080._2 | |
459 | 464 | invoke(poolAddr, "callFunction", ["exchange", ["1"]], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
460 | 465 | } | |
461 | 466 | ||
465 | 470 | let prFee = getIntegerValue(wxSwapContract, "%s__protocolFee") | |
466 | 471 | let pFee = getIntegerValue(wxSwapContract, "%s__poolFee") | |
467 | 472 | let feeScale = toBigInt(100000000) | |
468 | - | let $ | |
473 | + | let $t01555915867 = if ((assetTokenToGet == assetIdA)) | |
469 | 474 | then { | |
470 | 475 | let amountToPay = fraction(balA, amountTokenToGet, (balB - amountTokenToGet)) | |
471 | 476 | $Tuple2(amountToPay, assetIdB) | |
474 | 479 | let amountToPay = fraction(balB, amountTokenToGet, (balA - amountTokenToGet)) | |
475 | 480 | $Tuple2(amountToPay, assetIdA) | |
476 | 481 | } | |
477 | - | let amountToPay = $ | |
478 | - | let assetToPay = $ | |
482 | + | let amountToPay = $t01555915867._1 | |
483 | + | let assetToPay = $t01555915867._2 | |
479 | 484 | let amountToPayWithFee = toInt(fraction(toBigInt(amountToPay), feeScale, (feeScale - toBigInt((prFee + pFee))))) | |
480 | 485 | invoke(wxSwapContract, "swap", [1, assetTokenToGet, toString(this)], [AttachedPayment(assetIdFromStr(assetToPay), amountToPayWithFee)]) | |
481 | 486 | } | |
489 | 494 | func withdrawAmountCalc (pool,userCanWithdraw,debt,borrowAsset) = { | |
490 | 495 | let poolAddr = Address(fromBase58String(pool)) | |
491 | 496 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
492 | - | let $ | |
493 | - | let assetIdA = $ | |
494 | - | let assetIdB = $ | |
495 | - | let balA = $ | |
496 | - | let balB = $ | |
497 | + | let $t01673216799 = getPoolData(poolAddr, pType) | |
498 | + | let assetIdA = $t01673216799._1 | |
499 | + | let assetIdB = $t01673216799._2 | |
500 | + | let balA = $t01673216799._3 | |
501 | + | let balB = $t01673216799._4 | |
497 | 502 | let cBalABefore = accountBalance(assetIdFromStr(assetIdA)) | |
498 | 503 | if ((cBalABefore == cBalABefore)) | |
499 | 504 | then { | |
509 | 514 | then { | |
510 | 515 | let cBalAAfter = accountBalance(assetIdFromStr(assetIdA)) | |
511 | 516 | let cBalBAfter = accountBalance(assetIdFromStr(assetIdB)) | |
512 | - | let $ | |
513 | - | let tokensAmountA = $ | |
514 | - | let tokensAmountB = $ | |
515 | - | let $ | |
517 | + | let $t01731117400 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
518 | + | let tokensAmountA = $t01731117400._1 | |
519 | + | let tokensAmountB = $t01731117400._2 | |
520 | + | let $t01740318099 = if ((debt > 0)) | |
516 | 521 | then { | |
517 | 522 | let amountToGetEx = if (if ((borrowAsset == assetIdA)) | |
518 | 523 | then (debt > tokensAmountA) | |
535 | 540 | else throw("Strict value is not equal to itself.") | |
536 | 541 | } | |
537 | 542 | else $Tuple2(tokensAmountA, tokensAmountB) | |
538 | - | let toUserAmountA = $ | |
539 | - | let toUserAmountB = $ | |
543 | + | let toUserAmountA = $t01740318099._1 | |
544 | + | let toUserAmountB = $t01740318099._2 | |
540 | 545 | $Tuple4(toUserAmountA, assetIdA, toUserAmountB, assetIdB) | |
541 | 546 | } | |
542 | 547 | else throw("Strict value is not equal to itself.") | |
547 | 552 | } | |
548 | 553 | ||
549 | 554 | ||
555 | + | func parseRequest (requestId) = { | |
556 | + | let request = split(valueOrErrorMessage(getString(this, (requestId + kRequestId)), ("No request with id " + requestId)), ",") | |
557 | + | let user = request[0] | |
558 | + | let pool = request[1] | |
559 | + | let pmtA = parseIntValue(request[2]) | |
560 | + | let AId = request[3] | |
561 | + | let pmtB = parseIntValue(request[4]) | |
562 | + | let BId = request[5] | |
563 | + | let balA = parseIntValue(request[6]) | |
564 | + | let balB = parseIntValue(request[7]) | |
565 | + | let shareId = request[8] | |
566 | + | let bwAsset = request[9] | |
567 | + | let bwAmount = parseIntValue(request[10]) | |
568 | + | $Tuple11(user, pool, pmtA, AId, pmtB, BId, balA, balB, shareId, bwAsset, bwAmount) | |
569 | + | } | |
570 | + | ||
571 | + | ||
550 | 572 | @Callable(i) | |
551 | 573 | func replenishREADONLY (pool,leverage,borrowAssetId) = if (if ((100 > leverage)) | |
552 | 574 | then true | |
553 | 575 | else (leverage > 300)) | |
554 | 576 | then throw("Leverage can't be <100 and >300") | |
555 | 577 | else { | |
556 | - | let | |
557 | - | let $ | |
558 | - | let AId = $ | |
559 | - | let BId = $ | |
560 | - | let balA = $ | |
561 | - | let balB = $ | |
562 | - | let shareId = $ | |
563 | - | let $ | |
578 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
579 | + | let $t01905319143 = getPoolData(Address(fromBase58String(pool)), pType) | |
580 | + | let AId = $t01905319143._1 | |
581 | + | let BId = $t01905319143._2 | |
582 | + | let balA = $t01905319143._3 | |
583 | + | let balB = $t01905319143._4 | |
584 | + | let shareId = $t01905319143._5 | |
585 | + | let $t01914619783 = if ((size(i.payments) == 2)) | |
564 | 586 | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
565 | 587 | then throw("Wrong payment asset A") | |
566 | 588 | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
573 | 595 | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
574 | 596 | else throw("Wrong payment") | |
575 | 597 | else throw("One or two payments expected") | |
576 | - | let pmtA = $ | |
577 | - | let pmtAssetA = $ | |
578 | - | let pmtB = $ | |
579 | - | let pmtAssetB = $ | |
580 | - | let $ | |
598 | + | let pmtA = $t01914619783._1 | |
599 | + | let pmtAssetA = $t01914619783._2 | |
600 | + | let pmtB = $t01914619783._3 | |
601 | + | let pmtAssetB = $t01914619783._4 | |
602 | + | let $t01978621297 = if ((leverage > 100)) | |
581 | 603 | then { | |
582 | 604 | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetA, false], nil) | |
583 | 605 | if ($isInstanceOf(@, "(Int, Int)")) | |
589 | 611 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._1 | |
590 | 612 | let paydInDollar = (fraction(dPriceA, pmtA, pow(10, 0, getAssetDecimals(pmtAssetA), 0, 0, DOWN)) + fraction(dPriceB, pmtB, pow(10, 0, getAssetDecimals(pmtAssetB), 0, 0, DOWN))) | |
591 | 613 | let borrowAmount = fraction(paydInDollar, (leverage - 100), 100) | |
592 | - | let request = makeString([ | |
614 | + | let request = makeString([toString(i.caller), pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, borrowAssetId, toString(borrowAmount), toString(1)], ",") | |
593 | 615 | let newRequestId = { | |
594 | 616 | let @ = invoke(this, "createNewRequest", [request], nil) | |
595 | 617 | if ($isInstanceOf(@, "Int")) | |
609 | 631 | else throw("Strict value is not equal to itself.") | |
610 | 632 | } | |
611 | 633 | else $Tuple4(pmtA, pmtB, NO_LOAN_FEE, 0) | |
612 | - | let paymentA = $t01881020335._1 | |
613 | - | let paymentB = $t01881020335._2 | |
614 | - | let feeType = $t01881020335._3 | |
615 | - | let borrowAmount = $t01881020335._4 | |
616 | - | let $t02033820732 = if ((type == SF_POOL)) | |
617 | - | then replenishSwopFi(pool, feeType, paymentA, pmtAssetA, paymentB, pmtAssetB, balA, balB, shareId) | |
618 | - | else replenishWX(pool, feeType, pmtA, pmtAssetA, pmtB, pmtAssetB, shareId) | |
619 | - | let userStaked = $t02033820732._1 | |
620 | - | let axlyFee = $t02033820732._2 | |
621 | - | let $t02073520860 = withdrawAmountCalc(pool, userStaked, borrowAmount, borrowAssetId) | |
622 | - | if (($t02073520860 == $t02073520860)) | |
634 | + | let paymentA = $t01978621297._1 | |
635 | + | let paymentB = $t01978621297._2 | |
636 | + | let feeType = $t01978621297._3 | |
637 | + | let borrowAmount = $t01978621297._4 | |
638 | + | let $t02130021412 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
639 | + | let userStaked = $t02130021412._1 | |
640 | + | let axlyFee = $t02130021412._2 | |
641 | + | let $t02141621541 = withdrawAmountCalc(pool, userStaked, borrowAmount, borrowAssetId) | |
642 | + | if (($t02141621541 == $t02141621541)) | |
623 | 643 | then { | |
624 | - | let assetIdB = $ | |
625 | - | let toUserAmountB = $ | |
626 | - | let assetIdA = $ | |
627 | - | let toUserAmountA = $ | |
644 | + | let assetIdB = $t02141621541._4 | |
645 | + | let toUserAmountB = $t02141621541._3 | |
646 | + | let assetIdA = $t02141621541._2 | |
647 | + | let toUserAmountA = $t02141621541._1 | |
628 | 648 | $Tuple2(nil, [userStaked, toUserAmountA, toUserAmountB]) | |
629 | 649 | } | |
630 | 650 | else throw("Strict value is not equal to itself.") | |
633 | 653 | ||
634 | 654 | ||
635 | 655 | @Callable(i) | |
636 | - | func replenishFromLandReadOnly (requestId) = $Tuple2(nil, 11111) | |
656 | + | func replenishFromLandReadOnly (requestId) = { | |
657 | + | let $t02166521769 = parseRequest(requestId) | |
658 | + | let user = $t02166521769._1 | |
659 | + | let pool = $t02166521769._2 | |
660 | + | let pmtA = $t02166521769._3 | |
661 | + | let AId = $t02166521769._4 | |
662 | + | let pmtB = $t02166521769._5 | |
663 | + | let BId = $t02166521769._6 | |
664 | + | let balA = $t02166521769._7 | |
665 | + | let balB = $t02166521769._8 | |
666 | + | let shareId = $t02166521769._9 | |
667 | + | let bwAsset = $t02166521769._10 | |
668 | + | let bwAmount = $t02166521769._11 | |
669 | + | if ((size(i.payments) != 1)) | |
670 | + | then throw("Wrong payment size") | |
671 | + | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
672 | + | then true | |
673 | + | else (i.payments[0].amount != bwAmount)) | |
674 | + | then throw("Wrong payment") | |
675 | + | else { | |
676 | + | let $t02195922083 = if ((AId == bwAsset)) | |
677 | + | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
678 | + | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
679 | + | let pmtAllA = $t02195922083._1 | |
680 | + | let pmtAllB = $t02195922083._2 | |
681 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
682 | + | let $t02216522274 = replenishByType(pType, pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
683 | + | let userStaked = $t02216522274._1 | |
684 | + | let axlyFee = $t02216522274._2 | |
685 | + | nil | |
686 | + | } | |
687 | + | } | |
637 | 688 | ||
638 | 689 | ||
639 | 690 | ||
643 | 694 | else (leverage > 300)) | |
644 | 695 | then throw("Leverage can't be <100 and >300") | |
645 | 696 | else { | |
646 | - | let | |
647 | - | let $ | |
648 | - | let AId = $ | |
649 | - | let BId = $ | |
650 | - | let balA = $ | |
651 | - | let balB = $ | |
652 | - | let shareId = $ | |
653 | - | let $ | |
697 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
698 | + | let $t02258822678 = getPoolData(Address(fromBase58String(pool)), pType) | |
699 | + | let AId = $t02258822678._1 | |
700 | + | let BId = $t02258822678._2 | |
701 | + | let balA = $t02258822678._3 | |
702 | + | let balB = $t02258822678._4 | |
703 | + | let shareId = $t02258822678._5 | |
704 | + | let $t02268123318 = if ((size(i.payments) == 2)) | |
654 | 705 | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
655 | 706 | then throw("Wrong payment asset A") | |
656 | 707 | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
663 | 714 | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
664 | 715 | else throw("Wrong payment") | |
665 | 716 | else throw("One or two payments expected") | |
666 | - | let pmtA = $ | |
667 | - | let pmtAssetA = $ | |
668 | - | let pmtB = $ | |
669 | - | let pmtAssetB = $ | |
717 | + | let pmtA = $t02268123318._1 | |
718 | + | let pmtAssetA = $t02268123318._2 | |
719 | + | let pmtB = $t02268123318._3 | |
720 | + | let pmtAssetB = $t02268123318._4 | |
670 | 721 | let newPosNum = getNewUserPositionNumber(pool, toString(i.caller)) | |
671 | 722 | if ((leverage > 100)) | |
672 | 723 | then { | |
680 | 731 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._1 | |
681 | 732 | let paydInDollar = (fraction(dPriceA, pmtA, pow(10, 0, getAssetDecimals(pmtAssetA), 0, 0, DOWN)) + fraction(dPriceB, pmtB, pow(10, 0, getAssetDecimals(pmtAssetB), 0, 0, DOWN))) | |
682 | 733 | let borrowAmount = fraction(paydInDollar, (leverage - 100), 100) | |
683 | - | let request = makeString([ | |
734 | + | let request = makeString([toString(i.caller), pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, borrowAssetId, toString(borrowAmount)], ",") | |
684 | 735 | let newRequestId = { | |
685 | 736 | let @ = invoke(this, "createNewRequest", [request], nil) | |
686 | 737 | if ($isInstanceOf(@, "Int")) | |
698 | 749 | else throw("Strict value is not equal to itself.") | |
699 | 750 | } | |
700 | 751 | else { | |
701 | - | let $t02337223763 = if ((type == SF_POOL)) | |
702 | - | then replenishSwopFi(pool, NO_LOAN_FEE, pmtA, pmtAssetA, pmtB, pmtAssetB, balA, balB, shareId) | |
703 | - | else replenishWX(pool, NO_LOAN_FEE, pmtA, pmtAssetA, pmtB, pmtAssetB, shareId) | |
704 | - | let userStaked = $t02337223763._1 | |
705 | - | let axlyFee = $t02337223763._2 | |
706 | - | replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, type) | |
752 | + | let $t02461524727 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
753 | + | let userStaked = $t02461524727._1 | |
754 | + | let axlyFee = $t02461524727._2 | |
755 | + | replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, pType) | |
707 | 756 | } | |
708 | 757 | } | |
709 | 758 | ||
711 | 760 | ||
712 | 761 | @Callable(i) | |
713 | 762 | func replenishFromLand (requestId) = { | |
714 | - | let request = split(valueOrErrorMessage(getString(this, (requestId + kRequestId)), ("No request with id " + requestId)), ",") | |
763 | + | let $t02488924993 = parseRequest(requestId) | |
764 | + | let user = $t02488924993._1 | |
765 | + | let pool = $t02488924993._2 | |
766 | + | let pmtA = $t02488924993._3 | |
767 | + | let AId = $t02488924993._4 | |
768 | + | let pmtB = $t02488924993._5 | |
769 | + | let BId = $t02488924993._6 | |
770 | + | let balA = $t02488924993._7 | |
771 | + | let balB = $t02488924993._8 | |
772 | + | let shareId = $t02488924993._9 | |
773 | + | let bwAsset = $t02488924993._10 | |
774 | + | let bwAmount = $t02488924993._11 | |
715 | 775 | if ((size(i.payments) != 1)) | |
716 | 776 | then throw("Wrong payment size") | |
717 | - | else if (if ((assetIdToStr(i.payments[0].assetId) != | |
777 | + | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
718 | 778 | then true | |
719 | - | else (i.payments[0].amount != | |
779 | + | else (i.payments[0].amount != bwAmount)) | |
720 | 780 | then throw("Wrong payment") | |
721 | 781 | else { | |
722 | - | let pmtA = if ((request[4] == assetIdToStr(i.payments[0].assetId))) | |
723 | - | then (parseIntValue(request[3]) + i.payments[0].amount) | |
724 | - | else parseIntValue(request[3]) | |
725 | - | let pmtB = if ((request[6] == assetIdToStr(i.payments[0].assetId))) | |
726 | - | then (parseIntValue(request[5]) + i.payments[0].amount) | |
727 | - | else parseIntValue(request[3]) | |
728 | - | let pool = request[2] | |
729 | - | let user = request[1] | |
730 | - | let shareId = request[9] | |
731 | - | let posNum = parseIntValue(request[12]) | |
732 | - | let $t02472125236 = if ((request[0] == SF_POOL)) | |
733 | - | then replenishSwopFi(pool, LOAN_FEE, pmtA, request[4], pmtB, request[6], parseIntValue(request[7]), parseIntValue(request[8]), shareId) | |
734 | - | else if ((request[0] == WX_POOL)) | |
735 | - | then replenishWX(pool, LOAN_FEE, pmtA, request[4], pmtB, request[6], shareId) | |
736 | - | else throw("Wrong request type") | |
737 | - | let userStaked = $t02472125236._1 | |
738 | - | let axlyFee = $t02472125236._2 | |
739 | - | let borrowEntries = [IntegerEntry((((((request[2] + "_") + request[1]) + "_") + request[12]) + kUserBorrowAmount), i.payments[0].amount), StringEntry((((((request[2] + "_") + request[1]) + "_") + request[12]) + kUserBorrowAssetId), request[10])] | |
740 | - | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, request[0]) | |
782 | + | let $t02518325307 = if ((AId == bwAsset)) | |
783 | + | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
784 | + | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
785 | + | let pmtAllA = $t02518325307._1 | |
786 | + | let pmtAllB = $t02518325307._2 | |
787 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
788 | + | let $t02538925498 = replenishByType(pType, pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
789 | + | let userStaked = $t02538925498._1 | |
790 | + | let axlyFee = $t02538925498._2 | |
791 | + | let posNum = getNewUserPositionNumber(pool, toString(i.caller)) | |
792 | + | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
793 | + | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType) | |
741 | 794 | $Tuple2(((entries ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
742 | 795 | } | |
743 | 796 | } | |
763 | 816 | else throw(($getType(@) + " couldn't be cast to Int")) | |
764 | 817 | } | |
765 | 818 | else 0 | |
766 | - | let $ | |
767 | - | if (($ | |
819 | + | let $t02694027060 = withdrawAmountCalc(pool, userCanWithdraw, debt, borrowAsset) | |
820 | + | if (($t02694027060 == $t02694027060)) | |
768 | 821 | then { | |
769 | - | let assetIdB = $ | |
770 | - | let toUserAmountB = $ | |
771 | - | let assetIdA = $ | |
772 | - | let toUserAmountA = $ | |
822 | + | let assetIdB = $t02694027060._4 | |
823 | + | let toUserAmountB = $t02694027060._3 | |
824 | + | let assetIdA = $t02694027060._2 | |
825 | + | let toUserAmountA = $t02694027060._1 | |
773 | 826 | let closeDbtInv = if ((debt > 0)) | |
774 | 827 | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + toString(posId))], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
775 | 828 | else 0 | |
792 | 845 | ||
793 | 846 | @Callable(i) | |
794 | 847 | func capitalizeExKeeper (pool,type,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = { | |
795 | - | let $ | |
848 | + | let $t02835728551 = if (claim) | |
796 | 849 | then claimFarmed(type, pool) | |
797 | 850 | else { | |
798 | 851 | let claimedAsset = if ((type == SF_POOL)) | |
800 | 853 | else WXID | |
801 | 854 | $Tuple2(amountToExchange, claimedAsset) | |
802 | 855 | } | |
803 | - | let claimedAmount = $ | |
804 | - | let claimedAsset = $ | |
856 | + | let claimedAmount = $t02835728551._1 | |
857 | + | let claimedAsset = $t02835728551._2 | |
805 | 858 | let exchangedAmount = exchangeKeeper(tokenToId, amountToExchange, claimedAsset, amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options) | |
806 | 859 | let change = (claimedAmount - amountToExchange) | |
807 | 860 | let changeEntry = if ((change > 0)) | |
814 | 867 | ||
815 | 868 | @Callable(i) | |
816 | 869 | func capitalizeExPazzle (pool,type,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = { | |
817 | - | let $ | |
870 | + | let $t02920729401 = if (claim) | |
818 | 871 | then claimFarmed(type, pool) | |
819 | 872 | else { | |
820 | 873 | let claimedAsset = if ((type == SF_POOL)) | |
822 | 875 | else WXID | |
823 | 876 | $Tuple2(amountToExchange, claimedAsset) | |
824 | 877 | } | |
825 | - | let claimedAmount = $ | |
826 | - | let claimedAsset = $ | |
878 | + | let claimedAmount = $t02920729401._1 | |
879 | + | let claimedAsset = $t02920729401._2 | |
827 | 880 | let exchangedAmount = exchangePazzle(tokenToId, amountToExchange, claimedAsset, routesStr, minToReceive, options) | |
828 | 881 | let change = (claimedAmount - amountToExchange) | |
829 | 882 | let changeEntry = if ((change > 0)) | |
836 | 889 | ||
837 | 890 | @Callable(i) | |
838 | 891 | func capitalizeExSwopFi (pool,type,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = { | |
839 | - | let $ | |
892 | + | let $t03012430318 = if (claim) | |
840 | 893 | then claimFarmed(type, pool) | |
841 | 894 | else { | |
842 | 895 | let claimedAsset = if ((type == SF_POOL)) | |
844 | 897 | else WXID | |
845 | 898 | $Tuple2(amountToExchange, claimedAsset) | |
846 | 899 | } | |
847 | - | let claimedAmount = $ | |
848 | - | let claimedAsset = $ | |
900 | + | let claimedAmount = $t03012430318._1 | |
901 | + | let claimedAsset = $t03012430318._2 | |
849 | 902 | let exchangedAmount = exchangeSwopFi(tokenToId, amountToExchange, claimedAsset, exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options) | |
850 | 903 | let change = (claimedAmount - amountToExchange) | |
851 | 904 | let changeEntry = if ((change > 0)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SF_POOL = "SF" | |
5 | 5 | ||
6 | 6 | let WX_POOL = "WX" | |
7 | 7 | ||
8 | 8 | let CAP_FEE = "cap" | |
9 | 9 | ||
10 | 10 | let LOAN_FEE = "loan" | |
11 | 11 | ||
12 | 12 | let NO_LOAN_FEE = "noLoan" | |
13 | 13 | ||
14 | 14 | let SCALE8 = 100000000 | |
15 | 15 | ||
16 | 16 | let SCALE10 = 10000000000 | |
17 | 17 | ||
18 | 18 | let FEE_SCALE6 = 1000000 | |
19 | 19 | ||
20 | 20 | let kSFPoolAAssetBalance = "A_asset_balance" | |
21 | 21 | ||
22 | 22 | let kSFPoolBAssetBalance = "B_asset_balance" | |
23 | 23 | ||
24 | 24 | let kSFPoolAAssetId = "A_asset_id" | |
25 | 25 | ||
26 | 26 | let kSFPoolBAssetId = "B_asset_id" | |
27 | 27 | ||
28 | 28 | let kSFPoolShareId = "share_asset_id" | |
29 | 29 | ||
30 | 30 | let kSFPoolFee = "commission" | |
31 | 31 | ||
32 | 32 | let kUserPosition = "_user_position" | |
33 | 33 | ||
34 | 34 | let kUserBorrowAmount = "_user_position_borrow_amount" | |
35 | 35 | ||
36 | 36 | let kUserBorrowAssetId = "_user_position_borrow_asset_id" | |
37 | 37 | ||
38 | 38 | let kUserPositionNum = "_user_position_number" | |
39 | 39 | ||
40 | 40 | let kUserPositionInterest = "_user_position_interest" | |
41 | 41 | ||
42 | 42 | let kPoolTotal = "_pool_total" | |
43 | 43 | ||
44 | 44 | let kPoolInterest = "_pool_interest" | |
45 | 45 | ||
46 | 46 | let kAxlyInFeeWithoutLoan = "_axly_fee_without_loan" | |
47 | 47 | ||
48 | 48 | let kAxlyInFeeWithLoan = "_axly_fee_with_loan" | |
49 | 49 | ||
50 | 50 | let kAxlyCapFee = "_axly_fee_cap" | |
51 | 51 | ||
52 | 52 | let kRequestId = "_request_id" | |
53 | 53 | ||
54 | 54 | let kRequestIter = "requests_iter" | |
55 | 55 | ||
56 | 56 | let kPool = "pool_" | |
57 | 57 | ||
58 | 58 | let kPoolCapChange = "_pool_cap_change" | |
59 | 59 | ||
60 | 60 | let kMoneyBox = "axly_money_box" | |
61 | 61 | ||
62 | 62 | let kSFFarmingAddr = "swopfi_farming_addr" | |
63 | 63 | ||
64 | 64 | let kLendService = "lend_service_addr" | |
65 | 65 | ||
66 | 66 | let kPriceOracle = "price_oracle" | |
67 | 67 | ||
68 | 68 | let kExContract = "exchange_contract" | |
69 | 69 | ||
70 | 70 | let kWxSwapContract = "wx_swap_contract" | |
71 | 71 | ||
72 | 72 | let moneyBox = Address(fromBase58String(valueOrErrorMessage(getString(this, kMoneyBox), "No axly moneyBox address"))) | |
73 | 73 | ||
74 | 74 | let exContract = Address(fromBase58String(valueOrErrorMessage(getString(this, kExContract), "No exchange contract address"))) | |
75 | 75 | ||
76 | 76 | let priceOracleAddr = Address(fromBase58String(valueOrErrorMessage(getString(this, kPriceOracle), "No price oracle address"))) | |
77 | 77 | ||
78 | 78 | let wxSwapContract = Address(fromBase58String(valueOrErrorMessage(getString(this, kWxSwapContract), "No wx swap address"))) | |
79 | 79 | ||
80 | 80 | let SWOPID = base58'4W19ndijcc2CsQa9HGW2dfXKTVXhnneWWttxXrtjPmEp' | |
81 | 81 | ||
82 | 82 | let WXID = base58'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc' | |
83 | 83 | ||
84 | 84 | func isSelfCall (i) = if ((i.caller == this)) | |
85 | 85 | then unit | |
86 | 86 | else throw("Only contract itself can call this function") | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func accountBalance (assetId) = match assetId { | |
90 | 90 | case id: ByteVector => | |
91 | 91 | assetBalance(this, id) | |
92 | 92 | case waves: Unit => | |
93 | 93 | wavesBalance(this).available | |
94 | 94 | case _ => | |
95 | 95 | throw("Match error") | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func getSFPoolData (poolAddr) = $Tuple5(valueOrErrorMessage(getString(poolAddr, kSFPoolAAssetId), "Can't get pool A asset id"), valueOrErrorMessage(getString(poolAddr, kSFPoolBAssetId), "Can't get pool B asset id"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolAAssetBalance), "Can't get pool A asset balance"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolBAssetBalance), "Can't get pool B asset balance"), valueOrErrorMessage(getString(poolAddr, kSFPoolShareId), "Can't get share asset id")) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func getWXPoolData (poolAddr) = { | |
103 | 103 | let cfg = { | |
104 | 104 | let @ = invoke(poolAddr, "getPoolConfigWrapperREADONLY", nil, nil) | |
105 | 105 | if ($isInstanceOf(@, "List[Any]")) | |
106 | 106 | then @ | |
107 | 107 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
108 | 108 | } | |
109 | 109 | if ((cfg == cfg)) | |
110 | 110 | then $Tuple5(valueOrErrorMessage({ | |
111 | 111 | let @ = cfg[4] | |
112 | 112 | if ($isInstanceOf(@, "String")) | |
113 | 113 | then @ | |
114 | 114 | else unit | |
115 | 115 | }, "Can't get pool A asset id"), valueOrErrorMessage({ | |
116 | 116 | let @ = cfg[5] | |
117 | 117 | if ($isInstanceOf(@, "String")) | |
118 | 118 | then @ | |
119 | 119 | else unit | |
120 | 120 | }, "Can't get pool B asset id"), 0, 0, valueOrErrorMessage({ | |
121 | 121 | let @ = cfg[3] | |
122 | 122 | if ($isInstanceOf(@, "String")) | |
123 | 123 | then @ | |
124 | 124 | else unit | |
125 | 125 | }, "Can't get pool LP asset id")) | |
126 | 126 | else throw("Strict value is not equal to itself.") | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func getPoolData (poolAddr,type) = if ((type == SF_POOL)) | |
131 | 131 | then getSFPoolData(poolAddr) | |
132 | 132 | else if ((type == WX_POOL)) | |
133 | 133 | then getWXPoolData(poolAddr) | |
134 | 134 | else throw("Wrong pool type") | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func getPoolTotalShare (pool) = valueOrElse(getInteger(this, (pool + kPoolTotal)), 0) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func getNewUserPositionNumber (pool,user) = (valueOrElse(getInteger(this, (((pool + "_") + user) + kUserPositionNum)), 0) + 1) | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func getAxlyFee (pool,feeType) = if ((feeType == "cap")) | |
144 | 144 | then getIntegerValue(this, (pool + kAxlyCapFee)) | |
145 | 145 | else if ((feeType == "loan")) | |
146 | 146 | then getIntegerValue(this, (pool + kAxlyInFeeWithLoan)) | |
147 | 147 | else if ((feeType == "noLoan")) | |
148 | 148 | then getIntegerValue(this, (pool + kAxlyInFeeWithoutLoan)) | |
149 | 149 | else throw("Wrong fee type") | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | func getSFFarmingAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kSFFarmingAddr), "Can't get swopfi farming addr"))) | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func getWXFarmingAddr (poolAddr) = { | |
156 | 156 | let fContract = Address(fromBase58String(valueOrErrorMessage(getString(poolAddr, "%s__factoryContract"), "Can't get WX factory contract addr"))) | |
157 | 157 | let factroyCfg = split(valueOrErrorMessage(getString(fContract, "%s__factoryConfig"), "Can't get WX factory cfg"), "__") | |
158 | 158 | Address(fromBase58String(factroyCfg[1])) | |
159 | 159 | } | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func getLendSrvAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kLendService), "Can't get lend service addr"))) | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func assetIdToStr (assetId) = match assetId { | |
166 | 166 | case id: ByteVector => | |
167 | 167 | toBase58String(id) | |
168 | 168 | case waves: Unit => | |
169 | 169 | "WAVES" | |
170 | 170 | case _ => | |
171 | 171 | throw("Match error") | |
172 | 172 | } | |
173 | 173 | ||
174 | 174 | ||
175 | 175 | func assetIdFromStr (assetId) = if ((assetId == "WAVES")) | |
176 | 176 | then unit | |
177 | 177 | else fromBase58String(assetId) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func getAssetDecimals (assetId) = if ((assetId == "WAVES")) | |
181 | 181 | then 8 | |
182 | 182 | else match assetInfo(fromBase58String(assetId)) { | |
183 | 183 | case asset: Asset => | |
184 | 184 | asset.decimals | |
185 | 185 | case _ => | |
186 | 186 | throw("Can't find asset") | |
187 | 187 | } | |
188 | 188 | ||
189 | 189 | ||
190 | 190 | func replenishSwopFi (pool,feeType,pmtA,pmtAssetA,pmtB,pmtAssetB,balA,balB,shareId) = { | |
191 | 191 | let shareBalanceBefore = accountBalance(fromBase58String(shareId)) | |
192 | 192 | if ((shareBalanceBefore == shareBalanceBefore)) | |
193 | 193 | then { | |
194 | 194 | let poolAddr = Address(fromBase58String(pool)) | |
195 | 195 | let ratioA = fraction(SCALE8, pmtA, balA) | |
196 | 196 | let ratioB = fraction(SCALE8, pmtB, balB) | |
197 | 197 | let $t063976689 = if ((ratioB > ratioA)) | |
198 | 198 | then { | |
199 | 199 | let pmt = fraction(balB, ratioA, SCALE8, CEILING) | |
200 | 200 | $Tuple4(pmtA, pmt, (pmtB - pmt), pmtAssetB) | |
201 | 201 | } | |
202 | 202 | else { | |
203 | 203 | let pmt = fraction(balA, ratioB, SCALE8, CEILING) | |
204 | 204 | $Tuple4(pmt, pmtB, (pmtA - pmt), pmtAssetA) | |
205 | 205 | } | |
206 | 206 | let pmtAmountA = $t063976689._1 | |
207 | 207 | let pmtAmountB = $t063976689._2 | |
208 | 208 | let change = $t063976689._3 | |
209 | 209 | let changeAssetId = $t063976689._4 | |
210 | 210 | let inv1 = if (if ((pmtAmountA > 0)) | |
211 | 211 | then (pmtAmountB > 0) | |
212 | 212 | else false) | |
213 | 213 | then { | |
214 | 214 | let payments = [AttachedPayment(assetIdFromStr(pmtAssetA), pmtAmountA), AttachedPayment(assetIdFromStr(pmtAssetB), pmtAmountB)] | |
215 | 215 | invoke(poolAddr, "callFunction", ["replenishWithTwoTokens", ["false", "0"]], payments) | |
216 | 216 | } | |
217 | 217 | else 0 | |
218 | 218 | if ((inv1 == inv1)) | |
219 | 219 | then { | |
220 | 220 | let inv2 = if ((change > 0)) | |
221 | 221 | then { | |
222 | 222 | let payments = [AttachedPayment(assetIdFromStr(changeAssetId), change)] | |
223 | 223 | let vars = ["0", "false", "0"] | |
224 | 224 | invoke(poolAddr, "callFunction", ["replenishWithOneToken", vars], payments) | |
225 | 225 | } | |
226 | 226 | else 0 | |
227 | 227 | if ((inv2 == inv2)) | |
228 | 228 | then { | |
229 | 229 | let shareBalanceAfter = accountBalance(fromBase58String(shareId)) | |
230 | 230 | let totalStaked = (shareBalanceAfter - shareBalanceBefore) | |
231 | 231 | let axlyFeeAmount = fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
232 | 232 | let userShareForStake = (totalStaked - axlyFeeAmount) | |
233 | 233 | if ((0 >= userShareForStake)) | |
234 | 234 | then throw("amount of staked sharetokens must be > 0") | |
235 | 235 | else { | |
236 | 236 | let inv3 = invoke(getSFFarmingAddr(), "lockShareTokens", [pool, 0], [AttachedPayment(fromBase58String(shareId), userShareForStake)]) | |
237 | 237 | if ((inv3 == inv3)) | |
238 | 238 | then $Tuple2(userShareForStake, axlyFeeAmount) | |
239 | 239 | else throw("Strict value is not equal to itself.") | |
240 | 240 | } | |
241 | 241 | } | |
242 | 242 | else throw("Strict value is not equal to itself.") | |
243 | 243 | } | |
244 | 244 | else throw("Strict value is not equal to itself.") | |
245 | 245 | } | |
246 | 246 | else throw("Strict value is not equal to itself.") | |
247 | 247 | } | |
248 | 248 | ||
249 | 249 | ||
250 | 250 | func replenishWX (pool,feeType,pmtA,pmtAssetA,pmtB,pmtAssetB,shareId) = { | |
251 | 251 | let poolAddr = Address(fromBase58String(pool)) | |
252 | 252 | let $t081408989 = if (if ((pmtA > 0)) | |
253 | 253 | then (pmtB > 0) | |
254 | 254 | else false) | |
255 | 255 | then { | |
256 | 256 | let evalPutInA = split({ | |
257 | 257 | let @ = invoke(poolAddr, "evaluatePutByAmountAssetREADONLY", [pmtA], nil) | |
258 | 258 | if ($isInstanceOf(@, "String")) | |
259 | 259 | then @ | |
260 | 260 | else throw(($getType(@) + " couldn't be cast to String")) | |
261 | 261 | }, "__") | |
262 | 262 | if ((evalPutInA == evalPutInA)) | |
263 | 263 | then { | |
264 | 264 | let evalPutInB = split({ | |
265 | 265 | let @ = invoke(poolAddr, "evaluatePutByPriceAssetREADONLY", [pmtB], nil) | |
266 | 266 | if ($isInstanceOf(@, "String")) | |
267 | 267 | then @ | |
268 | 268 | else throw(($getType(@) + " couldn't be cast to String")) | |
269 | 269 | }, "__") | |
270 | 270 | if ((evalPutInB == evalPutInB)) | |
271 | 271 | then { | |
272 | 272 | let lpInA = parseIntValue(evalPutInA[1]) | |
273 | 273 | let lpInB = parseIntValue(evalPutInB[1]) | |
274 | 274 | if ((lpInB > lpInA)) | |
275 | 275 | then { | |
276 | 276 | let pmtInB = parseIntValue(evalPutInA[8]) | |
277 | 277 | $Tuple4(pmtA, pmtInB, (pmtB - pmtInB), pmtAssetB) | |
278 | 278 | } | |
279 | 279 | else { | |
280 | 280 | let pmtInA = parseIntValue(evalPutInB[7]) | |
281 | 281 | $Tuple4(pmtInA, pmtB, (pmtA - pmtInA), pmtAssetA) | |
282 | 282 | } | |
283 | 283 | } | |
284 | 284 | else throw("Strict value is not equal to itself.") | |
285 | 285 | } | |
286 | 286 | else throw("Strict value is not equal to itself.") | |
287 | 287 | } | |
288 | 288 | else if ((pmtA > 0)) | |
289 | 289 | then $Tuple4(pmtA, pmtB, pmtA, pmtAssetA) | |
290 | 290 | else if ((pmtB > 0)) | |
291 | 291 | then $Tuple4(pmtA, pmtB, pmtB, pmtAssetB) | |
292 | 292 | else throw("pmts must be > 0") | |
293 | 293 | let pmtAmountA = $t081408989._1 | |
294 | 294 | let pmtAmountB = $t081408989._2 | |
295 | 295 | let change = $t081408989._3 | |
296 | 296 | let changeAssetId = $t081408989._4 | |
297 | 297 | let shareBalanceBefore = accountBalance(fromBase58String(shareId)) | |
298 | 298 | if ((shareBalanceBefore == shareBalanceBefore)) | |
299 | 299 | then { | |
300 | 300 | let inv1 = if (if ((pmtAmountA > 0)) | |
301 | 301 | then (pmtAmountB > 0) | |
302 | 302 | else false) | |
303 | 303 | then { | |
304 | 304 | let payments = [AttachedPayment(assetIdFromStr(pmtAssetA), pmtAmountA), AttachedPayment(assetIdFromStr(pmtAssetB), pmtAmountB)] | |
305 | 305 | invoke(poolAddr, "put", [1000000, false], payments) | |
306 | 306 | } | |
307 | 307 | else 0 | |
308 | 308 | if ((inv1 == inv1)) | |
309 | 309 | then { | |
310 | 310 | let inv2 = if ((change > 0)) | |
311 | 311 | then { | |
312 | 312 | let payments = [AttachedPayment(assetIdFromStr(changeAssetId), change)] | |
313 | 313 | invoke(poolAddr, "putOneTkn", [0, false], payments) | |
314 | 314 | } | |
315 | 315 | else 0 | |
316 | 316 | if ((inv2 == inv2)) | |
317 | 317 | then { | |
318 | 318 | let shareBalanceAfter = accountBalance(fromBase58String(shareId)) | |
319 | 319 | let totalStaked = (shareBalanceAfter - shareBalanceBefore) | |
320 | 320 | let axlyFeeAmount = fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
321 | 321 | let userShareForStake = (totalStaked - axlyFeeAmount) | |
322 | 322 | if ((0 >= userShareForStake)) | |
323 | 323 | then throw("amount of staked sharetokens must be > 0") | |
324 | 324 | else { | |
325 | 325 | let inv3 = invoke(getWXFarmingAddr(poolAddr), "stake", nil, [AttachedPayment(fromBase58String(shareId), userShareForStake)]) | |
326 | 326 | if ((inv3 == inv3)) | |
327 | 327 | then $Tuple2(userShareForStake, axlyFeeAmount) | |
328 | 328 | else throw("Strict value is not equal to itself.") | |
329 | 329 | } | |
330 | 330 | } | |
331 | 331 | else throw("Strict value is not equal to itself.") | |
332 | 332 | } | |
333 | 333 | else throw("Strict value is not equal to itself.") | |
334 | 334 | } | |
335 | 335 | else throw("Strict value is not equal to itself.") | |
336 | 336 | } | |
337 | 337 | ||
338 | 338 | ||
339 | + | func replenishByType (type,pool,feeType,pmtA,AId,pmtB,BId,balA,balB,shareId) = if ((type == SF_POOL)) | |
340 | + | then replenishSwopFi(pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
341 | + | else if ((type == WX_POOL)) | |
342 | + | then replenishWX(pool, LOAN_FEE, pmtA, AId, pmtB, BId, shareId) | |
343 | + | else throw("Wrong pool type") | |
344 | + | ||
345 | + | ||
339 | 346 | func replenishEntries (pool,user,stakedAmount,axlyFeeAmount,posNum,shareId,type) = { | |
340 | 347 | let totalAmount = getPoolTotalShare(pool) | |
341 | 348 | let curPoolInterest = getIntegerValue(this, (pool + kPoolInterest)) | |
342 | 349 | [IntegerEntry((pool + kPoolTotal), (totalAmount + stakedAmount)), IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserPosition), stakedAmount), IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserPositionInterest), curPoolInterest), IntegerEntry((((pool + "_") + user) + kUserPositionNum), posNum), ScriptTransfer(moneyBox, axlyFeeAmount, fromBase58String(shareId))] | |
343 | 350 | } | |
344 | 351 | ||
345 | 352 | ||
346 | 353 | func claimFarmed (type,pool) = if ((type == SF_POOL)) | |
347 | 354 | then { | |
348 | 355 | let balBefore = accountBalance(SWOPID) | |
349 | 356 | if ((balBefore == balBefore)) | |
350 | 357 | then { | |
351 | 358 | let inv = invoke(getSFFarmingAddr(), "claim", [pool], nil) | |
352 | 359 | if ((inv == inv)) | |
353 | 360 | then { | |
354 | 361 | let balAfter = accountBalance(SWOPID) | |
355 | 362 | $Tuple2((balAfter - balBefore), SWOPID) | |
356 | 363 | } | |
357 | 364 | else throw("Strict value is not equal to itself.") | |
358 | 365 | } | |
359 | 366 | else throw("Strict value is not equal to itself.") | |
360 | 367 | } | |
361 | 368 | else if ((type == WX_POOL)) | |
362 | 369 | then { | |
363 | 370 | let balBefore = accountBalance(WXID) | |
364 | 371 | if ((balBefore == balBefore)) | |
365 | 372 | then { | |
366 | 373 | let inv = invoke(getWXFarmingAddr(Address(fromBase58String(pool))), "claimWX", [pool], nil) | |
367 | 374 | if ((inv == inv)) | |
368 | 375 | then { | |
369 | 376 | let balAfter = accountBalance(WXID) | |
370 | 377 | $Tuple2((balAfter - balBefore), WXID) | |
371 | 378 | } | |
372 | 379 | else throw("Strict value is not equal to itself.") | |
373 | 380 | } | |
374 | 381 | else throw("Strict value is not equal to itself.") | |
375 | 382 | } | |
376 | 383 | else throw("Wrong pool type") | |
377 | 384 | ||
378 | 385 | ||
379 | 386 | func exchangeKeeper (toToken,pmtAmount,pmtAsset,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = { | |
380 | 387 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
381 | 388 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
382 | 389 | then { | |
383 | 390 | let inv = invoke(exContract, "swap", [amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
384 | 391 | if ((inv == inv)) | |
385 | 392 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
386 | 393 | else throw("Strict value is not equal to itself.") | |
387 | 394 | } | |
388 | 395 | else throw("Strict value is not equal to itself.") | |
389 | 396 | } | |
390 | 397 | ||
391 | 398 | ||
392 | 399 | func exchangePazzle (toToken,pmtAmount,pmtAsset,routesStr,minToReceive,options) = { | |
393 | 400 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
394 | 401 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
395 | 402 | then { | |
396 | 403 | let inv = invoke(exContract, "puzzleSwap", [routesStr, minToReceive, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
397 | 404 | if ((inv == inv)) | |
398 | 405 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
399 | 406 | else throw("Strict value is not equal to itself.") | |
400 | 407 | } | |
401 | 408 | else throw("Strict value is not equal to itself.") | |
402 | 409 | } | |
403 | 410 | ||
404 | 411 | ||
405 | 412 | func exchangeSwopFi (toToken,pmtAmount,pmtAsset,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = { | |
406 | 413 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
407 | 414 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
408 | 415 | then { | |
409 | 416 | let inv = invoke(exContract, "swopfiSwap", [exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
410 | 417 | if ((inv == inv)) | |
411 | 418 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
412 | 419 | else throw("Strict value is not equal to itself.") | |
413 | 420 | } | |
414 | 421 | else throw("Strict value is not equal to itself.") | |
415 | 422 | } | |
416 | 423 | ||
417 | 424 | ||
418 | - | func capitalize (pool, | |
425 | + | func capitalize (pool,pType,tokenId,tokenAmount) = { | |
419 | 426 | let poolAddr = Address(fromBase58String(pool)) | |
420 | - | let $ | |
421 | - | let AId = $ | |
422 | - | let BId = $ | |
423 | - | let balA = $ | |
424 | - | let balB = $ | |
425 | - | let shareId = $ | |
426 | - | let $ | |
427 | + | let $t01382413903 = getPoolData(poolAddr, pType) | |
428 | + | let AId = $t01382413903._1 | |
429 | + | let BId = $t01382413903._2 | |
430 | + | let balA = $t01382413903._3 | |
431 | + | let balB = $t01382413903._4 | |
432 | + | let shareId = $t01382413903._5 | |
433 | + | let $t01390613986 = if ((tokenId == AId)) | |
427 | 434 | then $Tuple2(tokenAmount, 0) | |
428 | 435 | else $Tuple2(0, tokenAmount) | |
429 | - | let pmtA = $t01327113351._1 | |
430 | - | let pmtB = $t01327113351._2 | |
431 | - | let $t01335413715 = if ((type == SF_POOL)) | |
432 | - | then replenishSwopFi(pool, CAP_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
433 | - | else replenishWX(pool, CAP_FEE, pmtA, AId, pmtB, BId, shareId) | |
434 | - | let stakedAmount = $t01335413715._1 | |
435 | - | let axlyFee = $t01335413715._2 | |
436 | + | let pmtA = $t01390613986._1 | |
437 | + | let pmtB = $t01390613986._2 | |
438 | + | let $t01398914099 = replenishByType(pType, pool, CAP_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
439 | + | let stakedAmount = $t01398914099._1 | |
440 | + | let axlyFee = $t01398914099._2 | |
436 | 441 | let curPoolInterest = valueOrElse(getInteger(this, (pool + kPoolInterest)), 0) | |
437 | 442 | let totalShareAmount = getPoolTotalShare(pool) | |
438 | 443 | let newInterest = (curPoolInterest + fraction(stakedAmount, SCALE10, totalShareAmount)) | |
439 | 444 | [IntegerEntry((pool + kPoolInterest), newInterest), ScriptTransfer(moneyBox, axlyFee, fromBase58String(shareId))] | |
440 | 445 | } | |
441 | 446 | ||
442 | 447 | ||
443 | 448 | func exchangeDirectlySF (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
444 | 449 | let poolAddr = Address(fromBase58String(pool)) | |
445 | 450 | let feeScale6 = 1000000 | |
446 | 451 | let fee = getIntegerValue(poolAddr, kSFPoolFee) | |
447 | 452 | let amntGetNoFee = fraction(amountTokenToGet, feeScale6, (feeScale6 - fee)) | |
448 | - | let $ | |
453 | + | let $t01479215080 = if ((assetTokenToGet == assetIdA)) | |
449 | 454 | then { | |
450 | 455 | let amountToPay = fraction(balA, amntGetNoFee, (balB - amntGetNoFee)) | |
451 | 456 | $Tuple2(amountToPay, assetIdB) | |
452 | 457 | } | |
453 | 458 | else { | |
454 | 459 | let amountToPay = fraction(balB, amntGetNoFee, (balA - amntGetNoFee)) | |
455 | 460 | $Tuple2(amountToPay, assetIdA) | |
456 | 461 | } | |
457 | - | let amountToPay = $ | |
458 | - | let assetToPay = $ | |
462 | + | let amountToPay = $t01479215080._1 | |
463 | + | let assetToPay = $t01479215080._2 | |
459 | 464 | invoke(poolAddr, "callFunction", ["exchange", ["1"]], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
460 | 465 | } | |
461 | 466 | ||
462 | 467 | ||
463 | 468 | func exchangeDirectlyWX (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
464 | 469 | let poolAddr = Address(fromBase58String(pool)) | |
465 | 470 | let prFee = getIntegerValue(wxSwapContract, "%s__protocolFee") | |
466 | 471 | let pFee = getIntegerValue(wxSwapContract, "%s__poolFee") | |
467 | 472 | let feeScale = toBigInt(100000000) | |
468 | - | let $ | |
473 | + | let $t01555915867 = if ((assetTokenToGet == assetIdA)) | |
469 | 474 | then { | |
470 | 475 | let amountToPay = fraction(balA, amountTokenToGet, (balB - amountTokenToGet)) | |
471 | 476 | $Tuple2(amountToPay, assetIdB) | |
472 | 477 | } | |
473 | 478 | else { | |
474 | 479 | let amountToPay = fraction(balB, amountTokenToGet, (balA - amountTokenToGet)) | |
475 | 480 | $Tuple2(amountToPay, assetIdA) | |
476 | 481 | } | |
477 | - | let amountToPay = $ | |
478 | - | let assetToPay = $ | |
482 | + | let amountToPay = $t01555915867._1 | |
483 | + | let assetToPay = $t01555915867._2 | |
479 | 484 | let amountToPayWithFee = toInt(fraction(toBigInt(amountToPay), feeScale, (feeScale - toBigInt((prFee + pFee))))) | |
480 | 485 | invoke(wxSwapContract, "swap", [1, assetTokenToGet, toString(this)], [AttachedPayment(assetIdFromStr(assetToPay), amountToPayWithFee)]) | |
481 | 486 | } | |
482 | 487 | ||
483 | 488 | ||
484 | 489 | func exchangeDirectly (type,pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = if ((type == SF_POOL)) | |
485 | 490 | then exchangeDirectlySF(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
486 | 491 | else exchangeDirectlyWX(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
487 | 492 | ||
488 | 493 | ||
489 | 494 | func withdrawAmountCalc (pool,userCanWithdraw,debt,borrowAsset) = { | |
490 | 495 | let poolAddr = Address(fromBase58String(pool)) | |
491 | 496 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
492 | - | let $ | |
493 | - | let assetIdA = $ | |
494 | - | let assetIdB = $ | |
495 | - | let balA = $ | |
496 | - | let balB = $ | |
497 | + | let $t01673216799 = getPoolData(poolAddr, pType) | |
498 | + | let assetIdA = $t01673216799._1 | |
499 | + | let assetIdB = $t01673216799._2 | |
500 | + | let balA = $t01673216799._3 | |
501 | + | let balB = $t01673216799._4 | |
497 | 502 | let cBalABefore = accountBalance(assetIdFromStr(assetIdA)) | |
498 | 503 | if ((cBalABefore == cBalABefore)) | |
499 | 504 | then { | |
500 | 505 | let cBalBBefore = accountBalance(assetIdFromStr(assetIdB)) | |
501 | 506 | if ((cBalBBefore == cBalBBefore)) | |
502 | 507 | then { | |
503 | 508 | let inv = if ((pType == SF_POOL)) | |
504 | 509 | then invoke(poolAddr, "callFunction", ["withdraw", [toString(userCanWithdraw)]], nil) | |
505 | 510 | else if ((pType == WX_POOL)) | |
506 | 511 | then invoke(poolAddr, "unstakeAndGet", [userCanWithdraw], nil) | |
507 | 512 | else throw("Wrong position type") | |
508 | 513 | if ((inv == inv)) | |
509 | 514 | then { | |
510 | 515 | let cBalAAfter = accountBalance(assetIdFromStr(assetIdA)) | |
511 | 516 | let cBalBAfter = accountBalance(assetIdFromStr(assetIdB)) | |
512 | - | let $ | |
513 | - | let tokensAmountA = $ | |
514 | - | let tokensAmountB = $ | |
515 | - | let $ | |
517 | + | let $t01731117400 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
518 | + | let tokensAmountA = $t01731117400._1 | |
519 | + | let tokensAmountB = $t01731117400._2 | |
520 | + | let $t01740318099 = if ((debt > 0)) | |
516 | 521 | then { | |
517 | 522 | let amountToGetEx = if (if ((borrowAsset == assetIdA)) | |
518 | 523 | then (debt > tokensAmountA) | |
519 | 524 | else false) | |
520 | 525 | then (debt - tokensAmountA) | |
521 | 526 | else if (if ((borrowAsset == assetIdB)) | |
522 | 527 | then (debt > tokensAmountB) | |
523 | 528 | else false) | |
524 | 529 | then (debt - tokensAmountB) | |
525 | 530 | else 0 | |
526 | 531 | let exInv = if ((amountToGetEx > 0)) | |
527 | 532 | then exchangeDirectly(pType, pool, assetIdA, assetIdB, balA, balB, amountToGetEx, borrowAsset) | |
528 | 533 | else 0 | |
529 | 534 | if ((exInv == exInv)) | |
530 | 535 | then { | |
531 | 536 | let cBalAAfterRepay = accountBalance(assetIdFromStr(assetIdA)) | |
532 | 537 | let cBalBAfterRepay = accountBalance(assetIdFromStr(assetIdB)) | |
533 | 538 | $Tuple2((cBalAAfterRepay - cBalABefore), (cBalBAfterRepay - cBalBBefore)) | |
534 | 539 | } | |
535 | 540 | else throw("Strict value is not equal to itself.") | |
536 | 541 | } | |
537 | 542 | else $Tuple2(tokensAmountA, tokensAmountB) | |
538 | - | let toUserAmountA = $ | |
539 | - | let toUserAmountB = $ | |
543 | + | let toUserAmountA = $t01740318099._1 | |
544 | + | let toUserAmountB = $t01740318099._2 | |
540 | 545 | $Tuple4(toUserAmountA, assetIdA, toUserAmountB, assetIdB) | |
541 | 546 | } | |
542 | 547 | else throw("Strict value is not equal to itself.") | |
543 | 548 | } | |
544 | 549 | else throw("Strict value is not equal to itself.") | |
545 | 550 | } | |
546 | 551 | else throw("Strict value is not equal to itself.") | |
547 | 552 | } | |
548 | 553 | ||
549 | 554 | ||
555 | + | func parseRequest (requestId) = { | |
556 | + | let request = split(valueOrErrorMessage(getString(this, (requestId + kRequestId)), ("No request with id " + requestId)), ",") | |
557 | + | let user = request[0] | |
558 | + | let pool = request[1] | |
559 | + | let pmtA = parseIntValue(request[2]) | |
560 | + | let AId = request[3] | |
561 | + | let pmtB = parseIntValue(request[4]) | |
562 | + | let BId = request[5] | |
563 | + | let balA = parseIntValue(request[6]) | |
564 | + | let balB = parseIntValue(request[7]) | |
565 | + | let shareId = request[8] | |
566 | + | let bwAsset = request[9] | |
567 | + | let bwAmount = parseIntValue(request[10]) | |
568 | + | $Tuple11(user, pool, pmtA, AId, pmtB, BId, balA, balB, shareId, bwAsset, bwAmount) | |
569 | + | } | |
570 | + | ||
571 | + | ||
550 | 572 | @Callable(i) | |
551 | 573 | func replenishREADONLY (pool,leverage,borrowAssetId) = if (if ((100 > leverage)) | |
552 | 574 | then true | |
553 | 575 | else (leverage > 300)) | |
554 | 576 | then throw("Leverage can't be <100 and >300") | |
555 | 577 | else { | |
556 | - | let | |
557 | - | let $ | |
558 | - | let AId = $ | |
559 | - | let BId = $ | |
560 | - | let balA = $ | |
561 | - | let balB = $ | |
562 | - | let shareId = $ | |
563 | - | let $ | |
578 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
579 | + | let $t01905319143 = getPoolData(Address(fromBase58String(pool)), pType) | |
580 | + | let AId = $t01905319143._1 | |
581 | + | let BId = $t01905319143._2 | |
582 | + | let balA = $t01905319143._3 | |
583 | + | let balB = $t01905319143._4 | |
584 | + | let shareId = $t01905319143._5 | |
585 | + | let $t01914619783 = if ((size(i.payments) == 2)) | |
564 | 586 | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
565 | 587 | then throw("Wrong payment asset A") | |
566 | 588 | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
567 | 589 | then throw("Wrong payment asset B") | |
568 | 590 | else $Tuple4(i.payments[0].amount, AId, i.payments[1].amount, BId) | |
569 | 591 | else if ((size(i.payments) == 1)) | |
570 | 592 | then if ((assetIdToStr(i.payments[0].assetId) == AId)) | |
571 | 593 | then $Tuple4(i.payments[0].amount, AId, 0, BId) | |
572 | 594 | else if ((assetIdToStr(i.payments[0].assetId) == BId)) | |
573 | 595 | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
574 | 596 | else throw("Wrong payment") | |
575 | 597 | else throw("One or two payments expected") | |
576 | - | let pmtA = $ | |
577 | - | let pmtAssetA = $ | |
578 | - | let pmtB = $ | |
579 | - | let pmtAssetB = $ | |
580 | - | let $ | |
598 | + | let pmtA = $t01914619783._1 | |
599 | + | let pmtAssetA = $t01914619783._2 | |
600 | + | let pmtB = $t01914619783._3 | |
601 | + | let pmtAssetB = $t01914619783._4 | |
602 | + | let $t01978621297 = if ((leverage > 100)) | |
581 | 603 | then { | |
582 | 604 | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetA, false], nil) | |
583 | 605 | if ($isInstanceOf(@, "(Int, Int)")) | |
584 | 606 | then @ | |
585 | 607 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._1 | |
586 | 608 | let dPriceB = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetB, false], nil) | |
587 | 609 | if ($isInstanceOf(@, "(Int, Int)")) | |
588 | 610 | then @ | |
589 | 611 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._1 | |
590 | 612 | let paydInDollar = (fraction(dPriceA, pmtA, pow(10, 0, getAssetDecimals(pmtAssetA), 0, 0, DOWN)) + fraction(dPriceB, pmtB, pow(10, 0, getAssetDecimals(pmtAssetB), 0, 0, DOWN))) | |
591 | 613 | let borrowAmount = fraction(paydInDollar, (leverage - 100), 100) | |
592 | - | let request = makeString([ | |
614 | + | let request = makeString([toString(i.caller), pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, borrowAssetId, toString(borrowAmount), toString(1)], ",") | |
593 | 615 | let newRequestId = { | |
594 | 616 | let @ = invoke(this, "createNewRequest", [request], nil) | |
595 | 617 | if ($isInstanceOf(@, "Int")) | |
596 | 618 | then @ | |
597 | 619 | else throw(($getType(@) + " couldn't be cast to Int")) | |
598 | 620 | } | |
599 | 621 | if ((newRequestId == newRequestId)) | |
600 | 622 | then { | |
601 | 623 | let args = [((toString(i.caller) + "_") + toString(1)), shareId, borrowAssetId, borrowAmount, toString(this), "replenishFromLandReadOnly", toString(valueOrErrorMessage(newRequestId, "Can't create new request"))] | |
602 | 624 | let inv = reentrantInvoke(getLendSrvAddr(), "flashPosition", args, nil) | |
603 | 625 | if ((inv == inv)) | |
604 | 626 | then if ((borrowAssetId == pmtAssetA)) | |
605 | 627 | then $Tuple4((pmtA + borrowAmount), pmtB, LOAN_FEE, borrowAmount) | |
606 | 628 | else $Tuple4(pmtA, (pmtB + borrowAmount), LOAN_FEE, borrowAmount) | |
607 | 629 | else throw("Strict value is not equal to itself.") | |
608 | 630 | } | |
609 | 631 | else throw("Strict value is not equal to itself.") | |
610 | 632 | } | |
611 | 633 | else $Tuple4(pmtA, pmtB, NO_LOAN_FEE, 0) | |
612 | - | let paymentA = $t01881020335._1 | |
613 | - | let paymentB = $t01881020335._2 | |
614 | - | let feeType = $t01881020335._3 | |
615 | - | let borrowAmount = $t01881020335._4 | |
616 | - | let $t02033820732 = if ((type == SF_POOL)) | |
617 | - | then replenishSwopFi(pool, feeType, paymentA, pmtAssetA, paymentB, pmtAssetB, balA, balB, shareId) | |
618 | - | else replenishWX(pool, feeType, pmtA, pmtAssetA, pmtB, pmtAssetB, shareId) | |
619 | - | let userStaked = $t02033820732._1 | |
620 | - | let axlyFee = $t02033820732._2 | |
621 | - | let $t02073520860 = withdrawAmountCalc(pool, userStaked, borrowAmount, borrowAssetId) | |
622 | - | if (($t02073520860 == $t02073520860)) | |
634 | + | let paymentA = $t01978621297._1 | |
635 | + | let paymentB = $t01978621297._2 | |
636 | + | let feeType = $t01978621297._3 | |
637 | + | let borrowAmount = $t01978621297._4 | |
638 | + | let $t02130021412 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
639 | + | let userStaked = $t02130021412._1 | |
640 | + | let axlyFee = $t02130021412._2 | |
641 | + | let $t02141621541 = withdrawAmountCalc(pool, userStaked, borrowAmount, borrowAssetId) | |
642 | + | if (($t02141621541 == $t02141621541)) | |
623 | 643 | then { | |
624 | - | let assetIdB = $ | |
625 | - | let toUserAmountB = $ | |
626 | - | let assetIdA = $ | |
627 | - | let toUserAmountA = $ | |
644 | + | let assetIdB = $t02141621541._4 | |
645 | + | let toUserAmountB = $t02141621541._3 | |
646 | + | let assetIdA = $t02141621541._2 | |
647 | + | let toUserAmountA = $t02141621541._1 | |
628 | 648 | $Tuple2(nil, [userStaked, toUserAmountA, toUserAmountB]) | |
629 | 649 | } | |
630 | 650 | else throw("Strict value is not equal to itself.") | |
631 | 651 | } | |
632 | 652 | ||
633 | 653 | ||
634 | 654 | ||
635 | 655 | @Callable(i) | |
636 | - | func replenishFromLandReadOnly (requestId) = $Tuple2(nil, 11111) | |
656 | + | func replenishFromLandReadOnly (requestId) = { | |
657 | + | let $t02166521769 = parseRequest(requestId) | |
658 | + | let user = $t02166521769._1 | |
659 | + | let pool = $t02166521769._2 | |
660 | + | let pmtA = $t02166521769._3 | |
661 | + | let AId = $t02166521769._4 | |
662 | + | let pmtB = $t02166521769._5 | |
663 | + | let BId = $t02166521769._6 | |
664 | + | let balA = $t02166521769._7 | |
665 | + | let balB = $t02166521769._8 | |
666 | + | let shareId = $t02166521769._9 | |
667 | + | let bwAsset = $t02166521769._10 | |
668 | + | let bwAmount = $t02166521769._11 | |
669 | + | if ((size(i.payments) != 1)) | |
670 | + | then throw("Wrong payment size") | |
671 | + | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
672 | + | then true | |
673 | + | else (i.payments[0].amount != bwAmount)) | |
674 | + | then throw("Wrong payment") | |
675 | + | else { | |
676 | + | let $t02195922083 = if ((AId == bwAsset)) | |
677 | + | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
678 | + | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
679 | + | let pmtAllA = $t02195922083._1 | |
680 | + | let pmtAllB = $t02195922083._2 | |
681 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
682 | + | let $t02216522274 = replenishByType(pType, pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
683 | + | let userStaked = $t02216522274._1 | |
684 | + | let axlyFee = $t02216522274._2 | |
685 | + | nil | |
686 | + | } | |
687 | + | } | |
637 | 688 | ||
638 | 689 | ||
639 | 690 | ||
640 | 691 | @Callable(i) | |
641 | 692 | func replenish (pool,leverage,borrowAssetId) = if (if ((100 > leverage)) | |
642 | 693 | then true | |
643 | 694 | else (leverage > 300)) | |
644 | 695 | then throw("Leverage can't be <100 and >300") | |
645 | 696 | else { | |
646 | - | let | |
647 | - | let $ | |
648 | - | let AId = $ | |
649 | - | let BId = $ | |
650 | - | let balA = $ | |
651 | - | let balB = $ | |
652 | - | let shareId = $ | |
653 | - | let $ | |
697 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
698 | + | let $t02258822678 = getPoolData(Address(fromBase58String(pool)), pType) | |
699 | + | let AId = $t02258822678._1 | |
700 | + | let BId = $t02258822678._2 | |
701 | + | let balA = $t02258822678._3 | |
702 | + | let balB = $t02258822678._4 | |
703 | + | let shareId = $t02258822678._5 | |
704 | + | let $t02268123318 = if ((size(i.payments) == 2)) | |
654 | 705 | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
655 | 706 | then throw("Wrong payment asset A") | |
656 | 707 | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
657 | 708 | then throw("Wrong payment asset B") | |
658 | 709 | else $Tuple4(i.payments[0].amount, AId, i.payments[1].amount, BId) | |
659 | 710 | else if ((size(i.payments) == 1)) | |
660 | 711 | then if ((assetIdToStr(i.payments[0].assetId) == AId)) | |
661 | 712 | then $Tuple4(i.payments[0].amount, AId, 0, BId) | |
662 | 713 | else if ((assetIdToStr(i.payments[0].assetId) == BId)) | |
663 | 714 | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
664 | 715 | else throw("Wrong payment") | |
665 | 716 | else throw("One or two payments expected") | |
666 | - | let pmtA = $ | |
667 | - | let pmtAssetA = $ | |
668 | - | let pmtB = $ | |
669 | - | let pmtAssetB = $ | |
717 | + | let pmtA = $t02268123318._1 | |
718 | + | let pmtAssetA = $t02268123318._2 | |
719 | + | let pmtB = $t02268123318._3 | |
720 | + | let pmtAssetB = $t02268123318._4 | |
670 | 721 | let newPosNum = getNewUserPositionNumber(pool, toString(i.caller)) | |
671 | 722 | if ((leverage > 100)) | |
672 | 723 | then { | |
673 | 724 | let dPriceA = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetA, false], nil) | |
674 | 725 | if ($isInstanceOf(@, "(Int, Int)")) | |
675 | 726 | then @ | |
676 | 727 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._1 | |
677 | 728 | let dPriceB = ( let @ = invoke(priceOracleAddr, "getTWAP60", [pmtAssetB, false], nil) | |
678 | 729 | if ($isInstanceOf(@, "(Int, Int)")) | |
679 | 730 | then @ | |
680 | 731 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")))._1 | |
681 | 732 | let paydInDollar = (fraction(dPriceA, pmtA, pow(10, 0, getAssetDecimals(pmtAssetA), 0, 0, DOWN)) + fraction(dPriceB, pmtB, pow(10, 0, getAssetDecimals(pmtAssetB), 0, 0, DOWN))) | |
682 | 733 | let borrowAmount = fraction(paydInDollar, (leverage - 100), 100) | |
683 | - | let request = makeString([ | |
734 | + | let request = makeString([toString(i.caller), pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, borrowAssetId, toString(borrowAmount)], ",") | |
684 | 735 | let newRequestId = { | |
685 | 736 | let @ = invoke(this, "createNewRequest", [request], nil) | |
686 | 737 | if ($isInstanceOf(@, "Int")) | |
687 | 738 | then @ | |
688 | 739 | else throw(($getType(@) + " couldn't be cast to Int")) | |
689 | 740 | } | |
690 | 741 | if ((newRequestId == newRequestId)) | |
691 | 742 | then { | |
692 | 743 | let args = [((toString(i.caller) + "_") + toString(newPosNum)), shareId, borrowAssetId, borrowAmount, toString(this), "replenishFromLand", toString(valueOrErrorMessage(newRequestId, "Can't create new request"))] | |
693 | 744 | let inv = reentrantInvoke(getLendSrvAddr(), "flashPosition", args, nil) | |
694 | 745 | if ((inv == inv)) | |
695 | 746 | then nil | |
696 | 747 | else throw("Strict value is not equal to itself.") | |
697 | 748 | } | |
698 | 749 | else throw("Strict value is not equal to itself.") | |
699 | 750 | } | |
700 | 751 | else { | |
701 | - | let $t02337223763 = if ((type == SF_POOL)) | |
702 | - | then replenishSwopFi(pool, NO_LOAN_FEE, pmtA, pmtAssetA, pmtB, pmtAssetB, balA, balB, shareId) | |
703 | - | else replenishWX(pool, NO_LOAN_FEE, pmtA, pmtAssetA, pmtB, pmtAssetB, shareId) | |
704 | - | let userStaked = $t02337223763._1 | |
705 | - | let axlyFee = $t02337223763._2 | |
706 | - | replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, type) | |
752 | + | let $t02461524727 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
753 | + | let userStaked = $t02461524727._1 | |
754 | + | let axlyFee = $t02461524727._2 | |
755 | + | replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, pType) | |
707 | 756 | } | |
708 | 757 | } | |
709 | 758 | ||
710 | 759 | ||
711 | 760 | ||
712 | 761 | @Callable(i) | |
713 | 762 | func replenishFromLand (requestId) = { | |
714 | - | let request = split(valueOrErrorMessage(getString(this, (requestId + kRequestId)), ("No request with id " + requestId)), ",") | |
763 | + | let $t02488924993 = parseRequest(requestId) | |
764 | + | let user = $t02488924993._1 | |
765 | + | let pool = $t02488924993._2 | |
766 | + | let pmtA = $t02488924993._3 | |
767 | + | let AId = $t02488924993._4 | |
768 | + | let pmtB = $t02488924993._5 | |
769 | + | let BId = $t02488924993._6 | |
770 | + | let balA = $t02488924993._7 | |
771 | + | let balB = $t02488924993._8 | |
772 | + | let shareId = $t02488924993._9 | |
773 | + | let bwAsset = $t02488924993._10 | |
774 | + | let bwAmount = $t02488924993._11 | |
715 | 775 | if ((size(i.payments) != 1)) | |
716 | 776 | then throw("Wrong payment size") | |
717 | - | else if (if ((assetIdToStr(i.payments[0].assetId) != | |
777 | + | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
718 | 778 | then true | |
719 | - | else (i.payments[0].amount != | |
779 | + | else (i.payments[0].amount != bwAmount)) | |
720 | 780 | then throw("Wrong payment") | |
721 | 781 | else { | |
722 | - | let pmtA = if ((request[4] == assetIdToStr(i.payments[0].assetId))) | |
723 | - | then (parseIntValue(request[3]) + i.payments[0].amount) | |
724 | - | else parseIntValue(request[3]) | |
725 | - | let pmtB = if ((request[6] == assetIdToStr(i.payments[0].assetId))) | |
726 | - | then (parseIntValue(request[5]) + i.payments[0].amount) | |
727 | - | else parseIntValue(request[3]) | |
728 | - | let pool = request[2] | |
729 | - | let user = request[1] | |
730 | - | let shareId = request[9] | |
731 | - | let posNum = parseIntValue(request[12]) | |
732 | - | let $t02472125236 = if ((request[0] == SF_POOL)) | |
733 | - | then replenishSwopFi(pool, LOAN_FEE, pmtA, request[4], pmtB, request[6], parseIntValue(request[7]), parseIntValue(request[8]), shareId) | |
734 | - | else if ((request[0] == WX_POOL)) | |
735 | - | then replenishWX(pool, LOAN_FEE, pmtA, request[4], pmtB, request[6], shareId) | |
736 | - | else throw("Wrong request type") | |
737 | - | let userStaked = $t02472125236._1 | |
738 | - | let axlyFee = $t02472125236._2 | |
739 | - | let borrowEntries = [IntegerEntry((((((request[2] + "_") + request[1]) + "_") + request[12]) + kUserBorrowAmount), i.payments[0].amount), StringEntry((((((request[2] + "_") + request[1]) + "_") + request[12]) + kUserBorrowAssetId), request[10])] | |
740 | - | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, request[0]) | |
782 | + | let $t02518325307 = if ((AId == bwAsset)) | |
783 | + | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
784 | + | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
785 | + | let pmtAllA = $t02518325307._1 | |
786 | + | let pmtAllB = $t02518325307._2 | |
787 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
788 | + | let $t02538925498 = replenishByType(pType, pool, LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
789 | + | let userStaked = $t02538925498._1 | |
790 | + | let axlyFee = $t02538925498._2 | |
791 | + | let posNum = getNewUserPositionNumber(pool, toString(i.caller)) | |
792 | + | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
793 | + | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType) | |
741 | 794 | $Tuple2(((entries ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
742 | 795 | } | |
743 | 796 | } | |
744 | 797 | ||
745 | 798 | ||
746 | 799 | ||
747 | 800 | @Callable(i) | |
748 | 801 | func withdraw (pool,posId) = { | |
749 | 802 | let user = toString(i.caller) | |
750 | 803 | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + toString(posId)) + kUserPosition)), "Unknown position") | |
751 | 804 | let userInterest = getIntegerValue(this, (((((pool + "_") + user) + "_") + toString(posId)) + kUserPositionInterest)) | |
752 | 805 | let poolInterst = getIntegerValue(this, (pool + kPoolInterest)) | |
753 | 806 | let poolTotalShare = getPoolTotalShare(pool) | |
754 | 807 | let userCanWithdraw = (pAmount + fraction(pAmount, (poolInterst - userInterest), SCALE10)) | |
755 | 808 | let userAddr = Address(fromBase58String(user)) | |
756 | 809 | let borrowAmount = getIntegerValue(this, (((((pool + "_") + user) + "_") + toString(posId)) + kUserBorrowAmount)) | |
757 | 810 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + toString(posId)) + kUserBorrowAssetId)) | |
758 | 811 | let debt = if ((borrowAmount > 0)) | |
759 | 812 | then { | |
760 | 813 | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((((pool + "_") + user) + "_") + toString(posId)), borrowAsset], nil) | |
761 | 814 | if ($isInstanceOf(@, "Int")) | |
762 | 815 | then @ | |
763 | 816 | else throw(($getType(@) + " couldn't be cast to Int")) | |
764 | 817 | } | |
765 | 818 | else 0 | |
766 | - | let $ | |
767 | - | if (($ | |
819 | + | let $t02694027060 = withdrawAmountCalc(pool, userCanWithdraw, debt, borrowAsset) | |
820 | + | if (($t02694027060 == $t02694027060)) | |
768 | 821 | then { | |
769 | - | let assetIdB = $ | |
770 | - | let toUserAmountB = $ | |
771 | - | let assetIdA = $ | |
772 | - | let toUserAmountA = $ | |
822 | + | let assetIdB = $t02694027060._4 | |
823 | + | let toUserAmountB = $t02694027060._3 | |
824 | + | let assetIdA = $t02694027060._2 | |
825 | + | let toUserAmountA = $t02694027060._1 | |
773 | 826 | let closeDbtInv = if ((debt > 0)) | |
774 | 827 | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + toString(posId))], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
775 | 828 | else 0 | |
776 | 829 | if ((closeDbtInv == closeDbtInv)) | |
777 | 830 | then [DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPosition)), DeleteEntry((((((pool + "_") + user) + "_") + toString(posId)) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), (poolTotalShare - userCanWithdraw)), ScriptTransfer(userAddr, toUserAmountA, assetIdFromStr(assetIdA)), ScriptTransfer(userAddr, toUserAmountB, assetIdFromStr(assetIdB))] | |
778 | 831 | else throw("Strict value is not equal to itself.") | |
779 | 832 | } | |
780 | 833 | else throw("Strict value is not equal to itself.") | |
781 | 834 | } | |
782 | 835 | ||
783 | 836 | ||
784 | 837 | ||
785 | 838 | @Callable(i) | |
786 | 839 | func createNewRequest (params) = valueOrElse(isSelfCall(i), { | |
787 | 840 | let newRequestId = (valueOrElse(getInteger(this, kRequestIter), 0) + 1) | |
788 | 841 | $Tuple2([StringEntry((toString(newRequestId) + kRequestId), params), IntegerEntry(kRequestIter, newRequestId)], newRequestId) | |
789 | 842 | }) | |
790 | 843 | ||
791 | 844 | ||
792 | 845 | ||
793 | 846 | @Callable(i) | |
794 | 847 | func capitalizeExKeeper (pool,type,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = { | |
795 | - | let $ | |
848 | + | let $t02835728551 = if (claim) | |
796 | 849 | then claimFarmed(type, pool) | |
797 | 850 | else { | |
798 | 851 | let claimedAsset = if ((type == SF_POOL)) | |
799 | 852 | then SWOPID | |
800 | 853 | else WXID | |
801 | 854 | $Tuple2(amountToExchange, claimedAsset) | |
802 | 855 | } | |
803 | - | let claimedAmount = $ | |
804 | - | let claimedAsset = $ | |
856 | + | let claimedAmount = $t02835728551._1 | |
857 | + | let claimedAsset = $t02835728551._2 | |
805 | 858 | let exchangedAmount = exchangeKeeper(tokenToId, amountToExchange, claimedAsset, amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options) | |
806 | 859 | let change = (claimedAmount - amountToExchange) | |
807 | 860 | let changeEntry = if ((change > 0)) | |
808 | 861 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
809 | 862 | else nil | |
810 | 863 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
811 | 864 | } | |
812 | 865 | ||
813 | 866 | ||
814 | 867 | ||
815 | 868 | @Callable(i) | |
816 | 869 | func capitalizeExPazzle (pool,type,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = { | |
817 | - | let $ | |
870 | + | let $t02920729401 = if (claim) | |
818 | 871 | then claimFarmed(type, pool) | |
819 | 872 | else { | |
820 | 873 | let claimedAsset = if ((type == SF_POOL)) | |
821 | 874 | then SWOPID | |
822 | 875 | else WXID | |
823 | 876 | $Tuple2(amountToExchange, claimedAsset) | |
824 | 877 | } | |
825 | - | let claimedAmount = $ | |
826 | - | let claimedAsset = $ | |
878 | + | let claimedAmount = $t02920729401._1 | |
879 | + | let claimedAsset = $t02920729401._2 | |
827 | 880 | let exchangedAmount = exchangePazzle(tokenToId, amountToExchange, claimedAsset, routesStr, minToReceive, options) | |
828 | 881 | let change = (claimedAmount - amountToExchange) | |
829 | 882 | let changeEntry = if ((change > 0)) | |
830 | 883 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
831 | 884 | else nil | |
832 | 885 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
833 | 886 | } | |
834 | 887 | ||
835 | 888 | ||
836 | 889 | ||
837 | 890 | @Callable(i) | |
838 | 891 | func capitalizeExSwopFi (pool,type,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = { | |
839 | - | let $ | |
892 | + | let $t03012430318 = if (claim) | |
840 | 893 | then claimFarmed(type, pool) | |
841 | 894 | else { | |
842 | 895 | let claimedAsset = if ((type == SF_POOL)) | |
843 | 896 | then SWOPID | |
844 | 897 | else WXID | |
845 | 898 | $Tuple2(amountToExchange, claimedAsset) | |
846 | 899 | } | |
847 | - | let claimedAmount = $ | |
848 | - | let claimedAsset = $ | |
900 | + | let claimedAmount = $t03012430318._1 | |
901 | + | let claimedAsset = $t03012430318._2 | |
849 | 902 | let exchangedAmount = exchangeSwopFi(tokenToId, amountToExchange, claimedAsset, exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options) | |
850 | 903 | let change = (claimedAmount - amountToExchange) | |
851 | 904 | let changeEntry = if ((change > 0)) | |
852 | 905 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
853 | 906 | else nil | |
854 | 907 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
855 | 908 | } | |
856 | 909 | ||
857 | 910 | ||
858 | 911 | ||
859 | 912 | @Callable(i) | |
860 | 913 | func initNewPool (type,poolAddr,inFeeNoLoan,inFeeLoan,capFee) = if (if ((type != SF_POOL)) | |
861 | 914 | then (type != WX_POOL) | |
862 | 915 | else false) | |
863 | 916 | then throw("Wrong type") | |
864 | 917 | else [IntegerEntry((poolAddr + kAxlyInFeeWithoutLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyInFeeWithLoan), inFeeLoan), IntegerEntry((poolAddr + kAxlyCapFee), capFee), IntegerEntry((poolAddr + kPoolInterest), 0), StringEntry((kPool + poolAddr), type)] | |
865 | 918 | ||
866 | 919 | ||
867 | 920 | @Verifier(tx) | |
868 | 921 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
869 | 922 |
github/deemru/w8io/026f985 115.10 ms ◑