diff --git a/contracts/zero-ex/contracts/src/transformers/bridges/BSCBridgeAdapter.sol b/contracts/zero-ex/contracts/src/transformers/bridges/BSCBridgeAdapter.sol index f7575a61af..00a79320ca 100644 --- a/contracts/zero-ex/contracts/src/transformers/bridges/BSCBridgeAdapter.sol +++ b/contracts/zero-ex/contracts/src/transformers/bridges/BSCBridgeAdapter.sol @@ -105,7 +105,7 @@ contract BSCBridgeAdapter is return (0, true); } boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData); - } else if (protocolId == BridgeProtocols.MAVERICK) { + } else if (protocolId == BridgeProtocols.MAVERICKV1) { if (dryRun) { return (0, true); } diff --git a/contracts/zero-ex/contracts/src/transformers/bridges/BaseBridgeAdapter.sol b/contracts/zero-ex/contracts/src/transformers/bridges/BaseBridgeAdapter.sol index df8fd454fa..4d743712d1 100644 --- a/contracts/zero-ex/contracts/src/transformers/bridges/BaseBridgeAdapter.sol +++ b/contracts/zero-ex/contracts/src/transformers/bridges/BaseBridgeAdapter.sol @@ -75,7 +75,7 @@ contract BaseBridgeAdapter is return (0, true); } boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData); - } else if (protocolId == BridgeProtocols.MAVERICK) { + } else if (protocolId == BridgeProtocols.MAVERICKV1) { if (dryRun) { return (0, true); } diff --git a/contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol b/contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol index 371dd154e4..6cd62ad9d4 100644 --- a/contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol +++ b/contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol @@ -58,5 +58,5 @@ library BridgeProtocols { uint128 internal constant BARTER = 34; uint128 internal constant TRADERJOEV2 = 35; uint128 internal constant VELODROMEV2 = 36; - uint128 internal constant MAVERICK = 37; + uint128 internal constant MAVERICKV1 = 37; } diff --git a/contracts/zero-ex/contracts/src/transformers/bridges/EthereumBridgeAdapter.sol b/contracts/zero-ex/contracts/src/transformers/bridges/EthereumBridgeAdapter.sol index e1d3ee5bfe..d2ce9c2304 100644 --- a/contracts/zero-ex/contracts/src/transformers/bridges/EthereumBridgeAdapter.sol +++ b/contracts/zero-ex/contracts/src/transformers/bridges/EthereumBridgeAdapter.sol @@ -177,7 +177,7 @@ contract EthereumBridgeAdapter is return (0, true); } boughtAmount = _tradeBarter(sellToken, sellAmount, order.bridgeData); - } else if (protocolId == BridgeProtocols.MAVERICK) { + } else if (protocolId == BridgeProtocols.MAVERICKV1) { if (dryRun) { return (0, true); } diff --git a/contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol b/contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol index 5114d5b4a1..f9d9867d7e 100644 --- a/contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol +++ b/contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol @@ -32,4 +32,8 @@ contract BSCBridgeAdapterTest is Test { function testSupportsUniswapV3() public { assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128))); } + + function testSupportMaverickV1() public { + assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128))); + } } diff --git a/contracts/zero-ex/tests/transformers/bridges/BaseBridgeAdapterTest.t.sol b/contracts/zero-ex/tests/transformers/bridges/BaseBridgeAdapterTest.t.sol new file mode 100644 index 0000000000..684a5d862e --- /dev/null +++ b/contracts/zero-ex/tests/transformers/bridges/BaseBridgeAdapterTest.t.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: Apache-2.0 +/* + Copyright 2023 ZeroEx Intl. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +pragma solidity ^0.6.5; +pragma experimental ABIEncoderV2; + +import "forge-std/Test.sol"; +import "../../../contracts/src/transformers/bridges/BaseBridgeAdapter.sol"; +import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol"; + +contract BaseBridgeAdapterTest is Test { + address constant WETH = 0x4200000000000000000000000000000000000006; + + BaseBridgeAdapter private adapter; + + function setUp() public { + vm.chainId(8453); + adapter = new BaseBridgeAdapter(IEtherToken(WETH)); + } + + function testSupportsUniswapV3() public { + assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128))); + } + + function testSupportMaverickV1() public { + assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128))); + } +} diff --git a/contracts/zero-ex/tests/transformers/bridges/EthereumBridgeAdapterTest.t.sol b/contracts/zero-ex/tests/transformers/bridges/EthereumBridgeAdapterTest.t.sol new file mode 100644 index 0000000000..ea5808cb02 --- /dev/null +++ b/contracts/zero-ex/tests/transformers/bridges/EthereumBridgeAdapterTest.t.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: Apache-2.0 +/* + Copyright 2023 ZeroEx Intl. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +pragma solidity ^0.6.5; +pragma experimental ABIEncoderV2; + +import "forge-std/Test.sol"; +import "../../../contracts/src/transformers/bridges/EthereumBridgeAdapter.sol"; +import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol"; + +contract EthereumBridgeAdapterTest is Test { + address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; + + EthereumBridgeAdapter private adapter; + + function setUp() public { + vm.chainId(1); + adapter = new EthereumBridgeAdapter(IEtherToken(WETH)); + } + + function testSupportsUniswapV3() public { + assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128))); + } + + function testSupportMaverickV1() public { + assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128))); + } +}