From 01e2690b2bbbc542e1bac633bec51bfdedb631d4 Mon Sep 17 00:00:00 2001 From: Kyu Date: Wed, 19 Jul 2023 11:05:51 -0700 Subject: [PATCH] Check UniswapV3 support on Avalanche and BSC BridgeAdapters (#737) --- .../bridges/AvalancheBridgeAdapterTest.t.sol | 35 +++++++++++++++++++ .../bridges/BSCBridgeAdapterTest.t.sol | 35 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 contracts/zero-ex/tests/transformers/bridges/AvalancheBridgeAdapterTest.t.sol create mode 100644 contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol diff --git a/contracts/zero-ex/tests/transformers/bridges/AvalancheBridgeAdapterTest.t.sol b/contracts/zero-ex/tests/transformers/bridges/AvalancheBridgeAdapterTest.t.sol new file mode 100644 index 0000000000..feba5de135 --- /dev/null +++ b/contracts/zero-ex/tests/transformers/bridges/AvalancheBridgeAdapterTest.t.sol @@ -0,0 +1,35 @@ +// 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/AvalancheBridgeAdapter.sol"; +import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol"; + +contract AvalancheBridgeAdapterTest is Test { + address constant WAVAX = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7; + + AvalancheBridgeAdapter private adapter; + + function setUp() public { + vm.chainId(43114); + adapter = new AvalancheBridgeAdapter(IEtherToken(WAVAX)); + } + + function testSupportsUniswapV3() public { + assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128))); + } +} diff --git a/contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol b/contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol new file mode 100644 index 0000000000..5114d5b4a1 --- /dev/null +++ b/contracts/zero-ex/tests/transformers/bridges/BSCBridgeAdapterTest.t.sol @@ -0,0 +1,35 @@ +// 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/BSCBridgeAdapter.sol"; +import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol"; + +contract BSCBridgeAdapterTest is Test { + address constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c; + + BSCBridgeAdapter private adapter; + + function setUp() public { + vm.chainId(56); + adapter = new BSCBridgeAdapter(IEtherToken(WBNB)); + } + + function testSupportsUniswapV3() public { + assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128))); + } +}