From a0485ca3e08e7e8ad5c06c9fee9f26eae3838bef Mon Sep 17 00:00:00 2001 From: abls <112491550+abls@users.noreply.github.com> Date: Fri, 24 Feb 2023 05:14:03 -0800 Subject: [PATCH] fix _computeHopTarget for otc subcalls --- .../src/features/multiplex/MultiplexFeature.sol | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/contracts/zero-ex/contracts/src/features/multiplex/MultiplexFeature.sol b/contracts/zero-ex/contracts/src/features/multiplex/MultiplexFeature.sol index 578270fada..784f2178e7 100644 --- a/contracts/zero-ex/contracts/src/features/multiplex/MultiplexFeature.sol +++ b/contracts/zero-ex/contracts/src/features/multiplex/MultiplexFeature.sol @@ -544,7 +544,11 @@ contract MultiplexFeature is // is executed, so we the target is the address encoded // in the subcall data. (target, ) = abi.decode(subcall.data, (address, bytes)); - } else if (subcall.id == MultiplexSubcall.UniswapV3 || subcall.id == MultiplexSubcall.BatchSell) { + } else if ( + subcall.id == MultiplexSubcall.UniswapV3 || + subcall.id == MultiplexSubcall.BatchSell || + subcall.id == MultiplexSubcall.OTC + ) { // UniswapV3 uses a callback to pull in the tokens being // sold to it. The callback implemented in `UniswapV3Feature` // can either: @@ -570,13 +574,6 @@ contract MultiplexFeature is } else { target = address(this); } - } else if (subcall.id == MultiplexSubcall.OTC) { - //on the first call we want to pull tokens from the taker, subsequent calls should use the EP balance - if (i == 0) { - target = params.payer; - } else { - target = address(this); - } } else { revert("MultiplexFeature::_computeHopTarget/INVALID_SUBCALL"); }