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

42 lines
1.1 KiB
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-20 10:30:56 +00:00
import {Events} from "./events.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-20 10:30:56 +00:00
contract uniswapSellBeta is Helpers, Events {
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-20 10:51:36 +00:00
uint256 amountOutMinimum
2021-11-20 10:30:56 +00:00
)
external
payable
returns (string memory _eventName, bytes memory _eventParam)
{
2021-11-20 10:51:36 +00:00
IERC20(tokenIn).safeApprove(address(router), amountIn);
2021-11-20 10:30:56 +00:00
uint256 amountOut = swapSingleInput(
2021-11-19 12:59:55 +00:00
getParams(
2021-11-20 10:51:36 +00:00
tokenIn,
tokenOut,
2021-11-19 23:20:26 +00:00
address(this),
2021-11-19 12:59:55 +00:00
fee,
2021-11-19 14:28:35 +00:00
amountIn,
2021-11-20 10:51:36 +00:00
amountOutMinimum
2021-11-19 12:59:55 +00:00
)
);
2021-11-20 10:51:36 +00:00
_eventName = "LogSell(uint24,uint256,uint256,uint256)";
2021-11-20 12:27:45 +00:00
_eventParam = abi.encode(fee, amountIn, amountOut, amountOutMinimum);
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
}