Skip to content

Commit 09d6fbc

Browse files
authored
Rename Maverick to MaverickV1 and add tests (#742)
* Renaming Maverick and adding tests * Update Base chain ID
1 parent 7f324dd commit 09d6fbc

7 files changed

Lines changed: 86 additions & 4 deletions

File tree

contracts/zero-ex/contracts/src/transformers/bridges/BSCBridgeAdapter.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ contract BSCBridgeAdapter is
105105
return (0, true);
106106
}
107107
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
108-
} else if (protocolId == BridgeProtocols.MAVERICK) {
108+
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
109109
if (dryRun) {
110110
return (0, true);
111111
}

contracts/zero-ex/contracts/src/transformers/bridges/BaseBridgeAdapter.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ contract BaseBridgeAdapter is
7575
return (0, true);
7676
}
7777
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
78-
} else if (protocolId == BridgeProtocols.MAVERICK) {
78+
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
7979
if (dryRun) {
8080
return (0, true);
8181
}

contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ library BridgeProtocols {
5858
uint128 internal constant BARTER = 34;
5959
uint128 internal constant TRADERJOEV2 = 35;
6060
uint128 internal constant VELODROMEV2 = 36;
61-
uint128 internal constant MAVERICK = 37;
61+
uint128 internal constant MAVERICKV1 = 37;
6262
}

contracts/zero-ex/contracts/src/transformers/bridges/EthereumBridgeAdapter.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ contract EthereumBridgeAdapter is
177177
return (0, true);
178178
}
179179
boughtAmount = _tradeBarter(sellToken, sellAmount, order.bridgeData);
180-
} else if (protocolId == BridgeProtocols.MAVERICK) {
180+
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
181181
if (dryRun) {
182182
return (0, true);
183183
}

contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ contract BSCBridgeAdapterTest is Test {
3232
function testSupportsUniswapV3() public {
3333
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128)));
3434
}
35+
36+
function testSupportMaverickV1() public {
37+
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128)));
38+
}
3539
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
/*
3+
Copyright 2023 ZeroEx Intl.
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
*/
14+
15+
pragma solidity ^0.6.5;
16+
pragma experimental ABIEncoderV2;
17+
18+
import "forge-std/Test.sol";
19+
import "../../../contracts/src/transformers/bridges/BaseBridgeAdapter.sol";
20+
import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol";
21+
22+
contract BaseBridgeAdapterTest is Test {
23+
address constant WETH = 0x4200000000000000000000000000000000000006;
24+
25+
BaseBridgeAdapter private adapter;
26+
27+
function setUp() public {
28+
vm.chainId(8453);
29+
adapter = new BaseBridgeAdapter(IEtherToken(WETH));
30+
}
31+
32+
function testSupportsUniswapV3() public {
33+
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128)));
34+
}
35+
36+
function testSupportMaverickV1() public {
37+
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128)));
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
/*
3+
Copyright 2023 ZeroEx Intl.
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
*/
14+
15+
pragma solidity ^0.6.5;
16+
pragma experimental ABIEncoderV2;
17+
18+
import "forge-std/Test.sol";
19+
import "../../../contracts/src/transformers/bridges/EthereumBridgeAdapter.sol";
20+
import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol";
21+
22+
contract EthereumBridgeAdapterTest is Test {
23+
address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
24+
25+
EthereumBridgeAdapter private adapter;
26+
27+
function setUp() public {
28+
vm.chainId(1);
29+
adapter = new EthereumBridgeAdapter(IEtherToken(WETH));
30+
}
31+
32+
function testSupportsUniswapV3() public {
33+
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128)));
34+
}
35+
36+
function testSupportMaverickV1() public {
37+
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128)));
38+
}
39+
}

0 commit comments

Comments
 (0)