made more generic

This commit is contained in:
joshrrose
2023-01-20 08:55:04 -07:00
parent 2cd405c1cb
commit f9e4551728
3 changed files with 5 additions and 27 deletions

View File

@@ -23,16 +23,6 @@ pragma experimental ABIEncoderV2;
import "./IBridgeAdapter.sol";
abstract contract AbstractBridgeAdapter is IBridgeAdapter {
constructor(uint256 expectedChainId, string memory expectedChainName) public {
uint256 chainId;
assembly {
chainId := chainid()
}
// Allow testing on Ganache
if (chainId != expectedChainId && chainId != 1337) {
revert(string(abi.encodePacked(expectedChainName, "BridgeAdapter.constructor: wrong chain ID")));
}
}
function isSupportedSource(bytes32 source) external override returns (bool isSupported) {
BridgeOrder memory placeholderOrder;

View File

@@ -23,13 +23,11 @@ pragma experimental ABIEncoderV2;
import "./EthereumBridgeAdapterGroup1.sol";
import "./IBridgeAdapter.sol";
contract EthereumBridgeAdapter is IBridgeAdapter {
contract BridgeAdapter is IBridgeAdapter {
IBridgeAdapter private immutable adapter1;
uint256 private constant ADAPTER_1_LENGTH = 33;
constructor(IEtherTokenV06 weth) public {
uint256 expectedChainId = 1;
string memory expectedChainName = "Ethereum";
constructor(IEtherTokenV06 weth, uint256 expectedChainId, string memory expectedChainName) public {
uint256 chainId;
assembly {
chainId := chainid()
@@ -39,7 +37,7 @@ contract EthereumBridgeAdapter is IBridgeAdapter {
revert(string(abi.encodePacked(expectedChainName, "BridgeAdapter.constructor: wrong chain ID")));
}
adapter1 = new EthereumBridgeAdapterGroup1(weth);
adapter1 = new BridgeAdapterGroup1(weth);
}
function trade(

View File

@@ -46,7 +46,7 @@ import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinZeroExBridge.sol";
contract EthereumBridgeAdapterGroup1 is
AbstractBridgeAdapter(1, "Ethereum"),
AbstractBridgeAdapter,
MixinAaveV2,
MixinBalancer,
MixinBalancerV2Batch,
@@ -71,7 +71,7 @@ contract EthereumBridgeAdapterGroup1 is
MixinZeroExBridge
{
constructor(
IEtherTokenV06 weth
IEtherTokenV06 weth,
)
public
MixinBancor(weth)
@@ -82,16 +82,6 @@ contract EthereumBridgeAdapterGroup1 is
MixinUniswap(weth)
{}
// function trade(
// BridgeOrder memory order,
// IERC20TokenV06 sellToken,
// IERC20TokenV06 buyToken,
// uint256 sellAmount
// ) public override returns (uint256 boughtAmount) {
// (boughtAmount, ) = _trade(order, sellToken, buyToken, sellAmount, false);
// }
function _trade(
BridgeOrder memory order,
IERC20TokenV06 sellToken,