Always use DFB in asset-swapper (#2542)

* Always use DFB in asset-swapper

* Clean up
This commit is contained in:
Jacob Evans
2020-04-09 15:52:15 +10:00
committed by GitHub
parent a80d1f861c
commit 0e196a59d9
2 changed files with 7 additions and 2 deletions

View File

@@ -169,7 +169,8 @@ export function createOrdersFromPath(path: Fill[], opts: CreateOrderFromPathOpts
}
contiguousBridgeFills.push(collapsedPath[j]);
}
if (contiguousBridgeFills.length === 1 || !opts.shouldBatchBridgeOrders) {
// Always use DexForwarderBridge unless configured not to
if (!opts.shouldBatchBridgeOrders) {
orders.push(createBridgeOrder(contiguousBridgeFills[0], opts));
i += 1;
} else {

View File

@@ -69,7 +69,11 @@ describe('MarketOperationUtils tests', () => {
if (assetData.length === 74) {
return ERC20BridgeSource.Native;
}
const bridgeAddress = hexUtils.slice(assetData, 48, 68).toLowerCase();
const bridgeData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (!assetDataUtils.isERC20BridgeAssetData(bridgeData)) {
throw new Error('AssetData is not ERC20BridgeAssetData');
}
const { bridgeAddress } = bridgeData;
switch (bridgeAddress) {
case KYBER_BRIDGE_ADDRESS.toLowerCase():
return ERC20BridgeSource.Kyber;