@@ -20,6 +20,7 @@ import {Bebop} from "../../core/Bebop.sol";
2020
2121import {SafeTransferLib} from "../../vendor/SafeTransferLib.sol " ;
2222import {FreeMemory} from "../../utils/FreeMemory.sol " ;
23+ import {FastLogic} from "../../utils/FastLogic.sol " ;
2324import {Ternary} from "../../utils/Ternary.sol " ;
2425
2526import {ISettlerActions} from "../../ISettlerActions.sol " ;
@@ -69,6 +70,7 @@ abstract contract MainnetMixin is
6970{
7071 using SafeTransferLib for IERC20 ;
7172 using SafeTransferLib for address payable ;
73+ using FastLogic for bool ;
7274 using Ternary for bool ;
7375
7476 constructor () {
@@ -137,7 +139,7 @@ abstract contract MainnetMixin is
137139 token.safeTransfer (recipient, balance);
138140 }
139141 }
140- } else if (action == uint32 (ISettlerActions.UNISWAPV4.selector )) {
142+ } else if (( action == uint32 (ISettlerActions.UNISWAPV4.selector )). or (action == uint32 (ISettlerActions.BALANCERV3. selector )). or (action == uint32 (ISettlerActions.EKUBO. selector )). or (action == uint32 (ISettlerActions.EKUBOV3. selector ) )) {
141143 (
142144 address payable recipient ,
143145 IERC20 sellToken ,
@@ -150,7 +152,19 @@ abstract contract MainnetMixin is
150152 ) = abi.decode (data, (address , IERC20 , uint256 , bool , uint256 , uint256 , bytes , uint256 ));
151153 IERC20 buyToken;
152154 (recipient, buyToken, minAmountOut) = _maybeSetSlippage (slippage, recipient, minAmountOut);
153- (IERC20 actualBuyToken , uint256 actualAmountOut ) = sellToUniswapV4 (recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills);
155+
156+ IERC20 actualBuyToken;
157+ uint256 actualAmountOut;
158+ if (action == uint32 (ISettlerActions.UNISWAPV4.selector )) {
159+ (actualBuyToken, actualAmountOut) = sellToUniswapV4 (recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills);
160+ } else if (action == uint32 (ISettlerActions.BALANCERV3.selector )) {
161+ (actualBuyToken, actualAmountOut) = sellToBalancerV3 (recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills);
162+ } else if (action == uint32 (ISettlerActions.EKUBO.selector )) {
163+ (actualBuyToken, actualAmountOut) = sellToEkuboV2 (recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills);
164+ } else { // if (action == uint32(ISettlerActions.EKUBOV3.selector))
165+ (actualBuyToken, actualAmountOut) = sellToEkuboV3 (recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills);
166+ }
167+
154168 _checkSlippage (buyToken, minAmountOut, actualBuyToken, actualAmountOut);
155169 } else if (action == uint32 (ISettlerActions.MAKERPSM.selector )) {
156170 (address payable recipient , uint256 bps , bool buyGem , uint256 minAmountOut , IPSM psm , IERC20 dai ) =
@@ -166,21 +180,6 @@ abstract contract MainnetMixin is
166180 (recipient, buyToken, minAmountOut) = _maybeSetSlippage (slippage, recipient, minAmountOut);
167181 (IERC20 actualBuyToken , uint256 actualAmountOut ) = sellToEulerSwap (recipient, sellToken, bps, pool, zeroForOne);
168182 _checkSlippage (buyToken, minAmountOut, actualBuyToken, actualAmountOut);
169- } else if (action == uint32 (ISettlerActions.BALANCERV3.selector )) {
170- (
171- address payable recipient ,
172- IERC20 sellToken ,
173- uint256 bps ,
174- bool feeOnTransfer ,
175- uint256 hashMul ,
176- uint256 hashMod ,
177- bytes memory fills ,
178- uint256 minAmountOut
179- ) = abi.decode (data, (address , IERC20 , uint256 , bool , uint256 , uint256 , bytes , uint256 ));
180- IERC20 buyToken;
181- (recipient, buyToken, minAmountOut) = _maybeSetSlippage (slippage, recipient, minAmountOut);
182- (IERC20 actualBuyToken , uint256 actualAmountOut ) = sellToBalancerV3 (recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills);
183- _checkSlippage (buyToken, minAmountOut, actualBuyToken, actualAmountOut);
184183 } else if (action == uint32 (ISettlerActions.MAVERICKV2.selector )) {
185184 (
186185 address payable recipient ,
@@ -195,36 +194,6 @@ abstract contract MainnetMixin is
195194 (recipient, buyToken, minAmountOut) = _maybeSetSlippage (slippage, recipient, minAmountOut);
196195 (IERC20 actualBuyToken , uint256 actualAmountOut ) = sellToMaverickV2 (recipient, sellToken, bps, pool, tokenAIn, tickLimit);
197196 _checkSlippage (buyToken, minAmountOut, actualBuyToken, actualAmountOut);
198- } else if (action == uint32 (ISettlerActions.EKUBO.selector )) {
199- (
200- address payable recipient ,
201- IERC20 sellToken ,
202- uint256 bps ,
203- bool feeOnTransfer ,
204- uint256 hashMul ,
205- uint256 hashMod ,
206- bytes memory fills ,
207- uint256 minAmountOut
208- ) = abi.decode (data, (address , IERC20 , uint256 , bool , uint256 , uint256 , bytes , uint256 ));
209- IERC20 buyToken;
210- (recipient, buyToken, minAmountOut) = _maybeSetSlippage (slippage, recipient, minAmountOut);
211- (IERC20 actualBuyToken , uint256 actualAmountOut ) = sellToEkuboV2 (recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills);
212- _checkSlippage (buyToken, minAmountOut, actualBuyToken, actualAmountOut);
213- } else if (action == uint32 (ISettlerActions.EKUBOV3.selector )) {
214- (
215- address payable recipient ,
216- IERC20 sellToken ,
217- uint256 bps ,
218- bool feeOnTransfer ,
219- uint256 hashMul ,
220- uint256 hashMod ,
221- bytes memory fills ,
222- uint256 minAmountOut
223- ) = abi.decode (data, (address , IERC20 , uint256 , bool , uint256 , uint256 , bytes , uint256 ));
224- IERC20 buyToken;
225- (recipient, buyToken, minAmountOut) = _maybeSetSlippage (slippage, recipient, minAmountOut);
226- (IERC20 actualBuyToken , uint256 actualAmountOut ) = sellToEkuboV3 (recipient, sellToken, bps, feeOnTransfer, hashMul, hashMod, fills);
227- _checkSlippage (buyToken, minAmountOut, actualBuyToken, actualAmountOut);
228197 } else if (action == uint32 (ISettlerActions.BEBOP.selector )) {
229198 (
230199 address payable recipient ,
0 commit comments