Skip to content

Commit

Permalink
fix: addresses #5
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Dec 7, 2024
1 parent 1cbb74c commit 97d95ff
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ReservoirPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,12 @@ contract ReservoirPriceOracle is IPriceOracle, Owned(msg.sender), ReentrancyGuar
_getRouteDecimalDifferencePrice(lToken0, lToken1);

if (lRoute.length == 0) {
// There is one case where the behavior is a bit more unexpected, and that is when
// `aBase` is an empty contract, and the revert would not be caught at all, causing
// the entire operation to fail. But this is okay, because if `aBase` is not a contract, trying
// to use the fallbackOracle would not yield any results anyway.
// There are two cases where the behavior is a bit more unexpected, and that is when:
// (1) `aBase` is an empty contract, and the revert would not be caught at all, causing
// the entire operation to fail.
// (2) an error happens when decoding the return data (specifically the return data length)
// But this is okay, because if `aBase` is not a contract or tries to return different types,
// trying to use the fallbackOracle would not yield any results anyway.
// An alternative would be to use a low level `staticcall`.
try IERC4626(aBase).asset() returns (address rBaseAsset) {
uint256 lResolvedAmountIn = IERC4626(aBase).convertToAssets(aAmount);
Expand Down

0 comments on commit 97d95ff

Please sign in to comment.