diff --git a/src/dex/bebop/bebop.ts b/src/dex/bebop/bebop.ts index 83bb66373..cfe24ce3d 100644 --- a/src/dex/bebop/bebop.ts +++ b/src/dex/bebop/bebop.ts @@ -13,7 +13,7 @@ import { NumberAsString, DexExchangeParam, } from '../../types'; -import { SwapSide, Network, ETHER_ADDRESS } from '../../constants'; +import { SwapSide, Network } from '../../constants'; import * as CALLDATA_GAS_COST from '../../calldata-gas-cost'; import { getDexKeysWithNetwork, Utils } from '../../utils'; import { IDex } from '../../dex/idex'; @@ -613,7 +613,7 @@ export class Bebop extends SimpleExchange implements IDex { return { exchangeData: tx.data, needWrapNative: this.needWrapNative, - dexFuncHasRecipient: srcToken.toLowerCase() !== ETHER_ADDRESS, + dexFuncHasRecipient: true, targetExchange: this.settlementAddress, returnAmountPos: undefined, }; @@ -635,11 +635,7 @@ export class Bebop extends SimpleExchange implements IDex { sell_amounts: isSell ? optimalSwapExchange.srcAmount : undefined, buy_amounts: isBuy ? optimalSwapExchange.destAmount : undefined, taker_address: utils.getAddress(options.executionContractAddress), - receiver_address: utils.getAddress( - srcToken.address.toLowerCase() === ETHER_ADDRESS - ? options.executionContractAddress - : options.recipient, - ), + receiver_address: utils.getAddress(options.recipient), gasless: false, skip_validation: true, source: BEBOP_AUTH_NAME, diff --git a/src/executor/Executor01BytecodeBuilder.ts b/src/executor/Executor01BytecodeBuilder.ts index 71cff4d90..f04159e47 100644 --- a/src/executor/Executor01BytecodeBuilder.ts +++ b/src/executor/Executor01BytecodeBuilder.ts @@ -80,8 +80,9 @@ export class Executor01BytecodeBuilder extends ExecutorBytecodeBuilder< Flag.DONT_INSERT_FROM_AMOUNT_DONT_CHECK_BALANCE_AFTER_SWAP; // 0 if (isEthSrc && !needWrap) { - dexFlag = - Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_CHECK_SRC_TOKEN_BALANCE_AFTER_SWAP; // 5 + dexFlag = dexFuncHasRecipient + ? Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_DONT_CHECK_BALANCE_AFTER_SWAP // 9 + : Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_CHECK_SRC_TOKEN_BALANCE_AFTER_SWAP; // 5 } else if (isEthDest && !needUnwrap) { dexFlag = forcePreventInsertFromAmount ? Flag.DONT_INSERT_FROM_AMOUNT_CHECK_ETH_BALANCE_AFTER_SWAP @@ -417,6 +418,8 @@ export class Executor01BytecodeBuilder extends ExecutorBytecodeBuilder< maybeWethCallData, ); + console.log('FLAGS: ', flags); + let swapsCalldata = exchangeParams.reduce( (acc, ep, index) => hexConcat([ diff --git a/src/executor/Executor02BytecodeBuilder.ts b/src/executor/Executor02BytecodeBuilder.ts index 6876609f0..cb96b6a91 100644 --- a/src/executor/Executor02BytecodeBuilder.ts +++ b/src/executor/Executor02BytecodeBuilder.ts @@ -103,8 +103,9 @@ export class Executor02BytecodeBuilder extends ExecutorBytecodeBuilder< Flag.DONT_INSERT_FROM_AMOUNT_DONT_CHECK_BALANCE_AFTER_SWAP; // 0 if (isEthSrc && !needWrap) { - dexFlag = - Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_CHECK_SRC_TOKEN_BALANCE_AFTER_SWAP; // 5 + dexFlag = dexFuncHasRecipient + ? Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_DONT_CHECK_BALANCE_AFTER_SWAP // 9 + : Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_CHECK_SRC_TOKEN_BALANCE_AFTER_SWAP; // 5 } else if (isEthDest && !needUnwrap) { dexFlag = forcePreventInsertFromAmount ? Flag.DONT_INSERT_FROM_AMOUNT_CHECK_ETH_BALANCE_AFTER_SWAP diff --git a/src/executor/Executor03BytecodeBuilder.ts b/src/executor/Executor03BytecodeBuilder.ts index 146dc82d0..5ed683903 100644 --- a/src/executor/Executor03BytecodeBuilder.ts +++ b/src/executor/Executor03BytecodeBuilder.ts @@ -93,8 +93,9 @@ export class Executor03BytecodeBuilder extends ExecutorBytecodeBuilder< Flag.DONT_INSERT_FROM_AMOUNT_DONT_CHECK_BALANCE_AFTER_SWAP; // 0 if (isEthSrc && !needWrap) { - dexFlag = - Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_CHECK_SRC_TOKEN_BALANCE_AFTER_SWAP; // 5 + dexFlag = dexFuncHasRecipient + ? Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_DONT_CHECK_BALANCE_AFTER_SWAP // 9 + : Flag.SEND_ETH_EQUAL_TO_FROM_AMOUNT_CHECK_SRC_TOKEN_BALANCE_AFTER_SWAP; // 5 } else if (isEthDest && !needUnwrap) { dexFlag = forcePreventInsertFromAmount ? Flag.DONT_INSERT_FROM_AMOUNT_CHECK_ETH_BALANCE_AFTER_SWAP // 4