-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Filipp Makarov
authored and
Filipp Makarov
committed
Nov 22, 2024
1 parent
950b583
commit afd60e0
Showing
3 changed files
with
33 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,22 @@ pragma solidity ^0.8.27; | |
|
||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; | ||
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; | ||
//import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; | ||
import "@uniswap/v3-periphery/contracts/interfaces/IPeripheryPayments.sol"; | ||
|
||
interface ISwapRouter { | ||
struct ExactInputSingleParams { | ||
address tokenIn; | ||
address tokenOut; | ||
uint24 fee; | ||
address recipient; | ||
uint256 amountIn; | ||
uint256 amountOutMinimum; | ||
uint160 sqrtPriceLimitX96; | ||
} | ||
function exactInputSingle(ExactInputSingleParams memory params) external payable returns (uint256 amountOut); | ||
} | ||
|
||
/** | ||
* @title Uniswapper | ||
* @author ShivaanshK<[email protected]> | ||
|
@@ -59,7 +72,7 @@ abstract contract Uniswapper { | |
tokenOut: wrappedNative, | ||
fee: tokenToPools[tokenIn], | ||
recipient: address(this), | ||
deadline: block.timestamp, | ||
//deadline: block.timestamp, | ||
amountIn: amountIn, | ||
amountOutMinimum: minAmountOut, | ||
sqrtPriceLimitX96: 0 | ||
|
@@ -75,6 +88,7 @@ abstract contract Uniswapper { | |
|
||
function _unwrapWeth(uint256 amount) internal { | ||
if(amount == 0) return; | ||
IERC20(wrappedNative).transfer(address(uniswapRouter), amount); | ||
IPeripheryPayments(address(uniswapRouter)).unwrapWETH9(amount, address(this)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,5 +71,6 @@ | |
"lint:ts-fix": "pnpm prettier --write 'test/**/*.ts' 'scripts/**/*.ts'", | ||
"lint:sol-fix": "pnpm prettier --write 'contracts/**/*.sol' && pnpm solhint 'contracts/**/*.sol' --fix --noPrompt && forge fmt", | ||
"lint:fix": "pnpm run lint:sol-fix && pnpm run lint:ts-fix" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.beb9e2a803db336c10c9af682b58ad7181ca0fbd0d4119f2b33d5f2582e96d6c0d93c85b23869295b765170fbdaa92890c0da6ada457415039769edf3c959efe" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters