tx · CPJBNgiqCoi4X64H6kPiZV8k5jRgYMuRPHtNh9CMpnJ4 3MpygN8qm376tUAHB6mhC5BxG5NKYortiyX: -0.03600000 Waves 2022.11.24 23:10 [2331630] smart account 3MpygN8qm376tUAHB6mhC5BxG5NKYortiyX > SELF 0.00000000 Waves
{ "type": 13, "id": "CPJBNgiqCoi4X64H6kPiZV8k5jRgYMuRPHtNh9CMpnJ4", "fee": 3600000, "feeAssetId": null, "timestamp": 1669320559477, "version": 2, "chainId": 84, "sender": "3MpygN8qm376tUAHB6mhC5BxG5NKYortiyX", "senderPublicKey": "BjnLnkAMaJLYAK36vQqSepUNjGeMDHfZGfmdYwGcLbmg", "proofs": [ "22WLfVQrCioS7N68owkxKzVsyQQtfwoewZSV6zzT8yj7n6urGE36WNFjexDGMB6mffacTGAgxTkDWVjYpg8Vitt6", "49bzGPDiKvDxcRo8M6hGBhRT4ULncL3dAj4ma5VbbVfSwLM4zrwribEFX6QEf7HxJa6ZeXURjF1YKCQCHXqeiHsx" ], "script": "base64:BgJJCAISAwoBBBIECgIEARIGCgQBAQQBEgMKAQESBgoEAQgBARIECgIBARIDCgEBEgASABIAEgMKAQESBQoDBAEIEgASBAoCAQESAGsAB3ZlcnNpb24CBTIuMC4wAAhrVmVyc2lvbgIHdmVyc2lvbgAHa0FjdGl2ZQIGYWN0aXZlAAtrQWN0aXZlR2xvYgIUYWN0aXZlX2FsbF9jb250cmFjdHMACWtBc3NldElkQQIKQV9hc3NldF9pZAAJa0Fzc2V0SWRCAgpCX2Fzc2V0X2lkAAlrQmFsYW5jZUECD0FfYXNzZXRfYmFsYW5jZQAJa0JhbGFuY2VCAg9CX2Fzc2V0X2JhbGFuY2UADWtTaGFyZUFzc2V0SWQCDnNoYXJlX2Fzc2V0X2lkABFrU2hhcmVBc3NldFN1cHBseQISc2hhcmVfYXNzZXRfc3VwcGx5AARrRmVlAgpjb21taXNzaW9uAAprSW52YXJpYW50AglpbnZhcmlhbnQABmtDYXVzZQIOc2h1dG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CAUDaW52BGRBcHAFBHRoaXMJAAACCAUDaW52CGZ1bmN0aW9uAhl0YWtlSW50b0FjY291bnRFeHRyYUZ1bmRzBwQNc2lnbmVkQnlBZG1pbgMDAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUMYWRtaW5QdWJLZXkxBgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUMYWRtaW5QdWJLZXkyBgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUMYWRtaW5QdWJLZXkzBgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAURYWRtaW5QdWJLZXlJbnZva2UDAwUTY2FsbFRha2VJbnRvQWNjb3VudAUNc2lnbmVkQnlBZG1pbgcGBRNtdWx0aVNpZ25lZEJ5QWRtaW5zBRNtdWx0aVNpZ25lZEJ5QWRtaW5zgzYhsQ==", "height": 2331630, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A39GaZW6jN363AdoaKKBJKb8j8a7gV5dGrA81BzYiNZE Next: AxEfEyEs8YwBVVDzHc6ehgNVkhK9mTwTX7Zx7cLsYXDg Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | let kVersion = "version" | |
7 | 7 | ||
8 | 8 | let kActive = "active" | |
9 | + | ||
10 | + | let kActiveGlob = "active_all_contracts" | |
9 | 11 | ||
10 | 12 | let kAssetIdA = "A_asset_id" | |
11 | 13 | ||
110 | 112 | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 3) | |
111 | 113 | ||
112 | 114 | let active = getBooleanValue(this, kActive) | |
115 | + | ||
116 | + | let activeGlob = valueOrElse(getBoolean(oracle, kActiveGlob), true) | |
113 | 117 | ||
114 | 118 | let strAssetIdA = getStringValue(this, kAssetIdA) | |
115 | 119 | ||
326 | 330 | func throwIsActive () = throw("DApp is already active") | |
327 | 331 | ||
328 | 332 | ||
329 | - | func isActive () = if (active) | |
333 | + | func isActive () = if (if (active) | |
334 | + | then activeGlob | |
335 | + | else false) | |
330 | 336 | then unit | |
331 | 337 | else throw("DApp is inactive at this moment") | |
332 | 338 | ||
360 | 366 | ||
361 | 367 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
362 | 368 | then { | |
363 | - | let $ | |
364 | - | let call = $ | |
365 | - | let stakingAddr = $ | |
369 | + | let $t01050410570 = calcStakingFuncAndAddres(stake, assetId) | |
370 | + | let call = $t01050410570._1 | |
371 | + | let stakingAddr = $t01050410570._2 | |
366 | 372 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
367 | 373 | } | |
368 | 374 | else { | |
369 | - | let $ | |
370 | - | let call = $ | |
371 | - | let stakingAddr = $ | |
375 | + | let $t01065610722 = calcStakingFuncAndAddres(stake, assetId) | |
376 | + | let call = $t01065610722._1 | |
377 | + | let stakingAddr = $t01065610722._2 | |
372 | 378 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
373 | 379 | } | |
374 | 380 | ||
400 | 406 | } | |
401 | 407 | ||
402 | 408 | ||
409 | + | func replenishWithTwoTokensCalc (i,stakeFarming,lockType) = { | |
410 | + | let pmtAssetIdA = i.payments[0].assetId | |
411 | + | let pmtAssetIdB = i.payments[1].assetId | |
412 | + | let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA) | |
413 | + | let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB) | |
414 | + | let $t01230412381 = getAssetInfo(pmtAssetIdA) | |
415 | + | let pmtStrAssetIdA = $t01230412381._1 | |
416 | + | let pmtAssetNameA = $t01230412381._2 | |
417 | + | let pmtDecimalsA = $t01230412381._3 | |
418 | + | let $t01238612503 = getAssetInfo(pmtAssetIdB) | |
419 | + | let pmtStrAssetIdB = $t01238612503._1 | |
420 | + | let pmtAssetNameB = $t01238612503._2 | |
421 | + | let pmtDecimalsB = $t01238612503._3 | |
422 | + | let $t01250813012 = if ((ratioShareTokensInB > ratioShareTokensInA)) | |
423 | + | then { | |
424 | + | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
425 | + | $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA) | |
426 | + | } | |
427 | + | else { | |
428 | + | let pmt = fraction(balanceA, ratioShareTokensInB, scale8, CEILING) | |
429 | + | $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB) | |
430 | + | } | |
431 | + | let pmtAmountA = $t01250813012._1 | |
432 | + | let pmtAmountB = $t01250813012._2 | |
433 | + | let change = $t01250813012._3 | |
434 | + | let changeAssetId = $t01250813012._4 | |
435 | + | let shareTokenRatio = $t01250813012._5 | |
436 | + | let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8) | |
437 | + | if (if ((size(i.payments) != 2)) | |
438 | + | then (size(i.payments) != 3) | |
439 | + | else false) | |
440 | + | then throw("Two or three payments expected") | |
441 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
442 | + | then true | |
443 | + | else (pmtAssetIdB != assetIdB)) | |
444 | + | then throwAssets() | |
445 | + | else if ((shareTokenToPayAmount == 0)) | |
446 | + | then throw("Too small amount to replenish") | |
447 | + | else if ((0 > change)) | |
448 | + | then throw("Change < 0") | |
449 | + | else if (!(hasEnoughBalance)) | |
450 | + | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
451 | + | else { | |
452 | + | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
453 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
454 | + | else 0 | |
455 | + | if ((stake1 == stake1)) | |
456 | + | then { | |
457 | + | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
458 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
459 | + | else 0 | |
460 | + | if ((stake2 == stake2)) | |
461 | + | then { | |
462 | + | let scriptActions = [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))), ScriptTransfer(i.caller, change, changeAssetId)] | |
463 | + | if (stakeFarming) | |
464 | + | then { | |
465 | + | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmount)] ++ (if ((size(i.payments) == 3)) | |
466 | + | then [AttachedPayment(if ((i.payments[2].assetId == base58'')) | |
467 | + | then unit | |
468 | + | else i.payments[2].assetId, i.payments[2].amount)] | |
469 | + | else nil)) | |
470 | + | let re = invoke(this, "reissueShare", [shareTokenToPayAmount], nil) | |
471 | + | if ((re == re)) | |
472 | + | then { | |
473 | + | let s = invoke(farmingAddress, "lockShareTokensFromPool", [i.caller.bytes, toString(this), lockType], stPayments) | |
474 | + | if ((s == s)) | |
475 | + | then scriptActions | |
476 | + | else throw("Strict value is not equal to itself.") | |
477 | + | } | |
478 | + | else throw("Strict value is not equal to itself.") | |
479 | + | } | |
480 | + | else (scriptActions ++ [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)]) | |
481 | + | } | |
482 | + | else throw("Strict value is not equal to itself.") | |
483 | + | } | |
484 | + | else throw("Strict value is not equal to itself.") | |
485 | + | } | |
486 | + | } | |
487 | + | ||
488 | + | ||
489 | + | func replenishWithOneTokenCalc (i,virtualSwapTokenPay,virtualSwapTokenGet,stakeFarming,lockType) = { | |
490 | + | let $t01540215477 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
491 | + | let pmtAmount = $t01540215477._1 | |
492 | + | let pmtAssetId = $t01540215477._2 | |
493 | + | let $t01548215555 = getAssetInfo(pmtAssetId) | |
494 | + | let pmtStrAssetId = $t01548215555._1 | |
495 | + | let pmtAssetName = $t01548215555._2 | |
496 | + | let pmtDecimals = $t01548215555._3 | |
497 | + | let pmtMinThreshold = 5000000 | |
498 | + | let thresholdValueForMinTolerance = 50000000 | |
499 | + | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
500 | + | then 100000 | |
501 | + | else 1 | |
502 | + | let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000)) | |
503 | + | let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000)) | |
504 | + | let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000)) | |
505 | + | if ((pmtMinThreshold > pmtAmount)) | |
506 | + | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
507 | + | else if (if ((size(i.payments) != 1)) | |
508 | + | then (size(i.payments) != 2) | |
509 | + | else false) | |
510 | + | then throw("One or two payments expected") | |
511 | + | else if (!(hasEnoughBalance)) | |
512 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
513 | + | else if (if ((pmtAssetId != assetIdA)) | |
514 | + | then (pmtAssetId != assetIdB) | |
515 | + | else false) | |
516 | + | then throwAssets() | |
517 | + | else { | |
518 | + | let $t01656217204 = if ((pmtAssetId == assetIdA)) | |
519 | + | then $Tuple6((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), (balanceA + pmtAmount), balanceB) | |
520 | + | else $Tuple6(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), balanceA, (balanceB + pmtAmount)) | |
521 | + | let virtualReplenishA = $t01656217204._1 | |
522 | + | let virtualReplenishB = $t01656217204._2 | |
523 | + | let balanceAfterSwapA = $t01656217204._3 | |
524 | + | let balanceAfterSwapB = $t01656217204._4 | |
525 | + | let newBalanceA = $t01656217204._5 | |
526 | + | let newBalanceB = $t01656217204._6 | |
527 | + | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
528 | + | let ratioVirtualBalanceToVirtualReplenish = (fraction(scale16, balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
529 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
530 | + | if (if ((slippageValueMinForSwap >= fraction(scale8, invariant, invariantNew))) | |
531 | + | then true | |
532 | + | else (invariant > invariantNew)) | |
533 | + | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
534 | + | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
535 | + | then true | |
536 | + | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
537 | + | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
538 | + | else if (if ((dAppThresholdAmount > newBalanceA)) | |
539 | + | then true | |
540 | + | else (dAppThresholdAmount > newBalanceB)) | |
541 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
542 | + | else { | |
543 | + | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
544 | + | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
545 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
546 | + | let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6) | |
547 | + | let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6) | |
548 | + | let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply) | |
549 | + | let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply) | |
550 | + | let $t01919419489 = if ((pmtStrAssetId == strAssetIdA)) | |
551 | + | then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB) | |
552 | + | else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA) | |
553 | + | let stakeAmount = $t01919419489._1 | |
554 | + | let unstakeAmount = $t01919419489._2 | |
555 | + | let unstakeAsset = $t01919419489._3 | |
556 | + | let stake1 = if (contains(stakingAssets, pmtStrAssetId)) | |
557 | + | then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil) | |
558 | + | else 0 | |
559 | + | if ((stake1 == stake1)) | |
560 | + | then { | |
561 | + | let stake2 = if (contains(stakingAssets, unstakeAsset)) | |
562 | + | then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil) | |
563 | + | else 0 | |
564 | + | if ((stake2 == stake2)) | |
565 | + | then { | |
566 | + | let scriptActions = [IntegerEntry(kBalanceA, (newBalanceA - governanceRewardTokenA)), IntegerEntry(kBalanceB, (newBalanceB - governanceRewardTokenB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmountAfterFee)), IntegerEntry(kInvariant, invariantCalc((newBalanceA - governanceRewardTokenA), (newBalanceB - governanceRewardTokenB))), ScriptTransfer(moneyBoxAddress, governanceRewardTokenA, assetIdA), ScriptTransfer(moneyBoxAddress, governanceRewardTokenB, assetIdB)] | |
567 | + | if (stakeFarming) | |
568 | + | then { | |
569 | + | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmountAfterFee)] ++ (if ((size(i.payments) == 2)) | |
570 | + | then [AttachedPayment(if ((i.payments[1].assetId == base58'')) | |
571 | + | then unit | |
572 | + | else i.payments[1].assetId, i.payments[1].amount)] | |
573 | + | else nil)) | |
574 | + | let re = invoke(this, "reissueShare", [shareTokenToPayAmountAfterFee], nil) | |
575 | + | if ((re == re)) | |
576 | + | then { | |
577 | + | let s = invoke(farmingAddress, "lockShareTokensFromPool", [i.caller.bytes, toString(this), lockType], stPayments) | |
578 | + | if ((s == s)) | |
579 | + | then scriptActions | |
580 | + | else throw("Strict value is not equal to itself.") | |
581 | + | } | |
582 | + | else throw("Strict value is not equal to itself.") | |
583 | + | } | |
584 | + | else (scriptActions ++ [Reissue(shareAssetId, shareTokenToPayAmountAfterFee, true), ScriptTransfer(i.caller, shareTokenToPayAmountAfterFee, shareAssetId)]) | |
585 | + | } | |
586 | + | else throw("Strict value is not equal to itself.") | |
587 | + | } | |
588 | + | else throw("Strict value is not equal to itself.") | |
589 | + | } | |
590 | + | } | |
591 | + | } | |
592 | + | ||
593 | + | ||
594 | + | func withdrawCalc (i,unlockAmount) = { | |
595 | + | let $t02147621811 = if ((size(i.payments) == 1)) | |
596 | + | then if ((i.payments[0].assetId != shareAssetId)) | |
597 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
598 | + | else $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
599 | + | else $Tuple2(0, shareAssetId) | |
600 | + | let pmtAmount = $t02147621811._1 | |
601 | + | let pmtAssetId = $t02147621811._2 | |
602 | + | if (!(hasEnoughBalance)) | |
603 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
604 | + | else { | |
605 | + | let unlock = if ((unlockAmount > 0)) | |
606 | + | then invoke(farmingAddress, "withdrawShareTokensFromPool", [i.caller.bytes, toString(this), unlockAmount], nil) | |
607 | + | else 0 | |
608 | + | if ((unlock == unlock)) | |
609 | + | then { | |
610 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
611 | + | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
612 | + | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
613 | + | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
614 | + | let stake1 = if (contains(stakingAssets, strAssetIdA)) | |
615 | + | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
616 | + | else 0 | |
617 | + | if ((stake1 == stake1)) | |
618 | + | then { | |
619 | + | let stake2 = if (contains(stakingAssets, strAssetIdB)) | |
620 | + | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
621 | + | else 0 | |
622 | + | if ((stake2 == stake2)) | |
623 | + | then [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, withdrawAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
624 | + | else throw("Strict value is not equal to itself.") | |
625 | + | } | |
626 | + | else throw("Strict value is not equal to itself.") | |
627 | + | } | |
628 | + | else throw("Strict value is not equal to itself.") | |
629 | + | } | |
630 | + | } | |
631 | + | ||
632 | + | ||
403 | 633 | @Callable(i) | |
404 | 634 | func init (firstHarvest) = { | |
405 | - | let $ | |
406 | - | let pmtAmountA = $ | |
407 | - | let pmtAssetIdA = $ | |
408 | - | let $ | |
409 | - | let pmtAmountB = $ | |
410 | - | let pmtAssetIdB = $ | |
411 | - | let $ | |
412 | - | let pmtStrAssetIdA = $ | |
413 | - | let pmtAssetNameA = $ | |
414 | - | let pmtDecimalsA = $ | |
415 | - | let $ | |
416 | - | let pmtStrAssetIdB = $ | |
417 | - | let pmtAssetNameB = $ | |
418 | - | let pmtDecimalsB = $ | |
635 | + | let $t02336323440 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
636 | + | let pmtAmountA = $t02336323440._1 | |
637 | + | let pmtAssetIdA = $t02336323440._2 | |
638 | + | let $t02344523522 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
639 | + | let pmtAmountB = $t02344523522._1 | |
640 | + | let pmtAssetIdB = $t02344523522._2 | |
641 | + | let $t02352723604 = getAssetInfo(pmtAssetIdA) | |
642 | + | let pmtStrAssetIdA = $t02352723604._1 | |
643 | + | let pmtAssetNameA = $t02352723604._2 | |
644 | + | let pmtDecimalsA = $t02352723604._3 | |
645 | + | let $t02360923686 = getAssetInfo(pmtAssetIdB) | |
646 | + | let pmtStrAssetIdB = $t02360923686._1 | |
647 | + | let pmtAssetNameB = $t02360923686._2 | |
648 | + | let pmtDecimalsB = $t02360923686._3 | |
419 | 649 | if (isDefined(getBoolean(this, kActive))) | |
420 | 650 | then throwIsActive() | |
421 | 651 | else if ((pmtAssetIdA == pmtAssetIdB)) | |
452 | 682 | ||
453 | 683 | ||
454 | 684 | @Callable(i) | |
455 | - | func replenishWithTwoTokens (stakeFarming,lockType) = valueOrElse(isActive(), { | |
456 | - | let pmtAssetIdA = i.payments[0].assetId | |
457 | - | let pmtAssetIdB = i.payments[1].assetId | |
458 | - | let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA) | |
459 | - | let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB) | |
460 | - | let $t01519415271 = getAssetInfo(pmtAssetIdA) | |
461 | - | let pmtStrAssetIdA = $t01519415271._1 | |
462 | - | let pmtAssetNameA = $t01519415271._2 | |
463 | - | let pmtDecimalsA = $t01519415271._3 | |
464 | - | let $t01527615393 = getAssetInfo(pmtAssetIdB) | |
465 | - | let pmtStrAssetIdB = $t01527615393._1 | |
466 | - | let pmtAssetNameB = $t01527615393._2 | |
467 | - | let pmtDecimalsB = $t01527615393._3 | |
468 | - | let $t01539815902 = if ((ratioShareTokensInB > ratioShareTokensInA)) | |
469 | - | then { | |
470 | - | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
471 | - | $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA) | |
472 | - | } | |
473 | - | else { | |
474 | - | let pmt = fraction(balanceA, ratioShareTokensInB, scale8, CEILING) | |
475 | - | $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB) | |
476 | - | } | |
477 | - | let pmtAmountA = $t01539815902._1 | |
478 | - | let pmtAmountB = $t01539815902._2 | |
479 | - | let change = $t01539815902._3 | |
480 | - | let changeAssetId = $t01539815902._4 | |
481 | - | let shareTokenRatio = $t01539815902._5 | |
482 | - | let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8) | |
483 | - | if (if ((size(i.payments) != 2)) | |
484 | - | then (size(i.payments) != 3) | |
685 | + | func replenishWithTwoTokensV2 (stakeFarming,lockType) = valueOrElse(isActive(), replenishWithTwoTokensCalc(i, stakeFarming, lockType)) | |
686 | + | ||
687 | + | ||
688 | + | ||
689 | + | @Callable(i) | |
690 | + | func replenishWithOneTokenV2 (virtualSwapTokenPay,virtualSwapTokenGet,stakeFarming,lockType) = valueOrElse(isActive(), replenishWithOneTokenCalc(i, virtualSwapTokenPay, virtualSwapTokenGet, stakeFarming, lockType)) | |
691 | + | ||
692 | + | ||
693 | + | ||
694 | + | @Callable(i) | |
695 | + | func withdrawV2 (unlockAmount) = valueOrElse(isActive(), withdrawCalc(i, unlockAmount)) | |
696 | + | ||
697 | + | ||
698 | + | ||
699 | + | @Callable(i) | |
700 | + | func withdrawOneToken (unlockAmount,withdrawAsset,estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), { | |
701 | + | let $t02705627391 = if ((size(i.payments) == 1)) | |
702 | + | then if ((i.payments[0].assetId != shareAssetId)) | |
703 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
704 | + | else $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
705 | + | else $Tuple2(0, shareAssetId) | |
706 | + | let pmtAmount = $t02705627391._1 | |
707 | + | let pmtAssetId = $t02705627391._2 | |
708 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
709 | + | if (if ((withdrawAsset != strAssetIdA)) | |
710 | + | then (withdrawAsset != strAssetIdB) | |
485 | 711 | else false) | |
486 | - | then throw("Two or three payments expected") | |
487 | - | else if (if ((pmtAssetIdA != assetIdA)) | |
488 | - | then true | |
489 | - | else (pmtAssetIdB != assetIdB)) | |
490 | - | then throwAssets() | |
491 | - | else if ((shareTokenToPayAmount == 0)) | |
492 | - | then throw("Too small amount to replenish") | |
493 | - | else if ((0 > change)) | |
494 | - | then throw("Change < 0") | |
495 | - | else if (!(hasEnoughBalance)) | |
496 | - | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
497 | - | else { | |
498 | - | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
499 | - | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
712 | + | then throw("Incorrect withdraw asset") | |
713 | + | else if ((0 >= withdrawAmount)) | |
714 | + | then throw("withdraw amount must be grater than 0") | |
715 | + | else if (!(hasEnoughBalance)) | |
716 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
717 | + | else { | |
718 | + | let unlock = if ((unlockAmount > 0)) | |
719 | + | then invoke(farmingAddress, "withdrawShareTokensFromPool", [i.caller.bytes, toString(this), unlockAmount], nil) | |
720 | + | else 0 | |
721 | + | if ((unlock == unlock)) | |
722 | + | then { | |
723 | + | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
724 | + | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
725 | + | let newVirtBalcA = (balanceA - amountToPayA) | |
726 | + | let newVirtBalcB = (balanceB - amountToPayB) | |
727 | + | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
728 | + | let amountExchangedWithFee = if ((withdrawAsset == strAssetIdA)) | |
729 | + | then calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, amountToPayB, assetIdB, newVirtBalcA, newVirtBalcB, invariantCalc(newVirtBalcA, newVirtBalcB)) | |
730 | + | else calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, amountToPayA, assetIdA, newVirtBalcA, newVirtBalcB, invariantCalc(newVirtBalcA, newVirtBalcB)) | |
731 | + | let govReward = fraction(amountExchangedWithFee, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
732 | + | let amountExchanged = fraction(amountExchangedWithFee, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
733 | + | let $t02899429323 = if ((withdrawAsset == strAssetIdA)) | |
734 | + | then $Tuple3((amountToPayA + amountExchanged), (((balanceA - amountToPayA) - amountExchanged) - govReward), balanceB) | |
735 | + | else $Tuple3((amountToPayB + amountExchanged), balanceA, (((balanceB - amountToPayB) - amountExchanged) - govReward)) | |
736 | + | let amountToPay = $t02899429323._1 | |
737 | + | let balanceANew = $t02899429323._2 | |
738 | + | let balanceBNew = $t02899429323._3 | |
739 | + | let invariantCalculated = invariantCalc(balanceANew, balanceBNew) | |
740 | + | let stake1 = if (contains(stakingAssets, withdrawAsset)) | |
741 | + | then invoke(this, "stakeUnstake", [false, (amountToPay + govReward), withdrawAsset], nil) | |
500 | 742 | else 0 | |
501 | 743 | if ((stake1 == stake1)) | |
502 | - | then { | |
503 | - | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
504 | - | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
505 | - | else 0 | |
506 | - | if ((stake2 == stake2)) | |
507 | - | then { | |
508 | - | let scriptActions = [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))), ScriptTransfer(i.caller, change, changeAssetId)] | |
509 | - | if (stakeFarming) | |
510 | - | then { | |
511 | - | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmount)] ++ (if ((size(i.payments) == 3)) | |
512 | - | then [AttachedPayment(i.payments[2].assetId, i.payments[2].amount)] | |
513 | - | else nil)) | |
514 | - | let re = invoke(this, "reissueShare", [shareTokenToPayAmount], nil) | |
515 | - | if ((re == re)) | |
516 | - | then { | |
517 | - | let s = invoke(farmingAddress, "lockShareTokens", [toString(this), lockType], stPayments) | |
518 | - | if ((s == s)) | |
519 | - | then scriptActions | |
520 | - | else throw("Strict value is not equal to itself.") | |
521 | - | } | |
522 | - | else throw("Strict value is not equal to itself.") | |
523 | - | } | |
524 | - | else (scriptActions ++ [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)]) | |
525 | - | } | |
526 | - | else throw("Strict value is not equal to itself.") | |
527 | - | } | |
744 | + | then [IntegerEntry(kBalanceA, balanceANew), IntegerEntry(kBalanceB, balanceBNew), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, withdrawAmount), ScriptTransfer(i.caller, amountToPay, fromBase58String(withdrawAsset)), ScriptTransfer(moneyBoxAddress, govReward, fromBase58String(withdrawAsset))] | |
528 | 745 | else throw("Strict value is not equal to itself.") | |
529 | 746 | } | |
747 | + | else throw("Strict value is not equal to itself.") | |
748 | + | } | |
530 | 749 | }) | |
531 | 750 | ||
532 | 751 | ||
533 | 752 | ||
534 | 753 | @Callable(i) | |
535 | - | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet,stakeFarming,lockType) = valueOrElse(isActive(), { | |
536 | - | let $t01828118356 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
537 | - | let pmtAmount = $t01828118356._1 | |
538 | - | let pmtAssetId = $t01828118356._2 | |
539 | - | let $t01836118434 = getAssetInfo(pmtAssetId) | |
540 | - | let pmtStrAssetId = $t01836118434._1 | |
541 | - | let pmtAssetName = $t01836118434._2 | |
542 | - | let pmtDecimals = $t01836118434._3 | |
543 | - | let pmtMinThreshold = 5000000 | |
544 | - | let thresholdValueForMinTolerance = 50000000 | |
545 | - | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
546 | - | then 100000 | |
547 | - | else 1 | |
548 | - | let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000)) | |
549 | - | let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000)) | |
550 | - | let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000)) | |
551 | - | if ((pmtMinThreshold > pmtAmount)) | |
552 | - | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
553 | - | else if (if ((size(i.payments) != 1)) | |
554 | - | then (size(i.payments) != 2) | |
555 | - | else false) | |
556 | - | then throw("One or two payments expected") | |
557 | - | else if (!(hasEnoughBalance)) | |
558 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
559 | - | else if (if ((pmtAssetId != assetIdA)) | |
560 | - | then (pmtAssetId != assetIdB) | |
561 | - | else false) | |
562 | - | then throwAssets() | |
563 | - | else { | |
564 | - | let $t01944120083 = if ((pmtAssetId == assetIdA)) | |
565 | - | then $Tuple6((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), (balanceA + pmtAmount), balanceB) | |
566 | - | else $Tuple6(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), balanceA, (balanceB + pmtAmount)) | |
567 | - | let virtualReplenishA = $t01944120083._1 | |
568 | - | let virtualReplenishB = $t01944120083._2 | |
569 | - | let balanceAfterSwapA = $t01944120083._3 | |
570 | - | let balanceAfterSwapB = $t01944120083._4 | |
571 | - | let newBalanceA = $t01944120083._5 | |
572 | - | let newBalanceB = $t01944120083._6 | |
573 | - | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
574 | - | let ratioVirtualBalanceToVirtualReplenish = (fraction(scale16, balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
575 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
576 | - | if (if ((slippageValueMinForSwap >= fraction(scale8, invariant, invariantNew))) | |
577 | - | then true | |
578 | - | else (invariant > invariantNew)) | |
579 | - | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
580 | - | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
581 | - | then true | |
582 | - | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
583 | - | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
584 | - | else if (if ((dAppThresholdAmount > newBalanceA)) | |
585 | - | then true | |
586 | - | else (dAppThresholdAmount > newBalanceB)) | |
587 | - | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
588 | - | else { | |
589 | - | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
590 | - | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
591 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
592 | - | let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6) | |
593 | - | let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6) | |
594 | - | let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply) | |
595 | - | let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply) | |
596 | - | let $t02207322368 = if ((pmtStrAssetId == strAssetIdA)) | |
597 | - | then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB) | |
598 | - | else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA) | |
599 | - | let stakeAmount = $t02207322368._1 | |
600 | - | let unstakeAmount = $t02207322368._2 | |
601 | - | let unstakeAsset = $t02207322368._3 | |
602 | - | let stake1 = if (contains(stakingAssets, pmtStrAssetId)) | |
603 | - | then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil) | |
604 | - | else 0 | |
605 | - | if ((stake1 == stake1)) | |
606 | - | then { | |
607 | - | let stake2 = if (contains(stakingAssets, unstakeAsset)) | |
608 | - | then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil) | |
609 | - | else 0 | |
610 | - | if ((stake2 == stake2)) | |
611 | - | then { | |
612 | - | let scriptActions = [IntegerEntry(kBalanceA, (newBalanceA - governanceRewardTokenA)), IntegerEntry(kBalanceB, (newBalanceB - governanceRewardTokenB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmountAfterFee)), IntegerEntry(kInvariant, invariantCalc((newBalanceA - governanceRewardTokenA), (newBalanceB - governanceRewardTokenB))), ScriptTransfer(moneyBoxAddress, governanceRewardTokenA, assetIdA), ScriptTransfer(moneyBoxAddress, governanceRewardTokenB, assetIdB)] | |
613 | - | if (stakeFarming) | |
614 | - | then { | |
615 | - | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmountAfterFee)] ++ (if ((size(i.payments) == 2)) | |
616 | - | then [AttachedPayment(i.payments[1].assetId, i.payments[1].amount)] | |
617 | - | else nil)) | |
618 | - | let re = invoke(this, "reissueShare", [shareTokenToPayAmountAfterFee], nil) | |
619 | - | if ((re == re)) | |
620 | - | then { | |
621 | - | let s = invoke(farmingAddress, "lockShareTokens", [toString(this), lockType], stPayments) | |
622 | - | if ((s == s)) | |
623 | - | then scriptActions | |
624 | - | else throw("Strict value is not equal to itself.") | |
625 | - | } | |
626 | - | else throw("Strict value is not equal to itself.") | |
627 | - | } | |
628 | - | else (scriptActions ++ [Reissue(shareAssetId, shareTokenToPayAmountAfterFee, true), ScriptTransfer(i.caller, shareTokenToPayAmountAfterFee, shareAssetId)]) | |
629 | - | } | |
630 | - | else throw("Strict value is not equal to itself.") | |
631 | - | } | |
632 | - | else throw("Strict value is not equal to itself.") | |
633 | - | } | |
634 | - | } | |
635 | - | }) | |
636 | - | ||
637 | - | ||
638 | - | ||
639 | - | @Callable(i) | |
640 | - | func withdraw (unlockAmount) = valueOrElse(isActive(), { | |
641 | - | let $t02429724632 = if ((size(i.payments) == 1)) | |
642 | - | then if ((i.payments[0].assetId != shareAssetId)) | |
643 | - | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
644 | - | else $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
645 | - | else $Tuple2(0, shareAssetId) | |
646 | - | let pmtAmount = $t02429724632._1 | |
647 | - | let pmtAssetId = $t02429724632._2 | |
648 | - | if (!(hasEnoughBalance)) | |
649 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
650 | - | else { | |
651 | - | let unlock = if ((unlockAmount > 0)) | |
652 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
653 | - | else 0 | |
654 | - | if ((unlock == unlock)) | |
655 | - | then { | |
656 | - | let withdrawAmount = (pmtAmount + unlockAmount) | |
657 | - | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
658 | - | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
659 | - | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
660 | - | let stake1 = if (contains(stakingAssets, strAssetIdA)) | |
661 | - | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
662 | - | else 0 | |
663 | - | if ((stake1 == stake1)) | |
664 | - | then { | |
665 | - | let stake2 = if (contains(stakingAssets, strAssetIdB)) | |
666 | - | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
667 | - | else 0 | |
668 | - | if ((stake2 == stake2)) | |
669 | - | then [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, withdrawAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
670 | - | else throw("Strict value is not equal to itself.") | |
671 | - | } | |
672 | - | else throw("Strict value is not equal to itself.") | |
673 | - | } | |
674 | - | else throw("Strict value is not equal to itself.") | |
675 | - | } | |
676 | - | }) | |
677 | - | ||
678 | - | ||
679 | - | ||
680 | - | @Callable(i) | |
681 | - | func withdrawOneToken (unlockAmount,withdrawAsset,estimatedAmountToReceive,minAmountToReceive) = { | |
682 | - | let $t02624826583 = if ((size(i.payments) == 1)) | |
683 | - | then if ((i.payments[0].assetId != shareAssetId)) | |
684 | - | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
685 | - | else $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
686 | - | else $Tuple2(0, shareAssetId) | |
687 | - | let pmtAmount = $t02624826583._1 | |
688 | - | let pmtAssetId = $t02624826583._2 | |
689 | - | if (if ((withdrawAsset != strAssetIdA)) | |
690 | - | then (withdrawAsset != strAssetIdB) | |
691 | - | else false) | |
692 | - | then throw("Incorrect withdraw asset") | |
693 | - | else if (!(hasEnoughBalance)) | |
694 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
695 | - | else { | |
696 | - | let unlock = if ((unlockAmount > 0)) | |
697 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
698 | - | else 0 | |
699 | - | if ((unlock == unlock)) | |
700 | - | then { | |
701 | - | let withdrawAmount = (pmtAmount + unlockAmount) | |
702 | - | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
703 | - | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
704 | - | let newVirtBalcA = (balanceA - amountToPayA) | |
705 | - | let newVirtBalcB = (balanceB - amountToPayB) | |
706 | - | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
707 | - | let amountExchangedWithFee = if ((withdrawAsset == strAssetIdA)) | |
708 | - | then calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, amountToPayB, assetIdB, newVirtBalcA, newVirtBalcB, invariantCalc(newVirtBalcA, newVirtBalcB)) | |
709 | - | else calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, amountToPayA, assetIdA, newVirtBalcA, newVirtBalcB, invariantCalc(newVirtBalcA, newVirtBalcB)) | |
710 | - | let govReward = fraction(amountExchangedWithFee, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
711 | - | let amountExchanged = fraction(amountExchangedWithFee, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
712 | - | let $t02809428423 = if ((withdrawAsset == strAssetIdA)) | |
713 | - | then $Tuple3((amountToPayA + amountExchanged), (((balanceA - amountToPayA) - amountExchanged) - govReward), balanceB) | |
714 | - | else $Tuple3((amountToPayB + amountExchanged), balanceA, (((balanceB - amountToPayB) - amountExchanged) - govReward)) | |
715 | - | let amountToPay = $t02809428423._1 | |
716 | - | let balanceANew = $t02809428423._2 | |
717 | - | let balanceBNew = $t02809428423._3 | |
718 | - | let invariantCalculated = invariantCalc(balanceANew, balanceBNew) | |
719 | - | let stake1 = if (contains(stakingAssets, withdrawAsset)) | |
720 | - | then invoke(this, "stakeUnstake", [false, (amountToPay + govReward), withdrawAsset], nil) | |
721 | - | else 0 | |
722 | - | if ((stake1 == stake1)) | |
723 | - | then [IntegerEntry(kBalanceA, balanceANew), IntegerEntry(kBalanceB, balanceBNew), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, withdrawAmount), ScriptTransfer(i.caller, amountToPay, fromBase58String(withdrawAsset)), ScriptTransfer(moneyBoxAddress, govReward, fromBase58String(withdrawAsset))] | |
724 | - | else throw("Strict value is not equal to itself.") | |
725 | - | } | |
726 | - | else throw("Strict value is not equal to itself.") | |
727 | - | } | |
728 | - | } | |
729 | - | ||
730 | - | ||
731 | - | ||
732 | - | @Callable(i) | |
733 | 754 | func exchange (estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), { | |
734 | - | let $ | |
735 | - | let pmtAmount = $ | |
736 | - | let pmtAssetId = $ | |
755 | + | let $t03019630271 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
756 | + | let pmtAmount = $t03019630271._1 | |
757 | + | let pmtAssetId = $t03019630271._2 | |
737 | 758 | if ((0 >= estimatedAmountToReceive)) | |
738 | 759 | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
739 | 760 | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
760 | 781 | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
761 | 782 | let governanceReward = fraction(amount, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
762 | 783 | let amountMinusFee = fraction(amount, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
763 | - | let $ | |
784 | + | let $t03175532017 = if ((pmtAssetId == assetIdA)) | |
764 | 785 | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
765 | 786 | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
766 | - | let newBalanceA = $ | |
767 | - | let newBalanceB = $ | |
787 | + | let newBalanceA = $t03175532017._1 | |
788 | + | let newBalanceB = $t03175532017._2 | |
768 | 789 | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
769 | 790 | if (if ((dAppThresholdAmount > newBalanceA)) | |
770 | 791 | then true | |
771 | 792 | else (dAppThresholdAmount > newBalanceB)) | |
772 | 793 | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
773 | 794 | else { | |
774 | - | let $ | |
775 | - | let pmtStrAssetId = $ | |
776 | - | let pmtAssetName = $ | |
777 | - | let pmtDecimals = $ | |
778 | - | let $ | |
779 | - | let sendStrAssetId = $ | |
780 | - | let sendAssetName = $ | |
781 | - | let sendDecimals = $ | |
795 | + | let $t03231632389 = getAssetInfo(pmtAssetId) | |
796 | + | let pmtStrAssetId = $t03231632389._1 | |
797 | + | let pmtAssetName = $t03231632389._2 | |
798 | + | let pmtDecimals = $t03231632389._3 | |
799 | + | let $t03240232479 = getAssetInfo(sendAssetId) | |
800 | + | let sendStrAssetId = $t03240232479._1 | |
801 | + | let sendAssetName = $t03240232479._2 | |
802 | + | let sendDecimals = $t03240232479._3 | |
782 | 803 | let stake1 = if (contains(stakingAssets, pmtStrAssetId)) | |
783 | 804 | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
784 | 805 | else 0 | |
864 | 885 | func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this)) | |
865 | 886 | then throw("Only contract itself can invoke this function") | |
866 | 887 | else { | |
867 | - | let $ | |
868 | - | let call = $ | |
869 | - | let addr = $ | |
870 | - | let params = $ | |
871 | - | let payments = $ | |
888 | + | let $t03578135884 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
889 | + | let call = $t03578135884._1 | |
890 | + | let addr = $t03578135884._2 | |
891 | + | let params = $t03578135884._3 | |
892 | + | let payments = $t03578135884._4 | |
872 | 893 | let inv = invoke(addr, call, params, payments) | |
873 | 894 | if ((inv == inv)) | |
874 | 895 | then nil | |
875 | 896 | else throw("Strict value is not equal to itself.") | |
876 | 897 | } | |
898 | + | ||
899 | + | ||
900 | + | ||
901 | + | @Callable(i) | |
902 | + | func replenishWithTwoTokens () = valueOrElse(isActive(), replenishWithTwoTokensCalc(i, false, 0)) | |
903 | + | ||
904 | + | ||
905 | + | ||
906 | + | @Callable(i) | |
907 | + | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = valueOrElse(isActive(), replenishWithOneTokenCalc(i, virtualSwapTokenPay, virtualSwapTokenGet, false, 0)) | |
908 | + | ||
909 | + | ||
910 | + | ||
911 | + | @Callable(i) | |
912 | + | func withdraw () = valueOrElse(isActive(), withdrawCalc(i, 0)) | |
877 | 913 | ||
878 | 914 | ||
879 | 915 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "2.0.0" | |
5 | 5 | ||
6 | 6 | let kVersion = "version" | |
7 | 7 | ||
8 | 8 | let kActive = "active" | |
9 | + | ||
10 | + | let kActiveGlob = "active_all_contracts" | |
9 | 11 | ||
10 | 12 | let kAssetIdA = "A_asset_id" | |
11 | 13 | ||
12 | 14 | let kAssetIdB = "B_asset_id" | |
13 | 15 | ||
14 | 16 | let kBalanceA = "A_asset_balance" | |
15 | 17 | ||
16 | 18 | let kBalanceB = "B_asset_balance" | |
17 | 19 | ||
18 | 20 | let kShareAssetId = "share_asset_id" | |
19 | 21 | ||
20 | 22 | let kShareAssetSupply = "share_asset_supply" | |
21 | 23 | ||
22 | 24 | let kFee = "commission" | |
23 | 25 | ||
24 | 26 | let kInvariant = "invariant" | |
25 | 27 | ||
26 | 28 | let kCause = "shutdown_cause" | |
27 | 29 | ||
28 | 30 | let kUSDNAddress = "staking_usdnnsbt_address" | |
29 | 31 | ||
30 | 32 | let kEURNAddress = "staking_eurn_address" | |
31 | 33 | ||
32 | 34 | let kDiscounts = "discounts" | |
33 | 35 | ||
34 | 36 | let kDiscountValues = "discount_values" | |
35 | 37 | ||
36 | 38 | let kUserSwopInGov = "_SWOP_amount" | |
37 | 39 | ||
38 | 40 | let kUserGSwopInGov = "_GSwop_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 kFarmingAddress = "farming_address" | |
65 | 67 | ||
66 | 68 | let kVotingAddress = "voting_address" | |
67 | 69 | ||
68 | 70 | let kUSDNAssetId = "usdn_asset_id" | |
69 | 71 | ||
70 | 72 | let kStakingAssets = "staking_assets" | |
71 | 73 | ||
72 | 74 | let oracle = Address(base58'3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz') | |
73 | 75 | ||
74 | 76 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
75 | 77 | case string: String => | |
76 | 78 | fromBase58String(string) | |
77 | 79 | case nothing => | |
78 | 80 | throw((key + "is empty")) | |
79 | 81 | } | |
80 | 82 | ||
81 | 83 | ||
82 | 84 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
83 | 85 | ||
84 | 86 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
85 | 87 | ||
86 | 88 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
87 | 89 | ||
88 | 90 | let adminPubKeyInvoke = getBase58FromOracle(kAdminInvokePubKey) | |
89 | 91 | ||
90 | 92 | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
91 | 93 | ||
92 | 94 | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
93 | 95 | ||
94 | 96 | let stakingUSDNAddress = Address(getBase58FromOracle(kUSDNAddress)) | |
95 | 97 | ||
96 | 98 | let votingAddress = Address(getBase58FromOracle(kVotingAddress)) | |
97 | 99 | ||
98 | 100 | let farmingAddress = Address(getBase58FromOracle(kFarmingAddress)) | |
99 | 101 | ||
100 | 102 | let USDN = getBase58FromOracle(kUSDNAssetId) | |
101 | 103 | ||
102 | 104 | let stakingAssets = getStringValue(oracle, kStakingAssets) | |
103 | 105 | ||
104 | 106 | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
105 | 107 | ||
106 | 108 | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
107 | 109 | ||
108 | 110 | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
109 | 111 | ||
110 | 112 | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 3) | |
111 | 113 | ||
112 | 114 | let active = getBooleanValue(this, kActive) | |
115 | + | ||
116 | + | let activeGlob = valueOrElse(getBoolean(oracle, kActiveGlob), true) | |
113 | 117 | ||
114 | 118 | let strAssetIdA = getStringValue(this, kAssetIdA) | |
115 | 119 | ||
116 | 120 | let strAssetIdB = getStringValue(this, kAssetIdB) | |
117 | 121 | ||
118 | 122 | let assetIdA = if ((strAssetIdA == "WAVES")) | |
119 | 123 | then unit | |
120 | 124 | else fromBase58String(strAssetIdA) | |
121 | 125 | ||
122 | 126 | let assetIdB = if ((strAssetIdB == "WAVES")) | |
123 | 127 | then unit | |
124 | 128 | else fromBase58String(strAssetIdB) | |
125 | 129 | ||
126 | 130 | let assetNameA = match assetIdA { | |
127 | 131 | case id: ByteVector => | |
128 | 132 | value(assetInfo(id)).name | |
129 | 133 | case waves: Unit => | |
130 | 134 | "WAVES" | |
131 | 135 | case _ => | |
132 | 136 | throw("Match error") | |
133 | 137 | } | |
134 | 138 | ||
135 | 139 | let assetNameB = match assetIdB { | |
136 | 140 | case id: ByteVector => | |
137 | 141 | value(assetInfo(id)).name | |
138 | 142 | case waves: Unit => | |
139 | 143 | "WAVES" | |
140 | 144 | case _ => | |
141 | 145 | throw("Match error") | |
142 | 146 | } | |
143 | 147 | ||
144 | 148 | let balanceA = getIntegerValue(this, kBalanceA) | |
145 | 149 | ||
146 | 150 | let balanceB = getIntegerValue(this, kBalanceB) | |
147 | 151 | ||
148 | 152 | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
149 | 153 | ||
150 | 154 | let shareAssetSupply = getIntegerValue(this, kShareAssetSupply) | |
151 | 155 | ||
152 | 156 | let invariant = getIntegerValue(this, kInvariant) | |
153 | 157 | ||
154 | 158 | let fee = getIntegerValue(this, kFee) | |
155 | 159 | ||
156 | 160 | let feeGovernance = fraction(fee, 40, 100) | |
157 | 161 | ||
158 | 162 | let feeScale6 = 1000000 | |
159 | 163 | ||
160 | 164 | let scale3 = 1000 | |
161 | 165 | ||
162 | 166 | let scale8 = 100000000 | |
163 | 167 | ||
164 | 168 | let scale16 = 10000000000000000 | |
165 | 169 | ||
166 | 170 | let digits8 = 8 | |
167 | 171 | ||
168 | 172 | let dAppThreshold = 50 | |
169 | 173 | ||
170 | 174 | let dAppThresholdScale2 = 100 | |
171 | 175 | ||
172 | 176 | let exchangeRatioLimitMin = 90000000 | |
173 | 177 | ||
174 | 178 | let exchangeRatioLimitMax = 110000000 | |
175 | 179 | ||
176 | 180 | let alpha = 50 | |
177 | 181 | ||
178 | 182 | let alphaDigits = 2 | |
179 | 183 | ||
180 | 184 | let beta = 4600000000000000 | |
181 | 185 | ||
182 | 186 | func accountBalance (assetId) = match assetId { | |
183 | 187 | case id: ByteVector => | |
184 | 188 | assetBalance(this, id) | |
185 | 189 | case waves: Unit => | |
186 | 190 | wavesBalance(this).available | |
187 | 191 | case _ => | |
188 | 192 | throw("Match error") | |
189 | 193 | } | |
190 | 194 | ||
191 | 195 | ||
192 | 196 | func stakedAmount (assetId) = { | |
193 | 197 | let stakedAmountCalculated = match assetId { | |
194 | 198 | case aId: ByteVector => | |
195 | 199 | if ((aId == USDN)) | |
196 | 200 | then getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this))) | |
197 | 201 | else 0 | |
198 | 202 | case _: Unit => | |
199 | 203 | 0 | |
200 | 204 | case _ => | |
201 | 205 | throw("Match error") | |
202 | 206 | } | |
203 | 207 | match stakedAmountCalculated { | |
204 | 208 | case i: Int => | |
205 | 209 | i | |
206 | 210 | case _ => | |
207 | 211 | 0 | |
208 | 212 | } | |
209 | 213 | } | |
210 | 214 | ||
211 | 215 | ||
212 | 216 | let stakedAmountA = stakedAmount(assetIdA) | |
213 | 217 | ||
214 | 218 | let stakedAmountB = stakedAmount(assetIdB) | |
215 | 219 | ||
216 | 220 | let availableBalanceA = (balanceA - stakedAmountA) | |
217 | 221 | ||
218 | 222 | let availableBalanceB = (balanceB - stakedAmountB) | |
219 | 223 | ||
220 | 224 | let accountBalanceWithStakedA = (accountBalance(assetIdA) + stakedAmountA) | |
221 | 225 | ||
222 | 226 | let accountBalanceWithStakedB = (accountBalance(assetIdB) + stakedAmountB) | |
223 | 227 | ||
224 | 228 | let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA)) | |
225 | 229 | then (accountBalanceWithStakedB >= balanceB) | |
226 | 230 | else false | |
227 | 231 | ||
228 | 232 | func skewness (x,y) = ((fraction(scale16, x, y) + fraction(scale16, y, x)) / 2) | |
229 | 233 | ||
230 | 234 | ||
231 | 235 | func invariantCalc (x,y) = { | |
232 | 236 | let sk = skewness(x, y) | |
233 | 237 | (fraction((x + y), scale16, pow(sk, digits8, alpha, alphaDigits, digits8, CEILING)) + (2 * fraction(toInt(pow(fraction(toBigInt(x), toBigInt(y), toBigInt(scale8)), 0, toBigInt(5), 1, (digits8 / 2), DOWN)), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8))) | |
234 | 238 | } | |
235 | 239 | ||
236 | 240 | ||
237 | 241 | func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId,balcA,balcB,invCur) = { | |
238 | 242 | let worstAllowedNewInvariantRatio = (scale16 - ((scale16 * 1) / 10000000)) | |
239 | 243 | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount) | |
240 | 244 | let x = (balcA + tokenReceiveAmount) | |
241 | 245 | let y = (balcB + tokenReceiveAmount) | |
242 | 246 | func getStepAmount (acc,step) = if ((acc._1 == -1)) | |
243 | 247 | then { | |
244 | 248 | let amountToSend = (amountToSendEstimated - (((step * deltaBetweenMaxAndMinSendValue) / 3) / scale3)) | |
245 | 249 | let stepInvariant = if ((tokenId == assetIdA)) | |
246 | 250 | then invariantCalc(x, (balcB - amountToSend)) | |
247 | 251 | else invariantCalc((balcA - amountToSend), y) | |
248 | 252 | if ((stepInvariant > invCur)) | |
249 | 253 | then $Tuple2(amountToSend, stepInvariant) | |
250 | 254 | else $Tuple2(-1, 0) | |
251 | 255 | } | |
252 | 256 | else acc | |
253 | 257 | ||
254 | 258 | let amountToSendMin = getStepAmount($Tuple2(-1, 0), 3000) | |
255 | 259 | if ((0 > amountToSendMin._1)) | |
256 | 260 | then throw("Price is worse than minReceived") | |
257 | 261 | else { | |
258 | 262 | let invEstimated = if ((tokenId == assetIdA)) | |
259 | 263 | then invariantCalc(x, (balcB - amountToSendEstimated)) | |
260 | 264 | else if ((tokenId == assetIdB)) | |
261 | 265 | then invariantCalc((balcA - amountToSendEstimated), y) | |
262 | 266 | else throw("Wrong asset in payment") | |
263 | 267 | if ((invCur > invEstimated)) | |
264 | 268 | then if ((worstAllowedNewInvariantRatio >= fraction(scale16, invCur, invEstimated))) | |
265 | 269 | then throw("The requested price is too not profitable for user") | |
266 | 270 | else { | |
267 | 271 | let a = { | |
268 | 272 | let $l = [25, 200, 500] | |
269 | 273 | let $s = size($l) | |
270 | 274 | let $acc0 = $Tuple2(-1, 0) | |
271 | 275 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
272 | 276 | then $a | |
273 | 277 | else getStepAmount($a, $l[$i]) | |
274 | 278 | ||
275 | 279 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
276 | 280 | then $a | |
277 | 281 | else throw("List size exceeds 3") | |
278 | 282 | ||
279 | 283 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
280 | 284 | } | |
281 | 285 | if ((0 > a._1)) | |
282 | 286 | then amountToSendMin._1 | |
283 | 287 | else a._1 | |
284 | 288 | } | |
285 | 289 | else { | |
286 | 290 | let a = { | |
287 | 291 | let $l = [-500, -200, -25] | |
288 | 292 | let $s = size($l) | |
289 | 293 | let $acc0 = $Tuple2(-1, 0) | |
290 | 294 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
291 | 295 | then $a | |
292 | 296 | else getStepAmount($a, $l[$i]) | |
293 | 297 | ||
294 | 298 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
295 | 299 | then $a | |
296 | 300 | else throw("List size exceeds 3") | |
297 | 301 | ||
298 | 302 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
299 | 303 | } | |
300 | 304 | let tupleSendBetter = if ((0 > a._1)) | |
301 | 305 | then $Tuple2(amountToSendEstimated, invEstimated) | |
302 | 306 | else a | |
303 | 307 | if ((worstAllowedNewInvariantRatio >= fraction(scale16, invCur, tupleSendBetter._2))) | |
304 | 308 | then throw("The requested price is too not profitable for user") | |
305 | 309 | else tupleSendBetter._1 | |
306 | 310 | } | |
307 | 311 | } | |
308 | 312 | } | |
309 | 313 | ||
310 | 314 | ||
311 | 315 | func getAssetInfo (assetId) = match assetId { | |
312 | 316 | case id: ByteVector => | |
313 | 317 | let stringId = toBase58String(id) | |
314 | 318 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
315 | 319 | $Tuple3(stringId, info.name, info.decimals) | |
316 | 320 | case waves: Unit => | |
317 | 321 | $Tuple3("WAVES", "WAVES", 8) | |
318 | 322 | case _ => | |
319 | 323 | throw("Match error") | |
320 | 324 | } | |
321 | 325 | ||
322 | 326 | ||
323 | 327 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
324 | 328 | ||
325 | 329 | ||
326 | 330 | func throwIsActive () = throw("DApp is already active") | |
327 | 331 | ||
328 | 332 | ||
329 | - | func isActive () = if (active) | |
333 | + | func isActive () = if (if (active) | |
334 | + | then activeGlob | |
335 | + | else false) | |
330 | 336 | then unit | |
331 | 337 | else throw("DApp is inactive at this moment") | |
332 | 338 | ||
333 | 339 | ||
334 | 340 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
335 | 341 | then unit | |
336 | 342 | else throw("Only admin can call this function") | |
337 | 343 | ||
338 | 344 | ||
339 | 345 | func isSelfCall (i) = if ((this == i.caller)) | |
340 | 346 | then unit | |
341 | 347 | else throw("Only contract itself can call this function") | |
342 | 348 | ||
343 | 349 | ||
344 | 350 | func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
345 | 351 | ||
346 | 352 | ||
347 | 353 | func throwOnePayment () = throw("One attached payment expected") | |
348 | 354 | ||
349 | 355 | ||
350 | 356 | func throwThreshold (threshold,amountA,amountB) = throw(((((((((("New balance in assets of the DApp is less than threshold " + toString(threshold)) + ": ") + toString(amountA)) + " ") + assetNameA) + ", ") + toString(amountB)) + " ") + assetNameB)) | |
351 | 357 | ||
352 | 358 | ||
353 | 359 | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
354 | 360 | ||
355 | 361 | ||
356 | 362 | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
357 | 363 | then $Tuple2("lockNeutrino", stakingUSDNAddress) | |
358 | 364 | else $Tuple2("unlockNeutrino", stakingUSDNAddress) | |
359 | 365 | ||
360 | 366 | ||
361 | 367 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
362 | 368 | then { | |
363 | - | let $ | |
364 | - | let call = $ | |
365 | - | let stakingAddr = $ | |
369 | + | let $t01050410570 = calcStakingFuncAndAddres(stake, assetId) | |
370 | + | let call = $t01050410570._1 | |
371 | + | let stakingAddr = $t01050410570._2 | |
366 | 372 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
367 | 373 | } | |
368 | 374 | else { | |
369 | - | let $ | |
370 | - | let call = $ | |
371 | - | let stakingAddr = $ | |
375 | + | let $t01065610722 = calcStakingFuncAndAddres(stake, assetId) | |
376 | + | let call = $t01065610722._1 | |
377 | + | let stakingAddr = $t01065610722._2 | |
372 | 378 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
373 | 379 | } | |
374 | 380 | ||
375 | 381 | ||
376 | 382 | func calculateFeeDiscount (userAddr) = { | |
377 | 383 | let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0) | |
378 | 384 | let gSwopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserGSwopInGov)), 0) | |
379 | 385 | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
380 | 386 | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
381 | 387 | if (if ((gSwopAmount >= parseIntValue(discountValues[0]))) | |
382 | 388 | then (parseIntValue(discountValues[1]) > gSwopAmount) | |
383 | 389 | else false) | |
384 | 390 | then (feeScale6 - parseIntValue(discounts[0])) | |
385 | 391 | else if (if ((gSwopAmount >= parseIntValue(discountValues[1]))) | |
386 | 392 | then (parseIntValue(discountValues[2]) > gSwopAmount) | |
387 | 393 | else false) | |
388 | 394 | then (feeScale6 - parseIntValue(discounts[1])) | |
389 | 395 | else if (if ((gSwopAmount >= parseIntValue(discountValues[2]))) | |
390 | 396 | then (parseIntValue(discountValues[3]) > gSwopAmount) | |
391 | 397 | else false) | |
392 | 398 | then (feeScale6 - parseIntValue(discounts[2])) | |
393 | 399 | else if (if ((gSwopAmount >= parseIntValue(discountValues[3]))) | |
394 | 400 | then (parseIntValue(discountValues[4]) > gSwopAmount) | |
395 | 401 | else false) | |
396 | 402 | then (feeScale6 - parseIntValue(discounts[3])) | |
397 | 403 | else if ((gSwopAmount >= parseIntValue(discountValues[4]))) | |
398 | 404 | then (feeScale6 - parseIntValue(discounts[4])) | |
399 | 405 | else feeScale6 | |
400 | 406 | } | |
401 | 407 | ||
402 | 408 | ||
409 | + | func replenishWithTwoTokensCalc (i,stakeFarming,lockType) = { | |
410 | + | let pmtAssetIdA = i.payments[0].assetId | |
411 | + | let pmtAssetIdB = i.payments[1].assetId | |
412 | + | let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA) | |
413 | + | let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB) | |
414 | + | let $t01230412381 = getAssetInfo(pmtAssetIdA) | |
415 | + | let pmtStrAssetIdA = $t01230412381._1 | |
416 | + | let pmtAssetNameA = $t01230412381._2 | |
417 | + | let pmtDecimalsA = $t01230412381._3 | |
418 | + | let $t01238612503 = getAssetInfo(pmtAssetIdB) | |
419 | + | let pmtStrAssetIdB = $t01238612503._1 | |
420 | + | let pmtAssetNameB = $t01238612503._2 | |
421 | + | let pmtDecimalsB = $t01238612503._3 | |
422 | + | let $t01250813012 = if ((ratioShareTokensInB > ratioShareTokensInA)) | |
423 | + | then { | |
424 | + | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
425 | + | $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA) | |
426 | + | } | |
427 | + | else { | |
428 | + | let pmt = fraction(balanceA, ratioShareTokensInB, scale8, CEILING) | |
429 | + | $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB) | |
430 | + | } | |
431 | + | let pmtAmountA = $t01250813012._1 | |
432 | + | let pmtAmountB = $t01250813012._2 | |
433 | + | let change = $t01250813012._3 | |
434 | + | let changeAssetId = $t01250813012._4 | |
435 | + | let shareTokenRatio = $t01250813012._5 | |
436 | + | let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8) | |
437 | + | if (if ((size(i.payments) != 2)) | |
438 | + | then (size(i.payments) != 3) | |
439 | + | else false) | |
440 | + | then throw("Two or three payments expected") | |
441 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
442 | + | then true | |
443 | + | else (pmtAssetIdB != assetIdB)) | |
444 | + | then throwAssets() | |
445 | + | else if ((shareTokenToPayAmount == 0)) | |
446 | + | then throw("Too small amount to replenish") | |
447 | + | else if ((0 > change)) | |
448 | + | then throw("Change < 0") | |
449 | + | else if (!(hasEnoughBalance)) | |
450 | + | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
451 | + | else { | |
452 | + | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
453 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
454 | + | else 0 | |
455 | + | if ((stake1 == stake1)) | |
456 | + | then { | |
457 | + | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
458 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
459 | + | else 0 | |
460 | + | if ((stake2 == stake2)) | |
461 | + | then { | |
462 | + | let scriptActions = [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))), ScriptTransfer(i.caller, change, changeAssetId)] | |
463 | + | if (stakeFarming) | |
464 | + | then { | |
465 | + | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmount)] ++ (if ((size(i.payments) == 3)) | |
466 | + | then [AttachedPayment(if ((i.payments[2].assetId == base58'')) | |
467 | + | then unit | |
468 | + | else i.payments[2].assetId, i.payments[2].amount)] | |
469 | + | else nil)) | |
470 | + | let re = invoke(this, "reissueShare", [shareTokenToPayAmount], nil) | |
471 | + | if ((re == re)) | |
472 | + | then { | |
473 | + | let s = invoke(farmingAddress, "lockShareTokensFromPool", [i.caller.bytes, toString(this), lockType], stPayments) | |
474 | + | if ((s == s)) | |
475 | + | then scriptActions | |
476 | + | else throw("Strict value is not equal to itself.") | |
477 | + | } | |
478 | + | else throw("Strict value is not equal to itself.") | |
479 | + | } | |
480 | + | else (scriptActions ++ [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)]) | |
481 | + | } | |
482 | + | else throw("Strict value is not equal to itself.") | |
483 | + | } | |
484 | + | else throw("Strict value is not equal to itself.") | |
485 | + | } | |
486 | + | } | |
487 | + | ||
488 | + | ||
489 | + | func replenishWithOneTokenCalc (i,virtualSwapTokenPay,virtualSwapTokenGet,stakeFarming,lockType) = { | |
490 | + | let $t01540215477 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
491 | + | let pmtAmount = $t01540215477._1 | |
492 | + | let pmtAssetId = $t01540215477._2 | |
493 | + | let $t01548215555 = getAssetInfo(pmtAssetId) | |
494 | + | let pmtStrAssetId = $t01548215555._1 | |
495 | + | let pmtAssetName = $t01548215555._2 | |
496 | + | let pmtDecimals = $t01548215555._3 | |
497 | + | let pmtMinThreshold = 5000000 | |
498 | + | let thresholdValueForMinTolerance = 50000000 | |
499 | + | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
500 | + | then 100000 | |
501 | + | else 1 | |
502 | + | let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000)) | |
503 | + | let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000)) | |
504 | + | let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000)) | |
505 | + | if ((pmtMinThreshold > pmtAmount)) | |
506 | + | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
507 | + | else if (if ((size(i.payments) != 1)) | |
508 | + | then (size(i.payments) != 2) | |
509 | + | else false) | |
510 | + | then throw("One or two payments expected") | |
511 | + | else if (!(hasEnoughBalance)) | |
512 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
513 | + | else if (if ((pmtAssetId != assetIdA)) | |
514 | + | then (pmtAssetId != assetIdB) | |
515 | + | else false) | |
516 | + | then throwAssets() | |
517 | + | else { | |
518 | + | let $t01656217204 = if ((pmtAssetId == assetIdA)) | |
519 | + | then $Tuple6((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), (balanceA + pmtAmount), balanceB) | |
520 | + | else $Tuple6(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), balanceA, (balanceB + pmtAmount)) | |
521 | + | let virtualReplenishA = $t01656217204._1 | |
522 | + | let virtualReplenishB = $t01656217204._2 | |
523 | + | let balanceAfterSwapA = $t01656217204._3 | |
524 | + | let balanceAfterSwapB = $t01656217204._4 | |
525 | + | let newBalanceA = $t01656217204._5 | |
526 | + | let newBalanceB = $t01656217204._6 | |
527 | + | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
528 | + | let ratioVirtualBalanceToVirtualReplenish = (fraction(scale16, balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
529 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
530 | + | if (if ((slippageValueMinForSwap >= fraction(scale8, invariant, invariantNew))) | |
531 | + | then true | |
532 | + | else (invariant > invariantNew)) | |
533 | + | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
534 | + | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
535 | + | then true | |
536 | + | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
537 | + | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
538 | + | else if (if ((dAppThresholdAmount > newBalanceA)) | |
539 | + | then true | |
540 | + | else (dAppThresholdAmount > newBalanceB)) | |
541 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
542 | + | else { | |
543 | + | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
544 | + | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
545 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
546 | + | let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6) | |
547 | + | let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6) | |
548 | + | let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply) | |
549 | + | let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply) | |
550 | + | let $t01919419489 = if ((pmtStrAssetId == strAssetIdA)) | |
551 | + | then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB) | |
552 | + | else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA) | |
553 | + | let stakeAmount = $t01919419489._1 | |
554 | + | let unstakeAmount = $t01919419489._2 | |
555 | + | let unstakeAsset = $t01919419489._3 | |
556 | + | let stake1 = if (contains(stakingAssets, pmtStrAssetId)) | |
557 | + | then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil) | |
558 | + | else 0 | |
559 | + | if ((stake1 == stake1)) | |
560 | + | then { | |
561 | + | let stake2 = if (contains(stakingAssets, unstakeAsset)) | |
562 | + | then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil) | |
563 | + | else 0 | |
564 | + | if ((stake2 == stake2)) | |
565 | + | then { | |
566 | + | let scriptActions = [IntegerEntry(kBalanceA, (newBalanceA - governanceRewardTokenA)), IntegerEntry(kBalanceB, (newBalanceB - governanceRewardTokenB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmountAfterFee)), IntegerEntry(kInvariant, invariantCalc((newBalanceA - governanceRewardTokenA), (newBalanceB - governanceRewardTokenB))), ScriptTransfer(moneyBoxAddress, governanceRewardTokenA, assetIdA), ScriptTransfer(moneyBoxAddress, governanceRewardTokenB, assetIdB)] | |
567 | + | if (stakeFarming) | |
568 | + | then { | |
569 | + | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmountAfterFee)] ++ (if ((size(i.payments) == 2)) | |
570 | + | then [AttachedPayment(if ((i.payments[1].assetId == base58'')) | |
571 | + | then unit | |
572 | + | else i.payments[1].assetId, i.payments[1].amount)] | |
573 | + | else nil)) | |
574 | + | let re = invoke(this, "reissueShare", [shareTokenToPayAmountAfterFee], nil) | |
575 | + | if ((re == re)) | |
576 | + | then { | |
577 | + | let s = invoke(farmingAddress, "lockShareTokensFromPool", [i.caller.bytes, toString(this), lockType], stPayments) | |
578 | + | if ((s == s)) | |
579 | + | then scriptActions | |
580 | + | else throw("Strict value is not equal to itself.") | |
581 | + | } | |
582 | + | else throw("Strict value is not equal to itself.") | |
583 | + | } | |
584 | + | else (scriptActions ++ [Reissue(shareAssetId, shareTokenToPayAmountAfterFee, true), ScriptTransfer(i.caller, shareTokenToPayAmountAfterFee, shareAssetId)]) | |
585 | + | } | |
586 | + | else throw("Strict value is not equal to itself.") | |
587 | + | } | |
588 | + | else throw("Strict value is not equal to itself.") | |
589 | + | } | |
590 | + | } | |
591 | + | } | |
592 | + | ||
593 | + | ||
594 | + | func withdrawCalc (i,unlockAmount) = { | |
595 | + | let $t02147621811 = if ((size(i.payments) == 1)) | |
596 | + | then if ((i.payments[0].assetId != shareAssetId)) | |
597 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
598 | + | else $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
599 | + | else $Tuple2(0, shareAssetId) | |
600 | + | let pmtAmount = $t02147621811._1 | |
601 | + | let pmtAssetId = $t02147621811._2 | |
602 | + | if (!(hasEnoughBalance)) | |
603 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
604 | + | else { | |
605 | + | let unlock = if ((unlockAmount > 0)) | |
606 | + | then invoke(farmingAddress, "withdrawShareTokensFromPool", [i.caller.bytes, toString(this), unlockAmount], nil) | |
607 | + | else 0 | |
608 | + | if ((unlock == unlock)) | |
609 | + | then { | |
610 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
611 | + | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
612 | + | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
613 | + | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
614 | + | let stake1 = if (contains(stakingAssets, strAssetIdA)) | |
615 | + | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
616 | + | else 0 | |
617 | + | if ((stake1 == stake1)) | |
618 | + | then { | |
619 | + | let stake2 = if (contains(stakingAssets, strAssetIdB)) | |
620 | + | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
621 | + | else 0 | |
622 | + | if ((stake2 == stake2)) | |
623 | + | then [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, withdrawAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
624 | + | else throw("Strict value is not equal to itself.") | |
625 | + | } | |
626 | + | else throw("Strict value is not equal to itself.") | |
627 | + | } | |
628 | + | else throw("Strict value is not equal to itself.") | |
629 | + | } | |
630 | + | } | |
631 | + | ||
632 | + | ||
403 | 633 | @Callable(i) | |
404 | 634 | func init (firstHarvest) = { | |
405 | - | let $ | |
406 | - | let pmtAmountA = $ | |
407 | - | let pmtAssetIdA = $ | |
408 | - | let $ | |
409 | - | let pmtAmountB = $ | |
410 | - | let pmtAssetIdB = $ | |
411 | - | let $ | |
412 | - | let pmtStrAssetIdA = $ | |
413 | - | let pmtAssetNameA = $ | |
414 | - | let pmtDecimalsA = $ | |
415 | - | let $ | |
416 | - | let pmtStrAssetIdB = $ | |
417 | - | let pmtAssetNameB = $ | |
418 | - | let pmtDecimalsB = $ | |
635 | + | let $t02336323440 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
636 | + | let pmtAmountA = $t02336323440._1 | |
637 | + | let pmtAssetIdA = $t02336323440._2 | |
638 | + | let $t02344523522 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
639 | + | let pmtAmountB = $t02344523522._1 | |
640 | + | let pmtAssetIdB = $t02344523522._2 | |
641 | + | let $t02352723604 = getAssetInfo(pmtAssetIdA) | |
642 | + | let pmtStrAssetIdA = $t02352723604._1 | |
643 | + | let pmtAssetNameA = $t02352723604._2 | |
644 | + | let pmtDecimalsA = $t02352723604._3 | |
645 | + | let $t02360923686 = getAssetInfo(pmtAssetIdB) | |
646 | + | let pmtStrAssetIdB = $t02360923686._1 | |
647 | + | let pmtAssetNameB = $t02360923686._2 | |
648 | + | let pmtDecimalsB = $t02360923686._3 | |
419 | 649 | if (isDefined(getBoolean(this, kActive))) | |
420 | 650 | then throwIsActive() | |
421 | 651 | else if ((pmtAssetIdA == pmtAssetIdB)) | |
422 | 652 | then throw("Assets must be different") | |
423 | 653 | else { | |
424 | 654 | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
425 | 655 | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
426 | 656 | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
427 | 657 | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
428 | 658 | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
429 | 659 | let shareIssueId = calculateAssetId(shareIssue) | |
430 | 660 | let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB) | |
431 | 661 | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
432 | 662 | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
433 | 663 | else 0 | |
434 | 664 | if ((stake1 == stake1)) | |
435 | 665 | then { | |
436 | 666 | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
437 | 667 | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
438 | 668 | else 0 | |
439 | 669 | if ((stake2 == stake2)) | |
440 | 670 | then { | |
441 | 671 | let baseEntry = [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kInvariant, invariantCalculated), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
442 | 672 | if (firstHarvest) | |
443 | 673 | then (baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
444 | 674 | else baseEntry | |
445 | 675 | } | |
446 | 676 | else throw("Strict value is not equal to itself.") | |
447 | 677 | } | |
448 | 678 | else throw("Strict value is not equal to itself.") | |
449 | 679 | } | |
450 | 680 | } | |
451 | 681 | ||
452 | 682 | ||
453 | 683 | ||
454 | 684 | @Callable(i) | |
455 | - | func replenishWithTwoTokens (stakeFarming,lockType) = valueOrElse(isActive(), { | |
456 | - | let pmtAssetIdA = i.payments[0].assetId | |
457 | - | let pmtAssetIdB = i.payments[1].assetId | |
458 | - | let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA) | |
459 | - | let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB) | |
460 | - | let $t01519415271 = getAssetInfo(pmtAssetIdA) | |
461 | - | let pmtStrAssetIdA = $t01519415271._1 | |
462 | - | let pmtAssetNameA = $t01519415271._2 | |
463 | - | let pmtDecimalsA = $t01519415271._3 | |
464 | - | let $t01527615393 = getAssetInfo(pmtAssetIdB) | |
465 | - | let pmtStrAssetIdB = $t01527615393._1 | |
466 | - | let pmtAssetNameB = $t01527615393._2 | |
467 | - | let pmtDecimalsB = $t01527615393._3 | |
468 | - | let $t01539815902 = if ((ratioShareTokensInB > ratioShareTokensInA)) | |
469 | - | then { | |
470 | - | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
471 | - | $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA) | |
472 | - | } | |
473 | - | else { | |
474 | - | let pmt = fraction(balanceA, ratioShareTokensInB, scale8, CEILING) | |
475 | - | $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB) | |
476 | - | } | |
477 | - | let pmtAmountA = $t01539815902._1 | |
478 | - | let pmtAmountB = $t01539815902._2 | |
479 | - | let change = $t01539815902._3 | |
480 | - | let changeAssetId = $t01539815902._4 | |
481 | - | let shareTokenRatio = $t01539815902._5 | |
482 | - | let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8) | |
483 | - | if (if ((size(i.payments) != 2)) | |
484 | - | then (size(i.payments) != 3) | |
685 | + | func replenishWithTwoTokensV2 (stakeFarming,lockType) = valueOrElse(isActive(), replenishWithTwoTokensCalc(i, stakeFarming, lockType)) | |
686 | + | ||
687 | + | ||
688 | + | ||
689 | + | @Callable(i) | |
690 | + | func replenishWithOneTokenV2 (virtualSwapTokenPay,virtualSwapTokenGet,stakeFarming,lockType) = valueOrElse(isActive(), replenishWithOneTokenCalc(i, virtualSwapTokenPay, virtualSwapTokenGet, stakeFarming, lockType)) | |
691 | + | ||
692 | + | ||
693 | + | ||
694 | + | @Callable(i) | |
695 | + | func withdrawV2 (unlockAmount) = valueOrElse(isActive(), withdrawCalc(i, unlockAmount)) | |
696 | + | ||
697 | + | ||
698 | + | ||
699 | + | @Callable(i) | |
700 | + | func withdrawOneToken (unlockAmount,withdrawAsset,estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), { | |
701 | + | let $t02705627391 = if ((size(i.payments) == 1)) | |
702 | + | then if ((i.payments[0].assetId != shareAssetId)) | |
703 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
704 | + | else $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
705 | + | else $Tuple2(0, shareAssetId) | |
706 | + | let pmtAmount = $t02705627391._1 | |
707 | + | let pmtAssetId = $t02705627391._2 | |
708 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
709 | + | if (if ((withdrawAsset != strAssetIdA)) | |
710 | + | then (withdrawAsset != strAssetIdB) | |
485 | 711 | else false) | |
486 | - | then throw("Two or three payments expected") | |
487 | - | else if (if ((pmtAssetIdA != assetIdA)) | |
488 | - | then true | |
489 | - | else (pmtAssetIdB != assetIdB)) | |
490 | - | then throwAssets() | |
491 | - | else if ((shareTokenToPayAmount == 0)) | |
492 | - | then throw("Too small amount to replenish") | |
493 | - | else if ((0 > change)) | |
494 | - | then throw("Change < 0") | |
495 | - | else if (!(hasEnoughBalance)) | |
496 | - | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
497 | - | else { | |
498 | - | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
499 | - | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
712 | + | then throw("Incorrect withdraw asset") | |
713 | + | else if ((0 >= withdrawAmount)) | |
714 | + | then throw("withdraw amount must be grater than 0") | |
715 | + | else if (!(hasEnoughBalance)) | |
716 | + | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
717 | + | else { | |
718 | + | let unlock = if ((unlockAmount > 0)) | |
719 | + | then invoke(farmingAddress, "withdrawShareTokensFromPool", [i.caller.bytes, toString(this), unlockAmount], nil) | |
720 | + | else 0 | |
721 | + | if ((unlock == unlock)) | |
722 | + | then { | |
723 | + | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
724 | + | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
725 | + | let newVirtBalcA = (balanceA - amountToPayA) | |
726 | + | let newVirtBalcB = (balanceB - amountToPayB) | |
727 | + | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
728 | + | let amountExchangedWithFee = if ((withdrawAsset == strAssetIdA)) | |
729 | + | then calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, amountToPayB, assetIdB, newVirtBalcA, newVirtBalcB, invariantCalc(newVirtBalcA, newVirtBalcB)) | |
730 | + | else calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, amountToPayA, assetIdA, newVirtBalcA, newVirtBalcB, invariantCalc(newVirtBalcA, newVirtBalcB)) | |
731 | + | let govReward = fraction(amountExchangedWithFee, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
732 | + | let amountExchanged = fraction(amountExchangedWithFee, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
733 | + | let $t02899429323 = if ((withdrawAsset == strAssetIdA)) | |
734 | + | then $Tuple3((amountToPayA + amountExchanged), (((balanceA - amountToPayA) - amountExchanged) - govReward), balanceB) | |
735 | + | else $Tuple3((amountToPayB + amountExchanged), balanceA, (((balanceB - amountToPayB) - amountExchanged) - govReward)) | |
736 | + | let amountToPay = $t02899429323._1 | |
737 | + | let balanceANew = $t02899429323._2 | |
738 | + | let balanceBNew = $t02899429323._3 | |
739 | + | let invariantCalculated = invariantCalc(balanceANew, balanceBNew) | |
740 | + | let stake1 = if (contains(stakingAssets, withdrawAsset)) | |
741 | + | then invoke(this, "stakeUnstake", [false, (amountToPay + govReward), withdrawAsset], nil) | |
500 | 742 | else 0 | |
501 | 743 | if ((stake1 == stake1)) | |
502 | - | then { | |
503 | - | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
504 | - | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
505 | - | else 0 | |
506 | - | if ((stake2 == stake2)) | |
507 | - | then { | |
508 | - | let scriptActions = [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))), ScriptTransfer(i.caller, change, changeAssetId)] | |
509 | - | if (stakeFarming) | |
510 | - | then { | |
511 | - | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmount)] ++ (if ((size(i.payments) == 3)) | |
512 | - | then [AttachedPayment(i.payments[2].assetId, i.payments[2].amount)] | |
513 | - | else nil)) | |
514 | - | let re = invoke(this, "reissueShare", [shareTokenToPayAmount], nil) | |
515 | - | if ((re == re)) | |
516 | - | then { | |
517 | - | let s = invoke(farmingAddress, "lockShareTokens", [toString(this), lockType], stPayments) | |
518 | - | if ((s == s)) | |
519 | - | then scriptActions | |
520 | - | else throw("Strict value is not equal to itself.") | |
521 | - | } | |
522 | - | else throw("Strict value is not equal to itself.") | |
523 | - | } | |
524 | - | else (scriptActions ++ [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)]) | |
525 | - | } | |
526 | - | else throw("Strict value is not equal to itself.") | |
527 | - | } | |
744 | + | then [IntegerEntry(kBalanceA, balanceANew), IntegerEntry(kBalanceB, balanceBNew), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, withdrawAmount), ScriptTransfer(i.caller, amountToPay, fromBase58String(withdrawAsset)), ScriptTransfer(moneyBoxAddress, govReward, fromBase58String(withdrawAsset))] | |
528 | 745 | else throw("Strict value is not equal to itself.") | |
529 | 746 | } | |
747 | + | else throw("Strict value is not equal to itself.") | |
748 | + | } | |
530 | 749 | }) | |
531 | 750 | ||
532 | 751 | ||
533 | 752 | ||
534 | 753 | @Callable(i) | |
535 | - | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet,stakeFarming,lockType) = valueOrElse(isActive(), { | |
536 | - | let $t01828118356 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
537 | - | let pmtAmount = $t01828118356._1 | |
538 | - | let pmtAssetId = $t01828118356._2 | |
539 | - | let $t01836118434 = getAssetInfo(pmtAssetId) | |
540 | - | let pmtStrAssetId = $t01836118434._1 | |
541 | - | let pmtAssetName = $t01836118434._2 | |
542 | - | let pmtDecimals = $t01836118434._3 | |
543 | - | let pmtMinThreshold = 5000000 | |
544 | - | let thresholdValueForMinTolerance = 50000000 | |
545 | - | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
546 | - | then 100000 | |
547 | - | else 1 | |
548 | - | let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000)) | |
549 | - | let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000)) | |
550 | - | let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000)) | |
551 | - | if ((pmtMinThreshold > pmtAmount)) | |
552 | - | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
553 | - | else if (if ((size(i.payments) != 1)) | |
554 | - | then (size(i.payments) != 2) | |
555 | - | else false) | |
556 | - | then throw("One or two payments expected") | |
557 | - | else if (!(hasEnoughBalance)) | |
558 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
559 | - | else if (if ((pmtAssetId != assetIdA)) | |
560 | - | then (pmtAssetId != assetIdB) | |
561 | - | else false) | |
562 | - | then throwAssets() | |
563 | - | else { | |
564 | - | let $t01944120083 = if ((pmtAssetId == assetIdA)) | |
565 | - | then $Tuple6((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), (balanceA + pmtAmount), balanceB) | |
566 | - | else $Tuple6(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), balanceA, (balanceB + pmtAmount)) | |
567 | - | let virtualReplenishA = $t01944120083._1 | |
568 | - | let virtualReplenishB = $t01944120083._2 | |
569 | - | let balanceAfterSwapA = $t01944120083._3 | |
570 | - | let balanceAfterSwapB = $t01944120083._4 | |
571 | - | let newBalanceA = $t01944120083._5 | |
572 | - | let newBalanceB = $t01944120083._6 | |
573 | - | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
574 | - | let ratioVirtualBalanceToVirtualReplenish = (fraction(scale16, balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
575 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
576 | - | if (if ((slippageValueMinForSwap >= fraction(scale8, invariant, invariantNew))) | |
577 | - | then true | |
578 | - | else (invariant > invariantNew)) | |
579 | - | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
580 | - | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
581 | - | then true | |
582 | - | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
583 | - | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
584 | - | else if (if ((dAppThresholdAmount > newBalanceA)) | |
585 | - | then true | |
586 | - | else (dAppThresholdAmount > newBalanceB)) | |
587 | - | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
588 | - | else { | |
589 | - | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
590 | - | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
591 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
592 | - | let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6) | |
593 | - | let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6) | |
594 | - | let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply) | |
595 | - | let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply) | |
596 | - | let $t02207322368 = if ((pmtStrAssetId == strAssetIdA)) | |
597 | - | then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB) | |
598 | - | else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA) | |
599 | - | let stakeAmount = $t02207322368._1 | |
600 | - | let unstakeAmount = $t02207322368._2 | |
601 | - | let unstakeAsset = $t02207322368._3 | |
602 | - | let stake1 = if (contains(stakingAssets, pmtStrAssetId)) | |
603 | - | then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil) | |
604 | - | else 0 | |
605 | - | if ((stake1 == stake1)) | |
606 | - | then { | |
607 | - | let stake2 = if (contains(stakingAssets, unstakeAsset)) | |
608 | - | then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil) | |
609 | - | else 0 | |
610 | - | if ((stake2 == stake2)) | |
611 | - | then { | |
612 | - | let scriptActions = [IntegerEntry(kBalanceA, (newBalanceA - governanceRewardTokenA)), IntegerEntry(kBalanceB, (newBalanceB - governanceRewardTokenB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmountAfterFee)), IntegerEntry(kInvariant, invariantCalc((newBalanceA - governanceRewardTokenA), (newBalanceB - governanceRewardTokenB))), ScriptTransfer(moneyBoxAddress, governanceRewardTokenA, assetIdA), ScriptTransfer(moneyBoxAddress, governanceRewardTokenB, assetIdB)] | |
613 | - | if (stakeFarming) | |
614 | - | then { | |
615 | - | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmountAfterFee)] ++ (if ((size(i.payments) == 2)) | |
616 | - | then [AttachedPayment(i.payments[1].assetId, i.payments[1].amount)] | |
617 | - | else nil)) | |
618 | - | let re = invoke(this, "reissueShare", [shareTokenToPayAmountAfterFee], nil) | |
619 | - | if ((re == re)) | |
620 | - | then { | |
621 | - | let s = invoke(farmingAddress, "lockShareTokens", [toString(this), lockType], stPayments) | |
622 | - | if ((s == s)) | |
623 | - | then scriptActions | |
624 | - | else throw("Strict value is not equal to itself.") | |
625 | - | } | |
626 | - | else throw("Strict value is not equal to itself.") | |
627 | - | } | |
628 | - | else (scriptActions ++ [Reissue(shareAssetId, shareTokenToPayAmountAfterFee, true), ScriptTransfer(i.caller, shareTokenToPayAmountAfterFee, shareAssetId)]) | |
629 | - | } | |
630 | - | else throw("Strict value is not equal to itself.") | |
631 | - | } | |
632 | - | else throw("Strict value is not equal to itself.") | |
633 | - | } | |
634 | - | } | |
635 | - | }) | |
636 | - | ||
637 | - | ||
638 | - | ||
639 | - | @Callable(i) | |
640 | - | func withdraw (unlockAmount) = valueOrElse(isActive(), { | |
641 | - | let $t02429724632 = if ((size(i.payments) == 1)) | |
642 | - | then if ((i.payments[0].assetId != shareAssetId)) | |
643 | - | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
644 | - | else $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
645 | - | else $Tuple2(0, shareAssetId) | |
646 | - | let pmtAmount = $t02429724632._1 | |
647 | - | let pmtAssetId = $t02429724632._2 | |
648 | - | if (!(hasEnoughBalance)) | |
649 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
650 | - | else { | |
651 | - | let unlock = if ((unlockAmount > 0)) | |
652 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
653 | - | else 0 | |
654 | - | if ((unlock == unlock)) | |
655 | - | then { | |
656 | - | let withdrawAmount = (pmtAmount + unlockAmount) | |
657 | - | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
658 | - | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
659 | - | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
660 | - | let stake1 = if (contains(stakingAssets, strAssetIdA)) | |
661 | - | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
662 | - | else 0 | |
663 | - | if ((stake1 == stake1)) | |
664 | - | then { | |
665 | - | let stake2 = if (contains(stakingAssets, strAssetIdB)) | |
666 | - | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
667 | - | else 0 | |
668 | - | if ((stake2 == stake2)) | |
669 | - | then [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, withdrawAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
670 | - | else throw("Strict value is not equal to itself.") | |
671 | - | } | |
672 | - | else throw("Strict value is not equal to itself.") | |
673 | - | } | |
674 | - | else throw("Strict value is not equal to itself.") | |
675 | - | } | |
676 | - | }) | |
677 | - | ||
678 | - | ||
679 | - | ||
680 | - | @Callable(i) | |
681 | - | func withdrawOneToken (unlockAmount,withdrawAsset,estimatedAmountToReceive,minAmountToReceive) = { | |
682 | - | let $t02624826583 = if ((size(i.payments) == 1)) | |
683 | - | then if ((i.payments[0].assetId != shareAssetId)) | |
684 | - | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
685 | - | else $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
686 | - | else $Tuple2(0, shareAssetId) | |
687 | - | let pmtAmount = $t02624826583._1 | |
688 | - | let pmtAssetId = $t02624826583._2 | |
689 | - | if (if ((withdrawAsset != strAssetIdA)) | |
690 | - | then (withdrawAsset != strAssetIdB) | |
691 | - | else false) | |
692 | - | then throw("Incorrect withdraw asset") | |
693 | - | else if (!(hasEnoughBalance)) | |
694 | - | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
695 | - | else { | |
696 | - | let unlock = if ((unlockAmount > 0)) | |
697 | - | then invoke(farmingAddress, "withdrawShareTokens", [toString(this), unlockAmount], nil) | |
698 | - | else 0 | |
699 | - | if ((unlock == unlock)) | |
700 | - | then { | |
701 | - | let withdrawAmount = (pmtAmount + unlockAmount) | |
702 | - | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
703 | - | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
704 | - | let newVirtBalcA = (balanceA - amountToPayA) | |
705 | - | let newVirtBalcB = (balanceB - amountToPayB) | |
706 | - | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
707 | - | let amountExchangedWithFee = if ((withdrawAsset == strAssetIdA)) | |
708 | - | then calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, amountToPayB, assetIdB, newVirtBalcA, newVirtBalcB, invariantCalc(newVirtBalcA, newVirtBalcB)) | |
709 | - | else calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, amountToPayA, assetIdA, newVirtBalcA, newVirtBalcB, invariantCalc(newVirtBalcA, newVirtBalcB)) | |
710 | - | let govReward = fraction(amountExchangedWithFee, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
711 | - | let amountExchanged = fraction(amountExchangedWithFee, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
712 | - | let $t02809428423 = if ((withdrawAsset == strAssetIdA)) | |
713 | - | then $Tuple3((amountToPayA + amountExchanged), (((balanceA - amountToPayA) - amountExchanged) - govReward), balanceB) | |
714 | - | else $Tuple3((amountToPayB + amountExchanged), balanceA, (((balanceB - amountToPayB) - amountExchanged) - govReward)) | |
715 | - | let amountToPay = $t02809428423._1 | |
716 | - | let balanceANew = $t02809428423._2 | |
717 | - | let balanceBNew = $t02809428423._3 | |
718 | - | let invariantCalculated = invariantCalc(balanceANew, balanceBNew) | |
719 | - | let stake1 = if (contains(stakingAssets, withdrawAsset)) | |
720 | - | then invoke(this, "stakeUnstake", [false, (amountToPay + govReward), withdrawAsset], nil) | |
721 | - | else 0 | |
722 | - | if ((stake1 == stake1)) | |
723 | - | then [IntegerEntry(kBalanceA, balanceANew), IntegerEntry(kBalanceB, balanceBNew), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, withdrawAmount), ScriptTransfer(i.caller, amountToPay, fromBase58String(withdrawAsset)), ScriptTransfer(moneyBoxAddress, govReward, fromBase58String(withdrawAsset))] | |
724 | - | else throw("Strict value is not equal to itself.") | |
725 | - | } | |
726 | - | else throw("Strict value is not equal to itself.") | |
727 | - | } | |
728 | - | } | |
729 | - | ||
730 | - | ||
731 | - | ||
732 | - | @Callable(i) | |
733 | 754 | func exchange (estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), { | |
734 | - | let $ | |
735 | - | let pmtAmount = $ | |
736 | - | let pmtAssetId = $ | |
755 | + | let $t03019630271 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
756 | + | let pmtAmount = $t03019630271._1 | |
757 | + | let pmtAssetId = $t03019630271._2 | |
737 | 758 | if ((0 >= estimatedAmountToReceive)) | |
738 | 759 | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
739 | 760 | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
740 | 761 | then throw("Minimal amount can't be greater than estimated.") | |
741 | 762 | else if ((size(i.payments) != 1)) | |
742 | 763 | then throwOnePayment() | |
743 | 764 | else if (!(hasEnoughBalance)) | |
744 | 765 | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
745 | 766 | else if (if ((pmtAssetId != assetIdA)) | |
746 | 767 | then (pmtAssetId != assetIdB) | |
747 | 768 | else false) | |
748 | 769 | then throwAssets() | |
749 | 770 | else if ((10000000 > pmtAmount)) | |
750 | 771 | then throw("Only swap of 10.000000 or more tokens is allowed") | |
751 | 772 | else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount))) | |
752 | 773 | then true | |
753 | 774 | else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax)) | |
754 | 775 | then throw("Incorrect args and pmt ratio") | |
755 | 776 | else { | |
756 | 777 | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
757 | 778 | then assetIdB | |
758 | 779 | else assetIdA | |
759 | 780 | let amount = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId, balanceA, balanceB, invariant) | |
760 | 781 | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
761 | 782 | let governanceReward = fraction(amount, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
762 | 783 | let amountMinusFee = fraction(amount, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
763 | - | let $ | |
784 | + | let $t03175532017 = if ((pmtAssetId == assetIdA)) | |
764 | 785 | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
765 | 786 | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
766 | - | let newBalanceA = $ | |
767 | - | let newBalanceB = $ | |
787 | + | let newBalanceA = $t03175532017._1 | |
788 | + | let newBalanceB = $t03175532017._2 | |
768 | 789 | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
769 | 790 | if (if ((dAppThresholdAmount > newBalanceA)) | |
770 | 791 | then true | |
771 | 792 | else (dAppThresholdAmount > newBalanceB)) | |
772 | 793 | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
773 | 794 | else { | |
774 | - | let $ | |
775 | - | let pmtStrAssetId = $ | |
776 | - | let pmtAssetName = $ | |
777 | - | let pmtDecimals = $ | |
778 | - | let $ | |
779 | - | let sendStrAssetId = $ | |
780 | - | let sendAssetName = $ | |
781 | - | let sendDecimals = $ | |
795 | + | let $t03231632389 = getAssetInfo(pmtAssetId) | |
796 | + | let pmtStrAssetId = $t03231632389._1 | |
797 | + | let pmtAssetName = $t03231632389._2 | |
798 | + | let pmtDecimals = $t03231632389._3 | |
799 | + | let $t03240232479 = getAssetInfo(sendAssetId) | |
800 | + | let sendStrAssetId = $t03240232479._1 | |
801 | + | let sendAssetName = $t03240232479._2 | |
802 | + | let sendDecimals = $t03240232479._3 | |
782 | 803 | let stake1 = if (contains(stakingAssets, pmtStrAssetId)) | |
783 | 804 | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
784 | 805 | else 0 | |
785 | 806 | if ((stake1 == stake1)) | |
786 | 807 | then { | |
787 | 808 | let stake2 = if (contains(stakingAssets, sendStrAssetId)) | |
788 | 809 | then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil) | |
789 | 810 | else 0 | |
790 | 811 | if ((stake2 == stake2)) | |
791 | 812 | then $Tuple2([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(moneyBoxAddress, governanceReward, sendAssetId)], [amountMinusFee, sendAssetId]) | |
792 | 813 | else throw("Strict value is not equal to itself.") | |
793 | 814 | } | |
794 | 815 | else throw("Strict value is not equal to itself.") | |
795 | 816 | } | |
796 | 817 | } | |
797 | 818 | }) | |
798 | 819 | ||
799 | 820 | ||
800 | 821 | ||
801 | 822 | @Callable(msg) | |
802 | 823 | func reissueShare (amount) = valueOrElse(isSelfCall(msg), [Reissue(shareAssetId, amount, true)]) | |
803 | 824 | ||
804 | 825 | ||
805 | 826 | ||
806 | 827 | @Callable(i) | |
807 | 828 | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
808 | 829 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
809 | 830 | else suspend("Paused by admin")) | |
810 | 831 | ||
811 | 832 | ||
812 | 833 | ||
813 | 834 | @Callable(i) | |
814 | 835 | func activate () = valueOrElse(isAdminCall(i), if (active) | |
815 | 836 | then throwIsActive() | |
816 | 837 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
817 | 838 | ||
818 | 839 | ||
819 | 840 | ||
820 | 841 | @Callable(i) | |
821 | 842 | func takeIntoAccountExtraFunds () = valueOrElse(isActive(), { | |
822 | 843 | let amountEnrollA = (accountBalanceWithStakedA - balanceA) | |
823 | 844 | let amountEnrollB = (accountBalanceWithStakedB - balanceB) | |
824 | 845 | let invariantNew = invariantCalc((balanceA + amountEnrollA), (balanceB + amountEnrollB)) | |
825 | 846 | if ((i.caller != moneyBoxAddress)) | |
826 | 847 | then throw("Only the money box can call this function") | |
827 | 848 | else if (if ((0 > amountEnrollA)) | |
828 | 849 | then true | |
829 | 850 | else (0 > amountEnrollB)) | |
830 | 851 | then suspend("Enroll amount negative") | |
831 | 852 | else if (if ((amountEnrollA == 0)) | |
832 | 853 | then (amountEnrollB == 0) | |
833 | 854 | else false) | |
834 | 855 | then throw("No money to take") | |
835 | 856 | else { | |
836 | 857 | let stake1 = if (if (contains(stakingAssets, strAssetIdA)) | |
837 | 858 | then (amountEnrollA > 0) | |
838 | 859 | else false) | |
839 | 860 | then invoke(this, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil) | |
840 | 861 | else 0 | |
841 | 862 | if ((stake1 == stake1)) | |
842 | 863 | then { | |
843 | 864 | let stake2 = if (if (contains(stakingAssets, strAssetIdB)) | |
844 | 865 | then (amountEnrollB > 0) | |
845 | 866 | else false) | |
846 | 867 | then invoke(this, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil) | |
847 | 868 | else 0 | |
848 | 869 | if ((stake2 == stake2)) | |
849 | 870 | then [IntegerEntry(kInvariant, invariantNew), IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB))] | |
850 | 871 | else throw("Strict value is not equal to itself.") | |
851 | 872 | } | |
852 | 873 | else throw("Strict value is not equal to itself.") | |
853 | 874 | } | |
854 | 875 | }) | |
855 | 876 | ||
856 | 877 | ||
857 | 878 | ||
858 | 879 | @Callable(i) | |
859 | 880 | func keepLimitForFirstHarvest (shareLimit) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [IntegerEntry(kShareLimit, shareLimit)])) | |
860 | 881 | ||
861 | 882 | ||
862 | 883 | ||
863 | 884 | @Callable(i) | |
864 | 885 | func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this)) | |
865 | 886 | then throw("Only contract itself can invoke this function") | |
866 | 887 | else { | |
867 | - | let $ | |
868 | - | let call = $ | |
869 | - | let addr = $ | |
870 | - | let params = $ | |
871 | - | let payments = $ | |
888 | + | let $t03578135884 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
889 | + | let call = $t03578135884._1 | |
890 | + | let addr = $t03578135884._2 | |
891 | + | let params = $t03578135884._3 | |
892 | + | let payments = $t03578135884._4 | |
872 | 893 | let inv = invoke(addr, call, params, payments) | |
873 | 894 | if ((inv == inv)) | |
874 | 895 | then nil | |
875 | 896 | else throw("Strict value is not equal to itself.") | |
876 | 897 | } | |
898 | + | ||
899 | + | ||
900 | + | ||
901 | + | @Callable(i) | |
902 | + | func replenishWithTwoTokens () = valueOrElse(isActive(), replenishWithTwoTokensCalc(i, false, 0)) | |
903 | + | ||
904 | + | ||
905 | + | ||
906 | + | @Callable(i) | |
907 | + | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = valueOrElse(isActive(), replenishWithOneTokenCalc(i, virtualSwapTokenPay, virtualSwapTokenGet, false, 0)) | |
908 | + | ||
909 | + | ||
910 | + | ||
911 | + | @Callable(i) | |
912 | + | func withdraw () = valueOrElse(isActive(), withdrawCalc(i, 0)) | |
877 | 913 | ||
878 | 914 | ||
879 | 915 | @Verifier(tx) | |
880 | 916 | func verify () = { | |
881 | 917 | let multiSignedByAdmins = { | |
882 | 918 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
883 | 919 | then 1 | |
884 | 920 | else 0 | |
885 | 921 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
886 | 922 | then 1 | |
887 | 923 | else 0 | |
888 | 924 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
889 | 925 | then 1 | |
890 | 926 | else 0 | |
891 | 927 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
892 | 928 | } | |
893 | 929 | match tx { | |
894 | 930 | case inv: InvokeScriptTransaction => | |
895 | 931 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
896 | 932 | then (inv.function == "takeIntoAccountExtraFunds") | |
897 | 933 | else false | |
898 | 934 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
899 | 935 | then true | |
900 | 936 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
901 | 937 | then true | |
902 | 938 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
903 | 939 | then true | |
904 | 940 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyInvoke) | |
905 | 941 | if (if (callTakeIntoAccount) | |
906 | 942 | then signedByAdmin | |
907 | 943 | else false) | |
908 | 944 | then true | |
909 | 945 | else multiSignedByAdmins | |
910 | 946 | case _ => | |
911 | 947 | multiSignedByAdmins | |
912 | 948 | } | |
913 | 949 | } | |
914 | 950 |
github/deemru/w8io/026f985 217.60 ms ◑