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/CAISAwoBBBIECgIEARIGCgQBAQQBEgMKAQESBgoEAQgBARIECgIBARIDCgEBEgASABIAEgMKAQESBQoDBAEIZgAHdmVyc2lvbgIFMi4wLjAACGtWZXJzaW9uAgd2ZXJzaW9uAAdrQWN0aXZlAgZhY3RpdmUACWtBc3NldElkQQIKQV9hc3NldF9pZAAJa0Fzc2V0SWRCAgpCX2Fzc2V0X2lkAAlrQmFsYW5jZUECD0FfYXNzZXRfYmFsYW5jZQAJa0JhbGFuY2VCAg9CX2Fzc2V0X2JhbGFuY2UADWtTaGFyZUFzc2V0SWQCDnNoYXJlX2Fzc2V0X2lkABFrU2hhcmVBc3NldFN1cHBseQISc2hhcmVfYXNzZXRfc3VwcGx5AARrRmVlAgpjb21taXNzaW9uAAprSW52YXJpYW50AglpbnZhcmlhbnQABmtDYXVzZQIOc2h1dGRvd25fY2F1c2UADGtVU0ROQWRkcmVzcwIYc3R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eXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFDGFkbWluUHViS2V5MQYJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFDGFkbWluUHViS2V5MgYJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFDGFkbWluUHViS2V5MwYJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFEWFkbWluUHViS2V5SW52b2tlAwMFE2NhbGxUYWtlSW50b0FjY291bnQFDXNpZ25lZEJ5QWRtaW4HBgUTbXVsdGlTaWduZWRCeUFkbWlucwUTbXVsdGlTaWduZWRCeUFkbWluc1rlQc4=", "height": 2277620, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9pcBoNpCF3hhNnNfYGwDdUG8coh6GcVfQ57fL1yRaQa6 Next: 229oXUtuv42qXd4r4aqar76mwAUZ1KZ87X2LFXLaAAr9 Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let version = "2.0.0"
3535
3636 let kUserSwopInGov = "_SWOP_amount"
3737
38+let kUserGSwopInGov = "_GSwop_amount"
39+
3840 let kFirstHarvest = "first_harvest"
3941
4042 let kFirstHarvestHeight = "first_harvest_height"
5961
6062 let kGovAddress = "governance_address"
6163
64+let kFarmingAddress = "farming_address"
65+
6266 let kVotingAddress = "voting_address"
6367
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')
6573
6674 func getBase58FromOracle (key) = match getString(oracle, key) {
6775 case string: String =>
8795
8896 let votingAddress = Address(getBase58FromOracle(kVotingAddress))
8997
90-let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS'
98+let farmingAddress = Address(getBase58FromOracle(kFarmingAddress))
9199
92-let stakingAssets = [toBase58String(USDN)]
100+let USDN = getBase58FromOracle(kUSDNAssetId)
101+
102+let stakingAssets = getStringValue(oracle, kStakingAssets)
93103
94104 let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod")
95105
152162 let scale8 = 100000000
153163
154164 let scale16 = 10000000000000000
155-
156-let slippageScale3 = 1000
157165
158166 let digits8 = 8
159167
328336 else throw("Only admin can call this function")
329337
330338
339+func isSelfCall (i) = if ((this == i.caller))
340+ then unit
341+ else throw("Only contract itself can call this function")
342+
343+
331344 func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB))
332345
333346
347360
348361 func calcStakingParams (stake,amount,assetId) = if (stake)
349362 then {
350- let $t01006410130 = calcStakingFuncAndAddres(stake, assetId)
351- let call = $t01006410130._1
352- let stakingAddr = $t01006410130._2
363+ let $t01037610442 = calcStakingFuncAndAddres(stake, assetId)
364+ let call = $t01037610442._1
365+ let stakingAddr = $t01037610442._2
353366 $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)])
354367 }
355368 else {
356- let $t01021610282 = calcStakingFuncAndAddres(stake, assetId)
357- let call = $t01021610282._1
358- let stakingAddr = $t01021610282._2
369+ let $t01052810594 = calcStakingFuncAndAddres(stake, assetId)
370+ let call = $t01052810594._1
371+ let stakingAddr = $t01052810594._2
359372 $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil)
360373 }
361374
362375
363376 func calculateFeeDiscount (userAddr) = {
364377 let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0)
378+ let gSwopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserGSwopInGov)), 0)
365379 let discountValues = split(getStringValue(oracle, kDiscountValues), ",")
366380 let discounts = split(getStringValue(oracle, kDiscounts), ",")
367- if (if ((swopAmount >= parseIntValue(discountValues[0])))
368- then (parseIntValue(discountValues[1]) > swopAmount)
381+ if (if ((gSwopAmount >= parseIntValue(discountValues[0])))
382+ then (parseIntValue(discountValues[1]) > gSwopAmount)
369383 else false)
370384 then (feeScale6 - parseIntValue(discounts[0]))
371- else if (if ((swopAmount >= parseIntValue(discountValues[1])))
372- then (parseIntValue(discountValues[2]) > swopAmount)
385+ else if (if ((gSwopAmount >= parseIntValue(discountValues[1])))
386+ then (parseIntValue(discountValues[2]) > gSwopAmount)
373387 else false)
374388 then (feeScale6 - parseIntValue(discounts[1]))
375- else if (if ((swopAmount >= parseIntValue(discountValues[2])))
376- then (parseIntValue(discountValues[3]) > swopAmount)
389+ else if (if ((gSwopAmount >= parseIntValue(discountValues[2])))
390+ then (parseIntValue(discountValues[3]) > gSwopAmount)
377391 else false)
378392 then (feeScale6 - parseIntValue(discounts[2]))
379- else if (if ((swopAmount >= parseIntValue(discountValues[3])))
380- then (parseIntValue(discountValues[4]) > swopAmount)
393+ else if (if ((gSwopAmount >= parseIntValue(discountValues[3])))
394+ then (parseIntValue(discountValues[4]) > gSwopAmount)
381395 else false)
382396 then (feeScale6 - parseIntValue(discounts[3]))
383- else if ((swopAmount >= parseIntValue(discountValues[4])))
397+ else if ((gSwopAmount >= parseIntValue(discountValues[4])))
384398 then (feeScale6 - parseIntValue(discounts[4]))
385399 else feeScale6
386400 }
388402
389403 @Callable(i)
390404 func init (firstHarvest) = {
391- let $t01147511552 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
392- let pmtAmountA = $t01147511552._1
393- let pmtAssetIdA = $t01147511552._2
394- let $t01155711634 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
395- let pmtAmountB = $t01155711634._1
396- let pmtAssetIdB = $t01155711634._2
397- let $t01163911716 = getAssetInfo(pmtAssetIdA)
398- let pmtStrAssetIdA = $t01163911716._1
399- let pmtAssetNameA = $t01163911716._2
400- let pmtDecimalsA = $t01163911716._3
401- let $t01172111798 = getAssetInfo(pmtAssetIdB)
402- let pmtStrAssetIdB = $t01172111798._1
403- let pmtAssetNameB = $t01172111798._2
404- let pmtDecimalsB = $t01172111798._3
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
405419 if (isDefined(getBoolean(this, kActive)))
406420 then throwIsActive()
407421 else if ((pmtAssetIdA == pmtAssetIdB))
414428 let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true)
415429 let shareIssueId = calculateAssetId(shareIssue)
416430 let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB)
417- let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA))
431+ let stake1 = if (contains(stakingAssets, pmtStrAssetIdA))
418432 then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil)
419433 else 0
420434 if ((stake1 == stake1))
421435 then {
422- let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB))
436+ let stake2 = if (contains(stakingAssets, pmtStrAssetIdB))
423437 then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil)
424438 else 0
425439 if ((stake2 == stake2))
438452
439453
440454 @Callable(i)
441-func replenishWithTwoTokens () = valueOrElse(isActive(), {
455+func replenishWithTwoTokens (stakeFarming,lockType) = valueOrElse(isActive(), {
442456 let pmtAssetIdA = i.payments[0].assetId
443457 let pmtAssetIdB = i.payments[1].assetId
444458 let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA)
445459 let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB)
446- let $t01474614823 = getAssetInfo(pmtAssetIdA)
447- let pmtStrAssetIdA = $t01474614823._1
448- let pmtAssetNameA = $t01474614823._2
449- let pmtDecimalsA = $t01474614823._3
450- let $t01482814945 = getAssetInfo(pmtAssetIdB)
451- let pmtStrAssetIdB = $t01482814945._1
452- let pmtAssetNameB = $t01482814945._2
453- let pmtDecimalsB = $t01482814945._3
454- let $t01495015454 = if ((ratioShareTokensInB > ratioShareTokensInA))
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))
455469 then {
456470 let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING)
457471 $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA)
460474 let pmt = fraction(balanceA, ratioShareTokensInB, scale8, CEILING)
461475 $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB)
462476 }
463- let pmtAmountA = $t01495015454._1
464- let pmtAmountB = $t01495015454._2
465- let change = $t01495015454._3
466- let changeAssetId = $t01495015454._4
467- let shareTokenRatio = $t01495015454._5
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
468482 let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8)
469483 if ((size(i.payments) != 2))
470484 then throw("Two attached assets expected")
479493 else if (!(hasEnoughBalance))
480494 then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious())
481495 else {
482- let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA))
496+ let stake1 = if (contains(stakingAssets, pmtStrAssetIdA))
483497 then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil)
484498 else 0
485499 if ((stake1 == stake1))
486500 then {
487- let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB))
501+ let stake2 = if (contains(stakingAssets, pmtStrAssetIdB))
488502 then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil)
489503 else 0
490504 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+ }
492521 else throw("Strict value is not equal to itself.")
493522 }
494523 else throw("Strict value is not equal to itself.")
498527
499528
500529 @Callable(i)
501-func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = valueOrElse(isActive(), {
502- let $t01718717262 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
503- let pmtAmount = $t01718717262._1
504- let pmtAssetId = $t01718717262._2
505- let $t01726717340 = getAssetInfo(pmtAssetId)
506- let pmtStrAssetId = $t01726717340._1
507- let pmtAssetName = $t01726717340._2
508- let pmtDecimals = $t01726717340._3
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
509538 let pmtMinThreshold = 5000000
510539 let thresholdValueForMinTolerance = 50000000
511540 let tolerance = if ((thresholdValueForMinTolerance > pmtAmount))
525554 else false)
526555 then throwAssets()
527556 else {
528- let $t01831818960 = if ((pmtAssetId == assetIdA))
557+ let $t01916819810 = if ((pmtAssetId == assetIdA))
529558 then $Tuple6((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), (balanceA + pmtAmount), balanceB)
530559 else $Tuple6(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), balanceA, (balanceB + pmtAmount))
531- let virtualReplenishA = $t01831818960._1
532- let virtualReplenishB = $t01831818960._2
533- let balanceAfterSwapA = $t01831818960._3
534- let balanceAfterSwapB = $t01831818960._4
535- let newBalanceA = $t01831818960._5
536- let newBalanceB = $t01831818960._6
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
537566 let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB)
538567 let ratioVirtualBalanceToVirtualReplenish = (fraction(scale16, balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB))
539568 let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2))
557586 let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6)
558587 let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply)
559588 let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply)
560- let $t02094721242 = if ((pmtStrAssetId == strAssetIdA))
589+ let $t02179722092 = if ((pmtStrAssetId == strAssetIdA))
561590 then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB)
562591 else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA)
563- let stakeAmount = $t02094721242._1
564- let unstakeAmount = $t02094721242._2
565- let unstakeAsset = $t02094721242._3
566- let stake1 = if (containsElement(stakingAssets, pmtStrAssetId))
592+ let stakeAmount = $t02179722092._1
593+ let unstakeAmount = $t02179722092._2
594+ let unstakeAsset = $t02179722092._3
595+ let stake1 = if (contains(stakingAssets, pmtStrAssetId))
567596 then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil)
568597 else 0
569598 if ((stake1 == stake1))
570599 then {
571- let stake2 = if (containsElement(stakingAssets, unstakeAsset))
600+ let stake2 = if (contains(stakingAssets, unstakeAsset))
572601 then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil)
573602 else 0
574603 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+ }
576620 else throw("Strict value is not equal to itself.")
577621 }
578622 else throw("Strict value is not equal to itself.")
583627
584628
585629 @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))
596633 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))
601651 then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil)
602652 else 0
603653 if ((stake1 == stake1))
604654 then {
605- let stake2 = if (containsElement(stakingAssets, strAssetIdB))
655+ let stake2 = if (contains(stakingAssets, strAssetIdB))
606656 then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil)
607657 else 0
608658 if ((stake2 == stake2))
609- 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)]
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)]
610660 else throw("Strict value is not equal to itself.")
611661 }
612662 else throw("Strict value is not equal to itself.")
613663 }
664+ else throw("Strict value is not equal to itself.")
665+ }
614666 })
615667
616668
617669
618670 @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)
619721 func exchange (estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), {
620- let $t02415524230 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
621- let pmtAmount = $t02415524230._1
622- let pmtAssetId = $t02415524230._2
722+ let $t02855228627 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
723+ let pmtAmount = $t02855228627._1
724+ let pmtAssetId = $t02855228627._2
623725 if ((0 >= estimatedAmountToReceive))
624726 then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive)))
625727 else if ((minAmountToReceive > estimatedAmountToReceive))
646748 let feeDiscount = calculateFeeDiscount(i.originCaller)
647749 let governanceReward = fraction(amount, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6)
648750 let amountMinusFee = fraction(amount, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6)
649- let $t02568325945 = if ((pmtAssetId == assetIdA))
751+ let $t03008030342 = if ((pmtAssetId == assetIdA))
650752 then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward))
651753 else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount))
652- let newBalanceA = $t02568325945._1
653- let newBalanceB = $t02568325945._2
754+ let newBalanceA = $t03008030342._1
755+ let newBalanceB = $t03008030342._2
654756 let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2))
655757 if (if ((dAppThresholdAmount > newBalanceA))
656758 then true
657759 else (dAppThresholdAmount > newBalanceB))
658760 then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
659761 else {
660- let $t02624426317 = getAssetInfo(pmtAssetId)
661- let pmtStrAssetId = $t02624426317._1
662- let pmtAssetName = $t02624426317._2
663- let pmtDecimals = $t02624426317._3
664- let $t02633026407 = getAssetInfo(sendAssetId)
665- let sendStrAssetId = $t02633026407._1
666- let sendAssetName = $t02633026407._2
667- let sendDecimals = $t02633026407._3
668- let stake1 = if (containsElement(stakingAssets, pmtStrAssetId))
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))
669771 then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil)
670772 else 0
671773 if ((stake1 == stake1))
672774 then {
673- let stake2 = if (containsElement(stakingAssets, sendStrAssetId))
775+ let stake2 = if (contains(stakingAssets, sendStrAssetId))
674776 then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil)
675777 else 0
676778 if ((stake2 == stake2))
681783 }
682784 }
683785 })
786+
787+
788+
789+@Callable(msg)
790+func reissueShare (amount) = valueOrElse(isSelfCall(msg), [Reissue(shareAssetId, amount, true)])
684791
685792
686793
714821 else false)
715822 then throw("No money to take")
716823 else {
717- let stake1 = if (if (containsElement(stakingAssets, strAssetIdA))
824+ let stake1 = if (if (contains(stakingAssets, strAssetIdA))
718825 then (amountEnrollA > 0)
719826 else false)
720827 then invoke(this, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil)
721828 else 0
722829 if ((stake1 == stake1))
723830 then {
724- let stake2 = if (if (containsElement(stakingAssets, strAssetIdB))
831+ let stake2 = if (if (contains(stakingAssets, strAssetIdB))
725832 then (amountEnrollB > 0)
726833 else false)
727834 then invoke(this, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil)
745852 func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this))
746853 then throw("Only contract itself can invoke this function")
747854 else {
748- let $t02961429717 = calcStakingParams(stake, amount, fromBase58String(assetIdString))
749- let call = $t02961429717._1
750- let addr = $t02961429717._2
751- let params = $t02961429717._3
752- let payments = $t02961429717._4
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
753860 let inv = invoke(addr, call, params, payments)
754861 if ((inv == inv))
755862 then nil
Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let version = "2.0.0"
55
66 let kVersion = "version"
77
88 let kActive = "active"
99
1010 let kAssetIdA = "A_asset_id"
1111
1212 let kAssetIdB = "B_asset_id"
1313
1414 let kBalanceA = "A_asset_balance"
1515
1616 let kBalanceB = "B_asset_balance"
1717
1818 let kShareAssetId = "share_asset_id"
1919
2020 let kShareAssetSupply = "share_asset_supply"
2121
2222 let kFee = "commission"
2323
2424 let kInvariant = "invariant"
2525
2626 let kCause = "shutdown_cause"
2727
2828 let kUSDNAddress = "staking_usdnnsbt_address"
2929
3030 let kEURNAddress = "staking_eurn_address"
3131
3232 let kDiscounts = "discounts"
3333
3434 let kDiscountValues = "discount_values"
3535
3636 let kUserSwopInGov = "_SWOP_amount"
3737
38+let kUserGSwopInGov = "_GSwop_amount"
39+
3840 let kFirstHarvest = "first_harvest"
3941
4042 let kFirstHarvestHeight = "first_harvest_height"
4143
4244 let kShareLimit = "share_limit_on_first_harvest"
4345
4446 let kBasePeriod = "base_period"
4547
4648 let kPeriodLength = "period_length"
4749
4850 let kStartHeight = "start_height"
4951
5052 let kAdminPubKey1 = "admin_pub_1"
5153
5254 let kAdminPubKey2 = "admin_pub_2"
5355
5456 let kAdminPubKey3 = "admin_pub_3"
5557
5658 let kAdminInvokePubKey = "admin_invoke_pub"
5759
5860 let kMoneyBoxAddress = "money_box_address"
5961
6062 let kGovAddress = "governance_address"
6163
64+let kFarmingAddress = "farming_address"
65+
6266 let kVotingAddress = "voting_address"
6367
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')
6573
6674 func getBase58FromOracle (key) = match getString(oracle, key) {
6775 case string: String =>
6876 fromBase58String(string)
6977 case nothing =>
7078 throw((key + "is empty"))
7179 }
7280
7381
7482 let adminPubKey1 = getBase58FromOracle(kAdminPubKey1)
7583
7684 let adminPubKey2 = getBase58FromOracle(kAdminPubKey2)
7785
7886 let adminPubKey3 = getBase58FromOracle(kAdminPubKey3)
7987
8088 let adminPubKeyInvoke = getBase58FromOracle(kAdminInvokePubKey)
8189
8290 let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress))
8391
8492 let govAddress = Address(getBase58FromOracle(kGovAddress))
8593
8694 let stakingUSDNAddress = Address(getBase58FromOracle(kUSDNAddress))
8795
8896 let votingAddress = Address(getBase58FromOracle(kVotingAddress))
8997
90-let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS'
98+let farmingAddress = Address(getBase58FromOracle(kFarmingAddress))
9199
92-let stakingAssets = [toBase58String(USDN)]
100+let USDN = getBase58FromOracle(kUSDNAssetId)
101+
102+let stakingAssets = getStringValue(oracle, kStakingAssets)
93103
94104 let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod")
95105
96106 let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight")
97107
98108 let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength")
99109
100110 let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 3)
101111
102112 let active = getBooleanValue(this, kActive)
103113
104114 let strAssetIdA = getStringValue(this, kAssetIdA)
105115
106116 let strAssetIdB = getStringValue(this, kAssetIdB)
107117
108118 let assetIdA = if ((strAssetIdA == "WAVES"))
109119 then unit
110120 else fromBase58String(strAssetIdA)
111121
112122 let assetIdB = if ((strAssetIdB == "WAVES"))
113123 then unit
114124 else fromBase58String(strAssetIdB)
115125
116126 let assetNameA = match assetIdA {
117127 case id: ByteVector =>
118128 value(assetInfo(id)).name
119129 case waves: Unit =>
120130 "WAVES"
121131 case _ =>
122132 throw("Match error")
123133 }
124134
125135 let assetNameB = match assetIdB {
126136 case id: ByteVector =>
127137 value(assetInfo(id)).name
128138 case waves: Unit =>
129139 "WAVES"
130140 case _ =>
131141 throw("Match error")
132142 }
133143
134144 let balanceA = getIntegerValue(this, kBalanceA)
135145
136146 let balanceB = getIntegerValue(this, kBalanceB)
137147
138148 let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId))
139149
140150 let shareAssetSupply = getIntegerValue(this, kShareAssetSupply)
141151
142152 let invariant = getIntegerValue(this, kInvariant)
143153
144154 let fee = getIntegerValue(this, kFee)
145155
146156 let feeGovernance = fraction(fee, 40, 100)
147157
148158 let feeScale6 = 1000000
149159
150160 let scale3 = 1000
151161
152162 let scale8 = 100000000
153163
154164 let scale16 = 10000000000000000
155-
156-let slippageScale3 = 1000
157165
158166 let digits8 = 8
159167
160168 let dAppThreshold = 50
161169
162170 let dAppThresholdScale2 = 100
163171
164172 let exchangeRatioLimitMin = 90000000
165173
166174 let exchangeRatioLimitMax = 110000000
167175
168176 let alpha = 50
169177
170178 let alphaDigits = 2
171179
172180 let beta = 4600000000000000
173181
174182 func accountBalance (assetId) = match assetId {
175183 case id: ByteVector =>
176184 assetBalance(this, id)
177185 case waves: Unit =>
178186 wavesBalance(this).available
179187 case _ =>
180188 throw("Match error")
181189 }
182190
183191
184192 func stakedAmount (assetId) = {
185193 let stakedAmountCalculated = match assetId {
186194 case aId: ByteVector =>
187195 if ((aId == USDN))
188196 then getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this)))
189197 else 0
190198 case _: Unit =>
191199 0
192200 case _ =>
193201 throw("Match error")
194202 }
195203 match stakedAmountCalculated {
196204 case i: Int =>
197205 i
198206 case _ =>
199207 0
200208 }
201209 }
202210
203211
204212 let stakedAmountA = stakedAmount(assetIdA)
205213
206214 let stakedAmountB = stakedAmount(assetIdB)
207215
208216 let availableBalanceA = (balanceA - stakedAmountA)
209217
210218 let availableBalanceB = (balanceB - stakedAmountB)
211219
212220 let accountBalanceWithStakedA = (accountBalance(assetIdA) + stakedAmountA)
213221
214222 let accountBalanceWithStakedB = (accountBalance(assetIdB) + stakedAmountB)
215223
216224 let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA))
217225 then (accountBalanceWithStakedB >= balanceB)
218226 else false
219227
220228 func skewness (x,y) = ((fraction(scale16, x, y) + fraction(scale16, y, x)) / 2)
221229
222230
223231 func invariantCalc (x,y) = {
224232 let sk = skewness(x, y)
225233 (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)))
226234 }
227235
228236
229237 func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId) = {
230238 let worstAllowedNewInvariantRatio = (scale16 - ((scale16 * 1) / 10000000))
231239 let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount)
232240 let x = (balanceA + tokenReceiveAmount)
233241 let y = (balanceB + tokenReceiveAmount)
234242 func getStepAmount (acc,step) = if ((acc._1 == -1))
235243 then {
236244 let amountToSend = (amountToSendEstimated - (((step * deltaBetweenMaxAndMinSendValue) / 3) / scale3))
237245 let stepInvariant = if ((tokenId == assetIdA))
238246 then invariantCalc(x, (balanceB - amountToSend))
239247 else invariantCalc((balanceA - amountToSend), y)
240248 if ((stepInvariant > invariant))
241249 then $Tuple2(amountToSend, stepInvariant)
242250 else $Tuple2(-1, 0)
243251 }
244252 else acc
245253
246254 let amountToSendMin = getStepAmount($Tuple2(-1, 0), 3000)
247255 if ((0 > amountToSendMin._1))
248256 then throw("Price is worse than minReceived")
249257 else {
250258 let invEstimated = if ((tokenId == assetIdA))
251259 then invariantCalc(x, (balanceB - amountToSendEstimated))
252260 else if ((tokenId == assetIdB))
253261 then invariantCalc((balanceA - amountToSendEstimated), y)
254262 else throw("Wrong asset in payment")
255263 if ((invariant > invEstimated))
256264 then if ((worstAllowedNewInvariantRatio >= fraction(scale16, invariant, invEstimated)))
257265 then throw("The requested price is too not profitable for user")
258266 else {
259267 let a = {
260268 let $l = [25, 200, 500]
261269 let $s = size($l)
262270 let $acc0 = $Tuple2(-1, 0)
263271 func $f0_1 ($a,$i) = if (($i >= $s))
264272 then $a
265273 else getStepAmount($a, $l[$i])
266274
267275 func $f0_2 ($a,$i) = if (($i >= $s))
268276 then $a
269277 else throw("List size exceeds 3")
270278
271279 $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
272280 }
273281 if ((0 > a._1))
274282 then amountToSendMin._1
275283 else a._1
276284 }
277285 else {
278286 let a = {
279287 let $l = [-500, -200, -25]
280288 let $s = size($l)
281289 let $acc0 = $Tuple2(-1, 0)
282290 func $f0_1 ($a,$i) = if (($i >= $s))
283291 then $a
284292 else getStepAmount($a, $l[$i])
285293
286294 func $f0_2 ($a,$i) = if (($i >= $s))
287295 then $a
288296 else throw("List size exceeds 3")
289297
290298 $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
291299 }
292300 let tupleSendBetter = if ((0 > a._1))
293301 then $Tuple2(amountToSendEstimated, invEstimated)
294302 else a
295303 if ((worstAllowedNewInvariantRatio >= fraction(scale16, invariant, tupleSendBetter._2)))
296304 then throw("The requested price is too not profitable for user")
297305 else tupleSendBetter._1
298306 }
299307 }
300308 }
301309
302310
303311 func getAssetInfo (assetId) = match assetId {
304312 case id: ByteVector =>
305313 let stringId = toBase58String(id)
306314 let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist"))
307315 $Tuple3(stringId, info.name, info.decimals)
308316 case waves: Unit =>
309317 $Tuple3("WAVES", "WAVES", 8)
310318 case _ =>
311319 throw("Match error")
312320 }
313321
314322
315323 func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
316324
317325
318326 func throwIsActive () = throw("DApp is already active")
319327
320328
321329 func isActive () = if (active)
322330 then unit
323331 else throw("DApp is inactive at this moment")
324332
325333
326334 func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))
327335 then unit
328336 else throw("Only admin can call this function")
329337
330338
339+func isSelfCall (i) = if ((this == i.caller))
340+ then unit
341+ else throw("Only contract itself can call this function")
342+
343+
331344 func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB))
332345
333346
334347 func throwOnePayment () = throw("One attached payment expected")
335348
336349
337350 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))
338351
339352
340353 func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB))
341354
342355
343356 func calcStakingFuncAndAddres (stake,assetId) = if (stake)
344357 then $Tuple2("lockNeutrino", stakingUSDNAddress)
345358 else $Tuple2("unlockNeutrino", stakingUSDNAddress)
346359
347360
348361 func calcStakingParams (stake,amount,assetId) = if (stake)
349362 then {
350- let $t01006410130 = calcStakingFuncAndAddres(stake, assetId)
351- let call = $t01006410130._1
352- let stakingAddr = $t01006410130._2
363+ let $t01037610442 = calcStakingFuncAndAddres(stake, assetId)
364+ let call = $t01037610442._1
365+ let stakingAddr = $t01037610442._2
353366 $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)])
354367 }
355368 else {
356- let $t01021610282 = calcStakingFuncAndAddres(stake, assetId)
357- let call = $t01021610282._1
358- let stakingAddr = $t01021610282._2
369+ let $t01052810594 = calcStakingFuncAndAddres(stake, assetId)
370+ let call = $t01052810594._1
371+ let stakingAddr = $t01052810594._2
359372 $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil)
360373 }
361374
362375
363376 func calculateFeeDiscount (userAddr) = {
364377 let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0)
378+ let gSwopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserGSwopInGov)), 0)
365379 let discountValues = split(getStringValue(oracle, kDiscountValues), ",")
366380 let discounts = split(getStringValue(oracle, kDiscounts), ",")
367- if (if ((swopAmount >= parseIntValue(discountValues[0])))
368- then (parseIntValue(discountValues[1]) > swopAmount)
381+ if (if ((gSwopAmount >= parseIntValue(discountValues[0])))
382+ then (parseIntValue(discountValues[1]) > gSwopAmount)
369383 else false)
370384 then (feeScale6 - parseIntValue(discounts[0]))
371- else if (if ((swopAmount >= parseIntValue(discountValues[1])))
372- then (parseIntValue(discountValues[2]) > swopAmount)
385+ else if (if ((gSwopAmount >= parseIntValue(discountValues[1])))
386+ then (parseIntValue(discountValues[2]) > gSwopAmount)
373387 else false)
374388 then (feeScale6 - parseIntValue(discounts[1]))
375- else if (if ((swopAmount >= parseIntValue(discountValues[2])))
376- then (parseIntValue(discountValues[3]) > swopAmount)
389+ else if (if ((gSwopAmount >= parseIntValue(discountValues[2])))
390+ then (parseIntValue(discountValues[3]) > gSwopAmount)
377391 else false)
378392 then (feeScale6 - parseIntValue(discounts[2]))
379- else if (if ((swopAmount >= parseIntValue(discountValues[3])))
380- then (parseIntValue(discountValues[4]) > swopAmount)
393+ else if (if ((gSwopAmount >= parseIntValue(discountValues[3])))
394+ then (parseIntValue(discountValues[4]) > gSwopAmount)
381395 else false)
382396 then (feeScale6 - parseIntValue(discounts[3]))
383- else if ((swopAmount >= parseIntValue(discountValues[4])))
397+ else if ((gSwopAmount >= parseIntValue(discountValues[4])))
384398 then (feeScale6 - parseIntValue(discounts[4]))
385399 else feeScale6
386400 }
387401
388402
389403 @Callable(i)
390404 func init (firstHarvest) = {
391- let $t01147511552 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
392- let pmtAmountA = $t01147511552._1
393- let pmtAssetIdA = $t01147511552._2
394- let $t01155711634 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
395- let pmtAmountB = $t01155711634._1
396- let pmtAssetIdB = $t01155711634._2
397- let $t01163911716 = getAssetInfo(pmtAssetIdA)
398- let pmtStrAssetIdA = $t01163911716._1
399- let pmtAssetNameA = $t01163911716._2
400- let pmtDecimalsA = $t01163911716._3
401- let $t01172111798 = getAssetInfo(pmtAssetIdB)
402- let pmtStrAssetIdB = $t01172111798._1
403- let pmtAssetNameB = $t01172111798._2
404- let pmtDecimalsB = $t01172111798._3
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
405419 if (isDefined(getBoolean(this, kActive)))
406420 then throwIsActive()
407421 else if ((pmtAssetIdA == pmtAssetIdB))
408422 then throw("Assets must be different")
409423 else {
410424 let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7))
411425 let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this))
412426 let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2)
413427 let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN))
414428 let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true)
415429 let shareIssueId = calculateAssetId(shareIssue)
416430 let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB)
417- let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA))
431+ let stake1 = if (contains(stakingAssets, pmtStrAssetIdA))
418432 then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil)
419433 else 0
420434 if ((stake1 == stake1))
421435 then {
422- let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB))
436+ let stake2 = if (contains(stakingAssets, pmtStrAssetIdB))
423437 then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil)
424438 else 0
425439 if ((stake2 == stake2))
426440 then {
427441 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)]
428442 if (firstHarvest)
429443 then (baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))])
430444 else baseEntry
431445 }
432446 else throw("Strict value is not equal to itself.")
433447 }
434448 else throw("Strict value is not equal to itself.")
435449 }
436450 }
437451
438452
439453
440454 @Callable(i)
441-func replenishWithTwoTokens () = valueOrElse(isActive(), {
455+func replenishWithTwoTokens (stakeFarming,lockType) = valueOrElse(isActive(), {
442456 let pmtAssetIdA = i.payments[0].assetId
443457 let pmtAssetIdB = i.payments[1].assetId
444458 let ratioShareTokensInA = fraction(scale8, i.payments[0].amount, balanceA)
445459 let ratioShareTokensInB = fraction(scale8, i.payments[1].amount, balanceB)
446- let $t01474614823 = getAssetInfo(pmtAssetIdA)
447- let pmtStrAssetIdA = $t01474614823._1
448- let pmtAssetNameA = $t01474614823._2
449- let pmtDecimalsA = $t01474614823._3
450- let $t01482814945 = getAssetInfo(pmtAssetIdB)
451- let pmtStrAssetIdB = $t01482814945._1
452- let pmtAssetNameB = $t01482814945._2
453- let pmtDecimalsB = $t01482814945._3
454- let $t01495015454 = if ((ratioShareTokensInB > ratioShareTokensInA))
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))
455469 then {
456470 let pmt = fraction(balanceB, ratioShareTokensInA, scale8, CEILING)
457471 $Tuple5(i.payments[0].amount, pmt, (i.payments[1].amount - pmt), pmtAssetIdB, ratioShareTokensInA)
458472 }
459473 else {
460474 let pmt = fraction(balanceA, ratioShareTokensInB, scale8, CEILING)
461475 $Tuple5(pmt, i.payments[1].amount, (i.payments[0].amount - pmt), pmtAssetIdA, ratioShareTokensInB)
462476 }
463- let pmtAmountA = $t01495015454._1
464- let pmtAmountB = $t01495015454._2
465- let change = $t01495015454._3
466- let changeAssetId = $t01495015454._4
467- let shareTokenRatio = $t01495015454._5
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
468482 let shareTokenToPayAmount = fraction(shareTokenRatio, shareAssetSupply, scale8)
469483 if ((size(i.payments) != 2))
470484 then throw("Two attached assets expected")
471485 else if (if ((pmtAssetIdA != assetIdA))
472486 then true
473487 else (pmtAssetIdB != assetIdB))
474488 then throwAssets()
475489 else if ((shareTokenToPayAmount == 0))
476490 then throw("Too small amount to replenish")
477491 else if ((0 > change))
478492 then throw("Change < 0")
479493 else if (!(hasEnoughBalance))
480494 then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious())
481495 else {
482- let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA))
496+ let stake1 = if (contains(stakingAssets, pmtStrAssetIdA))
483497 then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil)
484498 else 0
485499 if ((stake1 == stake1))
486500 then {
487- let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB))
501+ let stake2 = if (contains(stakingAssets, pmtStrAssetIdB))
488502 then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil)
489503 else 0
490504 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+ }
492521 else throw("Strict value is not equal to itself.")
493522 }
494523 else throw("Strict value is not equal to itself.")
495524 }
496525 })
497526
498527
499528
500529 @Callable(i)
501-func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = valueOrElse(isActive(), {
502- let $t01718717262 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
503- let pmtAmount = $t01718717262._1
504- let pmtAssetId = $t01718717262._2
505- let $t01726717340 = getAssetInfo(pmtAssetId)
506- let pmtStrAssetId = $t01726717340._1
507- let pmtAssetName = $t01726717340._2
508- let pmtDecimals = $t01726717340._3
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
509538 let pmtMinThreshold = 5000000
510539 let thresholdValueForMinTolerance = 50000000
511540 let tolerance = if ((thresholdValueForMinTolerance > pmtAmount))
512541 then 100000
513542 else 1
514543 let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000))
515544 let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000))
516545 let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000))
517546 if ((pmtMinThreshold > pmtAmount))
518547 then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens"))
519548 else if ((size(i.payments) != 1))
520549 then throwOnePayment()
521550 else if (!(hasEnoughBalance))
522551 then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious())
523552 else if (if ((pmtAssetId != assetIdA))
524553 then (pmtAssetId != assetIdB)
525554 else false)
526555 then throwAssets()
527556 else {
528- let $t01831818960 = if ((pmtAssetId == assetIdA))
557+ let $t01916819810 = if ((pmtAssetId == assetIdA))
529558 then $Tuple6((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), (balanceA + pmtAmount), balanceB)
530559 else $Tuple6(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), balanceA, (balanceB + pmtAmount))
531- let virtualReplenishA = $t01831818960._1
532- let virtualReplenishB = $t01831818960._2
533- let balanceAfterSwapA = $t01831818960._3
534- let balanceAfterSwapB = $t01831818960._4
535- let newBalanceA = $t01831818960._5
536- let newBalanceB = $t01831818960._6
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
537566 let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB)
538567 let ratioVirtualBalanceToVirtualReplenish = (fraction(scale16, balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB))
539568 let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2))
540569 if (if ((slippageValueMinForSwap >= fraction(scale8, invariant, invariantNew)))
541570 then true
542571 else (invariant > invariantNew))
543572 then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
544573 else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
545574 then true
546575 else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
547576 then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect")
548577 else if (if ((dAppThresholdAmount > newBalanceA))
549578 then true
550579 else (dAppThresholdAmount > newBalanceB))
551580 then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
552581 else {
553582 let ratioShareTokensInA = fraction(virtualReplenishA, scale8, balanceAfterSwapA)
554583 let ratioShareTokensInB = fraction(virtualReplenishB, scale8, balanceAfterSwapB)
555584 let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8)
556585 let shareTokenToPayAmountAfterFee = fraction(shareTokenToPayAmount, (feeScale6 - (fee / 2)), feeScale6)
557586 let shareTokenGovernanceReward = fraction(shareTokenToPayAmount, (feeGovernance / 2), feeScale6)
558587 let governanceRewardTokenA = fraction(shareTokenGovernanceReward, balanceA, shareAssetSupply)
559588 let governanceRewardTokenB = fraction(shareTokenGovernanceReward, balanceB, shareAssetSupply)
560- let $t02094721242 = if ((pmtStrAssetId == strAssetIdA))
589+ let $t02179722092 = if ((pmtStrAssetId == strAssetIdA))
561590 then $Tuple3((pmtAmount - governanceRewardTokenA), governanceRewardTokenB, strAssetIdB)
562591 else $Tuple3((pmtAmount - governanceRewardTokenB), governanceRewardTokenA, strAssetIdA)
563- let stakeAmount = $t02094721242._1
564- let unstakeAmount = $t02094721242._2
565- let unstakeAsset = $t02094721242._3
566- let stake1 = if (containsElement(stakingAssets, pmtStrAssetId))
592+ let stakeAmount = $t02179722092._1
593+ let unstakeAmount = $t02179722092._2
594+ let unstakeAsset = $t02179722092._3
595+ let stake1 = if (contains(stakingAssets, pmtStrAssetId))
567596 then invoke(this, "stakeUnstake", [true, stakeAmount, pmtStrAssetId], nil)
568597 else 0
569598 if ((stake1 == stake1))
570599 then {
571- let stake2 = if (containsElement(stakingAssets, unstakeAsset))
600+ let stake2 = if (contains(stakingAssets, unstakeAsset))
572601 then invoke(this, "stakeUnstake", [false, unstakeAmount, unstakeAsset], nil)
573602 else 0
574603 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+ }
576620 else throw("Strict value is not equal to itself.")
577621 }
578622 else throw("Strict value is not equal to itself.")
579623 }
580624 }
581625 })
582626
583627
584628
585629 @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))
596633 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))
601651 then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil)
602652 else 0
603653 if ((stake1 == stake1))
604654 then {
605- let stake2 = if (containsElement(stakingAssets, strAssetIdB))
655+ let stake2 = if (contains(stakingAssets, strAssetIdB))
606656 then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil)
607657 else 0
608658 if ((stake2 == stake2))
609- 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)]
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)]
610660 else throw("Strict value is not equal to itself.")
611661 }
612662 else throw("Strict value is not equal to itself.")
613663 }
664+ else throw("Strict value is not equal to itself.")
665+ }
614666 })
615667
616668
617669
618670 @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)
619721 func exchange (estimatedAmountToReceive,minAmountToReceive) = valueOrElse(isActive(), {
620- let $t02415524230 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
621- let pmtAmount = $t02415524230._1
622- let pmtAssetId = $t02415524230._2
722+ let $t02855228627 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
723+ let pmtAmount = $t02855228627._1
724+ let pmtAssetId = $t02855228627._2
623725 if ((0 >= estimatedAmountToReceive))
624726 then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive)))
625727 else if ((minAmountToReceive > estimatedAmountToReceive))
626728 then throw("Minimal amount can't be greater than estimated.")
627729 else if ((size(i.payments) != 1))
628730 then throwOnePayment()
629731 else if (!(hasEnoughBalance))
630732 then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious())
631733 else if (if ((pmtAssetId != assetIdA))
632734 then (pmtAssetId != assetIdB)
633735 else false)
634736 then throwAssets()
635737 else if ((10000000 > pmtAmount))
636738 then throw("Only swap of 10.000000 or more tokens is allowed")
637739 else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount)))
638740 then true
639741 else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax))
640742 then throw("Incorrect args and pmt ratio")
641743 else {
642744 let sendAssetId = if ((pmtAssetId == assetIdA))
643745 then assetIdB
644746 else assetIdA
645747 let amount = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId)
646748 let feeDiscount = calculateFeeDiscount(i.originCaller)
647749 let governanceReward = fraction(amount, fraction(feeGovernance, feeDiscount, feeScale6, CEILING), feeScale6)
648750 let amountMinusFee = fraction(amount, (feeScale6 - fraction(fee, feeDiscount, feeScale6, CEILING)), feeScale6)
649- let $t02568325945 = if ((pmtAssetId == assetIdA))
751+ let $t03008030342 = if ((pmtAssetId == assetIdA))
650752 then $Tuple2((balanceA + pmtAmount), ((balanceB - amountMinusFee) - governanceReward))
651753 else $Tuple2(((balanceA - amountMinusFee) - governanceReward), (balanceB + pmtAmount))
652- let newBalanceA = $t02568325945._1
653- let newBalanceB = $t02568325945._2
754+ let newBalanceA = $t03008030342._1
755+ let newBalanceB = $t03008030342._2
654756 let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2))
655757 if (if ((dAppThresholdAmount > newBalanceA))
656758 then true
657759 else (dAppThresholdAmount > newBalanceB))
658760 then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
659761 else {
660- let $t02624426317 = getAssetInfo(pmtAssetId)
661- let pmtStrAssetId = $t02624426317._1
662- let pmtAssetName = $t02624426317._2
663- let pmtDecimals = $t02624426317._3
664- let $t02633026407 = getAssetInfo(sendAssetId)
665- let sendStrAssetId = $t02633026407._1
666- let sendAssetName = $t02633026407._2
667- let sendDecimals = $t02633026407._3
668- let stake1 = if (containsElement(stakingAssets, pmtStrAssetId))
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))
669771 then invoke(this, "stakeUnstake", [true, pmtAmount, pmtStrAssetId], nil)
670772 else 0
671773 if ((stake1 == stake1))
672774 then {
673- let stake2 = if (containsElement(stakingAssets, sendStrAssetId))
775+ let stake2 = if (contains(stakingAssets, sendStrAssetId))
674776 then invoke(this, "stakeUnstake", [false, (amountMinusFee + governanceReward), sendStrAssetId], nil)
675777 else 0
676778 if ((stake2 == stake2))
677779 then $Tuple2([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountMinusFee, sendAssetId), ScriptTransfer(moneyBoxAddress, governanceReward, sendAssetId)], [amountMinusFee, sendAssetId])
678780 else throw("Strict value is not equal to itself.")
679781 }
680782 else throw("Strict value is not equal to itself.")
681783 }
682784 }
683785 })
786+
787+
788+
789+@Callable(msg)
790+func reissueShare (amount) = valueOrElse(isSelfCall(msg), [Reissue(shareAssetId, amount, true)])
684791
685792
686793
687794 @Callable(i)
688795 func shutdown () = valueOrElse(isAdminCall(i), if (!(active))
689796 then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
690797 else suspend("Paused by admin"))
691798
692799
693800
694801 @Callable(i)
695802 func activate () = valueOrElse(isAdminCall(i), if (active)
696803 then throwIsActive()
697804 else [BooleanEntry(kActive, true), DeleteEntry(kCause)])
698805
699806
700807
701808 @Callable(i)
702809 func takeIntoAccountExtraFunds () = valueOrElse(isActive(), {
703810 let amountEnrollA = (accountBalanceWithStakedA - balanceA)
704811 let amountEnrollB = (accountBalanceWithStakedB - balanceB)
705812 let invariantNew = invariantCalc((balanceA + amountEnrollA), (balanceB + amountEnrollB))
706813 if ((i.caller != moneyBoxAddress))
707814 then throw("Only the money box can call this function")
708815 else if (if ((0 > amountEnrollA))
709816 then true
710817 else (0 > amountEnrollB))
711818 then suspend("Enroll amount negative")
712819 else if (if ((amountEnrollA == 0))
713820 then (amountEnrollB == 0)
714821 else false)
715822 then throw("No money to take")
716823 else {
717- let stake1 = if (if (containsElement(stakingAssets, strAssetIdA))
824+ let stake1 = if (if (contains(stakingAssets, strAssetIdA))
718825 then (amountEnrollA > 0)
719826 else false)
720827 then invoke(this, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil)
721828 else 0
722829 if ((stake1 == stake1))
723830 then {
724- let stake2 = if (if (containsElement(stakingAssets, strAssetIdB))
831+ let stake2 = if (if (contains(stakingAssets, strAssetIdB))
725832 then (amountEnrollB > 0)
726833 else false)
727834 then invoke(this, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil)
728835 else 0
729836 if ((stake2 == stake2))
730837 then [IntegerEntry(kInvariant, invariantNew), IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB))]
731838 else throw("Strict value is not equal to itself.")
732839 }
733840 else throw("Strict value is not equal to itself.")
734841 }
735842 })
736843
737844
738845
739846 @Callable(i)
740847 func keepLimitForFirstHarvest (shareLimit) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [IntegerEntry(kShareLimit, shareLimit)]))
741848
742849
743850
744851 @Callable(i)
745852 func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this))
746853 then throw("Only contract itself can invoke this function")
747854 else {
748- let $t02961429717 = calcStakingParams(stake, amount, fromBase58String(assetIdString))
749- let call = $t02961429717._1
750- let addr = $t02961429717._2
751- let params = $t02961429717._3
752- let payments = $t02961429717._4
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
753860 let inv = invoke(addr, call, params, payments)
754861 if ((inv == inv))
755862 then nil
756863 else throw("Strict value is not equal to itself.")
757864 }
758865
759866
760867 @Verifier(tx)
761868 func verify () = {
762869 let multiSignedByAdmins = {
763870 let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1))
764871 then 1
765872 else 0
766873 let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2))
767874 then 1
768875 else 0
769876 let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3))
770877 then 1
771878 else 0
772879 (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2)
773880 }
774881 match tx {
775882 case inv: InvokeScriptTransaction =>
776883 let callTakeIntoAccount = if ((inv.dApp == this))
777884 then (inv.function == "takeIntoAccountExtraFunds")
778885 else false
779886 let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1))
780887 then true
781888 else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2))
782889 then true
783890 else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3))
784891 then true
785892 else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyInvoke)
786893 if (if (callTakeIntoAccount)
787894 then signedByAdmin
788895 else false)
789896 then true
790897 else multiSignedByAdmins
791898 case _ =>
792899 multiSignedByAdmins
793900 }
794901 }
795902

github/deemru/w8io/169f3d6 
151.14 ms