tx · Hhmftx4zsDJmHpo15zEgE87hGgBjwxceqTdhKSvRnrc 3N5Xd7QVQZWntaJwha9Kg42is626GUPjtUW: -0.14000000 Waves 2022.06.06 15:45 [2084512] smart account 3N5Xd7QVQZWntaJwha9Kg42is626GUPjtUW > SELF 0.00000000 Waves
{ "type": 13, "id": "Hhmftx4zsDJmHpo15zEgE87hGgBjwxceqTdhKSvRnrc", "fee": 14000000, "feeAssetId": null, "timestamp": 1654519525914, "version": 2, "chainId": 84, "sender": "3N5Xd7QVQZWntaJwha9Kg42is626GUPjtUW", "senderPublicKey": "DfbjpZJBbZwnUKysUkxCbWTE1ZWuoUb6Y6BZdu5iAE8j", "proofs": [ "qzXBgMtx5jvpj4WP7UiT3i1PzcbXNzqKTdN1jYEzvXDFEr9ZVZjwo8JLuAKn8jHt7FW6k14aePnbnPCWjLmDfCo", "4P2s71MrCzYE28pYL4KYyyFbp9p273rX9mMKrvJiVXibdiA34FQuRuYTFsb3iHo3tcP8VR34w4zdiDjQRfWYqjAA" ], "script": "base64:AAIFAAAAAAAAEvgIAhIAEgASBAoCAQESABIECgIBARIAEgASABIFCgMEAQgSABoMCgFBEgckbWF0Y2gwGgsKAUISBnN0cmluZxoMCgFDEgdub3RoaW5nGhEKAUQSDGFkbWluUHViS2V5MRoRCgFFEgxhZG1pblB1YktleTIaEQoBRhIMYWRtaW5QdWJLZXkzGhYKAUcSEWFkbWluUHViS2V5SW52b2tlGhQKAUgSD21vbmV5Qm94QWRkcmVzcxoPCgFJEgpnb3ZBZGRyZXNzGhcKAUoSEnN0YWtpbmdVU0ROQWRkcmVzcxoJCgFLEgRVU0ROGhIKAUwSDXN0YWtpbmdBc3NldHMaCwoBTRIGYWN0aXZlGhAKAU4SC3N0ckFzc2V0SWRBGhAKAU8SC3N0ckFzc2V0SWRCGg0KAVASCGFzc2V0SWRBGg0KAVESCGFzc2V0SWRCGg8KAVISCmFzc2V0TmFtZUEaBwoBUxICaWQaCgoBVBIFd2F2ZXMaDwoBVRI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IIBQAAAAJkegAAAARkQXBwBQAAAAR0aGlzCQAAAAAAAAIIBQAAAAJkegAAAAhmdW5jdGlvbgIAAAAZdGFrZUludG9BY2NvdW50RXh0cmFGdW5kcwcEAAAAAmRIAwMDCQAB9AAAAAMIBQAAAAJkQQAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmRBAAAABnByb29mcwAAAAAAAAAAAAUAAAABRAYJAAH0AAAAAwgFAAAAAmRBAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACZEEAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAFFBgkAAfQAAAADCAUAAAACZEEAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJkQQAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAAUYGCQAB9AAAAAMIBQAAAAJkQQAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmRBAAAABnByb29mcwAAAAAAAAAAAAUAAAABRwMDBQAAAAJkRwUAAAACZEgHBgUAAAACZEMFAAAAAmRD1YeZlw==", "height": 2084512, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: sRVmQR5UUJKRKZCf1TQfzRMKNNSybvkhGumCVmFFztf Next: HHTretVGkLmUGNcuYk3CNk53GFLEPycsdjonWAA4DDut Diff:
Old | New | Differences | |
---|---|---|---|
133 | 133 | ||
134 | 134 | let digits8 = 8 | |
135 | 135 | ||
136 | - | let dAppThreshold = | |
136 | + | let dAppThreshold = 125 | |
137 | 137 | ||
138 | - | let dAppThresholdScale2 = | |
138 | + | let dAppThresholdScale2 = 1000 | |
139 | 139 | ||
140 | - | let | |
140 | + | let exchangeRatioLimitCoef = 2500000 | |
141 | 141 | ||
142 | - | let | |
142 | + | let exchangeRatioLimit = 93500000 | |
143 | 143 | ||
144 | 144 | let alpha = 50 | |
145 | 145 | ||
310 | 310 | func throwOnePayment () = throw("One attached payment expected") | |
311 | 311 | ||
312 | 312 | ||
313 | - | func | |
313 | + | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
314 | 314 | ||
315 | 315 | ||
316 | - | func | |
316 | + | 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)) | |
317 | 317 | ||
318 | 318 | ||
319 | 319 | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
323 | 323 | ||
324 | 324 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
325 | 325 | then { | |
326 | - | let $ | |
327 | - | let call = $ | |
328 | - | let stakingAddr = $ | |
326 | + | let $t093629428 = calcStakingFuncAndAddres(stake, assetId) | |
327 | + | let call = $t093629428._1 | |
328 | + | let stakingAddr = $t093629428._2 | |
329 | 329 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
330 | 330 | } | |
331 | 331 | else { | |
332 | - | let $ | |
333 | - | let call = $ | |
334 | - | let stakingAddr = $ | |
332 | + | let $t095149580 = calcStakingFuncAndAddres(stake, assetId) | |
333 | + | let call = $t095149580._1 | |
334 | + | let stakingAddr = $t095149580._2 | |
335 | 335 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
336 | 336 | } | |
337 | 337 | ||
362 | 362 | } | |
363 | 363 | ||
364 | 364 | ||
365 | + | func calcBalanceAndPmtRatio (ABalance,BBalance,minAmountToReceive,pmtAmount,pmtAssetId) = if ((balanceA > balanceB)) | |
366 | + | then { | |
367 | + | let ratio = fraction(scale8, balanceA, balanceB) | |
368 | + | let pratio = if ((pmtAssetId == assetIdA)) | |
369 | + | then fraction(scale8, minAmountToReceive, pmtAmount) | |
370 | + | else fraction(scale8, minAmountToReceive, pmtAmount) | |
371 | + | $Tuple2(ratio, pratio) | |
372 | + | } | |
373 | + | else { | |
374 | + | let ratio = fraction(scale8, balanceB, balanceA) | |
375 | + | let pratio = if ((pmtAssetId == assetIdA)) | |
376 | + | then fraction(scale8, minAmountToReceive, pmtAmount) | |
377 | + | else fraction(scale8, minAmountToReceive, pmtAmount) | |
378 | + | $Tuple2(ratio, pratio) | |
379 | + | } | |
380 | + | ||
381 | + | ||
365 | 382 | @Callable(i) | |
366 | 383 | func init () = { | |
367 | - | let $ | |
368 | - | let pmtAmountA = $ | |
369 | - | let pmtAssetIdA = $ | |
370 | - | let $ | |
371 | - | let pmtAmountB = $ | |
372 | - | let pmtAssetIdB = $ | |
373 | - | let $ | |
374 | - | let pmtStrAssetIdA = $ | |
375 | - | let pmtAssetNameA = $ | |
376 | - | let pmtDecimalsA = $ | |
377 | - | let $ | |
378 | - | let pmtStrAssetIdB = $ | |
379 | - | let pmtAssetNameB = $ | |
380 | - | let pmtDecimalsB = $ | |
384 | + | let $t01149811575 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
385 | + | let pmtAmountA = $t01149811575._1 | |
386 | + | let pmtAssetIdA = $t01149811575._2 | |
387 | + | let $t01158011657 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
388 | + | let pmtAmountB = $t01158011657._1 | |
389 | + | let pmtAssetIdB = $t01158011657._2 | |
390 | + | let $t01166211739 = getAssetInfo(pmtAssetIdA) | |
391 | + | let pmtStrAssetIdA = $t01166211739._1 | |
392 | + | let pmtAssetNameA = $t01166211739._2 | |
393 | + | let pmtDecimalsA = $t01166211739._3 | |
394 | + | let $t01174411821 = getAssetInfo(pmtAssetIdB) | |
395 | + | let pmtStrAssetIdB = $t01174411821._1 | |
396 | + | let pmtAssetNameB = $t01174411821._2 | |
397 | + | let pmtDecimalsB = $t01174411821._3 | |
381 | 398 | if (isDefined(getBoolean(this, kActive))) | |
382 | 399 | then throwIsActive() | |
383 | 400 | else if ((pmtAssetIdA == pmtAssetIdB)) | |
414 | 431 | let pmtAssetIdB = i.payments[1].assetId | |
415 | 432 | let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA) | |
416 | 433 | let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB) | |
417 | - | let $ | |
418 | - | let pmtStrAssetIdA = $ | |
419 | - | let pmtAssetNameA = $ | |
420 | - | let pmtDecimalsA = $ | |
421 | - | let $ | |
422 | - | let pmtStrAssetIdB = $ | |
423 | - | let pmtAssetNameB = $ | |
424 | - | let pmtDecimalsB = $ | |
425 | - | let $ | |
434 | + | let $t01446914546 = getAssetInfo(pmtAssetIdA) | |
435 | + | let pmtStrAssetIdA = $t01446914546._1 | |
436 | + | let pmtAssetNameA = $t01446914546._2 | |
437 | + | let pmtDecimalsA = $t01446914546._3 | |
438 | + | let $t01455114668 = getAssetInfo(pmtAssetIdB) | |
439 | + | let pmtStrAssetIdB = $t01455114668._1 | |
440 | + | let pmtAssetNameB = $t01455114668._2 | |
441 | + | let pmtDecimalsB = $t01455114668._3 | |
442 | + | let $t01467315177 = if ((ratioShareTokensInB > ratioShareTokensInA)) | |
426 | 443 | then { | |
427 | 444 | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
428 | 445 | $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA) | |
431 | 448 | let pmt = fraction(balanceA, ratioShareTokensInB, scale8, CEILING) | |
432 | 449 | $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB) | |
433 | 450 | } | |
434 | - | let pmtAmountA = $ | |
435 | - | let pmtAmountB = $ | |
436 | - | let change = $ | |
437 | - | let changeAssetId = $ | |
438 | - | let shareTokenRatio = $ | |
451 | + | let pmtAmountA = $t01467315177._1 | |
452 | + | let pmtAmountB = $t01467315177._2 | |
453 | + | let change = $t01467315177._3 | |
454 | + | let changeAssetId = $t01467315177._4 | |
455 | + | let shareTokenRatio = $t01467315177._5 | |
439 | 456 | let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8) | |
440 | 457 | if ((size(i.payments) != 2)) | |
441 | 458 | then throw("Two attached assets expected") | |
470 | 487 | ||
471 | 488 | @Callable(i) | |
472 | 489 | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = valueOrElse(isActive(), { | |
473 | - | let $ | |
474 | - | let pmtAmount = $ | |
475 | - | let pmtAssetId = $ | |
476 | - | let $ | |
477 | - | let pmtStrAssetId = $ | |
478 | - | let pmtAssetName = $ | |
479 | - | let pmtDecimals = $ | |
490 | + | let $t01691016985 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
491 | + | let pmtAmount = $t01691016985._1 | |
492 | + | let pmtAssetId = $t01691016985._2 | |
493 | + | let $t01699017063 = getAssetInfo(pmtAssetId) | |
494 | + | let pmtStrAssetId = $t01699017063._1 | |
495 | + | let pmtAssetName = $t01699017063._2 | |
496 | + | let pmtDecimals = $t01699017063._3 | |
480 | 497 | let pmtMinThreshold = 5000000 | |
481 | 498 | let thresholdValueForMinTolerance = 50000000 | |
482 | 499 | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
496 | 513 | else false) | |
497 | 514 | then throwAssets() | |
498 | 515 | else { | |
499 | - | let $ | |
516 | + | let $t01804118683 = if ((pmtAssetId == assetIdA)) | |
500 | 517 | then $Tuple6((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), (balanceA + pmtAmount), balanceB) | |
501 | 518 | else $Tuple6(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), balanceA, (balanceB + pmtAmount)) | |
502 | - | let virtualReplenishA = $ | |
503 | - | let virtualReplenishB = $ | |
504 | - | let balanceAfterSwapA = $ | |
505 | - | let balanceAfterSwapB = $ | |
506 | - | let newBalanceA = $ | |
507 | - | let newBalanceB = $ | |
519 | + | let virtualReplenishA = $t01804118683._1 | |
520 | + | let virtualReplenishB = $t01804118683._2 | |
521 | + | let balanceAfterSwapA = $t01804118683._3 | |
522 | + | let balanceAfterSwapB = $t01804118683._4 | |
523 | + | let newBalanceA = $t01804118683._5 | |
524 | + | let newBalanceB = $t01804118683._6 | |
508 | 525 | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
509 | 526 | let ratioVirtualBalanceToVirtualReplenish = (fraction(scale16, balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
510 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
511 | 527 | if (if ((slippageValueMinForSwap >= fraction(scale8, invariant, invariantNew))) | |
512 | 528 | then true | |
513 | 529 | else (invariant > invariantNew)) | |
516 | 532 | then true | |
517 | 533 | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
518 | 534 | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
519 | - | else if (if ((dAppThresholdAmount > newBalanceA)) | |
520 | - | then true | |
521 | - | else (dAppThresholdAmount > newBalanceB)) | |
522 | - | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
523 | - | else { | |
524 | - | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
525 | - | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
526 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
527 | - | let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6) | |
528 | - | let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6) | |
529 | - | let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply) | |
530 | - | let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply) | |
531 | - | let $t01990820203 = if ((pmtStrAssetId == strAssetIdA)) | |
532 | - | then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB) | |
533 | - | else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA) | |
534 | - | let stakeAmount = $t01990820203._1 | |
535 | - | let unstakeAmount = $t01990820203._2 | |
536 | - | let unstakeAsset = $t01990820203._3 | |
537 | - | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
538 | - | then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil) | |
539 | - | else 0 | |
540 | - | if ((stake1 == stake1)) | |
541 | - | then { | |
542 | - | let stake2 = if (containsElement(stakingAssets, unstakeAsset)) | |
543 | - | then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil) | |
544 | - | else 0 | |
545 | - | if ((stake2 == stake2)) | |
546 | - | then [Reissue(shareAssetId, shareTokenToPayAmountAfterFee, true), ScriptTransfer(i.caller, shareTokenToPayAmountAfterFee, shareAssetId), ScriptTransfer(moneyBoxAddress, governanceRewardTokenA, assetIdA), ScriptTransfer(moneyBoxAddress, governanceRewardTokenB, assetIdB), IntegerEntry(kBalanceA, (newBalanceA - governanceRewardTokenA)), IntegerEntry(kBalanceB, (newBalanceB - governanceRewardTokenB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmountAfterFee)), IntegerEntry(kInvariant, invariantCalc((newBalanceA - governanceRewardTokenA), (newBalanceB - governanceRewardTokenB)))] | |
547 | - | else throw("Strict value is not equal to itself.") | |
548 | - | } | |
549 | - | else throw("Strict value is not equal to itself.") | |
550 | - | } | |
535 | + | else { | |
536 | + | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
537 | + | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
538 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
539 | + | let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6) | |
540 | + | let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6) | |
541 | + | let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply) | |
542 | + | let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply) | |
543 | + | let $t02039420689 = if ((pmtStrAssetId == strAssetIdA)) | |
544 | + | then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB) | |
545 | + | else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA) | |
546 | + | let stakeAmount = $t02039420689._1 | |
547 | + | let unstakeAmount = $t02039420689._2 | |
548 | + | let unstakeAsset = $t02039420689._3 | |
549 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
550 | + | then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil) | |
551 | + | else 0 | |
552 | + | if ((stake1 == stake1)) | |
553 | + | then { | |
554 | + | let stake2 = if (containsElement(stakingAssets, unstakeAsset)) | |
555 | + | then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil) | |
556 | + | else 0 | |
557 | + | if ((stake2 == stake2)) | |
558 | + | then [Reissue(shareAssetId, shareTokenToPayAmountAfterFee, true), ScriptTransfer(i.caller, shareTokenToPayAmountAfterFee, shareAssetId), ScriptTransfer(moneyBoxAddress, governanceRewardTokenA, assetIdA), ScriptTransfer(moneyBoxAddress, governanceRewardTokenB, assetIdB), IntegerEntry(kBalanceA, (newBalanceA - governanceRewardTokenA)), IntegerEntry(kBalanceB, (newBalanceB - governanceRewardTokenB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmountAfterFee)), IntegerEntry(kInvariant, invariantCalc((newBalanceA - governanceRewardTokenA), (newBalanceB - governanceRewardTokenB)))] | |
559 | + | else throw("Strict value is not equal to itself.") | |
560 | + | } | |
561 | + | else throw("Strict value is not equal to itself.") | |
562 | + | } | |
551 | 563 | } | |
552 | 564 | }) | |
553 | 565 | ||
555 | 567 | ||
556 | 568 | @Callable(i) | |
557 | 569 | func withdraw () = valueOrElse(isActive(), { | |
558 | - | let $ | |
559 | - | let pmtAmount = $ | |
560 | - | let pmtAssetId = $ | |
570 | + | let $t02197622051 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
571 | + | let pmtAmount = $t02197622051._1 | |
572 | + | let pmtAssetId = $t02197622051._2 | |
561 | 573 | let amountToPayA = fraction(pmtAmount, balanceA, shareAssetSupply) | |
562 | 574 | let amountToPayB = fraction(pmtAmount, balanceB, shareAssetSupply) | |
563 | 575 | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
588 | 600 | ||
589 | 601 | @Callable(i) | |
590 | 602 | func exchange (estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), { | |
591 | - | let $ | |
592 | - | let pmtAmount = $ | |
593 | - | let pmtAssetId = $ | |
603 | + | let $t02360223677 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
604 | + | let pmtAmount = $t02360223677._1 | |
605 | + | let pmtAssetId = $t02360223677._2 | |
594 | 606 | if ((0 >= estimatedAmountToReceive)) | |
595 | 607 | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
596 | 608 | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
605 | 617 | then throwAssets() | |
606 | 618 | else if ((10000000 > pmtAmount)) | |
607 | 619 | then throw("Only swap of 10.000000 or more tokens is allowed") | |
608 | - | else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount))) | |
609 | - | then true | |
610 | - | else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax)) | |
611 | - | then throw("Incorrect args and pmt ratio") | |
612 | - | else { | |
613 | - | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
614 | - | then assetIdB | |
615 | - | else assetIdA | |
616 | - | let amount = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId) | |
617 | - | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
618 | - | let governanceReward = fraction(amount, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
619 | - | let amountMinusFee = fraction(amount, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
620 | - | let $t02464424906 = if ((pmtAssetId == assetIdA)) | |
621 | - | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
622 | - | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
623 | - | let newBalanceA = $t02464424906._1 | |
624 | - | let newBalanceB = $t02464424906._2 | |
625 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
626 | - | if (if ((dAppThresholdAmount > newBalanceA)) | |
627 | - | then true | |
628 | - | else (dAppThresholdAmount > newBalanceB)) | |
629 | - | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
630 | - | else { | |
631 | - | let $t02520525278 = getAssetInfo(pmtAssetId) | |
632 | - | let pmtStrAssetId = $t02520525278._1 | |
633 | - | let pmtAssetName = $t02520525278._2 | |
634 | - | let pmtDecimals = $t02520525278._3 | |
635 | - | let $t02529125368 = getAssetInfo(sendAssetId) | |
636 | - | let sendStrAssetId = $t02529125368._1 | |
637 | - | let sendAssetName = $t02529125368._2 | |
638 | - | let sendDecimals = $t02529125368._3 | |
639 | - | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
640 | - | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
641 | - | else 0 | |
642 | - | if ((stake1 == stake1)) | |
643 | - | then { | |
644 | - | let stake2 = if (containsElement(stakingAssets, sendStrAssetId)) | |
645 | - | then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil) | |
646 | - | else 0 | |
647 | - | if ((stake2 == stake2)) | |
648 | - | then $Tuple2([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(moneyBoxAddress, governanceReward, sendAssetId)], $Tuple2(amountMinusFee, sendAssetId)) | |
649 | - | else throw("Strict value is not equal to itself.") | |
650 | - | } | |
651 | - | else throw("Strict value is not equal to itself.") | |
652 | - | } | |
653 | - | } | |
620 | + | else { | |
621 | + | let $t02436324479 = calcBalanceAndPmtRatio(balanceA, balanceB, minAmountToReceive, pmtAmount, pmtAssetId) | |
622 | + | let balanceRatio = $t02436324479._1 | |
623 | + | let pmtRatio = $t02436324479._2 | |
624 | + | if (((exchangeRatioLimit - fraction(exchangeRatioLimitCoef, balanceRatio, scale8)) > pmtRatio)) | |
625 | + | then throw("Incorrect args and pmt ratio") | |
626 | + | else { | |
627 | + | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
628 | + | then assetIdB | |
629 | + | else assetIdA | |
630 | + | let amount = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId) | |
631 | + | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
632 | + | let governanceReward = fraction(amount, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
633 | + | let amountMinusFee = fraction(amount, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
634 | + | let $t02523425512 = if ((pmtAssetId == assetIdA)) | |
635 | + | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
636 | + | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
637 | + | let newBalanceA = $t02523425512._1 | |
638 | + | let newBalanceB = $t02523425512._2 | |
639 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
640 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
641 | + | then true | |
642 | + | else (dAppThresholdAmount > newBalanceB)) | |
643 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
644 | + | else { | |
645 | + | let $t02583125904 = getAssetInfo(pmtAssetId) | |
646 | + | let pmtStrAssetId = $t02583125904._1 | |
647 | + | let pmtAssetName = $t02583125904._2 | |
648 | + | let pmtDecimals = $t02583125904._3 | |
649 | + | let $t02592125998 = getAssetInfo(sendAssetId) | |
650 | + | let sendStrAssetId = $t02592125998._1 | |
651 | + | let sendAssetName = $t02592125998._2 | |
652 | + | let sendDecimals = $t02592125998._3 | |
653 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
654 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
655 | + | else 0 | |
656 | + | if ((stake1 == stake1)) | |
657 | + | then { | |
658 | + | let stake2 = if (containsElement(stakingAssets, sendStrAssetId)) | |
659 | + | then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil) | |
660 | + | else 0 | |
661 | + | if ((stake2 == stake2)) | |
662 | + | then $Tuple2([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(moneyBoxAddress, governanceReward, sendAssetId)], $Tuple2(amountMinusFee, sendAssetId)) | |
663 | + | else throw("Strict value is not equal to itself.") | |
664 | + | } | |
665 | + | else throw("Strict value is not equal to itself.") | |
666 | + | } | |
667 | + | } | |
668 | + | } | |
654 | 669 | }) | |
655 | 670 | ||
656 | 671 | ||
711 | 726 | func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this)) | |
712 | 727 | then throw("Only contract itself can invoke this function") | |
713 | 728 | else { | |
714 | - | let $ | |
715 | - | let call = $ | |
716 | - | let addr = $ | |
717 | - | let params = $ | |
718 | - | let payments = $ | |
729 | + | let $t02904129144 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
730 | + | let call = $t02904129144._1 | |
731 | + | let addr = $t02904129144._2 | |
732 | + | let params = $t02904129144._3 | |
733 | + | let payments = $t02904129144._4 | |
719 | 734 | let inv = invoke(addr, call, params, payments) | |
720 | 735 | if ((inv == inv)) | |
721 | 736 | then nil |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
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 | 9 | ||
10 | 10 | let kAssetIdA = "A_asset_id" | |
11 | 11 | ||
12 | 12 | let kAssetIdB = "B_asset_id" | |
13 | 13 | ||
14 | 14 | let kBalanceA = "A_asset_balance" | |
15 | 15 | ||
16 | 16 | let kBalanceB = "B_asset_balance" | |
17 | 17 | ||
18 | 18 | let kShareAssetId = "share_asset_id" | |
19 | 19 | ||
20 | 20 | let kShareAssetSupply = "share_asset_supply" | |
21 | 21 | ||
22 | 22 | let kFee = "commission" | |
23 | 23 | ||
24 | 24 | let kInvariant = "invariant" | |
25 | 25 | ||
26 | 26 | let kCause = "shutdown_cause" | |
27 | 27 | ||
28 | 28 | let kUSDNAddress = "staking_usdnnsbt_address" | |
29 | 29 | ||
30 | 30 | let kEURNAddress = "staking_eurn_address" | |
31 | 31 | ||
32 | 32 | let kDiscounts = "discounts" | |
33 | 33 | ||
34 | 34 | let kDiscountValues = "discount_values" | |
35 | 35 | ||
36 | 36 | let kUserSwopInGov = "_SWOP_amount" | |
37 | 37 | ||
38 | 38 | let kAdminPubKey1 = "admin_pub_1" | |
39 | 39 | ||
40 | 40 | let kAdminPubKey2 = "admin_pub_2" | |
41 | 41 | ||
42 | 42 | let kAdminPubKey3 = "admin_pub_3" | |
43 | 43 | ||
44 | 44 | let kAdminInvokePubKey = "admin_invoke_pub" | |
45 | 45 | ||
46 | 46 | let kMoneyBoxAddress = "money_box_address" | |
47 | 47 | ||
48 | 48 | let kGovAddress = "governance_address" | |
49 | 49 | ||
50 | 50 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
51 | 51 | ||
52 | 52 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
53 | 53 | case string: String => | |
54 | 54 | fromBase58String(string) | |
55 | 55 | case nothing => | |
56 | 56 | throw((key + "is empty")) | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
61 | 61 | ||
62 | 62 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
63 | 63 | ||
64 | 64 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
65 | 65 | ||
66 | 66 | let adminPubKeyInvoke = getBase58FromOracle(kAdminInvokePubKey) | |
67 | 67 | ||
68 | 68 | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
69 | 69 | ||
70 | 70 | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
71 | 71 | ||
72 | 72 | let stakingUSDNAddress = Address(getBase58FromOracle(kUSDNAddress)) | |
73 | 73 | ||
74 | 74 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
75 | 75 | ||
76 | 76 | let stakingAssets = [toBase58String(USDN)] | |
77 | 77 | ||
78 | 78 | let active = getBooleanValue(this, kActive) | |
79 | 79 | ||
80 | 80 | let strAssetIdA = getStringValue(this, kAssetIdA) | |
81 | 81 | ||
82 | 82 | let strAssetIdB = getStringValue(this, kAssetIdB) | |
83 | 83 | ||
84 | 84 | let assetIdA = if ((strAssetIdA == "WAVES")) | |
85 | 85 | then unit | |
86 | 86 | else fromBase58String(strAssetIdA) | |
87 | 87 | ||
88 | 88 | let assetIdB = if ((strAssetIdB == "WAVES")) | |
89 | 89 | then unit | |
90 | 90 | else fromBase58String(strAssetIdB) | |
91 | 91 | ||
92 | 92 | let assetNameA = match assetIdA { | |
93 | 93 | case id: ByteVector => | |
94 | 94 | value(assetInfo(id)).name | |
95 | 95 | case waves: Unit => | |
96 | 96 | "WAVES" | |
97 | 97 | case _ => | |
98 | 98 | throw("Match error") | |
99 | 99 | } | |
100 | 100 | ||
101 | 101 | let assetNameB = match assetIdB { | |
102 | 102 | case id: ByteVector => | |
103 | 103 | value(assetInfo(id)).name | |
104 | 104 | case waves: Unit => | |
105 | 105 | "WAVES" | |
106 | 106 | case _ => | |
107 | 107 | throw("Match error") | |
108 | 108 | } | |
109 | 109 | ||
110 | 110 | let balanceA = getIntegerValue(this, kBalanceA) | |
111 | 111 | ||
112 | 112 | let balanceB = getIntegerValue(this, kBalanceB) | |
113 | 113 | ||
114 | 114 | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
115 | 115 | ||
116 | 116 | let shareAssetSupply = getIntegerValue(this, kShareAssetSupply) | |
117 | 117 | ||
118 | 118 | let invariant = getIntegerValue(this, kInvariant) | |
119 | 119 | ||
120 | 120 | let fee = getIntegerValue(this, kFee) | |
121 | 121 | ||
122 | 122 | let feeGovernance = fraction(fee, 40, 100) | |
123 | 123 | ||
124 | 124 | let feeScale6 = 1000000 | |
125 | 125 | ||
126 | 126 | let scale3 = 1000 | |
127 | 127 | ||
128 | 128 | let scale8 = 100000000 | |
129 | 129 | ||
130 | 130 | let scale16 = 10000000000000000 | |
131 | 131 | ||
132 | 132 | let slippageScale3 = 1000 | |
133 | 133 | ||
134 | 134 | let digits8 = 8 | |
135 | 135 | ||
136 | - | let dAppThreshold = | |
136 | + | let dAppThreshold = 125 | |
137 | 137 | ||
138 | - | let dAppThresholdScale2 = | |
138 | + | let dAppThresholdScale2 = 1000 | |
139 | 139 | ||
140 | - | let | |
140 | + | let exchangeRatioLimitCoef = 2500000 | |
141 | 141 | ||
142 | - | let | |
142 | + | let exchangeRatioLimit = 93500000 | |
143 | 143 | ||
144 | 144 | let alpha = 50 | |
145 | 145 | ||
146 | 146 | let alphaDigits = 2 | |
147 | 147 | ||
148 | 148 | let beta = 4600000000000000 | |
149 | 149 | ||
150 | 150 | func accountBalance (assetId) = match assetId { | |
151 | 151 | case id: ByteVector => | |
152 | 152 | assetBalance(this, id) | |
153 | 153 | case waves: Unit => | |
154 | 154 | wavesBalance(this).available | |
155 | 155 | case _ => | |
156 | 156 | throw("Match error") | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func stakedAmount (assetId) = { | |
161 | 161 | let stakedAmountCalculated = match assetId { | |
162 | 162 | case aId: ByteVector => | |
163 | 163 | if ((aId == USDN)) | |
164 | 164 | then getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this))) | |
165 | 165 | else 0 | |
166 | 166 | case _: Unit => | |
167 | 167 | 0 | |
168 | 168 | case _ => | |
169 | 169 | throw("Match error") | |
170 | 170 | } | |
171 | 171 | match stakedAmountCalculated { | |
172 | 172 | case i: Int => | |
173 | 173 | i | |
174 | 174 | case _ => | |
175 | 175 | 0 | |
176 | 176 | } | |
177 | 177 | } | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | let stakedAmountA = stakedAmount(assetIdA) | |
181 | 181 | ||
182 | 182 | let stakedAmountB = stakedAmount(assetIdB) | |
183 | 183 | ||
184 | 184 | let availableBalanceA = (balanceA - stakedAmountA) | |
185 | 185 | ||
186 | 186 | let availableBalanceB = (balanceB - stakedAmountB) | |
187 | 187 | ||
188 | 188 | let accountBalanceWithStakedA = (accountBalance(assetIdA) + stakedAmountA) | |
189 | 189 | ||
190 | 190 | let accountBalanceWithStakedB = (accountBalance(assetIdB) + stakedAmountB) | |
191 | 191 | ||
192 | 192 | let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA)) | |
193 | 193 | then (accountBalanceWithStakedB >= balanceB) | |
194 | 194 | else false | |
195 | 195 | ||
196 | 196 | func skewness (x,y) = ((fraction(scale16, x, y) + fraction(scale16, y, x)) / 2) | |
197 | 197 | ||
198 | 198 | ||
199 | 199 | func invariantCalc (x,y) = { | |
200 | 200 | let sk = skewness(x, y) | |
201 | 201 | (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))) | |
202 | 202 | } | |
203 | 203 | ||
204 | 204 | ||
205 | 205 | func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId) = { | |
206 | 206 | let worstAllowedNewInvariantRatio = (scale16 - ((scale16 * 1) / 10000000)) | |
207 | 207 | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount) | |
208 | 208 | let x = (balanceA + tokenReceiveAmount) | |
209 | 209 | let y = (balanceB + tokenReceiveAmount) | |
210 | 210 | func getStepAmount (acc,step) = if ((acc._1 == -1)) | |
211 | 211 | then { | |
212 | 212 | let amountToSend = (amountToSendEstimated - (((step * deltaBetweenMaxAndMinSendValue) / 3) / scale3)) | |
213 | 213 | let stepInvariant = if ((tokenId == assetIdA)) | |
214 | 214 | then invariantCalc(x, (balanceB - amountToSend)) | |
215 | 215 | else invariantCalc((balanceA - amountToSend), y) | |
216 | 216 | if ((stepInvariant > invariant)) | |
217 | 217 | then $Tuple2(amountToSend, stepInvariant) | |
218 | 218 | else $Tuple2(-1, 0) | |
219 | 219 | } | |
220 | 220 | else acc | |
221 | 221 | ||
222 | 222 | let amountToSendMin = getStepAmount($Tuple2(-1, 0), 3000) | |
223 | 223 | if ((0 > amountToSendMin._1)) | |
224 | 224 | then throw("Price is worse than minReceived") | |
225 | 225 | else { | |
226 | 226 | let invEstimated = if ((tokenId == assetIdA)) | |
227 | 227 | then invariantCalc(x, (balanceB - amountToSendEstimated)) | |
228 | 228 | else if ((tokenId == assetIdB)) | |
229 | 229 | then invariantCalc((balanceA - amountToSendEstimated), y) | |
230 | 230 | else throw("Wrong asset in payment") | |
231 | 231 | if ((invariant > invEstimated)) | |
232 | 232 | then if ((worstAllowedNewInvariantRatio >= fraction(scale16, invariant, invEstimated))) | |
233 | 233 | then throw("The requested price is too not profitable for user") | |
234 | 234 | else { | |
235 | 235 | let a = { | |
236 | 236 | let $l = [25, 200, 500] | |
237 | 237 | let $s = size($l) | |
238 | 238 | let $acc0 = $Tuple2(-1, 0) | |
239 | 239 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
240 | 240 | then $a | |
241 | 241 | else getStepAmount($a, $l[$i]) | |
242 | 242 | ||
243 | 243 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
244 | 244 | then $a | |
245 | 245 | else throw("List size exceeds 3") | |
246 | 246 | ||
247 | 247 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
248 | 248 | } | |
249 | 249 | if ((0 > a._1)) | |
250 | 250 | then amountToSendMin._1 | |
251 | 251 | else a._1 | |
252 | 252 | } | |
253 | 253 | else { | |
254 | 254 | let a = { | |
255 | 255 | let $l = [-500, -200, -25] | |
256 | 256 | let $s = size($l) | |
257 | 257 | let $acc0 = $Tuple2(-1, 0) | |
258 | 258 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
259 | 259 | then $a | |
260 | 260 | else getStepAmount($a, $l[$i]) | |
261 | 261 | ||
262 | 262 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
263 | 263 | then $a | |
264 | 264 | else throw("List size exceeds 3") | |
265 | 265 | ||
266 | 266 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
267 | 267 | } | |
268 | 268 | let tupleSendBetter = if ((0 > a._1)) | |
269 | 269 | then $Tuple2(amountToSendEstimated, invEstimated) | |
270 | 270 | else a | |
271 | 271 | if ((worstAllowedNewInvariantRatio >= fraction(scale16, invariant, tupleSendBetter._2))) | |
272 | 272 | then throw("The requested price is too not profitable for user") | |
273 | 273 | else tupleSendBetter._1 | |
274 | 274 | } | |
275 | 275 | } | |
276 | 276 | } | |
277 | 277 | ||
278 | 278 | ||
279 | 279 | func getAssetInfo (assetId) = match assetId { | |
280 | 280 | case id: ByteVector => | |
281 | 281 | let stringId = toBase58String(id) | |
282 | 282 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
283 | 283 | $Tuple3(stringId, info.name, info.decimals) | |
284 | 284 | case waves: Unit => | |
285 | 285 | $Tuple3("WAVES", "WAVES", 8) | |
286 | 286 | case _ => | |
287 | 287 | throw("Match error") | |
288 | 288 | } | |
289 | 289 | ||
290 | 290 | ||
291 | 291 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
292 | 292 | ||
293 | 293 | ||
294 | 294 | func throwIsActive () = throw("DApp is already active") | |
295 | 295 | ||
296 | 296 | ||
297 | 297 | func isActive () = if (active) | |
298 | 298 | then unit | |
299 | 299 | else throw("DApp is inactive at this moment") | |
300 | 300 | ||
301 | 301 | ||
302 | 302 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
303 | 303 | then unit | |
304 | 304 | else throw("Only admin can call this function") | |
305 | 305 | ||
306 | 306 | ||
307 | 307 | func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
308 | 308 | ||
309 | 309 | ||
310 | 310 | func throwOnePayment () = throw("One attached payment expected") | |
311 | 311 | ||
312 | 312 | ||
313 | - | func | |
313 | + | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
314 | 314 | ||
315 | 315 | ||
316 | - | func | |
316 | + | 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)) | |
317 | 317 | ||
318 | 318 | ||
319 | 319 | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
320 | 320 | then $Tuple2("lockNeutrino", stakingUSDNAddress) | |
321 | 321 | else $Tuple2("unlockNeutrino", stakingUSDNAddress) | |
322 | 322 | ||
323 | 323 | ||
324 | 324 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
325 | 325 | then { | |
326 | - | let $ | |
327 | - | let call = $ | |
328 | - | let stakingAddr = $ | |
326 | + | let $t093629428 = calcStakingFuncAndAddres(stake, assetId) | |
327 | + | let call = $t093629428._1 | |
328 | + | let stakingAddr = $t093629428._2 | |
329 | 329 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
330 | 330 | } | |
331 | 331 | else { | |
332 | - | let $ | |
333 | - | let call = $ | |
334 | - | let stakingAddr = $ | |
332 | + | let $t095149580 = calcStakingFuncAndAddres(stake, assetId) | |
333 | + | let call = $t095149580._1 | |
334 | + | let stakingAddr = $t095149580._2 | |
335 | 335 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
336 | 336 | } | |
337 | 337 | ||
338 | 338 | ||
339 | 339 | func calculateFeeDiscount (userAddr) = { | |
340 | 340 | let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0) | |
341 | 341 | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
342 | 342 | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
343 | 343 | if (if ((swopAmount >= parseIntValue(discountValues[0]))) | |
344 | 344 | then (parseIntValue(discountValues[1]) > swopAmount) | |
345 | 345 | else false) | |
346 | 346 | then (feeScale6 - parseIntValue(discounts[0])) | |
347 | 347 | else if (if ((swopAmount >= parseIntValue(discountValues[1]))) | |
348 | 348 | then (parseIntValue(discountValues[2]) > swopAmount) | |
349 | 349 | else false) | |
350 | 350 | then (feeScale6 - parseIntValue(discounts[1])) | |
351 | 351 | else if (if ((swopAmount >= parseIntValue(discountValues[2]))) | |
352 | 352 | then (parseIntValue(discountValues[3]) > swopAmount) | |
353 | 353 | else false) | |
354 | 354 | then (feeScale6 - parseIntValue(discounts[2])) | |
355 | 355 | else if (if ((swopAmount >= parseIntValue(discountValues[3]))) | |
356 | 356 | then (parseIntValue(discountValues[4]) > swopAmount) | |
357 | 357 | else false) | |
358 | 358 | then (feeScale6 - parseIntValue(discounts[3])) | |
359 | 359 | else if ((swopAmount >= parseIntValue(discountValues[4]))) | |
360 | 360 | then (feeScale6 - parseIntValue(discounts[4])) | |
361 | 361 | else feeScale6 | |
362 | 362 | } | |
363 | 363 | ||
364 | 364 | ||
365 | + | func calcBalanceAndPmtRatio (ABalance,BBalance,minAmountToReceive,pmtAmount,pmtAssetId) = if ((balanceA > balanceB)) | |
366 | + | then { | |
367 | + | let ratio = fraction(scale8, balanceA, balanceB) | |
368 | + | let pratio = if ((pmtAssetId == assetIdA)) | |
369 | + | then fraction(scale8, minAmountToReceive, pmtAmount) | |
370 | + | else fraction(scale8, minAmountToReceive, pmtAmount) | |
371 | + | $Tuple2(ratio, pratio) | |
372 | + | } | |
373 | + | else { | |
374 | + | let ratio = fraction(scale8, balanceB, balanceA) | |
375 | + | let pratio = if ((pmtAssetId == assetIdA)) | |
376 | + | then fraction(scale8, minAmountToReceive, pmtAmount) | |
377 | + | else fraction(scale8, minAmountToReceive, pmtAmount) | |
378 | + | $Tuple2(ratio, pratio) | |
379 | + | } | |
380 | + | ||
381 | + | ||
365 | 382 | @Callable(i) | |
366 | 383 | func init () = { | |
367 | - | let $ | |
368 | - | let pmtAmountA = $ | |
369 | - | let pmtAssetIdA = $ | |
370 | - | let $ | |
371 | - | let pmtAmountB = $ | |
372 | - | let pmtAssetIdB = $ | |
373 | - | let $ | |
374 | - | let pmtStrAssetIdA = $ | |
375 | - | let pmtAssetNameA = $ | |
376 | - | let pmtDecimalsA = $ | |
377 | - | let $ | |
378 | - | let pmtStrAssetIdB = $ | |
379 | - | let pmtAssetNameB = $ | |
380 | - | let pmtDecimalsB = $ | |
384 | + | let $t01149811575 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
385 | + | let pmtAmountA = $t01149811575._1 | |
386 | + | let pmtAssetIdA = $t01149811575._2 | |
387 | + | let $t01158011657 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
388 | + | let pmtAmountB = $t01158011657._1 | |
389 | + | let pmtAssetIdB = $t01158011657._2 | |
390 | + | let $t01166211739 = getAssetInfo(pmtAssetIdA) | |
391 | + | let pmtStrAssetIdA = $t01166211739._1 | |
392 | + | let pmtAssetNameA = $t01166211739._2 | |
393 | + | let pmtDecimalsA = $t01166211739._3 | |
394 | + | let $t01174411821 = getAssetInfo(pmtAssetIdB) | |
395 | + | let pmtStrAssetIdB = $t01174411821._1 | |
396 | + | let pmtAssetNameB = $t01174411821._2 | |
397 | + | let pmtDecimalsB = $t01174411821._3 | |
381 | 398 | if (isDefined(getBoolean(this, kActive))) | |
382 | 399 | then throwIsActive() | |
383 | 400 | else if ((pmtAssetIdA == pmtAssetIdB)) | |
384 | 401 | then throw("Assets must be different") | |
385 | 402 | else { | |
386 | 403 | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
387 | 404 | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
388 | 405 | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
389 | 406 | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
390 | 407 | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
391 | 408 | let shareIssueId = calculateAssetId(shareIssue) | |
392 | 409 | let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB) | |
393 | 410 | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
394 | 411 | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
395 | 412 | else 0 | |
396 | 413 | if ((stake1 == stake1)) | |
397 | 414 | then { | |
398 | 415 | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
399 | 416 | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
400 | 417 | else 0 | |
401 | 418 | if ((stake2 == stake2)) | |
402 | 419 | then [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)] | |
403 | 420 | else throw("Strict value is not equal to itself.") | |
404 | 421 | } | |
405 | 422 | else throw("Strict value is not equal to itself.") | |
406 | 423 | } | |
407 | 424 | } | |
408 | 425 | ||
409 | 426 | ||
410 | 427 | ||
411 | 428 | @Callable(i) | |
412 | 429 | func replenishWithTwoTokens () = valueOrElse(isActive(), { | |
413 | 430 | let pmtAssetIdA = i.payments[0].assetId | |
414 | 431 | let pmtAssetIdB = i.payments[1].assetId | |
415 | 432 | let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA) | |
416 | 433 | let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB) | |
417 | - | let $ | |
418 | - | let pmtStrAssetIdA = $ | |
419 | - | let pmtAssetNameA = $ | |
420 | - | let pmtDecimalsA = $ | |
421 | - | let $ | |
422 | - | let pmtStrAssetIdB = $ | |
423 | - | let pmtAssetNameB = $ | |
424 | - | let pmtDecimalsB = $ | |
425 | - | let $ | |
434 | + | let $t01446914546 = getAssetInfo(pmtAssetIdA) | |
435 | + | let pmtStrAssetIdA = $t01446914546._1 | |
436 | + | let pmtAssetNameA = $t01446914546._2 | |
437 | + | let pmtDecimalsA = $t01446914546._3 | |
438 | + | let $t01455114668 = getAssetInfo(pmtAssetIdB) | |
439 | + | let pmtStrAssetIdB = $t01455114668._1 | |
440 | + | let pmtAssetNameB = $t01455114668._2 | |
441 | + | let pmtDecimalsB = $t01455114668._3 | |
442 | + | let $t01467315177 = if ((ratioShareTokensInB > ratioShareTokensInA)) | |
426 | 443 | then { | |
427 | 444 | let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING) | |
428 | 445 | $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA) | |
429 | 446 | } | |
430 | 447 | else { | |
431 | 448 | let pmt = fraction(balanceA, ratioShareTokensInB, scale8, CEILING) | |
432 | 449 | $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB) | |
433 | 450 | } | |
434 | - | let pmtAmountA = $ | |
435 | - | let pmtAmountB = $ | |
436 | - | let change = $ | |
437 | - | let changeAssetId = $ | |
438 | - | let shareTokenRatio = $ | |
451 | + | let pmtAmountA = $t01467315177._1 | |
452 | + | let pmtAmountB = $t01467315177._2 | |
453 | + | let change = $t01467315177._3 | |
454 | + | let changeAssetId = $t01467315177._4 | |
455 | + | let shareTokenRatio = $t01467315177._5 | |
439 | 456 | let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8) | |
440 | 457 | if ((size(i.payments) != 2)) | |
441 | 458 | then throw("Two attached assets expected") | |
442 | 459 | else if (if ((pmtAssetIdA != assetIdA)) | |
443 | 460 | then true | |
444 | 461 | else (pmtAssetIdB != assetIdB)) | |
445 | 462 | then throwAssets() | |
446 | 463 | else if ((shareTokenToPayAmount == 0)) | |
447 | 464 | then throw("Too small amount to replenish") | |
448 | 465 | else if ((0 > change)) | |
449 | 466 | then throw("Change < 0") | |
450 | 467 | else if (!(hasEnoughBalance)) | |
451 | 468 | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
452 | 469 | else { | |
453 | 470 | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
454 | 471 | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
455 | 472 | else 0 | |
456 | 473 | if ((stake1 == stake1)) | |
457 | 474 | then { | |
458 | 475 | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
459 | 476 | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
460 | 477 | else 0 | |
461 | 478 | if ((stake2 == stake2)) | |
462 | 479 | then [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), ScriptTransfer(i.caller, change, changeAssetId)] | |
463 | 480 | else throw("Strict value is not equal to itself.") | |
464 | 481 | } | |
465 | 482 | else throw("Strict value is not equal to itself.") | |
466 | 483 | } | |
467 | 484 | }) | |
468 | 485 | ||
469 | 486 | ||
470 | 487 | ||
471 | 488 | @Callable(i) | |
472 | 489 | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = valueOrElse(isActive(), { | |
473 | - | let $ | |
474 | - | let pmtAmount = $ | |
475 | - | let pmtAssetId = $ | |
476 | - | let $ | |
477 | - | let pmtStrAssetId = $ | |
478 | - | let pmtAssetName = $ | |
479 | - | let pmtDecimals = $ | |
490 | + | let $t01691016985 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
491 | + | let pmtAmount = $t01691016985._1 | |
492 | + | let pmtAssetId = $t01691016985._2 | |
493 | + | let $t01699017063 = getAssetInfo(pmtAssetId) | |
494 | + | let pmtStrAssetId = $t01699017063._1 | |
495 | + | let pmtAssetName = $t01699017063._2 | |
496 | + | let pmtDecimals = $t01699017063._3 | |
480 | 497 | let pmtMinThreshold = 5000000 | |
481 | 498 | let thresholdValueForMinTolerance = 50000000 | |
482 | 499 | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
483 | 500 | then 100000 | |
484 | 501 | else 1 | |
485 | 502 | let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000)) | |
486 | 503 | let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000)) | |
487 | 504 | let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000)) | |
488 | 505 | if ((pmtMinThreshold > pmtAmount)) | |
489 | 506 | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
490 | 507 | else if ((size(i.payments) != 1)) | |
491 | 508 | then throwOnePayment() | |
492 | 509 | else if (!(hasEnoughBalance)) | |
493 | 510 | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
494 | 511 | else if (if ((pmtAssetId != assetIdA)) | |
495 | 512 | then (pmtAssetId != assetIdB) | |
496 | 513 | else false) | |
497 | 514 | then throwAssets() | |
498 | 515 | else { | |
499 | - | let $ | |
516 | + | let $t01804118683 = if ((pmtAssetId == assetIdA)) | |
500 | 517 | then $Tuple6((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), (balanceA + pmtAmount), balanceB) | |
501 | 518 | else $Tuple6(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), balanceA, (balanceB + pmtAmount)) | |
502 | - | let virtualReplenishA = $ | |
503 | - | let virtualReplenishB = $ | |
504 | - | let balanceAfterSwapA = $ | |
505 | - | let balanceAfterSwapB = $ | |
506 | - | let newBalanceA = $ | |
507 | - | let newBalanceB = $ | |
519 | + | let virtualReplenishA = $t01804118683._1 | |
520 | + | let virtualReplenishB = $t01804118683._2 | |
521 | + | let balanceAfterSwapA = $t01804118683._3 | |
522 | + | let balanceAfterSwapB = $t01804118683._4 | |
523 | + | let newBalanceA = $t01804118683._5 | |
524 | + | let newBalanceB = $t01804118683._6 | |
508 | 525 | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
509 | 526 | let ratioVirtualBalanceToVirtualReplenish = (fraction(scale16, balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB)) | |
510 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
511 | 527 | if (if ((slippageValueMinForSwap >= fraction(scale8, invariant, invariantNew))) | |
512 | 528 | then true | |
513 | 529 | else (invariant > invariantNew)) | |
514 | 530 | then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
515 | 531 | else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
516 | 532 | then true | |
517 | 533 | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
518 | 534 | then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect") | |
519 | - | else if (if ((dAppThresholdAmount > newBalanceA)) | |
520 | - | then true | |
521 | - | else (dAppThresholdAmount > newBalanceB)) | |
522 | - | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
523 | - | else { | |
524 | - | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
525 | - | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
526 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
527 | - | let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6) | |
528 | - | let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6) | |
529 | - | let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply) | |
530 | - | let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply) | |
531 | - | let $t01990820203 = if ((pmtStrAssetId == strAssetIdA)) | |
532 | - | then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB) | |
533 | - | else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA) | |
534 | - | let stakeAmount = $t01990820203._1 | |
535 | - | let unstakeAmount = $t01990820203._2 | |
536 | - | let unstakeAsset = $t01990820203._3 | |
537 | - | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
538 | - | then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil) | |
539 | - | else 0 | |
540 | - | if ((stake1 == stake1)) | |
541 | - | then { | |
542 | - | let stake2 = if (containsElement(stakingAssets, unstakeAsset)) | |
543 | - | then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil) | |
544 | - | else 0 | |
545 | - | if ((stake2 == stake2)) | |
546 | - | then [Reissue(shareAssetId, shareTokenToPayAmountAfterFee, true), ScriptTransfer(i.caller, shareTokenToPayAmountAfterFee, shareAssetId), ScriptTransfer(moneyBoxAddress, governanceRewardTokenA, assetIdA), ScriptTransfer(moneyBoxAddress, governanceRewardTokenB, assetIdB), IntegerEntry(kBalanceA, (newBalanceA - governanceRewardTokenA)), IntegerEntry(kBalanceB, (newBalanceB - governanceRewardTokenB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmountAfterFee)), IntegerEntry(kInvariant, invariantCalc((newBalanceA - governanceRewardTokenA), (newBalanceB - governanceRewardTokenB)))] | |
547 | - | else throw("Strict value is not equal to itself.") | |
548 | - | } | |
549 | - | else throw("Strict value is not equal to itself.") | |
550 | - | } | |
535 | + | else { | |
536 | + | let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA) | |
537 | + | let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB) | |
538 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
539 | + | let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6) | |
540 | + | let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6) | |
541 | + | let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply) | |
542 | + | let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply) | |
543 | + | let $t02039420689 = if ((pmtStrAssetId == strAssetIdA)) | |
544 | + | then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB) | |
545 | + | else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA) | |
546 | + | let stakeAmount = $t02039420689._1 | |
547 | + | let unstakeAmount = $t02039420689._2 | |
548 | + | let unstakeAsset = $t02039420689._3 | |
549 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
550 | + | then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil) | |
551 | + | else 0 | |
552 | + | if ((stake1 == stake1)) | |
553 | + | then { | |
554 | + | let stake2 = if (containsElement(stakingAssets, unstakeAsset)) | |
555 | + | then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil) | |
556 | + | else 0 | |
557 | + | if ((stake2 == stake2)) | |
558 | + | then [Reissue(shareAssetId, shareTokenToPayAmountAfterFee, true), ScriptTransfer(i.caller, shareTokenToPayAmountAfterFee, shareAssetId), ScriptTransfer(moneyBoxAddress, governanceRewardTokenA, assetIdA), ScriptTransfer(moneyBoxAddress, governanceRewardTokenB, assetIdB), IntegerEntry(kBalanceA, (newBalanceA - governanceRewardTokenA)), IntegerEntry(kBalanceB, (newBalanceB - governanceRewardTokenB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmountAfterFee)), IntegerEntry(kInvariant, invariantCalc((newBalanceA - governanceRewardTokenA), (newBalanceB - governanceRewardTokenB)))] | |
559 | + | else throw("Strict value is not equal to itself.") | |
560 | + | } | |
561 | + | else throw("Strict value is not equal to itself.") | |
562 | + | } | |
551 | 563 | } | |
552 | 564 | }) | |
553 | 565 | ||
554 | 566 | ||
555 | 567 | ||
556 | 568 | @Callable(i) | |
557 | 569 | func withdraw () = valueOrElse(isActive(), { | |
558 | - | let $ | |
559 | - | let pmtAmount = $ | |
560 | - | let pmtAssetId = $ | |
570 | + | let $t02197622051 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
571 | + | let pmtAmount = $t02197622051._1 | |
572 | + | let pmtAssetId = $t02197622051._2 | |
561 | 573 | let amountToPayA = fraction(pmtAmount, balanceA, shareAssetSupply) | |
562 | 574 | let amountToPayB = fraction(pmtAmount, balanceB, shareAssetSupply) | |
563 | 575 | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
564 | 576 | if ((size(i.payments) != 1)) | |
565 | 577 | then throwOnePayment() | |
566 | 578 | else if ((pmtAssetId != shareAssetId)) | |
567 | 579 | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
568 | 580 | else if (!(hasEnoughBalance)) | |
569 | 581 | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
570 | 582 | else { | |
571 | 583 | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
572 | 584 | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
573 | 585 | else 0 | |
574 | 586 | if ((stake1 == stake1)) | |
575 | 587 | then { | |
576 | 588 | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
577 | 589 | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
578 | 590 | else 0 | |
579 | 591 | if ((stake2 == stake2)) | |
580 | 592 | then [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
581 | 593 | else throw("Strict value is not equal to itself.") | |
582 | 594 | } | |
583 | 595 | else throw("Strict value is not equal to itself.") | |
584 | 596 | } | |
585 | 597 | }) | |
586 | 598 | ||
587 | 599 | ||
588 | 600 | ||
589 | 601 | @Callable(i) | |
590 | 602 | func exchange (estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), { | |
591 | - | let $ | |
592 | - | let pmtAmount = $ | |
593 | - | let pmtAssetId = $ | |
603 | + | let $t02360223677 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
604 | + | let pmtAmount = $t02360223677._1 | |
605 | + | let pmtAssetId = $t02360223677._2 | |
594 | 606 | if ((0 >= estimatedAmountToReceive)) | |
595 | 607 | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
596 | 608 | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
597 | 609 | then throw("Minimal amount can't be greater than estimated.") | |
598 | 610 | else if ((size(i.payments) != 1)) | |
599 | 611 | then throwOnePayment() | |
600 | 612 | else if (!(hasEnoughBalance)) | |
601 | 613 | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
602 | 614 | else if (if ((pmtAssetId != assetIdA)) | |
603 | 615 | then (pmtAssetId != assetIdB) | |
604 | 616 | else false) | |
605 | 617 | then throwAssets() | |
606 | 618 | else if ((10000000 > pmtAmount)) | |
607 | 619 | then throw("Only swap of 10.000000 or more tokens is allowed") | |
608 | - | else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount))) | |
609 | - | then true | |
610 | - | else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax)) | |
611 | - | then throw("Incorrect args and pmt ratio") | |
612 | - | else { | |
613 | - | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
614 | - | then assetIdB | |
615 | - | else assetIdA | |
616 | - | let amount = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId) | |
617 | - | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
618 | - | let governanceReward = fraction(amount, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
619 | - | let amountMinusFee = fraction(amount, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
620 | - | let $t02464424906 = if ((pmtAssetId == assetIdA)) | |
621 | - | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
622 | - | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
623 | - | let newBalanceA = $t02464424906._1 | |
624 | - | let newBalanceB = $t02464424906._2 | |
625 | - | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
626 | - | if (if ((dAppThresholdAmount > newBalanceA)) | |
627 | - | then true | |
628 | - | else (dAppThresholdAmount > newBalanceB)) | |
629 | - | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
630 | - | else { | |
631 | - | let $t02520525278 = getAssetInfo(pmtAssetId) | |
632 | - | let pmtStrAssetId = $t02520525278._1 | |
633 | - | let pmtAssetName = $t02520525278._2 | |
634 | - | let pmtDecimals = $t02520525278._3 | |
635 | - | let $t02529125368 = getAssetInfo(sendAssetId) | |
636 | - | let sendStrAssetId = $t02529125368._1 | |
637 | - | let sendAssetName = $t02529125368._2 | |
638 | - | let sendDecimals = $t02529125368._3 | |
639 | - | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
640 | - | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
641 | - | else 0 | |
642 | - | if ((stake1 == stake1)) | |
643 | - | then { | |
644 | - | let stake2 = if (containsElement(stakingAssets, sendStrAssetId)) | |
645 | - | then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil) | |
646 | - | else 0 | |
647 | - | if ((stake2 == stake2)) | |
648 | - | then $Tuple2([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(moneyBoxAddress, governanceReward, sendAssetId)], $Tuple2(amountMinusFee, sendAssetId)) | |
649 | - | else throw("Strict value is not equal to itself.") | |
650 | - | } | |
651 | - | else throw("Strict value is not equal to itself.") | |
652 | - | } | |
653 | - | } | |
620 | + | else { | |
621 | + | let $t02436324479 = calcBalanceAndPmtRatio(balanceA, balanceB, minAmountToReceive, pmtAmount, pmtAssetId) | |
622 | + | let balanceRatio = $t02436324479._1 | |
623 | + | let pmtRatio = $t02436324479._2 | |
624 | + | if (((exchangeRatioLimit - fraction(exchangeRatioLimitCoef, balanceRatio, scale8)) > pmtRatio)) | |
625 | + | then throw("Incorrect args and pmt ratio") | |
626 | + | else { | |
627 | + | let sendAssetId = if ((pmtAssetId == assetIdA)) | |
628 | + | then assetIdB | |
629 | + | else assetIdA | |
630 | + | let amount = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId) | |
631 | + | let feeDiscount = calculateFeeDiscount(i.originCaller) | |
632 | + | let governanceReward = fraction(amount, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6) | |
633 | + | let amountMinusFee = fraction(amount, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6) | |
634 | + | let $t02523425512 = if ((pmtAssetId == assetIdA)) | |
635 | + | then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward)) | |
636 | + | else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount)) | |
637 | + | let newBalanceA = $t02523425512._1 | |
638 | + | let newBalanceB = $t02523425512._2 | |
639 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2)) | |
640 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
641 | + | then true | |
642 | + | else (dAppThresholdAmount > newBalanceB)) | |
643 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
644 | + | else { | |
645 | + | let $t02583125904 = getAssetInfo(pmtAssetId) | |
646 | + | let pmtStrAssetId = $t02583125904._1 | |
647 | + | let pmtAssetName = $t02583125904._2 | |
648 | + | let pmtDecimals = $t02583125904._3 | |
649 | + | let $t02592125998 = getAssetInfo(sendAssetId) | |
650 | + | let sendStrAssetId = $t02592125998._1 | |
651 | + | let sendAssetName = $t02592125998._2 | |
652 | + | let sendDecimals = $t02592125998._3 | |
653 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetId)) | |
654 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil) | |
655 | + | else 0 | |
656 | + | if ((stake1 == stake1)) | |
657 | + | then { | |
658 | + | let stake2 = if (containsElement(stakingAssets, sendStrAssetId)) | |
659 | + | then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil) | |
660 | + | else 0 | |
661 | + | if ((stake2 == stake2)) | |
662 | + | then $Tuple2([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(moneyBoxAddress, governanceReward, sendAssetId)], $Tuple2(amountMinusFee, sendAssetId)) | |
663 | + | else throw("Strict value is not equal to itself.") | |
664 | + | } | |
665 | + | else throw("Strict value is not equal to itself.") | |
666 | + | } | |
667 | + | } | |
668 | + | } | |
654 | 669 | }) | |
655 | 670 | ||
656 | 671 | ||
657 | 672 | ||
658 | 673 | @Callable(i) | |
659 | 674 | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
660 | 675 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
661 | 676 | else suspend("Paused by admin")) | |
662 | 677 | ||
663 | 678 | ||
664 | 679 | ||
665 | 680 | @Callable(i) | |
666 | 681 | func activate () = valueOrElse(isAdminCall(i), if (active) | |
667 | 682 | then throwIsActive() | |
668 | 683 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
669 | 684 | ||
670 | 685 | ||
671 | 686 | ||
672 | 687 | @Callable(i) | |
673 | 688 | func takeIntoAccountExtraFunds () = valueOrElse(isActive(), { | |
674 | 689 | let amountEnrollA = (accountBalanceWithStakedA - balanceA) | |
675 | 690 | let amountEnrollB = (accountBalanceWithStakedB - balanceB) | |
676 | 691 | let invariantNew = invariantCalc((balanceA + amountEnrollA), (balanceB + amountEnrollB)) | |
677 | 692 | if ((i.caller != moneyBoxAddress)) | |
678 | 693 | then throw("Only the money box can call this function") | |
679 | 694 | else if (if ((0 > amountEnrollA)) | |
680 | 695 | then true | |
681 | 696 | else (0 > amountEnrollB)) | |
682 | 697 | then suspend("Enroll amount negative") | |
683 | 698 | else if (if ((amountEnrollA == 0)) | |
684 | 699 | then (amountEnrollB == 0) | |
685 | 700 | else false) | |
686 | 701 | then throw("No money to take") | |
687 | 702 | else { | |
688 | 703 | let stake1 = if (if (containsElement(stakingAssets, strAssetIdA)) | |
689 | 704 | then (amountEnrollA > 0) | |
690 | 705 | else false) | |
691 | 706 | then invoke(this, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil) | |
692 | 707 | else 0 | |
693 | 708 | if ((stake1 == stake1)) | |
694 | 709 | then { | |
695 | 710 | let stake2 = if (if (containsElement(stakingAssets, strAssetIdB)) | |
696 | 711 | then (amountEnrollB > 0) | |
697 | 712 | else false) | |
698 | 713 | then invoke(this, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil) | |
699 | 714 | else 0 | |
700 | 715 | if ((stake2 == stake2)) | |
701 | 716 | then [IntegerEntry(kInvariant, invariantNew), IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB))] | |
702 | 717 | else throw("Strict value is not equal to itself.") | |
703 | 718 | } | |
704 | 719 | else throw("Strict value is not equal to itself.") | |
705 | 720 | } | |
706 | 721 | }) | |
707 | 722 | ||
708 | 723 | ||
709 | 724 | ||
710 | 725 | @Callable(i) | |
711 | 726 | func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this)) | |
712 | 727 | then throw("Only contract itself can invoke this function") | |
713 | 728 | else { | |
714 | - | let $ | |
715 | - | let call = $ | |
716 | - | let addr = $ | |
717 | - | let params = $ | |
718 | - | let payments = $ | |
729 | + | let $t02904129144 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
730 | + | let call = $t02904129144._1 | |
731 | + | let addr = $t02904129144._2 | |
732 | + | let params = $t02904129144._3 | |
733 | + | let payments = $t02904129144._4 | |
719 | 734 | let inv = invoke(addr, call, params, payments) | |
720 | 735 | if ((inv == inv)) | |
721 | 736 | then nil | |
722 | 737 | else throw("Strict value is not equal to itself.") | |
723 | 738 | } | |
724 | 739 | ||
725 | 740 | ||
726 | 741 | ||
727 | 742 | @Callable(i) | |
728 | 743 | func toBigIntInvariant () = valueOrElse(isAdminCall(i), [IntegerEntry(kInvariant, invariantCalc(balanceA, balanceB))]) | |
729 | 744 | ||
730 | 745 | ||
731 | 746 | @Verifier(tx) | |
732 | 747 | func verify () = { | |
733 | 748 | let multiSignedByAdmins = { | |
734 | 749 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
735 | 750 | then 1 | |
736 | 751 | else 0 | |
737 | 752 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
738 | 753 | then 1 | |
739 | 754 | else 0 | |
740 | 755 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
741 | 756 | then 1 | |
742 | 757 | else 0 | |
743 | 758 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
744 | 759 | } | |
745 | 760 | match tx { | |
746 | 761 | case inv: InvokeScriptTransaction => | |
747 | 762 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
748 | 763 | then (inv.function == "takeIntoAccountExtraFunds") | |
749 | 764 | else false | |
750 | 765 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
751 | 766 | then true | |
752 | 767 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
753 | 768 | then true | |
754 | 769 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
755 | 770 | then true | |
756 | 771 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyInvoke) | |
757 | 772 | if (if (callTakeIntoAccount) | |
758 | 773 | then signedByAdmin | |
759 | 774 | else false) | |
760 | 775 | then true | |
761 | 776 | else multiSignedByAdmins | |
762 | 777 | case _ => | |
763 | 778 | multiSignedByAdmins | |
764 | 779 | } | |
765 | 780 | } | |
766 | 781 |
github/deemru/w8io/026f985 103.56 ms ◑