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