@@ -60,27 +60,21 @@ contract UniswapPairPriceAdapter is Ownable {
6060 // Uniswap allowed pools
6161 address [] public allowedUniswapPools;
6262
63- // Address of Uniswap factory
64- address public uniswapFactory;
65-
6663 /* ============ Constructor ============ */
6764
6865 /**
6966 * Set state variables
7067 *
7168 * @param _controller Instance of controller contract
72- * @param _uniswapFactory Address of Uniswap factory
7369 * @param _uniswapPools Array of allowed Uniswap pools
7470 */
7571 constructor (
7672 IController _controller ,
77- address _uniswapFactory ,
7873 IUniswapV2Pair[] memory _uniswapPools
7974 )
8075 public
8176 {
8277 controller = _controller;
83- uniswapFactory = _uniswapFactory;
8478
8579 // Add each of initial addresses to state
8680 for (uint256 i = 0 ; i < _uniswapPools.length ; i++ ) {
@@ -199,11 +193,7 @@ contract UniswapPairPriceAdapter is Ownable {
199193 uint256 tokenOnePriceToMaster = _priceOracle.getPrice (poolInfo.tokenOne, _masterQuoteAsset);
200194 uint256 tokenTwoPriceToMaster = _priceOracle.getPrice (poolInfo.tokenTwo, _masterQuoteAsset);
201195
202- // Get reserve amounts
203- (
204- uint256 tokenOneReserves ,
205- uint256 tokenTwoReserves
206- ) = UniswapV2Library.getReserves (uniswapFactory, poolInfo.tokenOne, poolInfo.tokenTwo);
196+ (uint256 tokenOneReserves , uint256 tokenTwoReserves , ) = IUniswapV2Pair (_poolAddress).getReserves ();
207197
208198 uint256 normalizedTokenOneBaseUnit = tokenOneReserves.preciseDiv (poolInfo.tokenOneBaseUnit);
209199 uint256 normalizedTokenBaseTwoUnits = tokenTwoReserves.preciseDiv (poolInfo.tokenTwoBaseUnit);
0 commit comments