dsa-connectors/contracts/arbitrum/connectors/uniswap-sell-beta/main.sol

36 lines
943 B
Solidity
Raw Normal View History

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-19 14:22:34 +00:00
) public 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
}