tx · EGBLnMB1KVSq11AR38xr4j5WLjmgbqUdbv3iy4FYUxNb 3N8rRK2qY9gks7UiTZbno3oU9ZxHsjf6Nxg: -0.03700000 Waves 2022.09.07 11:27 [2218451] smart account 3N8rRK2qY9gks7UiTZbno3oU9ZxHsjf6Nxg > SELF 0.00000000 Waves
{ "type": 13, "id": "EGBLnMB1KVSq11AR38xr4j5WLjmgbqUdbv3iy4FYUxNb", "fee": 3700000, "feeAssetId": null, "timestamp": 1662539241008, "version": 2, "chainId": 84, "sender": "3N8rRK2qY9gks7UiTZbno3oU9ZxHsjf6Nxg", "senderPublicKey": "BGaHqWWh2PA55UDpG3EMuoSRrrPo348kqpXax829kygz", "proofs": [ "4q3Pgr6iHPj5ndYABWUNWptEFtMeoGDKE2eJUn8cbj7nx6L5oVLoGd6vrmzHQJcnVydBuUZVHd2GKhjKagFwW7fs", "nt1WVLJCyHK17amPyX5BGTZFvgxB99XfvBBkKnuLwUsqSw637pUWkWHodp3ExhdX4qGqmQUHSG3Xjs2GXxQEv4K" ], "script": "base64:BgJjCAISBAoCEQESBgoECAEBBBIECgIBBBIDCgEBEgYKBAgIAQgSBAoCCAESAwoBERIECgIRARIFCgMBCAgSBAoCCAESBQoDCAEBEgASABIECgIRBBIECgIBARIAEgASABIDCgEBXQAJUFJFQ0lTSU9OAMCEPQAFTUFYX0EAwIQ9AAxNQVhfQV9DSEFOR0UACgAIREVDSU1BTFMABgANTUlOX1JBTVBfVElNRQkAaQIAgKMFADwAB3ZlcnNpb24CBTMuMC4wAAhrVmVyc2lvbgIHdmVyc2lvbgAHa0Fzc2V0cwIJYXNzZXRfaWRzAA1rQXNzZXRCYWxhbmNlAghfYmFsYW5jZQAHa0FjdGl2ZQIGYWN0aXZlAAZrQ2F1c2UCDnNodXRkb3duX2NhdXNlAA1rU2hhcmVBc3NldElkAg5zaGFyZV9hc3NldF9pZAARa1NoYXJlQXNzZXRTdXBwbHkCEnNoYXJlX2Fzc2V0X3N1cHBseQAEa0ZlZQI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entComplexity": 0 } View: original | compacted Prev: 5YdwjdmbsLb2JEDf8wDCL6akoENR8wpxrPuiSRFpuTWC Next: 2de1y9tzD6ABXeXDSppAMtJnkocxi3rQoWAXaxcMzfem Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let version = "3.0.0" | |
5 | - | ||
6 | 4 | let PRECISION = 1000000 | |
7 | 5 | ||
8 | 6 | let MAX_A = 1000000 | |
12 | 10 | let DECIMALS = 6 | |
13 | 11 | ||
14 | 12 | let MIN_RAMP_TIME = (86400 / 60) | |
13 | + | ||
14 | + | let version = "3.0.0" | |
15 | + | ||
16 | + | let kVersion = "version" | |
15 | 17 | ||
16 | 18 | let kAssets = "asset_ids" | |
17 | 19 | ||
93 | 95 | ||
94 | 96 | let farmingAddress = Address(getBase58FromOracle(kFarmingAddress)) | |
95 | 97 | ||
96 | - | let capMoneyBoxAddress = Address(base58' | |
98 | + | let capMoneyBoxAddress = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
97 | 99 | ||
98 | 100 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
99 | 101 | ||
287 | 289 | else $Tuple2(D, false) | |
288 | 290 | } | |
289 | 291 | ||
290 | - | let $ | |
292 | + | let $t066756787 = { | |
291 | 293 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
292 | 294 | let $s = size($l) | |
293 | 295 | let $acc0 = $Tuple2(toBigInt(S), false) | |
301 | 303 | ||
302 | 304 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
303 | 305 | } | |
304 | - | let D = $ | |
305 | - | let finished = $ | |
306 | + | let D = $t066756787._1 | |
307 | + | let finished = $t066756787._2 | |
306 | 308 | if ((finished == false)) | |
307 | 309 | then throw(("get_D() not finished with " + toString(D))) | |
308 | 310 | else toInt(D) | |
328 | 330 | let D = get_D(xp_, amp) | |
329 | 331 | let Ann = (amp * nCoins) | |
330 | 332 | func S_c (acc,i) = { | |
331 | - | let $ | |
332 | - | let S_ = $ | |
333 | - | let c = $ | |
333 | + | let $t073587375 = acc | |
334 | + | let S_ = $t073587375._1 | |
335 | + | let c = $t073587375._2 | |
334 | 336 | let x_ = if ((in == i)) | |
335 | 337 | then x | |
336 | 338 | else xp_[i] | |
341 | 343 | else $Tuple2(S_, c) | |
342 | 344 | } | |
343 | 345 | ||
344 | - | let $ | |
346 | + | let $t075837684 = { | |
345 | 347 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
346 | 348 | let $s = size($l) | |
347 | 349 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
355 | 357 | ||
356 | 358 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
357 | 359 | } | |
358 | - | let S_ = $ | |
359 | - | let c_ = $ | |
360 | + | let S_ = $t075837684._1 | |
361 | + | let c_ = $t075837684._2 | |
360 | 362 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
361 | 363 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
362 | 364 | func y_proc (acc,_i) = if ((acc._2 == true)) | |
373 | 375 | else $Tuple2(y, false) | |
374 | 376 | } | |
375 | 377 | ||
376 | - | let $ | |
378 | + | let $t081668283 = { | |
377 | 379 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
378 | 380 | let $s = size($l) | |
379 | 381 | let $acc0 = $Tuple2(toBigInt(D), false) | |
387 | 389 | ||
388 | 390 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
389 | 391 | } | |
390 | - | let y = $ | |
391 | - | let finished = $ | |
392 | + | let y = $t081668283._1 | |
393 | + | let finished = $t081668283._2 | |
392 | 394 | if ((finished == false)) | |
393 | 395 | then throw(("getY() not finished with " + toString(y))) | |
394 | 396 | else toInt(y) | |
402 | 404 | else { | |
403 | 405 | let Ann = (A_ * nCoins) | |
404 | 406 | func S_c (acc,i) = { | |
405 | - | let $ | |
406 | - | let S_ = $ | |
407 | - | let c = $ | |
407 | + | let $t086628679 = acc | |
408 | + | let S_ = $t086628679._1 | |
409 | + | let c = $t086628679._2 | |
408 | 410 | let x_ = if (if ((in != i)) | |
409 | 411 | then (nCoins > i) | |
410 | 412 | else false) | |
417 | 419 | else $Tuple2(S_, c) | |
418 | 420 | } | |
419 | 421 | ||
420 | - | let $ | |
422 | + | let $t088999000 = { | |
421 | 423 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
422 | 424 | let $s = size($l) | |
423 | 425 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
431 | 433 | ||
432 | 434 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
433 | 435 | } | |
434 | - | let S_ = $ | |
435 | - | let c_ = $ | |
436 | + | let S_ = $t088999000._1 | |
437 | + | let c_ = $t088999000._2 | |
436 | 438 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
437 | 439 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
438 | 440 | func y_D_proc (acc,i) = if ((acc._2 == true)) | |
449 | 451 | else $Tuple2(y, false) | |
450 | 452 | } | |
451 | 453 | ||
452 | - | let $ | |
454 | + | let $t094839602 = { | |
453 | 455 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
454 | 456 | let $s = size($l) | |
455 | 457 | let $acc0 = $Tuple2(toBigInt(D), false) | |
463 | 465 | ||
464 | 466 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
465 | 467 | } | |
466 | - | let y = $ | |
467 | - | let finished = $ | |
468 | + | let y = $t094839602._1 | |
469 | + | let finished = $t094839602._2 | |
468 | 470 | if ((finished == false)) | |
469 | 471 | then throw(("get_y_D() not finished with " + toString(y))) | |
470 | 472 | else toInt(y) | |
481 | 483 | let new_y = get_y_D(amp, i, xp, D1) | |
482 | 484 | let dy_0 = (xp[i] - new_y) | |
483 | 485 | func xp_reduced_proc (acc,xp_j) = { | |
484 | - | let $ | |
485 | - | let xp_reduced = $ | |
486 | - | let index = $ | |
486 | + | let $t01024310272 = acc | |
487 | + | let xp_reduced = $t01024310272._1 | |
488 | + | let index = $t01024310272._2 | |
487 | 489 | let dx_expected = if ((index == i)) | |
488 | 490 | then (fraction(xp_j, D1, D0) - new_y) | |
489 | 491 | else (xp_j - fraction(xp_j, D1, D0)) | |
490 | 492 | $Tuple2((xp_reduced :+ (xp_j - fraction(_fee, dx_expected, feeScale6))), (index + 1)) | |
491 | 493 | } | |
492 | 494 | ||
493 | - | let $ | |
495 | + | let $t01053410598 = { | |
494 | 496 | let $l = xp | |
495 | 497 | let $s = size($l) | |
496 | 498 | let $acc0 = $Tuple2(nil, 0) | |
504 | 506 | ||
505 | 507 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
506 | 508 | } | |
507 | - | let xp_reduced = $ | |
508 | - | let index = $ | |
509 | + | let xp_reduced = $t01053410598._1 | |
510 | + | let index = $t01053410598._2 | |
509 | 511 | let xp_reduced_i = xp_reduced[i] | |
510 | 512 | let dy = ((xp_reduced_i - get_y_D(amp, i, xp_reduced, D1)) - 1) | |
511 | 513 | $Tuple2(dy, (dy_0 - dy)) | |
529 | 531 | ||
530 | 532 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
531 | 533 | then { | |
532 | - | let $ | |
533 | - | let call = $ | |
534 | - | let stakingAddr = $ | |
534 | + | let $t01116211228 = calcStakingFuncAndAddres(stake, assetId) | |
535 | + | let call = $t01116211228._1 | |
536 | + | let stakingAddr = $t01116211228._2 | |
535 | 537 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
536 | 538 | } | |
537 | 539 | else { | |
538 | - | let $ | |
539 | - | let call = $ | |
540 | - | let stakingAddr = $ | |
540 | + | let $t01131411380 = calcStakingFuncAndAddres(stake, assetId) | |
541 | + | let call = $t01131411380._1 | |
542 | + | let stakingAddr = $t01131411380._2 | |
541 | 543 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
542 | 544 | } | |
543 | 545 | ||
544 | 546 | ||
545 | 547 | func stake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
546 | 548 | then { | |
547 | - | let $ | |
548 | - | let call = $ | |
549 | - | let addr = $ | |
550 | - | let params = $ | |
551 | - | let payments = $ | |
549 | + | let $t01156711669 = calcStakingParams(true, amount, fromBase58String(assetIdString)) | |
550 | + | let call = $t01156711669._1 | |
551 | + | let addr = $t01156711669._2 | |
552 | + | let params = $t01156711669._3 | |
553 | + | let payments = $t01156711669._4 | |
552 | 554 | invoke(addr, call, params, payments) | |
553 | 555 | } | |
554 | 556 | else 0 | |
556 | 558 | ||
557 | 559 | func unstake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
558 | 560 | then { | |
559 | - | let $ | |
560 | - | let call = $ | |
561 | - | let addr = $ | |
562 | - | let params = $ | |
563 | - | let payments = $ | |
561 | + | let $t01185411957 = calcStakingParams(false, amount, fromBase58String(assetIdString)) | |
562 | + | let call = $t01185411957._1 | |
563 | + | let addr = $t01185411957._2 | |
564 | + | let params = $t01185411957._3 | |
565 | + | let payments = $t01185411957._4 | |
564 | 566 | invoke(addr, call, params, payments) | |
565 | 567 | } | |
566 | 568 | else 0 | |
589 | 591 | func checkSuspicious () = { | |
590 | 592 | let contractBalances = _xp() | |
591 | 593 | func checkBalance (acc,assetId) = { | |
592 | - | let $ | |
593 | - | let suspicious = $ | |
594 | - | let i = $ | |
594 | + | let $t01256812593 = acc | |
595 | + | let suspicious = $t01256812593._1 | |
596 | + | let i = $t01256812593._2 | |
595 | 597 | if (suspicious) | |
596 | 598 | then $Tuple2(suspicious, i) | |
597 | 599 | else { | |
684 | 686 | ||
685 | 687 | ||
686 | 688 | @Callable(msg) | |
687 | - | func init (assetIds,_A,firstHarvest) = if (!(isDataStorageUntouched(this))) | |
689 | + | func init (assetIds,_A,_dAppThresholdCoef,firstHarvest) = if (!(isDataStorageUntouched(this))) | |
688 | 690 | then throw("Already initialized") | |
689 | - | else { | |
690 | - | let shareName = "s_Multi_USD" | |
691 | - | let shareDescription = ("ShareToken of SwopFi protocol for MultiStable USD pool at address " + toString(this)) | |
692 | - | let issueToken = Issue(shareName, shareDescription, 0, 6, true) | |
693 | - | let tokenId = calculateAssetId(issueToken) | |
694 | - | if (checkCoins(assetIds)) | |
695 | - | then throw() | |
691 | + | else if ((0 >= _A)) | |
692 | + | then throw("Amp must be must > 0") | |
693 | + | else if ((0 >= _dAppThresholdCoef)) | |
694 | + | then throw("dApp Threshold Coef must be > 0") | |
696 | 695 | else { | |
697 | - | let baseEntry = [StringEntry(kAssets, assetIds), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), IntegerEntry(kDAppThresholdCoef, 15), BooleanEntry(kActive, true), issueToken] | |
698 | - | if (firstHarvest) | |
699 | - | then (baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
700 | - | else baseEntry | |
696 | + | let shareName = "s_Multi_USD" | |
697 | + | let shareDescription = ("ShareToken of SwopFi protocol for MultiStable USD pool at address " + toString(this)) | |
698 | + | let issueToken = Issue(shareName, shareDescription, 0, 6, true) | |
699 | + | let tokenId = calculateAssetId(issueToken) | |
700 | + | if (checkCoins(assetIds)) | |
701 | + | then throw() | |
702 | + | else { | |
703 | + | let baseEntry = [StringEntry(kVersion, version), StringEntry(kAssets, assetIds), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), IntegerEntry(kDAppThresholdCoef, _dAppThresholdCoef), BooleanEntry(kActive, true), issueToken] | |
704 | + | if (firstHarvest) | |
705 | + | then (baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
706 | + | else baseEntry | |
707 | + | } | |
701 | 708 | } | |
702 | - | } | |
703 | 709 | ||
704 | 710 | ||
705 | 711 | ||
711 | 717 | then 0 | |
712 | 718 | else getDMem(xp, amp) | |
713 | 719 | let payments = msg.payments | |
714 | - | let | |
715 | - | func validPayments (n) = if (( | |
720 | + | let paymentsSize = size(payments) | |
721 | + | func validPayments (n) = if ((paymentsSize > nCoins)) | |
716 | 722 | then throw(("payments size > " + toString(nCoins))) | |
717 | - | else if ((1 > | |
723 | + | else if ((1 > paymentsSize)) | |
718 | 724 | then throw("payments size < 1") | |
719 | 725 | else if (if ((shareSupply == 0)) | |
720 | - | then (nCoins != | |
726 | + | then (nCoins != paymentsSize) | |
721 | 727 | else false) | |
722 | 728 | then throw("initial deposit requires all coins") | |
723 | 729 | else { | |
739 | 745 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
740 | 746 | } | |
741 | 747 | ||
742 | - | if (!(validPayments( | |
748 | + | if (!(validPayments(paymentsSize))) | |
743 | 749 | then throw() | |
744 | 750 | else { | |
745 | 751 | let suspicious = checkSuspicious() | |
746 | 752 | if (suspicious._1) | |
747 | 753 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, payments)) | |
748 | 754 | else { | |
749 | - | let paymentsSize = size(payments) | |
750 | 755 | func parsePayments (acc,assetId) = { | |
751 | - | let $ | |
752 | - | let newBalances = $ | |
753 | - | let i = $ | |
754 | - | let j = $ | |
756 | + | let $t01690116930 = acc | |
757 | + | let newBalances = $t01690116930._1 | |
758 | + | let i = $t01690116930._2 | |
759 | + | let j = $t01690116930._3 | |
755 | 760 | if (if ((paymentsSize > j)) | |
756 | 761 | then (getStrAssetId(payments[j].assetId) == assetId) | |
757 | 762 | else false) | |
758 | - | then { | |
759 | - | let s = stake(payments[j].amount, getStrAssetId(payments[j].assetId)) | |
760 | - | if ((s == s)) | |
761 | - | then $Tuple3((newBalances :+ (xp[i] + payments[j].amount)), (i + 1), (j + 1)) | |
762 | - | else throw("Strict value is not equal to itself.") | |
763 | - | } | |
763 | + | then $Tuple3((newBalances :+ (xp[i] + payments[j].amount)), (i + 1), (j + 1)) | |
764 | 764 | else $Tuple3((newBalances :+ xp[i]), (i + 1), j) | |
765 | 765 | } | |
766 | 766 | ||
767 | - | let $ | |
767 | + | let $t01715017236 = { | |
768 | 768 | let $l = assetIds | |
769 | 769 | let $s = size($l) | |
770 | 770 | let $acc0 = $Tuple3(nil, 0, 0) | |
778 | 778 | ||
779 | 779 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
780 | 780 | } | |
781 | - | let newBalances = $ | |
782 | - | let k = $ | |
783 | - | let parsedPayments = $ | |
784 | - | if (( | |
781 | + | let newBalances = $t01715017236._1 | |
782 | + | let k = $t01715017236._2 | |
783 | + | let parsedPayments = $t01715017236._3 | |
784 | + | if ((paymentsSize > parsedPayments)) | |
785 | 785 | then throw("Incorect payments order") | |
786 | 786 | else if (checkDAppThreshold(newBalances)) | |
787 | 787 | then throw() | |
792 | 792 | else { | |
793 | 793 | let feeDiscount = calculateFeeDiscount(msg.caller) | |
794 | 794 | func calcScriptActions (acc,newBalance) = { | |
795 | - | let $ | |
796 | - | let invBalances = $ | |
797 | - | let scriptActions = $ | |
798 | - | let i = $ | |
795 | + | let $t01763717678 = acc | |
796 | + | let invBalances = $t01763717678._1 | |
797 | + | let scriptActions = $t01763717678._2 | |
798 | + | let i = $t01763717678._3 | |
799 | 799 | if ((shareSupply > 0)) | |
800 | 800 | then { | |
801 | 801 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
807 | 807 | fraction(_fee, difference, feeScale6) | |
808 | 808 | } | |
809 | 809 | let governanceFees = fraction(fees, feeGovernance, feeScale6) | |
810 | - | let finalBalance = (newBalance - | |
810 | + | let finalBalance = (newBalance - fees) | |
811 | 811 | let invariantBalance = (newBalance - fees) | |
812 | - | let us = unstake(fees, assetIds[i]) | |
813 | - | if ((us == us)) | |
812 | + | let pmt = (newBalance - xp[i]) | |
813 | + | let inv = if ((pmt > 0)) | |
814 | + | then stake((pmt - fees), assetIds[i]) | |
815 | + | else unstake(fees, assetIds[i]) | |
816 | + | if ((inv == inv)) | |
814 | 817 | then $Tuple3((invBalances :+ invariantBalance), (scriptActions ++ [ScriptTransfer(capMoneyBoxAddress, (fees - governanceFees), fromBase58String(assetIds[i])), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(assetIds[i])), IntegerEntry((assetIds[i] + kAssetBalance), finalBalance)]), (i + 1)) | |
815 | 818 | else throw("Strict value is not equal to itself.") | |
816 | 819 | } | |
817 | - | else $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
820 | + | else { | |
821 | + | let inv = stake(newBalance, assetIds[i]) | |
822 | + | if ((inv == inv)) | |
823 | + | then $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
824 | + | else throw("Strict value is not equal to itself.") | |
825 | + | } | |
818 | 826 | } | |
819 | 827 | ||
820 | - | let $ | |
828 | + | let $t01922619314 = { | |
821 | 829 | let $l = newBalances | |
822 | 830 | let $s = size($l) | |
823 | 831 | let $acc0 = $Tuple3(nil, nil, 0) | |
831 | 839 | ||
832 | 840 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
833 | 841 | } | |
834 | - | let invBalances = $ | |
835 | - | let scriptActions = $ | |
842 | + | let invBalances = $t01922619314._1 | |
843 | + | let scriptActions = $t01922619314._2 | |
836 | 844 | let D2 = getDMem(invBalances, amp) | |
837 | 845 | let mint_amount = if ((shareSupply == 0)) | |
838 | 846 | then D1 | |
906 | 914 | then throw("Exchange resulted in fewer coins than expected") | |
907 | 915 | else { | |
908 | 916 | func makeNewBalances (acc,tokenBalance) = { | |
909 | - | let $ | |
910 | - | let newBalances = $ | |
911 | - | let i = $ | |
917 | + | let $t02202622052 = acc | |
918 | + | let newBalances = $t02202622052._1 | |
919 | + | let i = $t02202622052._2 | |
912 | 920 | if ((i == fromIndex)) | |
913 | 921 | then $Tuple2((newBalances :+ (tokenBalance + dx)), (i + 1)) | |
914 | 922 | else if ((i == toIndex)) | |
916 | 924 | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
917 | 925 | } | |
918 | 926 | ||
919 | - | let $ | |
927 | + | let $t02230322364 = { | |
920 | 928 | let $l = xp | |
921 | 929 | let $s = size($l) | |
922 | 930 | let $acc0 = $Tuple2(nil, 0) | |
930 | 938 | ||
931 | 939 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
932 | 940 | } | |
933 | - | let newBalances = $ | |
934 | - | let i = $ | |
941 | + | let newBalances = $t02230322364._1 | |
942 | + | let i = $t02230322364._2 | |
935 | 943 | if (checkDAppThreshold(newBalances)) | |
936 | 944 | then throw() | |
937 | 945 | else { | |
940 | 948 | then { | |
941 | 949 | let us = unstake(_dy, tokenOut) | |
942 | 950 | if ((us == us)) | |
943 | - | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), (xp[toIndex] - _dy)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), ScriptTransfer(capMoneyBoxAddress, (_fee - governanceFees), tokenOutB58)], | |
951 | + | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), (xp[toIndex] - _dy)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), ScriptTransfer(capMoneyBoxAddress, (_fee - governanceFees), tokenOutB58)], [dy, tokenOutB58]) | |
944 | 952 | else throw("Strict value is not equal to itself.") | |
945 | 953 | } | |
946 | 954 | else throw("Strict value is not equal to itself.") | |
952 | 960 | ||
953 | 961 | ||
954 | 962 | @Callable(msg) | |
955 | - | func withdraw (minAmounts | |
963 | + | func withdraw (minAmounts) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
956 | 964 | then throw("size(payments) != 1") | |
965 | + | else { | |
966 | + | let pmtAmount = msg.payments[0].amount | |
967 | + | let pmtAssetId = msg.payments[0].assetId | |
968 | + | if ((shareAssetId != pmtAssetId)) | |
969 | + | then throw("unknown payment token") | |
970 | + | else { | |
971 | + | let suspicious = checkSuspicious() | |
972 | + | if (suspicious._1) | |
973 | + | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
974 | + | else { | |
975 | + | func calcScriptActions (acc,balance) = { | |
976 | + | let $t02350523533 = acc | |
977 | + | let scriptActions = $t02350523533._1 | |
978 | + | let i = $t02350523533._2 | |
979 | + | let wAmount = fraction(balance, pmtAmount, shareSupply) | |
980 | + | if (assert((wAmount >= minAmounts[i]))) | |
981 | + | then throw("Withdrawal resulted in fewer coins than expected") | |
982 | + | else { | |
983 | + | let us = unstake(wAmount, assetIds[i]) | |
984 | + | if ((us == us)) | |
985 | + | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.originCaller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
986 | + | else throw("Strict value is not equal to itself.") | |
987 | + | } | |
988 | + | } | |
989 | + | ||
990 | + | let $t02402324091 = { | |
991 | + | let $l = _xp() | |
992 | + | let $s = size($l) | |
993 | + | let $acc0 = $Tuple2(nil, 0) | |
994 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
995 | + | then $a | |
996 | + | else calcScriptActions($a, $l[$i]) | |
997 | + | ||
998 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
999 | + | then $a | |
1000 | + | else throw("List size exceeds 15") | |
1001 | + | ||
1002 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
1003 | + | } | |
1004 | + | let scriptActions = $t02402324091._1 | |
1005 | + | let i = $t02402324091._2 | |
1006 | + | (scriptActions ++ [Burn(shareAssetId, pmtAmount), IntegerEntry(kShareAssetSupply, (shareSupply - pmtAmount))]) | |
1007 | + | } | |
1008 | + | } | |
1009 | + | }) | |
1010 | + | ||
1011 | + | ||
1012 | + | ||
1013 | + | @Callable(msg) | |
1014 | + | func withdrawWithUnlock (minAmounts,unlockAmount) = valueOrElse(isActive(), if ((0 >= unlockAmount)) | |
1015 | + | then throw("Unlock amount must be positive") | |
957 | 1016 | else { | |
958 | 1017 | let suspicious = checkSuspicious() | |
959 | 1018 | if (suspicious._1) | |
960 | 1019 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
961 | 1020 | else { | |
962 | - | let payment = msg.payments[0] | |
963 | - | let tokenIn = payment.assetId | |
964 | - | if ((tokenIn != shareAssetId)) | |
965 | - | then throw("unknown token") | |
966 | - | else { | |
967 | - | let _amount = payment.amount | |
968 | - | let total_supply = shareSupply | |
969 | - | let unlock = if ((unlockAmount > 0)) | |
970 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
971 | - | else 0 | |
972 | - | if ((unlock == unlock)) | |
973 | - | then { | |
974 | - | let withdrawAmount = (_amount + unlockAmount) | |
975 | - | func calcScriptActions (acc,balance) = { | |
976 | - | let $t02336823396 = acc | |
977 | - | let scriptActions = $t02336823396._1 | |
978 | - | let i = $t02336823396._2 | |
979 | - | let wAmount = fraction(balance, withdrawAmount, total_supply) | |
980 | - | if (assert((wAmount >= minAmounts[i]))) | |
981 | - | then throw("Withdrawal resulted in fewer coins than expected") | |
982 | - | else { | |
983 | - | let us = unstake(wAmount, assetIds[i]) | |
984 | - | if ((us == us)) | |
985 | - | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.caller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
986 | - | else throw("Strict value is not equal to itself.") | |
987 | - | } | |
988 | - | } | |
989 | - | ||
990 | - | let $t02388623954 = { | |
991 | - | let $l = _xp() | |
992 | - | let $s = size($l) | |
993 | - | let $acc0 = $Tuple2(nil, 0) | |
994 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
995 | - | then $a | |
996 | - | else calcScriptActions($a, $l[$i]) | |
997 | - | ||
998 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
999 | - | then $a | |
1000 | - | else throw("List size exceeds 15") | |
1001 | - | ||
1002 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
1003 | - | } | |
1004 | - | let scriptActions = $t02388623954._1 | |
1005 | - | let i = $t02388623954._2 | |
1006 | - | (scriptActions ++ [Burn(shareAssetId, withdrawAmount), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))]) | |
1007 | - | } | |
1021 | + | let pmtAmount = if ((size(msg.payments) > 0)) | |
1022 | + | then if ((size(msg.payments) != 1)) | |
1023 | + | then throw("size(payments) != 1") | |
1024 | + | else { | |
1025 | + | let pmtAssetId = msg.payments[0].assetId | |
1026 | + | if ((shareAssetId != pmtAssetId)) | |
1027 | + | then throw("unknown payment token") | |
1028 | + | else msg.payments[0].amount | |
1029 | + | } | |
1030 | + | else 0 | |
1031 | + | let unlock = invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
1032 | + | if ((unlock == unlock)) | |
1033 | + | then { | |
1034 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
1035 | + | let inv = invoke(this, "withdraw", [minAmounts], [AttachedPayment(shareAssetId, withdrawAmount)]) | |
1036 | + | if ((inv == inv)) | |
1037 | + | then nil | |
1008 | 1038 | else throw("Strict value is not equal to itself.") | |
1009 | 1039 | } | |
1040 | + | else throw("Strict value is not equal to itself.") | |
1010 | 1041 | } | |
1011 | 1042 | }) | |
1012 | 1043 | ||
1021 | 1052 | ||
1022 | 1053 | ||
1023 | 1054 | @Callable(msg) | |
1024 | - | func withdrawOneCoin (tokenOut,minAmount | |
1055 | + | func withdrawOneCoin (tokenOut,minAmount) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
1025 | 1056 | then throw("size(payments) != 1") | |
1057 | + | else { | |
1058 | + | let suspicious = checkSuspicious() | |
1059 | + | if (suspicious._1) | |
1060 | + | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
1061 | + | else { | |
1062 | + | let pmtAmount = msg.payments[0].amount | |
1063 | + | let pmtAssetId = msg.payments[0].assetId | |
1064 | + | if ((pmtAssetId != shareAssetId)) | |
1065 | + | then throw("unknown token") | |
1066 | + | else { | |
1067 | + | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1068 | + | let xp = _xp() | |
1069 | + | let $t02600526087 = _calcWithdrawOneCoin(xp, pmtAmount, outIndex, msg.originCaller) | |
1070 | + | let dy = $t02600526087._1 | |
1071 | + | let dy_fee = $t02600526087._2 | |
1072 | + | if (assert((dy >= minAmount))) | |
1073 | + | then throw("Not enough coins removed") | |
1074 | + | else { | |
1075 | + | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
1076 | + | let dy_and_fee = (dy + dy_fee) | |
1077 | + | func makeNewBalances (acc,tokenBalance) = { | |
1078 | + | let $t02634526371 = acc | |
1079 | + | let newBalances = $t02634526371._1 | |
1080 | + | let i = $t02634526371._2 | |
1081 | + | if ((i == outIndex)) | |
1082 | + | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
1083 | + | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1084 | + | } | |
1085 | + | ||
1086 | + | let $t02653826599 = { | |
1087 | + | let $l = xp | |
1088 | + | let $s = size($l) | |
1089 | + | let $acc0 = $Tuple2(nil, 0) | |
1090 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1091 | + | then $a | |
1092 | + | else makeNewBalances($a, $l[$i]) | |
1093 | + | ||
1094 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1095 | + | then $a | |
1096 | + | else throw("List size exceeds 15") | |
1097 | + | ||
1098 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
1099 | + | } | |
1100 | + | let newBalances = $t02653826599._1 | |
1101 | + | let v = $t02653826599._2 | |
1102 | + | if (checkDAppThreshold(newBalances)) | |
1103 | + | then throw() | |
1104 | + | else { | |
1105 | + | let us = unstake(dy_and_fee, tokenOut) | |
1106 | + | if ((us == us)) | |
1107 | + | then [ScriptTransfer(msg.originCaller, dy, fromBase58String(tokenOut)), IntegerEntry((assetIds[outIndex] + kAssetBalance), (xp[outIndex] - dy_and_fee)), Burn(shareAssetId, pmtAmount), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(tokenOut)), ScriptTransfer(capMoneyBoxAddress, (dy_fee - governanceFees), fromBase58String(tokenOut)), IntegerEntry(kShareAssetSupply, (shareSupply - pmtAmount))] | |
1108 | + | else throw("Strict value is not equal to itself.") | |
1109 | + | } | |
1110 | + | } | |
1111 | + | } | |
1112 | + | } | |
1113 | + | }) | |
1114 | + | ||
1115 | + | ||
1116 | + | ||
1117 | + | @Callable(msg) | |
1118 | + | func withdrawOneCoinWithUnlock (tokenOut,minAmount,unlockAmount) = valueOrElse(isActive(), if ((0 >= unlockAmount)) | |
1119 | + | then throw("Unlock amount must be positive") | |
1026 | 1120 | else { | |
1027 | 1121 | let suspicious = checkSuspicious() | |
1028 | 1122 | if (suspicious._1) | |
1029 | 1123 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
1030 | 1124 | else { | |
1031 | - | let payment = msg.payments[0] | |
1032 | - | let tokenIn = payment.assetId | |
1033 | - | if ((tokenIn != shareAssetId)) | |
1034 | - | then throw("unknown token") | |
1035 | - | else { | |
1036 | - | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1037 | - | let _tokenAmount = payment.amount | |
1038 | - | let unlock = if ((unlockAmount > 0)) | |
1039 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
1040 | - | else 0 | |
1041 | - | if ((unlock == unlock)) | |
1042 | - | then { | |
1043 | - | let withdrawAmount = (_tokenAmount + unlockAmount) | |
1044 | - | let xp = _xp() | |
1045 | - | let $t02518525266 = _calcWithdrawOneCoin(xp, withdrawAmount, outIndex, msg.caller) | |
1046 | - | let dy = $t02518525266._1 | |
1047 | - | let dy_fee = $t02518525266._2 | |
1048 | - | if (assert((dy >= minAmount))) | |
1049 | - | then throw("Not enough coins removed") | |
1050 | - | else { | |
1051 | - | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
1052 | - | let dy_and_fee = (dy + dy_fee) | |
1053 | - | func makeNewBalances (acc,tokenBalance) = { | |
1054 | - | let $t02552425550 = acc | |
1055 | - | let newBalances = $t02552425550._1 | |
1056 | - | let i = $t02552425550._2 | |
1057 | - | if ((i == outIndex)) | |
1058 | - | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
1059 | - | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1060 | - | } | |
1061 | - | ||
1062 | - | let $t02571725778 = { | |
1063 | - | let $l = xp | |
1064 | - | let $s = size($l) | |
1065 | - | let $acc0 = $Tuple2(nil, 0) | |
1066 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1067 | - | then $a | |
1068 | - | else makeNewBalances($a, $l[$i]) | |
1069 | - | ||
1070 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1071 | - | then $a | |
1072 | - | else throw("List size exceeds 15") | |
1073 | - | ||
1074 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
1075 | - | } | |
1076 | - | let newBalances = $t02571725778._1 | |
1077 | - | let i = $t02571725778._2 | |
1078 | - | if (checkDAppThreshold(newBalances)) | |
1079 | - | then throw() | |
1080 | - | else { | |
1081 | - | let us = unstake(dy_and_fee, tokenOut) | |
1082 | - | if ((us == us)) | |
1083 | - | then [ScriptTransfer(msg.caller, dy, fromBase58String(tokenOut)), IntegerEntry((assetIds[i] + kAssetBalance), (xp[i] - dy_and_fee)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(tokenOut)), ScriptTransfer(capMoneyBoxAddress, (dy_fee - governanceFees), fromBase58String(tokenOut)), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))] | |
1084 | - | else throw("Strict value is not equal to itself.") | |
1085 | - | } | |
1086 | - | } | |
1087 | - | } | |
1125 | + | let pmtAmount = if ((size(msg.payments) > 0)) | |
1126 | + | then if ((size(msg.payments) != 1)) | |
1127 | + | then throw("size(payments) != 1") | |
1128 | + | else { | |
1129 | + | let pmtAssetId = msg.payments[0].assetId | |
1130 | + | if ((shareAssetId != pmtAssetId)) | |
1131 | + | then throw("unknown payment token") | |
1132 | + | else msg.payments[0].amount | |
1133 | + | } | |
1134 | + | else 0 | |
1135 | + | let unlock = invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
1136 | + | if ((unlock == unlock)) | |
1137 | + | then { | |
1138 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
1139 | + | let inv = invoke(this, "withdrawOneCoin", [tokenOut, minAmount], [AttachedPayment(shareAssetId, withdrawAmount)]) | |
1140 | + | if ((inv == inv)) | |
1141 | + | then nil | |
1088 | 1142 | else throw("Strict value is not equal to itself.") | |
1089 | 1143 | } | |
1144 | + | else throw("Strict value is not equal to itself.") | |
1090 | 1145 | } | |
1091 | 1146 | }) | |
1092 | 1147 | ||
1111 | 1166 | let balances = _xp() | |
1112 | 1167 | let D0 = getDMem(balances, amp) | |
1113 | 1168 | func calcNewBalances (acc,balance) = { | |
1114 | - | let $ | |
1115 | - | let newBalances = $ | |
1116 | - | let i = $ | |
1169 | + | let $t02852328549 = acc | |
1170 | + | let newBalances = $t02852328549._1 | |
1171 | + | let i = $t02852328549._2 | |
1117 | 1172 | let newBalance = (balance + (if (deposit) | |
1118 | 1173 | then amounts[i] | |
1119 | 1174 | else -(amounts[i]))) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let version = "3.0.0" | |
5 | - | ||
6 | 4 | let PRECISION = 1000000 | |
7 | 5 | ||
8 | 6 | let MAX_A = 1000000 | |
9 | 7 | ||
10 | 8 | let MAX_A_CHANGE = 10 | |
11 | 9 | ||
12 | 10 | let DECIMALS = 6 | |
13 | 11 | ||
14 | 12 | let MIN_RAMP_TIME = (86400 / 60) | |
13 | + | ||
14 | + | let version = "3.0.0" | |
15 | + | ||
16 | + | let kVersion = "version" | |
15 | 17 | ||
16 | 18 | let kAssets = "asset_ids" | |
17 | 19 | ||
18 | 20 | let kAssetBalance = "_balance" | |
19 | 21 | ||
20 | 22 | let kActive = "active" | |
21 | 23 | ||
22 | 24 | let kCause = "shutdown_cause" | |
23 | 25 | ||
24 | 26 | let kShareAssetId = "share_asset_id" | |
25 | 27 | ||
26 | 28 | let kShareAssetSupply = "share_asset_supply" | |
27 | 29 | ||
28 | 30 | let kFee = "commission" | |
29 | 31 | ||
30 | 32 | let kDAppThresholdCoef = "dAppThresholdCoef" | |
31 | 33 | ||
32 | 34 | let kUSDNAddress = "staking_usdnnsbt_address" | |
33 | 35 | ||
34 | 36 | let kDiscounts = "discounts" | |
35 | 37 | ||
36 | 38 | let kDiscountValues = "discount_values" | |
37 | 39 | ||
38 | 40 | let kUserSwopInGov = "_SWOP_amount" | |
39 | 41 | ||
40 | 42 | let kFirstHarvest = "first_harvest" | |
41 | 43 | ||
42 | 44 | let kFirstHarvestHeight = "first_harvest_height" | |
43 | 45 | ||
44 | 46 | let kShareLimit = "share_limit_on_first_harvest" | |
45 | 47 | ||
46 | 48 | let kBasePeriod = "base_period" | |
47 | 49 | ||
48 | 50 | let kPeriodLength = "period_length" | |
49 | 51 | ||
50 | 52 | let kStartHeight = "start_height" | |
51 | 53 | ||
52 | 54 | let kAdminPubKey1 = "admin_pub_1" | |
53 | 55 | ||
54 | 56 | let kAdminPubKey2 = "admin_pub_2" | |
55 | 57 | ||
56 | 58 | let kAdminPubKey3 = "admin_pub_3" | |
57 | 59 | ||
58 | 60 | let kAdminInvokePubKey = "admin_invoke_pub" | |
59 | 61 | ||
60 | 62 | let kMoneyBoxAddress = "money_box_address" | |
61 | 63 | ||
62 | 64 | let kGovAddress = "governance_address" | |
63 | 65 | ||
64 | 66 | let kVotingAddress = "voting_address" | |
65 | 67 | ||
66 | 68 | let kFarmingAddress = "farming_address" | |
67 | 69 | ||
68 | 70 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
69 | 71 | ||
70 | 72 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
71 | 73 | case string: String => | |
72 | 74 | fromBase58String(string) | |
73 | 75 | case nothing => | |
74 | 76 | throw((key + "is empty")) | |
75 | 77 | } | |
76 | 78 | ||
77 | 79 | ||
78 | 80 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
79 | 81 | ||
80 | 82 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
81 | 83 | ||
82 | 84 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
83 | 85 | ||
84 | 86 | let adminPubKeyInvoke = getBase58FromOracle(kAdminInvokePubKey) | |
85 | 87 | ||
86 | 88 | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
87 | 89 | ||
88 | 90 | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
89 | 91 | ||
90 | 92 | let stakingUSDNAddress = Address(getBase58FromOracle(kUSDNAddress)) | |
91 | 93 | ||
92 | 94 | let votingAddress = Address(getBase58FromOracle(kVotingAddress)) | |
93 | 95 | ||
94 | 96 | let farmingAddress = Address(getBase58FromOracle(kFarmingAddress)) | |
95 | 97 | ||
96 | - | let capMoneyBoxAddress = Address(base58' | |
98 | + | let capMoneyBoxAddress = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
97 | 99 | ||
98 | 100 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
99 | 101 | ||
100 | 102 | let stakingAssets = [toBase58String(USDN)] | |
101 | 103 | ||
102 | 104 | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
103 | 105 | ||
104 | 106 | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
105 | 107 | ||
106 | 108 | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
107 | 109 | ||
108 | 110 | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 3) | |
109 | 111 | ||
110 | 112 | let active = getBooleanValue(this, kActive) | |
111 | 113 | ||
112 | 114 | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
113 | 115 | ||
114 | 116 | let shareSupply = getIntegerValue(this, kShareAssetSupply) | |
115 | 117 | ||
116 | 118 | let feeScale6 = 1000000 | |
117 | 119 | ||
118 | 120 | let fee = getIntegerValue(this, kFee) | |
119 | 121 | ||
120 | 122 | let feeGovernance = fraction(40, feeScale6, 100) | |
121 | 123 | ||
122 | 124 | let initial_A = getIntegerValue(this, "initial_A") | |
123 | 125 | ||
124 | 126 | let future_A = getIntegerValue(this, "future_A") | |
125 | 127 | ||
126 | 128 | let initial_A_time = valueOrElse(getInteger(this, "initial_A_time"), 0) | |
127 | 129 | ||
128 | 130 | let future_A_time = valueOrElse(getInteger(this, "future_A_time"), 0) | |
129 | 131 | ||
130 | 132 | let assetIds = split(getStringValue(this, kAssets), ",") | |
131 | 133 | ||
132 | 134 | let nCoins = size(assetIds) | |
133 | 135 | ||
134 | 136 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
135 | 137 | ||
136 | 138 | ||
137 | 139 | func throwIsActive () = throw("DApp is already active") | |
138 | 140 | ||
139 | 141 | ||
140 | 142 | func isActive () = if (active) | |
141 | 143 | then unit | |
142 | 144 | else throw("DApp is inactive at this moment") | |
143 | 145 | ||
144 | 146 | ||
145 | 147 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
146 | 148 | then unit | |
147 | 149 | else throw("Only admin can call this function") | |
148 | 150 | ||
149 | 151 | ||
150 | 152 | func isSelfCall (i) = if ((this == i.caller)) | |
151 | 153 | then unit | |
152 | 154 | else throw("Only contract itself can call this function") | |
153 | 155 | ||
154 | 156 | ||
155 | 157 | let big2 = toBigInt(2) | |
156 | 158 | ||
157 | 159 | let blockTimestamp = height | |
158 | 160 | ||
159 | 161 | func assert (a) = if (a) | |
160 | 162 | then false | |
161 | 163 | else true | |
162 | 164 | ||
163 | 165 | ||
164 | 166 | func calculateFeeDiscount (userAddr) = { | |
165 | 167 | let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0) | |
166 | 168 | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
167 | 169 | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
168 | 170 | if (if ((swopAmount >= parseIntValue(discountValues[0]))) | |
169 | 171 | then (parseIntValue(discountValues[1]) > swopAmount) | |
170 | 172 | else false) | |
171 | 173 | then (feeScale6 - parseIntValue(discounts[0])) | |
172 | 174 | else if (if ((swopAmount >= parseIntValue(discountValues[1]))) | |
173 | 175 | then (parseIntValue(discountValues[2]) > swopAmount) | |
174 | 176 | else false) | |
175 | 177 | then (feeScale6 - parseIntValue(discounts[1])) | |
176 | 178 | else if (if ((swopAmount >= parseIntValue(discountValues[2]))) | |
177 | 179 | then (parseIntValue(discountValues[3]) > swopAmount) | |
178 | 180 | else false) | |
179 | 181 | then (feeScale6 - parseIntValue(discounts[2])) | |
180 | 182 | else if (if ((swopAmount >= parseIntValue(discountValues[3]))) | |
181 | 183 | then (parseIntValue(discountValues[4]) > swopAmount) | |
182 | 184 | else false) | |
183 | 185 | then (feeScale6 - parseIntValue(discounts[3])) | |
184 | 186 | else if ((swopAmount >= parseIntValue(discountValues[4]))) | |
185 | 187 | then (feeScale6 - parseIntValue(discounts[4])) | |
186 | 188 | else feeScale6 | |
187 | 189 | } | |
188 | 190 | ||
189 | 191 | ||
190 | 192 | func _A () = { | |
191 | 193 | let t1 = future_A_time | |
192 | 194 | let A1 = future_A | |
193 | 195 | if ((t1 > blockTimestamp)) | |
194 | 196 | then { | |
195 | 197 | let A0 = initial_A | |
196 | 198 | let t0 = initial_A_time | |
197 | 199 | if ((A1 > A0)) | |
198 | 200 | then (A0 + (((A1 - A0) * (blockTimestamp - t0)) / (t1 - t0))) | |
199 | 201 | else (A0 - (((A0 - A1) * (blockTimestamp - t0)) / (t1 - t0))) | |
200 | 202 | } | |
201 | 203 | else A1 | |
202 | 204 | } | |
203 | 205 | ||
204 | 206 | ||
205 | 207 | func _xp () = { | |
206 | 208 | func assetBalances (acc,assetId) = (acc :+ valueOrElse(getInteger(this, (assetId + kAssetBalance)), 0)) | |
207 | 209 | ||
208 | 210 | let $l = assetIds | |
209 | 211 | let $s = size($l) | |
210 | 212 | let $acc0 = nil | |
211 | 213 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
212 | 214 | then $a | |
213 | 215 | else assetBalances($a, $l[$i]) | |
214 | 216 | ||
215 | 217 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
216 | 218 | then $a | |
217 | 219 | else throw("List size exceeds 15") | |
218 | 220 | ||
219 | 221 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
220 | 222 | } | |
221 | 223 | ||
222 | 224 | ||
223 | 225 | func _xp_mem (xp) = xp | |
224 | 226 | ||
225 | 227 | ||
226 | 228 | func sumList (acc,element) = (acc + element) | |
227 | 229 | ||
228 | 230 | ||
229 | 231 | func get_D (xp,amp) = { | |
230 | 232 | let @ = invoke(this, "D", [xp, amp], nil) | |
231 | 233 | if ($isInstanceOf(@, "Int")) | |
232 | 234 | then @ | |
233 | 235 | else throw(($getType(invoke(this, "D", [xp, amp], nil)) + " couldn't be cast to Int")) | |
234 | 236 | } | |
235 | 237 | ||
236 | 238 | ||
237 | 239 | func get_D_internal (xp,amp) = { | |
238 | 240 | let S = { | |
239 | 241 | let $l = xp | |
240 | 242 | let $s = size($l) | |
241 | 243 | let $acc0 = 0 | |
242 | 244 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
243 | 245 | then $a | |
244 | 246 | else sumList($a, $l[$i]) | |
245 | 247 | ||
246 | 248 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
247 | 249 | then $a | |
248 | 250 | else throw("List size exceeds 15") | |
249 | 251 | ||
250 | 252 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
251 | 253 | } | |
252 | 254 | if ((S == 0)) | |
253 | 255 | then 0 | |
254 | 256 | else { | |
255 | 257 | let Ann = (amp * nCoins) | |
256 | 258 | let AnnS = (toBigInt(Ann) * toBigInt(S)) | |
257 | 259 | let Ann1 = toBigInt((Ann - 1)) | |
258 | 260 | func Dproc (acc,i) = if ((acc._2 == true)) | |
259 | 261 | then acc | |
260 | 262 | else { | |
261 | 263 | let Dprev = acc._1 | |
262 | 264 | func D_PProc (D_P,i) = if ((nCoins > i)) | |
263 | 265 | then ((D_P * Dprev) / (toBigInt(xp[i]) * toBigInt(nCoins))) | |
264 | 266 | else D_P | |
265 | 267 | ||
266 | 268 | let D_P = { | |
267 | 269 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
268 | 270 | let $s = size($l) | |
269 | 271 | let $acc0 = Dprev | |
270 | 272 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
271 | 273 | then $a | |
272 | 274 | else D_PProc($a, $l[$i]) | |
273 | 275 | ||
274 | 276 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
275 | 277 | then $a | |
276 | 278 | else throw("List size exceeds 15") | |
277 | 279 | ||
278 | 280 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
279 | 281 | } | |
280 | 282 | let D = fraction((AnnS + (toBigInt(nCoins) * D_P)), Dprev, ((Ann1 * Dprev) + (toBigInt((nCoins + 1)) * D_P))) | |
281 | 283 | if ((D > Dprev)) | |
282 | 284 | then if ((1 >= toInt((D - Dprev)))) | |
283 | 285 | then $Tuple2(D, true) | |
284 | 286 | else $Tuple2(D, false) | |
285 | 287 | else if ((1 >= toInt((Dprev - D)))) | |
286 | 288 | then $Tuple2(D, true) | |
287 | 289 | else $Tuple2(D, false) | |
288 | 290 | } | |
289 | 291 | ||
290 | - | let $ | |
292 | + | let $t066756787 = { | |
291 | 293 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
292 | 294 | let $s = size($l) | |
293 | 295 | let $acc0 = $Tuple2(toBigInt(S), false) | |
294 | 296 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
295 | 297 | then $a | |
296 | 298 | else Dproc($a, $l[$i]) | |
297 | 299 | ||
298 | 300 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
299 | 301 | then $a | |
300 | 302 | else throw("List size exceeds 15") | |
301 | 303 | ||
302 | 304 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
303 | 305 | } | |
304 | - | let D = $ | |
305 | - | let finished = $ | |
306 | + | let D = $t066756787._1 | |
307 | + | let finished = $t066756787._2 | |
306 | 308 | if ((finished == false)) | |
307 | 309 | then throw(("get_D() not finished with " + toString(D))) | |
308 | 310 | else toInt(D) | |
309 | 311 | } | |
310 | 312 | } | |
311 | 313 | ||
312 | 314 | ||
313 | 315 | func getDMem (xp,amp) = get_D(_xp_mem(xp), amp) | |
314 | 316 | ||
315 | 317 | ||
316 | 318 | func getY (in,out,x,xp_) = if (assert((in != out))) | |
317 | 319 | then throw("same coin") | |
318 | 320 | else if (assert(if ((out >= 0)) | |
319 | 321 | then (in >= 0) | |
320 | 322 | else false)) | |
321 | 323 | then throw("below zero") | |
322 | 324 | else if (assert(if ((nCoins > out)) | |
323 | 325 | then (nCoins > in) | |
324 | 326 | else false)) | |
325 | 327 | then throw("above N_COINS") | |
326 | 328 | else { | |
327 | 329 | let amp = _A() | |
328 | 330 | let D = get_D(xp_, amp) | |
329 | 331 | let Ann = (amp * nCoins) | |
330 | 332 | func S_c (acc,i) = { | |
331 | - | let $ | |
332 | - | let S_ = $ | |
333 | - | let c = $ | |
333 | + | let $t073587375 = acc | |
334 | + | let S_ = $t073587375._1 | |
335 | + | let c = $t073587375._2 | |
334 | 336 | let x_ = if ((in == i)) | |
335 | 337 | then x | |
336 | 338 | else xp_[i] | |
337 | 339 | if (if ((i != out)) | |
338 | 340 | then (nCoins > i) | |
339 | 341 | else false) | |
340 | 342 | then $Tuple2((S_ + x_), fraction(c, toBigInt(D), toBigInt((x_ * nCoins)))) | |
341 | 343 | else $Tuple2(S_, c) | |
342 | 344 | } | |
343 | 345 | ||
344 | - | let $ | |
346 | + | let $t075837684 = { | |
345 | 347 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
346 | 348 | let $s = size($l) | |
347 | 349 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
348 | 350 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
349 | 351 | then $a | |
350 | 352 | else S_c($a, $l[$i]) | |
351 | 353 | ||
352 | 354 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
353 | 355 | then $a | |
354 | 356 | else throw("List size exceeds 15") | |
355 | 357 | ||
356 | 358 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
357 | 359 | } | |
358 | - | let S_ = $ | |
359 | - | let c_ = $ | |
360 | + | let S_ = $t075837684._1 | |
361 | + | let c_ = $t075837684._2 | |
360 | 362 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
361 | 363 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
362 | 364 | func y_proc (acc,_i) = if ((acc._2 == true)) | |
363 | 365 | then acc | |
364 | 366 | else { | |
365 | 367 | let y_prev = acc._1 | |
366 | 368 | let y = (((y_prev * y_prev) + c) / ((big2 * y_prev) + bD)) | |
367 | 369 | if ((y > y_prev)) | |
368 | 370 | then if ((1 >= toInt((y - y_prev)))) | |
369 | 371 | then $Tuple2(y, true) | |
370 | 372 | else $Tuple2(y, false) | |
371 | 373 | else if ((1 >= toInt((y_prev - y)))) | |
372 | 374 | then $Tuple2(y, true) | |
373 | 375 | else $Tuple2(y, false) | |
374 | 376 | } | |
375 | 377 | ||
376 | - | let $ | |
378 | + | let $t081668283 = { | |
377 | 379 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
378 | 380 | let $s = size($l) | |
379 | 381 | let $acc0 = $Tuple2(toBigInt(D), false) | |
380 | 382 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
381 | 383 | then $a | |
382 | 384 | else y_proc($a, $l[$i]) | |
383 | 385 | ||
384 | 386 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
385 | 387 | then $a | |
386 | 388 | else throw("List size exceeds 16") | |
387 | 389 | ||
388 | 390 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
389 | 391 | } | |
390 | - | let y = $ | |
391 | - | let finished = $ | |
392 | + | let y = $t081668283._1 | |
393 | + | let finished = $t081668283._2 | |
392 | 394 | if ((finished == false)) | |
393 | 395 | then throw(("getY() not finished with " + toString(y))) | |
394 | 396 | else toInt(y) | |
395 | 397 | } | |
396 | 398 | ||
397 | 399 | ||
398 | 400 | func get_y_D (A_,in,xp,D) = if (assert((in >= 0))) | |
399 | 401 | then throw("i below zero") | |
400 | 402 | else if (assert((nCoins > in))) | |
401 | 403 | then throw("i above N_COINS") | |
402 | 404 | else { | |
403 | 405 | let Ann = (A_ * nCoins) | |
404 | 406 | func S_c (acc,i) = { | |
405 | - | let $ | |
406 | - | let S_ = $ | |
407 | - | let c = $ | |
407 | + | let $t086628679 = acc | |
408 | + | let S_ = $t086628679._1 | |
409 | + | let c = $t086628679._2 | |
408 | 410 | let x_ = if (if ((in != i)) | |
409 | 411 | then (nCoins > i) | |
410 | 412 | else false) | |
411 | 413 | then xp[i] | |
412 | 414 | else 0 | |
413 | 415 | if (if ((nCoins > i)) | |
414 | 416 | then (in != i) | |
415 | 417 | else false) | |
416 | 418 | then $Tuple2((S_ + x_), fraction(c, toBigInt(D), toBigInt((x_ * nCoins)))) | |
417 | 419 | else $Tuple2(S_, c) | |
418 | 420 | } | |
419 | 421 | ||
420 | - | let $ | |
422 | + | let $t088999000 = { | |
421 | 423 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
422 | 424 | let $s = size($l) | |
423 | 425 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
424 | 426 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
425 | 427 | then $a | |
426 | 428 | else S_c($a, $l[$i]) | |
427 | 429 | ||
428 | 430 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
429 | 431 | then $a | |
430 | 432 | else throw("List size exceeds 15") | |
431 | 433 | ||
432 | 434 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
433 | 435 | } | |
434 | - | let S_ = $ | |
435 | - | let c_ = $ | |
436 | + | let S_ = $t088999000._1 | |
437 | + | let c_ = $t088999000._2 | |
436 | 438 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
437 | 439 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
438 | 440 | func y_D_proc (acc,i) = if ((acc._2 == true)) | |
439 | 441 | then acc | |
440 | 442 | else { | |
441 | 443 | let y_prev = acc._1 | |
442 | 444 | let y = (((y_prev * y_prev) + c) / ((big2 * y_prev) + bD)) | |
443 | 445 | if ((y > y_prev)) | |
444 | 446 | then if ((1 >= toInt((y - y_prev)))) | |
445 | 447 | then $Tuple2(y, true) | |
446 | 448 | else $Tuple2(y, false) | |
447 | 449 | else if ((1 >= toInt((y_prev - y)))) | |
448 | 450 | then $Tuple2(y, true) | |
449 | 451 | else $Tuple2(y, false) | |
450 | 452 | } | |
451 | 453 | ||
452 | - | let $ | |
454 | + | let $t094839602 = { | |
453 | 455 | let $l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
454 | 456 | let $s = size($l) | |
455 | 457 | let $acc0 = $Tuple2(toBigInt(D), false) | |
456 | 458 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
457 | 459 | then $a | |
458 | 460 | else y_D_proc($a, $l[$i]) | |
459 | 461 | ||
460 | 462 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
461 | 463 | then $a | |
462 | 464 | else throw("List size exceeds 16") | |
463 | 465 | ||
464 | 466 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
465 | 467 | } | |
466 | - | let y = $ | |
467 | - | let finished = $ | |
468 | + | let y = $t094839602._1 | |
469 | + | let finished = $t094839602._2 | |
468 | 470 | if ((finished == false)) | |
469 | 471 | then throw(("get_y_D() not finished with " + toString(y))) | |
470 | 472 | else toInt(y) | |
471 | 473 | } | |
472 | 474 | ||
473 | 475 | ||
474 | 476 | func _calcWithdrawOneCoin (xp,_token_amount,i,caller) = { | |
475 | 477 | let feeDiscount = calculateFeeDiscount(caller) | |
476 | 478 | let amp = _A() | |
477 | 479 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
478 | 480 | let total_supply = shareSupply | |
479 | 481 | let D0 = get_D(xp, amp) | |
480 | 482 | let D1 = (D0 - fraction(_token_amount, D0, total_supply)) | |
481 | 483 | let new_y = get_y_D(amp, i, xp, D1) | |
482 | 484 | let dy_0 = (xp[i] - new_y) | |
483 | 485 | func xp_reduced_proc (acc,xp_j) = { | |
484 | - | let $ | |
485 | - | let xp_reduced = $ | |
486 | - | let index = $ | |
486 | + | let $t01024310272 = acc | |
487 | + | let xp_reduced = $t01024310272._1 | |
488 | + | let index = $t01024310272._2 | |
487 | 489 | let dx_expected = if ((index == i)) | |
488 | 490 | then (fraction(xp_j, D1, D0) - new_y) | |
489 | 491 | else (xp_j - fraction(xp_j, D1, D0)) | |
490 | 492 | $Tuple2((xp_reduced :+ (xp_j - fraction(_fee, dx_expected, feeScale6))), (index + 1)) | |
491 | 493 | } | |
492 | 494 | ||
493 | - | let $ | |
495 | + | let $t01053410598 = { | |
494 | 496 | let $l = xp | |
495 | 497 | let $s = size($l) | |
496 | 498 | let $acc0 = $Tuple2(nil, 0) | |
497 | 499 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
498 | 500 | then $a | |
499 | 501 | else xp_reduced_proc($a, $l[$i]) | |
500 | 502 | ||
501 | 503 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
502 | 504 | then $a | |
503 | 505 | else throw("List size exceeds 15") | |
504 | 506 | ||
505 | 507 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
506 | 508 | } | |
507 | - | let xp_reduced = $ | |
508 | - | let index = $ | |
509 | + | let xp_reduced = $t01053410598._1 | |
510 | + | let index = $t01053410598._2 | |
509 | 511 | let xp_reduced_i = xp_reduced[i] | |
510 | 512 | let dy = ((xp_reduced_i - get_y_D(amp, i, xp_reduced, D1)) - 1) | |
511 | 513 | $Tuple2(dy, (dy_0 - dy)) | |
512 | 514 | } | |
513 | 515 | ||
514 | 516 | ||
515 | 517 | func getStrAssetId (assetId) = match assetId { | |
516 | 518 | case id: ByteVector => | |
517 | 519 | toBase58String(id) | |
518 | 520 | case waves: Unit => | |
519 | 521 | "WAVES" | |
520 | 522 | case _ => | |
521 | 523 | throw("Match error") | |
522 | 524 | } | |
523 | 525 | ||
524 | 526 | ||
525 | 527 | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
526 | 528 | then $Tuple2("lockNeutrino", stakingUSDNAddress) | |
527 | 529 | else $Tuple2("unlockNeutrino", stakingUSDNAddress) | |
528 | 530 | ||
529 | 531 | ||
530 | 532 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
531 | 533 | then { | |
532 | - | let $ | |
533 | - | let call = $ | |
534 | - | let stakingAddr = $ | |
534 | + | let $t01116211228 = calcStakingFuncAndAddres(stake, assetId) | |
535 | + | let call = $t01116211228._1 | |
536 | + | let stakingAddr = $t01116211228._2 | |
535 | 537 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
536 | 538 | } | |
537 | 539 | else { | |
538 | - | let $ | |
539 | - | let call = $ | |
540 | - | let stakingAddr = $ | |
540 | + | let $t01131411380 = calcStakingFuncAndAddres(stake, assetId) | |
541 | + | let call = $t01131411380._1 | |
542 | + | let stakingAddr = $t01131411380._2 | |
541 | 543 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
542 | 544 | } | |
543 | 545 | ||
544 | 546 | ||
545 | 547 | func stake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
546 | 548 | then { | |
547 | - | let $ | |
548 | - | let call = $ | |
549 | - | let addr = $ | |
550 | - | let params = $ | |
551 | - | let payments = $ | |
549 | + | let $t01156711669 = calcStakingParams(true, amount, fromBase58String(assetIdString)) | |
550 | + | let call = $t01156711669._1 | |
551 | + | let addr = $t01156711669._2 | |
552 | + | let params = $t01156711669._3 | |
553 | + | let payments = $t01156711669._4 | |
552 | 554 | invoke(addr, call, params, payments) | |
553 | 555 | } | |
554 | 556 | else 0 | |
555 | 557 | ||
556 | 558 | ||
557 | 559 | func unstake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
558 | 560 | then { | |
559 | - | let $ | |
560 | - | let call = $ | |
561 | - | let addr = $ | |
562 | - | let params = $ | |
563 | - | let payments = $ | |
561 | + | let $t01185411957 = calcStakingParams(false, amount, fromBase58String(assetIdString)) | |
562 | + | let call = $t01185411957._1 | |
563 | + | let addr = $t01185411957._2 | |
564 | + | let params = $t01185411957._3 | |
565 | + | let payments = $t01185411957._4 | |
564 | 566 | invoke(addr, call, params, payments) | |
565 | 567 | } | |
566 | 568 | else 0 | |
567 | 569 | ||
568 | 570 | ||
569 | 571 | func stakedAmount (assetId) = { | |
570 | 572 | let stakedAmountCalculated = match assetId { | |
571 | 573 | case aId: ByteVector => | |
572 | 574 | if ((aId == USDN)) | |
573 | 575 | then getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this))) | |
574 | 576 | else 0 | |
575 | 577 | case _: Unit => | |
576 | 578 | 0 | |
577 | 579 | case _ => | |
578 | 580 | throw("Match error") | |
579 | 581 | } | |
580 | 582 | match stakedAmountCalculated { | |
581 | 583 | case i: Int => | |
582 | 584 | i | |
583 | 585 | case _ => | |
584 | 586 | 0 | |
585 | 587 | } | |
586 | 588 | } | |
587 | 589 | ||
588 | 590 | ||
589 | 591 | func checkSuspicious () = { | |
590 | 592 | let contractBalances = _xp() | |
591 | 593 | func checkBalance (acc,assetId) = { | |
592 | - | let $ | |
593 | - | let suspicious = $ | |
594 | - | let i = $ | |
594 | + | let $t01256812593 = acc | |
595 | + | let suspicious = $t01256812593._1 | |
596 | + | let i = $t01256812593._2 | |
595 | 597 | if (suspicious) | |
596 | 598 | then $Tuple2(suspicious, i) | |
597 | 599 | else { | |
598 | 600 | let aBalance = (assetBalance(this, fromBase58String(assetId)) + stakedAmount(fromBase58String(assetId))) | |
599 | 601 | if ((contractBalances[i] > aBalance)) | |
600 | 602 | then $Tuple2(true, i) | |
601 | 603 | else $Tuple2(false, (i + 1)) | |
602 | 604 | } | |
603 | 605 | } | |
604 | 606 | ||
605 | 607 | let $l = assetIds | |
606 | 608 | let $s = size($l) | |
607 | 609 | let $acc0 = $Tuple2(false, 0) | |
608 | 610 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
609 | 611 | then $a | |
610 | 612 | else checkBalance($a, $l[$i]) | |
611 | 613 | ||
612 | 614 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
613 | 615 | then $a | |
614 | 616 | else throw("List size exceeds 15") | |
615 | 617 | ||
616 | 618 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
617 | 619 | } | |
618 | 620 | ||
619 | 621 | ||
620 | 622 | func suspendSuspicious (i) = suspend(("Suspicious state with asset: " + assetIds[i])) | |
621 | 623 | ||
622 | 624 | ||
623 | 625 | func returnPayments (caller,payments) = { | |
624 | 626 | func parsePayments (acc,payment) = (acc :+ ScriptTransfer(caller, payment.amount, payment.assetId)) | |
625 | 627 | ||
626 | 628 | let $l = payments | |
627 | 629 | let $s = size($l) | |
628 | 630 | let $acc0 = nil | |
629 | 631 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
630 | 632 | then $a | |
631 | 633 | else parsePayments($a, $l[$i]) | |
632 | 634 | ||
633 | 635 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
634 | 636 | then $a | |
635 | 637 | else throw("List size exceeds 15") | |
636 | 638 | ||
637 | 639 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
638 | 640 | } | |
639 | 641 | ||
640 | 642 | ||
641 | 643 | func checkDAppThreshold (newBalances) = { | |
642 | 644 | let dAppThresholdCoef = valueOrErrorMessage(getInteger(this, kDAppThresholdCoef), "No dAppThresholdCoef key") | |
643 | 645 | let thresholdScale = 10000 | |
644 | 646 | let maxBalance = max(newBalances) | |
645 | 647 | let minBalance = min(newBalances) | |
646 | 648 | let ratio = fraction(maxBalance, thresholdScale, minBalance) | |
647 | 649 | if ((ratio > (dAppThresholdCoef * thresholdScale))) | |
648 | 650 | then throw("New balance in assets of the DApp is less than threshold") | |
649 | 651 | else false | |
650 | 652 | } | |
651 | 653 | ||
652 | 654 | ||
653 | 655 | func checkCoins (assetIds) = { | |
654 | 656 | let coins = split(assetIds, ",") | |
655 | 657 | func checkCoin (error,assetId) = { | |
656 | 658 | let asset = valueOrErrorMessage(fromBase58String(assetId), ("fromBase58String: " + assetId)) | |
657 | 659 | let decimals = valueOrErrorMessage(assetInfo(asset), ("assetInfo: " + assetId)).decimals | |
658 | 660 | if ((decimals != DECIMALS)) | |
659 | 661 | then throw("wrong decimals") | |
660 | 662 | else false | |
661 | 663 | } | |
662 | 664 | ||
663 | 665 | let $l = coins | |
664 | 666 | let $s = size($l) | |
665 | 667 | let $acc0 = false | |
666 | 668 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
667 | 669 | then $a | |
668 | 670 | else checkCoin($a, $l[$i]) | |
669 | 671 | ||
670 | 672 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
671 | 673 | then $a | |
672 | 674 | else throw("List size exceeds 15") | |
673 | 675 | ||
674 | 676 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
675 | 677 | } | |
676 | 678 | ||
677 | 679 | ||
678 | 680 | @Callable(msg) | |
679 | 681 | func D (xp,amp) = { | |
680 | 682 | let D = get_D_internal(xp, amp) | |
681 | 683 | $Tuple2([IntegerEntry("D", D)], D) | |
682 | 684 | } | |
683 | 685 | ||
684 | 686 | ||
685 | 687 | ||
686 | 688 | @Callable(msg) | |
687 | - | func init (assetIds,_A,firstHarvest) = if (!(isDataStorageUntouched(this))) | |
689 | + | func init (assetIds,_A,_dAppThresholdCoef,firstHarvest) = if (!(isDataStorageUntouched(this))) | |
688 | 690 | then throw("Already initialized") | |
689 | - | else { | |
690 | - | let shareName = "s_Multi_USD" | |
691 | - | let shareDescription = ("ShareToken of SwopFi protocol for MultiStable USD pool at address " + toString(this)) | |
692 | - | let issueToken = Issue(shareName, shareDescription, 0, 6, true) | |
693 | - | let tokenId = calculateAssetId(issueToken) | |
694 | - | if (checkCoins(assetIds)) | |
695 | - | then throw() | |
691 | + | else if ((0 >= _A)) | |
692 | + | then throw("Amp must be must > 0") | |
693 | + | else if ((0 >= _dAppThresholdCoef)) | |
694 | + | then throw("dApp Threshold Coef must be > 0") | |
696 | 695 | else { | |
697 | - | let baseEntry = [StringEntry(kAssets, assetIds), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), IntegerEntry(kDAppThresholdCoef, 15), BooleanEntry(kActive, true), issueToken] | |
698 | - | if (firstHarvest) | |
699 | - | then (baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
700 | - | else baseEntry | |
696 | + | let shareName = "s_Multi_USD" | |
697 | + | let shareDescription = ("ShareToken of SwopFi protocol for MultiStable USD pool at address " + toString(this)) | |
698 | + | let issueToken = Issue(shareName, shareDescription, 0, 6, true) | |
699 | + | let tokenId = calculateAssetId(issueToken) | |
700 | + | if (checkCoins(assetIds)) | |
701 | + | then throw() | |
702 | + | else { | |
703 | + | let baseEntry = [StringEntry(kVersion, version), StringEntry(kAssets, assetIds), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), IntegerEntry(kDAppThresholdCoef, _dAppThresholdCoef), BooleanEntry(kActive, true), issueToken] | |
704 | + | if (firstHarvest) | |
705 | + | then (baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
706 | + | else baseEntry | |
707 | + | } | |
701 | 708 | } | |
702 | - | } | |
703 | 709 | ||
704 | 710 | ||
705 | 711 | ||
706 | 712 | @Callable(msg) | |
707 | 713 | func addLiquidity (minMintAmount,stakeFarming) = valueOrElse(isActive(), { | |
708 | 714 | let amp = _A() | |
709 | 715 | let xp = _xp() | |
710 | 716 | let D0 = if ((shareSupply == 0)) | |
711 | 717 | then 0 | |
712 | 718 | else getDMem(xp, amp) | |
713 | 719 | let payments = msg.payments | |
714 | - | let | |
715 | - | func validPayments (n) = if (( | |
720 | + | let paymentsSize = size(payments) | |
721 | + | func validPayments (n) = if ((paymentsSize > nCoins)) | |
716 | 722 | then throw(("payments size > " + toString(nCoins))) | |
717 | - | else if ((1 > | |
723 | + | else if ((1 > paymentsSize)) | |
718 | 724 | then throw("payments size < 1") | |
719 | 725 | else if (if ((shareSupply == 0)) | |
720 | - | then (nCoins != | |
726 | + | then (nCoins != paymentsSize) | |
721 | 727 | else false) | |
722 | 728 | then throw("initial deposit requires all coins") | |
723 | 729 | else { | |
724 | 730 | func paymantValid (acc,payment) = if (containsElement(assetIds, getStrAssetId(payment.assetId))) | |
725 | 731 | then true | |
726 | 732 | else throw("Invalid asset in payment") | |
727 | 733 | ||
728 | 734 | let $l = payments | |
729 | 735 | let $s = size($l) | |
730 | 736 | let $acc0 = false | |
731 | 737 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
732 | 738 | then $a | |
733 | 739 | else paymantValid($a, $l[$i]) | |
734 | 740 | ||
735 | 741 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
736 | 742 | then $a | |
737 | 743 | else throw("List size exceeds 15") | |
738 | 744 | ||
739 | 745 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
740 | 746 | } | |
741 | 747 | ||
742 | - | if (!(validPayments( | |
748 | + | if (!(validPayments(paymentsSize))) | |
743 | 749 | then throw() | |
744 | 750 | else { | |
745 | 751 | let suspicious = checkSuspicious() | |
746 | 752 | if (suspicious._1) | |
747 | 753 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, payments)) | |
748 | 754 | else { | |
749 | - | let paymentsSize = size(payments) | |
750 | 755 | func parsePayments (acc,assetId) = { | |
751 | - | let $ | |
752 | - | let newBalances = $ | |
753 | - | let i = $ | |
754 | - | let j = $ | |
756 | + | let $t01690116930 = acc | |
757 | + | let newBalances = $t01690116930._1 | |
758 | + | let i = $t01690116930._2 | |
759 | + | let j = $t01690116930._3 | |
755 | 760 | if (if ((paymentsSize > j)) | |
756 | 761 | then (getStrAssetId(payments[j].assetId) == assetId) | |
757 | 762 | else false) | |
758 | - | then { | |
759 | - | let s = stake(payments[j].amount, getStrAssetId(payments[j].assetId)) | |
760 | - | if ((s == s)) | |
761 | - | then $Tuple3((newBalances :+ (xp[i] + payments[j].amount)), (i + 1), (j + 1)) | |
762 | - | else throw("Strict value is not equal to itself.") | |
763 | - | } | |
763 | + | then $Tuple3((newBalances :+ (xp[i] + payments[j].amount)), (i + 1), (j + 1)) | |
764 | 764 | else $Tuple3((newBalances :+ xp[i]), (i + 1), j) | |
765 | 765 | } | |
766 | 766 | ||
767 | - | let $ | |
767 | + | let $t01715017236 = { | |
768 | 768 | let $l = assetIds | |
769 | 769 | let $s = size($l) | |
770 | 770 | let $acc0 = $Tuple3(nil, 0, 0) | |
771 | 771 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
772 | 772 | then $a | |
773 | 773 | else parsePayments($a, $l[$i]) | |
774 | 774 | ||
775 | 775 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
776 | 776 | then $a | |
777 | 777 | else throw("List size exceeds 15") | |
778 | 778 | ||
779 | 779 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
780 | 780 | } | |
781 | - | let newBalances = $ | |
782 | - | let k = $ | |
783 | - | let parsedPayments = $ | |
784 | - | if (( | |
781 | + | let newBalances = $t01715017236._1 | |
782 | + | let k = $t01715017236._2 | |
783 | + | let parsedPayments = $t01715017236._3 | |
784 | + | if ((paymentsSize > parsedPayments)) | |
785 | 785 | then throw("Incorect payments order") | |
786 | 786 | else if (checkDAppThreshold(newBalances)) | |
787 | 787 | then throw() | |
788 | 788 | else { | |
789 | 789 | let D1 = getDMem(newBalances, amp) | |
790 | 790 | if (assert((D1 > D0))) | |
791 | 791 | then throw("D1 > D0") | |
792 | 792 | else { | |
793 | 793 | let feeDiscount = calculateFeeDiscount(msg.caller) | |
794 | 794 | func calcScriptActions (acc,newBalance) = { | |
795 | - | let $ | |
796 | - | let invBalances = $ | |
797 | - | let scriptActions = $ | |
798 | - | let i = $ | |
795 | + | let $t01763717678 = acc | |
796 | + | let invBalances = $t01763717678._1 | |
797 | + | let scriptActions = $t01763717678._2 | |
798 | + | let i = $t01763717678._3 | |
799 | 799 | if ((shareSupply > 0)) | |
800 | 800 | then { | |
801 | 801 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
802 | 802 | let fees = { | |
803 | 803 | let idealBalance = fraction(D1, xp[i], D0) | |
804 | 804 | let difference = if ((idealBalance > newBalance)) | |
805 | 805 | then (idealBalance - newBalance) | |
806 | 806 | else (newBalance - idealBalance) | |
807 | 807 | fraction(_fee, difference, feeScale6) | |
808 | 808 | } | |
809 | 809 | let governanceFees = fraction(fees, feeGovernance, feeScale6) | |
810 | - | let finalBalance = (newBalance - | |
810 | + | let finalBalance = (newBalance - fees) | |
811 | 811 | let invariantBalance = (newBalance - fees) | |
812 | - | let us = unstake(fees, assetIds[i]) | |
813 | - | if ((us == us)) | |
812 | + | let pmt = (newBalance - xp[i]) | |
813 | + | let inv = if ((pmt > 0)) | |
814 | + | then stake((pmt - fees), assetIds[i]) | |
815 | + | else unstake(fees, assetIds[i]) | |
816 | + | if ((inv == inv)) | |
814 | 817 | then $Tuple3((invBalances :+ invariantBalance), (scriptActions ++ [ScriptTransfer(capMoneyBoxAddress, (fees - governanceFees), fromBase58String(assetIds[i])), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(assetIds[i])), IntegerEntry((assetIds[i] + kAssetBalance), finalBalance)]), (i + 1)) | |
815 | 818 | else throw("Strict value is not equal to itself.") | |
816 | 819 | } | |
817 | - | else $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
820 | + | else { | |
821 | + | let inv = stake(newBalance, assetIds[i]) | |
822 | + | if ((inv == inv)) | |
823 | + | then $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
824 | + | else throw("Strict value is not equal to itself.") | |
825 | + | } | |
818 | 826 | } | |
819 | 827 | ||
820 | - | let $ | |
828 | + | let $t01922619314 = { | |
821 | 829 | let $l = newBalances | |
822 | 830 | let $s = size($l) | |
823 | 831 | let $acc0 = $Tuple3(nil, nil, 0) | |
824 | 832 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
825 | 833 | then $a | |
826 | 834 | else calcScriptActions($a, $l[$i]) | |
827 | 835 | ||
828 | 836 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
829 | 837 | then $a | |
830 | 838 | else throw("List size exceeds 15") | |
831 | 839 | ||
832 | 840 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
833 | 841 | } | |
834 | - | let invBalances = $ | |
835 | - | let scriptActions = $ | |
842 | + | let invBalances = $t01922619314._1 | |
843 | + | let scriptActions = $t01922619314._2 | |
836 | 844 | let D2 = getDMem(invBalances, amp) | |
837 | 845 | let mint_amount = if ((shareSupply == 0)) | |
838 | 846 | then D1 | |
839 | 847 | else fraction(shareSupply, (D2 - D0), D0) | |
840 | 848 | if (assert((mint_amount >= minMintAmount))) | |
841 | 849 | then throw("Slippage screwed you") | |
842 | 850 | else if (stakeFarming) | |
843 | 851 | then { | |
844 | 852 | let re = invoke(this, "reissueShare", [mint_amount], nil) | |
845 | 853 | if ((re == re)) | |
846 | 854 | then { | |
847 | 855 | let s = invoke(farmingAddress, "lockShareTokens", [toString(this)], [AttachedPayment(shareAssetId, mint_amount)]) | |
848 | 856 | if ((s == s)) | |
849 | 857 | then (scriptActions :+ IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))) | |
850 | 858 | else throw("Strict value is not equal to itself.") | |
851 | 859 | } | |
852 | 860 | else throw("Strict value is not equal to itself.") | |
853 | 861 | } | |
854 | 862 | else (scriptActions ++ [Reissue(shareAssetId, mint_amount, true), ScriptTransfer(msg.caller, mint_amount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))]) | |
855 | 863 | } | |
856 | 864 | } | |
857 | 865 | } | |
858 | 866 | } | |
859 | 867 | }) | |
860 | 868 | ||
861 | 869 | ||
862 | 870 | ||
863 | 871 | @Callable(msg) | |
864 | 872 | func reissueShare (amount) = valueOrElse(isSelfCall(msg), [Reissue(shareAssetId, amount, true)]) | |
865 | 873 | ||
866 | 874 | ||
867 | 875 | ||
868 | 876 | @Callable(msg) | |
869 | 877 | func getDy (assetFrom,assetTo,dx,userAddress) = { | |
870 | 878 | let xp = _xp() | |
871 | 879 | let fromIndex = valueOrErrorMessage(indexOf(assetIds, assetFrom), "unknown token in") | |
872 | 880 | let toIndex = valueOrErrorMessage(indexOf(assetIds, assetTo), "unknown token out") | |
873 | 881 | let x = (xp[fromIndex] + dx) | |
874 | 882 | let y = getY(fromIndex, toIndex, x, xp) | |
875 | 883 | let dy = ((xp[toIndex] - y) - 1) | |
876 | 884 | let feeDiscount = calculateFeeDiscount(Address(fromBase58String(userAddress))) | |
877 | 885 | let _fee = fraction(fraction(fee, feeDiscount, feeScale6, CEILING), dy, feeScale6) | |
878 | 886 | $Tuple2(nil, $Tuple2((dy - _fee), _fee)) | |
879 | 887 | } | |
880 | 888 | ||
881 | 889 | ||
882 | 890 | ||
883 | 891 | @Callable(msg) | |
884 | 892 | func exchange (tokenOut,min_dy) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
885 | 893 | then throw("size(payments) != 1") | |
886 | 894 | else { | |
887 | 895 | let suspicious = checkSuspicious() | |
888 | 896 | if (suspicious._1) | |
889 | 897 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
890 | 898 | else { | |
891 | 899 | let payment = msg.payments[0] | |
892 | 900 | let tokenIn = getStrAssetId(payment.assetId) | |
893 | 901 | let tokenOutB58 = fromBase58String(tokenOut) | |
894 | 902 | let dx = payment.amount | |
895 | 903 | let fromIndex = valueOrErrorMessage(indexOf(assetIds, tokenIn), "unknown token in") | |
896 | 904 | let toIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
897 | 905 | let xp = _xp() | |
898 | 906 | let x = (xp[fromIndex] + dx) | |
899 | 907 | let y = getY(fromIndex, toIndex, x, xp) | |
900 | 908 | let _dy = ((xp[toIndex] - y) - 1) | |
901 | 909 | let feeDiscount = calculateFeeDiscount(msg.caller) | |
902 | 910 | let _fee = fraction(_dy, fraction(fee, feeDiscount, feeScale6, CEILING), feeScale6) | |
903 | 911 | let dy = (_dy - _fee) | |
904 | 912 | let governanceFees = fraction(_fee, feeGovernance, feeScale6) | |
905 | 913 | if (assert((dy >= min_dy))) | |
906 | 914 | then throw("Exchange resulted in fewer coins than expected") | |
907 | 915 | else { | |
908 | 916 | func makeNewBalances (acc,tokenBalance) = { | |
909 | - | let $ | |
910 | - | let newBalances = $ | |
911 | - | let i = $ | |
917 | + | let $t02202622052 = acc | |
918 | + | let newBalances = $t02202622052._1 | |
919 | + | let i = $t02202622052._2 | |
912 | 920 | if ((i == fromIndex)) | |
913 | 921 | then $Tuple2((newBalances :+ (tokenBalance + dx)), (i + 1)) | |
914 | 922 | else if ((i == toIndex)) | |
915 | 923 | then $Tuple2((newBalances :+ (tokenBalance - _dy)), (i + 1)) | |
916 | 924 | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
917 | 925 | } | |
918 | 926 | ||
919 | - | let $ | |
927 | + | let $t02230322364 = { | |
920 | 928 | let $l = xp | |
921 | 929 | let $s = size($l) | |
922 | 930 | let $acc0 = $Tuple2(nil, 0) | |
923 | 931 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
924 | 932 | then $a | |
925 | 933 | else makeNewBalances($a, $l[$i]) | |
926 | 934 | ||
927 | 935 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
928 | 936 | then $a | |
929 | 937 | else throw("List size exceeds 15") | |
930 | 938 | ||
931 | 939 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
932 | 940 | } | |
933 | - | let newBalances = $ | |
934 | - | let i = $ | |
941 | + | let newBalances = $t02230322364._1 | |
942 | + | let i = $t02230322364._2 | |
935 | 943 | if (checkDAppThreshold(newBalances)) | |
936 | 944 | then throw() | |
937 | 945 | else { | |
938 | 946 | let s = stake(payment.amount, getStrAssetId(payment.assetId)) | |
939 | 947 | if ((s == s)) | |
940 | 948 | then { | |
941 | 949 | let us = unstake(_dy, tokenOut) | |
942 | 950 | if ((us == us)) | |
943 | - | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), (xp[toIndex] - _dy)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), ScriptTransfer(capMoneyBoxAddress, (_fee - governanceFees), tokenOutB58)], | |
951 | + | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), (xp[toIndex] - _dy)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), ScriptTransfer(capMoneyBoxAddress, (_fee - governanceFees), tokenOutB58)], [dy, tokenOutB58]) | |
944 | 952 | else throw("Strict value is not equal to itself.") | |
945 | 953 | } | |
946 | 954 | else throw("Strict value is not equal to itself.") | |
947 | 955 | } | |
948 | 956 | } | |
949 | 957 | } | |
950 | 958 | }) | |
951 | 959 | ||
952 | 960 | ||
953 | 961 | ||
954 | 962 | @Callable(msg) | |
955 | - | func withdraw (minAmounts | |
963 | + | func withdraw (minAmounts) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
956 | 964 | then throw("size(payments) != 1") | |
965 | + | else { | |
966 | + | let pmtAmount = msg.payments[0].amount | |
967 | + | let pmtAssetId = msg.payments[0].assetId | |
968 | + | if ((shareAssetId != pmtAssetId)) | |
969 | + | then throw("unknown payment token") | |
970 | + | else { | |
971 | + | let suspicious = checkSuspicious() | |
972 | + | if (suspicious._1) | |
973 | + | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
974 | + | else { | |
975 | + | func calcScriptActions (acc,balance) = { | |
976 | + | let $t02350523533 = acc | |
977 | + | let scriptActions = $t02350523533._1 | |
978 | + | let i = $t02350523533._2 | |
979 | + | let wAmount = fraction(balance, pmtAmount, shareSupply) | |
980 | + | if (assert((wAmount >= minAmounts[i]))) | |
981 | + | then throw("Withdrawal resulted in fewer coins than expected") | |
982 | + | else { | |
983 | + | let us = unstake(wAmount, assetIds[i]) | |
984 | + | if ((us == us)) | |
985 | + | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.originCaller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
986 | + | else throw("Strict value is not equal to itself.") | |
987 | + | } | |
988 | + | } | |
989 | + | ||
990 | + | let $t02402324091 = { | |
991 | + | let $l = _xp() | |
992 | + | let $s = size($l) | |
993 | + | let $acc0 = $Tuple2(nil, 0) | |
994 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
995 | + | then $a | |
996 | + | else calcScriptActions($a, $l[$i]) | |
997 | + | ||
998 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
999 | + | then $a | |
1000 | + | else throw("List size exceeds 15") | |
1001 | + | ||
1002 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
1003 | + | } | |
1004 | + | let scriptActions = $t02402324091._1 | |
1005 | + | let i = $t02402324091._2 | |
1006 | + | (scriptActions ++ [Burn(shareAssetId, pmtAmount), IntegerEntry(kShareAssetSupply, (shareSupply - pmtAmount))]) | |
1007 | + | } | |
1008 | + | } | |
1009 | + | }) | |
1010 | + | ||
1011 | + | ||
1012 | + | ||
1013 | + | @Callable(msg) | |
1014 | + | func withdrawWithUnlock (minAmounts,unlockAmount) = valueOrElse(isActive(), if ((0 >= unlockAmount)) | |
1015 | + | then throw("Unlock amount must be positive") | |
957 | 1016 | else { | |
958 | 1017 | let suspicious = checkSuspicious() | |
959 | 1018 | if (suspicious._1) | |
960 | 1019 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
961 | 1020 | else { | |
962 | - | let payment = msg.payments[0] | |
963 | - | let tokenIn = payment.assetId | |
964 | - | if ((tokenIn != shareAssetId)) | |
965 | - | then throw("unknown token") | |
966 | - | else { | |
967 | - | let _amount = payment.amount | |
968 | - | let total_supply = shareSupply | |
969 | - | let unlock = if ((unlockAmount > 0)) | |
970 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
971 | - | else 0 | |
972 | - | if ((unlock == unlock)) | |
973 | - | then { | |
974 | - | let withdrawAmount = (_amount + unlockAmount) | |
975 | - | func calcScriptActions (acc,balance) = { | |
976 | - | let $t02336823396 = acc | |
977 | - | let scriptActions = $t02336823396._1 | |
978 | - | let i = $t02336823396._2 | |
979 | - | let wAmount = fraction(balance, withdrawAmount, total_supply) | |
980 | - | if (assert((wAmount >= minAmounts[i]))) | |
981 | - | then throw("Withdrawal resulted in fewer coins than expected") | |
982 | - | else { | |
983 | - | let us = unstake(wAmount, assetIds[i]) | |
984 | - | if ((us == us)) | |
985 | - | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.caller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
986 | - | else throw("Strict value is not equal to itself.") | |
987 | - | } | |
988 | - | } | |
989 | - | ||
990 | - | let $t02388623954 = { | |
991 | - | let $l = _xp() | |
992 | - | let $s = size($l) | |
993 | - | let $acc0 = $Tuple2(nil, 0) | |
994 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
995 | - | then $a | |
996 | - | else calcScriptActions($a, $l[$i]) | |
997 | - | ||
998 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
999 | - | then $a | |
1000 | - | else throw("List size exceeds 15") | |
1001 | - | ||
1002 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
1003 | - | } | |
1004 | - | let scriptActions = $t02388623954._1 | |
1005 | - | let i = $t02388623954._2 | |
1006 | - | (scriptActions ++ [Burn(shareAssetId, withdrawAmount), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))]) | |
1007 | - | } | |
1021 | + | let pmtAmount = if ((size(msg.payments) > 0)) | |
1022 | + | then if ((size(msg.payments) != 1)) | |
1023 | + | then throw("size(payments) != 1") | |
1024 | + | else { | |
1025 | + | let pmtAssetId = msg.payments[0].assetId | |
1026 | + | if ((shareAssetId != pmtAssetId)) | |
1027 | + | then throw("unknown payment token") | |
1028 | + | else msg.payments[0].amount | |
1029 | + | } | |
1030 | + | else 0 | |
1031 | + | let unlock = invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
1032 | + | if ((unlock == unlock)) | |
1033 | + | then { | |
1034 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
1035 | + | let inv = invoke(this, "withdraw", [minAmounts], [AttachedPayment(shareAssetId, withdrawAmount)]) | |
1036 | + | if ((inv == inv)) | |
1037 | + | then nil | |
1008 | 1038 | else throw("Strict value is not equal to itself.") | |
1009 | 1039 | } | |
1040 | + | else throw("Strict value is not equal to itself.") | |
1010 | 1041 | } | |
1011 | 1042 | }) | |
1012 | 1043 | ||
1013 | 1044 | ||
1014 | 1045 | ||
1015 | 1046 | @Callable(msg) | |
1016 | 1047 | func calcWithdrawOneCoin (tokenAmount,tokenOut,user) = { | |
1017 | 1048 | let i = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1018 | 1049 | $Tuple2(nil, _calcWithdrawOneCoin(_xp(), tokenAmount, i, Address(fromBase58String(user)))._1) | |
1019 | 1050 | } | |
1020 | 1051 | ||
1021 | 1052 | ||
1022 | 1053 | ||
1023 | 1054 | @Callable(msg) | |
1024 | - | func withdrawOneCoin (tokenOut,minAmount | |
1055 | + | func withdrawOneCoin (tokenOut,minAmount) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
1025 | 1056 | then throw("size(payments) != 1") | |
1057 | + | else { | |
1058 | + | let suspicious = checkSuspicious() | |
1059 | + | if (suspicious._1) | |
1060 | + | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
1061 | + | else { | |
1062 | + | let pmtAmount = msg.payments[0].amount | |
1063 | + | let pmtAssetId = msg.payments[0].assetId | |
1064 | + | if ((pmtAssetId != shareAssetId)) | |
1065 | + | then throw("unknown token") | |
1066 | + | else { | |
1067 | + | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1068 | + | let xp = _xp() | |
1069 | + | let $t02600526087 = _calcWithdrawOneCoin(xp, pmtAmount, outIndex, msg.originCaller) | |
1070 | + | let dy = $t02600526087._1 | |
1071 | + | let dy_fee = $t02600526087._2 | |
1072 | + | if (assert((dy >= minAmount))) | |
1073 | + | then throw("Not enough coins removed") | |
1074 | + | else { | |
1075 | + | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
1076 | + | let dy_and_fee = (dy + dy_fee) | |
1077 | + | func makeNewBalances (acc,tokenBalance) = { | |
1078 | + | let $t02634526371 = acc | |
1079 | + | let newBalances = $t02634526371._1 | |
1080 | + | let i = $t02634526371._2 | |
1081 | + | if ((i == outIndex)) | |
1082 | + | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
1083 | + | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1084 | + | } | |
1085 | + | ||
1086 | + | let $t02653826599 = { | |
1087 | + | let $l = xp | |
1088 | + | let $s = size($l) | |
1089 | + | let $acc0 = $Tuple2(nil, 0) | |
1090 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1091 | + | then $a | |
1092 | + | else makeNewBalances($a, $l[$i]) | |
1093 | + | ||
1094 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1095 | + | then $a | |
1096 | + | else throw("List size exceeds 15") | |
1097 | + | ||
1098 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
1099 | + | } | |
1100 | + | let newBalances = $t02653826599._1 | |
1101 | + | let v = $t02653826599._2 | |
1102 | + | if (checkDAppThreshold(newBalances)) | |
1103 | + | then throw() | |
1104 | + | else { | |
1105 | + | let us = unstake(dy_and_fee, tokenOut) | |
1106 | + | if ((us == us)) | |
1107 | + | then [ScriptTransfer(msg.originCaller, dy, fromBase58String(tokenOut)), IntegerEntry((assetIds[outIndex] + kAssetBalance), (xp[outIndex] - dy_and_fee)), Burn(shareAssetId, pmtAmount), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(tokenOut)), ScriptTransfer(capMoneyBoxAddress, (dy_fee - governanceFees), fromBase58String(tokenOut)), IntegerEntry(kShareAssetSupply, (shareSupply - pmtAmount))] | |
1108 | + | else throw("Strict value is not equal to itself.") | |
1109 | + | } | |
1110 | + | } | |
1111 | + | } | |
1112 | + | } | |
1113 | + | }) | |
1114 | + | ||
1115 | + | ||
1116 | + | ||
1117 | + | @Callable(msg) | |
1118 | + | func withdrawOneCoinWithUnlock (tokenOut,minAmount,unlockAmount) = valueOrElse(isActive(), if ((0 >= unlockAmount)) | |
1119 | + | then throw("Unlock amount must be positive") | |
1026 | 1120 | else { | |
1027 | 1121 | let suspicious = checkSuspicious() | |
1028 | 1122 | if (suspicious._1) | |
1029 | 1123 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
1030 | 1124 | else { | |
1031 | - | let payment = msg.payments[0] | |
1032 | - | let tokenIn = payment.assetId | |
1033 | - | if ((tokenIn != shareAssetId)) | |
1034 | - | then throw("unknown token") | |
1035 | - | else { | |
1036 | - | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1037 | - | let _tokenAmount = payment.amount | |
1038 | - | let unlock = if ((unlockAmount > 0)) | |
1039 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
1040 | - | else 0 | |
1041 | - | if ((unlock == unlock)) | |
1042 | - | then { | |
1043 | - | let withdrawAmount = (_tokenAmount + unlockAmount) | |
1044 | - | let xp = _xp() | |
1045 | - | let $t02518525266 = _calcWithdrawOneCoin(xp, withdrawAmount, outIndex, msg.caller) | |
1046 | - | let dy = $t02518525266._1 | |
1047 | - | let dy_fee = $t02518525266._2 | |
1048 | - | if (assert((dy >= minAmount))) | |
1049 | - | then throw("Not enough coins removed") | |
1050 | - | else { | |
1051 | - | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
1052 | - | let dy_and_fee = (dy + dy_fee) | |
1053 | - | func makeNewBalances (acc,tokenBalance) = { | |
1054 | - | let $t02552425550 = acc | |
1055 | - | let newBalances = $t02552425550._1 | |
1056 | - | let i = $t02552425550._2 | |
1057 | - | if ((i == outIndex)) | |
1058 | - | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
1059 | - | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1060 | - | } | |
1061 | - | ||
1062 | - | let $t02571725778 = { | |
1063 | - | let $l = xp | |
1064 | - | let $s = size($l) | |
1065 | - | let $acc0 = $Tuple2(nil, 0) | |
1066 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1067 | - | then $a | |
1068 | - | else makeNewBalances($a, $l[$i]) | |
1069 | - | ||
1070 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1071 | - | then $a | |
1072 | - | else throw("List size exceeds 15") | |
1073 | - | ||
1074 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
1075 | - | } | |
1076 | - | let newBalances = $t02571725778._1 | |
1077 | - | let i = $t02571725778._2 | |
1078 | - | if (checkDAppThreshold(newBalances)) | |
1079 | - | then throw() | |
1080 | - | else { | |
1081 | - | let us = unstake(dy_and_fee, tokenOut) | |
1082 | - | if ((us == us)) | |
1083 | - | then [ScriptTransfer(msg.caller, dy, fromBase58String(tokenOut)), IntegerEntry((assetIds[i] + kAssetBalance), (xp[i] - dy_and_fee)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(tokenOut)), ScriptTransfer(capMoneyBoxAddress, (dy_fee - governanceFees), fromBase58String(tokenOut)), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))] | |
1084 | - | else throw("Strict value is not equal to itself.") | |
1085 | - | } | |
1086 | - | } | |
1087 | - | } | |
1125 | + | let pmtAmount = if ((size(msg.payments) > 0)) | |
1126 | + | then if ((size(msg.payments) != 1)) | |
1127 | + | then throw("size(payments) != 1") | |
1128 | + | else { | |
1129 | + | let pmtAssetId = msg.payments[0].assetId | |
1130 | + | if ((shareAssetId != pmtAssetId)) | |
1131 | + | then throw("unknown payment token") | |
1132 | + | else msg.payments[0].amount | |
1133 | + | } | |
1134 | + | else 0 | |
1135 | + | let unlock = invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
1136 | + | if ((unlock == unlock)) | |
1137 | + | then { | |
1138 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
1139 | + | let inv = invoke(this, "withdrawOneCoin", [tokenOut, minAmount], [AttachedPayment(shareAssetId, withdrawAmount)]) | |
1140 | + | if ((inv == inv)) | |
1141 | + | then nil | |
1088 | 1142 | else throw("Strict value is not equal to itself.") | |
1089 | 1143 | } | |
1144 | + | else throw("Strict value is not equal to itself.") | |
1090 | 1145 | } | |
1091 | 1146 | }) | |
1092 | 1147 | ||
1093 | 1148 | ||
1094 | 1149 | ||
1095 | 1150 | @Callable(msg) | |
1096 | 1151 | func A () = $Tuple2(nil, _A()) | |
1097 | 1152 | ||
1098 | 1153 | ||
1099 | 1154 | ||
1100 | 1155 | @Callable(msg) | |
1101 | 1156 | func getVirtualPrice () = { | |
1102 | 1157 | let D = get_D(_xp(), _A()) | |
1103 | 1158 | $Tuple2(nil, fraction(D, PRECISION, shareSupply)) | |
1104 | 1159 | } | |
1105 | 1160 | ||
1106 | 1161 | ||
1107 | 1162 | ||
1108 | 1163 | @Callable(msg) | |
1109 | 1164 | func calcTokenAmount (amounts,deposit) = { | |
1110 | 1165 | let amp = _A() | |
1111 | 1166 | let balances = _xp() | |
1112 | 1167 | let D0 = getDMem(balances, amp) | |
1113 | 1168 | func calcNewBalances (acc,balance) = { | |
1114 | - | let $ | |
1115 | - | let newBalances = $ | |
1116 | - | let i = $ | |
1169 | + | let $t02852328549 = acc | |
1170 | + | let newBalances = $t02852328549._1 | |
1171 | + | let i = $t02852328549._2 | |
1117 | 1172 | let newBalance = (balance + (if (deposit) | |
1118 | 1173 | then amounts[i] | |
1119 | 1174 | else -(amounts[i]))) | |
1120 | 1175 | $Tuple2((newBalances :+ newBalance), (i + 1)) | |
1121 | 1176 | } | |
1122 | 1177 | ||
1123 | 1178 | let newBalances = ( let $l = balances | |
1124 | 1179 | let $s = size($l) | |
1125 | 1180 | let $acc0 = $Tuple2(nil, 0) | |
1126 | 1181 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1127 | 1182 | then $a | |
1128 | 1183 | else calcNewBalances($a, $l[$i]) | |
1129 | 1184 | ||
1130 | 1185 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1131 | 1186 | then $a | |
1132 | 1187 | else throw("List size exceeds 15") | |
1133 | 1188 | ||
1134 | 1189 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15))._1 | |
1135 | 1190 | let D1 = getDMem(newBalances, amp) | |
1136 | 1191 | let diff = if (deposit) | |
1137 | 1192 | then (D1 - D0) | |
1138 | 1193 | else (D0 - D1) | |
1139 | 1194 | $Tuple2(nil, fraction(diff, shareSupply, D0)) | |
1140 | 1195 | } | |
1141 | 1196 | ||
1142 | 1197 | ||
1143 | 1198 | ||
1144 | 1199 | @Callable(msg) | |
1145 | 1200 | func rampA (_futureA,_futureTime) = valueOrElse(isActive(), valueOrElse(isAdminCall(msg), if (assert((blockTimestamp >= (initial_A_time + MIN_RAMP_TIME)))) | |
1146 | 1201 | then throw("too often") | |
1147 | 1202 | else if (assert((_futureTime >= (blockTimestamp + MIN_RAMP_TIME)))) | |
1148 | 1203 | then throw("insufficient time") | |
1149 | 1204 | else { | |
1150 | 1205 | let _initial_A = _A() | |
1151 | 1206 | if (assert(if ((_futureA > 0)) | |
1152 | 1207 | then (MAX_A > _futureA) | |
1153 | 1208 | else false)) | |
1154 | 1209 | then throw("out of base range") | |
1155 | 1210 | else if (assert(if (if ((_futureA >= _initial_A)) | |
1156 | 1211 | then ((_initial_A * MAX_A_CHANGE) >= _futureA) | |
1157 | 1212 | else false) | |
1158 | 1213 | then true | |
1159 | 1214 | else if ((_initial_A > _futureA)) | |
1160 | 1215 | then ((_futureA * MAX_A_CHANGE) >= _initial_A) | |
1161 | 1216 | else false)) | |
1162 | 1217 | then throw("out of range") | |
1163 | 1218 | else [IntegerEntry("initial_A", _initial_A), IntegerEntry("future_A", _futureA), IntegerEntry("initial_A_time", blockTimestamp), IntegerEntry("future_A_time", _futureTime)] | |
1164 | 1219 | })) | |
1165 | 1220 | ||
1166 | 1221 | ||
1167 | 1222 | ||
1168 | 1223 | @Callable(msg) | |
1169 | 1224 | func stopRampA () = valueOrElse(isActive(), valueOrElse(isAdminCall(msg), { | |
1170 | 1225 | let currentA = _A() | |
1171 | 1226 | [IntegerEntry("initial_A", currentA), IntegerEntry("future_A", currentA), IntegerEntry("initial_A_time", blockTimestamp), IntegerEntry("future_A_time", blockTimestamp)] | |
1172 | 1227 | })) | |
1173 | 1228 | ||
1174 | 1229 | ||
1175 | 1230 | ||
1176 | 1231 | @Callable(msg) | |
1177 | 1232 | func shutdown () = valueOrElse(isAdminCall(msg), if (!(active)) | |
1178 | 1233 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
1179 | 1234 | else suspend("Paused by admin")) | |
1180 | 1235 | ||
1181 | 1236 | ||
1182 | 1237 | ||
1183 | 1238 | @Callable(msg) | |
1184 | 1239 | func activate () = valueOrElse(isAdminCall(msg), if (active) | |
1185 | 1240 | then throwIsActive() | |
1186 | 1241 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
1187 | 1242 | ||
1188 | 1243 | ||
1189 | 1244 | ||
1190 | 1245 | @Callable(msg) | |
1191 | 1246 | func keepLimitForFirstHarvest (shareLimit) = valueOrElse(isActive(), valueOrElse(isAdminCall(msg), [IntegerEntry(kShareLimit, shareLimit)])) | |
1192 | 1247 | ||
1193 | 1248 | ||
1194 | 1249 | @Verifier(tx) | |
1195 | 1250 | func verify () = { | |
1196 | 1251 | let multiSignedByAdmins = { | |
1197 | 1252 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
1198 | 1253 | then 1 | |
1199 | 1254 | else 0 | |
1200 | 1255 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
1201 | 1256 | then 1 | |
1202 | 1257 | else 0 | |
1203 | 1258 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
1204 | 1259 | then 1 | |
1205 | 1260 | else 0 | |
1206 | 1261 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
1207 | 1262 | } | |
1208 | 1263 | match tx { | |
1209 | 1264 | case inv: InvokeScriptTransaction => | |
1210 | 1265 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
1211 | 1266 | then (inv.function == "takeIntoAccountExtraFunds") | |
1212 | 1267 | else false | |
1213 | 1268 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
1214 | 1269 | then true | |
1215 | 1270 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
1216 | 1271 | then true | |
1217 | 1272 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
1218 | 1273 | then true | |
1219 | 1274 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyInvoke) | |
1220 | 1275 | if (if (callTakeIntoAccount) | |
1221 | 1276 | then signedByAdmin | |
1222 | 1277 | else false) | |
1223 | 1278 | then true | |
1224 | 1279 | else multiSignedByAdmins | |
1225 | 1280 | case _ => | |
1226 | 1281 | multiSignedByAdmins | |
1227 | 1282 | } | |
1228 | 1283 | } | |
1229 | 1284 |
github/deemru/w8io/026f985 171.48 ms ◑