tx · 4uCgi9fCunMPoQfmBHk13j8x7aQY2QPNforZqdh9Grmf 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS: -0.04200000 Waves 2023.07.06 12:10 [2653851] smart account 3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS > SELF 0.00000000 Waves
{ "type": 13, "id": "4uCgi9fCunMPoQfmBHk13j8x7aQY2QPNforZqdh9Grmf", "fee": 4200000, "feeAssetId": null, "timestamp": 1688634662762, "version": 2, "chainId": 84, "sender": "3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS", "senderPublicKey": "HP8sssVq1866F7CaPQJwgFrt6fsqhQjKwM84cL1wjD2a", "proofs": [ "3Z3AAdoY3BvNAYEHwHsqqyAu6q9if6NLryYKpX1xDDJL94tRUxL98miPd1iLppK79pgRXJypohmgDLxBcJvpad5N" ], "script": "base64:BgKPAQgCEgMKAQgSBAoCCAgSBQoDCBgYEgUKAwgBCBIECgIIARIGCgQBCAgBEgUKAwEICBILCgkICAgICAgICAgSAwoBCBIDCgEIEgUKAwgIARIGCgQIAQgIEg4KDAgICAEEERgYEQEBGBIKCggICAgBBAgBGBIOCgwICAgBBBgYGBgYARgSCwoJCAgBAQEBAQEEbgAHU0ZfUE9PTAICU0YAB1dYX1BPT0wCAldYAA9DQVBfRkVFX05PX0xPQU4CCWNhcE5vTG9hbgAMQ0FQX0ZFRV9MT0FOAgdjYXBMb2FuABRTVE9QTE9TU19GRUVfTk9fTE9BTgIOc3RvcExvc3NOb0xvYW4ADVNUT1BMT1NTX0xPQU4CDHN0b3BMb3NzTG9hbgAITE9BTl9GRUUCBGxvYW4AC05PX0xPQU5fRkVFAgZub0xvYW4ABk5PX0ZFRQIFbm9GZWUABlNDQUxFOACAwtcvAAdTQ0FMRTEwAIDIr6AlAAdTQ0FMRTE2CQC2AgEAgICE/qbe4REACkZFRV9TQ0FMRTYAwIQ9ABRrU0ZQb29sQUFzc2V0QmFsYW5jZQIPQV9hc3NldF9i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ted Prev: 2VkR1ADyCjUa3VgPDuYD6Lrz8UowiEFDFPh2p9ptL6QD Next: JBuqH64sDbEgp5ujCnL39kaS2G1hNJy1k4DCmr2MsK7z Diff:
Old | New | Differences | |
---|---|---|---|
152 | 152 | } | |
153 | 153 | ||
154 | 154 | ||
155 | - | func getSFPoolData (poolAddr) = $Tuple5(valueOrErrorMessage(getString(poolAddr, kSFPoolAAssetId), "Can't get pool A asset id"), valueOrErrorMessage(getString(poolAddr, kSFPoolBAssetId), "Can't get pool B asset id"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolAAssetBalance), "Can't get pool A asset balance"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolBAssetBalance), "Can't get pool B asset balance"), valueOrErrorMessage(getString(poolAddr, kSFPoolShareId), "Can't get share asset id")) | |
155 | + | 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")) | |
156 | + | ||
157 | + | ||
158 | + | func getWXPoolBalances (poolAddr,aId,bId) = $Tuple2({ | |
159 | + | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [aId], nil) | |
160 | + | if ($isInstanceOf(@, "Int")) | |
161 | + | then @ | |
162 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
163 | + | }, { | |
164 | + | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [bId], nil) | |
165 | + | if ($isInstanceOf(@, "Int")) | |
166 | + | then @ | |
167 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
168 | + | }) | |
169 | + | ||
170 | + | ||
171 | + | func getPoolBalances (poolAddr,type,aId,bId) = if ((type == SF_POOL)) | |
172 | + | then getSFPoolBalances(poolAddr) | |
173 | + | else if ((type == WX_POOL)) | |
174 | + | then getWXPoolBalances(poolAddr, aId, bId) | |
175 | + | else throw("Wrong pool type") | |
176 | + | ||
177 | + | ||
178 | + | func getSFPoolData (poolAddr) = { | |
179 | + | let $t059365985 = getSFPoolBalances(poolAddr) | |
180 | + | if (($t059365985 == $t059365985)) | |
181 | + | then { | |
182 | + | let balB = $t059365985._2 | |
183 | + | let balA = $t059365985._1 | |
184 | + | $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")) | |
185 | + | } | |
186 | + | else throw("Strict value is not equal to itself.") | |
187 | + | } | |
156 | 188 | ||
157 | 189 | ||
158 | 190 | func getWXPoolData (poolAddr) = { | |
182 | 214 | then @ | |
183 | 215 | else unit | |
184 | 216 | }, "Can't get pool LP asset id") | |
185 | - | let balA = { | |
186 | - | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [aId], nil) | |
187 | - | if ($isInstanceOf(@, "Int")) | |
188 | - | then @ | |
189 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
190 | - | } | |
191 | - | if ((balA == balA)) | |
217 | + | let $t066606719 = getWXPoolBalances(poolAddr, aId, bId) | |
218 | + | if (($t066606719 == $t066606719)) | |
192 | 219 | then { | |
193 | - | let balB = { | |
194 | - | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [bId], nil) | |
195 | - | if ($isInstanceOf(@, "Int")) | |
196 | - | then @ | |
197 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
198 | - | } | |
199 | - | if ((balB == balB)) | |
200 | - | then $Tuple5(aId, bId, balA, balB, shareId) | |
201 | - | else throw("Strict value is not equal to itself.") | |
220 | + | let balB = $t066606719._2 | |
221 | + | let balA = $t066606719._1 | |
222 | + | $Tuple5(aId, bId, balA, balB, shareId) | |
202 | 223 | } | |
203 | 224 | else throw("Strict value is not equal to itself.") | |
204 | 225 | } | |
305 | 326 | let pool = valueOrErrorMessage(getString(this, (shareId + kSharePool)), "Can't find pool addr by share id") | |
306 | 327 | let poolAddr = Address(fromBase58String(pool)) | |
307 | 328 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
308 | - | let $ | |
309 | - | let aId = $ | |
310 | - | let bId = $ | |
311 | - | let aBalance = $ | |
312 | - | let bBalance = $ | |
329 | + | let $t097119776 = getPoolData(poolAddr, pType) | |
330 | + | let aId = $t097119776._1 | |
331 | + | let bId = $t097119776._2 | |
332 | + | let aBalance = $t097119776._3 | |
333 | + | let bBalance = $t097119776._4 | |
313 | 334 | let dPriceA = getIntegerValue(priceOracleAddr, (aId + kPriceInOracle)) | |
314 | 335 | let dPriceB = getIntegerValue(priceOracleAddr, (bId + kPriceInOracle)) | |
315 | 336 | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
380 | 401 | else throw("Strict value is not equal to itself.") | |
381 | 402 | } | |
382 | 403 | else { | |
383 | - | let $ | |
404 | + | let $t01129611546 = $Tuple2(split({ | |
384 | 405 | let @ = invoke(poolAddr, "evaluatePutByAmountAssetREADONLY", [pmtA], nil) | |
385 | 406 | if ($isInstanceOf(@, "String")) | |
386 | 407 | then @ | |
391 | 412 | then @ | |
392 | 413 | else throw(($getType(@) + " couldn't be cast to String")) | |
393 | 414 | }, "__")) | |
394 | - | if (($ | |
415 | + | if (($t01129611546 == $t01129611546)) | |
395 | 416 | then { | |
396 | - | let evalPutInB = $ | |
397 | - | let evalPutInA = $ | |
417 | + | let evalPutInB = $t01129611546._2 | |
418 | + | let evalPutInA = $t01129611546._1 | |
398 | 419 | let lpInA = parseIntValue(evalPutInA[1]) | |
399 | 420 | let lpInB = parseIntValue(evalPutInB[1]) | |
400 | 421 | if ((lpInB > lpInA)) | |
436 | 457 | ||
437 | 458 | ||
438 | 459 | func unstakeLP (pool,pType,shareId,amount) = { | |
439 | - | let $ | |
460 | + | let $t01303113388 = if ((pType == SF_POOL)) | |
440 | 461 | then $Tuple3(getSFFarmingAddr(), "withdrawShareTokens", [pool, amount]) | |
441 | 462 | else if ((pType == WX_POOL)) | |
442 | 463 | then $Tuple3(getWXFarmingAddr(Address(fromBase58String(pool))), "unstake", [shareId, amount]) | |
443 | 464 | else throw("Wrong pool type") | |
444 | - | let farmAddr = $ | |
445 | - | let fName = $ | |
446 | - | let params = $ | |
465 | + | let farmAddr = $t01303113388._1 | |
466 | + | let fName = $t01303113388._2 | |
467 | + | let params = $t01303113388._3 | |
447 | 468 | let inv = invoke(farmAddr, fName, params, nil) | |
448 | 469 | if ((inv == inv)) | |
449 | 470 | then amount | |
456 | 477 | let feeScale6 = 1000000 | |
457 | 478 | let fee = getIntegerValue(poolAddr, kSFPoolFee) | |
458 | 479 | let amntGetNoFee = fraction(amountTokenToGet, feeScale6, (feeScale6 - fee), CEILING) | |
459 | - | let $ | |
480 | + | let $t01381014116 = if ((assetTokenToGet == assetIdA)) | |
460 | 481 | then { | |
461 | 482 | let amountToPay = fraction(amntGetNoFee, balB, (balA - amntGetNoFee), CEILING) | |
462 | 483 | $Tuple2(amountToPay, assetIdB) | |
465 | 486 | let amountToPay = fraction(amntGetNoFee, balA, (balB - amntGetNoFee), CEILING) | |
466 | 487 | $Tuple2(amountToPay, assetIdA) | |
467 | 488 | } | |
468 | - | let amountToPay = $ | |
469 | - | let assetToPay = $ | |
489 | + | let amountToPay = $t01381014116._1 | |
490 | + | let assetToPay = $t01381014116._2 | |
470 | 491 | $Tuple2(assetToPay, amountToPay) | |
471 | 492 | } | |
472 | 493 | ||
475 | 496 | let prFee = getIntegerValue(wxSwapContract, "%s__protocolFee") | |
476 | 497 | let pFee = getIntegerValue(wxSwapContract, "%s__poolFee") | |
477 | 498 | let feeScale = toBigInt(100000000) | |
478 | - | let $ | |
499 | + | let $t01445514763 = if ((assetTokenToGet == assetIdA)) | |
479 | 500 | then { | |
480 | 501 | let amountToPay = fraction(amountTokenToGet, balB, (balA - amountTokenToGet)) | |
481 | 502 | $Tuple2(amountToPay, assetIdB) | |
484 | 505 | let amountToPay = fraction(amountTokenToGet, balA, (balB - amountTokenToGet)) | |
485 | 506 | $Tuple2(amountToPay, assetIdA) | |
486 | 507 | } | |
487 | - | let amountToPay = $ | |
488 | - | let assetToPay = $ | |
508 | + | let amountToPay = $t01445514763._1 | |
509 | + | let assetToPay = $t01445514763._2 | |
489 | 510 | let amountToPayWithFee = toInt(fraction(toBigInt(amountToPay), feeScale, (feeScale - toBigInt((prFee + pFee))), CEILING)) | |
490 | 511 | $Tuple2(assetToPay, amountToPayWithFee) | |
491 | 512 | } | |
493 | 514 | ||
494 | 515 | func exchangeDirectly (type,pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = if ((type == SF_POOL)) | |
495 | 516 | then { | |
496 | - | let $ | |
497 | - | let assetToPay = $ | |
498 | - | let amountToPay = $ | |
517 | + | let $t01510815230 = calcAmountToPaySF(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
518 | + | let assetToPay = $t01510815230._1 | |
519 | + | let amountToPay = $t01510815230._2 | |
499 | 520 | invoke(addressFromStringValue(pool), "callFunction", ["exchange", [toString(amountTokenToGet)]], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
500 | 521 | } | |
501 | 522 | else { | |
502 | - | let $ | |
503 | - | let assetToPay = $ | |
504 | - | let amountToPay = $ | |
523 | + | let $t01540515527 = calcAmountToPayWX(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
524 | + | let assetToPay = $t01540515527._1 | |
525 | + | let amountToPay = $t01540515527._2 | |
505 | 526 | invoke(wxSwapContract, "swap", [amountTokenToGet, assetTokenToGet, toString(this)], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
506 | 527 | } | |
507 | 528 | ||
508 | 529 | ||
509 | - | func calcReplenishLPVirt (pType,pool,pmtA,aId,pmtB,bId,balA,balB) = { | |
510 | - | let poolAddr = addressFromStringValue(pool) | |
511 | - | if ((pType == SF_POOL)) | |
512 | - | then { | |
513 | - | let inv = { | |
514 | - | let @ = invoke(poolAddr, "callFunction", ["calcLPReplenishDiffPropREADONLY", [toString(pmtA), toString(pmtB), "0"]], nil) | |
515 | - | if ($isInstanceOf(@, "List[Any]")) | |
516 | - | then @ | |
517 | - | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
518 | - | } | |
519 | - | if ((inv == inv)) | |
520 | - | then $Tuple2({ | |
521 | - | let @ = inv[0] | |
522 | - | if ($isInstanceOf(@, "Int")) | |
523 | - | then @ | |
524 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
525 | - | }, { | |
526 | - | let @ = inv[1] | |
527 | - | if ($isInstanceOf(@, "Int")) | |
528 | - | then @ | |
529 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
530 | - | }) | |
531 | - | else throw("Strict value is not equal to itself.") | |
532 | - | } | |
533 | - | else if ((pType == WX_POOL)) | |
534 | - | then { | |
535 | - | let $t01562915970 = if (if ((pmtA > 0)) | |
536 | - | then (pmtB > 0) | |
537 | - | else false) | |
538 | - | then { | |
539 | - | let $t01571015836 = calcReplenishByTwoTokens(pType, poolAddr, pmtA, aId, pmtB, bId, balA, balB) | |
540 | - | let pmtInA = $t01571015836._1 | |
541 | - | let pmtInB = $t01571015836._2 | |
542 | - | let change = $t01571015836._3 | |
543 | - | let changeId = $t01571015836._4 | |
544 | - | let lpAmount = $t01571015836._5 | |
545 | - | $Tuple3(change, changeId, lpAmount) | |
546 | - | } | |
547 | - | else if ((pmtA > 0)) | |
548 | - | then $Tuple3(pmtA, aId, 0) | |
549 | - | else $Tuple3(pmtB, bId, 0) | |
550 | - | let change = $t01562915970._1 | |
551 | - | let changeId = $t01562915970._2 | |
552 | - | let lpTwo = $t01562915970._3 | |
553 | - | let $t01597716193 = if ((change > 0)) | |
554 | - | then { | |
555 | - | let inv = { | |
556 | - | let @ = invoke(poolAddr, "putOneTknREADONLY", [changeId, change], nil) | |
557 | - | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
558 | - | then @ | |
559 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int, Int)")) | |
560 | - | } | |
561 | - | if ((inv == inv)) | |
562 | - | then $Tuple2(inv._1, inv._3) | |
563 | - | else throw("Strict value is not equal to itself.") | |
564 | - | } | |
565 | - | else $Tuple2(0, 0) | |
566 | - | let lpOne = $t01597716193._1 | |
567 | - | let loss = $t01597716193._2 | |
568 | - | $Tuple2((lpTwo + lpOne), loss) | |
569 | - | } | |
570 | - | else throw("Wrong pool type") | |
571 | - | } | |
572 | - | ||
573 | - | ||
574 | 530 | func calcWithdrawLPFromPoolVirt (poolAddr,pType,shareId,userCanWithdraw) = { | |
575 | - | let $ | |
531 | + | let $t01578916176 = if ((pType == SF_POOL)) | |
576 | 532 | then { | |
577 | 533 | let inv = { | |
578 | 534 | let @ = invoke(poolAddr, "callFunction", ["withdrawREADONLY", [toString(userCanWithdraw)]], nil) | |
595 | 551 | then $Tuple2(parseIntValue(inv[1]), parseIntValue(inv[2])) | |
596 | 552 | else throw("Strict value is not equal to itself.") | |
597 | 553 | } | |
598 | - | let amountA = $ | |
599 | - | let amountB = $ | |
554 | + | let amountA = $t01578916176._1 | |
555 | + | let amountB = $t01578916176._2 | |
600 | 556 | $Tuple2(amountA, amountB) | |
601 | - | } | |
602 | - | ||
603 | - | ||
604 | - | func calcWithdrawLPVirt (pType,pool,lpAmount,shareId,aId,bId,balA,balB,borrowAmount,borrowAssetId) = { | |
605 | - | let poolAddr = addressFromStringValue(pool) | |
606 | - | let $t01700817101 = calcWithdrawLPFromPoolVirt(poolAddr, pType, shareId, lpAmount) | |
607 | - | let getAmountA = $t01700817101._1 | |
608 | - | let getAmountB = $t01700817101._2 | |
609 | - | if ((borrowAmount > 0)) | |
610 | - | then { | |
611 | - | let amountToGetEx = if (if ((borrowAssetId == aId)) | |
612 | - | then (borrowAmount > getAmountA) | |
613 | - | else false) | |
614 | - | then (borrowAmount - getAmountA) | |
615 | - | else if (if ((borrowAssetId == bId)) | |
616 | - | then (borrowAmount > getAmountB) | |
617 | - | else false) | |
618 | - | then (borrowAmount - getAmountB) | |
619 | - | else 0 | |
620 | - | let $t01737917682 = if ((amountToGetEx > 0)) | |
621 | - | then if ((pType == SF_POOL)) | |
622 | - | then calcAmountToPaySF(pool, aId, bId, balA, balB, amountToGetEx, borrowAssetId) | |
623 | - | else calcAmountToPayWX(pool, aId, bId, balA, balB, amountToGetEx, borrowAssetId) | |
624 | - | else $Tuple2("", 0) | |
625 | - | let assetToPay = $t01737917682._1 | |
626 | - | let amountToPay = $t01737917682._2 | |
627 | - | if ((borrowAssetId == aId)) | |
628 | - | then $Tuple2(((getAmountA + amountToGetEx) - borrowAmount), (getAmountB - amountToPay)) | |
629 | - | else $Tuple2((getAmountA - amountToPay), ((getAmountB + amountToGetEx) - borrowAmount)) | |
630 | - | } | |
631 | - | else $Tuple2(getAmountA, getAmountB) | |
632 | 557 | } | |
633 | 558 | ||
634 | 559 | ||
670 | 595 | if ((lpBalanceBefore == lpBalanceBefore)) | |
671 | 596 | then { | |
672 | 597 | let poolAddr = addressFromStringValue(pool) | |
673 | - | let $ | |
598 | + | let $t01716217578 = if (if ((pmtA > 0)) | |
674 | 599 | then (pmtB > 0) | |
675 | 600 | else false) | |
676 | 601 | then { | |
677 | - | let $ | |
678 | - | let pmtInA = $ | |
679 | - | let pmtInB = $ | |
680 | - | let change = $ | |
681 | - | let changeId = $ | |
602 | + | let $t01722817344 = calcReplenishByTwoTokens(pType, poolAddr, pmtA, aId, pmtB, bId, balA, balB) | |
603 | + | let pmtInA = $t01722817344._1 | |
604 | + | let pmtInB = $t01722817344._2 | |
605 | + | let change = $t01722817344._3 | |
606 | + | let changeId = $t01722817344._4 | |
682 | 607 | let inv = replenishTwoTokensByType(poolAddr, pType, pmtInA, aId, pmtInB, bId) | |
683 | 608 | if ((inv == inv)) | |
684 | 609 | then $Tuple2(change, changeId) | |
689 | 614 | else if ((pmtB > 0)) | |
690 | 615 | then $Tuple2(pmtB, bId) | |
691 | 616 | else throw("pmts must be > 0") | |
692 | - | let change = $ | |
693 | - | let changeId = $ | |
617 | + | let change = $t01716217578._1 | |
618 | + | let changeId = $t01716217578._2 | |
694 | 619 | let inv = if ((change > 0)) | |
695 | 620 | then replenishOneTokenByType(poolAddr, pType, change, changeId) | |
696 | 621 | else nil | |
718 | 643 | func replenishEntries (pool,user,stakedAmount,axlyFeeAmount,posNum,shareId,type,withLoan) = { | |
719 | 644 | let totalAmount = getPoolTotalShare(pool) | |
720 | 645 | let totalAmountLoan = getPoolTotalShareWithLoan(pool) | |
721 | - | let $ | |
646 | + | let $t01843618674 = if (withLoan) | |
722 | 647 | then $Tuple2(getIntegerValue(this, (pool + kPoolInterestLoan)), (totalAmountLoan + stakedAmount)) | |
723 | 648 | else $Tuple2(getIntegerValue(this, (pool + kPoolInterestNoLoan)), totalAmountLoan) | |
724 | - | let curPoolInterest = $ | |
725 | - | let totalStakedWithLoan = $ | |
649 | + | let curPoolInterest = $t01843618674._1 | |
650 | + | let totalStakedWithLoan = $t01843618674._2 | |
726 | 651 | [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))] | |
727 | 652 | } | |
728 | 653 | ||
768 | 693 | ||
769 | 694 | func capitalize (pool,pType,tokenId,tokenAmount) = { | |
770 | 695 | let poolAddr = Address(fromBase58String(pool)) | |
771 | - | let $ | |
772 | - | let AId = $ | |
773 | - | let BId = $ | |
774 | - | let balA = $ | |
775 | - | let balB = $ | |
776 | - | let shareId = $ | |
696 | + | let $t02102521091 = getPoolData(poolAddr, pType) | |
697 | + | let AId = $t02102521091._1 | |
698 | + | let BId = $t02102521091._2 | |
699 | + | let balA = $t02102521091._3 | |
700 | + | let balB = $t02102521091._4 | |
701 | + | let shareId = $t02102521091._5 | |
777 | 702 | if (if ((tokenId != AId)) | |
778 | 703 | then (tokenId != BId) | |
779 | 704 | else false) | |
780 | 705 | then throw("Wrong asset") | |
781 | 706 | else { | |
782 | - | let $ | |
707 | + | let $t02117621256 = if ((tokenId == AId)) | |
783 | 708 | then $Tuple2(tokenAmount, 0) | |
784 | 709 | else $Tuple2(0, tokenAmount) | |
785 | - | let pmtA = $ | |
786 | - | let pmtB = $ | |
787 | - | let $ | |
788 | - | let stakedAmount = $ | |
789 | - | let nf = $ | |
710 | + | let pmtA = $t02117621256._1 | |
711 | + | let pmtB = $t02117621256._2 | |
712 | + | let $t02125921363 = replenishByType(pType, pool, NO_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
713 | + | let stakedAmount = $t02125921363._1 | |
714 | + | let nf = $t02125921363._2 | |
790 | 715 | let curPoolInterestLoan = valueOrElse(getInteger(this, (pool + kPoolInterestLoan)), 0) | |
791 | 716 | let curPoolInterestNoLoan = valueOrElse(getInteger(this, (pool + kPoolInterestNoLoan)), 0) | |
792 | 717 | let totalShareAmount = getPoolTotalShare(pool) | |
813 | 738 | func withdrawAmountCalc (pool,userCanWithdraw,debt,borrowAsset) = { | |
814 | 739 | let poolAddr = Address(fromBase58String(pool)) | |
815 | 740 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
816 | - | let $ | |
817 | - | let assetIdA = $ | |
818 | - | let assetIdB = $ | |
819 | - | let balA = $ | |
820 | - | let balB = $ | |
821 | - | let shareId = $ | |
741 | + | let $t02313523211 = getPoolData(poolAddr, pType) | |
742 | + | let assetIdA = $t02313523211._1 | |
743 | + | let assetIdB = $t02313523211._2 | |
744 | + | let balA = $t02313523211._3 | |
745 | + | let balB = $t02313523211._4 | |
746 | + | let shareId = $t02313523211._5 | |
822 | 747 | let cBalABefore = accountBalance(assetIdFromStr(assetIdA)) | |
823 | 748 | if ((cBalABefore == cBalABefore)) | |
824 | 749 | then { | |
837 | 762 | then { | |
838 | 763 | let cBalAAfter = accountBalance(assetIdFromStr(assetIdA)) | |
839 | 764 | let cBalBAfter = accountBalance(assetIdFromStr(assetIdB)) | |
840 | - | let $ | |
841 | - | let tokensAmountA = $ | |
842 | - | let tokensAmountB = $ | |
843 | - | let $ | |
765 | + | let $t02377423863 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
766 | + | let tokensAmountA = $t02377423863._1 | |
767 | + | let tokensAmountB = $t02377423863._2 | |
768 | + | let $t02386624720 = if ((debt > 0)) | |
844 | 769 | then { | |
845 | 770 | let amountToGetEx = if (if ((borrowAsset == assetIdA)) | |
846 | 771 | then (debt > tokensAmountA) | |
865 | 790 | else throw("Strict value is not equal to itself.") | |
866 | 791 | } | |
867 | 792 | else $Tuple2(tokensAmountA, tokensAmountB) | |
868 | - | let toUserA = $ | |
869 | - | let toUserB = $ | |
793 | + | let toUserA = $t02386624720._1 | |
794 | + | let toUserB = $t02386624720._2 | |
870 | 795 | $Tuple7(toUserA, assetIdA, toUserB, assetIdB, cBalAAfter, cBalBAfter, shareId) | |
871 | 796 | } | |
872 | 797 | else throw("Strict value is not equal to itself.") | |
902 | 827 | else throw(($getType(@) + " couldn't be cast to Int")) | |
903 | 828 | } | |
904 | 829 | else 0 | |
905 | - | let $ | |
906 | - | if (($ | |
830 | + | let $t02610826261 = withdrawAmountCalc(pool, userCanWithdraw, debt, borrowAsset) | |
831 | + | if (($t02610826261 == $t02610826261)) | |
907 | 832 | then { | |
908 | - | let shareId = $ | |
909 | - | let cBalBAfter = $ | |
910 | - | let cBalAAfter = $ | |
911 | - | let assetIdB = $ | |
912 | - | let toUserAmountB = $ | |
913 | - | let assetIdA = $ | |
914 | - | let toUserAmountA = $ | |
833 | + | let shareId = $t02610826261._7 | |
834 | + | let cBalBAfter = $t02610826261._6 | |
835 | + | let cBalAAfter = $t02610826261._5 | |
836 | + | let assetIdB = $t02610826261._4 | |
837 | + | let toUserAmountB = $t02610826261._3 | |
838 | + | let assetIdA = $t02610826261._2 | |
839 | + | let toUserAmountA = $t02610826261._1 | |
915 | 840 | let closeDbtInv = if ((debt > 0)) | |
916 | 841 | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + posId)], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
917 | 842 | else 0 | |
946 | 871 | let decPrA = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
947 | 872 | let decPrB = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
948 | 873 | let paydInDollar = (fraction(dPriceA, pmtA, decPrA) + fraction(dPriceB, pmtB, decPrB)) | |
949 | - | let $ | |
874 | + | let $t02790528002 = if ((borrowId == aId)) | |
950 | 875 | then $Tuple2(dPriceA, decPrA) | |
951 | 876 | else $Tuple2(dPriceB, decPrB) | |
952 | - | let borrowPrice = $ | |
953 | - | let borrowDecPr = $ | |
877 | + | let borrowPrice = $t02790528002._1 | |
878 | + | let borrowDecPr = $t02790528002._2 | |
954 | 879 | fraction(fraction(paydInDollar, (leverage - 100), 100), borrowDecPr, borrowPrice) | |
955 | 880 | } | |
956 | 881 | ||
957 | 882 | ||
958 | - | @Callable(i) | |
959 | - | func calcPriceImpactEVALONLY (pool,leverage,borrowId,pmtA,pmtB) = if (if ((100 > leverage)) | |
960 | - | then true | |
961 | - | else (leverage > 300)) | |
962 | - | then throw("Leverage can't be <100 and >300") | |
963 | - | else { | |
964 | - | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
965 | - | let $t03013730227 = getPoolData(Address(fromBase58String(pool)), pType) | |
966 | - | let AId = $t03013730227._1 | |
967 | - | let BId = $t03013730227._2 | |
968 | - | let balA = $t03013730227._3 | |
969 | - | let balB = $t03013730227._4 | |
970 | - | let shareId = $t03013730227._5 | |
971 | - | let borrowAmount = if ((leverage > 100)) | |
972 | - | then calcBorrowAmount(pmtA, pmtB, AId, BId, leverage, borrowId) | |
973 | - | else 0 | |
974 | - | let $t03036230469 = if ((borrowId == AId)) | |
975 | - | then $Tuple2((pmtA + borrowAmount), pmtB) | |
976 | - | else $Tuple2(pmtA, (pmtB + borrowAmount)) | |
977 | - | let payInA = $t03036230469._1 | |
978 | - | let payInB = $t03036230469._2 | |
979 | - | let $t03047230565 = calcReplenishLPVirt(pType, pool, payInA, AId, payInB, BId, balA, balB) | |
980 | - | let lpAmount = $t03047230565._1 | |
981 | - | let loss = $t03047230565._2 | |
982 | - | let impactMod = if ((0 > loss)) | |
983 | - | then (loss * -1) | |
984 | - | else loss | |
985 | - | $Tuple2(nil, [impactMod]) | |
986 | - | } | |
883 | + | func parseReplenishPmts (pmts,AId,BId) = if ((size(pmts) == 2)) | |
884 | + | then if ((assetIdToStr(pmts[0].assetId) != AId)) | |
885 | + | then throw("Wrong payment asset A") | |
886 | + | else if ((assetIdToStr(pmts[1].assetId) != BId)) | |
887 | + | then throw("Wrong payment asset B") | |
888 | + | else $Tuple4(pmts[0].amount, AId, pmts[1].amount, BId) | |
889 | + | else if ((size(pmts) == 1)) | |
890 | + | then if ((assetIdToStr(pmts[0].assetId) == AId)) | |
891 | + | then $Tuple4(pmts[0].amount, AId, 0, BId) | |
892 | + | else if ((assetIdToStr(pmts[0].assetId) == BId)) | |
893 | + | then $Tuple4(0, AId, pmts[0].amount, BId) | |
894 | + | else throw("Wrong payment") | |
895 | + | else throw("One or two payments expected") | |
987 | 896 | ||
988 | 897 | ||
989 | - | ||
990 | - | @Callable(i) | |
991 | - | func replenishFromLandEVALONLY (requestId) = valueOrElse(isLandCall(i), { | |
992 | - | let $t03074230846 = parseRequest(requestId) | |
993 | - | let user = $t03074230846._1 | |
994 | - | let pool = $t03074230846._2 | |
995 | - | let pmtA = $t03074230846._3 | |
996 | - | let AId = $t03074230846._4 | |
997 | - | let pmtB = $t03074230846._5 | |
998 | - | let BId = $t03074230846._6 | |
999 | - | let balA = $t03074230846._7 | |
1000 | - | let balB = $t03074230846._8 | |
1001 | - | let shareId = $t03074230846._9 | |
1002 | - | let bwAsset = $t03074230846._10 | |
1003 | - | let bwAmount = $t03074230846._11 | |
1004 | - | if ((size(i.payments) != 1)) | |
1005 | - | then throw("Wrong payment size") | |
1006 | - | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
1007 | - | then true | |
1008 | - | else (i.payments[0].amount != bwAmount)) | |
1009 | - | then throw("Wrong payment") | |
1010 | - | else { | |
1011 | - | let $t03103631160 = if ((AId == bwAsset)) | |
1012 | - | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
1013 | - | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
1014 | - | let pmtAllA = $t03103631160._1 | |
1015 | - | let pmtAllB = $t03103631160._2 | |
1016 | - | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
1017 | - | let $t03124231357 = replenishByType(pType, pool, LOAN_FEE, pmtAllA, AId, pmtAllB, BId, balA, balB, shareId) | |
1018 | - | let userStaked = $t03124231357._1 | |
1019 | - | let axlyFee = $t03124231357._2 | |
1020 | - | let posNum = getNewUserPositionNumber(user) | |
1021 | - | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
1022 | - | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType, true) | |
1023 | - | nil | |
1024 | - | } | |
1025 | - | }) | |
1026 | - | ||
898 | + | func calcPriceImpact (balA,balB,newBalA,newBalB) = { | |
899 | + | let pri = ((SCALE8 - fraction(fraction(balB, SCALE8, balA), SCALE8, fraction(newBalB, SCALE8, newBalA))) * 100) | |
900 | + | if ((0 > pri)) | |
901 | + | then (pri * -1) | |
902 | + | else pri | |
903 | + | } | |
1027 | 904 | ||
1028 | 905 | ||
1029 | 906 | @Callable(i) | |
1047 | 924 | @Callable(i) | |
1048 | 925 | func getUserPositionInDollarsREADONLY (user,pools,posNum) = { | |
1049 | 926 | func userPos (a,pool) = { | |
1050 | - | let $ | |
1051 | - | let totalPos = $ | |
1052 | - | let posDebt = $ | |
1053 | - | let index = $ | |
927 | + | let $t02970129735 = a | |
928 | + | let totalPos = $t02970129735._1 | |
929 | + | let posDebt = $t02970129735._2 | |
930 | + | let index = $t02970129735._3 | |
1054 | 931 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1055 | - | let $ | |
1056 | - | let AId = $ | |
1057 | - | let BId = $ | |
1058 | - | let balA = $ | |
1059 | - | let balB = $ | |
1060 | - | let shareId = $ | |
932 | + | let $t02982729917 = getPoolData(Address(fromBase58String(pool)), pType) | |
933 | + | let AId = $t02982729917._1 | |
934 | + | let BId = $t02982729917._2 | |
935 | + | let balA = $t02982729917._3 | |
936 | + | let balB = $t02982729917._4 | |
937 | + | let shareId = $t02982729917._5 | |
1061 | 938 | let borrowAmount = valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserBorrowAmount)), 0) | |
1062 | 939 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posNum[index], (borrowAmount > 0)) | |
1063 | 940 | let sharePrices = getSharePrice(shareId) | |
1080 | 957 | } | |
1081 | 958 | } | |
1082 | 959 | ||
1083 | - | let $ | |
960 | + | let $t03093730992 = { | |
1084 | 961 | let $l = pools | |
1085 | 962 | let $s = size($l) | |
1086 | 963 | let $acc0 = $Tuple3(nil, nil, 0) | |
1094 | 971 | ||
1095 | 972 | $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) | |
1096 | 973 | } | |
1097 | - | let pos = $ | |
1098 | - | let debt = $ | |
974 | + | let pos = $t03093730992._1 | |
975 | + | let debt = $t03093730992._2 | |
1099 | 976 | $Tuple2(nil, $Tuple2(pos, debt)) | |
1100 | 977 | } | |
1101 | 978 | ||
1112 | 989 | then throw("You can't borrow in this pool") | |
1113 | 990 | else { | |
1114 | 991 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1115 | - | let $t03418634276 = getPoolData(Address(fromBase58String(pool)), pType) | |
1116 | - | let AId = $t03418634276._1 | |
1117 | - | let BId = $t03418634276._2 | |
1118 | - | let balA = $t03418634276._3 | |
1119 | - | let balB = $t03418634276._4 | |
1120 | - | let shareId = $t03418634276._5 | |
1121 | - | let $t03427934916 = if ((size(i.payments) == 2)) | |
1122 | - | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
1123 | - | then throw("Wrong payment asset A") | |
1124 | - | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
1125 | - | then throw("Wrong payment asset B") | |
1126 | - | else $Tuple4(i.payments[0].amount, AId, i.payments[1].amount, BId) | |
1127 | - | else if ((size(i.payments) == 1)) | |
1128 | - | then if ((assetIdToStr(i.payments[0].assetId) == AId)) | |
1129 | - | then $Tuple4(i.payments[0].amount, AId, 0, BId) | |
1130 | - | else if ((assetIdToStr(i.payments[0].assetId) == BId)) | |
1131 | - | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
1132 | - | else throw("Wrong payment") | |
1133 | - | else throw("One or two payments expected") | |
1134 | - | let pmtA = $t03427934916._1 | |
1135 | - | let pmtAssetA = $t03427934916._2 | |
1136 | - | let pmtB = $t03427934916._3 | |
1137 | - | let pmtAssetB = $t03427934916._4 | |
1138 | - | let newPosNum = getNewUserPositionNumber(toString(i.caller)) | |
992 | + | let $t03143231522 = getPoolData(Address(fromBase58String(pool)), pType) | |
993 | + | let AId = $t03143231522._1 | |
994 | + | let BId = $t03143231522._2 | |
995 | + | let balA = $t03143231522._3 | |
996 | + | let balB = $t03143231522._4 | |
997 | + | let shareId = $t03143231522._5 | |
998 | + | let $t03152531606 = parseReplenishPmts(i.payments, AId, BId) | |
999 | + | let pmtA = $t03152531606._1 | |
1000 | + | let pmtAssetA = $t03152531606._2 | |
1001 | + | let pmtB = $t03152531606._3 | |
1002 | + | let pmtAssetB = $t03152531606._4 | |
1003 | + | let user = toString(i.caller) | |
1004 | + | let newPosNum = getNewUserPositionNumber(user) | |
1139 | 1005 | if ((leverage > 100)) | |
1140 | 1006 | then { | |
1141 | 1007 | let borrowAmount = calcBorrowAmount(pmtA, pmtB, pmtAssetA, pmtAssetB, leverage, borrowId) | |
1142 | - | let request = makeString([ | |
1008 | + | let request = makeString([user, pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, borrowId, toString(borrowAmount)], ",") | |
1143 | 1009 | let newRequestId = { | |
1144 | 1010 | let @ = invoke(this, "createNewRequest", [request], nil) | |
1145 | 1011 | if ($isInstanceOf(@, "Int")) | |
1148 | 1014 | } | |
1149 | 1015 | if ((newRequestId == newRequestId)) | |
1150 | 1016 | then { | |
1151 | - | let args = [(( | |
1017 | + | let args = [((user + "_") + toString(newPosNum)), shareId, borrowId, borrowAmount, toString(this), "replenishFromLand", toString(valueOrErrorMessage(newRequestId, "Can't create new request"))] | |
1152 | 1018 | let inv = reentrantInvoke(getLendSrvAddr(), "flashPosition", args, nil) | |
1153 | 1019 | if ((inv == inv)) | |
1154 | - | then nil | |
1020 | + | then { | |
1021 | + | let userStaked = getIntegerValue(this, (((((pool + "_") + user) + "_") + toString(newPosNum)) + kUserPosition)) | |
1022 | + | let $t03261932713 = getPoolBalances(Address(fromBase58String(pool)), pType, AId, BId) | |
1023 | + | if (($t03261932713 == $t03261932713)) | |
1024 | + | then { | |
1025 | + | let newBalB = $t03261932713._2 | |
1026 | + | let newBalA = $t03261932713._1 | |
1027 | + | let prImpact = calcPriceImpact(balA, balB, newBalA, newBalB) | |
1028 | + | let $t03278332898 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1029 | + | let wAmountA = $t03278332898._1 | |
1030 | + | let wAmountB = $t03278332898._2 | |
1031 | + | $Tuple2(nil, [prImpact, wAmountA, wAmountB]) | |
1032 | + | } | |
1033 | + | else throw("Strict value is not equal to itself.") | |
1034 | + | } | |
1155 | 1035 | else throw("Strict value is not equal to itself.") | |
1156 | 1036 | } | |
1157 | 1037 | else throw("Strict value is not equal to itself.") | |
1158 | 1038 | } | |
1159 | 1039 | else { | |
1160 | - | let $t03584435956 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
1161 | - | let userStaked = $t03584435956._1 | |
1162 | - | let axlyFee = $t03584435956._2 | |
1163 | - | let $t03596236077 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1164 | - | let wAmountA = $t03596236077._1 | |
1165 | - | let wAmountB = $t03596236077._2 | |
1166 | - | (replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, pType, false) ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])) | |
1040 | + | let $t03295133063 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
1041 | + | let userStaked = $t03295133063._1 | |
1042 | + | let axlyFee = $t03295133063._2 | |
1043 | + | let $t03306933163 = getPoolBalances(Address(fromBase58String(pool)), pType, AId, BId) | |
1044 | + | if (($t03306933163 == $t03306933163)) | |
1045 | + | then { | |
1046 | + | let newBalB = $t03306933163._2 | |
1047 | + | let newBalA = $t03306933163._1 | |
1048 | + | let prImpact = calcPriceImpact(balA, balB, newBalA, newBalB) | |
1049 | + | let $t03323333348 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1050 | + | let wAmountA = $t03323333348._1 | |
1051 | + | let wAmountB = $t03323333348._2 | |
1052 | + | $Tuple2((replenishEntries(pool, user, userStaked, axlyFee, newPosNum, shareId, pType, false) ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])), [prImpact, wAmountA, wAmountB]) | |
1053 | + | } | |
1054 | + | else throw("Strict value is not equal to itself.") | |
1167 | 1055 | } | |
1168 | 1056 | } | |
1169 | 1057 | ||
1212 | 1100 | ||
1213 | 1101 | @Callable(i) | |
1214 | 1102 | func replenishFromLand (requestId) = valueOrElse(isLandCall(i), { | |
1215 | - | let $ | |
1216 | - | let user = $ | |
1217 | - | let pool = $ | |
1218 | - | let pmtA = $ | |
1219 | - | let AId = $ | |
1220 | - | let pmtB = $ | |
1221 | - | let BId = $ | |
1222 | - | let balA = $ | |
1223 | - | let balB = $ | |
1224 | - | let shareId = $ | |
1225 | - | let bwAsset = $ | |
1226 | - | let bwAmount = $ | |
1103 | + | let $t03587435978 = parseRequest(requestId) | |
1104 | + | let user = $t03587435978._1 | |
1105 | + | let pool = $t03587435978._2 | |
1106 | + | let pmtA = $t03587435978._3 | |
1107 | + | let AId = $t03587435978._4 | |
1108 | + | let pmtB = $t03587435978._5 | |
1109 | + | let BId = $t03587435978._6 | |
1110 | + | let balA = $t03587435978._7 | |
1111 | + | let balB = $t03587435978._8 | |
1112 | + | let shareId = $t03587435978._9 | |
1113 | + | let bwAsset = $t03587435978._10 | |
1114 | + | let bwAmount = $t03587435978._11 | |
1227 | 1115 | if ((size(i.payments) != 1)) | |
1228 | 1116 | then throw("Wrong payment size") | |
1229 | 1117 | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
1231 | 1119 | else (i.payments[0].amount != bwAmount)) | |
1232 | 1120 | then throw("Wrong payment") | |
1233 | 1121 | else { | |
1234 | - | let $ | |
1122 | + | let $t03616836292 = if ((AId == bwAsset)) | |
1235 | 1123 | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
1236 | 1124 | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
1237 | - | let pmtAllA = $ | |
1238 | - | let pmtAllB = $ | |
1125 | + | let pmtAllA = $t03616836292._1 | |
1126 | + | let pmtAllB = $t03616836292._2 | |
1239 | 1127 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
1240 | - | let $ | |
1241 | - | let userStaked = $ | |
1242 | - | let axlyFee = $ | |
1128 | + | let $t03637436489 = replenishByType(pType, pool, LOAN_FEE, pmtAllA, AId, pmtAllB, BId, balA, balB, shareId) | |
1129 | + | let userStaked = $t03637436489._1 | |
1130 | + | let axlyFee = $t03637436489._2 | |
1243 | 1131 | let posNum = getNewUserPositionNumber(user) | |
1244 | 1132 | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
1245 | 1133 | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType, true) | |
1246 | - | let $ | |
1247 | - | let wAmountA = $ | |
1248 | - | let wAmountB = $ | |
1134 | + | let $t03684936964 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1135 | + | let wAmountA = $t03684936964._1 | |
1136 | + | let wAmountB = $t03684936964._2 | |
1249 | 1137 | $Tuple2((((entries ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])) ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
1250 | 1138 | } | |
1251 | 1139 | }) | |
1256 | 1144 | func liquidate (user,posId,liquidateAmount) = valueOrElse(isLandCall(i), { | |
1257 | 1145 | let pool = valueOrErrorMessage(getString(this, (((user + "_") + posId) + kUserPositionPool)), "no position") | |
1258 | 1146 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1259 | - | let $ | |
1260 | - | let AId = $ | |
1261 | - | let BId = $ | |
1262 | - | let balA = $ | |
1263 | - | let balB = $ | |
1264 | - | let shareId = $ | |
1147 | + | let $t03745837548 = getPoolData(Address(fromBase58String(pool)), pType) | |
1148 | + | let AId = $t03745837548._1 | |
1149 | + | let BId = $t03745837548._2 | |
1150 | + | let balA = $t03745837548._3 | |
1151 | + | let balB = $t03745837548._4 | |
1152 | + | let shareId = $t03745837548._5 | |
1265 | 1153 | let amount = unstakeLP(pool, pType, shareId, liquidateAmount) | |
1266 | 1154 | let borrowAmount = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)) | |
1267 | 1155 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)) | |
1285 | 1173 | ||
1286 | 1174 | @Callable(i) | |
1287 | 1175 | func capitalizeExKeeper (pool,type,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = valueOrElse(isAdminCall(i), { | |
1288 | - | let $ | |
1176 | + | let $t03931139505 = if (claim) | |
1289 | 1177 | then claimFarmed(type, pool) | |
1290 | 1178 | else { | |
1291 | 1179 | let claimedAsset = if ((type == SF_POOL)) | |
1293 | 1181 | else WXID | |
1294 | 1182 | $Tuple2(amountToExchange, claimedAsset) | |
1295 | 1183 | } | |
1296 | - | let claimedAmount = $ | |
1297 | - | let claimedAsset = $ | |
1184 | + | let claimedAmount = $t03931139505._1 | |
1185 | + | let claimedAsset = $t03931139505._2 | |
1298 | 1186 | let exchangedAmount = exchangeKeeper(tokenToId, amountToExchange, claimedAsset, amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options) | |
1299 | 1187 | let change = (claimedAmount - amountToExchange) | |
1300 | 1188 | let changeEntry = if ((change > 0)) | |
1307 | 1195 | ||
1308 | 1196 | @Callable(i) | |
1309 | 1197 | func capitalizeExPuzzle (pool,type,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = valueOrElse(isAdminCall(i), { | |
1310 | - | let $ | |
1198 | + | let $t04019040384 = if (claim) | |
1311 | 1199 | then claimFarmed(type, pool) | |
1312 | 1200 | else { | |
1313 | 1201 | let claimedAsset = if ((type == SF_POOL)) | |
1315 | 1203 | else WXID | |
1316 | 1204 | $Tuple2(amountToExchange, claimedAsset) | |
1317 | 1205 | } | |
1318 | - | let claimedAmount = $ | |
1319 | - | let claimedAsset = $ | |
1206 | + | let claimedAmount = $t04019040384._1 | |
1207 | + | let claimedAsset = $t04019040384._2 | |
1320 | 1208 | let exchangedAmount = exchangePuzzle(tokenToId, amountToExchange, claimedAsset, routesStr, minToReceive, options) | |
1321 | 1209 | let change = (claimedAmount - amountToExchange) | |
1322 | 1210 | let changeEntry = if ((change > 0)) | |
1329 | 1217 | ||
1330 | 1218 | @Callable(i) | |
1331 | 1219 | func capitalizeExSwopFi (pool,type,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = valueOrElse(isAdminCall(i), { | |
1332 | - | let $ | |
1220 | + | let $t04113541329 = if (claim) | |
1333 | 1221 | then claimFarmed(type, pool) | |
1334 | 1222 | else { | |
1335 | 1223 | let claimedAsset = if ((type == SF_POOL)) | |
1337 | 1225 | else WXID | |
1338 | 1226 | $Tuple2(amountToExchange, claimedAsset) | |
1339 | 1227 | } | |
1340 | - | let claimedAmount = $ | |
1341 | - | let claimedAsset = $ | |
1228 | + | let claimedAmount = $t04113541329._1 | |
1229 | + | let claimedAsset = $t04113541329._2 | |
1342 | 1230 | let exchangedAmount = exchangeSwopFi(tokenToId, amountToExchange, claimedAsset, exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options) | |
1343 | 1231 | let change = (claimedAmount - amountToExchange) | |
1344 | 1232 | let changeEntry = if ((change > 0)) | |
1355 | 1243 | else false) | |
1356 | 1244 | then throw("Wrong type") | |
1357 | 1245 | else { | |
1358 | - | let $ | |
1359 | - | let aId = $ | |
1360 | - | let bId = $ | |
1361 | - | let aBal = $ | |
1362 | - | let bBal = $ | |
1363 | - | let shareId = $ | |
1246 | + | let $t04207042164 = getPoolData(Address(fromBase58String(poolAddr)), type) | |
1247 | + | let aId = $t04207042164._1 | |
1248 | + | let bId = $t04207042164._2 | |
1249 | + | let aBal = $t04207042164._3 | |
1250 | + | let bBal = $t04207042164._4 | |
1251 | + | let shareId = $t04207042164._5 | |
1364 | 1252 | [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)] | |
1365 | 1253 | }) | |
1366 | 1254 |
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 = "_user_position" | |
45 | 45 | ||
46 | 46 | let kUserPositionPool = "_user_position_pool" | |
47 | 47 | ||
48 | 48 | let kUserBorrowAmount = "_user_position_borrow_amount" | |
49 | 49 | ||
50 | 50 | let kUserBorrowAssetId = "_user_position_borrow_asset_id" | |
51 | 51 | ||
52 | 52 | let kUserPositionNum = "_user_position_number" | |
53 | 53 | ||
54 | 54 | let kUserPositionInterest = "_user_position_interest" | |
55 | 55 | ||
56 | 56 | let kPoolTotal = "_pool_total" | |
57 | 57 | ||
58 | 58 | let kPoolTotalLoan = "_pool_total_loan" | |
59 | 59 | ||
60 | 60 | let kPoolInterestLoan = "_pool_interest_loan" | |
61 | 61 | ||
62 | 62 | let kPoolInterestNoLoan = "_pool_interest_no_loan" | |
63 | 63 | ||
64 | 64 | let kPoolCanBorrow = "_pool_can_borrow" | |
65 | 65 | ||
66 | 66 | let kAxlyInFeeWithoutLoan = "_axly_fee_without_loan" | |
67 | 67 | ||
68 | 68 | let kAxlyInFeeWithLoan = "_axly_fee_with_loan" | |
69 | 69 | ||
70 | 70 | let kAxlyNoLoanCapFee = "_axly_fee_cap_with_loan" | |
71 | 71 | ||
72 | 72 | let kAxlyWithLoanCapFee = "_axly_fee_cap_no_loan" | |
73 | 73 | ||
74 | 74 | let kAxlyStopLossNoLoanFee = "_axly_fee_stoploss_with_loan" | |
75 | 75 | ||
76 | 76 | let kAxlyStopLossLoanFee = "_axly_fee_stoploss_no_loan" | |
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 = "_pool_share_id" | |
85 | 85 | ||
86 | 86 | let kPoolCapChange = "_pool_cap_change" | |
87 | 87 | ||
88 | 88 | let kTokenLastPrice = "last_price" | |
89 | 89 | ||
90 | 90 | let kPriceInOracle = "_twap5B" | |
91 | 91 | ||
92 | 92 | let kUserStopLoss = "_stop_loss" | |
93 | 93 | ||
94 | 94 | let kMoneyBox = "axly_money_box" | |
95 | 95 | ||
96 | 96 | let kSFFarmingAddr = "swopfi_farming_addr" | |
97 | 97 | ||
98 | 98 | let kLendService = "lend_service_addr" | |
99 | 99 | ||
100 | 100 | let kAdminCallPK = "admin_call_pub_key" | |
101 | 101 | ||
102 | 102 | let kPriceOracle = "price_oracle" | |
103 | 103 | ||
104 | 104 | let kExContract = "exchange_contract" | |
105 | 105 | ||
106 | 106 | let kWxSwapContract = "wx_swap_contract" | |
107 | 107 | ||
108 | 108 | let kSwopId = "swop_id" | |
109 | 109 | ||
110 | 110 | let kWxId = "wx_id" | |
111 | 111 | ||
112 | 112 | let moneyBox = Address(fromBase58String(valueOrErrorMessage(getString(this, kMoneyBox), "No axly moneyBox address"))) | |
113 | 113 | ||
114 | 114 | let exContract = Address(fromBase58String(valueOrErrorMessage(getString(this, kExContract), "No exchange contract address"))) | |
115 | 115 | ||
116 | 116 | let priceOracleAddr = Address(fromBase58String(valueOrErrorMessage(getString(this, kPriceOracle), "No price oracle address"))) | |
117 | 117 | ||
118 | 118 | let wxSwapContract = Address(fromBase58String(valueOrErrorMessage(getString(this, kWxSwapContract), "No wx swap address"))) | |
119 | 119 | ||
120 | 120 | let SWOPID = fromBase58String(valueOrErrorMessage(getString(this, kSwopId), "No swop id")) | |
121 | 121 | ||
122 | 122 | let WXID = fromBase58String(valueOrErrorMessage(getString(this, kWxId), "No wx id")) | |
123 | 123 | ||
124 | 124 | func getLendSrvAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kLendService), "Can't get lend service addr"))) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func getAdminCallAddr () = addressFromPublicKey(fromBase58String(valueOrErrorMessage(getString(this, kAdminCallPK), "Can't get admin addr"))) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func isAdminCall (i) = if ((i.caller == getAdminCallAddr())) | |
131 | 131 | then unit | |
132 | 132 | else throw("Only admin can call this function") | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func isSelfCall (i) = if ((i.caller == this)) | |
136 | 136 | then unit | |
137 | 137 | else throw("Only contract itself can call this function") | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func isLandCall (i) = if ((i.caller == getLendSrvAddr())) | |
141 | 141 | then unit | |
142 | 142 | else throw("Only land contract can call this function") | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | func accountBalance (assetId) = match assetId { | |
146 | 146 | case id: ByteVector => | |
147 | 147 | assetBalance(this, id) | |
148 | 148 | case waves: Unit => | |
149 | 149 | wavesBalance(this).available | |
150 | 150 | case _ => | |
151 | 151 | throw("Match error") | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 | ||
155 | - | func getSFPoolData (poolAddr) = $Tuple5(valueOrErrorMessage(getString(poolAddr, kSFPoolAAssetId), "Can't get pool A asset id"), valueOrErrorMessage(getString(poolAddr, kSFPoolBAssetId), "Can't get pool B asset id"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolAAssetBalance), "Can't get pool A asset balance"), valueOrErrorMessage(getInteger(poolAddr, kSFPoolBAssetBalance), "Can't get pool B asset balance"), valueOrErrorMessage(getString(poolAddr, kSFPoolShareId), "Can't get share asset id")) | |
155 | + | 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")) | |
156 | + | ||
157 | + | ||
158 | + | func getWXPoolBalances (poolAddr,aId,bId) = $Tuple2({ | |
159 | + | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [aId], nil) | |
160 | + | if ($isInstanceOf(@, "Int")) | |
161 | + | then @ | |
162 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
163 | + | }, { | |
164 | + | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [bId], nil) | |
165 | + | if ($isInstanceOf(@, "Int")) | |
166 | + | then @ | |
167 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
168 | + | }) | |
169 | + | ||
170 | + | ||
171 | + | func getPoolBalances (poolAddr,type,aId,bId) = if ((type == SF_POOL)) | |
172 | + | then getSFPoolBalances(poolAddr) | |
173 | + | else if ((type == WX_POOL)) | |
174 | + | then getWXPoolBalances(poolAddr, aId, bId) | |
175 | + | else throw("Wrong pool type") | |
176 | + | ||
177 | + | ||
178 | + | func getSFPoolData (poolAddr) = { | |
179 | + | let $t059365985 = getSFPoolBalances(poolAddr) | |
180 | + | if (($t059365985 == $t059365985)) | |
181 | + | then { | |
182 | + | let balB = $t059365985._2 | |
183 | + | let balA = $t059365985._1 | |
184 | + | $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")) | |
185 | + | } | |
186 | + | else throw("Strict value is not equal to itself.") | |
187 | + | } | |
156 | 188 | ||
157 | 189 | ||
158 | 190 | func getWXPoolData (poolAddr) = { | |
159 | 191 | let cfg = { | |
160 | 192 | let @ = invoke(poolAddr, "getPoolConfigWrapperREADONLY", nil, nil) | |
161 | 193 | if ($isInstanceOf(@, "List[Any]")) | |
162 | 194 | then @ | |
163 | 195 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
164 | 196 | } | |
165 | 197 | if ((cfg == cfg)) | |
166 | 198 | then { | |
167 | 199 | let aId = valueOrErrorMessage({ | |
168 | 200 | let @ = cfg[4] | |
169 | 201 | if ($isInstanceOf(@, "String")) | |
170 | 202 | then @ | |
171 | 203 | else unit | |
172 | 204 | }, "Can't get pool A asset id") | |
173 | 205 | let bId = valueOrErrorMessage({ | |
174 | 206 | let @ = cfg[5] | |
175 | 207 | if ($isInstanceOf(@, "String")) | |
176 | 208 | then @ | |
177 | 209 | else unit | |
178 | 210 | }, "Can't get pool B asset id") | |
179 | 211 | let shareId = valueOrErrorMessage({ | |
180 | 212 | let @ = cfg[3] | |
181 | 213 | if ($isInstanceOf(@, "String")) | |
182 | 214 | then @ | |
183 | 215 | else unit | |
184 | 216 | }, "Can't get pool LP asset id") | |
185 | - | let balA = { | |
186 | - | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [aId], nil) | |
187 | - | if ($isInstanceOf(@, "Int")) | |
188 | - | then @ | |
189 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
190 | - | } | |
191 | - | if ((balA == balA)) | |
217 | + | let $t066606719 = getWXPoolBalances(poolAddr, aId, bId) | |
218 | + | if (($t066606719 == $t066606719)) | |
192 | 219 | then { | |
193 | - | let balB = { | |
194 | - | let @ = invoke(poolAddr, "getAccBalanceWrapperREADONLY", [bId], nil) | |
195 | - | if ($isInstanceOf(@, "Int")) | |
196 | - | then @ | |
197 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
198 | - | } | |
199 | - | if ((balB == balB)) | |
200 | - | then $Tuple5(aId, bId, balA, balB, shareId) | |
201 | - | else throw("Strict value is not equal to itself.") | |
220 | + | let balB = $t066606719._2 | |
221 | + | let balA = $t066606719._1 | |
222 | + | $Tuple5(aId, bId, balA, balB, shareId) | |
202 | 223 | } | |
203 | 224 | else throw("Strict value is not equal to itself.") | |
204 | 225 | } | |
205 | 226 | else throw("Strict value is not equal to itself.") | |
206 | 227 | } | |
207 | 228 | ||
208 | 229 | ||
209 | 230 | func getPoolData (poolAddr,type) = if ((type == SF_POOL)) | |
210 | 231 | then getSFPoolData(poolAddr) | |
211 | 232 | else if ((type == WX_POOL)) | |
212 | 233 | then getWXPoolData(poolAddr) | |
213 | 234 | else throw("Wrong pool type") | |
214 | 235 | ||
215 | 236 | ||
216 | 237 | func getShareSupply (poolAddr,type,shareId) = if ((type == SF_POOL)) | |
217 | 238 | then valueOrErrorMessage(getInteger(poolAddr, kSFPoolShareSupply), "Can't get share asset supply") | |
218 | 239 | else if ((type == WX_POOL)) | |
219 | 240 | then valueOrErrorMessage(assetInfo(fromBase58String(shareId)), "Wrong ShareId").quantity | |
220 | 241 | else throw("Wrong pool type") | |
221 | 242 | ||
222 | 243 | ||
223 | 244 | func getPoolTotalShare (pool) = valueOrElse(getInteger(this, (pool + kPoolTotal)), 0) | |
224 | 245 | ||
225 | 246 | ||
226 | 247 | func getPoolTotalShareWithLoan (pool) = valueOrElse(getInteger(this, (pool + kPoolTotalLoan)), 0) | |
227 | 248 | ||
228 | 249 | ||
229 | 250 | func getNewUserPositionNumber (user) = (valueOrElse(getInteger(this, (user + kUserPositionNum)), 0) + 1) | |
230 | 251 | ||
231 | 252 | ||
232 | 253 | func getAxlyFee (pool,feeType) = if ((feeType == CAP_FEE_LOAN)) | |
233 | 254 | then getIntegerValue(this, (pool + kAxlyWithLoanCapFee)) | |
234 | 255 | else if ((feeType == CAP_FEE_NO_LOAN)) | |
235 | 256 | then getIntegerValue(this, (pool + kAxlyNoLoanCapFee)) | |
236 | 257 | else if ((feeType == LOAN_FEE)) | |
237 | 258 | then getIntegerValue(this, (pool + kAxlyInFeeWithLoan)) | |
238 | 259 | else if ((feeType == NO_LOAN_FEE)) | |
239 | 260 | then getIntegerValue(this, (pool + kAxlyInFeeWithoutLoan)) | |
240 | 261 | else if ((feeType == NO_FEE)) | |
241 | 262 | then 0 | |
242 | 263 | else throw("Wrong fee type") | |
243 | 264 | ||
244 | 265 | ||
245 | 266 | func getSFFarmingAddr () = Address(fromBase58String(valueOrErrorMessage(getString(this, kSFFarmingAddr), "Can't get swopfi farming addr"))) | |
246 | 267 | ||
247 | 268 | ||
248 | 269 | func getWXFarmingAddr (poolAddr) = { | |
249 | 270 | let fContract = Address(fromBase58String(valueOrErrorMessage(getString(poolAddr, "%s__factoryContract"), "Can't get WX factory contract addr"))) | |
250 | 271 | let factroyCfg = split(valueOrErrorMessage(getString(fContract, "%s__factoryConfig"), "Can't get WX factory cfg"), "__") | |
251 | 272 | Address(fromBase58String(factroyCfg[1])) | |
252 | 273 | } | |
253 | 274 | ||
254 | 275 | ||
255 | 276 | func assetIdToStr (assetId) = match assetId { | |
256 | 277 | case id: ByteVector => | |
257 | 278 | toBase58String(id) | |
258 | 279 | case waves: Unit => | |
259 | 280 | "WAVES" | |
260 | 281 | case _ => | |
261 | 282 | throw("Not Asset id") | |
262 | 283 | } | |
263 | 284 | ||
264 | 285 | ||
265 | 286 | func assetIdFromStr (assetId) = if ((assetId == "WAVES")) | |
266 | 287 | then unit | |
267 | 288 | else fromBase58String(assetId) | |
268 | 289 | ||
269 | 290 | ||
270 | 291 | func getAssetDecimals (assetId) = if ((assetId == "WAVES")) | |
271 | 292 | then 8 | |
272 | 293 | else match assetInfo(fromBase58String(assetId)) { | |
273 | 294 | case asset: Asset => | |
274 | 295 | asset.decimals | |
275 | 296 | case _ => | |
276 | 297 | throw("Can't find asset") | |
277 | 298 | } | |
278 | 299 | ||
279 | 300 | ||
280 | 301 | func getAssetPrecition (assetId) = pow(10, 0, getAssetDecimals(assetId), 0, 0, DOWN) | |
281 | 302 | ||
282 | 303 | ||
283 | 304 | func getAssetsPrice (assetIds) = { | |
284 | 305 | func getPrices (a,assetId) = { | |
285 | 306 | let assetPrice = getIntegerValue(priceOracleAddr, (assetId + kPriceInOracle)) | |
286 | 307 | (a :+ assetPrice) | |
287 | 308 | } | |
288 | 309 | ||
289 | 310 | let $l = assetIds | |
290 | 311 | let $s = size($l) | |
291 | 312 | let $acc0 = nil | |
292 | 313 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
293 | 314 | then $a | |
294 | 315 | else getPrices($a, $l[$i]) | |
295 | 316 | ||
296 | 317 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
297 | 318 | then $a | |
298 | 319 | else throw("List size exceeds 50") | |
299 | 320 | ||
300 | 321 | $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) | |
301 | 322 | } | |
302 | 323 | ||
303 | 324 | ||
304 | 325 | func getSharePrice (shareId) = { | |
305 | 326 | let pool = valueOrErrorMessage(getString(this, (shareId + kSharePool)), "Can't find pool addr by share id") | |
306 | 327 | let poolAddr = Address(fromBase58String(pool)) | |
307 | 328 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
308 | - | let $ | |
309 | - | let aId = $ | |
310 | - | let bId = $ | |
311 | - | let aBalance = $ | |
312 | - | let bBalance = $ | |
329 | + | let $t097119776 = getPoolData(poolAddr, pType) | |
330 | + | let aId = $t097119776._1 | |
331 | + | let bId = $t097119776._2 | |
332 | + | let aBalance = $t097119776._3 | |
333 | + | let bBalance = $t097119776._4 | |
313 | 334 | let dPriceA = getIntegerValue(priceOracleAddr, (aId + kPriceInOracle)) | |
314 | 335 | let dPriceB = getIntegerValue(priceOracleAddr, (bId + kPriceInOracle)) | |
315 | 336 | let shareSupply = getShareSupply(poolAddr, pType, shareId) | |
316 | 337 | let APrecision = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
317 | 338 | let BPrecision = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
318 | 339 | let sharePrecision = pow(10, 0, getAssetDecimals(shareId), 0, 0, DOWN) | |
319 | 340 | let sum = (fraction(aBalance, dPriceA, APrecision) + fraction(bBalance, dPriceB, BPrecision)) | |
320 | 341 | fraction(sum, sharePrecision, shareSupply) | |
321 | 342 | } | |
322 | 343 | ||
323 | 344 | ||
324 | 345 | func getSharePrices (shareIds) = { | |
325 | 346 | func getPrices (a,shareId) = (a :+ getSharePrice(shareId)) | |
326 | 347 | ||
327 | 348 | let $l = shareIds | |
328 | 349 | let $s = size($l) | |
329 | 350 | let $acc0 = nil | |
330 | 351 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
331 | 352 | then $a | |
332 | 353 | else getPrices($a, $l[$i]) | |
333 | 354 | ||
334 | 355 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
335 | 356 | then $a | |
336 | 357 | else throw("List size exceeds 20") | |
337 | 358 | ||
338 | 359 | $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) | |
339 | 360 | } | |
340 | 361 | ||
341 | 362 | ||
342 | 363 | func getCursEntries (aId,bId,shareId,wAmounts) = { | |
343 | 364 | let assetsPrices = getAssetsPrice([aId, bId]) | |
344 | 365 | let sharePrice = getSharePrice(shareId) | |
345 | 366 | let prices = ([toString(assetsPrices[0]), toString(assetsPrices[1]), toString(sharePrice)] ++ wAmounts) | |
346 | 367 | [StringEntry(kTokenLastPrice, makeString(prices, ","))] | |
347 | 368 | } | |
348 | 369 | ||
349 | 370 | ||
350 | 371 | func calcReplenishByTwoTokens (pType,poolAddr,pmtA,aId,pmtB,bId,balA,balB) = if ((pType == SF_POOL)) | |
351 | 372 | then { | |
352 | 373 | let repl = { | |
353 | 374 | let @ = invoke(poolAddr, "callFunction", ["calcLPReplenishTwoTokensREADONLY", [toString(pmtA), toString(pmtB)]], nil) | |
354 | 375 | if ($isInstanceOf(@, "List[Any]")) | |
355 | 376 | then @ | |
356 | 377 | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
357 | 378 | } | |
358 | 379 | if ((repl == repl)) | |
359 | 380 | then $Tuple5({ | |
360 | 381 | let @ = repl[3] | |
361 | 382 | if ($isInstanceOf(@, "Int")) | |
362 | 383 | then @ | |
363 | 384 | else throw(($getType(@) + " couldn't be cast to Int")) | |
364 | 385 | }, { | |
365 | 386 | let @ = repl[4] | |
366 | 387 | if ($isInstanceOf(@, "Int")) | |
367 | 388 | then @ | |
368 | 389 | else throw(($getType(@) + " couldn't be cast to Int")) | |
369 | 390 | }, { | |
370 | 391 | let @ = repl[1] | |
371 | 392 | if ($isInstanceOf(@, "Int")) | |
372 | 393 | then @ | |
373 | 394 | else throw(($getType(@) + " couldn't be cast to Int")) | |
374 | 395 | }, assetIdToStr(repl[2]), { | |
375 | 396 | let @ = repl[0] | |
376 | 397 | if ($isInstanceOf(@, "Int")) | |
377 | 398 | then @ | |
378 | 399 | else throw(($getType(@) + " couldn't be cast to Int")) | |
379 | 400 | }) | |
380 | 401 | else throw("Strict value is not equal to itself.") | |
381 | 402 | } | |
382 | 403 | else { | |
383 | - | let $ | |
404 | + | let $t01129611546 = $Tuple2(split({ | |
384 | 405 | let @ = invoke(poolAddr, "evaluatePutByAmountAssetREADONLY", [pmtA], nil) | |
385 | 406 | if ($isInstanceOf(@, "String")) | |
386 | 407 | then @ | |
387 | 408 | else throw(($getType(@) + " couldn't be cast to String")) | |
388 | 409 | }, "__"), split({ | |
389 | 410 | let @ = invoke(poolAddr, "evaluatePutByPriceAssetREADONLY", [pmtB], nil) | |
390 | 411 | if ($isInstanceOf(@, "String")) | |
391 | 412 | then @ | |
392 | 413 | else throw(($getType(@) + " couldn't be cast to String")) | |
393 | 414 | }, "__")) | |
394 | - | if (($ | |
415 | + | if (($t01129611546 == $t01129611546)) | |
395 | 416 | then { | |
396 | - | let evalPutInB = $ | |
397 | - | let evalPutInA = $ | |
417 | + | let evalPutInB = $t01129611546._2 | |
418 | + | let evalPutInA = $t01129611546._1 | |
398 | 419 | let lpInA = parseIntValue(evalPutInA[1]) | |
399 | 420 | let lpInB = parseIntValue(evalPutInB[1]) | |
400 | 421 | if ((lpInB > lpInA)) | |
401 | 422 | then { | |
402 | 423 | let pmt = parseIntValue(evalPutInA[8]) | |
403 | 424 | $Tuple5(pmtA, pmt, (pmtB - pmt), bId, lpInB) | |
404 | 425 | } | |
405 | 426 | else { | |
406 | 427 | let pmt = parseIntValue(evalPutInB[7]) | |
407 | 428 | $Tuple5(pmt, pmtB, (pmtA - pmt), aId, lpInA) | |
408 | 429 | } | |
409 | 430 | } | |
410 | 431 | else throw("Strict value is not equal to itself.") | |
411 | 432 | } | |
412 | 433 | ||
413 | 434 | ||
414 | 435 | func replenishTwoTokensByType (poolAddr,pType,pmtA,aId,pmtB,bId) = { | |
415 | 436 | let payments = [AttachedPayment(assetIdFromStr(aId), pmtA), AttachedPayment(assetIdFromStr(bId), pmtB)] | |
416 | 437 | if ((pType == SF_POOL)) | |
417 | 438 | then invoke(poolAddr, "callFunction", ["replenishWithTwoTokens", ["false", "0"]], payments) | |
418 | 439 | else invoke(poolAddr, "put", [1000000, false], payments) | |
419 | 440 | } | |
420 | 441 | ||
421 | 442 | ||
422 | 443 | func replenishOneTokenByType (poolAddr,pType,pmt,pmtId) = { | |
423 | 444 | let payments = [AttachedPayment(assetIdFromStr(pmtId), pmt)] | |
424 | 445 | if ((pType == SF_POOL)) | |
425 | 446 | then invoke(poolAddr, "callFunction", ["replenishWithOneToken", ["0", "false", "0"]], payments) | |
426 | 447 | else invoke(poolAddr, "putOneTkn", [0, false], payments) | |
427 | 448 | } | |
428 | 449 | ||
429 | 450 | ||
430 | 451 | func stakeLP (pool,pType,shareId,amount) = { | |
431 | 452 | let payments = [AttachedPayment(fromBase58String(shareId), amount)] | |
432 | 453 | if ((pType == SF_POOL)) | |
433 | 454 | then invoke(getSFFarmingAddr(), "lockShareTokens", [pool, 0], payments) | |
434 | 455 | else invoke(getWXFarmingAddr(addressFromStringValue(pool)), "stake", nil, payments) | |
435 | 456 | } | |
436 | 457 | ||
437 | 458 | ||
438 | 459 | func unstakeLP (pool,pType,shareId,amount) = { | |
439 | - | let $ | |
460 | + | let $t01303113388 = if ((pType == SF_POOL)) | |
440 | 461 | then $Tuple3(getSFFarmingAddr(), "withdrawShareTokens", [pool, amount]) | |
441 | 462 | else if ((pType == WX_POOL)) | |
442 | 463 | then $Tuple3(getWXFarmingAddr(Address(fromBase58String(pool))), "unstake", [shareId, amount]) | |
443 | 464 | else throw("Wrong pool type") | |
444 | - | let farmAddr = $ | |
445 | - | let fName = $ | |
446 | - | let params = $ | |
465 | + | let farmAddr = $t01303113388._1 | |
466 | + | let fName = $t01303113388._2 | |
467 | + | let params = $t01303113388._3 | |
447 | 468 | let inv = invoke(farmAddr, fName, params, nil) | |
448 | 469 | if ((inv == inv)) | |
449 | 470 | then amount | |
450 | 471 | else throw("Strict value is not equal to itself.") | |
451 | 472 | } | |
452 | 473 | ||
453 | 474 | ||
454 | 475 | func calcAmountToPaySF (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
455 | 476 | let poolAddr = Address(fromBase58String(pool)) | |
456 | 477 | let feeScale6 = 1000000 | |
457 | 478 | let fee = getIntegerValue(poolAddr, kSFPoolFee) | |
458 | 479 | let amntGetNoFee = fraction(amountTokenToGet, feeScale6, (feeScale6 - fee), CEILING) | |
459 | - | let $ | |
480 | + | let $t01381014116 = if ((assetTokenToGet == assetIdA)) | |
460 | 481 | then { | |
461 | 482 | let amountToPay = fraction(amntGetNoFee, balB, (balA - amntGetNoFee), CEILING) | |
462 | 483 | $Tuple2(amountToPay, assetIdB) | |
463 | 484 | } | |
464 | 485 | else { | |
465 | 486 | let amountToPay = fraction(amntGetNoFee, balA, (balB - amntGetNoFee), CEILING) | |
466 | 487 | $Tuple2(amountToPay, assetIdA) | |
467 | 488 | } | |
468 | - | let amountToPay = $ | |
469 | - | let assetToPay = $ | |
489 | + | let amountToPay = $t01381014116._1 | |
490 | + | let assetToPay = $t01381014116._2 | |
470 | 491 | $Tuple2(assetToPay, amountToPay) | |
471 | 492 | } | |
472 | 493 | ||
473 | 494 | ||
474 | 495 | func calcAmountToPayWX (pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = { | |
475 | 496 | let prFee = getIntegerValue(wxSwapContract, "%s__protocolFee") | |
476 | 497 | let pFee = getIntegerValue(wxSwapContract, "%s__poolFee") | |
477 | 498 | let feeScale = toBigInt(100000000) | |
478 | - | let $ | |
499 | + | let $t01445514763 = if ((assetTokenToGet == assetIdA)) | |
479 | 500 | then { | |
480 | 501 | let amountToPay = fraction(amountTokenToGet, balB, (balA - amountTokenToGet)) | |
481 | 502 | $Tuple2(amountToPay, assetIdB) | |
482 | 503 | } | |
483 | 504 | else { | |
484 | 505 | let amountToPay = fraction(amountTokenToGet, balA, (balB - amountTokenToGet)) | |
485 | 506 | $Tuple2(amountToPay, assetIdA) | |
486 | 507 | } | |
487 | - | let amountToPay = $ | |
488 | - | let assetToPay = $ | |
508 | + | let amountToPay = $t01445514763._1 | |
509 | + | let assetToPay = $t01445514763._2 | |
489 | 510 | let amountToPayWithFee = toInt(fraction(toBigInt(amountToPay), feeScale, (feeScale - toBigInt((prFee + pFee))), CEILING)) | |
490 | 511 | $Tuple2(assetToPay, amountToPayWithFee) | |
491 | 512 | } | |
492 | 513 | ||
493 | 514 | ||
494 | 515 | func exchangeDirectly (type,pool,assetIdA,assetIdB,balA,balB,amountTokenToGet,assetTokenToGet) = if ((type == SF_POOL)) | |
495 | 516 | then { | |
496 | - | let $ | |
497 | - | let assetToPay = $ | |
498 | - | let amountToPay = $ | |
517 | + | let $t01510815230 = calcAmountToPaySF(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
518 | + | let assetToPay = $t01510815230._1 | |
519 | + | let amountToPay = $t01510815230._2 | |
499 | 520 | invoke(addressFromStringValue(pool), "callFunction", ["exchange", [toString(amountTokenToGet)]], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
500 | 521 | } | |
501 | 522 | else { | |
502 | - | let $ | |
503 | - | let assetToPay = $ | |
504 | - | let amountToPay = $ | |
523 | + | let $t01540515527 = calcAmountToPayWX(pool, assetIdA, assetIdB, balA, balB, amountTokenToGet, assetTokenToGet) | |
524 | + | let assetToPay = $t01540515527._1 | |
525 | + | let amountToPay = $t01540515527._2 | |
505 | 526 | invoke(wxSwapContract, "swap", [amountTokenToGet, assetTokenToGet, toString(this)], [AttachedPayment(assetIdFromStr(assetToPay), amountToPay)]) | |
506 | 527 | } | |
507 | 528 | ||
508 | 529 | ||
509 | - | func calcReplenishLPVirt (pType,pool,pmtA,aId,pmtB,bId,balA,balB) = { | |
510 | - | let poolAddr = addressFromStringValue(pool) | |
511 | - | if ((pType == SF_POOL)) | |
512 | - | then { | |
513 | - | let inv = { | |
514 | - | let @ = invoke(poolAddr, "callFunction", ["calcLPReplenishDiffPropREADONLY", [toString(pmtA), toString(pmtB), "0"]], nil) | |
515 | - | if ($isInstanceOf(@, "List[Any]")) | |
516 | - | then @ | |
517 | - | else throw(($getType(@) + " couldn't be cast to List[Any]")) | |
518 | - | } | |
519 | - | if ((inv == inv)) | |
520 | - | then $Tuple2({ | |
521 | - | let @ = inv[0] | |
522 | - | if ($isInstanceOf(@, "Int")) | |
523 | - | then @ | |
524 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
525 | - | }, { | |
526 | - | let @ = inv[1] | |
527 | - | if ($isInstanceOf(@, "Int")) | |
528 | - | then @ | |
529 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
530 | - | }) | |
531 | - | else throw("Strict value is not equal to itself.") | |
532 | - | } | |
533 | - | else if ((pType == WX_POOL)) | |
534 | - | then { | |
535 | - | let $t01562915970 = if (if ((pmtA > 0)) | |
536 | - | then (pmtB > 0) | |
537 | - | else false) | |
538 | - | then { | |
539 | - | let $t01571015836 = calcReplenishByTwoTokens(pType, poolAddr, pmtA, aId, pmtB, bId, balA, balB) | |
540 | - | let pmtInA = $t01571015836._1 | |
541 | - | let pmtInB = $t01571015836._2 | |
542 | - | let change = $t01571015836._3 | |
543 | - | let changeId = $t01571015836._4 | |
544 | - | let lpAmount = $t01571015836._5 | |
545 | - | $Tuple3(change, changeId, lpAmount) | |
546 | - | } | |
547 | - | else if ((pmtA > 0)) | |
548 | - | then $Tuple3(pmtA, aId, 0) | |
549 | - | else $Tuple3(pmtB, bId, 0) | |
550 | - | let change = $t01562915970._1 | |
551 | - | let changeId = $t01562915970._2 | |
552 | - | let lpTwo = $t01562915970._3 | |
553 | - | let $t01597716193 = if ((change > 0)) | |
554 | - | then { | |
555 | - | let inv = { | |
556 | - | let @ = invoke(poolAddr, "putOneTknREADONLY", [changeId, change], nil) | |
557 | - | if ($isInstanceOf(@, "(Int, Int, Int)")) | |
558 | - | then @ | |
559 | - | else throw(($getType(@) + " couldn't be cast to (Int, Int, Int)")) | |
560 | - | } | |
561 | - | if ((inv == inv)) | |
562 | - | then $Tuple2(inv._1, inv._3) | |
563 | - | else throw("Strict value is not equal to itself.") | |
564 | - | } | |
565 | - | else $Tuple2(0, 0) | |
566 | - | let lpOne = $t01597716193._1 | |
567 | - | let loss = $t01597716193._2 | |
568 | - | $Tuple2((lpTwo + lpOne), loss) | |
569 | - | } | |
570 | - | else throw("Wrong pool type") | |
571 | - | } | |
572 | - | ||
573 | - | ||
574 | 530 | func calcWithdrawLPFromPoolVirt (poolAddr,pType,shareId,userCanWithdraw) = { | |
575 | - | let $ | |
531 | + | let $t01578916176 = if ((pType == SF_POOL)) | |
576 | 532 | then { | |
577 | 533 | let inv = { | |
578 | 534 | let @ = invoke(poolAddr, "callFunction", ["withdrawREADONLY", [toString(userCanWithdraw)]], nil) | |
579 | 535 | if ($isInstanceOf(@, "(Int, Int)")) | |
580 | 536 | then @ | |
581 | 537 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
582 | 538 | } | |
583 | 539 | if ((inv == inv)) | |
584 | 540 | then $Tuple2(inv._1, inv._2) | |
585 | 541 | else throw("Strict value is not equal to itself.") | |
586 | 542 | } | |
587 | 543 | else { | |
588 | 544 | let inv = split({ | |
589 | 545 | let @ = invoke(poolAddr, "evaluateGetREADONLY", [shareId, userCanWithdraw], nil) | |
590 | 546 | if ($isInstanceOf(@, "String")) | |
591 | 547 | then @ | |
592 | 548 | else throw(($getType(@) + " couldn't be cast to String")) | |
593 | 549 | }, "__") | |
594 | 550 | if ((inv == inv)) | |
595 | 551 | then $Tuple2(parseIntValue(inv[1]), parseIntValue(inv[2])) | |
596 | 552 | else throw("Strict value is not equal to itself.") | |
597 | 553 | } | |
598 | - | let amountA = $ | |
599 | - | let amountB = $ | |
554 | + | let amountA = $t01578916176._1 | |
555 | + | let amountB = $t01578916176._2 | |
600 | 556 | $Tuple2(amountA, amountB) | |
601 | - | } | |
602 | - | ||
603 | - | ||
604 | - | func calcWithdrawLPVirt (pType,pool,lpAmount,shareId,aId,bId,balA,balB,borrowAmount,borrowAssetId) = { | |
605 | - | let poolAddr = addressFromStringValue(pool) | |
606 | - | let $t01700817101 = calcWithdrawLPFromPoolVirt(poolAddr, pType, shareId, lpAmount) | |
607 | - | let getAmountA = $t01700817101._1 | |
608 | - | let getAmountB = $t01700817101._2 | |
609 | - | if ((borrowAmount > 0)) | |
610 | - | then { | |
611 | - | let amountToGetEx = if (if ((borrowAssetId == aId)) | |
612 | - | then (borrowAmount > getAmountA) | |
613 | - | else false) | |
614 | - | then (borrowAmount - getAmountA) | |
615 | - | else if (if ((borrowAssetId == bId)) | |
616 | - | then (borrowAmount > getAmountB) | |
617 | - | else false) | |
618 | - | then (borrowAmount - getAmountB) | |
619 | - | else 0 | |
620 | - | let $t01737917682 = if ((amountToGetEx > 0)) | |
621 | - | then if ((pType == SF_POOL)) | |
622 | - | then calcAmountToPaySF(pool, aId, bId, balA, balB, amountToGetEx, borrowAssetId) | |
623 | - | else calcAmountToPayWX(pool, aId, bId, balA, balB, amountToGetEx, borrowAssetId) | |
624 | - | else $Tuple2("", 0) | |
625 | - | let assetToPay = $t01737917682._1 | |
626 | - | let amountToPay = $t01737917682._2 | |
627 | - | if ((borrowAssetId == aId)) | |
628 | - | then $Tuple2(((getAmountA + amountToGetEx) - borrowAmount), (getAmountB - amountToPay)) | |
629 | - | else $Tuple2((getAmountA - amountToPay), ((getAmountB + amountToGetEx) - borrowAmount)) | |
630 | - | } | |
631 | - | else $Tuple2(getAmountA, getAmountB) | |
632 | 557 | } | |
633 | 558 | ||
634 | 559 | ||
635 | 560 | func claimFarmed (type,pool) = if ((type == SF_POOL)) | |
636 | 561 | then { | |
637 | 562 | let balBefore = accountBalance(SWOPID) | |
638 | 563 | if ((balBefore == balBefore)) | |
639 | 564 | then { | |
640 | 565 | let inv = invoke(getSFFarmingAddr(), "claim", [pool], nil) | |
641 | 566 | if ((inv == inv)) | |
642 | 567 | then { | |
643 | 568 | let balAfter = accountBalance(SWOPID) | |
644 | 569 | $Tuple2((balAfter - balBefore), SWOPID) | |
645 | 570 | } | |
646 | 571 | else throw("Strict value is not equal to itself.") | |
647 | 572 | } | |
648 | 573 | else throw("Strict value is not equal to itself.") | |
649 | 574 | } | |
650 | 575 | else if ((type == WX_POOL)) | |
651 | 576 | then { | |
652 | 577 | let balBefore = accountBalance(WXID) | |
653 | 578 | if ((balBefore == balBefore)) | |
654 | 579 | then { | |
655 | 580 | let inv = invoke(getWXFarmingAddr(Address(fromBase58String(pool))), "claimWX", [pool], nil) | |
656 | 581 | if ((inv == inv)) | |
657 | 582 | then { | |
658 | 583 | let balAfter = accountBalance(WXID) | |
659 | 584 | $Tuple2((balAfter - balBefore), WXID) | |
660 | 585 | } | |
661 | 586 | else throw("Strict value is not equal to itself.") | |
662 | 587 | } | |
663 | 588 | else throw("Strict value is not equal to itself.") | |
664 | 589 | } | |
665 | 590 | else throw("Wrong pool type") | |
666 | 591 | ||
667 | 592 | ||
668 | 593 | func replenishByType (pType,pool,feeType,pmtA,aId,pmtB,bId,balA,balB,LPId) = { | |
669 | 594 | let lpBalanceBefore = accountBalance(fromBase58String(LPId)) | |
670 | 595 | if ((lpBalanceBefore == lpBalanceBefore)) | |
671 | 596 | then { | |
672 | 597 | let poolAddr = addressFromStringValue(pool) | |
673 | - | let $ | |
598 | + | let $t01716217578 = if (if ((pmtA > 0)) | |
674 | 599 | then (pmtB > 0) | |
675 | 600 | else false) | |
676 | 601 | then { | |
677 | - | let $ | |
678 | - | let pmtInA = $ | |
679 | - | let pmtInB = $ | |
680 | - | let change = $ | |
681 | - | let changeId = $ | |
602 | + | let $t01722817344 = calcReplenishByTwoTokens(pType, poolAddr, pmtA, aId, pmtB, bId, balA, balB) | |
603 | + | let pmtInA = $t01722817344._1 | |
604 | + | let pmtInB = $t01722817344._2 | |
605 | + | let change = $t01722817344._3 | |
606 | + | let changeId = $t01722817344._4 | |
682 | 607 | let inv = replenishTwoTokensByType(poolAddr, pType, pmtInA, aId, pmtInB, bId) | |
683 | 608 | if ((inv == inv)) | |
684 | 609 | then $Tuple2(change, changeId) | |
685 | 610 | else throw("Strict value is not equal to itself.") | |
686 | 611 | } | |
687 | 612 | else if ((pmtA > 0)) | |
688 | 613 | then $Tuple2(pmtA, aId) | |
689 | 614 | else if ((pmtB > 0)) | |
690 | 615 | then $Tuple2(pmtB, bId) | |
691 | 616 | else throw("pmts must be > 0") | |
692 | - | let change = $ | |
693 | - | let changeId = $ | |
617 | + | let change = $t01716217578._1 | |
618 | + | let changeId = $t01716217578._2 | |
694 | 619 | let inv = if ((change > 0)) | |
695 | 620 | then replenishOneTokenByType(poolAddr, pType, change, changeId) | |
696 | 621 | else nil | |
697 | 622 | if ((inv == inv)) | |
698 | 623 | then { | |
699 | 624 | let lpBalanceAfter = accountBalance(fromBase58String(LPId)) | |
700 | 625 | let totalStaked = (lpBalanceAfter - lpBalanceBefore) | |
701 | 626 | let axlyFeeAmount = fraction(totalStaked, getAxlyFee(pool, feeType), FEE_SCALE6) | |
702 | 627 | let userShareForStake = (totalStaked - axlyFeeAmount) | |
703 | 628 | if ((0 >= userShareForStake)) | |
704 | 629 | then throw("amount of staked sharetokens must be > 0") | |
705 | 630 | else { | |
706 | 631 | let invLP = stakeLP(pool, pType, LPId, userShareForStake) | |
707 | 632 | if ((invLP == invLP)) | |
708 | 633 | then $Tuple2(userShareForStake, axlyFeeAmount) | |
709 | 634 | else throw("Strict value is not equal to itself.") | |
710 | 635 | } | |
711 | 636 | } | |
712 | 637 | else throw("Strict value is not equal to itself.") | |
713 | 638 | } | |
714 | 639 | else throw("Strict value is not equal to itself.") | |
715 | 640 | } | |
716 | 641 | ||
717 | 642 | ||
718 | 643 | func replenishEntries (pool,user,stakedAmount,axlyFeeAmount,posNum,shareId,type,withLoan) = { | |
719 | 644 | let totalAmount = getPoolTotalShare(pool) | |
720 | 645 | let totalAmountLoan = getPoolTotalShareWithLoan(pool) | |
721 | - | let $ | |
646 | + | let $t01843618674 = if (withLoan) | |
722 | 647 | then $Tuple2(getIntegerValue(this, (pool + kPoolInterestLoan)), (totalAmountLoan + stakedAmount)) | |
723 | 648 | else $Tuple2(getIntegerValue(this, (pool + kPoolInterestNoLoan)), totalAmountLoan) | |
724 | - | let curPoolInterest = $ | |
725 | - | let totalStakedWithLoan = $ | |
649 | + | let curPoolInterest = $t01843618674._1 | |
650 | + | let totalStakedWithLoan = $t01843618674._2 | |
726 | 651 | [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))] | |
727 | 652 | } | |
728 | 653 | ||
729 | 654 | ||
730 | 655 | func exchangeKeeper (toToken,pmtAmount,pmtAsset,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = { | |
731 | 656 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
732 | 657 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
733 | 658 | then { | |
734 | 659 | let inv = invoke(exContract, "swap", [amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
735 | 660 | if ((inv == inv)) | |
736 | 661 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
737 | 662 | else throw("Strict value is not equal to itself.") | |
738 | 663 | } | |
739 | 664 | else throw("Strict value is not equal to itself.") | |
740 | 665 | } | |
741 | 666 | ||
742 | 667 | ||
743 | 668 | func exchangePuzzle (toToken,pmtAmount,pmtAsset,routesStr,minToReceive,options) = { | |
744 | 669 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
745 | 670 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
746 | 671 | then { | |
747 | 672 | let inv = invoke(exContract, "puzzleSwap", [routesStr, minToReceive, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
748 | 673 | if ((inv == inv)) | |
749 | 674 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
750 | 675 | else throw("Strict value is not equal to itself.") | |
751 | 676 | } | |
752 | 677 | else throw("Strict value is not equal to itself.") | |
753 | 678 | } | |
754 | 679 | ||
755 | 680 | ||
756 | 681 | func exchangeSwopFi (toToken,pmtAmount,pmtAsset,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = { | |
757 | 682 | let tokenBalanceBefore = accountBalance(assetIdFromStr(toToken)) | |
758 | 683 | if ((tokenBalanceBefore == tokenBalanceBefore)) | |
759 | 684 | then { | |
760 | 685 | let inv = invoke(exContract, "swopfiSwap", [exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options], [AttachedPayment(pmtAsset, pmtAmount)]) | |
761 | 686 | if ((inv == inv)) | |
762 | 687 | then (accountBalance(assetIdFromStr(toToken)) - tokenBalanceBefore) | |
763 | 688 | else throw("Strict value is not equal to itself.") | |
764 | 689 | } | |
765 | 690 | else throw("Strict value is not equal to itself.") | |
766 | 691 | } | |
767 | 692 | ||
768 | 693 | ||
769 | 694 | func capitalize (pool,pType,tokenId,tokenAmount) = { | |
770 | 695 | let poolAddr = Address(fromBase58String(pool)) | |
771 | - | let $ | |
772 | - | let AId = $ | |
773 | - | let BId = $ | |
774 | - | let balA = $ | |
775 | - | let balB = $ | |
776 | - | let shareId = $ | |
696 | + | let $t02102521091 = getPoolData(poolAddr, pType) | |
697 | + | let AId = $t02102521091._1 | |
698 | + | let BId = $t02102521091._2 | |
699 | + | let balA = $t02102521091._3 | |
700 | + | let balB = $t02102521091._4 | |
701 | + | let shareId = $t02102521091._5 | |
777 | 702 | if (if ((tokenId != AId)) | |
778 | 703 | then (tokenId != BId) | |
779 | 704 | else false) | |
780 | 705 | then throw("Wrong asset") | |
781 | 706 | else { | |
782 | - | let $ | |
707 | + | let $t02117621256 = if ((tokenId == AId)) | |
783 | 708 | then $Tuple2(tokenAmount, 0) | |
784 | 709 | else $Tuple2(0, tokenAmount) | |
785 | - | let pmtA = $ | |
786 | - | let pmtB = $ | |
787 | - | let $ | |
788 | - | let stakedAmount = $ | |
789 | - | let nf = $ | |
710 | + | let pmtA = $t02117621256._1 | |
711 | + | let pmtB = $t02117621256._2 | |
712 | + | let $t02125921363 = replenishByType(pType, pool, NO_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
713 | + | let stakedAmount = $t02125921363._1 | |
714 | + | let nf = $t02125921363._2 | |
790 | 715 | let curPoolInterestLoan = valueOrElse(getInteger(this, (pool + kPoolInterestLoan)), 0) | |
791 | 716 | let curPoolInterestNoLoan = valueOrElse(getInteger(this, (pool + kPoolInterestNoLoan)), 0) | |
792 | 717 | let totalShareAmount = getPoolTotalShare(pool) | |
793 | 718 | let totalShareAmountWithLoan = getPoolTotalShareWithLoan(pool) | |
794 | 719 | let loanPercent = fraction(totalShareAmountWithLoan, SCALE8, totalShareAmount) | |
795 | 720 | let stakedLoan = fraction(stakedAmount, loanPercent, SCALE8) | |
796 | 721 | let stakedNoLoan = (stakedAmount - stakedLoan) | |
797 | 722 | let newInterestLoan = if ((totalShareAmountWithLoan > 0)) | |
798 | 723 | then (curPoolInterestLoan + fraction(stakedLoan, SCALE10, totalShareAmountWithLoan)) | |
799 | 724 | else 0 | |
800 | 725 | let newInterestNoLoan = if (((totalShareAmount - totalShareAmountWithLoan) > 0)) | |
801 | 726 | then (curPoolInterestNoLoan + fraction(stakedNoLoan, SCALE10, (totalShareAmount - totalShareAmountWithLoan))) | |
802 | 727 | else 0 | |
803 | 728 | let axlyFeeLoan = fraction(stakedLoan, getAxlyFee(pool, CAP_FEE_LOAN), FEE_SCALE6) | |
804 | 729 | let axlyFeeNoLoan = fraction(stakedNoLoan, getAxlyFee(pool, CAP_FEE_NO_LOAN), FEE_SCALE6) | |
805 | 730 | let axlyFee = unstakeLP(pool, pType, shareId, (axlyFeeLoan + axlyFeeNoLoan)) | |
806 | 731 | if ((axlyFee == axlyFee)) | |
807 | 732 | 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)) | |
808 | 733 | else throw("Strict value is not equal to itself.") | |
809 | 734 | } | |
810 | 735 | } | |
811 | 736 | ||
812 | 737 | ||
813 | 738 | func withdrawAmountCalc (pool,userCanWithdraw,debt,borrowAsset) = { | |
814 | 739 | let poolAddr = Address(fromBase58String(pool)) | |
815 | 740 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
816 | - | let $ | |
817 | - | let assetIdA = $ | |
818 | - | let assetIdB = $ | |
819 | - | let balA = $ | |
820 | - | let balB = $ | |
821 | - | let shareId = $ | |
741 | + | let $t02313523211 = getPoolData(poolAddr, pType) | |
742 | + | let assetIdA = $t02313523211._1 | |
743 | + | let assetIdB = $t02313523211._2 | |
744 | + | let balA = $t02313523211._3 | |
745 | + | let balB = $t02313523211._4 | |
746 | + | let shareId = $t02313523211._5 | |
822 | 747 | let cBalABefore = accountBalance(assetIdFromStr(assetIdA)) | |
823 | 748 | if ((cBalABefore == cBalABefore)) | |
824 | 749 | then { | |
825 | 750 | let cBalBBefore = accountBalance(assetIdFromStr(assetIdB)) | |
826 | 751 | if ((cBalBBefore == cBalBBefore)) | |
827 | 752 | then { | |
828 | 753 | let inv = if ((pType == SF_POOL)) | |
829 | 754 | then invoke(poolAddr, "callFunction", ["withdraw", [toString(userCanWithdraw)]], nil) | |
830 | 755 | else { | |
831 | 756 | let inv = unstakeLP(pool, pType, shareId, userCanWithdraw) | |
832 | 757 | if ((inv == inv)) | |
833 | 758 | then invoke(poolAddr, "get", nil, [AttachedPayment(assetIdFromStr(shareId), userCanWithdraw)]) | |
834 | 759 | else throw("Strict value is not equal to itself.") | |
835 | 760 | } | |
836 | 761 | if ((inv == inv)) | |
837 | 762 | then { | |
838 | 763 | let cBalAAfter = accountBalance(assetIdFromStr(assetIdA)) | |
839 | 764 | let cBalBAfter = accountBalance(assetIdFromStr(assetIdB)) | |
840 | - | let $ | |
841 | - | let tokensAmountA = $ | |
842 | - | let tokensAmountB = $ | |
843 | - | let $ | |
765 | + | let $t02377423863 = $Tuple2((cBalAAfter - cBalABefore), (cBalBAfter - cBalBBefore)) | |
766 | + | let tokensAmountA = $t02377423863._1 | |
767 | + | let tokensAmountB = $t02377423863._2 | |
768 | + | let $t02386624720 = if ((debt > 0)) | |
844 | 769 | then { | |
845 | 770 | let amountToGetEx = if (if ((borrowAsset == assetIdA)) | |
846 | 771 | then (debt > tokensAmountA) | |
847 | 772 | else false) | |
848 | 773 | then (debt - tokensAmountA) | |
849 | 774 | else if (if ((borrowAsset == assetIdB)) | |
850 | 775 | then (debt > tokensAmountB) | |
851 | 776 | else false) | |
852 | 777 | then (debt - tokensAmountB) | |
853 | 778 | else 0 | |
854 | 779 | let exInv = if ((amountToGetEx > 0)) | |
855 | 780 | then exchangeDirectly(pType, pool, assetIdA, assetIdB, (balA - tokensAmountA), (balB - tokensAmountB), amountToGetEx, borrowAsset) | |
856 | 781 | else nil | |
857 | 782 | if ((exInv == exInv)) | |
858 | 783 | then { | |
859 | 784 | let cBalAAfterRepay = accountBalance(assetIdFromStr(assetIdA)) | |
860 | 785 | let cBalBAfterRepay = accountBalance(assetIdFromStr(assetIdB)) | |
861 | 786 | if ((borrowAsset == assetIdA)) | |
862 | 787 | then $Tuple2(((cBalAAfterRepay - cBalABefore) - debt), (cBalBAfterRepay - cBalBBefore)) | |
863 | 788 | else $Tuple2((cBalAAfterRepay - cBalABefore), ((cBalBAfterRepay - cBalBBefore) - debt)) | |
864 | 789 | } | |
865 | 790 | else throw("Strict value is not equal to itself.") | |
866 | 791 | } | |
867 | 792 | else $Tuple2(tokensAmountA, tokensAmountB) | |
868 | - | let toUserA = $ | |
869 | - | let toUserB = $ | |
793 | + | let toUserA = $t02386624720._1 | |
794 | + | let toUserB = $t02386624720._2 | |
870 | 795 | $Tuple7(toUserA, assetIdA, toUserB, assetIdB, cBalAAfter, cBalBAfter, shareId) | |
871 | 796 | } | |
872 | 797 | else throw("Strict value is not equal to itself.") | |
873 | 798 | } | |
874 | 799 | else throw("Strict value is not equal to itself.") | |
875 | 800 | } | |
876 | 801 | else throw("Strict value is not equal to itself.") | |
877 | 802 | } | |
878 | 803 | ||
879 | 804 | ||
880 | 805 | func userCanWithdrawShareCalc (user,pool,posId,borrowed) = { | |
881 | 806 | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
882 | 807 | let userInterest = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)) | |
883 | 808 | let poolInterest = if (borrowed) | |
884 | 809 | then getIntegerValue(this, (pool + kPoolInterestLoan)) | |
885 | 810 | else getIntegerValue(this, (pool + kPoolInterestNoLoan)) | |
886 | 811 | (pAmount + fraction(pAmount, (poolInterest - userInterest), SCALE10)) | |
887 | 812 | } | |
888 | 813 | ||
889 | 814 | ||
890 | 815 | func withdrawToUser (user,pool,posId,stopLoss) = { | |
891 | 816 | let pAmount = valueOrErrorMessage(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserPosition)), "Unknown position") | |
892 | 817 | let borrowAmount = valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)), 0) | |
893 | 818 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posId, (borrowAmount > 0)) | |
894 | 819 | let poolTotalShare = getPoolTotalShare(pool) | |
895 | 820 | let userAddr = Address(fromBase58String(user)) | |
896 | 821 | let borrowAsset = valueOrElse(getString(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)), "") | |
897 | 822 | let debt = if ((borrowAmount > 0)) | |
898 | 823 | then { | |
899 | 824 | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((user + "_") + posId), borrowAsset], nil) | |
900 | 825 | if ($isInstanceOf(@, "Int")) | |
901 | 826 | then @ | |
902 | 827 | else throw(($getType(@) + " couldn't be cast to Int")) | |
903 | 828 | } | |
904 | 829 | else 0 | |
905 | - | let $ | |
906 | - | if (($ | |
830 | + | let $t02610826261 = withdrawAmountCalc(pool, userCanWithdraw, debt, borrowAsset) | |
831 | + | if (($t02610826261 == $t02610826261)) | |
907 | 832 | then { | |
908 | - | let shareId = $ | |
909 | - | let cBalBAfter = $ | |
910 | - | let cBalAAfter = $ | |
911 | - | let assetIdB = $ | |
912 | - | let toUserAmountB = $ | |
913 | - | let assetIdA = $ | |
914 | - | let toUserAmountA = $ | |
833 | + | let shareId = $t02610826261._7 | |
834 | + | let cBalBAfter = $t02610826261._6 | |
835 | + | let cBalAAfter = $t02610826261._5 | |
836 | + | let assetIdB = $t02610826261._4 | |
837 | + | let toUserAmountB = $t02610826261._3 | |
838 | + | let assetIdA = $t02610826261._2 | |
839 | + | let toUserAmountA = $t02610826261._1 | |
915 | 840 | let closeDbtInv = if ((debt > 0)) | |
916 | 841 | then invoke(getLendSrvAddr(), "repayFor", [((user + "_") + posId)], [AttachedPayment(assetIdFromStr(borrowAsset), debt)]) | |
917 | 842 | else 0 | |
918 | 843 | if ((closeDbtInv == closeDbtInv)) | |
919 | 844 | then ([DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPosition)), DeleteEntry((((((pool + "_") + user) + "_") + posId) + kUserPositionInterest)), IntegerEntry((pool + kPoolTotal), (poolTotalShare - userCanWithdraw)), ScriptTransfer(userAddr, toUserAmountA, assetIdFromStr(assetIdA)), ScriptTransfer(userAddr, toUserAmountB, assetIdFromStr(assetIdB))] ++ getCursEntries(assetIdA, assetIdB, shareId, nil)) | |
920 | 845 | else throw("Strict value is not equal to itself.") | |
921 | 846 | } | |
922 | 847 | else throw("Strict value is not equal to itself.") | |
923 | 848 | } | |
924 | 849 | ||
925 | 850 | ||
926 | 851 | func parseRequest (requestId) = { | |
927 | 852 | let request = split(valueOrErrorMessage(getString(this, (requestId + kRequestId)), ("No request with id " + requestId)), ",") | |
928 | 853 | let user = request[0] | |
929 | 854 | let pool = request[1] | |
930 | 855 | let pmtA = parseIntValue(request[2]) | |
931 | 856 | let AId = request[3] | |
932 | 857 | let pmtB = parseIntValue(request[4]) | |
933 | 858 | let BId = request[5] | |
934 | 859 | let balA = parseIntValue(request[6]) | |
935 | 860 | let balB = parseIntValue(request[7]) | |
936 | 861 | let shareId = request[8] | |
937 | 862 | let bwAsset = request[9] | |
938 | 863 | let bwAmount = parseIntValue(request[10]) | |
939 | 864 | $Tuple11(user, pool, pmtA, AId, pmtB, BId, balA, balB, shareId, bwAsset, bwAmount) | |
940 | 865 | } | |
941 | 866 | ||
942 | 867 | ||
943 | 868 | func calcBorrowAmount (pmtA,pmtB,aId,bId,leverage,borrowId) = { | |
944 | 869 | let dPriceA = getIntegerValue(priceOracleAddr, (aId + kPriceInOracle)) | |
945 | 870 | let dPriceB = getIntegerValue(priceOracleAddr, (bId + kPriceInOracle)) | |
946 | 871 | let decPrA = pow(10, 0, getAssetDecimals(aId), 0, 0, DOWN) | |
947 | 872 | let decPrB = pow(10, 0, getAssetDecimals(bId), 0, 0, DOWN) | |
948 | 873 | let paydInDollar = (fraction(dPriceA, pmtA, decPrA) + fraction(dPriceB, pmtB, decPrB)) | |
949 | - | let $ | |
874 | + | let $t02790528002 = if ((borrowId == aId)) | |
950 | 875 | then $Tuple2(dPriceA, decPrA) | |
951 | 876 | else $Tuple2(dPriceB, decPrB) | |
952 | - | let borrowPrice = $ | |
953 | - | let borrowDecPr = $ | |
877 | + | let borrowPrice = $t02790528002._1 | |
878 | + | let borrowDecPr = $t02790528002._2 | |
954 | 879 | fraction(fraction(paydInDollar, (leverage - 100), 100), borrowDecPr, borrowPrice) | |
955 | 880 | } | |
956 | 881 | ||
957 | 882 | ||
958 | - | @Callable(i) | |
959 | - | func calcPriceImpactEVALONLY (pool,leverage,borrowId,pmtA,pmtB) = if (if ((100 > leverage)) | |
960 | - | then true | |
961 | - | else (leverage > 300)) | |
962 | - | then throw("Leverage can't be <100 and >300") | |
963 | - | else { | |
964 | - | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
965 | - | let $t03013730227 = getPoolData(Address(fromBase58String(pool)), pType) | |
966 | - | let AId = $t03013730227._1 | |
967 | - | let BId = $t03013730227._2 | |
968 | - | let balA = $t03013730227._3 | |
969 | - | let balB = $t03013730227._4 | |
970 | - | let shareId = $t03013730227._5 | |
971 | - | let borrowAmount = if ((leverage > 100)) | |
972 | - | then calcBorrowAmount(pmtA, pmtB, AId, BId, leverage, borrowId) | |
973 | - | else 0 | |
974 | - | let $t03036230469 = if ((borrowId == AId)) | |
975 | - | then $Tuple2((pmtA + borrowAmount), pmtB) | |
976 | - | else $Tuple2(pmtA, (pmtB + borrowAmount)) | |
977 | - | let payInA = $t03036230469._1 | |
978 | - | let payInB = $t03036230469._2 | |
979 | - | let $t03047230565 = calcReplenishLPVirt(pType, pool, payInA, AId, payInB, BId, balA, balB) | |
980 | - | let lpAmount = $t03047230565._1 | |
981 | - | let loss = $t03047230565._2 | |
982 | - | let impactMod = if ((0 > loss)) | |
983 | - | then (loss * -1) | |
984 | - | else loss | |
985 | - | $Tuple2(nil, [impactMod]) | |
986 | - | } | |
883 | + | func parseReplenishPmts (pmts,AId,BId) = if ((size(pmts) == 2)) | |
884 | + | then if ((assetIdToStr(pmts[0].assetId) != AId)) | |
885 | + | then throw("Wrong payment asset A") | |
886 | + | else if ((assetIdToStr(pmts[1].assetId) != BId)) | |
887 | + | then throw("Wrong payment asset B") | |
888 | + | else $Tuple4(pmts[0].amount, AId, pmts[1].amount, BId) | |
889 | + | else if ((size(pmts) == 1)) | |
890 | + | then if ((assetIdToStr(pmts[0].assetId) == AId)) | |
891 | + | then $Tuple4(pmts[0].amount, AId, 0, BId) | |
892 | + | else if ((assetIdToStr(pmts[0].assetId) == BId)) | |
893 | + | then $Tuple4(0, AId, pmts[0].amount, BId) | |
894 | + | else throw("Wrong payment") | |
895 | + | else throw("One or two payments expected") | |
987 | 896 | ||
988 | 897 | ||
989 | - | ||
990 | - | @Callable(i) | |
991 | - | func replenishFromLandEVALONLY (requestId) = valueOrElse(isLandCall(i), { | |
992 | - | let $t03074230846 = parseRequest(requestId) | |
993 | - | let user = $t03074230846._1 | |
994 | - | let pool = $t03074230846._2 | |
995 | - | let pmtA = $t03074230846._3 | |
996 | - | let AId = $t03074230846._4 | |
997 | - | let pmtB = $t03074230846._5 | |
998 | - | let BId = $t03074230846._6 | |
999 | - | let balA = $t03074230846._7 | |
1000 | - | let balB = $t03074230846._8 | |
1001 | - | let shareId = $t03074230846._9 | |
1002 | - | let bwAsset = $t03074230846._10 | |
1003 | - | let bwAmount = $t03074230846._11 | |
1004 | - | if ((size(i.payments) != 1)) | |
1005 | - | then throw("Wrong payment size") | |
1006 | - | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
1007 | - | then true | |
1008 | - | else (i.payments[0].amount != bwAmount)) | |
1009 | - | then throw("Wrong payment") | |
1010 | - | else { | |
1011 | - | let $t03103631160 = if ((AId == bwAsset)) | |
1012 | - | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
1013 | - | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
1014 | - | let pmtAllA = $t03103631160._1 | |
1015 | - | let pmtAllB = $t03103631160._2 | |
1016 | - | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
1017 | - | let $t03124231357 = replenishByType(pType, pool, LOAN_FEE, pmtAllA, AId, pmtAllB, BId, balA, balB, shareId) | |
1018 | - | let userStaked = $t03124231357._1 | |
1019 | - | let axlyFee = $t03124231357._2 | |
1020 | - | let posNum = getNewUserPositionNumber(user) | |
1021 | - | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
1022 | - | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType, true) | |
1023 | - | nil | |
1024 | - | } | |
1025 | - | }) | |
1026 | - | ||
898 | + | func calcPriceImpact (balA,balB,newBalA,newBalB) = { | |
899 | + | let pri = ((SCALE8 - fraction(fraction(balB, SCALE8, balA), SCALE8, fraction(newBalB, SCALE8, newBalA))) * 100) | |
900 | + | if ((0 > pri)) | |
901 | + | then (pri * -1) | |
902 | + | else pri | |
903 | + | } | |
1027 | 904 | ||
1028 | 905 | ||
1029 | 906 | @Callable(i) | |
1030 | 907 | func getShareAssetPriceREADONLY (shareId) = { | |
1031 | 908 | let sharePrices = getSharePrice(shareId) | |
1032 | 909 | $Tuple2(nil, sharePrices) | |
1033 | 910 | } | |
1034 | 911 | ||
1035 | 912 | ||
1036 | 913 | ||
1037 | 914 | @Callable(i) | |
1038 | 915 | func getUserPositionShareAmountREADONLY (user,posNum) = { | |
1039 | 916 | let pool = valueOrErrorMessage(getString(this, (((user + "_") + posNum) + kUserPositionPool)), "Unknown position") | |
1040 | 917 | let borrowAmount = getIntegerValue(this, (((((pool + "_") + user) + "_") + posNum) + kUserBorrowAmount)) | |
1041 | 918 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posNum, (borrowAmount > 0)) | |
1042 | 919 | $Tuple2(nil, userCanWithdraw) | |
1043 | 920 | } | |
1044 | 921 | ||
1045 | 922 | ||
1046 | 923 | ||
1047 | 924 | @Callable(i) | |
1048 | 925 | func getUserPositionInDollarsREADONLY (user,pools,posNum) = { | |
1049 | 926 | func userPos (a,pool) = { | |
1050 | - | let $ | |
1051 | - | let totalPos = $ | |
1052 | - | let posDebt = $ | |
1053 | - | let index = $ | |
927 | + | let $t02970129735 = a | |
928 | + | let totalPos = $t02970129735._1 | |
929 | + | let posDebt = $t02970129735._2 | |
930 | + | let index = $t02970129735._3 | |
1054 | 931 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1055 | - | let $ | |
1056 | - | let AId = $ | |
1057 | - | let BId = $ | |
1058 | - | let balA = $ | |
1059 | - | let balB = $ | |
1060 | - | let shareId = $ | |
932 | + | let $t02982729917 = getPoolData(Address(fromBase58String(pool)), pType) | |
933 | + | let AId = $t02982729917._1 | |
934 | + | let BId = $t02982729917._2 | |
935 | + | let balA = $t02982729917._3 | |
936 | + | let balB = $t02982729917._4 | |
937 | + | let shareId = $t02982729917._5 | |
1061 | 938 | let borrowAmount = valueOrElse(getInteger(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserBorrowAmount)), 0) | |
1062 | 939 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posNum[index], (borrowAmount > 0)) | |
1063 | 940 | let sharePrices = getSharePrice(shareId) | |
1064 | 941 | let decPrShare = pow(10, 0, getAssetDecimals(shareId), 0, 0, DOWN) | |
1065 | 942 | let shareD = fraction(userCanWithdraw, sharePrices, decPrShare) | |
1066 | 943 | if ((borrowAmount == 0)) | |
1067 | 944 | then $Tuple3((totalPos :+ shareD), (posDebt :+ 0), (index + 1)) | |
1068 | 945 | else { | |
1069 | 946 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posNum[index]) + kUserBorrowAssetId)) | |
1070 | 947 | let debt = { | |
1071 | 948 | let @ = invoke(getLendSrvAddr(), "getAssetDebt", [false, ((user + "_") + posNum[index]), borrowAsset], nil) | |
1072 | 949 | if ($isInstanceOf(@, "Int")) | |
1073 | 950 | then @ | |
1074 | 951 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1075 | 952 | } | |
1076 | 953 | let borrowAssetPrice = getIntegerValue(priceOracleAddr, (borrowAsset + kPriceInOracle)) | |
1077 | 954 | let decPrBorrowId = pow(10, 0, getAssetDecimals(borrowAsset), 0, 0, DOWN) | |
1078 | 955 | let debtD = fraction(debt, borrowAssetPrice, decPrBorrowId) | |
1079 | 956 | $Tuple3((totalPos :+ shareD), (posDebt :+ debtD), (index + 1)) | |
1080 | 957 | } | |
1081 | 958 | } | |
1082 | 959 | ||
1083 | - | let $ | |
960 | + | let $t03093730992 = { | |
1084 | 961 | let $l = pools | |
1085 | 962 | let $s = size($l) | |
1086 | 963 | let $acc0 = $Tuple3(nil, nil, 0) | |
1087 | 964 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1088 | 965 | then $a | |
1089 | 966 | else userPos($a, $l[$i]) | |
1090 | 967 | ||
1091 | 968 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1092 | 969 | then $a | |
1093 | 970 | else throw("List size exceeds 20") | |
1094 | 971 | ||
1095 | 972 | $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) | |
1096 | 973 | } | |
1097 | - | let pos = $ | |
1098 | - | let debt = $ | |
974 | + | let pos = $t03093730992._1 | |
975 | + | let debt = $t03093730992._2 | |
1099 | 976 | $Tuple2(nil, $Tuple2(pos, debt)) | |
1100 | 977 | } | |
1101 | 978 | ||
1102 | 979 | ||
1103 | 980 | ||
1104 | 981 | @Callable(i) | |
1105 | 982 | func replenish (pool,leverage,borrowId) = if (if ((100 > leverage)) | |
1106 | 983 | then true | |
1107 | 984 | else (leverage > 300)) | |
1108 | 985 | then throw("Leverage can't be <100 and >300") | |
1109 | 986 | else if (if (!(getBooleanValue(this, (pool + kPoolCanBorrow)))) | |
1110 | 987 | then (leverage > 100) | |
1111 | 988 | else false) | |
1112 | 989 | then throw("You can't borrow in this pool") | |
1113 | 990 | else { | |
1114 | 991 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1115 | - | let $t03418634276 = getPoolData(Address(fromBase58String(pool)), pType) | |
1116 | - | let AId = $t03418634276._1 | |
1117 | - | let BId = $t03418634276._2 | |
1118 | - | let balA = $t03418634276._3 | |
1119 | - | let balB = $t03418634276._4 | |
1120 | - | let shareId = $t03418634276._5 | |
1121 | - | let $t03427934916 = if ((size(i.payments) == 2)) | |
1122 | - | then if ((assetIdToStr(i.payments[0].assetId) != AId)) | |
1123 | - | then throw("Wrong payment asset A") | |
1124 | - | else if ((assetIdToStr(i.payments[1].assetId) != BId)) | |
1125 | - | then throw("Wrong payment asset B") | |
1126 | - | else $Tuple4(i.payments[0].amount, AId, i.payments[1].amount, BId) | |
1127 | - | else if ((size(i.payments) == 1)) | |
1128 | - | then if ((assetIdToStr(i.payments[0].assetId) == AId)) | |
1129 | - | then $Tuple4(i.payments[0].amount, AId, 0, BId) | |
1130 | - | else if ((assetIdToStr(i.payments[0].assetId) == BId)) | |
1131 | - | then $Tuple4(0, AId, i.payments[0].amount, BId) | |
1132 | - | else throw("Wrong payment") | |
1133 | - | else throw("One or two payments expected") | |
1134 | - | let pmtA = $t03427934916._1 | |
1135 | - | let pmtAssetA = $t03427934916._2 | |
1136 | - | let pmtB = $t03427934916._3 | |
1137 | - | let pmtAssetB = $t03427934916._4 | |
1138 | - | let newPosNum = getNewUserPositionNumber(toString(i.caller)) | |
992 | + | let $t03143231522 = getPoolData(Address(fromBase58String(pool)), pType) | |
993 | + | let AId = $t03143231522._1 | |
994 | + | let BId = $t03143231522._2 | |
995 | + | let balA = $t03143231522._3 | |
996 | + | let balB = $t03143231522._4 | |
997 | + | let shareId = $t03143231522._5 | |
998 | + | let $t03152531606 = parseReplenishPmts(i.payments, AId, BId) | |
999 | + | let pmtA = $t03152531606._1 | |
1000 | + | let pmtAssetA = $t03152531606._2 | |
1001 | + | let pmtB = $t03152531606._3 | |
1002 | + | let pmtAssetB = $t03152531606._4 | |
1003 | + | let user = toString(i.caller) | |
1004 | + | let newPosNum = getNewUserPositionNumber(user) | |
1139 | 1005 | if ((leverage > 100)) | |
1140 | 1006 | then { | |
1141 | 1007 | let borrowAmount = calcBorrowAmount(pmtA, pmtB, pmtAssetA, pmtAssetB, leverage, borrowId) | |
1142 | - | let request = makeString([ | |
1008 | + | let request = makeString([user, pool, toString(pmtA), pmtAssetA, toString(pmtB), pmtAssetB, toString(balA), toString(balB), shareId, borrowId, toString(borrowAmount)], ",") | |
1143 | 1009 | let newRequestId = { | |
1144 | 1010 | let @ = invoke(this, "createNewRequest", [request], nil) | |
1145 | 1011 | if ($isInstanceOf(@, "Int")) | |
1146 | 1012 | then @ | |
1147 | 1013 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1148 | 1014 | } | |
1149 | 1015 | if ((newRequestId == newRequestId)) | |
1150 | 1016 | then { | |
1151 | - | let args = [(( | |
1017 | + | let args = [((user + "_") + toString(newPosNum)), shareId, borrowId, borrowAmount, toString(this), "replenishFromLand", toString(valueOrErrorMessage(newRequestId, "Can't create new request"))] | |
1152 | 1018 | let inv = reentrantInvoke(getLendSrvAddr(), "flashPosition", args, nil) | |
1153 | 1019 | if ((inv == inv)) | |
1154 | - | then nil | |
1020 | + | then { | |
1021 | + | let userStaked = getIntegerValue(this, (((((pool + "_") + user) + "_") + toString(newPosNum)) + kUserPosition)) | |
1022 | + | let $t03261932713 = getPoolBalances(Address(fromBase58String(pool)), pType, AId, BId) | |
1023 | + | if (($t03261932713 == $t03261932713)) | |
1024 | + | then { | |
1025 | + | let newBalB = $t03261932713._2 | |
1026 | + | let newBalA = $t03261932713._1 | |
1027 | + | let prImpact = calcPriceImpact(balA, balB, newBalA, newBalB) | |
1028 | + | let $t03278332898 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1029 | + | let wAmountA = $t03278332898._1 | |
1030 | + | let wAmountB = $t03278332898._2 | |
1031 | + | $Tuple2(nil, [prImpact, wAmountA, wAmountB]) | |
1032 | + | } | |
1033 | + | else throw("Strict value is not equal to itself.") | |
1034 | + | } | |
1155 | 1035 | else throw("Strict value is not equal to itself.") | |
1156 | 1036 | } | |
1157 | 1037 | else throw("Strict value is not equal to itself.") | |
1158 | 1038 | } | |
1159 | 1039 | else { | |
1160 | - | let $t03584435956 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
1161 | - | let userStaked = $t03584435956._1 | |
1162 | - | let axlyFee = $t03584435956._2 | |
1163 | - | let $t03596236077 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1164 | - | let wAmountA = $t03596236077._1 | |
1165 | - | let wAmountB = $t03596236077._2 | |
1166 | - | (replenishEntries(pool, toString(i.caller), userStaked, axlyFee, newPosNum, shareId, pType, false) ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])) | |
1040 | + | let $t03295133063 = replenishByType(pType, pool, NO_LOAN_FEE, pmtA, AId, pmtB, BId, balA, balB, shareId) | |
1041 | + | let userStaked = $t03295133063._1 | |
1042 | + | let axlyFee = $t03295133063._2 | |
1043 | + | let $t03306933163 = getPoolBalances(Address(fromBase58String(pool)), pType, AId, BId) | |
1044 | + | if (($t03306933163 == $t03306933163)) | |
1045 | + | then { | |
1046 | + | let newBalB = $t03306933163._2 | |
1047 | + | let newBalA = $t03306933163._1 | |
1048 | + | let prImpact = calcPriceImpact(balA, balB, newBalA, newBalB) | |
1049 | + | let $t03323333348 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1050 | + | let wAmountA = $t03323333348._1 | |
1051 | + | let wAmountB = $t03323333348._2 | |
1052 | + | $Tuple2((replenishEntries(pool, user, userStaked, axlyFee, newPosNum, shareId, pType, false) ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])), [prImpact, wAmountA, wAmountB]) | |
1053 | + | } | |
1054 | + | else throw("Strict value is not equal to itself.") | |
1167 | 1055 | } | |
1168 | 1056 | } | |
1169 | 1057 | ||
1170 | 1058 | ||
1171 | 1059 | ||
1172 | 1060 | @Callable(i) | |
1173 | 1061 | func withdraw (pool,posId) = withdrawToUser(toString(i.caller), pool, toString(posId), false) | |
1174 | 1062 | ||
1175 | 1063 | ||
1176 | 1064 | ||
1177 | 1065 | @Callable(i) | |
1178 | 1066 | func createUpdateStopLoss (posId,poolId,assetId,price) = { | |
1179 | 1067 | let tokenOraclePrice = getIntegerValue(priceOracleAddr, (assetId + kPriceInOracle)) | |
1180 | 1068 | if (!(isDefined(getInteger(this, (((((poolId + "_") + toString(i.caller)) + "_") + toString(posId)) + kUserPosition))))) | |
1181 | 1069 | then throw("There are no user position") | |
1182 | 1070 | else if ((0 >= price)) | |
1183 | 1071 | then throw("Price must be greater than 0") | |
1184 | 1072 | else if ((price > tokenOraclePrice)) | |
1185 | 1073 | then throw("Price must be less than current token price") | |
1186 | 1074 | else [IntegerEntry((((((((toString(i.caller) + "_") + toString(posId)) + "_") + poolId) + "_") + assetId) + kUserStopLoss), price)] | |
1187 | 1075 | } | |
1188 | 1076 | ||
1189 | 1077 | ||
1190 | 1078 | ||
1191 | 1079 | @Callable(i) | |
1192 | 1080 | func deleteStopLoss (posId,poolId,assetId) = if (!(isDefined(getInteger(this, (((((((toString(i.caller) + "_") + toString(posId)) + "_") + poolId) + "_") + assetId) + kUserStopLoss))))) | |
1193 | 1081 | then throw("No entry") | |
1194 | 1082 | else [DeleteEntry((((((((toString(i.caller) + "_") + toString(posId)) + "_") + poolId) + "_") + assetId) + kUserStopLoss))] | |
1195 | 1083 | ||
1196 | 1084 | ||
1197 | 1085 | ||
1198 | 1086 | @Callable(i) | |
1199 | 1087 | func init (moneyBoxAddr,sfFarmingAddr,lendAddr,priceOracleAddr,keeperExContract,wxSwapContract,swopAssetId,wxAssetId,adminPubKey) = if (isDefined(getString(kMoneyBox))) | |
1200 | 1088 | then throw("Already inited") | |
1201 | 1089 | 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)] | |
1202 | 1090 | ||
1203 | 1091 | ||
1204 | 1092 | ||
1205 | 1093 | @Callable(i) | |
1206 | 1094 | func createNewRequest (params) = valueOrElse(isSelfCall(i), { | |
1207 | 1095 | let newRequestId = (valueOrElse(getInteger(this, kRequestIter), 0) + 1) | |
1208 | 1096 | $Tuple2([StringEntry((toString(newRequestId) + kRequestId), params), IntegerEntry(kRequestIter, newRequestId)], newRequestId) | |
1209 | 1097 | }) | |
1210 | 1098 | ||
1211 | 1099 | ||
1212 | 1100 | ||
1213 | 1101 | @Callable(i) | |
1214 | 1102 | func replenishFromLand (requestId) = valueOrElse(isLandCall(i), { | |
1215 | - | let $ | |
1216 | - | let user = $ | |
1217 | - | let pool = $ | |
1218 | - | let pmtA = $ | |
1219 | - | let AId = $ | |
1220 | - | let pmtB = $ | |
1221 | - | let BId = $ | |
1222 | - | let balA = $ | |
1223 | - | let balB = $ | |
1224 | - | let shareId = $ | |
1225 | - | let bwAsset = $ | |
1226 | - | let bwAmount = $ | |
1103 | + | let $t03587435978 = parseRequest(requestId) | |
1104 | + | let user = $t03587435978._1 | |
1105 | + | let pool = $t03587435978._2 | |
1106 | + | let pmtA = $t03587435978._3 | |
1107 | + | let AId = $t03587435978._4 | |
1108 | + | let pmtB = $t03587435978._5 | |
1109 | + | let BId = $t03587435978._6 | |
1110 | + | let balA = $t03587435978._7 | |
1111 | + | let balB = $t03587435978._8 | |
1112 | + | let shareId = $t03587435978._9 | |
1113 | + | let bwAsset = $t03587435978._10 | |
1114 | + | let bwAmount = $t03587435978._11 | |
1227 | 1115 | if ((size(i.payments) != 1)) | |
1228 | 1116 | then throw("Wrong payment size") | |
1229 | 1117 | else if (if ((assetIdToStr(i.payments[0].assetId) != bwAsset)) | |
1230 | 1118 | then true | |
1231 | 1119 | else (i.payments[0].amount != bwAmount)) | |
1232 | 1120 | then throw("Wrong payment") | |
1233 | 1121 | else { | |
1234 | - | let $ | |
1122 | + | let $t03616836292 = if ((AId == bwAsset)) | |
1235 | 1123 | then $Tuple2((pmtA + i.payments[0].amount), pmtB) | |
1236 | 1124 | else $Tuple2(pmtA, (pmtB + i.payments[0].amount)) | |
1237 | - | let pmtAllA = $ | |
1238 | - | let pmtAllB = $ | |
1125 | + | let pmtAllA = $t03616836292._1 | |
1126 | + | let pmtAllB = $t03616836292._2 | |
1239 | 1127 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Unknown pool") | |
1240 | - | let $ | |
1241 | - | let userStaked = $ | |
1242 | - | let axlyFee = $ | |
1128 | + | let $t03637436489 = replenishByType(pType, pool, LOAN_FEE, pmtAllA, AId, pmtAllB, BId, balA, balB, shareId) | |
1129 | + | let userStaked = $t03637436489._1 | |
1130 | + | let axlyFee = $t03637436489._2 | |
1243 | 1131 | let posNum = getNewUserPositionNumber(user) | |
1244 | 1132 | let borrowEntries = [IntegerEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAmount), bwAmount), StringEntry((((((pool + "_") + user) + "_") + toString(posNum)) + kUserBorrowAssetId), bwAsset)] | |
1245 | 1133 | let entries = replenishEntries(pool, user, userStaked, axlyFee, posNum, shareId, pType, true) | |
1246 | - | let $ | |
1247 | - | let wAmountA = $ | |
1248 | - | let wAmountB = $ | |
1134 | + | let $t03684936964 = calcWithdrawLPFromPoolVirt(Address(fromBase58String(pool)), pType, shareId, userStaked) | |
1135 | + | let wAmountA = $t03684936964._1 | |
1136 | + | let wAmountB = $t03684936964._2 | |
1249 | 1137 | $Tuple2((((entries ++ getCursEntries(AId, BId, shareId, [toString(wAmountA), toString(wAmountB)])) ++ borrowEntries) :+ DeleteEntry((requestId + kRequestId))), userStaked) | |
1250 | 1138 | } | |
1251 | 1139 | }) | |
1252 | 1140 | ||
1253 | 1141 | ||
1254 | 1142 | ||
1255 | 1143 | @Callable(i) | |
1256 | 1144 | func liquidate (user,posId,liquidateAmount) = valueOrElse(isLandCall(i), { | |
1257 | 1145 | let pool = valueOrErrorMessage(getString(this, (((user + "_") + posId) + kUserPositionPool)), "no position") | |
1258 | 1146 | let pType = valueOrErrorMessage(getString(this, (kPool + pool)), "Pool is not inited") | |
1259 | - | let $ | |
1260 | - | let AId = $ | |
1261 | - | let BId = $ | |
1262 | - | let balA = $ | |
1263 | - | let balB = $ | |
1264 | - | let shareId = $ | |
1147 | + | let $t03745837548 = getPoolData(Address(fromBase58String(pool)), pType) | |
1148 | + | let AId = $t03745837548._1 | |
1149 | + | let BId = $t03745837548._2 | |
1150 | + | let balA = $t03745837548._3 | |
1151 | + | let balB = $t03745837548._4 | |
1152 | + | let shareId = $t03745837548._5 | |
1265 | 1153 | let amount = unstakeLP(pool, pType, shareId, liquidateAmount) | |
1266 | 1154 | let borrowAmount = getIntegerValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAmount)) | |
1267 | 1155 | let borrowAsset = getStringValue(this, (((((pool + "_") + user) + "_") + posId) + kUserBorrowAssetId)) | |
1268 | 1156 | let userCanWithdraw = userCanWithdrawShareCalc(user, pool, posId, (borrowAmount > 0)) | |
1269 | 1157 | if ((borrowAmount == 0)) | |
1270 | 1158 | then throw("You can't liquidate position without borrow") | |
1271 | 1159 | 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))] | |
1272 | 1160 | }) | |
1273 | 1161 | ||
1274 | 1162 | ||
1275 | 1163 | ||
1276 | 1164 | @Callable(i) | |
1277 | 1165 | func stopLoss (user,posId,pool,assetId) = valueOrElse(isAdminCall(i), { | |
1278 | 1166 | let tokenOraclePrice = getIntegerValue(priceOracleAddr, (assetId + kPriceInOracle)) | |
1279 | 1167 | if (!(isDefined(getInteger(this, (((((((user + "_") + toString(posId)) + "_") + pool) + "_") + assetId) + kUserStopLoss))))) | |
1280 | 1168 | then throw("No entry") | |
1281 | 1169 | else (withdrawToUser(toString(i.caller), pool, toString(posId), true) :+ DeleteEntry((((((((user + "_") + toString(posId)) + "_") + pool) + "_") + assetId) + kUserStopLoss))) | |
1282 | 1170 | }) | |
1283 | 1171 | ||
1284 | 1172 | ||
1285 | 1173 | ||
1286 | 1174 | @Callable(i) | |
1287 | 1175 | func capitalizeExKeeper (pool,type,tokenToId,amountToExchange,claim,amountsIn,addresses,assetsToReceive,estReceived,slippageTolerance,minReceived,options) = valueOrElse(isAdminCall(i), { | |
1288 | - | let $ | |
1176 | + | let $t03931139505 = if (claim) | |
1289 | 1177 | then claimFarmed(type, pool) | |
1290 | 1178 | else { | |
1291 | 1179 | let claimedAsset = if ((type == SF_POOL)) | |
1292 | 1180 | then SWOPID | |
1293 | 1181 | else WXID | |
1294 | 1182 | $Tuple2(amountToExchange, claimedAsset) | |
1295 | 1183 | } | |
1296 | - | let claimedAmount = $ | |
1297 | - | let claimedAsset = $ | |
1184 | + | let claimedAmount = $t03931139505._1 | |
1185 | + | let claimedAsset = $t03931139505._2 | |
1298 | 1186 | let exchangedAmount = exchangeKeeper(tokenToId, amountToExchange, claimedAsset, amountsIn, addresses, assetsToReceive, estReceived, slippageTolerance, minReceived, options) | |
1299 | 1187 | let change = (claimedAmount - amountToExchange) | |
1300 | 1188 | let changeEntry = if ((change > 0)) | |
1301 | 1189 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
1302 | 1190 | else nil | |
1303 | 1191 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
1304 | 1192 | }) | |
1305 | 1193 | ||
1306 | 1194 | ||
1307 | 1195 | ||
1308 | 1196 | @Callable(i) | |
1309 | 1197 | func capitalizeExPuzzle (pool,type,tokenToId,amountToExchange,claim,routesStr,minToReceive,options) = valueOrElse(isAdminCall(i), { | |
1310 | - | let $ | |
1198 | + | let $t04019040384 = if (claim) | |
1311 | 1199 | then claimFarmed(type, pool) | |
1312 | 1200 | else { | |
1313 | 1201 | let claimedAsset = if ((type == SF_POOL)) | |
1314 | 1202 | then SWOPID | |
1315 | 1203 | else WXID | |
1316 | 1204 | $Tuple2(amountToExchange, claimedAsset) | |
1317 | 1205 | } | |
1318 | - | let claimedAmount = $ | |
1319 | - | let claimedAsset = $ | |
1206 | + | let claimedAmount = $t04019040384._1 | |
1207 | + | let claimedAsset = $t04019040384._2 | |
1320 | 1208 | let exchangedAmount = exchangePuzzle(tokenToId, amountToExchange, claimedAsset, routesStr, minToReceive, options) | |
1321 | 1209 | let change = (claimedAmount - amountToExchange) | |
1322 | 1210 | let changeEntry = if ((change > 0)) | |
1323 | 1211 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
1324 | 1212 | else nil | |
1325 | 1213 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
1326 | 1214 | }) | |
1327 | 1215 | ||
1328 | 1216 | ||
1329 | 1217 | ||
1330 | 1218 | @Callable(i) | |
1331 | 1219 | func capitalizeExSwopFi (pool,type,tokenToId,amountToExchange,claim,exchangers,exchangersType,args1,args2,routingAssetsKeys,minAmountToReceive,options) = valueOrElse(isAdminCall(i), { | |
1332 | - | let $ | |
1220 | + | let $t04113541329 = if (claim) | |
1333 | 1221 | then claimFarmed(type, pool) | |
1334 | 1222 | else { | |
1335 | 1223 | let claimedAsset = if ((type == SF_POOL)) | |
1336 | 1224 | then SWOPID | |
1337 | 1225 | else WXID | |
1338 | 1226 | $Tuple2(amountToExchange, claimedAsset) | |
1339 | 1227 | } | |
1340 | - | let claimedAmount = $ | |
1341 | - | let claimedAsset = $ | |
1228 | + | let claimedAmount = $t04113541329._1 | |
1229 | + | let claimedAsset = $t04113541329._2 | |
1342 | 1230 | let exchangedAmount = exchangeSwopFi(tokenToId, amountToExchange, claimedAsset, exchangers, exchangersType, args1, args2, routingAssetsKeys, minAmountToReceive, options) | |
1343 | 1231 | let change = (claimedAmount - amountToExchange) | |
1344 | 1232 | let changeEntry = if ((change > 0)) | |
1345 | 1233 | then [IntegerEntry((pool + kPoolCapChange), (change + valueOrElse(getInteger(this, (pool + kPoolCapChange)), 0)))] | |
1346 | 1234 | else nil | |
1347 | 1235 | (capitalize(pool, type, tokenToId, exchangedAmount) ++ changeEntry) | |
1348 | 1236 | }) | |
1349 | 1237 | ||
1350 | 1238 | ||
1351 | 1239 | ||
1352 | 1240 | @Callable(i) | |
1353 | 1241 | func initNewPool (type,poolAddr,inFeeNoLoan,inFeeLoan,capFeeNoLoan,capFeeWithLoan,stoplossFeeNoLoan,stoplossFeeWithLoan,canBorrow) = valueOrElse(isAdminCall(i), if (if ((type != SF_POOL)) | |
1354 | 1242 | then (type != WX_POOL) | |
1355 | 1243 | else false) | |
1356 | 1244 | then throw("Wrong type") | |
1357 | 1245 | else { | |
1358 | - | let $ | |
1359 | - | let aId = $ | |
1360 | - | let bId = $ | |
1361 | - | let aBal = $ | |
1362 | - | let bBal = $ | |
1363 | - | let shareId = $ | |
1246 | + | let $t04207042164 = getPoolData(Address(fromBase58String(poolAddr)), type) | |
1247 | + | let aId = $t04207042164._1 | |
1248 | + | let bId = $t04207042164._2 | |
1249 | + | let aBal = $t04207042164._3 | |
1250 | + | let bBal = $t04207042164._4 | |
1251 | + | let shareId = $t04207042164._5 | |
1364 | 1252 | [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)] | |
1365 | 1253 | }) | |
1366 | 1254 | ||
1367 | 1255 | ||
1368 | 1256 | @Verifier(tx) | |
1369 | 1257 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
1370 | 1258 |
github/deemru/w8io/026f985 194.96 ms ◑