tx · CFhZzZ6MY7TwbdvfGoJJbqUaEGbABsr8SUHyewKHNDK2 3N2M4PztorHwrfENp7D6LhYGgGodjiD1fjn: -0.02400000 Waves 2023.08.21 10:36 [2720103] smart account 3N2M4PztorHwrfENp7D6LhYGgGodjiD1fjn > SELF 0.00000000 Waves
{ "type": 13, "id": "CFhZzZ6MY7TwbdvfGoJJbqUaEGbABsr8SUHyewKHNDK2", "fee": 2400000, "feeAssetId": null, "timestamp": 1692603377240, "version": 2, "chainId": 84, "sender": "3N2M4PztorHwrfENp7D6LhYGgGodjiD1fjn", "senderPublicKey": "Fj9LPkCtmW3pDnVU6wPQnvqpZJCBieWSvZqY5FAGeCyp", "proofs": [ "3i5ymQxPNVkYZMuYguTuKTCPxZcVQwjfuBNrkp4HUgUwWsy93zaFzkEFSgfbWbD18UxygStPuW2t3buE3E8sgDm9", "43JEWYkmTviTm93C64PrimyHpwQq2NH1Pinm4JTcxy2KsXzVfRtDuxBchCYhFRbVha6x2sirQoeNPcNsbjaieF1L" ], "script": "base64:BgIhCAISABIAEgQKAggIEgMKAQgSBwoFCAgIAQESAwoBCBIAUAAGU0NBTEU4AIDC1y8AC0xFTkRFUlNfQVBSCQDMCAIAlgEJAMwIAgB4CQDMCAIAZAkAzAgCAFAJAMwIAgA8CQDMCAIAKAkAzAgCAB4JAMwIAgAUCQDMCAIACgUDbmlsABNMRU5ERVJTX0FQUl9QRVJJT0RTCQDMCAICAzEtMQkAzAgCAgMyLTIJAMwIAgIDMy0zCQDMCAICAzQtNAkAzAgCAgM1LTgJAMwIAgIEOS0xMgkAzAgCAgUxNC0xNgkAzAgCAgUxNy0yMAkAzAgCAgYyMC0xMDQFA25pbAATTEVOREVSU19NQVhfUEVSSU9EUwBoAAZMUF9BUFIJAMwIAgCWAQkAzAgCAHgJAMwIAgBkCQDMCAIAUAkAzAgCADwJAMwIAgAoBQNuaWwADkxQX0FQUl9QRVJJT0RTCQDMCAICAzEtMQkAzAgCAgMyLTIJAMwIAgIDMy0z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JLZXkxU2lnbmVkBRJhZG1pblB1YktleTJTaWduZWQFEmFkbWluUHViS2V5M1NpZ25lZAACBAckbWF0Y2gwBQJ0eAMJAAECBQckbWF0Y2gwAhdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgQDaW52BQckbWF0Y2gwBAZpc1NlbGYJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkECmlzUmlnaHRGZWUDCQAAAggFA2ludgNmZWUAoPc2CQAAAggFA2ludgpmZWVBc3NldElkBQR1bml0BwQKaXNJbml0Q2FsbAkAAAIIBQNpbnYIZnVuY3Rpb24CBGluaXQEDGlzbm9QYXltZW50cwkAAAIJAJADAQgFA2ludghwYXltZW50cwAAAwMDAwUKaXNSaWdodEZlZQUKaXNJbml0Q2FsbAcFBmlzU2VsZgcFDGlzbm9QYXltZW50cwcGBRNtdWx0aVNpZ25lZEJ5QWRtaW5zBRNtdWx0aVNpZ25lZEJ5QWRtaW5zySzL/Q==", "height": 2720103, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EAnLk6E4niaQJBUKYafFQEnM9s7dt8iKFi95DT8G1gJ3 Next: Da28mGrJkJgGZepZN1Addyv83dTwpckaYEPko4NMDQMQ Diff:
Old | New | Differences | |
---|---|---|---|
476 | 476 | @Callable(i) | |
477 | 477 | func updateRewards () = valueOrElse(isOperatorCall(i), { | |
478 | 478 | let lastUpdatePeriod = valueOrElse(getInteger(this, kLastUpdatePeriod), 0) | |
479 | - | let curPeriod = (((height - startHeight) / periodLength) + 1) | |
480 | - | if (if ((lastUpdatePeriod >= curPeriod)) | |
481 | - | then (lastUpdatePeriod != 0) | |
482 | - | else false) | |
483 | - | then throw("rewards alredy updated in this period") | |
484 | - | else { | |
485 | - | let $t01482514905 = getTotalSupplyAllTokens() | |
486 | - | let totalSupply = $t01482514905._1 | |
487 | - | let totalSupplyUsd = $t01482514905._2 | |
488 | - | let totalSupplyUsdAll = $t01482514905._3 | |
489 | - | let axlyPrice = getAssetPrice(axlyId) | |
490 | - | let axlyPrecision = getAssetPrecision(axlyId) | |
491 | - | let maxAPR = getAdoptedAPRByPeriod(curPeriod, LENDERS_APR_PERIODS, LENDERS_APR) | |
492 | - | func updateReward (a,tokenId) = { | |
493 | - | let $t01515415198 = a | |
494 | - | let enteries = $t01515415198._1 | |
495 | - | let totalPeriodReward = $t01515415198._2 | |
496 | - | let index = $t01515415198._3 | |
497 | - | if ((totalSupply[index] == 0)) | |
498 | - | then $Tuple3((enteries ++ [IntegerEntry((tokenId + kPrevLendTokenSupply), totalSupply[index]), IntegerEntry((tokenId + kTokenRewardPerBlock), 0), IntegerEntry((tokenId + kTokenInterest), calcNewTokenInterest(tokenId, totalSupply[index])), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height]))]), totalPeriodReward, (index + 1)) | |
499 | - | else { | |
500 | - | let share = fraction(totalSupplyUsd[index], SCALE8, totalSupplyUsdAll) | |
501 | - | let maxReward = fraction(share, lendMaxPeriodAmount, SCALE8) | |
502 | - | let maxRewardUsd = fraction(maxReward, axlyPrice, axlyPrecision) | |
503 | - | let prevTotalSupply = valueOrElse(getInteger(this, kPrevLendTokenSupply), 0) | |
504 | - | let rtCoef = if (if ((prevTotalSupply == 0)) | |
505 | - | then true | |
506 | - | else (totalSupply[index] == 0)) | |
507 | - | then 0 | |
508 | - | else fraction(prevTotalSupply, SCALE8, totalSupply[index]) | |
509 | - | let reward = ((min([(maxAPR * (SCALE8 + rtCoef)), fraction(maxAPR, (15 * SCALE8), 10)]) / SCALE8) / 100) | |
510 | - | let rewardUsd = min([maxRewardUsd, fraction(totalSupplyUsd[index], reward, SCALE8)]) | |
511 | - | let rewardPeriod = fraction(rewardUsd, axlyPrecision, axlyPrice) | |
512 | - | let rewardPerBlock = (rewardPeriod / periodLength) | |
513 | - | $Tuple3((enteries ++ [IntegerEntry((tokenId + kPrevLendTokenSupply), totalSupply[index]), IntegerEntry((tokenId + kTokenRewardPerBlock), rewardPerBlock), IntegerEntry((tokenId + kTokenInterest), calcNewTokenInterest(tokenId, totalSupply[index])), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height]))]), (totalPeriodReward + rewardPeriod), (index + 1)) | |
479 | + | let calcPeriod = (((height - startHeight) / periodLength) + 1) | |
480 | + | let curPeriod = if ((0 >= calcPeriod)) | |
481 | + | then 1 | |
482 | + | else calcPeriod | |
483 | + | if ((curPeriod > 104)) | |
484 | + | then throw("max period is 104") | |
485 | + | else if (if ((lastUpdatePeriod >= curPeriod)) | |
486 | + | then (lastUpdatePeriod != 0) | |
487 | + | else false) | |
488 | + | then throw("rewards alredy updated in this period") | |
489 | + | else { | |
490 | + | let $t01494415024 = getTotalSupplyAllTokens() | |
491 | + | let totalSupply = $t01494415024._1 | |
492 | + | let totalSupplyUsd = $t01494415024._2 | |
493 | + | let totalSupplyUsdAll = $t01494415024._3 | |
494 | + | let axlyPrice = getAssetPrice(axlyId) | |
495 | + | let axlyPrecision = getAssetPrecision(axlyId) | |
496 | + | let maxAPR = getAdoptedAPRByPeriod(curPeriod, LENDERS_APR_PERIODS, LENDERS_APR) | |
497 | + | func updateReward (a,tokenId) = { | |
498 | + | let $t01527315317 = a | |
499 | + | let enteries = $t01527315317._1 | |
500 | + | let totalPeriodReward = $t01527315317._2 | |
501 | + | let index = $t01527315317._3 | |
502 | + | if ((totalSupply[index] == 0)) | |
503 | + | then $Tuple3((enteries ++ [IntegerEntry((tokenId + kPrevLendTokenSupply), totalSupply[index]), IntegerEntry((tokenId + kTokenRewardPerBlock), 0), IntegerEntry((tokenId + kTokenInterest), calcNewTokenInterest(tokenId, totalSupply[index])), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height]))]), totalPeriodReward, (index + 1)) | |
504 | + | else { | |
505 | + | let share = fraction(totalSupplyUsd[index], SCALE8, totalSupplyUsdAll) | |
506 | + | let maxReward = fraction(share, lendMaxPeriodAmount, SCALE8) | |
507 | + | let maxRewardUsd = fraction(maxReward, axlyPrice, axlyPrecision) | |
508 | + | let prevTotalSupply = valueOrElse(getInteger(this, kPrevLendTokenSupply), 0) | |
509 | + | let rtCoef = if (if ((prevTotalSupply == 0)) | |
510 | + | then true | |
511 | + | else (totalSupply[index] == 0)) | |
512 | + | then 0 | |
513 | + | else fraction(prevTotalSupply, SCALE8, totalSupply[index]) | |
514 | + | let reward = ((min([(maxAPR * (SCALE8 + rtCoef)), fraction(maxAPR, (15 * SCALE8), 10)]) / SCALE8) / 100) | |
515 | + | let rewardUsd = min([maxRewardUsd, fraction(totalSupplyUsd[index], reward, SCALE8)]) | |
516 | + | let rewardPeriod = fraction(rewardUsd, axlyPrecision, axlyPrice) | |
517 | + | let rewardPerBlock = (rewardPeriod / periodLength) | |
518 | + | $Tuple3((enteries ++ [IntegerEntry((tokenId + kPrevLendTokenSupply), totalSupply[index]), IntegerEntry((tokenId + kTokenRewardPerBlock), rewardPerBlock), IntegerEntry((tokenId + kTokenInterest), calcNewTokenInterest(tokenId, totalSupply[index])), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height]))]), (totalPeriodReward + rewardPeriod), (index + 1)) | |
519 | + | } | |
520 | + | } | |
521 | + | ||
522 | + | let $t01697917071 = { | |
523 | + | let $l = getAllTokens() | |
524 | + | let $s = size($l) | |
525 | + | let $acc0 = $Tuple3(nil, 0, 0) | |
526 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
527 | + | then $a | |
528 | + | else updateReward($a, $l[$i]) | |
529 | + | ||
530 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
531 | + | then $a | |
532 | + | else throw("List size exceeds 30") | |
533 | + | ||
534 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
535 | + | } | |
536 | + | let tokensEnteries = $t01697917071._1 | |
537 | + | let totalTokenReward = $t01697917071._2 | |
538 | + | let lpMaxAPR = getAdoptedAPRByPeriod(curPeriod, LP_APR_PERIODS, LP_APR) | |
539 | + | let lpTotalSupply = getIntegerValue(sfFarmingContract, (axlyPool + kSFTotalSupply)) | |
540 | + | let preLPSupply = valueOrElse(getInteger(this, kPrevLPSupply), 0) | |
541 | + | let lpId = getStringValue(addressFromStringValue(axlyPool), kLpId) | |
542 | + | let lpPrecision = getAssetPrecision(lpId) | |
543 | + | let lpPrice = { | |
544 | + | let @ = invoke(mainContract, "getShareAssetPriceREADONLY", [lpId], nil) | |
545 | + | if ($isInstanceOf(@, "Int")) | |
546 | + | then @ | |
547 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
548 | + | } | |
549 | + | let lpTotalSupplyUsd = fraction(lpTotalSupply, lpPrice, lpPrecision) | |
550 | + | let maxLPRewardUsd = fraction(lpMaxPeriodAmount, axlyPrice, axlyPrecision) | |
551 | + | let rtLPCoef = if (if ((preLPSupply == 0)) | |
552 | + | then true | |
553 | + | else (lpTotalSupply == 0)) | |
554 | + | then 0 | |
555 | + | else fraction(preLPSupply, SCALE8, lpTotalSupply) | |
556 | + | let rewardLp = ((min([(lpMaxAPR * (SCALE8 + rtLPCoef)), fraction(lpMaxAPR, (15 * SCALE8), 10)]) / SCALE8) / 100) | |
557 | + | let rewardLpUsd = min([maxLPRewardUsd, fraction(lpTotalSupplyUsd, rewardLp, SCALE8)]) | |
558 | + | let rewardLpPeriod = fraction(rewardLpUsd, axlyPrecision, axlyPrice) | |
559 | + | let rewardLpPerBlock = (rewardLpPeriod / periodLength) | |
560 | + | let burnLend = (lendMaxPeriodAmount - totalTokenReward) | |
561 | + | let burnLp = (lpMaxPeriodAmount - rewardLpPeriod) | |
562 | + | let inv = invoke(tokenContract, "withdrawLpReward", [(burnLend + burnLp), toString(this)], nil) | |
563 | + | if ((inv == inv)) | |
564 | + | then { | |
565 | + | let lpEnteries = if ((12 >= curPeriod)) | |
566 | + | then [IntegerEntry(kPrevLPSupply, lpTotalSupply), IntegerEntry(kLpRewardPerBlock, rewardLpPerBlock), IntegerEntry(kLpInterest, calcNewLpInterest(lpTotalSupply)), IntegerEntry(kLpInterestHeight, max([startHeight, height])), ScriptTransfer(Address(base58'3MsXJ3BesPECkYejzBQGHZPJT8GVYy4Fd3Q'), burnLend, fromBase58String(axlyId)), ScriptTransfer(Address(base58'3MsXJ3BesPECkYejzBQGHZPJT8GVYy4Fd3Q'), burnLp, fromBase58String(axlyId))] | |
567 | + | else nil | |
568 | + | ((lpEnteries ++ tokensEnteries) :+ IntegerEntry(kLastUpdatePeriod, lastUpdatePeriod)) | |
514 | 569 | } | |
570 | + | else throw("Strict value is not equal to itself.") | |
515 | 571 | } | |
516 | - | ||
517 | - | let $t01686016958 = { | |
518 | - | let $l = getAllTokens() | |
519 | - | let $s = size($l) | |
520 | - | let $acc0 = $Tuple3(nil, 0, 0) | |
521 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
522 | - | then $a | |
523 | - | else updateReward($a, $l[$i]) | |
524 | - | ||
525 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
526 | - | then $a | |
527 | - | else throw("List size exceeds 30") | |
528 | - | ||
529 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
530 | - | } | |
531 | - | let tokensEnteries = $t01686016958._1 | |
532 | - | let totalTokenReward = $t01686016958._2 | |
533 | - | let index = $t01686016958._3 | |
534 | - | let lpMaxAPR = getAdoptedAPRByPeriod(curPeriod, LP_APR_PERIODS, LP_APR) | |
535 | - | let lpTotalSupply = getIntegerValue(sfFarmingContract, (axlyPool + kSFTotalSupply)) | |
536 | - | let preLPSupply = valueOrElse(getInteger(this, kPrevLPSupply), 0) | |
537 | - | let lpId = getStringValue(addressFromStringValue(axlyPool), kLpId) | |
538 | - | let lpPrecision = getAssetPrecision(lpId) | |
539 | - | let lpPrice = { | |
540 | - | let @ = invoke(mainContract, "getShareAssetPriceREADONLY", [lpId], nil) | |
541 | - | if ($isInstanceOf(@, "Int")) | |
542 | - | then @ | |
543 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
544 | - | } | |
545 | - | let lpTotalSupplyUsd = fraction(lpTotalSupply, lpPrice, lpPrecision) | |
546 | - | let maxLPRewardUsd = fraction(lpMaxPeriodAmount, axlyPrice, axlyPrecision) | |
547 | - | let rtLPCoef = if (if ((preLPSupply == 0)) | |
548 | - | then true | |
549 | - | else (lpTotalSupply == 0)) | |
550 | - | then 0 | |
551 | - | else fraction(preLPSupply, SCALE8, lpTotalSupply) | |
552 | - | let rewardLp = ((min([(lpMaxAPR * (SCALE8 + rtLPCoef)), fraction(lpMaxAPR, (15 * SCALE8), 10)]) / SCALE8) / 100) | |
553 | - | let rewardLpUsd = min([maxLPRewardUsd, fraction(lpTotalSupplyUsd, rewardLp, SCALE8)]) | |
554 | - | let rewardLpPeriod = fraction(rewardLpUsd, axlyPrecision, axlyPrice) | |
555 | - | let rewardLpPerBlock = (rewardLpPeriod / periodLength) | |
556 | - | let burnLend = (lendMaxPeriodAmount - totalTokenReward) | |
557 | - | let burnLp = (lpMaxPeriodAmount - rewardLpPeriod) | |
558 | - | let inv = invoke(tokenContract, "withdrawLpReward", [(burnLend + burnLp), toString(this)], nil) | |
559 | - | if ((inv == inv)) | |
560 | - | then { | |
561 | - | let lpEnteries = [IntegerEntry(kPrevLPSupply, lpTotalSupply), IntegerEntry(kLpRewardPerBlock, rewardLpPerBlock), IntegerEntry(kLpInterest, calcNewLpInterest(lpTotalSupply)), IntegerEntry(kLpInterestHeight, max([startHeight, height])), ScriptTransfer(Address(base58'3MsXJ3BesPECkYejzBQGHZPJT8GVYy4Fd3Q'), burnLend, fromBase58String(axlyId)), ScriptTransfer(Address(base58'3MsXJ3BesPECkYejzBQGHZPJT8GVYy4Fd3Q'), burnLp, fromBase58String(axlyId))] | |
562 | - | ((lpEnteries ++ tokensEnteries) :+ IntegerEntry(kLastUpdatePeriod, lastUpdatePeriod)) | |
563 | - | } | |
564 | - | else throw("Strict value is not equal to itself.") | |
565 | - | } | |
566 | 572 | }) | |
567 | 573 | ||
568 | 574 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SCALE8 = 100000000 | |
5 | 5 | ||
6 | 6 | let LENDERS_APR = [150, 120, 100, 80, 60, 40, 30, 20, 10] | |
7 | 7 | ||
8 | 8 | let LENDERS_APR_PERIODS = ["1-1", "2-2", "3-3", "4-4", "5-8", "9-12", "14-16", "17-20", "20-104"] | |
9 | 9 | ||
10 | 10 | let LENDERS_MAX_PERIODS = 104 | |
11 | 11 | ||
12 | 12 | let LP_APR = [150, 120, 100, 80, 60, 40] | |
13 | 13 | ||
14 | 14 | let LP_APR_PERIODS = ["1-1", "2-2", "3-3", "4-4", "5-8", "9-12"] | |
15 | 15 | ||
16 | 16 | let LP_MAX_PERIODS = 12 | |
17 | 17 | ||
18 | 18 | let kStartHeight = "startHeight" | |
19 | 19 | ||
20 | 20 | let kPeriodLength = "periodLength" | |
21 | 21 | ||
22 | 22 | let kLendersMaxAmount = "lendRewardsAmount" | |
23 | 23 | ||
24 | 24 | let kLPMaxAmount = "lpRewardAmount" | |
25 | 25 | ||
26 | 26 | let kTokens = "tokens" | |
27 | 27 | ||
28 | 28 | let kUserSupply = "_userTotalSupply" | |
29 | 29 | ||
30 | 30 | let kTokenInterest = "_tokenInterest" | |
31 | 31 | ||
32 | 32 | let kTokenInterestHeight = "_tokenInterestHeight" | |
33 | 33 | ||
34 | 34 | let kTokenRewardPerBlock = "_tokenRewardPerBlock" | |
35 | 35 | ||
36 | 36 | let kLastUpdatePeriod = "rewardUpdatePeriod" | |
37 | 37 | ||
38 | 38 | let kUserLendInterest = "_userLandInterest" | |
39 | 39 | ||
40 | 40 | let kUserLendAvailableClaim = "_userLendAvailableClaim" | |
41 | 41 | ||
42 | 42 | let kUserLpAvailableClaim = "_userLpAvailableClaim" | |
43 | 43 | ||
44 | 44 | let kLpInterest = "lpInterest" | |
45 | 45 | ||
46 | 46 | let kLpInterestHeight = "lpInterestHeight" | |
47 | 47 | ||
48 | 48 | let kPrevLPSupply = "prevLPTotalSupply" | |
49 | 49 | ||
50 | 50 | let kLpRewardPerBlock = "lpRewardPerBlock" | |
51 | 51 | ||
52 | 52 | let kUserLpInterest = "_userLpInterest" | |
53 | 53 | ||
54 | 54 | let kPriceInOracle = "_twap5B" | |
55 | 55 | ||
56 | 56 | let kPrevLendTokenSupply = "_prevLendTotalSupply" | |
57 | 57 | ||
58 | 58 | let kAXLYTokenId = "axlyTokenId" | |
59 | 59 | ||
60 | 60 | let kLendTokenSupply = "total_supplied_" | |
61 | 61 | ||
62 | 62 | let kLendUserSupply = "_supplied_" | |
63 | 63 | ||
64 | 64 | let kLendSetupTokens = "setup_tokens" | |
65 | 65 | ||
66 | 66 | let kSFTotalSupply = "_total_share_tokens_locked" | |
67 | 67 | ||
68 | 68 | let kSFUserTotalSupply = "_share_tokens_locked" | |
69 | 69 | ||
70 | 70 | let kAxlyPool = "axlyPool" | |
71 | 71 | ||
72 | 72 | let kLpId = "share_asset_id" | |
73 | 73 | ||
74 | 74 | let kPriceOracle = "price_oracle" | |
75 | 75 | ||
76 | 76 | let kAxlyMainContract = "mainContract" | |
77 | 77 | ||
78 | 78 | let kAxlyTokenomicContract = "tokenomicContract" | |
79 | 79 | ||
80 | 80 | let kSFFarmingContract = "swopfi_farming_addr" | |
81 | 81 | ||
82 | 82 | let kLendContract = "lend_service_addr" | |
83 | 83 | ||
84 | 84 | let kAdmin1PK = "group1_admin1_pub_key" | |
85 | 85 | ||
86 | 86 | let kAdmin2PK = "group1_admin2_pub_key" | |
87 | 87 | ||
88 | 88 | let kAdmin3PK = "group1_admin3_pub_key" | |
89 | 89 | ||
90 | 90 | let kOperatorCallPK = "admin_call_pub_key" | |
91 | 91 | ||
92 | 92 | let axlyPool = valueOrErrorMessage(getString(this, kAxlyPool), "Can't get axlyPool key") | |
93 | 93 | ||
94 | 94 | let mainContract = addressFromStringValue(valueOrErrorMessage(getString(this, kAxlyMainContract), "Can't get mainContact key")) | |
95 | 95 | ||
96 | 96 | let tokenContract = addressFromStringValue(valueOrErrorMessage(getString(this, kAxlyTokenomicContract), "Can't get tokenomicContract key")) | |
97 | 97 | ||
98 | 98 | let lendContract = addressFromStringValue(valueOrErrorMessage(getString(mainContract, kLendContract), "Can't get lend_service_addr key")) | |
99 | 99 | ||
100 | 100 | let sfFarmingContract = addressFromStringValue(valueOrErrorMessage(getString(mainContract, kSFFarmingContract), "Can't get swopfi_farming_addr key")) | |
101 | 101 | ||
102 | 102 | let priceOracleAddr = addressFromStringValue(valueOrErrorMessage(getString(mainContract, kPriceOracle), "Can't get price_oracle key")) | |
103 | 103 | ||
104 | 104 | let admin1PK = fromBase58String(valueOrErrorMessage(getString(mainContract, kAdmin1PK), "Can't get admin1PK")) | |
105 | 105 | ||
106 | 106 | let admin2PK = fromBase58String(valueOrErrorMessage(getString(mainContract, kAdmin2PK), "Can't get admin2PK")) | |
107 | 107 | ||
108 | 108 | let admin3PK = fromBase58String(valueOrErrorMessage(getString(mainContract, kAdmin3PK), "Can't get operatorPK")) | |
109 | 109 | ||
110 | 110 | let operatorPK = fromBase58String(valueOrErrorMessage(getString(this, kOperatorCallPK), "Can't get operatorPK")) | |
111 | 111 | ||
112 | 112 | let axlyId = valueOrErrorMessage(getString(tokenContract, kAXLYTokenId), "Can't get Axly token id") | |
113 | 113 | ||
114 | 114 | let startHeight = getIntegerValue(this, kStartHeight) | |
115 | 115 | ||
116 | 116 | let periodLength = getIntegerValue(this, kPeriodLength) | |
117 | 117 | ||
118 | 118 | let lendMaxAmount = getIntegerValue(tokenContract, kLendersMaxAmount) | |
119 | 119 | ||
120 | 120 | let lendMaxPeriodAmount = (lendMaxAmount / LENDERS_MAX_PERIODS) | |
121 | 121 | ||
122 | 122 | let lpMaxAmount = getIntegerValue(tokenContract, kLPMaxAmount) | |
123 | 123 | ||
124 | 124 | let lpMaxPeriodAmount = (lpMaxAmount / LP_MAX_PERIODS) | |
125 | 125 | ||
126 | 126 | func isAdminCall (i) = if (containsElement([admin1PK, admin2PK, admin3PK], i.callerPublicKey)) | |
127 | 127 | then unit | |
128 | 128 | else throw("Only admin group1 can call this function") | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func isSelfCall (i) = if ((i.caller == this)) | |
132 | 132 | then unit | |
133 | 133 | else throw("Only contract itself can call this function") | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func isOperatorCall (i) = if ((i.callerPublicKey == operatorPK)) | |
137 | 137 | then unit | |
138 | 138 | else throw("Only operator can call this function") | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func isLandCall (i) = if ((i.caller == lendContract)) | |
142 | 142 | then unit | |
143 | 143 | else throw("Only land contract can call this function") | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func isSFFarmingCall (i) = if ((i.caller == sfFarmingContract)) | |
147 | 147 | then unit | |
148 | 148 | else throw("Only land contract can call this function") | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func getAllTokens () = { | |
152 | 152 | let tokens = valueOrElse(getString(this, kTokens), "") | |
153 | 153 | if ((tokens == "")) | |
154 | 154 | then nil | |
155 | 155 | else split(tokens, ",") | |
156 | 156 | } | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func getAssetPrice (assetId) = getIntegerValue(priceOracleAddr, (assetId + kPriceInOracle)) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func getAssetDecimals (assetId) = if ((assetId == "WAVES")) | |
163 | 163 | then 8 | |
164 | 164 | else match assetInfo(fromBase58String(assetId)) { | |
165 | 165 | case asset: Asset => | |
166 | 166 | asset.decimals | |
167 | 167 | case _ => | |
168 | 168 | throw("Can't find asset") | |
169 | 169 | } | |
170 | 170 | ||
171 | 171 | ||
172 | 172 | func getAssetPrecision (assetId) = pow(10, 0, getAssetDecimals(assetId), 0, 0, DOWN) | |
173 | 173 | ||
174 | 174 | ||
175 | 175 | func getAdoptedAPRByPeriod (period,aprPeriods,apr) = { | |
176 | 176 | func for (a,aperiod) = { | |
177 | 177 | let $t053625384 = a | |
178 | 178 | let index = $t053625384._1 | |
179 | 179 | let found = $t053625384._2 | |
180 | 180 | let ft = split(aperiod, "-") | |
181 | 181 | let $t054215484 = $Tuple2(parseIntValue(ft[0]), parseIntValue(ft[1])) | |
182 | 182 | let from = $t054215484._1 | |
183 | 183 | let to = $t054215484._2 | |
184 | 184 | if (found) | |
185 | 185 | then a | |
186 | 186 | else if (if ((period >= from)) | |
187 | 187 | then (to >= period) | |
188 | 188 | else false) | |
189 | 189 | then $Tuple2(index, true) | |
190 | 190 | else $Tuple2((index + 1), false) | |
191 | 191 | } | |
192 | 192 | ||
193 | 193 | let $t056215687 = { | |
194 | 194 | let $l = LENDERS_APR_PERIODS | |
195 | 195 | let $s = size($l) | |
196 | 196 | let $acc0 = $Tuple2(0, false) | |
197 | 197 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
198 | 198 | then $a | |
199 | 199 | else for($a, $l[$i]) | |
200 | 200 | ||
201 | 201 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
202 | 202 | then $a | |
203 | 203 | else throw("List size exceeds 9") | |
204 | 204 | ||
205 | 205 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9) | |
206 | 206 | } | |
207 | 207 | let index = $t056215687._1 | |
208 | 208 | let found = $t056215687._2 | |
209 | 209 | if (found) | |
210 | 210 | then fraction((LENDERS_APR[index] * SCALE8), 7, 365) | |
211 | 211 | else 0 | |
212 | 212 | } | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | func getTotalSupplyAllTokens () = { | |
216 | 216 | func for (a,tokenId) = { | |
217 | 217 | let $t058755931 = a | |
218 | 218 | let totalSupply = $t058755931._1 | |
219 | 219 | let totalSupplyUsd = $t058755931._2 | |
220 | 220 | let totalSupplyUsdAll = $t058755931._3 | |
221 | 221 | let tSupply = valueOrElse(getInteger(lendContract, (kLendTokenSupply + tokenId)), 0) | |
222 | 222 | let assetPrice = getAssetPrice(tokenId) | |
223 | 223 | let assetPrecision = getAssetPrecision(tokenId) | |
224 | 224 | let tSupplyUsd = fraction(tSupply, assetPrice, assetPrecision) | |
225 | 225 | $Tuple3((totalSupply :+ tSupply), (totalSupplyUsd :+ tSupplyUsd), (totalSupplyUsdAll + tSupplyUsd)) | |
226 | 226 | } | |
227 | 227 | ||
228 | 228 | let $l = getAllTokens() | |
229 | 229 | let $s = size($l) | |
230 | 230 | let $acc0 = $Tuple3(nil, nil, 0) | |
231 | 231 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
232 | 232 | then $a | |
233 | 233 | else for($a, $l[$i]) | |
234 | 234 | ||
235 | 235 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
236 | 236 | then $a | |
237 | 237 | else throw("List size exceeds 30") | |
238 | 238 | ||
239 | 239 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
240 | 240 | } | |
241 | 241 | ||
242 | 242 | ||
243 | 243 | func getTotalSupplyUsd (tokenId) = { | |
244 | 244 | let tSupply = valueOrElse(getInteger(lendContract, (kLendTokenSupply + tokenId)), 0) | |
245 | 245 | let assetPrice = getAssetPrice(tokenId) | |
246 | 246 | let assetPrecision = getAssetPrecision(tokenId) | |
247 | 247 | fraction(tSupply, assetPrice, assetPrecision) | |
248 | 248 | } | |
249 | 249 | ||
250 | 250 | ||
251 | 251 | func calcNewTokenInterest (tokenId,totalSupply) = if ((startHeight >= height)) | |
252 | 252 | then 0 | |
253 | 253 | else { | |
254 | 254 | let rewardPerBlock = getIntegerValue(this, (tokenId + kTokenRewardPerBlock)) | |
255 | 255 | let oldInterest = getIntegerValue(this, (tokenId + kTokenInterest)) | |
256 | 256 | let updateHeight = getIntegerValue(this, (tokenId + kTokenInterestHeight)) | |
257 | 257 | let reward = ((height - updateHeight) * rewardPerBlock) | |
258 | 258 | let interest = if ((totalSupply > 0)) | |
259 | 259 | then fraction(reward, SCALE8, totalSupply) | |
260 | 260 | else 0 | |
261 | 261 | (oldInterest + interest) | |
262 | 262 | } | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | func calcNewLpInterest (totalSupply) = if ((startHeight >= height)) | |
266 | 266 | then 0 | |
267 | 267 | else { | |
268 | 268 | let rewardPerBlock = valueOrElse(getInteger(this, kLpRewardPerBlock), 0) | |
269 | 269 | let oldInterest = valueOrElse(getInteger(this, kLpInterest), 0) | |
270 | 270 | let updateHeight = valueOrElse(getInteger(this, kLpInterestHeight), height) | |
271 | 271 | let reward = ((height - updateHeight) * rewardPerBlock) | |
272 | 272 | let interest = if ((totalSupply > 0)) | |
273 | 273 | then fraction(reward, SCALE8, totalSupply) | |
274 | 274 | else 0 | |
275 | 275 | (oldInterest + interest) | |
276 | 276 | } | |
277 | 277 | ||
278 | 278 | ||
279 | 279 | func calcLendUserReward (user,tokenId) = { | |
280 | 280 | let totalSupply = valueOrElse(getInteger(lendContract, (kLendTokenSupply + tokenId)), 0) | |
281 | 281 | let tokenInterest = calcNewTokenInterest(tokenId, totalSupply) | |
282 | 282 | let userSupply = valueOrElse(getInteger(lendContract, ((user + kLendUserSupply) + tokenId)), 0) | |
283 | 283 | let userTokenInterest = valueOrElse(getInteger(this, (((tokenId + "_") + user) + kUserLendInterest)), if ((userSupply == 0)) | |
284 | 284 | then tokenInterest | |
285 | 285 | else 0) | |
286 | 286 | let reward = fraction(userSupply, (tokenInterest - userTokenInterest), SCALE8) | |
287 | 287 | $Tuple3(reward, tokenInterest, userSupply) | |
288 | 288 | } | |
289 | 289 | ||
290 | 290 | ||
291 | 291 | func calcLpUserReward (user) = { | |
292 | 292 | let totalSupply = valueOrElse(getInteger(sfFarmingContract, (axlyPool + kSFTotalSupply)), 0) | |
293 | 293 | let tokenInterest = calcNewLpInterest(totalSupply) | |
294 | 294 | let userSupply = valueOrElse(getInteger(sfFarmingContract, (((axlyPool + "_") + user) + kSFUserTotalSupply)), 0) | |
295 | 295 | let userTokenInterest = valueOrElse(getInteger(this, (user + kUserLpInterest)), if ((userSupply == 0)) | |
296 | 296 | then tokenInterest | |
297 | 297 | else 0) | |
298 | 298 | let reward = fraction(userSupply, (tokenInterest - userTokenInterest), SCALE8) | |
299 | 299 | $Tuple3(reward, tokenInterest, userSupply) | |
300 | 300 | } | |
301 | 301 | ||
302 | 302 | ||
303 | 303 | func claimLenderRewardsCommon (user,readOnly) = { | |
304 | 304 | func claim (a,tokenId) = { | |
305 | 305 | let $t088208864 = a | |
306 | 306 | let tokenIds = $t088208864._1 | |
307 | 307 | let cAmount = $t088208864._2 | |
308 | 308 | let total = $t088208864._3 | |
309 | 309 | let enteries = $t088208864._4 | |
310 | 310 | let userAvailableClaim = valueOrElse(getInteger(this, (((tokenId + "_") + user) + kUserLendAvailableClaim)), 0) | |
311 | 311 | let $t089779056 = calcLendUserReward(user, tokenId) | |
312 | 312 | let uReward = $t089779056._1 | |
313 | 313 | let newTokenInterest = $t089779056._2 | |
314 | 314 | let userSupply = $t089779056._3 | |
315 | 315 | let totalToClaim = (userAvailableClaim + uReward) | |
316 | 316 | if (if ((totalToClaim > 0)) | |
317 | 317 | then true | |
318 | 318 | else (userSupply > 0)) | |
319 | 319 | then { | |
320 | 320 | let newEntreries = if (if (readOnly) | |
321 | 321 | then true | |
322 | 322 | else (totalToClaim == 0)) | |
323 | 323 | then enteries | |
324 | 324 | else (enteries ++ [IntegerEntry((((tokenId + "_") + user) + kUserLendInterest), newTokenInterest), IntegerEntry((((tokenId + "_") + user) + kUserLendAvailableClaim), 0), IntegerEntry((tokenId + kTokenInterest), newTokenInterest), IntegerEntry((tokenId + kTokenInterestHeight), height)]) | |
325 | 325 | $Tuple4((tokenIds :+ tokenId), (cAmount :+ totalToClaim), (total + totalToClaim), newEntreries) | |
326 | 326 | } | |
327 | 327 | else $Tuple4(tokenIds, cAmount, total, enteries) | |
328 | 328 | } | |
329 | 329 | ||
330 | 330 | let $l = getAllTokens() | |
331 | 331 | let $s = size($l) | |
332 | 332 | let $acc0 = $Tuple4(nil, nil, 0, nil) | |
333 | 333 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
334 | 334 | then $a | |
335 | 335 | else claim($a, $l[$i]) | |
336 | 336 | ||
337 | 337 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
338 | 338 | then $a | |
339 | 339 | else throw("List size exceeds 30") | |
340 | 340 | ||
341 | 341 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
342 | 342 | } | |
343 | 343 | ||
344 | 344 | ||
345 | 345 | func claimLpRewardsCommon (user,readOnly) = { | |
346 | 346 | let userAvailableClaim = valueOrElse(getInteger(this, (user + kUserLpAvailableClaim)), 0) | |
347 | 347 | let $t0998810053 = calcLpUserReward(user) | |
348 | 348 | let uReward = $t0998810053._1 | |
349 | 349 | let newLpInterest = $t0998810053._2 | |
350 | 350 | let userSupply = $t0998810053._3 | |
351 | 351 | let totalToClaim = (userAvailableClaim + uReward) | |
352 | 352 | if (if (readOnly) | |
353 | 353 | then true | |
354 | 354 | else (totalToClaim == 0)) | |
355 | 355 | then $Tuple2(totalToClaim, nil) | |
356 | 356 | else $Tuple2(totalToClaim, [IntegerEntry((user + kUserLpInterest), newLpInterest), IntegerEntry((user + kUserLpAvailableClaim), 0), IntegerEntry(kLpInterest, newLpInterest), IntegerEntry(kLpInterestHeight, height)]) | |
357 | 357 | } | |
358 | 358 | ||
359 | 359 | ||
360 | 360 | func getTokensAPRs () = { | |
361 | 361 | let axlyPrice = getAssetPrice(axlyId) | |
362 | 362 | let axlyPrecision = getAssetPrecision(axlyId) | |
363 | 363 | func tokensAprs (apr,tokenId) = { | |
364 | 364 | let rwpb = valueOrElse(getInteger(this, (tokenId + kTokenRewardPerBlock)), 0) | |
365 | 365 | let rwpbUsd = fraction(rwpb, axlyPrice, axlyPrecision) | |
366 | 366 | let rwYear = ((rwpbUsd * periodLength) * 52) | |
367 | 367 | let totalSupplyUsd = getTotalSupplyUsd(tokenId) | |
368 | 368 | (apr :+ fraction(rwYear, SCALE8, totalSupplyUsd)) | |
369 | 369 | } | |
370 | 370 | ||
371 | 371 | let aprs = { | |
372 | 372 | let $l = getAllTokens() | |
373 | 373 | let $s = size($l) | |
374 | 374 | let $acc0 = nil | |
375 | 375 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
376 | 376 | then $a | |
377 | 377 | else tokensAprs($a, $l[$i]) | |
378 | 378 | ||
379 | 379 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
380 | 380 | then $a | |
381 | 381 | else throw("List size exceeds 30") | |
382 | 382 | ||
383 | 383 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
384 | 384 | } | |
385 | 385 | let lpTotalSupply = getIntegerValue(sfFarmingContract, (axlyPool + kSFTotalSupply)) | |
386 | 386 | let lpId = getStringValue(addressFromStringValue(axlyPool), kLpId) | |
387 | 387 | let lpPrecision = getAssetPrecision(lpId) | |
388 | 388 | let lpPrice = { | |
389 | 389 | let @ = invoke(mainContract, "getShareAssetPriceREADONLY", [lpId], nil) | |
390 | 390 | if ($isInstanceOf(@, "Int")) | |
391 | 391 | then @ | |
392 | 392 | else throw(($getType(@) + " couldn't be cast to Int")) | |
393 | 393 | } | |
394 | 394 | let lpTotalSupplyUsd = fraction(lpTotalSupply, lpPrice, lpPrecision) | |
395 | 395 | let rwpb = valueOrElse(getInteger(this, kLpRewardPerBlock), 0) | |
396 | 396 | let rwpbUsd = fraction(rwpb, axlyPrice, axlyPrecision) | |
397 | 397 | let rwYear = ((rwpbUsd * periodLength) * 52) | |
398 | 398 | let lpApr = fraction(rwYear, SCALE8, lpTotalSupplyUsd) | |
399 | 399 | $Tuple3(getAllTokens(), aprs, lpApr) | |
400 | 400 | } | |
401 | 401 | ||
402 | 402 | ||
403 | 403 | @Callable(i) | |
404 | 404 | func claimLenderRewards () = { | |
405 | 405 | let claimRes = claimLenderRewardsCommon(toString(i.caller), false) | |
406 | 406 | if ((claimRes._3 == 0)) | |
407 | 407 | then throw("claim amount must be greater than 0") | |
408 | 408 | else { | |
409 | 409 | let inv = invoke(tokenContract, "withdrawLendReward", [claimRes._3, toString(i.caller)], nil) | |
410 | 410 | if ((inv == inv)) | |
411 | 411 | then claimRes._4 | |
412 | 412 | else throw("Strict value is not equal to itself.") | |
413 | 413 | } | |
414 | 414 | } | |
415 | 415 | ||
416 | 416 | ||
417 | 417 | ||
418 | 418 | @Callable(i) | |
419 | 419 | func claimLpRewards () = { | |
420 | 420 | let claimRes = claimLpRewardsCommon(toString(i.caller), false) | |
421 | 421 | if ((claimRes._1 == 0)) | |
422 | 422 | then throw("claim amount must be greater than 0") | |
423 | 423 | else { | |
424 | 424 | let inv = invoke(tokenContract, "withdrawLpReward", [claimRes._1, toString(i.caller)], nil) | |
425 | 425 | if ((inv == inv)) | |
426 | 426 | then claimRes._2 | |
427 | 427 | else throw("Strict value is not equal to itself.") | |
428 | 428 | } | |
429 | 429 | } | |
430 | 430 | ||
431 | 431 | ||
432 | 432 | ||
433 | 433 | @Callable(i) | |
434 | 434 | func lendAction (user,tokenId) = valueOrElse(isLandCall(i), { | |
435 | 435 | let userAvailableClaim = valueOrElse(getInteger(this, (tokenId + kUserLendAvailableClaim)), 0) | |
436 | 436 | let $t01240112468 = calcLendUserReward(user, tokenId) | |
437 | 437 | let uReward = $t01240112468._1 | |
438 | 438 | let newTokenInterest = $t01240112468._2 | |
439 | 439 | [IntegerEntry((((user + "_") + tokenId) + kUserLendInterest), newTokenInterest), IntegerEntry((((user + "_") + tokenId) + kUserLendAvailableClaim), (userAvailableClaim + uReward)), IntegerEntry((tokenId + kTokenInterest), newTokenInterest), IntegerEntry((tokenId + kTokenInterestHeight), height)] | |
440 | 440 | }) | |
441 | 441 | ||
442 | 442 | ||
443 | 443 | ||
444 | 444 | @Callable(i) | |
445 | 445 | func lpAction (user) = valueOrElse(isSFFarmingCall(i), { | |
446 | 446 | let userAvailableClaim = valueOrElse(getInteger(this, kUserLpAvailableClaim), 0) | |
447 | 447 | let $t01293312986 = calcLpUserReward(user) | |
448 | 448 | let uReward = $t01293312986._1 | |
449 | 449 | let newLpInterest = $t01293312986._2 | |
450 | 450 | [IntegerEntry((user + kUserLpInterest), newLpInterest), IntegerEntry((user + kUserLpAvailableClaim), (userAvailableClaim + uReward)), IntegerEntry((user + kLpInterest), newLpInterest), IntegerEntry((user + kLpInterestHeight), height)] | |
451 | 451 | }) | |
452 | 452 | ||
453 | 453 | ||
454 | 454 | ||
455 | 455 | @Callable(i) | |
456 | 456 | func init (axlyMainContractAddr,axlyTokenomicContractAddr,axlyPoolAddr,farmingStartHeight,periodLength) = valueOrElse(isSelfCall(i), if (!(isDefined(addressFromString(axlyMainContractAddr)))) | |
457 | 457 | then throw("Wrong farming address") | |
458 | 458 | else if (!(isDefined(addressFromString(axlyTokenomicContractAddr)))) | |
459 | 459 | then throw("Wrong main contract address") | |
460 | 460 | else [StringEntry(kAxlyMainContract, axlyMainContractAddr), StringEntry(kAxlyTokenomicContract, axlyTokenomicContractAddr), StringEntry(kAxlyPool, axlyPoolAddr), IntegerEntry(kStartHeight, farmingStartHeight), IntegerEntry(kPeriodLength, periodLength)]) | |
461 | 461 | ||
462 | 462 | ||
463 | 463 | ||
464 | 464 | @Callable(i) | |
465 | 465 | func initNewToken (tokenId) = valueOrElse(isAdminCall(i), if (isDefined(getInteger(this, (tokenId + kTokenInterest)))) | |
466 | 466 | then throw("token already inited") | |
467 | 467 | else if (!(contains(getStringValue(lendContract, kLendSetupTokens), tokenId))) | |
468 | 468 | then throw("no token on landing") | |
469 | 469 | else { | |
470 | 470 | let newAllTokens = (getAllTokens() :+ tokenId) | |
471 | 471 | [IntegerEntry((tokenId + kTokenInterest), 0), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height])), StringEntry(kTokens, makeString(newAllTokens, ",")), IntegerEntry((tokenId + kTokenRewardPerBlock), 0)] | |
472 | 472 | }) | |
473 | 473 | ||
474 | 474 | ||
475 | 475 | ||
476 | 476 | @Callable(i) | |
477 | 477 | func updateRewards () = valueOrElse(isOperatorCall(i), { | |
478 | 478 | let lastUpdatePeriod = valueOrElse(getInteger(this, kLastUpdatePeriod), 0) | |
479 | - | let curPeriod = (((height - startHeight) / periodLength) + 1) | |
480 | - | if (if ((lastUpdatePeriod >= curPeriod)) | |
481 | - | then (lastUpdatePeriod != 0) | |
482 | - | else false) | |
483 | - | then throw("rewards alredy updated in this period") | |
484 | - | else { | |
485 | - | let $t01482514905 = getTotalSupplyAllTokens() | |
486 | - | let totalSupply = $t01482514905._1 | |
487 | - | let totalSupplyUsd = $t01482514905._2 | |
488 | - | let totalSupplyUsdAll = $t01482514905._3 | |
489 | - | let axlyPrice = getAssetPrice(axlyId) | |
490 | - | let axlyPrecision = getAssetPrecision(axlyId) | |
491 | - | let maxAPR = getAdoptedAPRByPeriod(curPeriod, LENDERS_APR_PERIODS, LENDERS_APR) | |
492 | - | func updateReward (a,tokenId) = { | |
493 | - | let $t01515415198 = a | |
494 | - | let enteries = $t01515415198._1 | |
495 | - | let totalPeriodReward = $t01515415198._2 | |
496 | - | let index = $t01515415198._3 | |
497 | - | if ((totalSupply[index] == 0)) | |
498 | - | then $Tuple3((enteries ++ [IntegerEntry((tokenId + kPrevLendTokenSupply), totalSupply[index]), IntegerEntry((tokenId + kTokenRewardPerBlock), 0), IntegerEntry((tokenId + kTokenInterest), calcNewTokenInterest(tokenId, totalSupply[index])), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height]))]), totalPeriodReward, (index + 1)) | |
499 | - | else { | |
500 | - | let share = fraction(totalSupplyUsd[index], SCALE8, totalSupplyUsdAll) | |
501 | - | let maxReward = fraction(share, lendMaxPeriodAmount, SCALE8) | |
502 | - | let maxRewardUsd = fraction(maxReward, axlyPrice, axlyPrecision) | |
503 | - | let prevTotalSupply = valueOrElse(getInteger(this, kPrevLendTokenSupply), 0) | |
504 | - | let rtCoef = if (if ((prevTotalSupply == 0)) | |
505 | - | then true | |
506 | - | else (totalSupply[index] == 0)) | |
507 | - | then 0 | |
508 | - | else fraction(prevTotalSupply, SCALE8, totalSupply[index]) | |
509 | - | let reward = ((min([(maxAPR * (SCALE8 + rtCoef)), fraction(maxAPR, (15 * SCALE8), 10)]) / SCALE8) / 100) | |
510 | - | let rewardUsd = min([maxRewardUsd, fraction(totalSupplyUsd[index], reward, SCALE8)]) | |
511 | - | let rewardPeriod = fraction(rewardUsd, axlyPrecision, axlyPrice) | |
512 | - | let rewardPerBlock = (rewardPeriod / periodLength) | |
513 | - | $Tuple3((enteries ++ [IntegerEntry((tokenId + kPrevLendTokenSupply), totalSupply[index]), IntegerEntry((tokenId + kTokenRewardPerBlock), rewardPerBlock), IntegerEntry((tokenId + kTokenInterest), calcNewTokenInterest(tokenId, totalSupply[index])), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height]))]), (totalPeriodReward + rewardPeriod), (index + 1)) | |
479 | + | let calcPeriod = (((height - startHeight) / periodLength) + 1) | |
480 | + | let curPeriod = if ((0 >= calcPeriod)) | |
481 | + | then 1 | |
482 | + | else calcPeriod | |
483 | + | if ((curPeriod > 104)) | |
484 | + | then throw("max period is 104") | |
485 | + | else if (if ((lastUpdatePeriod >= curPeriod)) | |
486 | + | then (lastUpdatePeriod != 0) | |
487 | + | else false) | |
488 | + | then throw("rewards alredy updated in this period") | |
489 | + | else { | |
490 | + | let $t01494415024 = getTotalSupplyAllTokens() | |
491 | + | let totalSupply = $t01494415024._1 | |
492 | + | let totalSupplyUsd = $t01494415024._2 | |
493 | + | let totalSupplyUsdAll = $t01494415024._3 | |
494 | + | let axlyPrice = getAssetPrice(axlyId) | |
495 | + | let axlyPrecision = getAssetPrecision(axlyId) | |
496 | + | let maxAPR = getAdoptedAPRByPeriod(curPeriod, LENDERS_APR_PERIODS, LENDERS_APR) | |
497 | + | func updateReward (a,tokenId) = { | |
498 | + | let $t01527315317 = a | |
499 | + | let enteries = $t01527315317._1 | |
500 | + | let totalPeriodReward = $t01527315317._2 | |
501 | + | let index = $t01527315317._3 | |
502 | + | if ((totalSupply[index] == 0)) | |
503 | + | then $Tuple3((enteries ++ [IntegerEntry((tokenId + kPrevLendTokenSupply), totalSupply[index]), IntegerEntry((tokenId + kTokenRewardPerBlock), 0), IntegerEntry((tokenId + kTokenInterest), calcNewTokenInterest(tokenId, totalSupply[index])), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height]))]), totalPeriodReward, (index + 1)) | |
504 | + | else { | |
505 | + | let share = fraction(totalSupplyUsd[index], SCALE8, totalSupplyUsdAll) | |
506 | + | let maxReward = fraction(share, lendMaxPeriodAmount, SCALE8) | |
507 | + | let maxRewardUsd = fraction(maxReward, axlyPrice, axlyPrecision) | |
508 | + | let prevTotalSupply = valueOrElse(getInteger(this, kPrevLendTokenSupply), 0) | |
509 | + | let rtCoef = if (if ((prevTotalSupply == 0)) | |
510 | + | then true | |
511 | + | else (totalSupply[index] == 0)) | |
512 | + | then 0 | |
513 | + | else fraction(prevTotalSupply, SCALE8, totalSupply[index]) | |
514 | + | let reward = ((min([(maxAPR * (SCALE8 + rtCoef)), fraction(maxAPR, (15 * SCALE8), 10)]) / SCALE8) / 100) | |
515 | + | let rewardUsd = min([maxRewardUsd, fraction(totalSupplyUsd[index], reward, SCALE8)]) | |
516 | + | let rewardPeriod = fraction(rewardUsd, axlyPrecision, axlyPrice) | |
517 | + | let rewardPerBlock = (rewardPeriod / periodLength) | |
518 | + | $Tuple3((enteries ++ [IntegerEntry((tokenId + kPrevLendTokenSupply), totalSupply[index]), IntegerEntry((tokenId + kTokenRewardPerBlock), rewardPerBlock), IntegerEntry((tokenId + kTokenInterest), calcNewTokenInterest(tokenId, totalSupply[index])), IntegerEntry((tokenId + kTokenInterestHeight), max([startHeight, height]))]), (totalPeriodReward + rewardPeriod), (index + 1)) | |
519 | + | } | |
520 | + | } | |
521 | + | ||
522 | + | let $t01697917071 = { | |
523 | + | let $l = getAllTokens() | |
524 | + | let $s = size($l) | |
525 | + | let $acc0 = $Tuple3(nil, 0, 0) | |
526 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
527 | + | then $a | |
528 | + | else updateReward($a, $l[$i]) | |
529 | + | ||
530 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
531 | + | then $a | |
532 | + | else throw("List size exceeds 30") | |
533 | + | ||
534 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
535 | + | } | |
536 | + | let tokensEnteries = $t01697917071._1 | |
537 | + | let totalTokenReward = $t01697917071._2 | |
538 | + | let lpMaxAPR = getAdoptedAPRByPeriod(curPeriod, LP_APR_PERIODS, LP_APR) | |
539 | + | let lpTotalSupply = getIntegerValue(sfFarmingContract, (axlyPool + kSFTotalSupply)) | |
540 | + | let preLPSupply = valueOrElse(getInteger(this, kPrevLPSupply), 0) | |
541 | + | let lpId = getStringValue(addressFromStringValue(axlyPool), kLpId) | |
542 | + | let lpPrecision = getAssetPrecision(lpId) | |
543 | + | let lpPrice = { | |
544 | + | let @ = invoke(mainContract, "getShareAssetPriceREADONLY", [lpId], nil) | |
545 | + | if ($isInstanceOf(@, "Int")) | |
546 | + | then @ | |
547 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
548 | + | } | |
549 | + | let lpTotalSupplyUsd = fraction(lpTotalSupply, lpPrice, lpPrecision) | |
550 | + | let maxLPRewardUsd = fraction(lpMaxPeriodAmount, axlyPrice, axlyPrecision) | |
551 | + | let rtLPCoef = if (if ((preLPSupply == 0)) | |
552 | + | then true | |
553 | + | else (lpTotalSupply == 0)) | |
554 | + | then 0 | |
555 | + | else fraction(preLPSupply, SCALE8, lpTotalSupply) | |
556 | + | let rewardLp = ((min([(lpMaxAPR * (SCALE8 + rtLPCoef)), fraction(lpMaxAPR, (15 * SCALE8), 10)]) / SCALE8) / 100) | |
557 | + | let rewardLpUsd = min([maxLPRewardUsd, fraction(lpTotalSupplyUsd, rewardLp, SCALE8)]) | |
558 | + | let rewardLpPeriod = fraction(rewardLpUsd, axlyPrecision, axlyPrice) | |
559 | + | let rewardLpPerBlock = (rewardLpPeriod / periodLength) | |
560 | + | let burnLend = (lendMaxPeriodAmount - totalTokenReward) | |
561 | + | let burnLp = (lpMaxPeriodAmount - rewardLpPeriod) | |
562 | + | let inv = invoke(tokenContract, "withdrawLpReward", [(burnLend + burnLp), toString(this)], nil) | |
563 | + | if ((inv == inv)) | |
564 | + | then { | |
565 | + | let lpEnteries = if ((12 >= curPeriod)) | |
566 | + | then [IntegerEntry(kPrevLPSupply, lpTotalSupply), IntegerEntry(kLpRewardPerBlock, rewardLpPerBlock), IntegerEntry(kLpInterest, calcNewLpInterest(lpTotalSupply)), IntegerEntry(kLpInterestHeight, max([startHeight, height])), ScriptTransfer(Address(base58'3MsXJ3BesPECkYejzBQGHZPJT8GVYy4Fd3Q'), burnLend, fromBase58String(axlyId)), ScriptTransfer(Address(base58'3MsXJ3BesPECkYejzBQGHZPJT8GVYy4Fd3Q'), burnLp, fromBase58String(axlyId))] | |
567 | + | else nil | |
568 | + | ((lpEnteries ++ tokensEnteries) :+ IntegerEntry(kLastUpdatePeriod, lastUpdatePeriod)) | |
514 | 569 | } | |
570 | + | else throw("Strict value is not equal to itself.") | |
515 | 571 | } | |
516 | - | ||
517 | - | let $t01686016958 = { | |
518 | - | let $l = getAllTokens() | |
519 | - | let $s = size($l) | |
520 | - | let $acc0 = $Tuple3(nil, 0, 0) | |
521 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
522 | - | then $a | |
523 | - | else updateReward($a, $l[$i]) | |
524 | - | ||
525 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
526 | - | then $a | |
527 | - | else throw("List size exceeds 30") | |
528 | - | ||
529 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30) | |
530 | - | } | |
531 | - | let tokensEnteries = $t01686016958._1 | |
532 | - | let totalTokenReward = $t01686016958._2 | |
533 | - | let index = $t01686016958._3 | |
534 | - | let lpMaxAPR = getAdoptedAPRByPeriod(curPeriod, LP_APR_PERIODS, LP_APR) | |
535 | - | let lpTotalSupply = getIntegerValue(sfFarmingContract, (axlyPool + kSFTotalSupply)) | |
536 | - | let preLPSupply = valueOrElse(getInteger(this, kPrevLPSupply), 0) | |
537 | - | let lpId = getStringValue(addressFromStringValue(axlyPool), kLpId) | |
538 | - | let lpPrecision = getAssetPrecision(lpId) | |
539 | - | let lpPrice = { | |
540 | - | let @ = invoke(mainContract, "getShareAssetPriceREADONLY", [lpId], nil) | |
541 | - | if ($isInstanceOf(@, "Int")) | |
542 | - | then @ | |
543 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
544 | - | } | |
545 | - | let lpTotalSupplyUsd = fraction(lpTotalSupply, lpPrice, lpPrecision) | |
546 | - | let maxLPRewardUsd = fraction(lpMaxPeriodAmount, axlyPrice, axlyPrecision) | |
547 | - | let rtLPCoef = if (if ((preLPSupply == 0)) | |
548 | - | then true | |
549 | - | else (lpTotalSupply == 0)) | |
550 | - | then 0 | |
551 | - | else fraction(preLPSupply, SCALE8, lpTotalSupply) | |
552 | - | let rewardLp = ((min([(lpMaxAPR * (SCALE8 + rtLPCoef)), fraction(lpMaxAPR, (15 * SCALE8), 10)]) / SCALE8) / 100) | |
553 | - | let rewardLpUsd = min([maxLPRewardUsd, fraction(lpTotalSupplyUsd, rewardLp, SCALE8)]) | |
554 | - | let rewardLpPeriod = fraction(rewardLpUsd, axlyPrecision, axlyPrice) | |
555 | - | let rewardLpPerBlock = (rewardLpPeriod / periodLength) | |
556 | - | let burnLend = (lendMaxPeriodAmount - totalTokenReward) | |
557 | - | let burnLp = (lpMaxPeriodAmount - rewardLpPeriod) | |
558 | - | let inv = invoke(tokenContract, "withdrawLpReward", [(burnLend + burnLp), toString(this)], nil) | |
559 | - | if ((inv == inv)) | |
560 | - | then { | |
561 | - | let lpEnteries = [IntegerEntry(kPrevLPSupply, lpTotalSupply), IntegerEntry(kLpRewardPerBlock, rewardLpPerBlock), IntegerEntry(kLpInterest, calcNewLpInterest(lpTotalSupply)), IntegerEntry(kLpInterestHeight, max([startHeight, height])), ScriptTransfer(Address(base58'3MsXJ3BesPECkYejzBQGHZPJT8GVYy4Fd3Q'), burnLend, fromBase58String(axlyId)), ScriptTransfer(Address(base58'3MsXJ3BesPECkYejzBQGHZPJT8GVYy4Fd3Q'), burnLp, fromBase58String(axlyId))] | |
562 | - | ((lpEnteries ++ tokensEnteries) :+ IntegerEntry(kLastUpdatePeriod, lastUpdatePeriod)) | |
563 | - | } | |
564 | - | else throw("Strict value is not equal to itself.") | |
565 | - | } | |
566 | 572 | }) | |
567 | 573 | ||
568 | 574 | ||
569 | 575 | @Verifier(tx) | |
570 | 576 | func verify () = { | |
571 | 577 | let multiSignedByAdmins = { | |
572 | 578 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK)) | |
573 | 579 | then 1 | |
574 | 580 | else 0 | |
575 | 581 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], admin2PK)) | |
576 | 582 | then 1 | |
577 | 583 | else 0 | |
578 | 584 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], admin3PK)) | |
579 | 585 | then 1 | |
580 | 586 | else 0 | |
581 | 587 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
582 | 588 | } | |
583 | 589 | match tx { | |
584 | 590 | case inv: InvokeScriptTransaction => | |
585 | 591 | let isSelf = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
586 | 592 | let isRightFee = if ((inv.fee == 900000)) | |
587 | 593 | then (inv.feeAssetId == unit) | |
588 | 594 | else false | |
589 | 595 | let isInitCall = (inv.function == "init") | |
590 | 596 | let isnoPayments = (size(inv.payments) == 0) | |
591 | 597 | if (if (if (if (isRightFee) | |
592 | 598 | then isInitCall | |
593 | 599 | else false) | |
594 | 600 | then isSelf | |
595 | 601 | else false) | |
596 | 602 | then isnoPayments | |
597 | 603 | else false) | |
598 | 604 | then true | |
599 | 605 | else multiSignedByAdmins | |
600 | 606 | case _ => | |
601 | 607 | multiSignedByAdmins | |
602 | 608 | } | |
603 | 609 | } | |
604 | 610 |
github/deemru/w8io/026f985 56.24 ms ◑