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

questions #15

Merged
merged 10 commits into from
Jul 8, 2024
7 changes: 6 additions & 1 deletion src/ReservoirPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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?
xenide marked this conversation as resolved.
Show resolved Hide resolved
/// @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`.
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
Loading