@@ -20,6 +20,7 @@ pragma solidity 0.6.10;
20
20
pragma experimental "ABIEncoderV2 " ;
21
21
22
22
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol " ;
23
+ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol " ;
23
24
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol " ;
24
25
25
26
import { IUniswapV2Factory } from "../interfaces/external/IUniswapV2Factory.sol " ;
@@ -38,6 +39,7 @@ import { PreciseUnitMath } from "../lib/PreciseUnitMath.sol";
38
39
*/
39
40
contract AMMSplitter {
40
41
42
+ using SafeERC20 for IERC20 ;
41
43
using SafeMath for uint256 ;
42
44
using PreciseUnitMath for uint256 ;
43
45
@@ -133,7 +135,7 @@ contract AMMSplitter {
133
135
_checkPath (_path);
134
136
135
137
IERC20 inputToken = IERC20 (_path[0 ]);
136
- inputToken.transferFrom (msg .sender , address (this ), _amountIn);
138
+ inputToken.safeTransferFrom (msg .sender , address (this ), _amountIn);
137
139
138
140
TradeInfo memory tradeInfo = _getTradeSizes (_path, _amountIn);
139
141
@@ -191,7 +193,7 @@ contract AMMSplitter {
191
193
require (totalInput <= _amountInMax, "AMMSplitter: INSUFFICIENT_INPUT_AMOUNT " );
192
194
193
195
IERC20 inputToken = IERC20 (_path[0 ]);
194
- inputToken.transferFrom (msg .sender , address (this ), totalInput);
196
+ inputToken.safeTransferFrom (msg .sender , address (this ), totalInput);
195
197
196
198
_checkApprovals (expectedUniInput, expectedSushiInput, inputToken);
197
199
@@ -328,7 +330,7 @@ contract AMMSplitter {
328
330
*
329
331
* This equation is derived using several assumptions. First, it assumes that the price impact is equal to 2T / P where T is
330
332
* equal to the trade size, and P is equal to the pool size. This approximation holds given that the price impact is a small percentage.
331
- * The second approximation made is that when executing trades that utilize multiple hops, total price impact is the sum of the each
333
+ * The second approximation made is that when executing trades that utilize multiple hops, total price impact is the sum of each
332
334
* hop's price impact (not accounting for the price impact of the prior trade). This approximation again holds true under the assumption
333
335
* that the total price impact is a small percentage. The full derivation of this equation can be viewed in STIP-002.
334
336
*
0 commit comments