|
18 | 18 |
|
19 | 19 | pragma solidity 0.6.10;
|
20 | 20 |
|
21 |
| -import "../../../interfaces/IAmmAdapter.sol"; |
22 |
| -import "../../../interfaces/external/IArrakisVaultV1.sol"; |
23 | 21 | import "@openzeppelin/contracts/math/SafeMath.sol";
|
24 | 22 | import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
25 | 23 | import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
|
26 | 24 | import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
|
27 | 25 |
|
| 26 | +import "../../../interfaces/IAmmAdapter.sol"; |
| 27 | +import "../../../interfaces/external/IArrakisVaultV1.sol"; |
| 28 | + |
28 | 29 | /**
|
29 | 30 | * @title UniswapV3AmmAdapter
|
30 | 31 | * @author Zishan Sami
|
@@ -58,6 +59,8 @@ contract ArrakisUniswapV3AmmAdapter is IAmmAdapter {
|
58 | 59 | * @param _uniV3Factory Address of UniswapV3 Factory contract
|
59 | 60 | */
|
60 | 61 | 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"); |
61 | 64 | router = _router;
|
62 | 65 | uniV3Factory = IUniswapV3Factory(_uniV3Factory);
|
63 | 66 | }
|
@@ -240,18 +243,23 @@ contract ArrakisUniswapV3AmmAdapter is IAmmAdapter {
|
240 | 243 | return false;
|
241 | 244 | }
|
242 | 245 |
|
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) ) { |
250 | 258 | return false;
|
251 | 259 | }
|
252 | 260 |
|
253 | 261 | // Make sure the pool address follows IERC20 interface
|
254 |
| - try IArrakisVaultV1(_pool).totalSupply() returns (uint256 _totalSupply) { |
| 262 | + try IArrakisVaultV1(_pool).totalSupply() returns (uint256) { |
255 | 263 | } catch {
|
256 | 264 | return false;
|
257 | 265 | }
|
|
0 commit comments