|
987 | 987 | .List
|
988 | 988 | </contract-fn-return-names>
|
989 | 989 | <contract-fn-body>
|
990 |
| - { uint256 i ; while ( i < path . length - 1 ) { { address input = path [ i ] ; address output = path [ i + 1 ] ; address [ ] memory tokens = uniswapV2Library_sortTokens ( input , output , .TypedVals ) ; uint256 amountOut = amounts [ i + 1 ] ; uint256 amount0Out = input == tokens [ 0 ] ? uint256 ( 0 , .TypedVals ) : amountOut ; uint256 amount1Out = input == tokens [ 0 ] ? amountOut : uint256 ( 0 , .TypedVals ) ; address to = i < path . length - 2 ? uniswapV2Library_pairFor ( output , path [ i + 2 ] , .TypedVals ) : _to ; UniswapV2Pair ( uniswapV2Library_pairFor ( input , output , .TypedVals ) , .TypedVals ) . swap ( amount0Out , amount1Out , to , .TypedVals ) ; .Statements } i ++ ; .Statements } .Statements } .Statements |
| 990 | + for ( uint256 i ; i < path . length - 1 ; i ++ ) { address input = path [ i ] ; address output = path [ i + 1 ] ; address [ ] memory tokens = uniswapV2Library_sortTokens ( input , output , .TypedVals ) ; uint256 amountOut = amounts [ i + 1 ] ; uint256 amount0Out = input == tokens [ 0 ] ? uint256 ( 0 , .TypedVals ) : amountOut ; uint256 amount1Out = input == tokens [ 0 ] ? amountOut : uint256 ( 0 , .TypedVals ) ; address to = i < path . length - 2 ? uniswapV2Library_pairFor ( output , path [ i + 2 ] , .TypedVals ) : _to ; UniswapV2Pair ( uniswapV2Library_pairFor ( input , output , .TypedVals ) , .TypedVals ) . swap ( amount0Out , amount1Out , to , .TypedVals ) ; .Statements } .Statements |
991 | 991 | </contract-fn-body>
|
992 | 992 | </contract-fn> <contract-fn>
|
993 | 993 | <contract-fn-id>
|
|
1213 | 1213 | ListItem ( amounts )
|
1214 | 1214 | </contract-fn-return-names>
|
1215 | 1215 | <contract-fn-body>
|
1216 |
| - require ( path . length >= 2 , "UniswapV2Library: INVALID_PATH" , .TypedVals ) ; amounts = new uint256 [ ] ( path . length , .TypedVals ) ; amounts [ amounts . length - 1 ] = amountOut ; { uint256 i = path . length - 1 ; while ( i > 0 ) { { uint256 [ ] memory reserves = uniswapV2Library_getReserves ( path [ i - 1 ] , path [ i ] , .TypedVals ) ; amounts [ i - 1 ] = uniswapV2Library_getAmountIn ( amounts [ i ] , reserves [ 0 ] , reserves [ 1 ] , .TypedVals ) ; .Statements } i -- ; .Statements } .Statements } .Statements |
| 1216 | + require ( path . length >= 2 , "UniswapV2Library: INVALID_PATH" , .TypedVals ) ; amounts = new uint256 [ ] ( path . length , .TypedVals ) ; amounts [ amounts . length - 1 ] = amountOut ; for ( uint256 i = path . length - 1 ; i > 0 ; i -- ) { uint256 [ ] memory reserves = uniswapV2Library_getReserves ( path [ i - 1 ] , path [ i ] , .TypedVals ) ; amounts [ i - 1 ] = uniswapV2Library_getAmountIn ( amounts [ i ] , reserves [ 0 ] , reserves [ 1 ] , .TypedVals ) ; .Statements } .Statements |
1217 | 1217 | </contract-fn-body>
|
1218 | 1218 | </contract-fn> <contract-fn>
|
1219 | 1219 | <contract-fn-id>
|
|
1237 | 1237 | ListItem ( amounts )
|
1238 | 1238 | </contract-fn-return-names>
|
1239 | 1239 | <contract-fn-body>
|
1240 |
| - require ( path . length >= 2 , "UniswapV2Library: INVALID_PATH" , .TypedVals ) ; amounts = new uint256 [ ] ( path . length , .TypedVals ) ; amounts [ 0 ] = amountIn ; { uint256 i ; while ( i < path . length - 1 ) { { uint256 [ ] memory reserves = uniswapV2Library_getReserves ( path [ i ] , path [ i + 1 ] , .TypedVals ) ; amounts [ i + 1 ] = uniswapV2Library_getAmountOut ( amounts [ i ] , reserves [ 0 ] , reserves [ 1 ] , .TypedVals ) ; .Statements } i ++ ; .Statements } .Statements } .Statements |
| 1240 | + require ( path . length >= 2 , "UniswapV2Library: INVALID_PATH" , .TypedVals ) ; amounts = new uint256 [ ] ( path . length , .TypedVals ) ; amounts [ 0 ] = amountIn ; for ( uint256 i ; i < path . length - 1 ; i ++ ) { uint256 [ ] memory reserves = uniswapV2Library_getReserves ( path [ i ] , path [ i + 1 ] , .TypedVals ) ; amounts [ i + 1 ] = uniswapV2Library_getAmountOut ( amounts [ i ] , reserves [ 0 ] , reserves [ 1 ] , .TypedVals ) ; .Statements } .Statements |
1241 | 1241 | </contract-fn-body>
|
1242 | 1242 | </contract-fn> <contract-fn>
|
1243 | 1243 | <contract-fn-id>
|
|
0 commit comments