Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rseth ezeth oracles #29

Merged
merged 6 commits into from
Feb 12, 2025
Merged

Add rseth ezeth oracles #29

merged 6 commits into from
Feb 12, 2025

Conversation

hexonaut
Copy link
Contributor

@hexonaut hexonaut commented Feb 5, 2025

rsETH and ezETH are planned to be onboarded, so we need exchange rate oracles for them.

Copy link
Contributor

@lucas-manuel lucas-manuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small changes

function latestAnswer() external view returns (int256) {
int256 ethUsd = ethSource.latestAnswer();
(, , uint256 tvl) = oracle.calculateTVLs();
int256 exchangeRate = int256(((tvl * 1e18) / ezETH.totalSupply()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int256 exchangeRate = int256(((tvl * 1e18) / ezETH.totalSupply()));
( ,, uint256 tvl ) = oracle.calculateTVLs();

Copy link
Contributor Author

@hexonaut hexonaut Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These diffs are weird, but I think you wanted the spacing fixed on the return calculate tvls value. Changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int256(tvl * 1e18 / ezETH.totalSupply());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah wtf why did I put so many brackets. fixed

}

function calculateTVLs() external view returns (uint256[][] memory , uint256[] memory, uint256 _exchangeRate) {
_exchangeRate = exchangeRate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_exchangeRate = exchangeRate;
function calculateTVLs() external view returns (uint256[][] memory, uint256[] memory, uint256 _exchangeRate) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you want changed here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hahah damn just uint256[][] memory , => uint256[][] memory, for first return param

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

_exchangeRate = exchangeRate;
}

function totalSupply() external view returns (uint256) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link

Coverage after merging add-rseth-ezeth-oracles into master will be

98.36%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   CappedFallbackRateSource.sol100%100%100%100%
   CappedOracle.sol100%100%100%100%
   EZETHExchangeRateOracle.sol100%100%100%100%
   FixedPriceOracle.sol100%100%100%100%
   MorphoUpgradableOracle.sol100%100%100%100%
   PotRateSource.sol100%100%100%100%
   RETHExchangeRateOracle.sol100%100%100%100%
   RSETHExchangeRateOracle.sol100%100%100%100%
   RateTargetBaseInterestRateStrategy.sol100%100%100%100%
   RateTargetKinkInterestRateStrategy.sol100%100%100%100%
   SSRRateSource.sol100%100%100%100%
   VariableBorrowInterestRateStrategy.sol93.94%83.33%100%93.62%119, 123, 127, 71
   WEETHExchangeRateOracle.sol100%100%100%100%
   WSTETHExchangeRateOracle.sol100%100%100%100%

@hexonaut hexonaut merged commit 338c371 into master Feb 12, 2025
3 checks passed
@hexonaut hexonaut deleted the add-rseth-ezeth-oracles branch February 12, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants