SetProtocol / set-protocol-v2

Set Protocol V2
118 stars 94 forks source link

fix: prevent getPrice from revert in UniswapPairPriceAdapter #235

Open gzliudan opened 2 years ago

gzliudan commented 2 years ago

Now function getPrice in UniswapPairPriceAdapter maybe revert when call function priceOracle.getPrice in function getPrice or _getUniswapPrice. This will prevent other oracle adapters which added after UniswapPairPriceAdapter from provide price. To resolve this issue, I use try/catch clause to check revert case. When revert, new version of getPrice will return (false, 0);