File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
AxelarHandler/src/libraries Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ library SkipSwapRouter {
23
23
bytes memory swapData
24
24
) public returns (uint256 amountOut ) {
25
25
uint256 preBalIn = IERC20 (inputToken).balanceOf (address (this )) - amountIn;
26
- uint256 preBalOut = IERC20 (outputToken).balanceOf (address (this ));
26
+
27
+ uint256 preBalOut =
28
+ outputToken == address (0 ) ? address (this ).balance : IERC20 (outputToken).balanceOf (address (this ));
27
29
28
30
IERC20 (inputToken).forceApprove (router, amountIn);
29
31
@@ -33,7 +35,11 @@ library SkipSwapRouter {
33
35
_revertWithData (returnData);
34
36
}
35
37
36
- amountOut = IERC20 (outputToken).balanceOf (address (this )) - preBalOut;
38
+ if (outputToken == address (0 )) {
39
+ amountOut = address (this ).balance - preBalOut;
40
+ } else {
41
+ amountOut = IERC20 (outputToken).balanceOf (address (this )) - preBalOut;
42
+ }
37
43
38
44
uint256 dust = IERC20 (inputToken).balanceOf (address (this )) - preBalIn;
39
45
You can’t perform that action at this time.
0 commit comments