2021-11-19 12:59:55 +00:00
|
|
|
pragma solidity ^0.7.6;
|
|
|
|
pragma abicoder v2;
|
|
|
|
|
|
|
|
import "./helpers.sol";
|
2021-11-19 23:20:26 +00:00
|
|
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
|
|
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
2021-11-19 12:59:55 +00:00
|
|
|
|
2021-11-19 14:40:44 +00:00
|
|
|
contract uniswapSellBeta is Helpers {
|
2021-11-19 23:20:26 +00:00
|
|
|
using SafeERC20 for IERC20;
|
|
|
|
|
2021-11-19 12:59:55 +00:00
|
|
|
function sell(
|
|
|
|
address tokenIn,
|
|
|
|
address tokenOut,
|
|
|
|
uint24 fee,
|
2021-11-19 14:28:35 +00:00
|
|
|
uint256 amountIn,
|
2021-11-19 23:20:26 +00:00
|
|
|
uint256 amountOutMinimum
|
2021-11-20 09:08:36 +00:00
|
|
|
) external payable returns (uint256 amountOut) {
|
2021-11-19 23:20:26 +00:00
|
|
|
IERC20(tokenIn).safeApprove(address(router), amountIn);
|
2021-11-19 14:22:34 +00:00
|
|
|
amountOut = swapSingleInput(
|
2021-11-19 12:59:55 +00:00
|
|
|
getParams(
|
2021-11-19 23:20:26 +00:00
|
|
|
tokenIn,
|
|
|
|
tokenOut,
|
|
|
|
address(this),
|
2021-11-19 12:59:55 +00:00
|
|
|
fee,
|
2021-11-19 14:28:35 +00:00
|
|
|
amountIn,
|
2021-11-19 12:59:55 +00:00
|
|
|
amountOutMinimum,
|
2021-11-19 23:20:26 +00:00
|
|
|
tokenOut > tokenIn
|
2021-11-19 12:59:55 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-19 23:20:26 +00:00
|
|
|
contract ConnectV2UniswapSellBeta is uniswapSellBeta {
|
|
|
|
string public constant name = "Uniswap-Sell-Beta";
|
2021-11-19 12:59:55 +00:00
|
|
|
}
|