made more generic
This commit is contained in:
		@@ -23,16 +23,6 @@ pragma experimental ABIEncoderV2;
 | 
				
			|||||||
import "./IBridgeAdapter.sol";
 | 
					import "./IBridgeAdapter.sol";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
abstract contract AbstractBridgeAdapter is IBridgeAdapter {
 | 
					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) {
 | 
					    function isSupportedSource(bytes32 source) external override returns (bool isSupported) {
 | 
				
			||||||
        BridgeOrder memory placeholderOrder;
 | 
					        BridgeOrder memory placeholderOrder;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,13 +23,11 @@ pragma experimental ABIEncoderV2;
 | 
				
			|||||||
import "./EthereumBridgeAdapterGroup1.sol";
 | 
					import "./EthereumBridgeAdapterGroup1.sol";
 | 
				
			||||||
import "./IBridgeAdapter.sol";
 | 
					import "./IBridgeAdapter.sol";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
contract EthereumBridgeAdapter is IBridgeAdapter {
 | 
					contract BridgeAdapter is IBridgeAdapter {
 | 
				
			||||||
    IBridgeAdapter private immutable adapter1;
 | 
					    IBridgeAdapter private immutable adapter1;
 | 
				
			||||||
    uint256 private constant ADAPTER_1_LENGTH = 33;
 | 
					    uint256 private constant ADAPTER_1_LENGTH = 33;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructor(IEtherTokenV06 weth) public {
 | 
					    constructor(IEtherTokenV06 weth, uint256 expectedChainId, string memory expectedChainName) public {
 | 
				
			||||||
        uint256 expectedChainId = 1;
 | 
					 | 
				
			||||||
        string memory expectedChainName = "Ethereum";
 | 
					 | 
				
			||||||
        uint256 chainId;
 | 
					        uint256 chainId;
 | 
				
			||||||
        assembly {
 | 
					        assembly {
 | 
				
			||||||
            chainId := chainid()
 | 
					            chainId := chainid()
 | 
				
			||||||
@@ -39,7 +37,7 @@ contract EthereumBridgeAdapter is IBridgeAdapter {
 | 
				
			|||||||
            revert(string(abi.encodePacked(expectedChainName, "BridgeAdapter.constructor: wrong chain ID")));
 | 
					            revert(string(abi.encodePacked(expectedChainName, "BridgeAdapter.constructor: wrong chain ID")));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        adapter1 = new EthereumBridgeAdapterGroup1(weth); 
 | 
					        adapter1 = new BridgeAdapterGroup1(weth); 
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function trade(
 | 
					    function trade(
 | 
				
			||||||
@@ -46,7 +46,7 @@ import "./mixins/MixinUniswapV3.sol";
 | 
				
			|||||||
import "./mixins/MixinZeroExBridge.sol";
 | 
					import "./mixins/MixinZeroExBridge.sol";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
contract EthereumBridgeAdapterGroup1 is
 | 
					contract EthereumBridgeAdapterGroup1 is
 | 
				
			||||||
    AbstractBridgeAdapter(1, "Ethereum"),
 | 
					    AbstractBridgeAdapter,
 | 
				
			||||||
    MixinAaveV2,
 | 
					    MixinAaveV2,
 | 
				
			||||||
    MixinBalancer,
 | 
					    MixinBalancer,
 | 
				
			||||||
    MixinBalancerV2Batch,
 | 
					    MixinBalancerV2Batch,
 | 
				
			||||||
@@ -71,7 +71,7 @@ contract EthereumBridgeAdapterGroup1 is
 | 
				
			|||||||
    MixinZeroExBridge
 | 
					    MixinZeroExBridge
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    constructor(
 | 
					    constructor(
 | 
				
			||||||
        IEtherTokenV06 weth
 | 
					        IEtherTokenV06 weth,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
        public
 | 
					        public
 | 
				
			||||||
        MixinBancor(weth)
 | 
					        MixinBancor(weth)
 | 
				
			||||||
@@ -82,16 +82,6 @@ contract EthereumBridgeAdapterGroup1 is
 | 
				
			|||||||
        MixinUniswap(weth)
 | 
					        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(
 | 
					    function _trade(
 | 
				
			||||||
        BridgeOrder memory order,
 | 
					        BridgeOrder memory order,
 | 
				
			||||||
        IERC20TokenV06 sellToken,
 | 
					        IERC20TokenV06 sellToken,
 | 
				
			||||||
		Reference in New Issue
	
	Block a user