https://github.com/kinetic-market/public-money-market-contracts
In the RedeemBurnRateCalculatorV3
contract, the value of the useOraclePrice
variable determines whether the price is retrieved from the price oracle contract or from Uniswap V3. However, this value is immutable, meaning the contract can only retrieve the price from one source.
Here is the relevant code:
function shouldSkipBurnRate(
address user,
uint256 /*amount*/
) external view override returns (bool) {
if (_exclusionListedAddresses.contains(user))
return false;
if (useOraclePrice) {
uint256 price = priceOracle.getPrice(address(protocolToken));
return ((price * esProtocolToken.balanceOf(user) / (10**esProtocolTokenDecimals)) > burnRateThresholdUSD);
}
uint amountOut = getAmountOut();
uint esProtocolWNativePrice = amountOut * esProtocolToken.balanceOf(user) / (10**esProtocolTokenDecimals);
uint sNativePrice = priceOracle.getPrice(address(sETH));
esProtocolWNativePrice = esProtocolWNativePrice * sNativePrice / (10**sETHDecimals);
return esProtocolWNativePrice > burnRateThresholdUSD;
}
The current implementation restricts the contract to always retrieve prices from only one oracle. This limits flexibility and could be suboptimal depending on the situation.
It is recommended to add functionality to adjust the useOraclePrice
variable dynamically. This would allow the contract to switch between price sources based on certain conditions, providing more flexibility and responsiveness to market conditions.
https://github.com/kinetic-market/public-money-market-contracts/blob/d46f5223344ff6502349549ad858588e496483df/contracts/Tokenomics/RedeemBurnRateCalculatorV3.sol#L148-L152