Skip to content

Commit c2daf0f

Browse files
committed
remove uniswapFactory in UniswapPairPriceAdapter
1 parent b99255f commit c2daf0f

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

contracts/protocol/integration/oracles/UniswapPairPriceAdapter.sol

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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++) {
@@ -200,10 +194,7 @@ contract UniswapPairPriceAdapter is Ownable {
200194
uint256 tokenTwoPriceToMaster = _priceOracle.getPrice(poolInfo.tokenTwo, _masterQuoteAsset);
201195

202196
// Get reserve amounts
203-
(
204-
uint256 tokenOneReserves,
205-
uint256 tokenTwoReserves
206-
) = UniswapV2Library.getReserves(uniswapFactory, poolInfo.tokenOne, poolInfo.tokenTwo);
197+
(uint256 tokenOneReserves, uint256 tokenTwoReserves, ) = IUniswapV2Pair(_poolAddress).getReserves();
207198

208199
uint256 normalizedTokenOneBaseUnit = tokenOneReserves.preciseDiv(poolInfo.tokenOneBaseUnit);
209200
uint256 normalizedTokenBaseTwoUnits = tokenTwoReserves.preciseDiv(poolInfo.tokenTwoBaseUnit);

0 commit comments

Comments
 (0)