You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I'm facing issue with UniswapPairPriceAdapter. I've add the pools but getPrice returns always false.
I think this is because of a bug in the contract.
addPool function saves into uniswapPoolsToSettings by the pool address
But getPrice function check by the assets addresses
function getPrice(address _assetOne, address _assetTwo) external view returns (bool, uint256) {
require(controller.isSystemContract(msg.sender), "Must be system contract");
bool isAllowedUniswapPoolOne = uniswapPoolsToSettings[_assetOne].isValid;
bool isAllowedUniswapPoolTwo = uniswapPoolsToSettings[_assetTwo].isValid;
// If assetOne and assetTwo are both not Uniswap pools, then return false
if (!isAllowedUniswapPoolOne && !isAllowedUniswapPoolTwo) {
return (false, 0);
}
IPriceOracle priceOracle = controller.getPriceOracle();
address masterQuoteAsset = priceOracle.masterQuoteAsset();
uint256 assetOnePriceToMaster;
if(isAllowedUniswapPoolOne) {
assetOnePriceToMaster = _getUniswapPrice(priceOracle, _assetOne, masterQuoteAsset);
} else {
assetOnePriceToMaster = priceOracle.getPrice(_assetOne, masterQuoteAsset);
}
uint256 assetTwoPriceToMaster;
if(isAllowedUniswapPoolTwo) {
assetTwoPriceToMaster = _getUniswapPrice(priceOracle, _assetTwo, masterQuoteAsset);
} else {
assetTwoPriceToMaster = priceOracle.getPrice(_assetTwo, masterQuoteAsset);
}
return (true, assetOnePriceToMaster.preciseDiv(assetTwoPriceToMaster));
}
So this will be return always false
// If assetOne and assetTwo are both not Uniswap pools, then return false
if (!isAllowedUniswapPoolOne && !isAllowedUniswapPoolTwo) {
return (false, 0);
}
Am I missing something?
The text was updated successfully, but these errors were encountered:
Hello! I'm facing issue with UniswapPairPriceAdapter. I've add the pools but getPrice returns always false.
I think this is because of a bug in the contract.
addPool function saves into uniswapPoolsToSettings by the pool address
But getPrice function check by the assets addresses
So this will be return always false
Am I missing something?
The text was updated successfully, but these errors were encountered: