mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Uniswap sell beta connector done
This commit is contained in:
parent
c952949ded
commit
07d9240556
|
@ -5,7 +5,6 @@ contract Events {
|
|||
uint24 fee,
|
||||
uint256 amountIn,
|
||||
uint256 amountOut,
|
||||
uint256 amountOutMinimum,
|
||||
bool zeroForOne
|
||||
uint256 amountOutMinimum
|
||||
);
|
||||
}
|
||||
|
|
|
@ -85,8 +85,7 @@ contract Helpers {
|
|||
address recipient,
|
||||
uint24 fee,
|
||||
uint256 amountIn,
|
||||
uint256 amountOutMinimum,
|
||||
bool zeroForOne
|
||||
uint256 amountOutMinimum
|
||||
) internal view returns (ISwapRouter.ExactInputSingleParams memory params) {
|
||||
params = ISwapRouter.ExactInputSingleParams({
|
||||
tokenIn: tokenIn,
|
||||
|
@ -98,7 +97,7 @@ contract Helpers {
|
|||
amountOutMinimum: amountOutMinimum,
|
||||
sqrtPriceLimitX96: getPriceLimit(
|
||||
amountIn,
|
||||
zeroForOne,
|
||||
tokenIn < tokenOut,
|
||||
tokenIn,
|
||||
tokenOut,
|
||||
fee
|
||||
|
|
|
@ -14,37 +14,29 @@ contract uniswapSellBeta is Helpers, Events {
|
|||
address tokenOut,
|
||||
uint24 fee,
|
||||
uint256 amountIn,
|
||||
uint256 amountOutMinimum,
|
||||
bool zeroForOne
|
||||
uint256 amountOutMinimum
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
(address token0, address token1) = SwapTokens(
|
||||
tokenIn,
|
||||
tokenOut,
|
||||
zeroForOne
|
||||
);
|
||||
IERC20(token0).safeApprove(address(router), amountIn);
|
||||
IERC20(tokenIn).safeApprove(address(router), amountIn);
|
||||
uint256 amountOut = swapSingleInput(
|
||||
getParams(
|
||||
token0,
|
||||
token1,
|
||||
tokenIn,
|
||||
tokenOut,
|
||||
address(this),
|
||||
fee,
|
||||
amountIn,
|
||||
amountOutMinimum,
|
||||
zeroForOne
|
||||
amountOutMinimum
|
||||
)
|
||||
);
|
||||
_eventName = "LogSell(uint24,uint256,uint256,uint256,bool)";
|
||||
_eventName = "LogSell(uint24,uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(
|
||||
fee,
|
||||
amountIn,
|
||||
amountOut,
|
||||
amountOutMinimum,
|
||||
zeroForOne
|
||||
amountOutMinimum
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user