tx · 4opCmweNFJvfGjV1kBC5K5Kgyr2up5W19rX3J8B4rERv 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS: -0.05300000 Waves 2023.08.09 17:08 [2703161] smart account 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS > SELF 0.00000000 Waves
{ "type": 13, "id": "4opCmweNFJvfGjV1kBC5K5Kgyr2up5W19rX3J8B4rERv", "fee": 5300000, "feeAssetId": null, "timestamp": 1691590100823, "version": 2, "chainId": 84, "sender": "3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS", "senderPublicKey": "HP8sssVq1866F7CaPQJwgFrt6fsqhQjKwM84cL1wjD2a", "proofs": [ "3AsxcpMtHTYLd5mZj1buyThT4jzxALjKiM4nUkU8k87gpMx8xhV1NVsmfp2kvc4kcAt8ZwuU7z9dZ5e1NDMxyPHU" ], "script": "base64:BgLBAQgCEgMKAQgSAwoBCBIECgIICBIFCgMIGBgSBQoDCAEIEgQKAggBEgYKBAEICAESBQoDAQgIEg8KDQgICAgICAgICAgICAgSAwoBCBIDCgEIEgUKAwgIARIGCgQIAQgIEg0KCwgIAQQRGBgYAQEYEgkKBwgIAQQIARgSDQoLCAgBBBgYGBgYARgSBQoDCAQBEgsKCQgIAQEBAQEBBBIJCgcIAQEBAQEBEgASABIAEgASABIAEgASABIDCgEIEgMKAQiBAQAHU0ZfUE9PTAICU0YAB1dYX1BPT0wCAldYAA9DQVBfRkVFX05PX0xPQU4CCWNhcE5vTG9hbgAMQ0FQX0ZFRV9MT0FOAgdjYXBMb2FuABRTVE9QTE9TU19GRUVfTk9fTE9BTgIOc3RvcExvc3NOb0xvYW4ADVNUT1BMT1NTX0xPQU4CDHN0b3BMb3NzTG9hbgAITE9BTl9GRUUCBGxvYW4AC05PX0xPQU5fRkVFAgZub0xvYW4ABk5PX0ZFRQIFbm9GZWUABlNDQUxFOACAwtcvAAdTQ0FMRTEwAIDIr6AlAAdTQ0FMRTE2CQC2AgEAgICE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b2wJAQt2YWx1ZU9yRWxzZQIJAQtpc0FkbWluQ2FsbAEFAWkDCQEBIQEJAQlpc0RlZmluZWQBCQCdCAIFBHRoaXMJAKwCAgUFa1Bvb2wFBHBvb2wJAAIBAgxVbmtub3duIHBvb2wDCQEBIQEJAQt2YWx1ZU9yRWxzZQIJAJsIAgUEdGhpcwkArAICBQRwb29sBQtrUG9vbEFjdGl2ZQYJAAIBAhVQb29sIGFscmVhZHkgc2h1dGRvd24JAMwIAgkBDEJvb2xlYW5FbnRyeQIJAKwCAgUEcG9vbAULa1Bvb2xBY3RpdmUHBQNuaWwAu303DA==", "height": 2703161, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FxVCrpoJFb2gwrAJBhMAeUvSjuGMv8pTNvFKARVw2ixj Next: 5W8me79ju9vr22gKggeGKTHUvDDc2gnGH7wsLsZTbiku Diff:
Old | New | Differences | |
---|---|---|---|
67 | 67 | ||
68 | 68 | let kAxlyInFeeWithLoan = "_axlyFeeWithLoan" | |
69 | 69 | ||
70 | - | let kAxlyNoLoanCapFee = "_ | |
70 | + | let kAxlyNoLoanCapFee = "_axlyFeeCapNoLoan" | |
71 | 71 | ||
72 | - | let kAxlyWithLoanCapFee = "_ | |
72 | + | let kAxlyWithLoanCapFee = "_axlyFeeCapWithLoan" | |
73 | 73 | ||
74 | 74 | let kAxlyStopLossNoLoanFee = "_axlyFeeStoplossWithLoan" | |
75 | 75 | ||
105 | 105 | ||
106 | 106 | let kLendService = "lend_service_addr" | |
107 | 107 | ||
108 | - | let | |
108 | + | let kOperatorCallPK = "admin_call_pub_key" | |
109 | 109 | ||
110 | 110 | let kPriceOracle = "price_oracle" | |
111 | 111 | ||
116 | 116 | let kSwopId = "swop_id" | |
117 | 117 | ||
118 | 118 | let kWxId = "wx_id" | |
119 | + | ||
120 | + | let kGroup1Admin1PK = "group1_admin1_pub_key" | |
121 | + | ||
122 | + | let kGroup1Admin2PK = "group1_admin2_pub_key" | |
123 | + | ||
124 | + | let kGroup2Admin1PK = "group2_admin1_pub_key" | |
125 | + | ||
126 | + | let kGroup2Admin2PK = "group2_admin2_pub_key" | |
119 | 127 | ||
120 | 128 | let moneyBox = Address(fromBase58String(valueOrErrorMessage(getString(this, kMoneyBox), "No axly moneyBox address"))) | |
121 | 129 | ||
129 | 137 | ||
130 | 138 | let WXID = fromBase58String(valueOrErrorMessage(getString(this, kWxId), "No wx id")) | |
131 | 139 | ||
140 | + | let group1Admin1PK = fromBase58String(valueOrErrorMessage(getString(this, kGroup1Admin1PK), "Can't get kGroup1Admin1PK")) | |
141 | + | ||
142 | + | let group1Admin2PK = fromBase58String(valueOrErrorMessage(getString(this, kGroup1Admin2PK), "Can't get kGroup1Admin2PK")) | |
143 | + | ||
144 | + | let group2Admin1PK = fromBase58String(valueOrErrorMessage(getString(this, kGroup2Admin1PK), "Can't get kGroup2Admin1PK")) | |
145 | + | ||
146 | + | let group2Admin2PK = fromBase58String(valueOrErrorMessage(getString(this, kGroup2Admin2PK), "Can't get kGroup2Admin1PK")) | |
147 | + | ||
148 | + | let operatorPK = fromBase58String(valueOrErrorMessage(getString(this, kOperatorCallPK), "Can't get operatorPK")) | |
149 | + | ||
132 | 150 | func unknownPoolType () = throw("Wrong pool type") | |
133 | 151 | ||
134 | 152 | ||
135 | 153 | func getLendSrvAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kLendService), "Can't get lend service addr"))) | |
136 | 154 | ||
137 | 155 | ||
138 | - | func getAdminCallAddr () = addressFromPublicKey(fromBase58String(valueOrErrorMessage(getString(this, kAdminCallPK), "Can't get admin addr"))) | |
156 | + | func isOperatorCall (i) = if ((i.callerPublicKey == i.callerPublicKey)) | |
157 | + | then unit | |
158 | + | else throw("Only operator can call this function") | |
139 | 159 | ||
140 | 160 | ||
141 | - | func isAdminCall (i) = if ((i.caller == getAdminCallAddr())) | |
161 | + | func isAdminCall (i) = if (if ((i.callerPublicKey == i.callerPublicKey)) | |
162 | + | then true | |
163 | + | else (i.callerPublicKey == i.callerPublicKey)) | |
142 | 164 | then unit | |
143 | - | else throw("Only admin can call this function") | |
165 | + | else throw("Only admin group1 can call this function") | |
144 | 166 | ||
145 | 167 | ||
146 | 168 | func isSelfCall (i) = if ((i.caller == this)) | |
210 | 232 | ||
211 | 233 | ||
212 | 234 | func getSFPoolData (poolAddr) = { | |
213 | - | let $ | |
214 | - | if (($ | |
235 | + | let $t079127961 = getSFPoolBalances(poolAddr) | |
236 | + | if (($t079127961 == $t079127961)) | |
215 | 237 | then { | |
216 | - | let balB = $ | |
217 | - | let balA = $ | |
238 | + | let balB = $t079127961._2 | |
239 | + | let balA = $t079127961._1 | |
218 | 240 | $Tuple5(valueOrErrorMessage(getString(poolAddr, kSFPoolAAssetId), "Can't get pool A asset id"), valueOrErrorMessage(getString(poolAddr, kSFPoolBAssetId), "Can't get pool B asset id"), balA, balB, valueOrErrorMessage(getString(poolAddr, kSFPoolShareId), "Can't get share asset id")) | |
219 | 241 | } | |
220 | 242 | else throw("Strict value is not equal to itself.") | |
248 | 270 | then @ | |
249 | 271 | else unit | |
250 | 272 | }, "Can't get pool LP asset id") | |
251 | - | let $ | |
252 | - | if (($ | |
273 | + | let $t086588717 = getWXPoolBalances(poolAddr, aId, bId) | |
274 | + | if (($t086588717 == $t086588717)) | |
253 | 275 | then { | |
254 | - | let balB = $ | |
255 | - | let balA = $ | |
276 | + | let balB = $t086588717._2 | |
277 | + | let balA = $t086588717._1 | |
256 | 278 | $Tuple5(aId, bId, balA, balB, shareId) | |
257 | 279 | } | |
258 | 280 | else throw("Strict value is not equal to itself.") | |
337 | 359 | ||
338 | 360 | func getAssetsPrice (assetIds) = { | |
339 | 361 | func getPrices (a,assetId) = { | |
340 | - | let assetPrice = | |
362 | + | let assetPrice = valueOrElse(getInteger(priceOracleAddr, (assetId + kPriceInOracle)), -1) | |
341 | 363 | (a :+ assetPrice) | |
342 | 364 | } | |
343 | 365 | ||
360 | 382 | let pool = valueOrErrorMessage(getString(this, (shareId + kSharePool)), "Can't find pool addr by share id") | |
361 | 383 | let poolAddr = Address(fromBase58String(pool)) | |
362 | 384 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
363 | - | let $t01084710912 = getPoolData(poolAddr, pType) | |
364 | - | let aId = $t01084710912._1 | |
365 | - | let bId = $t01084710912._2 | |
366 | - | let aBalance = $t01084710912._3 | |
367 | - | let bBalance = $t01084710912._4 | |
368 | - | let dPriceA = getIntegerValue(priceOracleAddr, (aId + kPriceInOracle)) | |
369 | - | let dPriceB = getIntegerValue(priceOracleAddr, (bId + kPriceInOracle)) | |
370 | - | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
371 | - | let APrecision = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
372 | - | let BPrecision = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
373 | - | let sharePrecision = pow(10, 0, getAssetDecimals(shareId), 0, 0, DOWN) | |
374 | - | let sum = (fraction(aBalance, dPriceA, APrecision) + fraction(bBalance, dPriceB, BPrecision)) | |
375 | - | fraction(sum, sharePrecision, shareSupply) | |
385 | + | let $t01170611771 = getPoolData(poolAddr, pType) | |
386 | + | let aId = $t01170611771._1 | |
387 | + | let bId = $t01170611771._2 | |
388 | + | let aBalance = $t01170611771._3 | |
389 | + | let bBalance = $t01170611771._4 | |
390 | + | let prices = getAssetsPrice([aId, bId]) | |
391 | + | let dPriceA = prices[0] | |
392 | + | let dPriceB = prices[1] | |
393 | + | if (if ((0 > dPriceA)) | |
394 | + | then true | |
395 | + | else (0 > dPriceB)) | |
396 | + | then -1 | |
397 | + | else { | |
398 | + | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
399 | + | let APrecision = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
400 | + | let BPrecision = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
401 | + | let sharePrecision = pow(10, 0, getAssetDecimals(shareId), 0, 0, DOWN) | |
402 | + | let sum = (fraction(aBalance, dPriceA, APrecision) + fraction(bBalance, dPriceB, BPrecision)) | |
403 | + | fraction(sum, sharePrecision, shareSupply) | |
404 | + | } | |
376 | 405 | } | |
377 | 406 | ||
378 | 407 | ||
436 | 465 | } | |
437 | 466 | else if ((pType == WX_POOL)) | |
438 | 467 | then { | |
439 | - | let $ | |
468 | + | let $t01331513565 = $Tuple2(split({ | |
440 | 469 | let @ = invoke(poolAddr, "evaluatePutByAmountAssetREADONLY", [pmtA], nil) | |
441 | 470 | if ($isInstanceOf(@, "String")) | |
442 | 471 | then @ | |
447 | 476 | then @ | |
448 | 477 | else throw(($getType(@) + " couldn't be cast to String")) | |
449 | 478 | }, "__")) | |
450 | - | if (($ | |
479 | + | if (($t01331513565 == $t01331513565)) | |
451 | 480 | then { | |
452 | - | let evalPutInB = $ | |
453 | - | let evalPutInA = $ | |
481 | + | let evalPutInB = $t01331513565._2 | |
482 | + | let evalPutInA = $t01331513565._1 | |
454 | 483 | let lpInA = parseIntValue(evalPutInA[1]) | |
455 | 484 | let lpInB = parseIntValue(evalPutInB[1]) | |
456 | 485 | if ((lpInB > lpInA)) | |
499 | 528 | ||
500 | 529 | ||
501 | 530 | func unstakeLP (pool,pType,shareId,amount) = { | |
502 | - | let $ | |
531 | + | let $t01522415574 = if ((pType == SF_POOL)) | |
503 | 532 | then $Tuple3(getSFFarmingAddr(), "withdrawShareTokens", [pool, amount]) | |
504 | 533 | else if ((pType == WX_POOL)) | |
505 | 534 | then $Tuple3(getWXFarmingAddr(Address(fromBase58String(pool))), "unstake", [shareId, amount]) | |
506 | 535 | else unknownPoolType() | |
507 | - | let farmAddr = $ | |
508 | - | let fName = $ | |
509 | - | let params = $ | |
536 | + | let farmAddr = $t01522415574._1 | |
537 | + | let fName = $t01522415574._2 | |
538 | + | let params = $t01522415574._3 | |
510 | 539 | let inv = invoke(farmAddr, fName, params, nil) | |
511 | 540 | if ((inv == inv)) | |
512 | 541 | then amount | |
519 | 548 | let feeScale6 = 1000000 | |
520 | 549 | let fee = getIntegerValue(poolAddr, kSFPoolFee) | |
521 | 550 | let amntGetNoFee = fraction(amountTokenToGet, feeScale6, (feeScale6 - fee), CEILING) | |
522 | - | let $ | |
551 | + | let $t01599616302 = if ((assetTokenToGet == assetIdA)) | |
523 | 552 | then { | |
524 | 553 | let amountToPay = fraction(amntGetNoFee, balB, (balA - amntGetNoFee), CEILING) | |
525 | 554 | $Tuple2(amountToPay, assetIdB) | |
528 | 557 | let amountToPay = fraction(amntGetNoFee, balA, (balB - amntGetNoFee), CEILING) | |
529 | 558 | $Tuple2(amountToPay, assetIdA) | |
530 | 559 | } | |
531 | - | let amountToPay = $ | |
532 | - | let assetToPay = $ | |
560 | + | let amountToPay = $t01599616302._1 | |
561 | + | let assetToPay = $t01599616302._2 | |
533 | 562 | $Tuple2(assetToPay, amountToPay) | |
534 | 563 | } | |
535 | 564 | ||
549 | 578 | ||
550 | 579 | ||
551 | 580 | func calcAmountToPayWX (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
552 | - | let $ | |
553 | - | let pFee = $ | |
554 | - | let prFee = $ | |
581 | + | let $t01704217081 = getWXSwapFees(pool) | |
582 | + | let pFee = $t01704217081._1 | |
583 | + | let prFee = $t01704217081._2 | |
555 | 584 | let feeScale = toBigInt(100000000) | |
556 | - | let $ | |
585 | + | let $t01712117429 = if ((assetTokenToGet == assetIdA)) | |
557 | 586 | then { | |
558 | 587 | let amountToPay = fraction(amountTokenToGet, balB, (balA - amountTokenToGet)) | |
559 | 588 | $Tuple2(amountToPay, assetIdB) | |
562 | 591 | let amountToPay = fraction(amountTokenToGet, balA, (balB - amountTokenToGet)) | |
563 | 592 | $Tuple2(amountToPay, assetIdA) | |
564 | 593 | } | |
565 | - | let amountToPay = $ | |
566 | - | let assetToPay = $ | |
594 | + | let amountToPay = $t01712117429._1 | |
595 | + | let assetToPay = $t01712117429._2 | |
567 | 596 | let amountToPayWithFee = toInt(fraction(toBigInt(amountToPay), feeScale, (feeScale - toBigInt((prFee + pFee))), CEILING)) | |
568 | 597 | $Tuple2(assetToPay, amountToPayWithFee) | |
569 | 598 | } | |
571 | 600 | ||
572 | 601 | func exchangeDirectly (pType,pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = if ((pType == SF_POOL)) | |
573 | 602 | then { | |
574 | - | let $ | |
575 | - | let assetToPay = $ | |
576 | - | let amountToPay = $ | |
603 | + | let $t01777617898 = calcAmountToPaySF(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
604 | + | let assetToPay = $t01777617898._1 | |
605 | + | let amountToPay = $t01777617898._2 | |
577 | 606 | invoke(addressFromStringValue(pool), "callFunction", ["exchange", [toString(amountTokenToGet)]], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
578 | 607 | } | |
579 | 608 | else if ((pType == WX_POOL)) | |
580 | 609 | then { | |
581 | - | let $ | |
582 | - | let assetToPay = $ | |
583 | - | let amountToPay = $ | |
610 | + | let $t01809818220 = calcAmountToPayWX(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
611 | + | let assetToPay = $t01809818220._1 | |
612 | + | let amountToPay = $t01809818220._2 | |
584 | 613 | invoke(wxSwapContract, "swap", [amountTokenToGet, assetTokenToGet, toString(this)], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
585 | 614 | } | |
586 | 615 | else unknownPoolType() | |
587 | 616 | ||
588 | 617 | ||
589 | 618 | func calcWithdrawLPFromPoolVirt (poolAddr,pType,shareId,userCanWithdraw) = { | |
590 | - | let $ | |
619 | + | let $t01850718971 = if ((pType == SF_POOL)) | |
591 | 620 | then { | |
592 | 621 | let inv = { | |
593 | 622 | let @ = invoke(poolAddr, "callFunction", ["withdrawREADONLY", [toString(userCanWithdraw)]], nil) | |
622 | 651 | else throw("Strict value is not equal to itself.") | |
623 | 652 | } | |
624 | 653 | else unknownPoolType() | |
625 | - | let amountA = $ | |
626 | - | let amountB = $ | |
654 | + | let amountA = $t01850718971._1 | |
655 | + | let amountB = $t01850718971._2 | |
627 | 656 | $Tuple2(amountA, amountB) | |
628 | 657 | } | |
629 | 658 | ||
645 | 674 | } | |
646 | 675 | else if ((pType == WX_POOL)) | |
647 | 676 | then { | |
677 | + | let $t01933919418 = getWXPoolData(addressFromStringValue(pool)) | |
678 | + | let aId = $t01933919418._1 | |
679 | + | let bId = $t01933919418._2 | |
680 | + | let aBal = $t01933919418._3 | |
681 | + | let bBal = $t01933919418._4 | |
682 | + | let lpId = $t01933919418._5 | |
648 | 683 | let balBefore = accountBalance(WXID) | |
649 | 684 | if ((balBefore == balBefore)) | |
650 | 685 | then { | |
651 | - | let inv = invoke(getWXFarmingAddr( | |
686 | + | let inv = invoke(getWXFarmingAddr(addressFromStringValue(pool)), "claimWx", [lpId], nil) | |
652 | 687 | if ((inv == inv)) | |
653 | 688 | then { | |
654 | 689 | let balAfter = accountBalance(WXID) | |
666 | 701 | if ((lpBalanceBefore == lpBalanceBefore)) | |
667 | 702 | then { | |
668 | 703 | let poolAddr = addressFromStringValue(pool) | |
669 | - | let $ | |
704 | + | let $t02001620432 = if (if ((pmtA > 0)) | |
670 | 705 | then (pmtB > 0) | |
671 | 706 | else false) | |
672 | 707 | then { | |
673 | - | let $ | |
674 | - | let pmtInA = $ | |
675 | - | let pmtInB = $ | |
676 | - | let change = $ | |
677 | - | let changeId = $ | |
708 | + | let $t02008220198 = calcReplenishByTwoTokens(pType, poolAddr, pmtA, aId, pmtB, bId, balA, balB) | |
709 | + | let pmtInA = $t02008220198._1 | |
710 | + | let pmtInB = $t02008220198._2 | |
711 | + | let change = $t02008220198._3 | |
712 | + | let changeId = $t02008220198._4 | |
678 | 713 | let inv = replenishTwoTokensByType(poolAddr, pType, pmtInA, aId, pmtInB, bId) | |
679 | 714 | if ((inv == inv)) | |
680 | 715 | then $Tuple2(change, changeId) | |
685 | 720 | else if ((pmtB > 0)) | |
686 | 721 | then $Tuple2(pmtB, bId) | |
687 | 722 | else throw("pmts must be > 0") | |
688 | - | let change = $ | |
689 | - | let changeId = $ | |
723 | + | let change = $t02001620432._1 | |
724 | + | let changeId = $t02001620432._2 | |
690 | 725 | let inv = if ((change > 0)) | |
691 | 726 | then replenishOneTokenByType(poolAddr, pType, change, changeId) | |
692 | 727 | else nil | |
714 | 749 | func replenishEntries (pool,user,stakedAmount,axlyFeeAmount,posNum,shareId,type,withLoan) = { | |
715 | 750 | let totalAmount = getPoolTotalShare(pool) | |
716 | 751 | let totalAmountLoan = getPoolTotalShareWithLoan(pool) | |
717 | - | let $ | |
752 | + | let $t02128921527 = if (withLoan) | |
718 | 753 | then $Tuple2(getIntegerValue(this, (pool + kPoolInterestLoan)), (totalAmountLoan + stakedAmount)) | |
719 | 754 | else $Tuple2(getIntegerValue(this, (pool + kPoolInterestNoLoan)), totalAmountLoan) | |
720 | - | let curPoolInterest = $ | |
721 | - | let totalStakedWithLoan = $ | |
755 | + | let curPoolInterest = $t02128921527._1 | |
756 | + | let totalStakedWithLoan = $t02128921527._2 | |
722 | 757 | [IntegerEntry((pool + kPoolTotal), (totalAmount + stakedAmount)), IntegerEntry((pool + kPoolTotalLoan), totalStakedWithLoan), IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserPosition), stakedAmount), IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserPositionInterest), curPoolInterest), StringEntry((((user + "_") + toString(posNum)) + kUserPositionPool), pool), IntegerEntry((user + kUserPositionNum), posNum), ScriptTransfer(moneyBox, axlyFeeAmount, fromBase58String(shareId))] | |
723 | 758 | } | |
724 | 759 | ||
764 | 799 | ||
765 | 800 | func capitalize (pool,pType,tokenId,tokenAmount) = { | |
766 | 801 | let poolAddr = Address(fromBase58String(pool)) | |
767 | - | let $ | |
768 | - | let AId = $ | |
769 | - | let BId = $ | |
770 | - | let balA = $ | |
771 | - | let balB = $ | |
772 | - | let shareId = $ | |
802 | + | let $t02388123947 = getPoolData(poolAddr, pType) | |
803 | + | let AId = $t02388123947._1 | |
804 | + | let BId = $t02388123947._2 | |
805 | + | let balA = $t02388123947._3 | |
806 | + | let balB = $t02388123947._4 | |
807 | + | let shareId = $t02388123947._5 | |
773 | 808 | if (if ((tokenId != AId)) | |
774 | 809 | then (tokenId != BId) | |
775 | 810 | else false) | |
776 | 811 | then throw("Wrong asset") | |
777 | 812 | else { | |
778 | - | let $t02309223172 = if ((tokenId == AId)) | |
779 | - | then $Tuple2(tokenAmount, 0) | |
780 | - | else $Tuple2(0, tokenAmount) | |
781 | - | let pmtA = $t02309223172._1 | |
782 | - | let pmtB = $t02309223172._2 | |
783 | - | let $t02317523279 = replenishByType(pType, pool, NO_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
784 | - | let stakedAmount = $t02317523279._1 | |
785 | - | let nf = $t02317523279._2 | |
786 | - | let curPoolInterestLoan = valueOrElse(getInteger(this, (pool + kPoolInterestLoan)), 0) | |
787 | - | let curPoolInterestNoLoan = valueOrElse(getInteger(this, (pool + kPoolInterestNoLoan)), 0) | |
788 | 813 | let totalShareAmount = getPoolTotalShare(pool) | |
789 | 814 | let totalShareAmountWithLoan = getPoolTotalShareWithLoan(pool) | |
790 | 815 | let loanPercent = fraction(totalShareAmountWithLoan, SCALE8, totalShareAmount) | |
816 | + | let tokensForFeeLoan = fraction(tokenAmount, loanPercent, SCALE8) | |
817 | + | let tokensForFeeNoLoan = (tokenAmount - tokensForFeeLoan) | |
818 | + | let axlyFeeLoan = fraction(tokensForFeeLoan, getAxlyFee(pool, CAP_FEE_LOAN), FEE_SCALE6) | |
819 | + | let axlyFeeNoLoan = fraction(tokensForFeeNoLoan, getAxlyFee(pool, CAP_FEE_NO_LOAN), FEE_SCALE6) | |
820 | + | let axlyFee = (axlyFeeLoan + axlyFeeNoLoan) | |
821 | + | let $t02458724687 = if ((tokenId == AId)) | |
822 | + | then $Tuple2((tokenAmount - axlyFee), 0) | |
823 | + | else $Tuple2(0, (tokenAmount - axlyFee)) | |
824 | + | let pmtA = $t02458724687._1 | |
825 | + | let pmtB = $t02458724687._2 | |
826 | + | let $t02469024794 = replenishByType(pType, pool, NO_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
827 | + | let stakedAmount = $t02469024794._1 | |
828 | + | let nf = $t02469024794._2 | |
829 | + | let curPoolInterestLoan = valueOrElse(getInteger(this, (pool + kPoolInterestLoan)), 0) | |
830 | + | let curPoolInterestNoLoan = valueOrElse(getInteger(this, (pool + kPoolInterestNoLoan)), 0) | |
791 | 831 | let stakedLoan = fraction(stakedAmount, loanPercent, SCALE8) | |
792 | 832 | let stakedNoLoan = (stakedAmount - stakedLoan) | |
793 | 833 | let newInterestLoan = if ((totalShareAmountWithLoan > 0)) | |
796 | 836 | let newInterestNoLoan = if (((totalShareAmount - totalShareAmountWithLoan) > 0)) | |
797 | 837 | then (curPoolInterestNoLoan + fraction(stakedNoLoan, SCALE10, (totalShareAmount - totalShareAmountWithLoan))) | |
798 | 838 | else 0 | |
799 | - | let axlyFeeLoan = fraction(stakedLoan, getAxlyFee(pool, CAP_FEE_LOAN), FEE_SCALE6) | |
800 | - | let axlyFeeNoLoan = fraction(stakedNoLoan, getAxlyFee(pool, CAP_FEE_NO_LOAN), FEE_SCALE6) | |
801 | - | let axlyFee = unstakeLP(pool, pType, shareId, (axlyFeeLoan + axlyFeeNoLoan)) | |
802 | - | if ((axlyFee == axlyFee)) | |
803 | - | then ([IntegerEntry((pool + kPoolInterestLoan), newInterestLoan), IntegerEntry((pool + kPoolInterestNoLoan), newInterestNoLoan), IntegerEntry((pool + kPoolTotal), ((totalShareAmount + stakedAmount) - axlyFee)), IntegerEntry((pool + kPoolTotalLoan), ((totalShareAmountWithLoan + stakedLoan) - axlyFeeLoan)), ScriptTransfer(moneyBox, (axlyFeeLoan + axlyFeeNoLoan), fromBase58String(shareId))] ++ getCursEntries(AId, BId, shareId, nil)) | |
804 | - | else throw("Strict value is not equal to itself.") | |
839 | + | ([IntegerEntry((pool + kPoolInterestLoan), newInterestLoan), IntegerEntry((pool + kPoolInterestNoLoan), newInterestNoLoan), IntegerEntry((pool + kPoolTotal), (totalShareAmount + stakedAmount)), IntegerEntry((pool + kPoolTotalLoan), (totalShareAmountWithLoan + stakedLoan)), ScriptTransfer(moneyBox, axlyFee, fromBase58String(tokenId))] ++ getCursEntries(AId, BId, shareId, nil)) | |
805 | 840 | } | |
806 | 841 | } | |
807 | 842 | ||
808 | 843 | ||
809 | - | func withdrawAmountCalc (pool,userCanWithdraw,debt,borrowAsset,stopLossFee) = { | |
844 | + | func userCanWithdrawShareCalc (user,pool,posId,borrowed) = { | |
845 | + | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
846 | + | let userInterest = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)) | |
847 | + | let poolInterest = if (borrowed) | |
848 | + | then getIntegerValue(this, (pool + kPoolInterestLoan)) | |
849 | + | else getIntegerValue(this, (pool + kPoolInterestNoLoan)) | |
850 | + | (pAmount + fraction(pAmount, (poolInterest - userInterest), SCALE10)) | |
851 | + | } | |
852 | + | ||
853 | + | ||
854 | + | func calcStopLossFee (pool,isBorrowed,stopLoss,lpWithdraw) = { | |
855 | + | let feeType = if (isBorrowed) | |
856 | + | then STOPLOSS_LOAN | |
857 | + | else STOPLOSS_FEE_NO_LOAN | |
858 | + | if (stopLoss) | |
859 | + | then fraction(lpWithdraw, getAxlyFee(pool, feeType), FEE_SCALE6) | |
860 | + | else 0 | |
861 | + | } | |
862 | + | ||
863 | + | ||
864 | + | func withdrawToUser (user,pool,posId,stopLoss) = { | |
865 | + | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
866 | + | let isBorrowed = (valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), 0) > 0) | |
867 | + | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posId, isBorrowed) | |
868 | + | let poolTotalShare = getPoolTotalShare(pool) | |
869 | + | let poolTotalShareLoan = getPoolTotalShareWithLoan(pool) | |
870 | + | let userAddr = Address(fromBase58String(user)) | |
810 | 871 | let poolAddr = Address(fromBase58String(pool)) | |
811 | 872 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
812 | - | let $t02506925145 = getPoolData(poolAddr, pType) | |
813 | - | let assetIdA = $t02506925145._1 | |
814 | - | let assetIdB = $t02506925145._2 | |
815 | - | let balA = $t02506925145._3 | |
816 | - | let balB = $t02506925145._4 | |
817 | - | let shareId = $t02506925145._5 | |
818 | - | let cBalABefore = accountBalance(assetIdFromStr(assetIdA)) | |
873 | + | let $t02732527397 = getPoolData(poolAddr, pType) | |
874 | + | let idAStr = $t02732527397._1 | |
875 | + | let idBStr = $t02732527397._2 | |
876 | + | let balA = $t02732527397._3 | |
877 | + | let balB = $t02732527397._4 | |
878 | + | let shareId = $t02732527397._5 | |
879 | + | let $t02740027467 = $Tuple2(assetIdFromStr(idAStr), assetIdFromStr(idBStr)) | |
880 | + | let idA = $t02740027467._1 | |
881 | + | let idB = $t02740027467._2 | |
882 | + | let stopLossFee = calcStopLossFee(pool, isBorrowed, stopLoss, userCanWithdraw) | |
883 | + | let cBalABefore = accountBalance(idA) | |
819 | 884 | if ((cBalABefore == cBalABefore)) | |
820 | 885 | then { | |
821 | - | let cBalBBefore = accountBalance( | |
886 | + | let cBalBBefore = accountBalance(idB) | |
822 | 887 | if ((cBalBBefore == cBalBBefore)) | |
823 | 888 | then { | |
824 | 889 | let inv = if ((pType == SF_POOL)) | |
838 | 903 | else unknownPoolType() | |
839 | 904 | if ((inv == inv)) | |
840 | 905 | then { | |
841 | - | let cBalAAfter = accountBalance(assetIdFromStr(assetIdA)) | |
842 | - | let cBalBAfter = accountBalance(assetIdFromStr(assetIdB)) | |
843 | - | let $t02583825927 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
844 | - | let tokensAmountA = $t02583825927._1 | |
845 | - | let tokensAmountB = $t02583825927._2 | |
846 | - | let $t02593026784 = if ((debt > 0)) | |
906 | + | let cBalAAfter = accountBalance(idA) | |
907 | + | if ((cBalAAfter == cBalAAfter)) | |
847 | 908 | then { | |
848 | - | let amountToGetEx = if (if ((borrowAsset == assetIdA)) | |
849 | - | then (debt > tokensAmountA) | |
850 | - | else false) | |
851 | - | then (debt - tokensAmountA) | |
852 | - | else if (if ((borrowAsset == assetIdB)) | |
853 | - | then (debt > tokensAmountB) | |
854 | - | else false) | |
855 | - | then (debt - tokensAmountB) | |
856 | - | else 0 | |
857 | - | let exInv = if ((amountToGetEx > 0)) | |
858 | - | then exchangeDirectly(pType, pool, assetIdA, assetIdB, (balA - tokensAmountA), (balB - tokensAmountB), amountToGetEx, borrowAsset) | |
859 | - | else nil | |
860 | - | if ((exInv == exInv)) | |
909 | + | let cBalBAfter = accountBalance(idB) | |
910 | + | if ((cBalBAfter == cBalBAfter)) | |
861 | 911 | then { | |
862 | - | let cBalAAfterRepay = accountBalance(assetIdFromStr(assetIdA)) | |
863 | - | let cBalBAfterRepay = accountBalance(assetIdFromStr(assetIdB)) | |
864 | - | if ((borrowAsset == assetIdA)) | |
865 | - | then $Tuple2(((cBalAAfterRepay - cBalABefore) - debt), (cBalBAfterRepay - cBalBBefore)) | |
866 | - | else $Tuple2((cBalAAfterRepay - cBalABefore), ((cBalBAfterRepay - cBalBBefore) - debt)) | |
912 | + | let $t02816228251 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
913 | + | let tokensAmountA = $t02816228251._1 | |
914 | + | let tokensAmountB = $t02816228251._2 | |
915 | + | let $t02825429490 = if (isBorrowed) | |
916 | + | then { | |
917 | + | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)) | |
918 | + | let debt = { | |
919 | + | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((user + "_") + posId), borrowAsset], nil) | |
920 | + | if ($isInstanceOf(@, "Int")) | |
921 | + | then @ | |
922 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
923 | + | } | |
924 | + | if ((debt == debt)) | |
925 | + | then { | |
926 | + | let amountToGetEx = if (if ((borrowAsset == idAStr)) | |
927 | + | then (debt > tokensAmountA) | |
928 | + | else false) | |
929 | + | then (debt - tokensAmountA) | |
930 | + | else if (if ((borrowAsset == idBStr)) | |
931 | + | then (debt > tokensAmountB) | |
932 | + | else false) | |
933 | + | then (debt - tokensAmountB) | |
934 | + | else 0 | |
935 | + | let exInv = if ((amountToGetEx > 0)) | |
936 | + | then exchangeDirectly(pType, pool, idAStr, idBStr, (balA - tokensAmountA), (balB - tokensAmountB), amountToGetEx, borrowAsset) | |
937 | + | else nil | |
938 | + | if ((exInv == exInv)) | |
939 | + | then { | |
940 | + | let cBalAAfterRepay = accountBalance(idA) | |
941 | + | if ((cBalAAfterRepay == cBalAAfterRepay)) | |
942 | + | then { | |
943 | + | let cBalBAfterRepay = accountBalance(idB) | |
944 | + | if ((cBalBAfterRepay == cBalBAfterRepay)) | |
945 | + | then { | |
946 | + | let closeDbtInv = if ((debt > 0)) | |
947 | + | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + posId)], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
948 | + | else 0 | |
949 | + | if ((closeDbtInv == closeDbtInv)) | |
950 | + | then if ((borrowAsset == idAStr)) | |
951 | + | then $Tuple2(((cBalAAfterRepay - cBalABefore) - debt), (cBalBAfterRepay - cBalBBefore)) | |
952 | + | else $Tuple2((cBalAAfterRepay - cBalABefore), ((cBalBAfterRepay - cBalBBefore) - debt)) | |
953 | + | else throw("Strict value is not equal to itself.") | |
954 | + | } | |
955 | + | else throw("Strict value is not equal to itself.") | |
956 | + | } | |
957 | + | else throw("Strict value is not equal to itself.") | |
958 | + | } | |
959 | + | else throw("Strict value is not equal to itself.") | |
960 | + | } | |
961 | + | else throw("Strict value is not equal to itself.") | |
962 | + | } | |
963 | + | else $Tuple2(tokensAmountA, tokensAmountB) | |
964 | + | let toUserA = $t02825429490._1 | |
965 | + | let toUserB = $t02825429490._2 | |
966 | + | let poolTotalLoanEntries = if (isBorrowed) | |
967 | + | then [IntegerEntry((pool + kPoolTotalLoan), ((poolTotalShareLoan - userCanWithdraw) - stopLossFee))] | |
968 | + | else nil | |
969 | + | let entries = (([DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPosition)), DeleteEntry((((user + "_") + posId) + kUserPositionPool)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), ((poolTotalShare - userCanWithdraw) - stopLossFee)), ScriptTransfer(userAddr, toUserA, idA), ScriptTransfer(userAddr, toUserB, idB), ScriptTransfer(moneyBox, stopLossFee, fromBase58String(shareId))] ++ poolTotalLoanEntries) ++ getCursEntries(idAStr, idBStr, shareId, nil)) | |
970 | + | $Tuple2(entries, [toUserA, toUserB]) | |
867 | 971 | } | |
868 | 972 | else throw("Strict value is not equal to itself.") | |
869 | 973 | } | |
870 | - | else $Tuple2(tokensAmountA, tokensAmountB) | |
871 | - | let toUserA = $t02593026784._1 | |
872 | - | let toUserB = $t02593026784._2 | |
873 | - | $Tuple5(toUserA, assetIdA, toUserB, assetIdB, shareId) | |
974 | + | else throw("Strict value is not equal to itself.") | |
874 | 975 | } | |
875 | 976 | else throw("Strict value is not equal to itself.") | |
876 | - | } | |
877 | - | else throw("Strict value is not equal to itself.") | |
878 | - | } | |
879 | - | else throw("Strict value is not equal to itself.") | |
880 | - | } | |
881 | - | ||
882 | - | ||
883 | - | func userCanWithdrawShareCalc (user,pool,posId,borrowed) = { | |
884 | - | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
885 | - | let userInterest = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)) | |
886 | - | let poolInterest = if (borrowed) | |
887 | - | then getIntegerValue(this, (pool + kPoolInterestLoan)) | |
888 | - | else getIntegerValue(this, (pool + kPoolInterestNoLoan)) | |
889 | - | (pAmount + fraction(pAmount, (poolInterest - userInterest), SCALE10)) | |
890 | - | } | |
891 | - | ||
892 | - | ||
893 | - | func withdrawToUser (user,pool,posId,stopLoss) = { | |
894 | - | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
895 | - | let borrowAmount = valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), 0) | |
896 | - | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posId, (borrowAmount > 0)) | |
897 | - | let poolTotalShare = getPoolTotalShare(pool) | |
898 | - | let userAddr = Address(fromBase58String(user)) | |
899 | - | let borrowAsset = valueOrElse(getString(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)), "") | |
900 | - | let $t02798228216 = if ((borrowAmount > 0)) | |
901 | - | then $Tuple2({ | |
902 | - | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((user + "_") + posId), borrowAsset], nil) | |
903 | - | if ($isInstanceOf(@, "Int")) | |
904 | - | then @ | |
905 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
906 | - | }, STOPLOSS_LOAN) | |
907 | - | else $Tuple2(0, STOPLOSS_FEE_NO_LOAN) | |
908 | - | let debt = $t02798228216._1 | |
909 | - | let feeType = $t02798228216._2 | |
910 | - | let stopLossFee = if (stopLoss) | |
911 | - | then fraction(userCanWithdraw, getAxlyFee(pool, feeType), FEE_SCALE6) | |
912 | - | else 0 | |
913 | - | let $t02833328489 = withdrawAmountCalc(pool, (userCanWithdraw - stopLossFee), debt, borrowAsset, stopLossFee) | |
914 | - | if (($t02833328489 == $t02833328489)) | |
915 | - | then { | |
916 | - | let shareId = $t02833328489._5 | |
917 | - | let assetIdB = $t02833328489._4 | |
918 | - | let toUserAmountB = $t02833328489._3 | |
919 | - | let assetIdA = $t02833328489._2 | |
920 | - | let toUserAmountA = $t02833328489._1 | |
921 | - | let closeDbtInv = if ((debt > 0)) | |
922 | - | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + posId)], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
923 | - | else 0 | |
924 | - | if ((closeDbtInv == closeDbtInv)) | |
925 | - | then { | |
926 | - | let entries = ([DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPosition)), DeleteEntry((((user + "_") + posId) + kUserPositionPool)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), ((poolTotalShare - userCanWithdraw) - stopLossFee)), ScriptTransfer(userAddr, toUserAmountA, assetIdFromStr(assetIdA)), ScriptTransfer(userAddr, toUserAmountB, assetIdFromStr(assetIdB)), ScriptTransfer(moneyBox, stopLossFee, fromBase58String(shareId))] ++ getCursEntries(assetIdA, assetIdB, shareId, nil)) | |
927 | - | $Tuple2(entries, [toUserAmountA, toUserAmountB]) | |
928 | 977 | } | |
929 | 978 | else throw("Strict value is not equal to itself.") | |
930 | 979 | } | |
959 | 1008 | let decPrA = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
960 | 1009 | let decPrB = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
961 | 1010 | let paydInDollar = (fraction(dPriceA, pmtA, decPrA) + fraction(dPriceB, pmtB, decPrB)) | |
962 | - | let $ | |
1011 | + | let $t03147231569 = if ((borrowId == aId)) | |
963 | 1012 | then $Tuple2(dPriceA, decPrA) | |
964 | 1013 | else $Tuple2(dPriceB, decPrB) | |
965 | - | let borrowPrice = $ | |
966 | - | let borrowDecPr = $ | |
1014 | + | let borrowPrice = $t03147231569._1 | |
1015 | + | let borrowDecPr = $t03147231569._2 | |
967 | 1016 | fraction(fraction(paydInDollar, (leverage - 100), 100), borrowDecPr, borrowPrice) | |
968 | 1017 | } | |
969 | 1018 | ||
991 | 1040 | } | |
992 | 1041 | ||
993 | 1042 | ||
994 | - | func | |
995 | - | let $ | |
1043 | + | func claimAndCheckAmnt (pool,pType,claim,amount,change) = { | |
1044 | + | let $t03256932828 = if (claim) | |
996 | 1045 | then claimFarmed(pType, pool) | |
997 | 1046 | else { | |
998 | 1047 | let claimedAsset = if ((pType == SF_POOL)) | |
1000 | 1049 | else if ((pType == WX_POOL)) | |
1001 | 1050 | then WXID | |
1002 | 1051 | else unknownPoolType() | |
1003 | - | $Tuple2( | |
1052 | + | $Tuple2(amount, claimedAsset) | |
1004 | 1053 | } | |
1005 | - | let claimAmount = $ | |
1006 | - | let claimAsset = $ | |
1054 | + | let claimAmount = $t03256932828._1 | |
1055 | + | let claimAsset = $t03256932828._2 | |
1007 | 1056 | let bal = accountBalance(claimAsset) | |
1008 | - | if (if (( | |
1057 | + | if (if ((amount > (claimAmount + change))) | |
1009 | 1058 | then true | |
1010 | - | else ( | |
1059 | + | else (amount > bal)) | |
1011 | 1060 | then throw("To big amount to exchange") | |
1012 | 1061 | else $Tuple2(claimAmount, claimAsset) | |
1013 | 1062 | } | |
1063 | + | ||
1064 | + | ||
1065 | + | @Callable(i) | |
1066 | + | func getPoolInfoREADONLY (pool) = { | |
1067 | + | let poolAddr = addressFromStringValue(pool) | |
1068 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1069 | + | let $t03322533315 = getPoolData(Address(fromBase58String(pool)), pType) | |
1070 | + | let AId = $t03322533315._1 | |
1071 | + | let BId = $t03322533315._2 | |
1072 | + | let balA = $t03322533315._3 | |
1073 | + | let balB = $t03322533315._4 | |
1074 | + | let shareId = $t03322533315._5 | |
1075 | + | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
1076 | + | $Tuple2(nil, $Tuple6(AId, BId, shareId, balA, balB, shareSupply)) | |
1077 | + | } | |
1078 | + | ||
1014 | 1079 | ||
1015 | 1080 | ||
1016 | 1081 | @Callable(i) | |
1034 | 1099 | @Callable(i) | |
1035 | 1100 | func getUserPositionREADONLY (user,pools,posNum) = { | |
1036 | 1101 | func userPos (a,pool) = { | |
1037 | - | let $ | |
1038 | - | let wAmountsA = $ | |
1039 | - | let wAmountsB = $ | |
1040 | - | let debts = $ | |
1041 | - | let eqWAmountsA = $ | |
1042 | - | let eqWAmountsB = $ | |
1043 | - | let index = $ | |
1102 | + | let $t03418834258 = a | |
1103 | + | let wAmountsA = $t03418834258._1 | |
1104 | + | let wAmountsB = $t03418834258._2 | |
1105 | + | let debts = $t03418834258._3 | |
1106 | + | let eqWAmountsA = $t03418834258._4 | |
1107 | + | let eqWAmountsB = $t03418834258._5 | |
1108 | + | let index = $t03418834258._6 | |
1044 | 1109 | if (!(isDefined(getInteger(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserPosition))))) | |
1045 | 1110 | then $Tuple6((wAmountsA :+ 0), (wAmountsB :+ 0), (debts :+ 0), (eqWAmountsA :+ 0), (eqWAmountsB :+ 0), (index + 1)) | |
1046 | 1111 | else { | |
1047 | 1112 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1048 | - | let $ | |
1049 | - | let AId = $ | |
1050 | - | let BId = $ | |
1051 | - | let balA = $ | |
1052 | - | let balB = $ | |
1053 | - | let shareId = $ | |
1113 | + | let $t03453734627 = getPoolData(Address(fromBase58String(pool)), pType) | |
1114 | + | let AId = $t03453734627._1 | |
1115 | + | let BId = $t03453734627._2 | |
1116 | + | let balA = $t03453734627._3 | |
1117 | + | let balB = $t03453734627._4 | |
1118 | + | let shareId = $t03453734627._5 | |
1054 | 1119 | let borrowAmount = valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserBorrowAmount)), 0) | |
1055 | 1120 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posNum[index], (borrowAmount > 0)) | |
1056 | - | let $ | |
1057 | - | let wAmountA = $ | |
1058 | - | let wAmountB = $ | |
1121 | + | let $t03484334963 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userCanWithdraw) | |
1122 | + | let wAmountA = $t03484334963._1 | |
1123 | + | let wAmountB = $t03484334963._2 | |
1059 | 1124 | if ((borrowAmount > 0)) | |
1060 | 1125 | then { | |
1061 | 1126 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserBorrowAssetId)) | |
1067 | 1132 | } | |
1068 | 1133 | if ((debt == debt)) | |
1069 | 1134 | then { | |
1070 | - | let $t03399734281 = if ((pType == SF_POOL)) | |
1071 | - | then calcAmountToPaySF(pool, AId, BId, balA, balB, debt, borrowAsset) | |
1072 | - | else if ((pType == WX_POOL)) | |
1073 | - | then calcAmountToPayWX(pool, AId, BId, balA, balB, debt, borrowAsset) | |
1074 | - | else unknownPoolType() | |
1075 | - | let assetToPay = $t03399734281._1 | |
1076 | - | let amountToPay = $t03399734281._2 | |
1077 | - | let $t03428834434 = if ((assetToPay == BId)) | |
1078 | - | then $Tuple2((wAmountA - debt), (wAmountB - amountToPay)) | |
1079 | - | else $Tuple2((wAmountA - amountToPay), (wAmountB - debt)) | |
1080 | - | let eqWAmountA = $t03428834434._1 | |
1081 | - | let eqWAmountB = $t03428834434._2 | |
1135 | + | let amountToGetEx = if (if ((borrowAsset == AId)) | |
1136 | + | then (debt > wAmountA) | |
1137 | + | else false) | |
1138 | + | then (debt - wAmountA) | |
1139 | + | else if (if ((borrowAsset == BId)) | |
1140 | + | then (debt > wAmountB) | |
1141 | + | else false) | |
1142 | + | then (debt - wAmountB) | |
1143 | + | else 0 | |
1144 | + | let amountToPay = if ((amountToGetEx > 0)) | |
1145 | + | then if ((pType == SF_POOL)) | |
1146 | + | then { | |
1147 | + | let ex = calcAmountToPaySF(pool, AId, BId, balA, balB, amountToGetEx, borrowAsset) | |
1148 | + | ex._2 | |
1149 | + | } | |
1150 | + | else if ((pType == WX_POOL)) | |
1151 | + | then { | |
1152 | + | let ex = calcAmountToPayWX(pool, AId, BId, balA, balB, amountToGetEx, borrowAsset) | |
1153 | + | ex._2 | |
1154 | + | } | |
1155 | + | else unknownPoolType() | |
1156 | + | else 0 | |
1157 | + | let $t03587536094 = if ((borrowAsset == AId)) | |
1158 | + | then $Tuple2(((wAmountA + amountToGetEx) - debt), (wAmountB - amountToPay)) | |
1159 | + | else $Tuple2((wAmountA - amountToPay), ((wAmountB + amountToGetEx) - debt)) | |
1160 | + | let eqWAmountA = $t03587536094._1 | |
1161 | + | let eqWAmountB = $t03587536094._2 | |
1082 | 1162 | $Tuple6((wAmountsA :+ wAmountA), (wAmountsB :+ wAmountB), (debts :+ debt), (eqWAmountsA :+ eqWAmountA), (eqWAmountsB :+ eqWAmountB), (index + 1)) | |
1083 | 1163 | } | |
1084 | 1164 | else throw("Strict value is not equal to itself.") | |
1087 | 1167 | } | |
1088 | 1168 | } | |
1089 | 1169 | ||
1090 | - | let $ | |
1170 | + | let $t03634936460 = { | |
1091 | 1171 | let $l = pools | |
1092 | 1172 | let $s = size($l) | |
1093 | 1173 | let $acc0 = $Tuple6(nil, nil, nil, nil, nil, 0) | |
1101 | 1181 | ||
1102 | 1182 | $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($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), 16), 17), 18), 19), 20) | |
1103 | 1183 | } | |
1104 | - | let wAmountsA = $ | |
1105 | - | let wAmountsB = $ | |
1106 | - | let debts = $ | |
1107 | - | let eqWAmountsA = $ | |
1108 | - | let eqWAmountsB = $ | |
1184 | + | let wAmountsA = $t03634936460._1 | |
1185 | + | let wAmountsB = $t03634936460._2 | |
1186 | + | let debts = $t03634936460._3 | |
1187 | + | let eqWAmountsA = $t03634936460._4 | |
1188 | + | let eqWAmountsB = $t03634936460._5 | |
1109 | 1189 | $Tuple2(nil, $Tuple5(wAmountsA, wAmountsB, debts, eqWAmountsA, eqWAmountsB)) | |
1110 | 1190 | } | |
1111 | 1191 | ||
1125 | 1205 | else false) | |
1126 | 1206 | then throw("You can't borrow in this pool") | |
1127 | 1207 | else { | |
1128 | - | let $ | |
1129 | - | let AId = $ | |
1130 | - | let BId = $ | |
1131 | - | let balA = $ | |
1132 | - | let balB = $ | |
1133 | - | let shareId = $ | |
1208 | + | let $t03705837148 = getPoolData(Address(fromBase58String(pool)), pType) | |
1209 | + | let AId = $t03705837148._1 | |
1210 | + | let BId = $t03705837148._2 | |
1211 | + | let balA = $t03705837148._3 | |
1212 | + | let balB = $t03705837148._4 | |
1213 | + | let shareId = $t03705837148._5 | |
1134 | 1214 | if (if ((borrowId != AId)) | |
1135 | 1215 | then (borrowId != BId) | |
1136 | 1216 | else false) | |
1137 | 1217 | then throw("Wrong borrow asset") | |
1138 | 1218 | else { | |
1139 | - | let $ | |
1140 | - | let pmtA = $ | |
1141 | - | let pmtB = $ | |
1219 | + | let $t03722937288 = parseReplenishPmts(i.payments, AId, BId) | |
1220 | + | let pmtA = $t03722937288._1 | |
1221 | + | let pmtB = $t03722937288._2 | |
1142 | 1222 | let user = toString(i.caller) | |
1143 | 1223 | let newPosNum = getNewUserPositionNumber(user) | |
1144 | 1224 | if ((leverage > 100)) | |
1158 | 1238 | if ((inv == inv)) | |
1159 | 1239 | then { | |
1160 | 1240 | let userStaked = getIntegerValue(this, (((((pool + "_") + user) + "_") + toString(newPosNum)) + kUserPosition)) | |
1161 | - | let $ | |
1162 | - | if (($ | |
1241 | + | let $t03827738371 = getPoolBalances(Address(fromBase58String(pool)), pType, AId, BId) | |
1242 | + | if (($t03827738371 == $t03827738371)) | |
1163 | 1243 | then { | |
1164 | - | let newBalB = $ | |
1165 | - | let newBalA = $ | |
1244 | + | let newBalB = $t03827738371._2 | |
1245 | + | let newBalA = $t03827738371._1 | |
1166 | 1246 | let prImpact = calcPriceImpact(balA, balB, newBalA, newBalB) | |
1167 | - | let $ | |
1168 | - | let wAmountA = $ | |
1169 | - | let wAmountB = $ | |
1247 | + | let $t03844138556 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1248 | + | let wAmountA = $t03844138556._1 | |
1249 | + | let wAmountB = $t03844138556._2 | |
1170 | 1250 | $Tuple2(nil, [prImpact, wAmountA, wAmountB]) | |
1171 | 1251 | } | |
1172 | 1252 | else throw("Strict value is not equal to itself.") | |
1176 | 1256 | else throw("Strict value is not equal to itself.") | |
1177 | 1257 | } | |
1178 | 1258 | else { | |
1179 | - | let $ | |
1180 | - | if (($ | |
1259 | + | let $t03860938724 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
1260 | + | if (($t03860938724 == $t03860938724)) | |
1181 | 1261 | then { | |
1182 | - | let axlyFee = $ | |
1183 | - | let userStaked = $ | |
1184 | - | let $ | |
1185 | - | if (($ | |
1262 | + | let axlyFee = $t03860938724._2 | |
1263 | + | let userStaked = $t03860938724._1 | |
1264 | + | let $t03873038824 = getPoolBalances(Address(fromBase58String(pool)), pType, AId, BId) | |
1265 | + | if (($t03873038824 == $t03873038824)) | |
1186 | 1266 | then { | |
1187 | - | let newBalB = $ | |
1188 | - | let newBalA = $ | |
1267 | + | let newBalB = $t03873038824._2 | |
1268 | + | let newBalA = $t03873038824._1 | |
1189 | 1269 | let prImpact = calcPriceImpact(balA, balB, newBalA, newBalB) | |
1190 | - | let $ | |
1191 | - | let wAmountA = $ | |
1192 | - | let wAmountB = $ | |
1270 | + | let $t03889439009 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1271 | + | let wAmountA = $t03889439009._1 | |
1272 | + | let wAmountB = $t03889439009._2 | |
1193 | 1273 | $Tuple2((replenishEntries(pool, user, userStaked, axlyFee, newPosNum, shareId, pType, false) ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])), [prImpact, wAmountA, wAmountB]) | |
1194 | 1274 | } | |
1195 | 1275 | else throw("Strict value is not equal to itself.") | |
1242 | 1322 | ||
1243 | 1323 | ||
1244 | 1324 | @Callable(i) | |
1245 | - | func init (moneyBoxAddr,sfFarmingAddr,lendAddr,priceOracleAddr,keeperExContract,wxSwapContract,swopAssetId,wxAssetId, | |
1325 | + | func init (moneyBoxAddr,sfFarmingAddr,lendAddr,priceOracleAddr,keeperExContract,wxSwapContract,swopAssetId,wxAssetId,operatorPubKey,group1Admin1PubKey,group1Admin2PubKey,group2Admin1PubKey,group2Admin2PubKey) = valueOrElse(isSelfCall(i), if (isDefined(getString(kOperatorCallPK))) | |
1246 | 1326 | then throw("Already inited") | |
1247 | 1327 | else if (!(isDefined(addressFromString(moneyBoxAddr)))) | |
1248 | 1328 | then throw("moneyBoxAddr is not correct address") | |
1258 | 1338 | then throw("swopAssetId is not correct asset id") | |
1259 | 1339 | else if (!(isDefined(assetInfo(fromBase58String(wxAssetId))))) | |
1260 | 1340 | then throw("swopAssetId is not correct asset id") | |
1261 | - | else if ((size(fromBase58String(adminPubKey)) != 32)) | |
1262 | - | then throw("adminPubKey is not correct") | |
1263 | - | else [StringEntry(kMoneyBox, moneyBoxAddr), StringEntry(kSFFarmingAddr, sfFarmingAddr), StringEntry(kLendService, lendAddr), StringEntry(kPriceOracle, priceOracleAddr), StringEntry(kExContract, keeperExContract), StringEntry(kWxSwapContract, wxSwapContract), StringEntry(kSwopId, swopAssetId), StringEntry(kWxId, wxAssetId), StringEntry(kAdminCallPK, adminPubKey)]) | |
1341 | + | else if ((size(fromBase58String(operatorPubKey)) != 32)) | |
1342 | + | then throw("operatorPubKey is not correct") | |
1343 | + | else if ((size(fromBase58String(group1Admin1PubKey)) != 32)) | |
1344 | + | then throw("group1Admin1PubKey is not correct") | |
1345 | + | else if ((size(fromBase58String(group1Admin2PubKey)) != 32)) | |
1346 | + | then throw("group1Admin2PubKey is not correct") | |
1347 | + | else if ((size(fromBase58String(group2Admin1PubKey)) != 32)) | |
1348 | + | then throw("group2Admin1PubKey is not correct") | |
1349 | + | else if ((size(fromBase58String(group2Admin2PubKey)) != 32)) | |
1350 | + | then throw("group2Admin2PubKey is not correct") | |
1351 | + | else [StringEntry(kMoneyBox, moneyBoxAddr), StringEntry(kSFFarmingAddr, sfFarmingAddr), StringEntry(kLendService, lendAddr), StringEntry(kPriceOracle, priceOracleAddr), StringEntry(kExContract, keeperExContract), StringEntry(kWxSwapContract, wxSwapContract), StringEntry(kSwopId, swopAssetId), StringEntry(kWxId, wxAssetId), StringEntry(kOperatorCallPK, operatorPubKey), StringEntry(kGroup1Admin1PK, group1Admin1PubKey), StringEntry(kGroup1Admin2PK, group1Admin2PubKey), StringEntry(kGroup2Admin1PK, group2Admin1PubKey), StringEntry(kGroup2Admin2PK, group2Admin2PubKey)]) | |
1264 | 1352 | ||
1265 | 1353 | ||
1266 | 1354 | ||
1274 | 1362 | ||
1275 | 1363 | @Callable(i) | |
1276 | 1364 | func replenishFromLand (requestId) = valueOrElse(isActive(), valueOrElse(isLandCall(i), { | |
1277 | - | let $ | |
1278 | - | let user = $ | |
1279 | - | let pool = $ | |
1280 | - | let pmtA = $ | |
1281 | - | let AId = $ | |
1282 | - | let pmtB = $ | |
1283 | - | let BId = $ | |
1284 | - | let balA = $ | |
1285 | - | let balB = $ | |
1286 | - | let shareId = $ | |
1287 | - | let bwAsset = $ | |
1288 | - | let bwAmount = $ | |
1365 | + | let $t04384843952 = parseRequest(requestId) | |
1366 | + | let user = $t04384843952._1 | |
1367 | + | let pool = $t04384843952._2 | |
1368 | + | let pmtA = $t04384843952._3 | |
1369 | + | let AId = $t04384843952._4 | |
1370 | + | let pmtB = $t04384843952._5 | |
1371 | + | let BId = $t04384843952._6 | |
1372 | + | let balA = $t04384843952._7 | |
1373 | + | let balB = $t04384843952._8 | |
1374 | + | let shareId = $t04384843952._9 | |
1375 | + | let bwAsset = $t04384843952._10 | |
1376 | + | let bwAmount = $t04384843952._11 | |
1289 | 1377 | if ((size(i.payments) != 1)) | |
1290 | 1378 | then throw("Wrong payment size") | |
1291 | 1379 | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
1293 | 1381 | else (i.payments[0].amount != bwAmount)) | |
1294 | 1382 | then throw("Wrong payment") | |
1295 | 1383 | else { | |
1296 | - | let $ | |
1384 | + | let $t04414244242 = if ((AId == bwAsset)) | |
1297 | 1385 | then $Tuple2((pmtA + bwAmount), pmtB) | |
1298 | 1386 | else $Tuple2(pmtA, (pmtB + bwAmount)) | |
1299 | - | let pmtAllA = $ | |
1300 | - | let pmtAllB = $ | |
1387 | + | let pmtAllA = $t04414244242._1 | |
1388 | + | let pmtAllB = $t04414244242._2 | |
1301 | 1389 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
1302 | - | let $ | |
1303 | - | let userStaked = $ | |
1304 | - | let axlyFee = $ | |
1390 | + | let $t04432444439 = replenishByType(pType, pool, LOAN_FEE, pmtAllA, AId, pmtAllB, BId, balA, balB, shareId) | |
1391 | + | let userStaked = $t04432444439._1 | |
1392 | + | let axlyFee = $t04432444439._2 | |
1305 | 1393 | let posNum = getNewUserPositionNumber(user) | |
1306 | 1394 | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
1307 | 1395 | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType, true) | |
1308 | - | let $ | |
1309 | - | let wAmountA = $ | |
1310 | - | let wAmountB = $ | |
1396 | + | let $t04479944914 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1397 | + | let wAmountA = $t04479944914._1 | |
1398 | + | let wAmountB = $t04479944914._2 | |
1311 | 1399 | $Tuple2((((entries ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])) ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
1312 | 1400 | } | |
1313 | 1401 | })) | |
1318 | 1406 | func liquidate (user,posId,liquidateAmount) = valueOrElse(isActive(), valueOrElse(isLandCall(i), { | |
1319 | 1407 | let pool = valueOrErrorMessage(getString(this, (((user + "_") + posId) + kUserPositionPool)), "no position") | |
1320 | 1408 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1321 | - | let $ | |
1322 | - | let AId = $ | |
1323 | - | let BId = $ | |
1324 | - | let balA = $ | |
1325 | - | let balB = $ | |
1326 | - | let shareId = $ | |
1409 | + | let $t04543545525 = getPoolData(Address(fromBase58String(pool)), pType) | |
1410 | + | let AId = $t04543545525._1 | |
1411 | + | let BId = $t04543545525._2 | |
1412 | + | let balA = $t04543545525._3 | |
1413 | + | let balB = $t04543545525._4 | |
1414 | + | let shareId = $t04543545525._5 | |
1327 | 1415 | let amount = unstakeLP(pool, pType, shareId, liquidateAmount) | |
1328 | 1416 | let borrowAmount = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)) | |
1329 | 1417 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)) | |
1338 | 1426 | ||
1339 | 1427 | ||
1340 | 1428 | @Callable(i) | |
1341 | - | func stopLoss (user,posId,pool,assetId) = valueOrElse(isActive(), valueOrElse( | |
1429 | + | func stopLoss (user,posId,pool,assetId) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1342 | 1430 | let tokenOraclePrice = getIntegerValue(priceOracleAddr, (assetId + kPriceInOracle)) | |
1343 | 1431 | let stopLossPrice = valueOrErrorMessage(getInteger(this, (((((((user + "_") + toString(posId)) + "_") + pool) + "_") + assetId) + kUserStopLoss)), "No entry") | |
1344 | 1432 | if ((tokenOraclePrice > stopLossPrice)) | |
1352 | 1440 | ||
1353 | 1441 | ||
1354 | 1442 | @Callable(i) | |
1355 | - | func capitalizeExKeeper (pool,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = valueOrElse(isActive(), valueOrElse( | |
1443 | + | func capitalizeExKeeper (pool,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1356 | 1444 | let pType = getStringValue(this, (kPool + pool)) | |
1357 | 1445 | let change = valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0) | |
1358 | - | let $ | |
1359 | - | let claimedAmount = $ | |
1360 | - | let claimedAsset = $ | |
1446 | + | let $t04767447773 = claimAndCheckAmnt(pool, pType, claim, amountToExchange, change) | |
1447 | + | let claimedAmount = $t04767447773._1 | |
1448 | + | let claimedAsset = $t04767447773._2 | |
1361 | 1449 | let exchangedAmount = exchangeKeeper(tokenToId, amountToExchange, claimedAsset, amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options) | |
1362 | 1450 | let newChange = ((claimedAmount + change) - amountToExchange) | |
1363 | 1451 | let changeEntry = if ((newChange >= 0)) | |
1364 | 1452 | then [IntegerEntry((pool + kPoolCapChange), newChange)] | |
1365 | - | else | |
1453 | + | else throw("Negative change") | |
1366 | 1454 | (capitalize(pool, pType, tokenToId, exchangedAmount) ++ changeEntry) | |
1367 | 1455 | })) | |
1368 | 1456 | ||
1369 | 1457 | ||
1370 | 1458 | ||
1371 | 1459 | @Callable(i) | |
1372 | - | func capitalizeExPuzzle (pool,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = valueOrElse(isActive(), valueOrElse( | |
1460 | + | func capitalizeExPuzzle (pool,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1373 | 1461 | let pType = getStringValue(this, (kPool + pool)) | |
1374 | 1462 | let change = valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0) | |
1375 | - | let $ | |
1376 | - | let claimedAmount = $ | |
1377 | - | let claimedAsset = $ | |
1463 | + | let $t04857348672 = claimAndCheckAmnt(pool, pType, claim, amountToExchange, change) | |
1464 | + | let claimedAmount = $t04857348672._1 | |
1465 | + | let claimedAsset = $t04857348672._2 | |
1378 | 1466 | let exchangedAmount = exchangePuzzle(tokenToId, amountToExchange, claimedAsset, routesStr, minToReceive, options) | |
1379 | 1467 | let newChange = ((claimedAmount + change) - amountToExchange) | |
1380 | 1468 | let changeEntry = if ((newChange >= 0)) | |
1386 | 1474 | ||
1387 | 1475 | ||
1388 | 1476 | @Callable(i) | |
1389 | - | func capitalizeExSwopFi (pool,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = valueOrElse(isActive(), valueOrElse( | |
1477 | + | func capitalizeExSwopFi (pool,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1390 | 1478 | let pType = getStringValue(this, (kPool + pool)) | |
1391 | 1479 | let change = valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0) | |
1392 | - | let $ | |
1393 | - | let claimedAmount = $ | |
1394 | - | let claimedAsset = $ | |
1480 | + | let $t04951749616 = claimAndCheckAmnt(pool, pType, claim, amountToExchange, change) | |
1481 | + | let claimedAmount = $t04951749616._1 | |
1482 | + | let claimedAsset = $t04951749616._2 | |
1395 | 1483 | let exchangedAmount = exchangeSwopFi(tokenToId, amountToExchange, claimedAsset, exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options) | |
1396 | 1484 | let newChange = ((claimedAmount + change) - amountToExchange) | |
1397 | 1485 | let changeEntry = if ((newChange >= 0)) | |
1403 | 1491 | ||
1404 | 1492 | ||
1405 | 1493 | @Callable(i) | |
1494 | + | func capitalizeNoEx (pool,claim,amountFromBalance) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1495 | + | let pType = getStringValue(this, (kPool + pool)) | |
1496 | + | let $t05021350308 = claimAndCheckAmnt(pool, pType, claim, amountFromBalance, 0) | |
1497 | + | let claimedAmount = $t05021350308._1 | |
1498 | + | let claimedAsset = $t05021350308._2 | |
1499 | + | capitalize(pool, pType, assetIdToStr(claimedAsset), (claimedAmount + amountFromBalance)) | |
1500 | + | })) | |
1501 | + | ||
1502 | + | ||
1503 | + | ||
1504 | + | @Callable(i) | |
1406 | 1505 | func initNewPool (type,poolAddr,inFeeNoLoan,inFeeLoan,capFeeNoLoan,capFeeWithLoan,stoplossFeeNoLoan,stoplossFeeWithLoan,canBorrow) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if (if ((type != SF_POOL)) | |
1407 | 1506 | then (type != WX_POOL) | |
1408 | 1507 | else false) | |
1409 | 1508 | then throw("Wrong type") | |
1410 | 1509 | else { | |
1411 | - | let $ | |
1412 | - | let aId = $ | |
1413 | - | let bId = $ | |
1414 | - | let aBal = $ | |
1415 | - | let bBal = $ | |
1416 | - | let shareId = $ | |
1510 | + | let $t05073450828 = getPoolData(Address(fromBase58String(poolAddr)), type) | |
1511 | + | let aId = $t05073450828._1 | |
1512 | + | let bId = $t05073450828._2 | |
1513 | + | let aBal = $t05073450828._3 | |
1514 | + | let bBal = $t05073450828._4 | |
1515 | + | let shareId = $t05073450828._5 | |
1417 | 1516 | if ((0 > inFeeNoLoan)) | |
1418 | 1517 | then throw("inFeeNoLoan must be greater than 0") | |
1419 | 1518 | else if ((0 > inFeeLoan)) | |
1428 | 1527 | then throw("stoplossFeeWithLoan must be greater than 0") | |
1429 | 1528 | else [IntegerEntry((poolAddr + kAxlyInFeeWithoutLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyInFeeWithLoan), inFeeLoan), IntegerEntry((poolAddr + kAxlyNoLoanCapFee), capFeeNoLoan), IntegerEntry((poolAddr + kAxlyWithLoanCapFee), capFeeWithLoan), IntegerEntry((poolAddr + kAxlyStopLossNoLoanFee), stoplossFeeNoLoan), IntegerEntry((poolAddr + kAxlyStopLossLoanFee), stoplossFeeWithLoan), IntegerEntry((poolAddr + kPoolInterestLoan), 0), IntegerEntry((poolAddr + kPoolInterestNoLoan), 0), StringEntry((kPool + poolAddr), type), StringEntry((shareId + kSharePool), poolAddr), BooleanEntry((poolAddr + kPoolCanBorrow), canBorrow)] | |
1430 | 1529 | })) | |
1530 | + | ||
1531 | + | ||
1532 | + | ||
1533 | + | @Callable(i) | |
1534 | + | func updatePoolFees (poolAddr,inFeeNoLoan,inFeeLoan,capFeeNoLoan,capFeeWithLoan,stoplossFeeNoLoan,stoplossFeeWithLoan) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if (!(isDefined(getString(this, (kPool + poolAddr))))) | |
1535 | + | then throw(("Can't find pool with addr " + poolAddr)) | |
1536 | + | else if ((0 > inFeeNoLoan)) | |
1537 | + | then throw("inFeeNoLoan must be greater than 0") | |
1538 | + | else if ((0 > inFeeLoan)) | |
1539 | + | then throw("inFeeLoan must be greater than 0") | |
1540 | + | else if ((0 > capFeeNoLoan)) | |
1541 | + | then throw("capFeeNoLoan must be greater than 0") | |
1542 | + | else if ((0 > capFeeWithLoan)) | |
1543 | + | then throw("capFeeWithLoan must be greater than 0") | |
1544 | + | else if ((0 > stoplossFeeNoLoan)) | |
1545 | + | then throw("stoplossFeeNoLoan must be greater than 0") | |
1546 | + | else if ((0 > stoplossFeeWithLoan)) | |
1547 | + | then throw("stoplossFeeWithLoan must be greater than 0") | |
1548 | + | else [IntegerEntry((poolAddr + kAxlyInFeeWithoutLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyInFeeWithLoan), inFeeLoan), IntegerEntry((poolAddr + kAxlyNoLoanCapFee), capFeeNoLoan), IntegerEntry((poolAddr + kAxlyWithLoanCapFee), capFeeWithLoan), IntegerEntry((poolAddr + kAxlyStopLossNoLoanFee), stoplossFeeNoLoan), IntegerEntry((poolAddr + kAxlyStopLossLoanFee), stoplossFeeWithLoan)])) | |
1431 | 1549 | ||
1432 | 1550 | ||
1433 | 1551 | ||
1504 | 1622 | else [BooleanEntry((pool + kPoolActive), false)]) | |
1505 | 1623 | ||
1506 | 1624 | ||
1507 | - | @Verifier(tx) | |
1508 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
1509 | - |
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_NO_LOAN = "capNoLoan" | |
9 | 9 | ||
10 | 10 | let CAP_FEE_LOAN = "capLoan" | |
11 | 11 | ||
12 | 12 | let STOPLOSS_FEE_NO_LOAN = "stopLossNoLoan" | |
13 | 13 | ||
14 | 14 | let STOPLOSS_LOAN = "stopLossLoan" | |
15 | 15 | ||
16 | 16 | let LOAN_FEE = "loan" | |
17 | 17 | ||
18 | 18 | let NO_LOAN_FEE = "noLoan" | |
19 | 19 | ||
20 | 20 | let NO_FEE = "noFee" | |
21 | 21 | ||
22 | 22 | let SCALE8 = 100000000 | |
23 | 23 | ||
24 | 24 | let SCALE10 = 10000000000 | |
25 | 25 | ||
26 | 26 | let SCALE16 = toBigInt(10000000000000000) | |
27 | 27 | ||
28 | 28 | let FEE_SCALE6 = 1000000 | |
29 | 29 | ||
30 | 30 | let kSFPoolAAssetBalance = "A_asset_balance" | |
31 | 31 | ||
32 | 32 | let kSFPoolBAssetBalance = "B_asset_balance" | |
33 | 33 | ||
34 | 34 | let kSFPoolAAssetId = "A_asset_id" | |
35 | 35 | ||
36 | 36 | let kSFPoolBAssetId = "B_asset_id" | |
37 | 37 | ||
38 | 38 | let kSFPoolShareId = "share_asset_id" | |
39 | 39 | ||
40 | 40 | let kSFPoolShareSupply = "share_asset_supply" | |
41 | 41 | ||
42 | 42 | let kSFPoolFee = "commission" | |
43 | 43 | ||
44 | 44 | let kUserPosition = "_userPosition" | |
45 | 45 | ||
46 | 46 | let kUserPositionPool = "_userPositionPool" | |
47 | 47 | ||
48 | 48 | let kUserBorrowAmount = "_userPositionBorrowAmount" | |
49 | 49 | ||
50 | 50 | let kUserBorrowAssetId = "_userPositionBorrowAssetId" | |
51 | 51 | ||
52 | 52 | let kUserPositionNum = "_userPositionNumber" | |
53 | 53 | ||
54 | 54 | let kUserPositionInterest = "_userPositionInterest" | |
55 | 55 | ||
56 | 56 | let kPoolTotal = "_poolTotal" | |
57 | 57 | ||
58 | 58 | let kPoolTotalLoan = "_poolTotalLoan" | |
59 | 59 | ||
60 | 60 | let kPoolInterestLoan = "_poolInterestLoan" | |
61 | 61 | ||
62 | 62 | let kPoolInterestNoLoan = "_poolInterestNoLoan" | |
63 | 63 | ||
64 | 64 | let kPoolCanBorrow = "_poolCanBorrow" | |
65 | 65 | ||
66 | 66 | let kAxlyInFeeWithoutLoan = "_axlyFeeNoLoan" | |
67 | 67 | ||
68 | 68 | let kAxlyInFeeWithLoan = "_axlyFeeWithLoan" | |
69 | 69 | ||
70 | - | let kAxlyNoLoanCapFee = "_ | |
70 | + | let kAxlyNoLoanCapFee = "_axlyFeeCapNoLoan" | |
71 | 71 | ||
72 | - | let kAxlyWithLoanCapFee = "_ | |
72 | + | let kAxlyWithLoanCapFee = "_axlyFeeCapWithLoan" | |
73 | 73 | ||
74 | 74 | let kAxlyStopLossNoLoanFee = "_axlyFeeStoplossWithLoan" | |
75 | 75 | ||
76 | 76 | let kAxlyStopLossLoanFee = "_axlyFeeStoplossNoLoan" | |
77 | 77 | ||
78 | 78 | let kRequestId = "_request_id" | |
79 | 79 | ||
80 | 80 | let kRequestIter = "requests_iter" | |
81 | 81 | ||
82 | 82 | let kPool = "pool_" | |
83 | 83 | ||
84 | 84 | let kSharePool = "_poolShareId" | |
85 | 85 | ||
86 | 86 | let kPoolCapChange = "_poolCapChange" | |
87 | 87 | ||
88 | 88 | let kTokenLastPrice = "last_price" | |
89 | 89 | ||
90 | 90 | let kPriceInOracle = "_twap5B" | |
91 | 91 | ||
92 | 92 | let kActive = "active" | |
93 | 93 | ||
94 | 94 | let kActiveUsers = "activeUsers" | |
95 | 95 | ||
96 | 96 | let kActiveSFWX = "_active" | |
97 | 97 | ||
98 | 98 | let kPoolActive = "_activePool" | |
99 | 99 | ||
100 | 100 | let kUserStopLoss = "_stopLoss" | |
101 | 101 | ||
102 | 102 | let kMoneyBox = "axly_money_box" | |
103 | 103 | ||
104 | 104 | let kSFFarmingAddr = "swopfi_farming_addr" | |
105 | 105 | ||
106 | 106 | let kLendService = "lend_service_addr" | |
107 | 107 | ||
108 | - | let | |
108 | + | let kOperatorCallPK = "admin_call_pub_key" | |
109 | 109 | ||
110 | 110 | let kPriceOracle = "price_oracle" | |
111 | 111 | ||
112 | 112 | let kExContract = "exchange_contract" | |
113 | 113 | ||
114 | 114 | let kWxSwapContract = "wx_swap_contract" | |
115 | 115 | ||
116 | 116 | let kSwopId = "swop_id" | |
117 | 117 | ||
118 | 118 | let kWxId = "wx_id" | |
119 | + | ||
120 | + | let kGroup1Admin1PK = "group1_admin1_pub_key" | |
121 | + | ||
122 | + | let kGroup1Admin2PK = "group1_admin2_pub_key" | |
123 | + | ||
124 | + | let kGroup2Admin1PK = "group2_admin1_pub_key" | |
125 | + | ||
126 | + | let kGroup2Admin2PK = "group2_admin2_pub_key" | |
119 | 127 | ||
120 | 128 | let moneyBox = Address(fromBase58String(valueOrErrorMessage(getString(this, kMoneyBox), "No axly moneyBox address"))) | |
121 | 129 | ||
122 | 130 | let exContract = Address(fromBase58String(valueOrErrorMessage(getString(this, kExContract), "No exchange contract address"))) | |
123 | 131 | ||
124 | 132 | let priceOracleAddr = Address(fromBase58String(valueOrErrorMessage(getString(this, kPriceOracle), "No price oracle address"))) | |
125 | 133 | ||
126 | 134 | let wxSwapContract = Address(fromBase58String(valueOrErrorMessage(getString(this, kWxSwapContract), "No wx swap address"))) | |
127 | 135 | ||
128 | 136 | let SWOPID = fromBase58String(valueOrErrorMessage(getString(this, kSwopId), "No swop id")) | |
129 | 137 | ||
130 | 138 | let WXID = fromBase58String(valueOrErrorMessage(getString(this, kWxId), "No wx id")) | |
131 | 139 | ||
140 | + | let group1Admin1PK = fromBase58String(valueOrErrorMessage(getString(this, kGroup1Admin1PK), "Can't get kGroup1Admin1PK")) | |
141 | + | ||
142 | + | let group1Admin2PK = fromBase58String(valueOrErrorMessage(getString(this, kGroup1Admin2PK), "Can't get kGroup1Admin2PK")) | |
143 | + | ||
144 | + | let group2Admin1PK = fromBase58String(valueOrErrorMessage(getString(this, kGroup2Admin1PK), "Can't get kGroup2Admin1PK")) | |
145 | + | ||
146 | + | let group2Admin2PK = fromBase58String(valueOrErrorMessage(getString(this, kGroup2Admin2PK), "Can't get kGroup2Admin1PK")) | |
147 | + | ||
148 | + | let operatorPK = fromBase58String(valueOrErrorMessage(getString(this, kOperatorCallPK), "Can't get operatorPK")) | |
149 | + | ||
132 | 150 | func unknownPoolType () = throw("Wrong pool type") | |
133 | 151 | ||
134 | 152 | ||
135 | 153 | func getLendSrvAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kLendService), "Can't get lend service addr"))) | |
136 | 154 | ||
137 | 155 | ||
138 | - | func getAdminCallAddr () = addressFromPublicKey(fromBase58String(valueOrErrorMessage(getString(this, kAdminCallPK), "Can't get admin addr"))) | |
156 | + | func isOperatorCall (i) = if ((i.callerPublicKey == i.callerPublicKey)) | |
157 | + | then unit | |
158 | + | else throw("Only operator can call this function") | |
139 | 159 | ||
140 | 160 | ||
141 | - | func isAdminCall (i) = if ((i.caller == getAdminCallAddr())) | |
161 | + | func isAdminCall (i) = if (if ((i.callerPublicKey == i.callerPublicKey)) | |
162 | + | then true | |
163 | + | else (i.callerPublicKey == i.callerPublicKey)) | |
142 | 164 | then unit | |
143 | - | else throw("Only admin can call this function") | |
165 | + | else throw("Only admin group1 can call this function") | |
144 | 166 | ||
145 | 167 | ||
146 | 168 | func isSelfCall (i) = if ((i.caller == this)) | |
147 | 169 | then unit | |
148 | 170 | else throw("Only contract itself can call this function") | |
149 | 171 | ||
150 | 172 | ||
151 | 173 | func isLandCall (i) = if ((i.caller == getLendSrvAddr())) | |
152 | 174 | then unit | |
153 | 175 | else throw("Only land contract can call this function") | |
154 | 176 | ||
155 | 177 | ||
156 | 178 | func isActive () = if ((valueOrElse(getBoolean(this, kActive), true) == true)) | |
157 | 179 | then unit | |
158 | 180 | else throw("DApp is inactive at this moment") | |
159 | 181 | ||
160 | 182 | ||
161 | 183 | func isActiveForUsers () = if (if (valueOrElse(getBoolean(this, kActive), true)) | |
162 | 184 | then (valueOrElse(getBoolean(this, kActiveUsers), true) == true) | |
163 | 185 | else false) | |
164 | 186 | then unit | |
165 | 187 | else throw("DApp is inactive for users at this moment") | |
166 | 188 | ||
167 | 189 | ||
168 | 190 | func isPoolActive (pool,type) = { | |
169 | 191 | let WXSFActive = valueOrElse(getBoolean(this, (type + kActiveSFWX)), true) | |
170 | 192 | let poolActive = valueOrElse(getBoolean(this, (pool + kPoolActive)), true) | |
171 | 193 | if (if (WXSFActive) | |
172 | 194 | then poolActive | |
173 | 195 | else false) | |
174 | 196 | then true | |
175 | 197 | else false | |
176 | 198 | } | |
177 | 199 | ||
178 | 200 | ||
179 | 201 | func accountBalance (assetId) = match assetId { | |
180 | 202 | case id: ByteVector => | |
181 | 203 | assetBalance(this, id) | |
182 | 204 | case waves: Unit => | |
183 | 205 | wavesBalance(this).available | |
184 | 206 | case _ => | |
185 | 207 | throw("Match error") | |
186 | 208 | } | |
187 | 209 | ||
188 | 210 | ||
189 | 211 | func getSFPoolBalances (poolAddr) = $Tuple2(valueOrErrorMessage(getInteger(poolAddr, kSFPoolAAssetBalance), "Can't get pool A asset balance"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolBAssetBalance), "Can't get pool B asset balance")) | |
190 | 212 | ||
191 | 213 | ||
192 | 214 | func getWXPoolBalances (poolAddr,aId,bId) = $Tuple2({ | |
193 | 215 | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [aId], nil) | |
194 | 216 | if ($isInstanceOf(@, "Int")) | |
195 | 217 | then @ | |
196 | 218 | else throw(($getType(@) + " couldn't be cast to Int")) | |
197 | 219 | }, { | |
198 | 220 | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [bId], nil) | |
199 | 221 | if ($isInstanceOf(@, "Int")) | |
200 | 222 | then @ | |
201 | 223 | else throw(($getType(@) + " couldn't be cast to Int")) | |
202 | 224 | }) | |
203 | 225 | ||
204 | 226 | ||
205 | 227 | func getPoolBalances (poolAddr,type,aId,bId) = if ((type == SF_POOL)) | |
206 | 228 | then getSFPoolBalances(poolAddr) | |
207 | 229 | else if ((type == WX_POOL)) | |
208 | 230 | then getWXPoolBalances(poolAddr, aId, bId) | |
209 | 231 | else unknownPoolType() | |
210 | 232 | ||
211 | 233 | ||
212 | 234 | func getSFPoolData (poolAddr) = { | |
213 | - | let $ | |
214 | - | if (($ | |
235 | + | let $t079127961 = getSFPoolBalances(poolAddr) | |
236 | + | if (($t079127961 == $t079127961)) | |
215 | 237 | then { | |
216 | - | let balB = $ | |
217 | - | let balA = $ | |
238 | + | let balB = $t079127961._2 | |
239 | + | let balA = $t079127961._1 | |
218 | 240 | $Tuple5(valueOrErrorMessage(getString(poolAddr, kSFPoolAAssetId), "Can't get pool A asset id"), valueOrErrorMessage(getString(poolAddr, kSFPoolBAssetId), "Can't get pool B asset id"), balA, balB, valueOrErrorMessage(getString(poolAddr, kSFPoolShareId), "Can't get share asset id")) | |
219 | 241 | } | |
220 | 242 | else throw("Strict value is not equal to itself.") | |
221 | 243 | } | |
222 | 244 | ||
223 | 245 | ||
224 | 246 | func getWXPoolData (poolAddr) = { | |
225 | 247 | let cfg = { | |
226 | 248 | let @ = invoke(poolAddr, "getPoolConfigWrapperREADONLY", nil, nil) | |
227 | 249 | if ($isInstanceOf(@, "List[Any]")) | |
228 | 250 | then @ | |
229 | 251 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
230 | 252 | } | |
231 | 253 | if ((cfg == cfg)) | |
232 | 254 | then { | |
233 | 255 | let aId = valueOrErrorMessage({ | |
234 | 256 | let @ = cfg[4] | |
235 | 257 | if ($isInstanceOf(@, "String")) | |
236 | 258 | then @ | |
237 | 259 | else unit | |
238 | 260 | }, "Can't get pool A asset id") | |
239 | 261 | let bId = valueOrErrorMessage({ | |
240 | 262 | let @ = cfg[5] | |
241 | 263 | if ($isInstanceOf(@, "String")) | |
242 | 264 | then @ | |
243 | 265 | else unit | |
244 | 266 | }, "Can't get pool B asset id") | |
245 | 267 | let shareId = valueOrErrorMessage({ | |
246 | 268 | let @ = cfg[3] | |
247 | 269 | if ($isInstanceOf(@, "String")) | |
248 | 270 | then @ | |
249 | 271 | else unit | |
250 | 272 | }, "Can't get pool LP asset id") | |
251 | - | let $ | |
252 | - | if (($ | |
273 | + | let $t086588717 = getWXPoolBalances(poolAddr, aId, bId) | |
274 | + | if (($t086588717 == $t086588717)) | |
253 | 275 | then { | |
254 | - | let balB = $ | |
255 | - | let balA = $ | |
276 | + | let balB = $t086588717._2 | |
277 | + | let balA = $t086588717._1 | |
256 | 278 | $Tuple5(aId, bId, balA, balB, shareId) | |
257 | 279 | } | |
258 | 280 | else throw("Strict value is not equal to itself.") | |
259 | 281 | } | |
260 | 282 | else throw("Strict value is not equal to itself.") | |
261 | 283 | } | |
262 | 284 | ||
263 | 285 | ||
264 | 286 | func getPoolData (poolAddr,type) = if ((type == SF_POOL)) | |
265 | 287 | then getSFPoolData(poolAddr) | |
266 | 288 | else if ((type == WX_POOL)) | |
267 | 289 | then getWXPoolData(poolAddr) | |
268 | 290 | else unknownPoolType() | |
269 | 291 | ||
270 | 292 | ||
271 | 293 | func getShareSupply (poolAddr,type,shareId) = if ((type == SF_POOL)) | |
272 | 294 | then valueOrErrorMessage(getInteger(poolAddr, kSFPoolShareSupply), "Can't get share asset supply") | |
273 | 295 | else if ((type == WX_POOL)) | |
274 | 296 | then valueOrErrorMessage(assetInfo(fromBase58String(shareId)), "Wrong ShareId").quantity | |
275 | 297 | else unknownPoolType() | |
276 | 298 | ||
277 | 299 | ||
278 | 300 | func getPoolTotalShare (pool) = valueOrElse(getInteger(this, (pool + kPoolTotal)), 0) | |
279 | 301 | ||
280 | 302 | ||
281 | 303 | func getPoolTotalShareWithLoan (pool) = valueOrElse(getInteger(this, (pool + kPoolTotalLoan)), 0) | |
282 | 304 | ||
283 | 305 | ||
284 | 306 | func getNewUserPositionNumber (user) = (valueOrElse(getInteger(this, (user + kUserPositionNum)), 0) + 1) | |
285 | 307 | ||
286 | 308 | ||
287 | 309 | func getAxlyFee (pool,feeType) = if ((feeType == CAP_FEE_LOAN)) | |
288 | 310 | then getIntegerValue(this, (pool + kAxlyWithLoanCapFee)) | |
289 | 311 | else if ((feeType == CAP_FEE_NO_LOAN)) | |
290 | 312 | then getIntegerValue(this, (pool + kAxlyNoLoanCapFee)) | |
291 | 313 | else if ((feeType == LOAN_FEE)) | |
292 | 314 | then getIntegerValue(this, (pool + kAxlyInFeeWithLoan)) | |
293 | 315 | else if ((feeType == NO_LOAN_FEE)) | |
294 | 316 | then getIntegerValue(this, (pool + kAxlyInFeeWithoutLoan)) | |
295 | 317 | else if ((feeType == NO_FEE)) | |
296 | 318 | then 0 | |
297 | 319 | else throw("Wrong fee type") | |
298 | 320 | ||
299 | 321 | ||
300 | 322 | func getSFFarmingAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kSFFarmingAddr), "Can't get swopfi farming addr"))) | |
301 | 323 | ||
302 | 324 | ||
303 | 325 | func getWXFarmingAddr (poolAddr) = { | |
304 | 326 | let fContract = Address(fromBase58String(valueOrErrorMessage(getString(poolAddr, "%s__factoryContract"), "Can't get WX factory contract addr"))) | |
305 | 327 | let factroyCfg = split(valueOrErrorMessage(getString(fContract, "%s__factoryConfig"), "Can't get WX factory cfg"), "__") | |
306 | 328 | Address(fromBase58String(factroyCfg[1])) | |
307 | 329 | } | |
308 | 330 | ||
309 | 331 | ||
310 | 332 | func assetIdToStr (assetId) = match assetId { | |
311 | 333 | case id: ByteVector => | |
312 | 334 | toBase58String(id) | |
313 | 335 | case waves: Unit => | |
314 | 336 | "WAVES" | |
315 | 337 | case _ => | |
316 | 338 | throw("Not Asset id") | |
317 | 339 | } | |
318 | 340 | ||
319 | 341 | ||
320 | 342 | func assetIdFromStr (assetId) = if ((assetId == "WAVES")) | |
321 | 343 | then unit | |
322 | 344 | else fromBase58String(assetId) | |
323 | 345 | ||
324 | 346 | ||
325 | 347 | func getAssetDecimals (assetId) = if ((assetId == "WAVES")) | |
326 | 348 | then 8 | |
327 | 349 | else match assetInfo(fromBase58String(assetId)) { | |
328 | 350 | case asset: Asset => | |
329 | 351 | asset.decimals | |
330 | 352 | case _ => | |
331 | 353 | throw("Can't find asset") | |
332 | 354 | } | |
333 | 355 | ||
334 | 356 | ||
335 | 357 | func getAssetPrecition (assetId) = pow(10, 0, getAssetDecimals(assetId), 0, 0, DOWN) | |
336 | 358 | ||
337 | 359 | ||
338 | 360 | func getAssetsPrice (assetIds) = { | |
339 | 361 | func getPrices (a,assetId) = { | |
340 | - | let assetPrice = | |
362 | + | let assetPrice = valueOrElse(getInteger(priceOracleAddr, (assetId + kPriceInOracle)), -1) | |
341 | 363 | (a :+ assetPrice) | |
342 | 364 | } | |
343 | 365 | ||
344 | 366 | let $l = assetIds | |
345 | 367 | let $s = size($l) | |
346 | 368 | let $acc0 = nil | |
347 | 369 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
348 | 370 | then $a | |
349 | 371 | else getPrices($a, $l[$i]) | |
350 | 372 | ||
351 | 373 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
352 | 374 | then $a | |
353 | 375 | else throw("List size exceeds 50") | |
354 | 376 | ||
355 | 377 | $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($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($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($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), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50) | |
356 | 378 | } | |
357 | 379 | ||
358 | 380 | ||
359 | 381 | func getSharePrice (shareId) = { | |
360 | 382 | let pool = valueOrErrorMessage(getString(this, (shareId + kSharePool)), "Can't find pool addr by share id") | |
361 | 383 | let poolAddr = Address(fromBase58String(pool)) | |
362 | 384 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
363 | - | let $t01084710912 = getPoolData(poolAddr, pType) | |
364 | - | let aId = $t01084710912._1 | |
365 | - | let bId = $t01084710912._2 | |
366 | - | let aBalance = $t01084710912._3 | |
367 | - | let bBalance = $t01084710912._4 | |
368 | - | let dPriceA = getIntegerValue(priceOracleAddr, (aId + kPriceInOracle)) | |
369 | - | let dPriceB = getIntegerValue(priceOracleAddr, (bId + kPriceInOracle)) | |
370 | - | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
371 | - | let APrecision = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
372 | - | let BPrecision = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
373 | - | let sharePrecision = pow(10, 0, getAssetDecimals(shareId), 0, 0, DOWN) | |
374 | - | let sum = (fraction(aBalance, dPriceA, APrecision) + fraction(bBalance, dPriceB, BPrecision)) | |
375 | - | fraction(sum, sharePrecision, shareSupply) | |
385 | + | let $t01170611771 = getPoolData(poolAddr, pType) | |
386 | + | let aId = $t01170611771._1 | |
387 | + | let bId = $t01170611771._2 | |
388 | + | let aBalance = $t01170611771._3 | |
389 | + | let bBalance = $t01170611771._4 | |
390 | + | let prices = getAssetsPrice([aId, bId]) | |
391 | + | let dPriceA = prices[0] | |
392 | + | let dPriceB = prices[1] | |
393 | + | if (if ((0 > dPriceA)) | |
394 | + | then true | |
395 | + | else (0 > dPriceB)) | |
396 | + | then -1 | |
397 | + | else { | |
398 | + | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
399 | + | let APrecision = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
400 | + | let BPrecision = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
401 | + | let sharePrecision = pow(10, 0, getAssetDecimals(shareId), 0, 0, DOWN) | |
402 | + | let sum = (fraction(aBalance, dPriceA, APrecision) + fraction(bBalance, dPriceB, BPrecision)) | |
403 | + | fraction(sum, sharePrecision, shareSupply) | |
404 | + | } | |
376 | 405 | } | |
377 | 406 | ||
378 | 407 | ||
379 | 408 | func getSharePrices (shareIds) = { | |
380 | 409 | func getPrices (a,shareId) = (a :+ getSharePrice(shareId)) | |
381 | 410 | ||
382 | 411 | let $l = shareIds | |
383 | 412 | let $s = size($l) | |
384 | 413 | let $acc0 = nil | |
385 | 414 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
386 | 415 | then $a | |
387 | 416 | else getPrices($a, $l[$i]) | |
388 | 417 | ||
389 | 418 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
390 | 419 | then $a | |
391 | 420 | else throw("List size exceeds 20") | |
392 | 421 | ||
393 | 422 | $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($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), 16), 17), 18), 19), 20) | |
394 | 423 | } | |
395 | 424 | ||
396 | 425 | ||
397 | 426 | func getCursEntries (aId,bId,shareId,wAmounts) = { | |
398 | 427 | let assetsPrices = getAssetsPrice([aId, bId]) | |
399 | 428 | let sharePrice = getSharePrice(shareId) | |
400 | 429 | let prices = ([toString(assetsPrices[0]), toString(assetsPrices[1]), toString(sharePrice)] ++ wAmounts) | |
401 | 430 | [StringEntry(kTokenLastPrice, makeString(prices, ","))] | |
402 | 431 | } | |
403 | 432 | ||
404 | 433 | ||
405 | 434 | func calcReplenishByTwoTokens (pType,poolAddr,pmtA,aId,pmtB,bId,balA,balB) = if ((pType == SF_POOL)) | |
406 | 435 | then { | |
407 | 436 | let repl = { | |
408 | 437 | let @ = invoke(poolAddr, "callFunction", ["calcLPReplenishTwoTokensREADONLY", [toString(pmtA), toString(pmtB)]], nil) | |
409 | 438 | if ($isInstanceOf(@, "List[Any]")) | |
410 | 439 | then @ | |
411 | 440 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
412 | 441 | } | |
413 | 442 | if ((repl == repl)) | |
414 | 443 | then $Tuple5({ | |
415 | 444 | let @ = repl[3] | |
416 | 445 | if ($isInstanceOf(@, "Int")) | |
417 | 446 | then @ | |
418 | 447 | else throw(($getType(@) + " couldn't be cast to Int")) | |
419 | 448 | }, { | |
420 | 449 | let @ = repl[4] | |
421 | 450 | if ($isInstanceOf(@, "Int")) | |
422 | 451 | then @ | |
423 | 452 | else throw(($getType(@) + " couldn't be cast to Int")) | |
424 | 453 | }, { | |
425 | 454 | let @ = repl[1] | |
426 | 455 | if ($isInstanceOf(@, "Int")) | |
427 | 456 | then @ | |
428 | 457 | else throw(($getType(@) + " couldn't be cast to Int")) | |
429 | 458 | }, assetIdToStr(repl[2]), { | |
430 | 459 | let @ = repl[0] | |
431 | 460 | if ($isInstanceOf(@, "Int")) | |
432 | 461 | then @ | |
433 | 462 | else throw(($getType(@) + " couldn't be cast to Int")) | |
434 | 463 | }) | |
435 | 464 | else throw("Strict value is not equal to itself.") | |
436 | 465 | } | |
437 | 466 | else if ((pType == WX_POOL)) | |
438 | 467 | then { | |
439 | - | let $ | |
468 | + | let $t01331513565 = $Tuple2(split({ | |
440 | 469 | let @ = invoke(poolAddr, "evaluatePutByAmountAssetREADONLY", [pmtA], nil) | |
441 | 470 | if ($isInstanceOf(@, "String")) | |
442 | 471 | then @ | |
443 | 472 | else throw(($getType(@) + " couldn't be cast to String")) | |
444 | 473 | }, "__"), split({ | |
445 | 474 | let @ = invoke(poolAddr, "evaluatePutByPriceAssetREADONLY", [pmtB], nil) | |
446 | 475 | if ($isInstanceOf(@, "String")) | |
447 | 476 | then @ | |
448 | 477 | else throw(($getType(@) + " couldn't be cast to String")) | |
449 | 478 | }, "__")) | |
450 | - | if (($ | |
479 | + | if (($t01331513565 == $t01331513565)) | |
451 | 480 | then { | |
452 | - | let evalPutInB = $ | |
453 | - | let evalPutInA = $ | |
481 | + | let evalPutInB = $t01331513565._2 | |
482 | + | let evalPutInA = $t01331513565._1 | |
454 | 483 | let lpInA = parseIntValue(evalPutInA[1]) | |
455 | 484 | let lpInB = parseIntValue(evalPutInB[1]) | |
456 | 485 | if ((lpInB > lpInA)) | |
457 | 486 | then { | |
458 | 487 | let pmt = parseIntValue(evalPutInA[8]) | |
459 | 488 | $Tuple5(pmtA, pmt, (pmtB - pmt), bId, lpInB) | |
460 | 489 | } | |
461 | 490 | else { | |
462 | 491 | let pmt = parseIntValue(evalPutInB[7]) | |
463 | 492 | $Tuple5(pmt, pmtB, (pmtA - pmt), aId, lpInA) | |
464 | 493 | } | |
465 | 494 | } | |
466 | 495 | else throw("Strict value is not equal to itself.") | |
467 | 496 | } | |
468 | 497 | else unknownPoolType() | |
469 | 498 | ||
470 | 499 | ||
471 | 500 | func replenishTwoTokensByType (poolAddr,pType,pmtA,aId,pmtB,bId) = { | |
472 | 501 | let payments = [AttachedPayment(assetIdFromStr(aId), pmtA), AttachedPayment(assetIdFromStr(bId), pmtB)] | |
473 | 502 | if ((pType == SF_POOL)) | |
474 | 503 | then invoke(poolAddr, "callFunction", ["replenishWithTwoTokens", ["false", "0"]], payments) | |
475 | 504 | else if ((pType == WX_POOL)) | |
476 | 505 | then invoke(poolAddr, "put", [1000000, false], payments) | |
477 | 506 | else unknownPoolType() | |
478 | 507 | } | |
479 | 508 | ||
480 | 509 | ||
481 | 510 | func replenishOneTokenByType (poolAddr,pType,pmt,pmtId) = { | |
482 | 511 | let payments = [AttachedPayment(assetIdFromStr(pmtId), pmt)] | |
483 | 512 | if ((pType == SF_POOL)) | |
484 | 513 | then invoke(poolAddr, "callFunction", ["replenishWithOneToken", ["0", "false", "0"]], payments) | |
485 | 514 | else if ((pType == WX_POOL)) | |
486 | 515 | then invoke(poolAddr, "putOneTkn", [0, false], payments) | |
487 | 516 | else unknownPoolType() | |
488 | 517 | } | |
489 | 518 | ||
490 | 519 | ||
491 | 520 | func stakeLP (pool,pType,shareId,amount) = { | |
492 | 521 | let payments = [AttachedPayment(fromBase58String(shareId), amount)] | |
493 | 522 | if ((pType == SF_POOL)) | |
494 | 523 | then invoke(getSFFarmingAddr(), "lockShareTokens", [pool, 0], payments) | |
495 | 524 | else if ((pType == WX_POOL)) | |
496 | 525 | then invoke(getWXFarmingAddr(addressFromStringValue(pool)), "stake", nil, payments) | |
497 | 526 | else unknownPoolType() | |
498 | 527 | } | |
499 | 528 | ||
500 | 529 | ||
501 | 530 | func unstakeLP (pool,pType,shareId,amount) = { | |
502 | - | let $ | |
531 | + | let $t01522415574 = if ((pType == SF_POOL)) | |
503 | 532 | then $Tuple3(getSFFarmingAddr(), "withdrawShareTokens", [pool, amount]) | |
504 | 533 | else if ((pType == WX_POOL)) | |
505 | 534 | then $Tuple3(getWXFarmingAddr(Address(fromBase58String(pool))), "unstake", [shareId, amount]) | |
506 | 535 | else unknownPoolType() | |
507 | - | let farmAddr = $ | |
508 | - | let fName = $ | |
509 | - | let params = $ | |
536 | + | let farmAddr = $t01522415574._1 | |
537 | + | let fName = $t01522415574._2 | |
538 | + | let params = $t01522415574._3 | |
510 | 539 | let inv = invoke(farmAddr, fName, params, nil) | |
511 | 540 | if ((inv == inv)) | |
512 | 541 | then amount | |
513 | 542 | else throw("Strict value is not equal to itself.") | |
514 | 543 | } | |
515 | 544 | ||
516 | 545 | ||
517 | 546 | func calcAmountToPaySF (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
518 | 547 | let poolAddr = Address(fromBase58String(pool)) | |
519 | 548 | let feeScale6 = 1000000 | |
520 | 549 | let fee = getIntegerValue(poolAddr, kSFPoolFee) | |
521 | 550 | let amntGetNoFee = fraction(amountTokenToGet, feeScale6, (feeScale6 - fee), CEILING) | |
522 | - | let $ | |
551 | + | let $t01599616302 = if ((assetTokenToGet == assetIdA)) | |
523 | 552 | then { | |
524 | 553 | let amountToPay = fraction(amntGetNoFee, balB, (balA - amntGetNoFee), CEILING) | |
525 | 554 | $Tuple2(amountToPay, assetIdB) | |
526 | 555 | } | |
527 | 556 | else { | |
528 | 557 | let amountToPay = fraction(amntGetNoFee, balA, (balB - amntGetNoFee), CEILING) | |
529 | 558 | $Tuple2(amountToPay, assetIdA) | |
530 | 559 | } | |
531 | - | let amountToPay = $ | |
532 | - | let assetToPay = $ | |
560 | + | let amountToPay = $t01599616302._1 | |
561 | + | let assetToPay = $t01599616302._2 | |
533 | 562 | $Tuple2(assetToPay, amountToPay) | |
534 | 563 | } | |
535 | 564 | ||
536 | 565 | ||
537 | 566 | func getWXSwapFees (pool) = { | |
538 | 567 | let poolAddr = addressFromStringValue(pool) | |
539 | 568 | let fContract = addressFromStringValue(valueOrErrorMessage(getString(poolAddr, "%s__factoryContract"), "Can't get WX factory contract addr")) | |
540 | 569 | let poolFeeDefault = value(getInteger(wxSwapContract, "%s__poolFee")) | |
541 | 570 | let protocolFeeDefault = value(getInteger(wxSwapContract, "%s__protocolFee")) | |
542 | 571 | match invoke(fContract, "getSwapFeeREADONLY", [toString(poolAddr)], nil) { | |
543 | 572 | case fees: (Int, Int) => | |
544 | 573 | $Tuple2(fees._1, fees._2) | |
545 | 574 | case _ => | |
546 | 575 | $Tuple2(poolFeeDefault, protocolFeeDefault) | |
547 | 576 | } | |
548 | 577 | } | |
549 | 578 | ||
550 | 579 | ||
551 | 580 | func calcAmountToPayWX (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
552 | - | let $ | |
553 | - | let pFee = $ | |
554 | - | let prFee = $ | |
581 | + | let $t01704217081 = getWXSwapFees(pool) | |
582 | + | let pFee = $t01704217081._1 | |
583 | + | let prFee = $t01704217081._2 | |
555 | 584 | let feeScale = toBigInt(100000000) | |
556 | - | let $ | |
585 | + | let $t01712117429 = if ((assetTokenToGet == assetIdA)) | |
557 | 586 | then { | |
558 | 587 | let amountToPay = fraction(amountTokenToGet, balB, (balA - amountTokenToGet)) | |
559 | 588 | $Tuple2(amountToPay, assetIdB) | |
560 | 589 | } | |
561 | 590 | else { | |
562 | 591 | let amountToPay = fraction(amountTokenToGet, balA, (balB - amountTokenToGet)) | |
563 | 592 | $Tuple2(amountToPay, assetIdA) | |
564 | 593 | } | |
565 | - | let amountToPay = $ | |
566 | - | let assetToPay = $ | |
594 | + | let amountToPay = $t01712117429._1 | |
595 | + | let assetToPay = $t01712117429._2 | |
567 | 596 | let amountToPayWithFee = toInt(fraction(toBigInt(amountToPay), feeScale, (feeScale - toBigInt((prFee + pFee))), CEILING)) | |
568 | 597 | $Tuple2(assetToPay, amountToPayWithFee) | |
569 | 598 | } | |
570 | 599 | ||
571 | 600 | ||
572 | 601 | func exchangeDirectly (pType,pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = if ((pType == SF_POOL)) | |
573 | 602 | then { | |
574 | - | let $ | |
575 | - | let assetToPay = $ | |
576 | - | let amountToPay = $ | |
603 | + | let $t01777617898 = calcAmountToPaySF(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
604 | + | let assetToPay = $t01777617898._1 | |
605 | + | let amountToPay = $t01777617898._2 | |
577 | 606 | invoke(addressFromStringValue(pool), "callFunction", ["exchange", [toString(amountTokenToGet)]], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
578 | 607 | } | |
579 | 608 | else if ((pType == WX_POOL)) | |
580 | 609 | then { | |
581 | - | let $ | |
582 | - | let assetToPay = $ | |
583 | - | let amountToPay = $ | |
610 | + | let $t01809818220 = calcAmountToPayWX(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
611 | + | let assetToPay = $t01809818220._1 | |
612 | + | let amountToPay = $t01809818220._2 | |
584 | 613 | invoke(wxSwapContract, "swap", [amountTokenToGet, assetTokenToGet, toString(this)], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
585 | 614 | } | |
586 | 615 | else unknownPoolType() | |
587 | 616 | ||
588 | 617 | ||
589 | 618 | func calcWithdrawLPFromPoolVirt (poolAddr,pType,shareId,userCanWithdraw) = { | |
590 | - | let $ | |
619 | + | let $t01850718971 = if ((pType == SF_POOL)) | |
591 | 620 | then { | |
592 | 621 | let inv = { | |
593 | 622 | let @ = invoke(poolAddr, "callFunction", ["withdrawREADONLY", [toString(userCanWithdraw)]], nil) | |
594 | 623 | if ($isInstanceOf(@, "List[Any]")) | |
595 | 624 | then @ | |
596 | 625 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
597 | 626 | } | |
598 | 627 | if ((inv == inv)) | |
599 | 628 | then $Tuple2({ | |
600 | 629 | let @ = inv[0] | |
601 | 630 | if ($isInstanceOf(@, "Int")) | |
602 | 631 | then @ | |
603 | 632 | else throw(($getType(@) + " couldn't be cast to Int")) | |
604 | 633 | }, { | |
605 | 634 | let @ = inv[1] | |
606 | 635 | if ($isInstanceOf(@, "Int")) | |
607 | 636 | then @ | |
608 | 637 | else throw(($getType(@) + " couldn't be cast to Int")) | |
609 | 638 | }) | |
610 | 639 | else throw("Strict value is not equal to itself.") | |
611 | 640 | } | |
612 | 641 | else if ((pType == WX_POOL)) | |
613 | 642 | then { | |
614 | 643 | let inv = split({ | |
615 | 644 | let @ = invoke(poolAddr, "evaluateGetREADONLY", [shareId, userCanWithdraw], nil) | |
616 | 645 | if ($isInstanceOf(@, "String")) | |
617 | 646 | then @ | |
618 | 647 | else throw(($getType(@) + " couldn't be cast to String")) | |
619 | 648 | }, "__") | |
620 | 649 | if ((inv == inv)) | |
621 | 650 | then $Tuple2(parseIntValue(inv[1]), parseIntValue(inv[2])) | |
622 | 651 | else throw("Strict value is not equal to itself.") | |
623 | 652 | } | |
624 | 653 | else unknownPoolType() | |
625 | - | let amountA = $ | |
626 | - | let amountB = $ | |
654 | + | let amountA = $t01850718971._1 | |
655 | + | let amountB = $t01850718971._2 | |
627 | 656 | $Tuple2(amountA, amountB) | |
628 | 657 | } | |
629 | 658 | ||
630 | 659 | ||
631 | 660 | func claimFarmed (pType,pool) = if ((pType == SF_POOL)) | |
632 | 661 | then { | |
633 | 662 | let balBefore = accountBalance(SWOPID) | |
634 | 663 | if ((balBefore == balBefore)) | |
635 | 664 | then { | |
636 | 665 | let inv = invoke(getSFFarmingAddr(), "claim", [pool], nil) | |
637 | 666 | if ((inv == inv)) | |
638 | 667 | then { | |
639 | 668 | let balAfter = accountBalance(SWOPID) | |
640 | 669 | $Tuple2((balAfter - balBefore), SWOPID) | |
641 | 670 | } | |
642 | 671 | else throw("Strict value is not equal to itself.") | |
643 | 672 | } | |
644 | 673 | else throw("Strict value is not equal to itself.") | |
645 | 674 | } | |
646 | 675 | else if ((pType == WX_POOL)) | |
647 | 676 | then { | |
677 | + | let $t01933919418 = getWXPoolData(addressFromStringValue(pool)) | |
678 | + | let aId = $t01933919418._1 | |
679 | + | let bId = $t01933919418._2 | |
680 | + | let aBal = $t01933919418._3 | |
681 | + | let bBal = $t01933919418._4 | |
682 | + | let lpId = $t01933919418._5 | |
648 | 683 | let balBefore = accountBalance(WXID) | |
649 | 684 | if ((balBefore == balBefore)) | |
650 | 685 | then { | |
651 | - | let inv = invoke(getWXFarmingAddr( | |
686 | + | let inv = invoke(getWXFarmingAddr(addressFromStringValue(pool)), "claimWx", [lpId], nil) | |
652 | 687 | if ((inv == inv)) | |
653 | 688 | then { | |
654 | 689 | let balAfter = accountBalance(WXID) | |
655 | 690 | $Tuple2((balAfter - balBefore), WXID) | |
656 | 691 | } | |
657 | 692 | else throw("Strict value is not equal to itself.") | |
658 | 693 | } | |
659 | 694 | else throw("Strict value is not equal to itself.") | |
660 | 695 | } | |
661 | 696 | else unknownPoolType() | |
662 | 697 | ||
663 | 698 | ||
664 | 699 | func replenishByType (pType,pool,feeType,pmtA,aId,pmtB,bId,balA,balB,LPId) = { | |
665 | 700 | let lpBalanceBefore = accountBalance(fromBase58String(LPId)) | |
666 | 701 | if ((lpBalanceBefore == lpBalanceBefore)) | |
667 | 702 | then { | |
668 | 703 | let poolAddr = addressFromStringValue(pool) | |
669 | - | let $ | |
704 | + | let $t02001620432 = if (if ((pmtA > 0)) | |
670 | 705 | then (pmtB > 0) | |
671 | 706 | else false) | |
672 | 707 | then { | |
673 | - | let $ | |
674 | - | let pmtInA = $ | |
675 | - | let pmtInB = $ | |
676 | - | let change = $ | |
677 | - | let changeId = $ | |
708 | + | let $t02008220198 = calcReplenishByTwoTokens(pType, poolAddr, pmtA, aId, pmtB, bId, balA, balB) | |
709 | + | let pmtInA = $t02008220198._1 | |
710 | + | let pmtInB = $t02008220198._2 | |
711 | + | let change = $t02008220198._3 | |
712 | + | let changeId = $t02008220198._4 | |
678 | 713 | let inv = replenishTwoTokensByType(poolAddr, pType, pmtInA, aId, pmtInB, bId) | |
679 | 714 | if ((inv == inv)) | |
680 | 715 | then $Tuple2(change, changeId) | |
681 | 716 | else throw("Strict value is not equal to itself.") | |
682 | 717 | } | |
683 | 718 | else if ((pmtA > 0)) | |
684 | 719 | then $Tuple2(pmtA, aId) | |
685 | 720 | else if ((pmtB > 0)) | |
686 | 721 | then $Tuple2(pmtB, bId) | |
687 | 722 | else throw("pmts must be > 0") | |
688 | - | let change = $ | |
689 | - | let changeId = $ | |
723 | + | let change = $t02001620432._1 | |
724 | + | let changeId = $t02001620432._2 | |
690 | 725 | let inv = if ((change > 0)) | |
691 | 726 | then replenishOneTokenByType(poolAddr, pType, change, changeId) | |
692 | 727 | else nil | |
693 | 728 | if ((inv == inv)) | |
694 | 729 | then { | |
695 | 730 | let lpBalanceAfter = accountBalance(fromBase58String(LPId)) | |
696 | 731 | let totalStaked = (lpBalanceAfter - lpBalanceBefore) | |
697 | 732 | let axlyFeeAmount = fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
698 | 733 | let userShareForStake = (totalStaked - axlyFeeAmount) | |
699 | 734 | if ((0 >= userShareForStake)) | |
700 | 735 | then throw("amount of staked sharetokens must be > 0") | |
701 | 736 | else { | |
702 | 737 | let invLP = stakeLP(pool, pType, LPId, userShareForStake) | |
703 | 738 | if ((invLP == invLP)) | |
704 | 739 | then $Tuple2(userShareForStake, axlyFeeAmount) | |
705 | 740 | else throw("Strict value is not equal to itself.") | |
706 | 741 | } | |
707 | 742 | } | |
708 | 743 | else throw("Strict value is not equal to itself.") | |
709 | 744 | } | |
710 | 745 | else throw("Strict value is not equal to itself.") | |
711 | 746 | } | |
712 | 747 | ||
713 | 748 | ||
714 | 749 | func replenishEntries (pool,user,stakedAmount,axlyFeeAmount,posNum,shareId,type,withLoan) = { | |
715 | 750 | let totalAmount = getPoolTotalShare(pool) | |
716 | 751 | let totalAmountLoan = getPoolTotalShareWithLoan(pool) | |
717 | - | let $ | |
752 | + | let $t02128921527 = if (withLoan) | |
718 | 753 | then $Tuple2(getIntegerValue(this, (pool + kPoolInterestLoan)), (totalAmountLoan + stakedAmount)) | |
719 | 754 | else $Tuple2(getIntegerValue(this, (pool + kPoolInterestNoLoan)), totalAmountLoan) | |
720 | - | let curPoolInterest = $ | |
721 | - | let totalStakedWithLoan = $ | |
755 | + | let curPoolInterest = $t02128921527._1 | |
756 | + | let totalStakedWithLoan = $t02128921527._2 | |
722 | 757 | [IntegerEntry((pool + kPoolTotal), (totalAmount + stakedAmount)), IntegerEntry((pool + kPoolTotalLoan), totalStakedWithLoan), IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserPosition), stakedAmount), IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserPositionInterest), curPoolInterest), StringEntry((((user + "_") + toString(posNum)) + kUserPositionPool), pool), IntegerEntry((user + kUserPositionNum), posNum), ScriptTransfer(moneyBox, axlyFeeAmount, fromBase58String(shareId))] | |
723 | 758 | } | |
724 | 759 | ||
725 | 760 | ||
726 | 761 | func exchangeKeeper (toToken,pmtAmount,pmtAsset,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = { | |
727 | 762 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
728 | 763 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
729 | 764 | then { | |
730 | 765 | let inv = invoke(exContract, "swap", [amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
731 | 766 | if ((inv == inv)) | |
732 | 767 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
733 | 768 | else throw("Strict value is not equal to itself.") | |
734 | 769 | } | |
735 | 770 | else throw("Strict value is not equal to itself.") | |
736 | 771 | } | |
737 | 772 | ||
738 | 773 | ||
739 | 774 | func exchangePuzzle (toToken,pmtAmount,pmtAsset,routesStr,minToReceive,options) = { | |
740 | 775 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
741 | 776 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
742 | 777 | then { | |
743 | 778 | let inv = invoke(exContract, "puzzleSwap", [routesStr, minToReceive, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
744 | 779 | if ((inv == inv)) | |
745 | 780 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
746 | 781 | else throw("Strict value is not equal to itself.") | |
747 | 782 | } | |
748 | 783 | else throw("Strict value is not equal to itself.") | |
749 | 784 | } | |
750 | 785 | ||
751 | 786 | ||
752 | 787 | func exchangeSwopFi (toToken,pmtAmount,pmtAsset,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = { | |
753 | 788 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
754 | 789 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
755 | 790 | then { | |
756 | 791 | let inv = invoke(exContract, "swopfiSwap", [exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
757 | 792 | if ((inv == inv)) | |
758 | 793 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
759 | 794 | else throw("Strict value is not equal to itself.") | |
760 | 795 | } | |
761 | 796 | else throw("Strict value is not equal to itself.") | |
762 | 797 | } | |
763 | 798 | ||
764 | 799 | ||
765 | 800 | func capitalize (pool,pType,tokenId,tokenAmount) = { | |
766 | 801 | let poolAddr = Address(fromBase58String(pool)) | |
767 | - | let $ | |
768 | - | let AId = $ | |
769 | - | let BId = $ | |
770 | - | let balA = $ | |
771 | - | let balB = $ | |
772 | - | let shareId = $ | |
802 | + | let $t02388123947 = getPoolData(poolAddr, pType) | |
803 | + | let AId = $t02388123947._1 | |
804 | + | let BId = $t02388123947._2 | |
805 | + | let balA = $t02388123947._3 | |
806 | + | let balB = $t02388123947._4 | |
807 | + | let shareId = $t02388123947._5 | |
773 | 808 | if (if ((tokenId != AId)) | |
774 | 809 | then (tokenId != BId) | |
775 | 810 | else false) | |
776 | 811 | then throw("Wrong asset") | |
777 | 812 | else { | |
778 | - | let $t02309223172 = if ((tokenId == AId)) | |
779 | - | then $Tuple2(tokenAmount, 0) | |
780 | - | else $Tuple2(0, tokenAmount) | |
781 | - | let pmtA = $t02309223172._1 | |
782 | - | let pmtB = $t02309223172._2 | |
783 | - | let $t02317523279 = replenishByType(pType, pool, NO_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
784 | - | let stakedAmount = $t02317523279._1 | |
785 | - | let nf = $t02317523279._2 | |
786 | - | let curPoolInterestLoan = valueOrElse(getInteger(this, (pool + kPoolInterestLoan)), 0) | |
787 | - | let curPoolInterestNoLoan = valueOrElse(getInteger(this, (pool + kPoolInterestNoLoan)), 0) | |
788 | 813 | let totalShareAmount = getPoolTotalShare(pool) | |
789 | 814 | let totalShareAmountWithLoan = getPoolTotalShareWithLoan(pool) | |
790 | 815 | let loanPercent = fraction(totalShareAmountWithLoan, SCALE8, totalShareAmount) | |
816 | + | let tokensForFeeLoan = fraction(tokenAmount, loanPercent, SCALE8) | |
817 | + | let tokensForFeeNoLoan = (tokenAmount - tokensForFeeLoan) | |
818 | + | let axlyFeeLoan = fraction(tokensForFeeLoan, getAxlyFee(pool, CAP_FEE_LOAN), FEE_SCALE6) | |
819 | + | let axlyFeeNoLoan = fraction(tokensForFeeNoLoan, getAxlyFee(pool, CAP_FEE_NO_LOAN), FEE_SCALE6) | |
820 | + | let axlyFee = (axlyFeeLoan + axlyFeeNoLoan) | |
821 | + | let $t02458724687 = if ((tokenId == AId)) | |
822 | + | then $Tuple2((tokenAmount - axlyFee), 0) | |
823 | + | else $Tuple2(0, (tokenAmount - axlyFee)) | |
824 | + | let pmtA = $t02458724687._1 | |
825 | + | let pmtB = $t02458724687._2 | |
826 | + | let $t02469024794 = replenishByType(pType, pool, NO_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
827 | + | let stakedAmount = $t02469024794._1 | |
828 | + | let nf = $t02469024794._2 | |
829 | + | let curPoolInterestLoan = valueOrElse(getInteger(this, (pool + kPoolInterestLoan)), 0) | |
830 | + | let curPoolInterestNoLoan = valueOrElse(getInteger(this, (pool + kPoolInterestNoLoan)), 0) | |
791 | 831 | let stakedLoan = fraction(stakedAmount, loanPercent, SCALE8) | |
792 | 832 | let stakedNoLoan = (stakedAmount - stakedLoan) | |
793 | 833 | let newInterestLoan = if ((totalShareAmountWithLoan > 0)) | |
794 | 834 | then (curPoolInterestLoan + fraction(stakedLoan, SCALE10, totalShareAmountWithLoan)) | |
795 | 835 | else 0 | |
796 | 836 | let newInterestNoLoan = if (((totalShareAmount - totalShareAmountWithLoan) > 0)) | |
797 | 837 | then (curPoolInterestNoLoan + fraction(stakedNoLoan, SCALE10, (totalShareAmount - totalShareAmountWithLoan))) | |
798 | 838 | else 0 | |
799 | - | let axlyFeeLoan = fraction(stakedLoan, getAxlyFee(pool, CAP_FEE_LOAN), FEE_SCALE6) | |
800 | - | let axlyFeeNoLoan = fraction(stakedNoLoan, getAxlyFee(pool, CAP_FEE_NO_LOAN), FEE_SCALE6) | |
801 | - | let axlyFee = unstakeLP(pool, pType, shareId, (axlyFeeLoan + axlyFeeNoLoan)) | |
802 | - | if ((axlyFee == axlyFee)) | |
803 | - | then ([IntegerEntry((pool + kPoolInterestLoan), newInterestLoan), IntegerEntry((pool + kPoolInterestNoLoan), newInterestNoLoan), IntegerEntry((pool + kPoolTotal), ((totalShareAmount + stakedAmount) - axlyFee)), IntegerEntry((pool + kPoolTotalLoan), ((totalShareAmountWithLoan + stakedLoan) - axlyFeeLoan)), ScriptTransfer(moneyBox, (axlyFeeLoan + axlyFeeNoLoan), fromBase58String(shareId))] ++ getCursEntries(AId, BId, shareId, nil)) | |
804 | - | else throw("Strict value is not equal to itself.") | |
839 | + | ([IntegerEntry((pool + kPoolInterestLoan), newInterestLoan), IntegerEntry((pool + kPoolInterestNoLoan), newInterestNoLoan), IntegerEntry((pool + kPoolTotal), (totalShareAmount + stakedAmount)), IntegerEntry((pool + kPoolTotalLoan), (totalShareAmountWithLoan + stakedLoan)), ScriptTransfer(moneyBox, axlyFee, fromBase58String(tokenId))] ++ getCursEntries(AId, BId, shareId, nil)) | |
805 | 840 | } | |
806 | 841 | } | |
807 | 842 | ||
808 | 843 | ||
809 | - | func withdrawAmountCalc (pool,userCanWithdraw,debt,borrowAsset,stopLossFee) = { | |
844 | + | func userCanWithdrawShareCalc (user,pool,posId,borrowed) = { | |
845 | + | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
846 | + | let userInterest = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)) | |
847 | + | let poolInterest = if (borrowed) | |
848 | + | then getIntegerValue(this, (pool + kPoolInterestLoan)) | |
849 | + | else getIntegerValue(this, (pool + kPoolInterestNoLoan)) | |
850 | + | (pAmount + fraction(pAmount, (poolInterest - userInterest), SCALE10)) | |
851 | + | } | |
852 | + | ||
853 | + | ||
854 | + | func calcStopLossFee (pool,isBorrowed,stopLoss,lpWithdraw) = { | |
855 | + | let feeType = if (isBorrowed) | |
856 | + | then STOPLOSS_LOAN | |
857 | + | else STOPLOSS_FEE_NO_LOAN | |
858 | + | if (stopLoss) | |
859 | + | then fraction(lpWithdraw, getAxlyFee(pool, feeType), FEE_SCALE6) | |
860 | + | else 0 | |
861 | + | } | |
862 | + | ||
863 | + | ||
864 | + | func withdrawToUser (user,pool,posId,stopLoss) = { | |
865 | + | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
866 | + | let isBorrowed = (valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), 0) > 0) | |
867 | + | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posId, isBorrowed) | |
868 | + | let poolTotalShare = getPoolTotalShare(pool) | |
869 | + | let poolTotalShareLoan = getPoolTotalShareWithLoan(pool) | |
870 | + | let userAddr = Address(fromBase58String(user)) | |
810 | 871 | let poolAddr = Address(fromBase58String(pool)) | |
811 | 872 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
812 | - | let $t02506925145 = getPoolData(poolAddr, pType) | |
813 | - | let assetIdA = $t02506925145._1 | |
814 | - | let assetIdB = $t02506925145._2 | |
815 | - | let balA = $t02506925145._3 | |
816 | - | let balB = $t02506925145._4 | |
817 | - | let shareId = $t02506925145._5 | |
818 | - | let cBalABefore = accountBalance(assetIdFromStr(assetIdA)) | |
873 | + | let $t02732527397 = getPoolData(poolAddr, pType) | |
874 | + | let idAStr = $t02732527397._1 | |
875 | + | let idBStr = $t02732527397._2 | |
876 | + | let balA = $t02732527397._3 | |
877 | + | let balB = $t02732527397._4 | |
878 | + | let shareId = $t02732527397._5 | |
879 | + | let $t02740027467 = $Tuple2(assetIdFromStr(idAStr), assetIdFromStr(idBStr)) | |
880 | + | let idA = $t02740027467._1 | |
881 | + | let idB = $t02740027467._2 | |
882 | + | let stopLossFee = calcStopLossFee(pool, isBorrowed, stopLoss, userCanWithdraw) | |
883 | + | let cBalABefore = accountBalance(idA) | |
819 | 884 | if ((cBalABefore == cBalABefore)) | |
820 | 885 | then { | |
821 | - | let cBalBBefore = accountBalance( | |
886 | + | let cBalBBefore = accountBalance(idB) | |
822 | 887 | if ((cBalBBefore == cBalBBefore)) | |
823 | 888 | then { | |
824 | 889 | let inv = if ((pType == SF_POOL)) | |
825 | 890 | then { | |
826 | 891 | let inv = unstakeLP(pool, pType, shareId, stopLossFee) | |
827 | 892 | if ((inv == inv)) | |
828 | 893 | then invoke(poolAddr, "callFunction", ["withdraw", [toString(userCanWithdraw)]], nil) | |
829 | 894 | else throw("Strict value is not equal to itself.") | |
830 | 895 | } | |
831 | 896 | else if ((pType == WX_POOL)) | |
832 | 897 | then { | |
833 | 898 | let inv = unstakeLP(pool, pType, shareId, (userCanWithdraw + stopLossFee)) | |
834 | 899 | if ((inv == inv)) | |
835 | 900 | then invoke(poolAddr, "get", nil, [AttachedPayment(assetIdFromStr(shareId), userCanWithdraw)]) | |
836 | 901 | else throw("Strict value is not equal to itself.") | |
837 | 902 | } | |
838 | 903 | else unknownPoolType() | |
839 | 904 | if ((inv == inv)) | |
840 | 905 | then { | |
841 | - | let cBalAAfter = accountBalance(assetIdFromStr(assetIdA)) | |
842 | - | let cBalBAfter = accountBalance(assetIdFromStr(assetIdB)) | |
843 | - | let $t02583825927 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
844 | - | let tokensAmountA = $t02583825927._1 | |
845 | - | let tokensAmountB = $t02583825927._2 | |
846 | - | let $t02593026784 = if ((debt > 0)) | |
906 | + | let cBalAAfter = accountBalance(idA) | |
907 | + | if ((cBalAAfter == cBalAAfter)) | |
847 | 908 | then { | |
848 | - | let amountToGetEx = if (if ((borrowAsset == assetIdA)) | |
849 | - | then (debt > tokensAmountA) | |
850 | - | else false) | |
851 | - | then (debt - tokensAmountA) | |
852 | - | else if (if ((borrowAsset == assetIdB)) | |
853 | - | then (debt > tokensAmountB) | |
854 | - | else false) | |
855 | - | then (debt - tokensAmountB) | |
856 | - | else 0 | |
857 | - | let exInv = if ((amountToGetEx > 0)) | |
858 | - | then exchangeDirectly(pType, pool, assetIdA, assetIdB, (balA - tokensAmountA), (balB - tokensAmountB), amountToGetEx, borrowAsset) | |
859 | - | else nil | |
860 | - | if ((exInv == exInv)) | |
909 | + | let cBalBAfter = accountBalance(idB) | |
910 | + | if ((cBalBAfter == cBalBAfter)) | |
861 | 911 | then { | |
862 | - | let cBalAAfterRepay = accountBalance(assetIdFromStr(assetIdA)) | |
863 | - | let cBalBAfterRepay = accountBalance(assetIdFromStr(assetIdB)) | |
864 | - | if ((borrowAsset == assetIdA)) | |
865 | - | then $Tuple2(((cBalAAfterRepay - cBalABefore) - debt), (cBalBAfterRepay - cBalBBefore)) | |
866 | - | else $Tuple2((cBalAAfterRepay - cBalABefore), ((cBalBAfterRepay - cBalBBefore) - debt)) | |
912 | + | let $t02816228251 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
913 | + | let tokensAmountA = $t02816228251._1 | |
914 | + | let tokensAmountB = $t02816228251._2 | |
915 | + | let $t02825429490 = if (isBorrowed) | |
916 | + | then { | |
917 | + | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)) | |
918 | + | let debt = { | |
919 | + | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((user + "_") + posId), borrowAsset], nil) | |
920 | + | if ($isInstanceOf(@, "Int")) | |
921 | + | then @ | |
922 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
923 | + | } | |
924 | + | if ((debt == debt)) | |
925 | + | then { | |
926 | + | let amountToGetEx = if (if ((borrowAsset == idAStr)) | |
927 | + | then (debt > tokensAmountA) | |
928 | + | else false) | |
929 | + | then (debt - tokensAmountA) | |
930 | + | else if (if ((borrowAsset == idBStr)) | |
931 | + | then (debt > tokensAmountB) | |
932 | + | else false) | |
933 | + | then (debt - tokensAmountB) | |
934 | + | else 0 | |
935 | + | let exInv = if ((amountToGetEx > 0)) | |
936 | + | then exchangeDirectly(pType, pool, idAStr, idBStr, (balA - tokensAmountA), (balB - tokensAmountB), amountToGetEx, borrowAsset) | |
937 | + | else nil | |
938 | + | if ((exInv == exInv)) | |
939 | + | then { | |
940 | + | let cBalAAfterRepay = accountBalance(idA) | |
941 | + | if ((cBalAAfterRepay == cBalAAfterRepay)) | |
942 | + | then { | |
943 | + | let cBalBAfterRepay = accountBalance(idB) | |
944 | + | if ((cBalBAfterRepay == cBalBAfterRepay)) | |
945 | + | then { | |
946 | + | let closeDbtInv = if ((debt > 0)) | |
947 | + | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + posId)], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
948 | + | else 0 | |
949 | + | if ((closeDbtInv == closeDbtInv)) | |
950 | + | then if ((borrowAsset == idAStr)) | |
951 | + | then $Tuple2(((cBalAAfterRepay - cBalABefore) - debt), (cBalBAfterRepay - cBalBBefore)) | |
952 | + | else $Tuple2((cBalAAfterRepay - cBalABefore), ((cBalBAfterRepay - cBalBBefore) - debt)) | |
953 | + | else throw("Strict value is not equal to itself.") | |
954 | + | } | |
955 | + | else throw("Strict value is not equal to itself.") | |
956 | + | } | |
957 | + | else throw("Strict value is not equal to itself.") | |
958 | + | } | |
959 | + | else throw("Strict value is not equal to itself.") | |
960 | + | } | |
961 | + | else throw("Strict value is not equal to itself.") | |
962 | + | } | |
963 | + | else $Tuple2(tokensAmountA, tokensAmountB) | |
964 | + | let toUserA = $t02825429490._1 | |
965 | + | let toUserB = $t02825429490._2 | |
966 | + | let poolTotalLoanEntries = if (isBorrowed) | |
967 | + | then [IntegerEntry((pool + kPoolTotalLoan), ((poolTotalShareLoan - userCanWithdraw) - stopLossFee))] | |
968 | + | else nil | |
969 | + | let entries = (([DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPosition)), DeleteEntry((((user + "_") + posId) + kUserPositionPool)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), ((poolTotalShare - userCanWithdraw) - stopLossFee)), ScriptTransfer(userAddr, toUserA, idA), ScriptTransfer(userAddr, toUserB, idB), ScriptTransfer(moneyBox, stopLossFee, fromBase58String(shareId))] ++ poolTotalLoanEntries) ++ getCursEntries(idAStr, idBStr, shareId, nil)) | |
970 | + | $Tuple2(entries, [toUserA, toUserB]) | |
867 | 971 | } | |
868 | 972 | else throw("Strict value is not equal to itself.") | |
869 | 973 | } | |
870 | - | else $Tuple2(tokensAmountA, tokensAmountB) | |
871 | - | let toUserA = $t02593026784._1 | |
872 | - | let toUserB = $t02593026784._2 | |
873 | - | $Tuple5(toUserA, assetIdA, toUserB, assetIdB, shareId) | |
974 | + | else throw("Strict value is not equal to itself.") | |
874 | 975 | } | |
875 | 976 | else throw("Strict value is not equal to itself.") | |
876 | - | } | |
877 | - | else throw("Strict value is not equal to itself.") | |
878 | - | } | |
879 | - | else throw("Strict value is not equal to itself.") | |
880 | - | } | |
881 | - | ||
882 | - | ||
883 | - | func userCanWithdrawShareCalc (user,pool,posId,borrowed) = { | |
884 | - | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
885 | - | let userInterest = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)) | |
886 | - | let poolInterest = if (borrowed) | |
887 | - | then getIntegerValue(this, (pool + kPoolInterestLoan)) | |
888 | - | else getIntegerValue(this, (pool + kPoolInterestNoLoan)) | |
889 | - | (pAmount + fraction(pAmount, (poolInterest - userInterest), SCALE10)) | |
890 | - | } | |
891 | - | ||
892 | - | ||
893 | - | func withdrawToUser (user,pool,posId,stopLoss) = { | |
894 | - | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
895 | - | let borrowAmount = valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), 0) | |
896 | - | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posId, (borrowAmount > 0)) | |
897 | - | let poolTotalShare = getPoolTotalShare(pool) | |
898 | - | let userAddr = Address(fromBase58String(user)) | |
899 | - | let borrowAsset = valueOrElse(getString(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)), "") | |
900 | - | let $t02798228216 = if ((borrowAmount > 0)) | |
901 | - | then $Tuple2({ | |
902 | - | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((user + "_") + posId), borrowAsset], nil) | |
903 | - | if ($isInstanceOf(@, "Int")) | |
904 | - | then @ | |
905 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
906 | - | }, STOPLOSS_LOAN) | |
907 | - | else $Tuple2(0, STOPLOSS_FEE_NO_LOAN) | |
908 | - | let debt = $t02798228216._1 | |
909 | - | let feeType = $t02798228216._2 | |
910 | - | let stopLossFee = if (stopLoss) | |
911 | - | then fraction(userCanWithdraw, getAxlyFee(pool, feeType), FEE_SCALE6) | |
912 | - | else 0 | |
913 | - | let $t02833328489 = withdrawAmountCalc(pool, (userCanWithdraw - stopLossFee), debt, borrowAsset, stopLossFee) | |
914 | - | if (($t02833328489 == $t02833328489)) | |
915 | - | then { | |
916 | - | let shareId = $t02833328489._5 | |
917 | - | let assetIdB = $t02833328489._4 | |
918 | - | let toUserAmountB = $t02833328489._3 | |
919 | - | let assetIdA = $t02833328489._2 | |
920 | - | let toUserAmountA = $t02833328489._1 | |
921 | - | let closeDbtInv = if ((debt > 0)) | |
922 | - | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + posId)], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
923 | - | else 0 | |
924 | - | if ((closeDbtInv == closeDbtInv)) | |
925 | - | then { | |
926 | - | let entries = ([DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPosition)), DeleteEntry((((user + "_") + posId) + kUserPositionPool)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), ((poolTotalShare - userCanWithdraw) - stopLossFee)), ScriptTransfer(userAddr, toUserAmountA, assetIdFromStr(assetIdA)), ScriptTransfer(userAddr, toUserAmountB, assetIdFromStr(assetIdB)), ScriptTransfer(moneyBox, stopLossFee, fromBase58String(shareId))] ++ getCursEntries(assetIdA, assetIdB, shareId, nil)) | |
927 | - | $Tuple2(entries, [toUserAmountA, toUserAmountB]) | |
928 | 977 | } | |
929 | 978 | else throw("Strict value is not equal to itself.") | |
930 | 979 | } | |
931 | 980 | else throw("Strict value is not equal to itself.") | |
932 | 981 | } | |
933 | 982 | ||
934 | 983 | ||
935 | 984 | func parseRequest (requestId) = { | |
936 | 985 | let request = split(valueOrErrorMessage(getString(this, (requestId + kRequestId)), ("No request with id " + requestId)), ",") | |
937 | 986 | let user = request[0] | |
938 | 987 | let pool = request[1] | |
939 | 988 | let pmtA = parseIntValue(request[2]) | |
940 | 989 | let AId = request[3] | |
941 | 990 | let pmtB = parseIntValue(request[4]) | |
942 | 991 | let BId = request[5] | |
943 | 992 | let balA = parseIntValue(request[6]) | |
944 | 993 | let balB = parseIntValue(request[7]) | |
945 | 994 | let shareId = request[8] | |
946 | 995 | let bwAsset = request[9] | |
947 | 996 | let bwAmount = parseIntValue(request[10]) | |
948 | 997 | $Tuple11(user, pool, pmtA, AId, pmtB, BId, balA, balB, shareId, bwAsset, bwAmount) | |
949 | 998 | } | |
950 | 999 | ||
951 | 1000 | ||
952 | 1001 | func calcBorrowAmount (pmtA,pmtB,aId,bId,leverage,borrowId) = if (if ((borrowId != aId)) | |
953 | 1002 | then (borrowId != bId) | |
954 | 1003 | else false) | |
955 | 1004 | then throw("Wrong borrow asset") | |
956 | 1005 | else { | |
957 | 1006 | let dPriceA = getIntegerValue(priceOracleAddr, (aId + kPriceInOracle)) | |
958 | 1007 | let dPriceB = getIntegerValue(priceOracleAddr, (bId + kPriceInOracle)) | |
959 | 1008 | let decPrA = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
960 | 1009 | let decPrB = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
961 | 1010 | let paydInDollar = (fraction(dPriceA, pmtA, decPrA) + fraction(dPriceB, pmtB, decPrB)) | |
962 | - | let $ | |
1011 | + | let $t03147231569 = if ((borrowId == aId)) | |
963 | 1012 | then $Tuple2(dPriceA, decPrA) | |
964 | 1013 | else $Tuple2(dPriceB, decPrB) | |
965 | - | let borrowPrice = $ | |
966 | - | let borrowDecPr = $ | |
1014 | + | let borrowPrice = $t03147231569._1 | |
1015 | + | let borrowDecPr = $t03147231569._2 | |
967 | 1016 | fraction(fraction(paydInDollar, (leverage - 100), 100), borrowDecPr, borrowPrice) | |
968 | 1017 | } | |
969 | 1018 | ||
970 | 1019 | ||
971 | 1020 | func parseReplenishPmts (pmts,AId,BId) = if ((size(pmts) == 2)) | |
972 | 1021 | then if ((assetIdToStr(pmts[0].assetId) != AId)) | |
973 | 1022 | then throw("Wrong payment asset A") | |
974 | 1023 | else if ((assetIdToStr(pmts[1].assetId) != BId)) | |
975 | 1024 | then throw("Wrong payment asset B") | |
976 | 1025 | else $Tuple2(pmts[0].amount, pmts[1].amount) | |
977 | 1026 | else if ((size(pmts) == 1)) | |
978 | 1027 | then if ((assetIdToStr(pmts[0].assetId) == AId)) | |
979 | 1028 | then $Tuple2(pmts[0].amount, 0) | |
980 | 1029 | else if ((assetIdToStr(pmts[0].assetId) == BId)) | |
981 | 1030 | then $Tuple2(0, pmts[0].amount) | |
982 | 1031 | else throw("Wrong payment") | |
983 | 1032 | else throw("One or two payments expected") | |
984 | 1033 | ||
985 | 1034 | ||
986 | 1035 | func calcPriceImpact (balA,balB,newBalA,newBalB) = { | |
987 | 1036 | let pri = ((SCALE8 - fraction(fraction(balB, SCALE8, balA), SCALE8, fraction(newBalB, SCALE8, newBalA))) * 100) | |
988 | 1037 | if ((0 > pri)) | |
989 | 1038 | then (pri * -1) | |
990 | 1039 | else pri | |
991 | 1040 | } | |
992 | 1041 | ||
993 | 1042 | ||
994 | - | func | |
995 | - | let $ | |
1043 | + | func claimAndCheckAmnt (pool,pType,claim,amount,change) = { | |
1044 | + | let $t03256932828 = if (claim) | |
996 | 1045 | then claimFarmed(pType, pool) | |
997 | 1046 | else { | |
998 | 1047 | let claimedAsset = if ((pType == SF_POOL)) | |
999 | 1048 | then SWOPID | |
1000 | 1049 | else if ((pType == WX_POOL)) | |
1001 | 1050 | then WXID | |
1002 | 1051 | else unknownPoolType() | |
1003 | - | $Tuple2( | |
1052 | + | $Tuple2(amount, claimedAsset) | |
1004 | 1053 | } | |
1005 | - | let claimAmount = $ | |
1006 | - | let claimAsset = $ | |
1054 | + | let claimAmount = $t03256932828._1 | |
1055 | + | let claimAsset = $t03256932828._2 | |
1007 | 1056 | let bal = accountBalance(claimAsset) | |
1008 | - | if (if (( | |
1057 | + | if (if ((amount > (claimAmount + change))) | |
1009 | 1058 | then true | |
1010 | - | else ( | |
1059 | + | else (amount > bal)) | |
1011 | 1060 | then throw("To big amount to exchange") | |
1012 | 1061 | else $Tuple2(claimAmount, claimAsset) | |
1013 | 1062 | } | |
1063 | + | ||
1064 | + | ||
1065 | + | @Callable(i) | |
1066 | + | func getPoolInfoREADONLY (pool) = { | |
1067 | + | let poolAddr = addressFromStringValue(pool) | |
1068 | + | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1069 | + | let $t03322533315 = getPoolData(Address(fromBase58String(pool)), pType) | |
1070 | + | let AId = $t03322533315._1 | |
1071 | + | let BId = $t03322533315._2 | |
1072 | + | let balA = $t03322533315._3 | |
1073 | + | let balB = $t03322533315._4 | |
1074 | + | let shareId = $t03322533315._5 | |
1075 | + | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
1076 | + | $Tuple2(nil, $Tuple6(AId, BId, shareId, balA, balB, shareSupply)) | |
1077 | + | } | |
1078 | + | ||
1014 | 1079 | ||
1015 | 1080 | ||
1016 | 1081 | @Callable(i) | |
1017 | 1082 | func getShareAssetPriceREADONLY (shareId) = { | |
1018 | 1083 | let sharePrices = getSharePrice(shareId) | |
1019 | 1084 | $Tuple2(nil, sharePrices) | |
1020 | 1085 | } | |
1021 | 1086 | ||
1022 | 1087 | ||
1023 | 1088 | ||
1024 | 1089 | @Callable(i) | |
1025 | 1090 | func getUserPositionShareAmountREADONLY (user,posNum) = { | |
1026 | 1091 | let pool = valueOrErrorMessage(getString(this, (((user + "_") + posNum) + kUserPositionPool)), "Unknown position") | |
1027 | 1092 | let borrowAmount = getIntegerValue(this, (((((pool + "_") + user) + "_") + posNum) + kUserBorrowAmount)) | |
1028 | 1093 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posNum, (borrowAmount > 0)) | |
1029 | 1094 | $Tuple2(nil, userCanWithdraw) | |
1030 | 1095 | } | |
1031 | 1096 | ||
1032 | 1097 | ||
1033 | 1098 | ||
1034 | 1099 | @Callable(i) | |
1035 | 1100 | func getUserPositionREADONLY (user,pools,posNum) = { | |
1036 | 1101 | func userPos (a,pool) = { | |
1037 | - | let $ | |
1038 | - | let wAmountsA = $ | |
1039 | - | let wAmountsB = $ | |
1040 | - | let debts = $ | |
1041 | - | let eqWAmountsA = $ | |
1042 | - | let eqWAmountsB = $ | |
1043 | - | let index = $ | |
1102 | + | let $t03418834258 = a | |
1103 | + | let wAmountsA = $t03418834258._1 | |
1104 | + | let wAmountsB = $t03418834258._2 | |
1105 | + | let debts = $t03418834258._3 | |
1106 | + | let eqWAmountsA = $t03418834258._4 | |
1107 | + | let eqWAmountsB = $t03418834258._5 | |
1108 | + | let index = $t03418834258._6 | |
1044 | 1109 | if (!(isDefined(getInteger(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserPosition))))) | |
1045 | 1110 | then $Tuple6((wAmountsA :+ 0), (wAmountsB :+ 0), (debts :+ 0), (eqWAmountsA :+ 0), (eqWAmountsB :+ 0), (index + 1)) | |
1046 | 1111 | else { | |
1047 | 1112 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1048 | - | let $ | |
1049 | - | let AId = $ | |
1050 | - | let BId = $ | |
1051 | - | let balA = $ | |
1052 | - | let balB = $ | |
1053 | - | let shareId = $ | |
1113 | + | let $t03453734627 = getPoolData(Address(fromBase58String(pool)), pType) | |
1114 | + | let AId = $t03453734627._1 | |
1115 | + | let BId = $t03453734627._2 | |
1116 | + | let balA = $t03453734627._3 | |
1117 | + | let balB = $t03453734627._4 | |
1118 | + | let shareId = $t03453734627._5 | |
1054 | 1119 | let borrowAmount = valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserBorrowAmount)), 0) | |
1055 | 1120 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posNum[index], (borrowAmount > 0)) | |
1056 | - | let $ | |
1057 | - | let wAmountA = $ | |
1058 | - | let wAmountB = $ | |
1121 | + | let $t03484334963 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userCanWithdraw) | |
1122 | + | let wAmountA = $t03484334963._1 | |
1123 | + | let wAmountB = $t03484334963._2 | |
1059 | 1124 | if ((borrowAmount > 0)) | |
1060 | 1125 | then { | |
1061 | 1126 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserBorrowAssetId)) | |
1062 | 1127 | let debt = { | |
1063 | 1128 | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((user + "_") + posNum[index]), borrowAsset], nil) | |
1064 | 1129 | if ($isInstanceOf(@, "Int")) | |
1065 | 1130 | then @ | |
1066 | 1131 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1067 | 1132 | } | |
1068 | 1133 | if ((debt == debt)) | |
1069 | 1134 | then { | |
1070 | - | let $t03399734281 = if ((pType == SF_POOL)) | |
1071 | - | then calcAmountToPaySF(pool, AId, BId, balA, balB, debt, borrowAsset) | |
1072 | - | else if ((pType == WX_POOL)) | |
1073 | - | then calcAmountToPayWX(pool, AId, BId, balA, balB, debt, borrowAsset) | |
1074 | - | else unknownPoolType() | |
1075 | - | let assetToPay = $t03399734281._1 | |
1076 | - | let amountToPay = $t03399734281._2 | |
1077 | - | let $t03428834434 = if ((assetToPay == BId)) | |
1078 | - | then $Tuple2((wAmountA - debt), (wAmountB - amountToPay)) | |
1079 | - | else $Tuple2((wAmountA - amountToPay), (wAmountB - debt)) | |
1080 | - | let eqWAmountA = $t03428834434._1 | |
1081 | - | let eqWAmountB = $t03428834434._2 | |
1135 | + | let amountToGetEx = if (if ((borrowAsset == AId)) | |
1136 | + | then (debt > wAmountA) | |
1137 | + | else false) | |
1138 | + | then (debt - wAmountA) | |
1139 | + | else if (if ((borrowAsset == BId)) | |
1140 | + | then (debt > wAmountB) | |
1141 | + | else false) | |
1142 | + | then (debt - wAmountB) | |
1143 | + | else 0 | |
1144 | + | let amountToPay = if ((amountToGetEx > 0)) | |
1145 | + | then if ((pType == SF_POOL)) | |
1146 | + | then { | |
1147 | + | let ex = calcAmountToPaySF(pool, AId, BId, balA, balB, amountToGetEx, borrowAsset) | |
1148 | + | ex._2 | |
1149 | + | } | |
1150 | + | else if ((pType == WX_POOL)) | |
1151 | + | then { | |
1152 | + | let ex = calcAmountToPayWX(pool, AId, BId, balA, balB, amountToGetEx, borrowAsset) | |
1153 | + | ex._2 | |
1154 | + | } | |
1155 | + | else unknownPoolType() | |
1156 | + | else 0 | |
1157 | + | let $t03587536094 = if ((borrowAsset == AId)) | |
1158 | + | then $Tuple2(((wAmountA + amountToGetEx) - debt), (wAmountB - amountToPay)) | |
1159 | + | else $Tuple2((wAmountA - amountToPay), ((wAmountB + amountToGetEx) - debt)) | |
1160 | + | let eqWAmountA = $t03587536094._1 | |
1161 | + | let eqWAmountB = $t03587536094._2 | |
1082 | 1162 | $Tuple6((wAmountsA :+ wAmountA), (wAmountsB :+ wAmountB), (debts :+ debt), (eqWAmountsA :+ eqWAmountA), (eqWAmountsB :+ eqWAmountB), (index + 1)) | |
1083 | 1163 | } | |
1084 | 1164 | else throw("Strict value is not equal to itself.") | |
1085 | 1165 | } | |
1086 | 1166 | else $Tuple6((wAmountsA :+ wAmountA), (wAmountsB :+ wAmountB), debts, (wAmountsA :+ wAmountA), (wAmountsB :+ wAmountB), (index + 1)) | |
1087 | 1167 | } | |
1088 | 1168 | } | |
1089 | 1169 | ||
1090 | - | let $ | |
1170 | + | let $t03634936460 = { | |
1091 | 1171 | let $l = pools | |
1092 | 1172 | let $s = size($l) | |
1093 | 1173 | let $acc0 = $Tuple6(nil, nil, nil, nil, nil, 0) | |
1094 | 1174 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1095 | 1175 | then $a | |
1096 | 1176 | else userPos($a, $l[$i]) | |
1097 | 1177 | ||
1098 | 1178 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1099 | 1179 | then $a | |
1100 | 1180 | else throw("List size exceeds 20") | |
1101 | 1181 | ||
1102 | 1182 | $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($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), 16), 17), 18), 19), 20) | |
1103 | 1183 | } | |
1104 | - | let wAmountsA = $ | |
1105 | - | let wAmountsB = $ | |
1106 | - | let debts = $ | |
1107 | - | let eqWAmountsA = $ | |
1108 | - | let eqWAmountsB = $ | |
1184 | + | let wAmountsA = $t03634936460._1 | |
1185 | + | let wAmountsB = $t03634936460._2 | |
1186 | + | let debts = $t03634936460._3 | |
1187 | + | let eqWAmountsA = $t03634936460._4 | |
1188 | + | let eqWAmountsB = $t03634936460._5 | |
1109 | 1189 | $Tuple2(nil, $Tuple5(wAmountsA, wAmountsB, debts, eqWAmountsA, eqWAmountsB)) | |
1110 | 1190 | } | |
1111 | 1191 | ||
1112 | 1192 | ||
1113 | 1193 | ||
1114 | 1194 | @Callable(i) | |
1115 | 1195 | func replenish (pool,leverage,borrowId) = valueOrElse(isActiveForUsers(), { | |
1116 | 1196 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1117 | 1197 | if (!(isPoolActive(pool, pType))) | |
1118 | 1198 | then throw("Pool not active at this moment") | |
1119 | 1199 | else if (if ((100 > leverage)) | |
1120 | 1200 | then true | |
1121 | 1201 | else (leverage > 300)) | |
1122 | 1202 | then throw("Leverage can't be <100 and >300") | |
1123 | 1203 | else if (if (!(getBooleanValue(this, (pool + kPoolCanBorrow)))) | |
1124 | 1204 | then (leverage > 100) | |
1125 | 1205 | else false) | |
1126 | 1206 | then throw("You can't borrow in this pool") | |
1127 | 1207 | else { | |
1128 | - | let $ | |
1129 | - | let AId = $ | |
1130 | - | let BId = $ | |
1131 | - | let balA = $ | |
1132 | - | let balB = $ | |
1133 | - | let shareId = $ | |
1208 | + | let $t03705837148 = getPoolData(Address(fromBase58String(pool)), pType) | |
1209 | + | let AId = $t03705837148._1 | |
1210 | + | let BId = $t03705837148._2 | |
1211 | + | let balA = $t03705837148._3 | |
1212 | + | let balB = $t03705837148._4 | |
1213 | + | let shareId = $t03705837148._5 | |
1134 | 1214 | if (if ((borrowId != AId)) | |
1135 | 1215 | then (borrowId != BId) | |
1136 | 1216 | else false) | |
1137 | 1217 | then throw("Wrong borrow asset") | |
1138 | 1218 | else { | |
1139 | - | let $ | |
1140 | - | let pmtA = $ | |
1141 | - | let pmtB = $ | |
1219 | + | let $t03722937288 = parseReplenishPmts(i.payments, AId, BId) | |
1220 | + | let pmtA = $t03722937288._1 | |
1221 | + | let pmtB = $t03722937288._2 | |
1142 | 1222 | let user = toString(i.caller) | |
1143 | 1223 | let newPosNum = getNewUserPositionNumber(user) | |
1144 | 1224 | if ((leverage > 100)) | |
1145 | 1225 | then { | |
1146 | 1226 | let borrowAmount = calcBorrowAmount(pmtA, pmtB, AId, BId, leverage, borrowId) | |
1147 | 1227 | let request = makeString([user, pool, toString(pmtA), AId, toString(pmtB), BId, toString(balA), toString(balB), shareId, borrowId, toString(borrowAmount)], ",") | |
1148 | 1228 | let newRequestId = { | |
1149 | 1229 | let @ = invoke(this, "createNewRequest", [request], nil) | |
1150 | 1230 | if ($isInstanceOf(@, "Int")) | |
1151 | 1231 | then @ | |
1152 | 1232 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1153 | 1233 | } | |
1154 | 1234 | if ((newRequestId == newRequestId)) | |
1155 | 1235 | then { | |
1156 | 1236 | let args = [((user + "_") + toString(newPosNum)), shareId, borrowId, borrowAmount, toString(this), "replenishFromLand", toString(valueOrErrorMessage(newRequestId, "Can't create new request"))] | |
1157 | 1237 | let inv = reentrantInvoke(getLendSrvAddr(), "flashPosition", args, nil) | |
1158 | 1238 | if ((inv == inv)) | |
1159 | 1239 | then { | |
1160 | 1240 | let userStaked = getIntegerValue(this, (((((pool + "_") + user) + "_") + toString(newPosNum)) + kUserPosition)) | |
1161 | - | let $ | |
1162 | - | if (($ | |
1241 | + | let $t03827738371 = getPoolBalances(Address(fromBase58String(pool)), pType, AId, BId) | |
1242 | + | if (($t03827738371 == $t03827738371)) | |
1163 | 1243 | then { | |
1164 | - | let newBalB = $ | |
1165 | - | let newBalA = $ | |
1244 | + | let newBalB = $t03827738371._2 | |
1245 | + | let newBalA = $t03827738371._1 | |
1166 | 1246 | let prImpact = calcPriceImpact(balA, balB, newBalA, newBalB) | |
1167 | - | let $ | |
1168 | - | let wAmountA = $ | |
1169 | - | let wAmountB = $ | |
1247 | + | let $t03844138556 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1248 | + | let wAmountA = $t03844138556._1 | |
1249 | + | let wAmountB = $t03844138556._2 | |
1170 | 1250 | $Tuple2(nil, [prImpact, wAmountA, wAmountB]) | |
1171 | 1251 | } | |
1172 | 1252 | else throw("Strict value is not equal to itself.") | |
1173 | 1253 | } | |
1174 | 1254 | else throw("Strict value is not equal to itself.") | |
1175 | 1255 | } | |
1176 | 1256 | else throw("Strict value is not equal to itself.") | |
1177 | 1257 | } | |
1178 | 1258 | else { | |
1179 | - | let $ | |
1180 | - | if (($ | |
1259 | + | let $t03860938724 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
1260 | + | if (($t03860938724 == $t03860938724)) | |
1181 | 1261 | then { | |
1182 | - | let axlyFee = $ | |
1183 | - | let userStaked = $ | |
1184 | - | let $ | |
1185 | - | if (($ | |
1262 | + | let axlyFee = $t03860938724._2 | |
1263 | + | let userStaked = $t03860938724._1 | |
1264 | + | let $t03873038824 = getPoolBalances(Address(fromBase58String(pool)), pType, AId, BId) | |
1265 | + | if (($t03873038824 == $t03873038824)) | |
1186 | 1266 | then { | |
1187 | - | let newBalB = $ | |
1188 | - | let newBalA = $ | |
1267 | + | let newBalB = $t03873038824._2 | |
1268 | + | let newBalA = $t03873038824._1 | |
1189 | 1269 | let prImpact = calcPriceImpact(balA, balB, newBalA, newBalB) | |
1190 | - | let $ | |
1191 | - | let wAmountA = $ | |
1192 | - | let wAmountB = $ | |
1270 | + | let $t03889439009 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1271 | + | let wAmountA = $t03889439009._1 | |
1272 | + | let wAmountB = $t03889439009._2 | |
1193 | 1273 | $Tuple2((replenishEntries(pool, user, userStaked, axlyFee, newPosNum, shareId, pType, false) ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])), [prImpact, wAmountA, wAmountB]) | |
1194 | 1274 | } | |
1195 | 1275 | else throw("Strict value is not equal to itself.") | |
1196 | 1276 | } | |
1197 | 1277 | else throw("Strict value is not equal to itself.") | |
1198 | 1278 | } | |
1199 | 1279 | } | |
1200 | 1280 | } | |
1201 | 1281 | }) | |
1202 | 1282 | ||
1203 | 1283 | ||
1204 | 1284 | ||
1205 | 1285 | @Callable(i) | |
1206 | 1286 | func withdraw (pool,posId) = valueOrElse(isActiveForUsers(), { | |
1207 | 1287 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1208 | 1288 | if (!(isPoolActive(pool, pType))) | |
1209 | 1289 | then throw("Pool not active at this moment") | |
1210 | 1290 | else withdrawToUser(toString(i.caller), pool, toString(posId), false) | |
1211 | 1291 | }) | |
1212 | 1292 | ||
1213 | 1293 | ||
1214 | 1294 | ||
1215 | 1295 | @Callable(i) | |
1216 | 1296 | func createUpdateStopLoss (posId,poolId,assetId,price) = valueOrElse(isActiveForUsers(), { | |
1217 | 1297 | let tokenOraclePrice = getIntegerValue(priceOracleAddr, (assetId + kPriceInOracle)) | |
1218 | 1298 | let pType = valueOrErrorMessage(getString(this, (kPool + poolId)), "Pool is not inited") | |
1219 | 1299 | if (!(isPoolActive(poolId, pType))) | |
1220 | 1300 | then throw("Pool not active at this moment") | |
1221 | 1301 | else if (!(isDefined(getInteger(this, (((((poolId + "_") + toString(i.caller)) + "_") + toString(posId)) + kUserPosition))))) | |
1222 | 1302 | then throw("There are no user position") | |
1223 | 1303 | else if ((0 >= price)) | |
1224 | 1304 | then throw("Price must be greater than 0") | |
1225 | 1305 | else if ((price > tokenOraclePrice)) | |
1226 | 1306 | then throw("Price must be less than current token price") | |
1227 | 1307 | else [IntegerEntry((((((((toString(i.caller) + "_") + toString(posId)) + "_") + poolId) + "_") + assetId) + kUserStopLoss), price)] | |
1228 | 1308 | }) | |
1229 | 1309 | ||
1230 | 1310 | ||
1231 | 1311 | ||
1232 | 1312 | @Callable(i) | |
1233 | 1313 | func deleteStopLoss (posId,poolId,assetId) = valueOrElse(isActiveForUsers(), { | |
1234 | 1314 | let pType = valueOrErrorMessage(getString(this, (kPool + poolId)), "Pool is not inited") | |
1235 | 1315 | if (!(isPoolActive(poolId, pType))) | |
1236 | 1316 | then throw("Pool not active at this moment") | |
1237 | 1317 | else if (!(isDefined(getInteger(this, (((((((toString(i.caller) + "_") + toString(posId)) + "_") + poolId) + "_") + assetId) + kUserStopLoss))))) | |
1238 | 1318 | then throw("No entry") | |
1239 | 1319 | else [DeleteEntry((((((((toString(i.caller) + "_") + toString(posId)) + "_") + poolId) + "_") + assetId) + kUserStopLoss))] | |
1240 | 1320 | }) | |
1241 | 1321 | ||
1242 | 1322 | ||
1243 | 1323 | ||
1244 | 1324 | @Callable(i) | |
1245 | - | func init (moneyBoxAddr,sfFarmingAddr,lendAddr,priceOracleAddr,keeperExContract,wxSwapContract,swopAssetId,wxAssetId, | |
1325 | + | func init (moneyBoxAddr,sfFarmingAddr,lendAddr,priceOracleAddr,keeperExContract,wxSwapContract,swopAssetId,wxAssetId,operatorPubKey,group1Admin1PubKey,group1Admin2PubKey,group2Admin1PubKey,group2Admin2PubKey) = valueOrElse(isSelfCall(i), if (isDefined(getString(kOperatorCallPK))) | |
1246 | 1326 | then throw("Already inited") | |
1247 | 1327 | else if (!(isDefined(addressFromString(moneyBoxAddr)))) | |
1248 | 1328 | then throw("moneyBoxAddr is not correct address") | |
1249 | 1329 | else if (!(isDefined(addressFromString(sfFarmingAddr)))) | |
1250 | 1330 | then throw("sfFarmingAddr is not correct address") | |
1251 | 1331 | else if (!(isDefined(addressFromString(lendAddr)))) | |
1252 | 1332 | then throw("lendAddr is not correct address") | |
1253 | 1333 | else if (!(isDefined(addressFromString(priceOracleAddr)))) | |
1254 | 1334 | then throw("priceOracleAddr is not correct address") | |
1255 | 1335 | else if (!(isDefined(addressFromString(keeperExContract)))) | |
1256 | 1336 | then throw("keeperExContract is not correct address") | |
1257 | 1337 | else if (!(isDefined(assetInfo(fromBase58String(swopAssetId))))) | |
1258 | 1338 | then throw("swopAssetId is not correct asset id") | |
1259 | 1339 | else if (!(isDefined(assetInfo(fromBase58String(wxAssetId))))) | |
1260 | 1340 | then throw("swopAssetId is not correct asset id") | |
1261 | - | else if ((size(fromBase58String(adminPubKey)) != 32)) | |
1262 | - | then throw("adminPubKey is not correct") | |
1263 | - | else [StringEntry(kMoneyBox, moneyBoxAddr), StringEntry(kSFFarmingAddr, sfFarmingAddr), StringEntry(kLendService, lendAddr), StringEntry(kPriceOracle, priceOracleAddr), StringEntry(kExContract, keeperExContract), StringEntry(kWxSwapContract, wxSwapContract), StringEntry(kSwopId, swopAssetId), StringEntry(kWxId, wxAssetId), StringEntry(kAdminCallPK, adminPubKey)]) | |
1341 | + | else if ((size(fromBase58String(operatorPubKey)) != 32)) | |
1342 | + | then throw("operatorPubKey is not correct") | |
1343 | + | else if ((size(fromBase58String(group1Admin1PubKey)) != 32)) | |
1344 | + | then throw("group1Admin1PubKey is not correct") | |
1345 | + | else if ((size(fromBase58String(group1Admin2PubKey)) != 32)) | |
1346 | + | then throw("group1Admin2PubKey is not correct") | |
1347 | + | else if ((size(fromBase58String(group2Admin1PubKey)) != 32)) | |
1348 | + | then throw("group2Admin1PubKey is not correct") | |
1349 | + | else if ((size(fromBase58String(group2Admin2PubKey)) != 32)) | |
1350 | + | then throw("group2Admin2PubKey is not correct") | |
1351 | + | else [StringEntry(kMoneyBox, moneyBoxAddr), StringEntry(kSFFarmingAddr, sfFarmingAddr), StringEntry(kLendService, lendAddr), StringEntry(kPriceOracle, priceOracleAddr), StringEntry(kExContract, keeperExContract), StringEntry(kWxSwapContract, wxSwapContract), StringEntry(kSwopId, swopAssetId), StringEntry(kWxId, wxAssetId), StringEntry(kOperatorCallPK, operatorPubKey), StringEntry(kGroup1Admin1PK, group1Admin1PubKey), StringEntry(kGroup1Admin2PK, group1Admin2PubKey), StringEntry(kGroup2Admin1PK, group2Admin1PubKey), StringEntry(kGroup2Admin2PK, group2Admin2PubKey)]) | |
1264 | 1352 | ||
1265 | 1353 | ||
1266 | 1354 | ||
1267 | 1355 | @Callable(i) | |
1268 | 1356 | func createNewRequest (params) = valueOrElse(isSelfCall(i), { | |
1269 | 1357 | let newRequestId = (valueOrElse(getInteger(this, kRequestIter), 0) + 1) | |
1270 | 1358 | $Tuple2([StringEntry((toString(newRequestId) + kRequestId), params), IntegerEntry(kRequestIter, newRequestId)], newRequestId) | |
1271 | 1359 | }) | |
1272 | 1360 | ||
1273 | 1361 | ||
1274 | 1362 | ||
1275 | 1363 | @Callable(i) | |
1276 | 1364 | func replenishFromLand (requestId) = valueOrElse(isActive(), valueOrElse(isLandCall(i), { | |
1277 | - | let $ | |
1278 | - | let user = $ | |
1279 | - | let pool = $ | |
1280 | - | let pmtA = $ | |
1281 | - | let AId = $ | |
1282 | - | let pmtB = $ | |
1283 | - | let BId = $ | |
1284 | - | let balA = $ | |
1285 | - | let balB = $ | |
1286 | - | let shareId = $ | |
1287 | - | let bwAsset = $ | |
1288 | - | let bwAmount = $ | |
1365 | + | let $t04384843952 = parseRequest(requestId) | |
1366 | + | let user = $t04384843952._1 | |
1367 | + | let pool = $t04384843952._2 | |
1368 | + | let pmtA = $t04384843952._3 | |
1369 | + | let AId = $t04384843952._4 | |
1370 | + | let pmtB = $t04384843952._5 | |
1371 | + | let BId = $t04384843952._6 | |
1372 | + | let balA = $t04384843952._7 | |
1373 | + | let balB = $t04384843952._8 | |
1374 | + | let shareId = $t04384843952._9 | |
1375 | + | let bwAsset = $t04384843952._10 | |
1376 | + | let bwAmount = $t04384843952._11 | |
1289 | 1377 | if ((size(i.payments) != 1)) | |
1290 | 1378 | then throw("Wrong payment size") | |
1291 | 1379 | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
1292 | 1380 | then true | |
1293 | 1381 | else (i.payments[0].amount != bwAmount)) | |
1294 | 1382 | then throw("Wrong payment") | |
1295 | 1383 | else { | |
1296 | - | let $ | |
1384 | + | let $t04414244242 = if ((AId == bwAsset)) | |
1297 | 1385 | then $Tuple2((pmtA + bwAmount), pmtB) | |
1298 | 1386 | else $Tuple2(pmtA, (pmtB + bwAmount)) | |
1299 | - | let pmtAllA = $ | |
1300 | - | let pmtAllB = $ | |
1387 | + | let pmtAllA = $t04414244242._1 | |
1388 | + | let pmtAllB = $t04414244242._2 | |
1301 | 1389 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
1302 | - | let $ | |
1303 | - | let userStaked = $ | |
1304 | - | let axlyFee = $ | |
1390 | + | let $t04432444439 = replenishByType(pType, pool, LOAN_FEE, pmtAllA, AId, pmtAllB, BId, balA, balB, shareId) | |
1391 | + | let userStaked = $t04432444439._1 | |
1392 | + | let axlyFee = $t04432444439._2 | |
1305 | 1393 | let posNum = getNewUserPositionNumber(user) | |
1306 | 1394 | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
1307 | 1395 | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType, true) | |
1308 | - | let $ | |
1309 | - | let wAmountA = $ | |
1310 | - | let wAmountB = $ | |
1396 | + | let $t04479944914 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1397 | + | let wAmountA = $t04479944914._1 | |
1398 | + | let wAmountB = $t04479944914._2 | |
1311 | 1399 | $Tuple2((((entries ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])) ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
1312 | 1400 | } | |
1313 | 1401 | })) | |
1314 | 1402 | ||
1315 | 1403 | ||
1316 | 1404 | ||
1317 | 1405 | @Callable(i) | |
1318 | 1406 | func liquidate (user,posId,liquidateAmount) = valueOrElse(isActive(), valueOrElse(isLandCall(i), { | |
1319 | 1407 | let pool = valueOrErrorMessage(getString(this, (((user + "_") + posId) + kUserPositionPool)), "no position") | |
1320 | 1408 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1321 | - | let $ | |
1322 | - | let AId = $ | |
1323 | - | let BId = $ | |
1324 | - | let balA = $ | |
1325 | - | let balB = $ | |
1326 | - | let shareId = $ | |
1409 | + | let $t04543545525 = getPoolData(Address(fromBase58String(pool)), pType) | |
1410 | + | let AId = $t04543545525._1 | |
1411 | + | let BId = $t04543545525._2 | |
1412 | + | let balA = $t04543545525._3 | |
1413 | + | let balB = $t04543545525._4 | |
1414 | + | let shareId = $t04543545525._5 | |
1327 | 1415 | let amount = unstakeLP(pool, pType, shareId, liquidateAmount) | |
1328 | 1416 | let borrowAmount = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)) | |
1329 | 1417 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)) | |
1330 | 1418 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posId, (borrowAmount > 0)) | |
1331 | 1419 | if ((liquidateAmount > userCanWithdraw)) | |
1332 | 1420 | then throw("You can't liquidate more than user have") | |
1333 | 1421 | else if ((borrowAmount == 0)) | |
1334 | 1422 | then throw("You can't liquidate position without borrow") | |
1335 | 1423 | else [IntegerEntry((((((pool + "_") + user) + "_") + posId) + kUserPositionInterest), getIntegerValue(this, (pool + kPoolInterestLoan))), IntegerEntry((pool + kPoolTotalLoan), (getPoolTotalShareWithLoan(pool) - liquidateAmount)), IntegerEntry((pool + kPoolTotal), (getPoolTotalShare(pool) - liquidateAmount)), IntegerEntry((((((pool + "_") + user) + "_") + posId) + kUserPosition), (userCanWithdraw - liquidateAmount)), ScriptTransfer(i.caller, amount, fromBase58String(shareId))] | |
1336 | 1424 | })) | |
1337 | 1425 | ||
1338 | 1426 | ||
1339 | 1427 | ||
1340 | 1428 | @Callable(i) | |
1341 | - | func stopLoss (user,posId,pool,assetId) = valueOrElse(isActive(), valueOrElse( | |
1429 | + | func stopLoss (user,posId,pool,assetId) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1342 | 1430 | let tokenOraclePrice = getIntegerValue(priceOracleAddr, (assetId + kPriceInOracle)) | |
1343 | 1431 | let stopLossPrice = valueOrErrorMessage(getInteger(this, (((((((user + "_") + toString(posId)) + "_") + pool) + "_") + assetId) + kUserStopLoss)), "No entry") | |
1344 | 1432 | if ((tokenOraclePrice > stopLossPrice)) | |
1345 | 1433 | then throw("Token price greater stop loss price") | |
1346 | 1434 | else { | |
1347 | 1435 | let res = withdrawToUser(user, pool, toString(posId), true) | |
1348 | 1436 | $Tuple2((res._1 :+ DeleteEntry((((((((user + "_") + toString(posId)) + "_") + pool) + "_") + assetId) + kUserStopLoss))), res._2) | |
1349 | 1437 | } | |
1350 | 1438 | })) | |
1351 | 1439 | ||
1352 | 1440 | ||
1353 | 1441 | ||
1354 | 1442 | @Callable(i) | |
1355 | - | func capitalizeExKeeper (pool,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = valueOrElse(isActive(), valueOrElse( | |
1443 | + | func capitalizeExKeeper (pool,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1356 | 1444 | let pType = getStringValue(this, (kPool + pool)) | |
1357 | 1445 | let change = valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0) | |
1358 | - | let $ | |
1359 | - | let claimedAmount = $ | |
1360 | - | let claimedAsset = $ | |
1446 | + | let $t04767447773 = claimAndCheckAmnt(pool, pType, claim, amountToExchange, change) | |
1447 | + | let claimedAmount = $t04767447773._1 | |
1448 | + | let claimedAsset = $t04767447773._2 | |
1361 | 1449 | let exchangedAmount = exchangeKeeper(tokenToId, amountToExchange, claimedAsset, amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options) | |
1362 | 1450 | let newChange = ((claimedAmount + change) - amountToExchange) | |
1363 | 1451 | let changeEntry = if ((newChange >= 0)) | |
1364 | 1452 | then [IntegerEntry((pool + kPoolCapChange), newChange)] | |
1365 | - | else | |
1453 | + | else throw("Negative change") | |
1366 | 1454 | (capitalize(pool, pType, tokenToId, exchangedAmount) ++ changeEntry) | |
1367 | 1455 | })) | |
1368 | 1456 | ||
1369 | 1457 | ||
1370 | 1458 | ||
1371 | 1459 | @Callable(i) | |
1372 | - | func capitalizeExPuzzle (pool,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = valueOrElse(isActive(), valueOrElse( | |
1460 | + | func capitalizeExPuzzle (pool,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1373 | 1461 | let pType = getStringValue(this, (kPool + pool)) | |
1374 | 1462 | let change = valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0) | |
1375 | - | let $ | |
1376 | - | let claimedAmount = $ | |
1377 | - | let claimedAsset = $ | |
1463 | + | let $t04857348672 = claimAndCheckAmnt(pool, pType, claim, amountToExchange, change) | |
1464 | + | let claimedAmount = $t04857348672._1 | |
1465 | + | let claimedAsset = $t04857348672._2 | |
1378 | 1466 | let exchangedAmount = exchangePuzzle(tokenToId, amountToExchange, claimedAsset, routesStr, minToReceive, options) | |
1379 | 1467 | let newChange = ((claimedAmount + change) - amountToExchange) | |
1380 | 1468 | let changeEntry = if ((newChange >= 0)) | |
1381 | 1469 | then [IntegerEntry((pool + kPoolCapChange), newChange)] | |
1382 | 1470 | else nil | |
1383 | 1471 | (capitalize(pool, pType, tokenToId, exchangedAmount) ++ changeEntry) | |
1384 | 1472 | })) | |
1385 | 1473 | ||
1386 | 1474 | ||
1387 | 1475 | ||
1388 | 1476 | @Callable(i) | |
1389 | - | func capitalizeExSwopFi (pool,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = valueOrElse(isActive(), valueOrElse( | |
1477 | + | func capitalizeExSwopFi (pool,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1390 | 1478 | let pType = getStringValue(this, (kPool + pool)) | |
1391 | 1479 | let change = valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0) | |
1392 | - | let $ | |
1393 | - | let claimedAmount = $ | |
1394 | - | let claimedAsset = $ | |
1480 | + | let $t04951749616 = claimAndCheckAmnt(pool, pType, claim, amountToExchange, change) | |
1481 | + | let claimedAmount = $t04951749616._1 | |
1482 | + | let claimedAsset = $t04951749616._2 | |
1395 | 1483 | let exchangedAmount = exchangeSwopFi(tokenToId, amountToExchange, claimedAsset, exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options) | |
1396 | 1484 | let newChange = ((claimedAmount + change) - amountToExchange) | |
1397 | 1485 | let changeEntry = if ((newChange >= 0)) | |
1398 | 1486 | then [IntegerEntry((pool + kPoolCapChange), newChange)] | |
1399 | 1487 | else nil | |
1400 | 1488 | (capitalize(pool, pType, tokenToId, exchangedAmount) ++ changeEntry) | |
1401 | 1489 | })) | |
1402 | 1490 | ||
1403 | 1491 | ||
1404 | 1492 | ||
1405 | 1493 | @Callable(i) | |
1494 | + | func capitalizeNoEx (pool,claim,amountFromBalance) = valueOrElse(isActive(), valueOrElse(isOperatorCall(i), { | |
1495 | + | let pType = getStringValue(this, (kPool + pool)) | |
1496 | + | let $t05021350308 = claimAndCheckAmnt(pool, pType, claim, amountFromBalance, 0) | |
1497 | + | let claimedAmount = $t05021350308._1 | |
1498 | + | let claimedAsset = $t05021350308._2 | |
1499 | + | capitalize(pool, pType, assetIdToStr(claimedAsset), (claimedAmount + amountFromBalance)) | |
1500 | + | })) | |
1501 | + | ||
1502 | + | ||
1503 | + | ||
1504 | + | @Callable(i) | |
1406 | 1505 | func initNewPool (type,poolAddr,inFeeNoLoan,inFeeLoan,capFeeNoLoan,capFeeWithLoan,stoplossFeeNoLoan,stoplossFeeWithLoan,canBorrow) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if (if ((type != SF_POOL)) | |
1407 | 1506 | then (type != WX_POOL) | |
1408 | 1507 | else false) | |
1409 | 1508 | then throw("Wrong type") | |
1410 | 1509 | else { | |
1411 | - | let $ | |
1412 | - | let aId = $ | |
1413 | - | let bId = $ | |
1414 | - | let aBal = $ | |
1415 | - | let bBal = $ | |
1416 | - | let shareId = $ | |
1510 | + | let $t05073450828 = getPoolData(Address(fromBase58String(poolAddr)), type) | |
1511 | + | let aId = $t05073450828._1 | |
1512 | + | let bId = $t05073450828._2 | |
1513 | + | let aBal = $t05073450828._3 | |
1514 | + | let bBal = $t05073450828._4 | |
1515 | + | let shareId = $t05073450828._5 | |
1417 | 1516 | if ((0 > inFeeNoLoan)) | |
1418 | 1517 | then throw("inFeeNoLoan must be greater than 0") | |
1419 | 1518 | else if ((0 > inFeeLoan)) | |
1420 | 1519 | then throw("inFeeLoan must be greater than 0") | |
1421 | 1520 | else if ((0 > capFeeNoLoan)) | |
1422 | 1521 | then throw("capFeeNoLoan must be greater than 0") | |
1423 | 1522 | else if ((0 > capFeeWithLoan)) | |
1424 | 1523 | then throw("capFeeWithLoan must be greater than 0") | |
1425 | 1524 | else if ((0 > stoplossFeeNoLoan)) | |
1426 | 1525 | then throw("stoplossFeeNoLoan must be greater than 0") | |
1427 | 1526 | else if ((0 > stoplossFeeWithLoan)) | |
1428 | 1527 | then throw("stoplossFeeWithLoan must be greater than 0") | |
1429 | 1528 | else [IntegerEntry((poolAddr + kAxlyInFeeWithoutLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyInFeeWithLoan), inFeeLoan), IntegerEntry((poolAddr + kAxlyNoLoanCapFee), capFeeNoLoan), IntegerEntry((poolAddr + kAxlyWithLoanCapFee), capFeeWithLoan), IntegerEntry((poolAddr + kAxlyStopLossNoLoanFee), stoplossFeeNoLoan), IntegerEntry((poolAddr + kAxlyStopLossLoanFee), stoplossFeeWithLoan), IntegerEntry((poolAddr + kPoolInterestLoan), 0), IntegerEntry((poolAddr + kPoolInterestNoLoan), 0), StringEntry((kPool + poolAddr), type), StringEntry((shareId + kSharePool), poolAddr), BooleanEntry((poolAddr + kPoolCanBorrow), canBorrow)] | |
1430 | 1529 | })) | |
1530 | + | ||
1531 | + | ||
1532 | + | ||
1533 | + | @Callable(i) | |
1534 | + | func updatePoolFees (poolAddr,inFeeNoLoan,inFeeLoan,capFeeNoLoan,capFeeWithLoan,stoplossFeeNoLoan,stoplossFeeWithLoan) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if (!(isDefined(getString(this, (kPool + poolAddr))))) | |
1535 | + | then throw(("Can't find pool with addr " + poolAddr)) | |
1536 | + | else if ((0 > inFeeNoLoan)) | |
1537 | + | then throw("inFeeNoLoan must be greater than 0") | |
1538 | + | else if ((0 > inFeeLoan)) | |
1539 | + | then throw("inFeeLoan must be greater than 0") | |
1540 | + | else if ((0 > capFeeNoLoan)) | |
1541 | + | then throw("capFeeNoLoan must be greater than 0") | |
1542 | + | else if ((0 > capFeeWithLoan)) | |
1543 | + | then throw("capFeeWithLoan must be greater than 0") | |
1544 | + | else if ((0 > stoplossFeeNoLoan)) | |
1545 | + | then throw("stoplossFeeNoLoan must be greater than 0") | |
1546 | + | else if ((0 > stoplossFeeWithLoan)) | |
1547 | + | then throw("stoplossFeeWithLoan must be greater than 0") | |
1548 | + | else [IntegerEntry((poolAddr + kAxlyInFeeWithoutLoan), inFeeNoLoan), IntegerEntry((poolAddr + kAxlyInFeeWithLoan), inFeeLoan), IntegerEntry((poolAddr + kAxlyNoLoanCapFee), capFeeNoLoan), IntegerEntry((poolAddr + kAxlyWithLoanCapFee), capFeeWithLoan), IntegerEntry((poolAddr + kAxlyStopLossNoLoanFee), stoplossFeeNoLoan), IntegerEntry((poolAddr + kAxlyStopLossLoanFee), stoplossFeeWithLoan)])) | |
1431 | 1549 | ||
1432 | 1550 | ||
1433 | 1551 | ||
1434 | 1552 | @Callable(i) | |
1435 | 1553 | func activate () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, kActive), true)) | |
1436 | 1554 | then throw("dApp already active") | |
1437 | 1555 | else [BooleanEntry(kActive, true)]) | |
1438 | 1556 | ||
1439 | 1557 | ||
1440 | 1558 | ||
1441 | 1559 | @Callable(i) | |
1442 | 1560 | func shutdown () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, kActive), true))) | |
1443 | 1561 | then throw("dApp already shutdown") | |
1444 | 1562 | else [BooleanEntry(kActive, false)]) | |
1445 | 1563 | ||
1446 | 1564 | ||
1447 | 1565 | ||
1448 | 1566 | @Callable(i) | |
1449 | 1567 | func activateForUsers () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, kActiveUsers), true)) | |
1450 | 1568 | then throw("dApp already active for users") | |
1451 | 1569 | else [BooleanEntry(kActiveUsers, true)]) | |
1452 | 1570 | ||
1453 | 1571 | ||
1454 | 1572 | ||
1455 | 1573 | @Callable(i) | |
1456 | 1574 | func shutdownForUsers () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, kActiveUsers), true))) | |
1457 | 1575 | then throw("dApp already shutdown for users") | |
1458 | 1576 | else [BooleanEntry(kActiveUsers, false)]) | |
1459 | 1577 | ||
1460 | 1578 | ||
1461 | 1579 | ||
1462 | 1580 | @Callable(i) | |
1463 | 1581 | func activateSF () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, (SF_POOL + kActiveSFWX)), true)) | |
1464 | 1582 | then throw("SWOPFI already active") | |
1465 | 1583 | else [BooleanEntry((SF_POOL + kActiveSFWX), true)]) | |
1466 | 1584 | ||
1467 | 1585 | ||
1468 | 1586 | ||
1469 | 1587 | @Callable(i) | |
1470 | 1588 | func shutdownSF () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, (SF_POOL + kActiveSFWX)), true))) | |
1471 | 1589 | then throw("SWOPFI already shutdown") | |
1472 | 1590 | else [BooleanEntry((SF_POOL + kActiveSFWX), false)]) | |
1473 | 1591 | ||
1474 | 1592 | ||
1475 | 1593 | ||
1476 | 1594 | @Callable(i) | |
1477 | 1595 | func activateWX () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, (WX_POOL + kActiveSFWX)), true)) | |
1478 | 1596 | then throw("WX already active") | |
1479 | 1597 | else [BooleanEntry((WX_POOL + kActiveSFWX), true)]) | |
1480 | 1598 | ||
1481 | 1599 | ||
1482 | 1600 | ||
1483 | 1601 | @Callable(i) | |
1484 | 1602 | func shutdownWX () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, (WX_POOL + kActiveSFWX)), true))) | |
1485 | 1603 | then throw("WX already shutdown") | |
1486 | 1604 | else [BooleanEntry((WX_POOL + kActiveSFWX), false)]) | |
1487 | 1605 | ||
1488 | 1606 | ||
1489 | 1607 | ||
1490 | 1608 | @Callable(i) | |
1491 | 1609 | func activatePool (pool) = valueOrElse(isAdminCall(i), if (!(isDefined(getString(this, (kPool + pool))))) | |
1492 | 1610 | then throw("Unknown pool") | |
1493 | 1611 | else if (valueOrElse(getBoolean(this, (pool + kPoolActive)), true)) | |
1494 | 1612 | then throw("Pool already active") | |
1495 | 1613 | else [BooleanEntry((pool + kPoolActive), true)]) | |
1496 | 1614 | ||
1497 | 1615 | ||
1498 | 1616 | ||
1499 | 1617 | @Callable(i) | |
1500 | 1618 | func shutdownPool (pool) = valueOrElse(isAdminCall(i), if (!(isDefined(getString(this, (kPool + pool))))) | |
1501 | 1619 | then throw("Unknown pool") | |
1502 | 1620 | else if (!(valueOrElse(getBoolean(this, (pool + kPoolActive)), true))) | |
1503 | 1621 | then throw("Pool already shutdown") | |
1504 | 1622 | else [BooleanEntry((pool + kPoolActive), false)]) | |
1505 | 1623 | ||
1506 | 1624 | ||
1507 | - | @Verifier(tx) | |
1508 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
1509 | - |
github/deemru/w8io/169f3d6 254.03 ms ◑