mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
fixes
Signed-off-by: pradyuman-verma <pradyumnverma27@gmail.com>
This commit is contained in:
parent
128fff7488
commit
3b280ee38e
contracts
arbitrum/connectors/uniswap/v3_swap
mainnet/connectors/uniswap/v3_swap
optimism/connectors/uniswap/v3_swap
polygon/connectors/uniswap/v3_swap
|
@ -53,7 +53,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
_sellAddr.decimals(),
|
||||
wmul(buyData.unitAmt, convertTo18(_buyAddr.decimals(), _buyAmt))
|
||||
);
|
||||
bool isEth = address(_sellAddr) == ethAddr;
|
||||
bool isEth = address(buyData.sellAddr) == ethAddr;
|
||||
convertEthToWeth(isEth, _sellAddr, _slippageAmt);
|
||||
approve(_sellAddr, address(swapRouter), _slippageAmt);
|
||||
|
||||
|
@ -70,8 +70,8 @@ abstract contract Helpers is DSMath, Basic {
|
|||
uint256 _sellAmt = swapRouter.exactOutputSingle(params);
|
||||
require(_slippageAmt >= _sellAmt, "Too much slippage");
|
||||
|
||||
isEth = address(_buyAddr) == wethAddr;
|
||||
convertWethToEth(isEth, _buyAddr, _buyAmt);
|
||||
isEth = address(buyData.buyAddr) == wethAddr;
|
||||
convertEthToWeth(isEth, _buyAddr, _slippageAmt);
|
||||
|
||||
setUint(setId, _sellAmt);
|
||||
|
||||
|
@ -115,7 +115,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
wmul(sellData.unitAmt, convertTo18(_sellAddr.decimals(), _sellAmt))
|
||||
);
|
||||
|
||||
bool isEth = address(_sellAddr) == ethAddr;
|
||||
bool isEth = address(sellData.sellAddr) == ethAddr;
|
||||
convertEthToWeth(isEth, _sellAddr, _sellAmt);
|
||||
approve(_sellAddr, address(swapRouter), _sellAmt);
|
||||
ExactInputSingleParams memory params = ExactInputSingleParams({
|
||||
|
@ -131,8 +131,8 @@ abstract contract Helpers is DSMath, Basic {
|
|||
uint256 _buyAmt = swapRouter.exactInputSingle(params);
|
||||
require(_slippageAmt <= _buyAmt, "Too much slippage");
|
||||
|
||||
isEth = address(_buyAddr) == wethAddr;
|
||||
convertWethToEth(isEth, _buyAddr, _buyAmt);
|
||||
isEth = address(sellData.buyAddr) == wethAddr;
|
||||
convertEthToWeth(isEth, _buyAddr, _sellAmt);
|
||||
|
||||
setUint(setId, _buyAmt);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
_sellAddr.decimals(),
|
||||
wmul(buyData.unitAmt, convertTo18(_buyAddr.decimals(), _buyAmt))
|
||||
);
|
||||
bool isEth = address(_sellAddr) == ethAddr;
|
||||
bool isEth = address(buyData.sellAddr) == ethAddr;
|
||||
convertEthToWeth(isEth, _sellAddr, _slippageAmt);
|
||||
approve(_sellAddr, address(swapRouter), _slippageAmt);
|
||||
|
||||
|
@ -69,8 +69,8 @@ abstract contract Helpers is DSMath, Basic {
|
|||
uint256 _sellAmt = swapRouter.exactOutputSingle(params);
|
||||
require(_slippageAmt >= _sellAmt, "Too much slippage");
|
||||
|
||||
isEth = address(_buyAddr) == wethAddr;
|
||||
convertWethToEth(isEth, _buyAddr, _buyAmt);
|
||||
isEth = address(buyData.buyAddr) == wethAddr;
|
||||
convertEthToWeth(isEth, _buyAddr, _slippageAmt);
|
||||
|
||||
setUint(setId, _sellAmt);
|
||||
|
||||
|
@ -114,7 +114,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
wmul(sellData.unitAmt, convertTo18(_sellAddr.decimals(), _sellAmt))
|
||||
);
|
||||
|
||||
bool isEth = address(_sellAddr) == ethAddr;
|
||||
bool isEth = address(sellData.sellAddr) == ethAddr;
|
||||
convertEthToWeth(isEth, _sellAddr, _sellAmt);
|
||||
approve(_sellAddr, address(swapRouter), _sellAmt);
|
||||
ExactInputSingleParams memory params = ExactInputSingleParams({
|
||||
|
@ -129,7 +129,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
uint256 _buyAmt = swapRouter.exactInputSingle(params);
|
||||
require(_slippageAmt <= _buyAmt, "Too much slippage");
|
||||
|
||||
isEth = address(_buyAddr) == wethAddr;
|
||||
isEth = address(sellData.buyAddr) == wethAddr;
|
||||
convertWethToEth(isEth, _buyAddr, _buyAmt);
|
||||
|
||||
setUint(setId, _buyAmt);
|
||||
|
|
|
@ -53,7 +53,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
_sellAddr.decimals(),
|
||||
wmul(buyData.unitAmt, convertTo18(_buyAddr.decimals(), _buyAmt))
|
||||
);
|
||||
bool isEth = address(_sellAddr) == ethAddr;
|
||||
bool isEth = address(buyData.sellAddr) == ethAddr;
|
||||
convertEthToWeth(isEth, _sellAddr, _slippageAmt);
|
||||
approve(_sellAddr, address(swapRouter), _slippageAmt);
|
||||
|
||||
|
@ -70,8 +70,8 @@ abstract contract Helpers is DSMath, Basic {
|
|||
uint256 _sellAmt = swapRouter.exactOutputSingle(params);
|
||||
require(_slippageAmt >= _sellAmt, "Too much slippage");
|
||||
|
||||
isEth = address(_buyAddr) == wethAddr;
|
||||
convertWethToEth(isEth, _buyAddr, _buyAmt);
|
||||
isEth = address(buyData.buyAddr) == ethAddr;
|
||||
convertEthToWeth(isEth, _buyAddr, _slippageAmt);
|
||||
|
||||
setUint(setId, _sellAmt);
|
||||
|
||||
|
@ -115,7 +115,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
wmul(sellData.unitAmt, convertTo18(_sellAddr.decimals(), _sellAmt))
|
||||
);
|
||||
|
||||
bool isEth = address(_sellAddr) == ethAddr;
|
||||
bool isEth = address(sellData.sellAddr) == ethAddr;
|
||||
convertEthToWeth(isEth, _sellAddr, _sellAmt);
|
||||
approve(_sellAddr, address(swapRouter), _sellAmt);
|
||||
ExactInputSingleParams memory params = ExactInputSingleParams({
|
||||
|
@ -131,8 +131,8 @@ abstract contract Helpers is DSMath, Basic {
|
|||
uint256 _buyAmt = swapRouter.exactInputSingle(params);
|
||||
require(_slippageAmt <= _buyAmt, "Too much slippage");
|
||||
|
||||
isEth = address(_buyAddr) == wethAddr;
|
||||
convertWethToEth(isEth, _buyAddr, _buyAmt);
|
||||
isEth = address(sellData.buyAddr) == ethAddr;
|
||||
convertEthToWeth(isEth, _buyAddr, _sellAmt);
|
||||
|
||||
setUint(setId, _buyAmt);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
wmul(buyData.unitAmt, convertTo18(_buyAddr.decimals(), _buyAmt))
|
||||
);
|
||||
|
||||
bool isMatic = address(_sellAddr) == maticAddr;
|
||||
bool isMatic = address(buyData.sellAddr) == maticAddr;
|
||||
convertMaticToWmatic(isMatic, _sellAddr, _slippageAmt);
|
||||
approve(_sellAddr, address(swapRouter), _slippageAmt);
|
||||
ExactOutputSingleParams memory params = ExactOutputSingleParams({
|
||||
|
@ -69,8 +69,8 @@ abstract contract Helpers is DSMath, Basic {
|
|||
uint256 _sellAmt = swapRouter.exactOutputSingle(params);
|
||||
require(_slippageAmt >= _sellAmt, "Too much slippage");
|
||||
|
||||
isMatic = address(_buyAddr) == wmaticAddr;
|
||||
convertWmaticToMatic(isMatic, _buyAddr, _buyAmt);
|
||||
isMatic = address(buyData.buyAddr) == maticAddr;
|
||||
convertMaticToWmatic(isMatic, _buyAddr, _slippageAmt);
|
||||
|
||||
setUint(setId, _sellAmt);
|
||||
|
||||
|
@ -114,7 +114,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
wmul(sellData.unitAmt, convertTo18(_sellAddr.decimals(), _sellAmt))
|
||||
);
|
||||
|
||||
bool isMatic = address(_sellAddr) == maticAddr;
|
||||
bool isMatic = address(buyData.sellAddr) == maticAddr;
|
||||
convertMaticToWmatic(isMatic, _sellAddr, _sellAmt);
|
||||
approve(_sellAddr, address(swapRouter), _sellAmt);
|
||||
ExactInputSingleParams memory params = ExactInputSingleParams({
|
||||
|
@ -130,7 +130,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
uint256 _buyAmt = swapRouter.exactInputSingle(params);
|
||||
require(_slippageAmt <= _buyAmt, "Too much slippage");
|
||||
|
||||
isMatic = address(_buyAddr) == wmaticAddr;
|
||||
isMatic = address(sellData.buyAddr) == wmaticAddr;
|
||||
convertWmaticToMatic(isMatic, _buyAddr, _buyAmt);
|
||||
|
||||
setUint(setId, _buyAmt);
|
||||
|
|
Loading…
Reference in New Issue
Block a user