From 670aab888bcf4ab9989247e88d15304d05947f34 Mon Sep 17 00:00:00 2001 From: aazhou1 Date: Fri, 20 Dec 2024 11:43:20 -0800 Subject: [PATCH] extra discount rate returned from validate and insert removed --- src/RepoTokenList.sol | 13 ++++++------- src/Strategy.sol | 2 +- src/TermAuctionList.sol | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/RepoTokenList.sol b/src/RepoTokenList.sol index e5d56354..0656edd1 100644 --- a/src/RepoTokenList.sol +++ b/src/RepoTokenList.sol @@ -340,7 +340,6 @@ library RepoTokenList { * @param discountRateAdapter The discount rate adapter * @param asset The address of the base asset * @return validRepoToken Whether the repoToken is valid - * @return discountRate The discount rate to be applied to the validated repoToken * @return redemptionTimestamp The redemption timestamp of the validated repoToken */ function validateAndInsertRepoToken( @@ -348,14 +347,14 @@ library RepoTokenList { ITermRepoToken repoToken, ITermDiscountRateAdapter discountRateAdapter, address asset - ) internal returns (bool validRepoToken, uint256 discountRate, uint256 redemptionTimestamp) { - discountRate = listData.discountRates[address(repoToken)]; + ) internal returns (bool validRepoToken, uint256 redemptionTimestamp) { + uint256 discountRate = listData.discountRates[address(repoToken)]; if (discountRate != INVALID_AUCTION_RATE) { (redemptionTimestamp, , ,) = repoToken.config(); // skip matured repoTokens if (redemptionTimestamp < block.timestamp) { - return (false, discountRate, redemptionTimestamp); //revert InvalidRepoToken(address(repoToken)); + return (false, redemptionTimestamp); //revert InvalidRepoToken(address(repoToken)); } uint256 oracleRate; @@ -374,20 +373,20 @@ library RepoTokenList { discountRate = rate == 0 ? ZERO_AUCTION_RATE : rate; } catch { discountRate = INVALID_AUCTION_RATE; - return (false, discountRate, redemptionTimestamp); + return (false, redemptionTimestamp); } bool isRepoTokenValid; (isRepoTokenValid, redemptionTimestamp) = validateRepoToken(listData, repoToken, asset); if (!isRepoTokenValid) { - return (false, discountRate, redemptionTimestamp); + return (false, redemptionTimestamp); } insertSorted(listData, address(repoToken)); listData.discountRates[address(repoToken)] = discountRate; } - return (true, discountRate, redemptionTimestamp); + return (true, redemptionTimestamp); } /** diff --git a/src/Strategy.sol b/src/Strategy.sol index 75ea189a..e9e1b2bf 100644 --- a/src/Strategy.sol +++ b/src/Strategy.sol @@ -1084,7 +1084,7 @@ contract Strategy is BaseStrategy, Pausable, AccessControl { } // Validate and insert the repoToken into the list, retrieve auction rate and redemption timestamp - (bool isRepoTokenValid , , uint256 redemptionTimestamp) = repoTokenListData + (bool isRepoTokenValid , uint256 redemptionTimestamp) = repoTokenListData .validateAndInsertRepoToken( ITermRepoToken(repoToken), strategyState.discountRateAdapter, diff --git a/src/TermAuctionList.sol b/src/TermAuctionList.sol index 7ae55a64..783e1e5b 100644 --- a/src/TermAuctionList.sol +++ b/src/TermAuctionList.sol @@ -187,7 +187,7 @@ library TermAuctionList { // because the offerLocker will have already removed the offer. // This applies if the repoToken hasn't been added to the repoTokenList // (only for new auctions, not reopenings). - (bool isValidRepoToken, , uint256 redemptionTimestamp ) = repoTokenListData.validateAndInsertRepoToken( + (bool isValidRepoToken, uint256 redemptionTimestamp ) = repoTokenListData.validateAndInsertRepoToken( ITermRepoToken(offer.repoToken), discountRateAdapter, asset ); if (!isValidRepoToken && block.timestamp > redemptionTimestamp) {