Skip to content

Commit 375cd81

Browse files
committed
review fixes
1 parent 755137f commit 375cd81

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

contracts/protocol/integration/amm/ArrakisUniswapV3AmmAdapter.sol

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
pragma solidity 0.6.10;
2020

21-
import "../../../interfaces/IAmmAdapter.sol";
22-
import "../../../interfaces/external/IArrakisVaultV1.sol";
2321
import "@openzeppelin/contracts/math/SafeMath.sol";
2422
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
2523
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
2624
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
2725

26+
import "../../../interfaces/IAmmAdapter.sol";
27+
import "../../../interfaces/external/IArrakisVaultV1.sol";
28+
2829
/**
2930
* @title UniswapV3AmmAdapter
3031
* @author Zishan Sami
@@ -58,6 +59,8 @@ contract ArrakisUniswapV3AmmAdapter is IAmmAdapter {
5859
* @param _uniV3Factory Address of UniswapV3 Factory contract
5960
*/
6061
constructor(address _router, address _uniV3Factory) public {
62+
require(_router != address(0),"_router address must not be zero address");
63+
require(_uniV3Factory != address(0),"_uniV3Factory address must not be zero address");
6164
router = _router;
6265
uniV3Factory = IUniswapV3Factory(_uniV3Factory);
6366
}
@@ -240,18 +243,23 @@ contract ArrakisUniswapV3AmmAdapter is IAmmAdapter {
240243
return false;
241244
}
242245

243-
// Make sure the tokens stored in the arrakis pools matches the
244-
// tokens provided in the components
245-
if (
246-
_components.length != 2 ||
247-
!(token0 == _components[0] || token0 == _components[1]) ||
248-
!(token1 == _components[0] || token1 == _components[1])
249-
) {
246+
// Make sure that components length is two
247+
if (_components.length != 2) {
248+
return false;
249+
}
250+
251+
// Make sure that _components[0] is either of token0 or token1
252+
if (!(_components[0] == token0 || _components[0] == token1) ) {
253+
return false;
254+
}
255+
256+
// Make sure that _components[1] is either of token0 or token1
257+
if (!(_components[1] == token0 || _components[1] == token1) ) {
250258
return false;
251259
}
252260

253261
// Make sure the pool address follows IERC20 interface
254-
try IArrakisVaultV1(_pool).totalSupply() returns (uint256 _totalSupply) {
262+
try IArrakisVaultV1(_pool).totalSupply() returns (uint256) {
255263
} catch {
256264
return false;
257265
}

0 commit comments

Comments
 (0)