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