From 8f6041409090bfe536625d65eda2ae9fff164fb8 Mon Sep 17 00:00:00 2001 From: OliverNChalk <11343499+OliverNChalk@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:15:43 -0500 Subject: [PATCH] questions --- src/ReservoirPriceOracle.sol | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ReservoirPriceOracle.sol b/src/ReservoirPriceOracle.sol index 5e9fe8d..2562040 100644 --- a/src/ReservoirPriceOracle.sol +++ b/src/ReservoirPriceOracle.sol @@ -113,6 +113,7 @@ contract ReservoirPriceOracle is IPriceOracle, IReservoirPriceOracle, Owned(msg. (rRoute,,) = _getRouteDecimalDifferencePrice(aToken0, aToken1); } + // REVIEW: Is this intended primarily for debugging? Because this won't work on composite routes right? /// @notice The latest cached geometric TWAP of token0/token1. /// Stored in the form of a 18 decimal fixed point number. /// Supported price range: 1wei to `Constants.MAX_SUPPORTED_PRICE`. @@ -153,7 +154,9 @@ contract ReservoirPriceOracle is IPriceOracle, IReservoirPriceOracle, Owned(msg. ); // if it's a simple route, we avoid loading the price again from storage - if (lRoute.length != 2) (lPrevPrice,) = _priceCache(lToken0, lToken1); + if (lRoute.length != 2) { + (lPrevPrice,) = _priceCache(lToken0, lToken1); + } _writePriceCache(lToken0, lToken1, lNewPrice); @@ -239,6 +242,8 @@ contract ReservoirPriceOracle is IPriceOracle, IReservoirPriceOracle, Owned(msg. } if (lPayoutAmt <= address(this).balance) { + // REVIEW: This can still revert, rather than balance checking we + // could just try/catch or use Yul to ignore reverts? payable(aRecipient).transfer(lPayoutAmt); } // do nothing if lPayoutAmt is greater than the balance