From 29b7095a00b01c7c5a813494520bb5536e8e913c Mon Sep 17 00:00:00 2001 From: dextracker Date: Thu, 23 Feb 2023 15:11:52 -0500 Subject: [PATCH] prettier and lint --- .../contracts/src/features/OtcOrdersFeature.sol | 2 +- .../src/features/multiplex/MultiplexFeature.sol | 13 ++++++------- .../src/features/multiplex/MultiplexOtc.sol | 2 +- .../zero-ex/tests/forked/MultiplexRfqt.t.sol | 16 ++++++++-------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/contracts/zero-ex/contracts/src/features/OtcOrdersFeature.sol b/contracts/zero-ex/contracts/src/features/OtcOrdersFeature.sol index 62d0c9a531..3593a25c80 100644 --- a/contracts/zero-ex/contracts/src/features/OtcOrdersFeature.sol +++ b/contracts/zero-ex/contracts/src/features/OtcOrdersFeature.sol @@ -31,7 +31,7 @@ import "./libs/LibNativeOrder.sol"; import "./libs/LibSignature.sol"; /// @dev Feature for interacting with OTC orders. -contract OtcOrdersFeature is IFeature, IOtcOrdersFeature, FixinCommon, FixinEIP712, FixinTokenSpender{ +contract OtcOrdersFeature is IFeature, IOtcOrdersFeature, FixinCommon, FixinEIP712, FixinTokenSpender { using LibSafeMathV06 for uint256; using LibSafeMathV06 for uint128; diff --git a/contracts/zero-ex/contracts/src/features/multiplex/MultiplexFeature.sol b/contracts/zero-ex/contracts/src/features/multiplex/MultiplexFeature.sol index 996902eca6..5189e83268 100644 --- a/contracts/zero-ex/contracts/src/features/multiplex/MultiplexFeature.sol +++ b/contracts/zero-ex/contracts/src/features/multiplex/MultiplexFeature.sol @@ -392,7 +392,7 @@ contract MultiplexFeature is // Compute the expected address and transfer the input tokens // there if necessary. state.from = _computeHopTarget(params, 0); - + // If the input tokens are currently held by `msg.sender` but // the first hop expects them elsewhere, perform a `transferFrom`. if (!params.useSelfBalance && state.from != msg.sender) { @@ -489,7 +489,7 @@ contract MultiplexFeature is // If `i == 0`, the target is the address which should hold the input // tokens prior to executing `calls[0]`. Otherwise, it is the address // that should receive `tokens[i]` upon executing `calls[i-1]`. - function _computeHopTarget(MultiHopSellParams memory params, uint256 i) private returns (address target) { + function _computeHopTarget(MultiHopSellParams memory params, uint256 i) private returns (address target) { if (i == params.calls.length) { // The last call should send the output tokens to the // multi-hop sell recipient. @@ -534,12 +534,11 @@ contract MultiplexFeature is } else { target = address(this); } - } else if(subcall.id == MultiplexSubcall.OTC) { + } 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 = msg.sender; - } - else { + if (i == 0) { + target = msg.sender; + } else { target = address(this); } } else { diff --git a/contracts/zero-ex/contracts/src/features/multiplex/MultiplexOtc.sol b/contracts/zero-ex/contracts/src/features/multiplex/MultiplexOtc.sol index 3262f176a4..8810513a65 100644 --- a/contracts/zero-ex/contracts/src/features/multiplex/MultiplexOtc.sol +++ b/contracts/zero-ex/contracts/src/features/multiplex/MultiplexOtc.sol @@ -21,7 +21,7 @@ import "../interfaces/IMultiplexFeature.sol"; import "../interfaces/IOtcOrdersFeature.sol"; import "../libs/LibNativeOrder.sol"; -abstract contract MultiplexOtc is FixinEIP712{ +abstract contract MultiplexOtc is FixinEIP712 { using LibSafeMathV06 for uint256; event ExpiredOtcOrder(bytes32 orderHash, address maker, uint64 expiry); diff --git a/contracts/zero-ex/tests/forked/MultiplexRfqt.t.sol b/contracts/zero-ex/tests/forked/MultiplexRfqt.t.sol index dcc73bfe2f..c38edfc5c2 100644 --- a/contracts/zero-ex/tests/forked/MultiplexRfqt.t.sol +++ b/contracts/zero-ex/tests/forked/MultiplexRfqt.t.sol @@ -29,9 +29,9 @@ import "src/transformers/bridges/BridgeProtocols.sol"; import "src/features/OtcOrdersFeature.sol"; contract MultiplexRfqtTest is Test, ForkUtils, TestUtils { - using LibERC20TokenV06 for IERC20Token; using LibERC20TokenV06 for IEtherToken; + function setUp() public { _setup(); } @@ -67,12 +67,15 @@ contract MultiplexRfqtTest is Test, ForkUtils, TestUtils { bytes32(0) // sushiswapPairInitCodeHash ); - OtcOrdersFeature otcOrdersFeature = new OtcOrdersFeature(address(addresses.exchangeProxy), tokens.WrappedNativeToken); + OtcOrdersFeature otcOrdersFeature = new OtcOrdersFeature( + address(addresses.exchangeProxy), + tokens.WrappedNativeToken + ); vm.label(address(multiplexFeature), "zeroEx/NewMultiplexFeature"); vm.label(address(otcOrdersFeature), "zeroEx/NewOtcOrdersFeature"); vm.prank(IZeroEx(addresses.exchangeProxy).owner()); - + IZeroEx(addresses.exchangeProxy).migrate( address(otcOrdersFeature), abi.encodeWithSelector(OtcOrdersFeature.migrate.selector), @@ -95,7 +98,6 @@ contract MultiplexRfqtTest is Test, ForkUtils, TestUtils { ContractAddresses memory addresses, LiquiditySources memory sources ) public onlyForked { - IZERO_EX = IZeroEx(addresses.exchangeProxy); address[] memory tradeTokens = new address[](3); @@ -139,8 +141,8 @@ contract MultiplexRfqtTest is Test, ForkUtils, TestUtils { subcalls[1] = subcall2; uint balanceBefore = tokens.DAI.balanceOf(address(this)); - emit log_named_uint("DAI Balance Before",balanceBefore); - emit log_string("Multihop Rfqt: WETH->USDC->DAI"); + emit log_named_uint("DAI Balance Before", balanceBefore); + emit log_string("Multihop Rfqt: WETH->USDC->DAI"); /// @dev Sells `sellAmount` of the input token (`tokens[0]`) /// via the given sequence of tokens and calls. @@ -193,8 +195,6 @@ contract MultiplexRfqtTest is Test, ForkUtils, TestUtils { vm.startPrank(order.maker); IERC20Token(order.makerToken).approveIfBelow(addresses.exchangeProxy, 2e20); - - order.taker = address(0); order.txOrigin = address(tx.origin); order.expiryAndNonce = encodeExpiryAndNonce(order.maker, bump);