Collapse on-chain sources into DexForwarderBridge (#2560)

* Collapse on-chain sources into DexForwarderBridge

* Fix tests. CHANGELOG
This commit is contained in:
Jacob Evans 2020-04-23 13:12:46 +10:00 committed by GitHub
parent 07acc9529e
commit cac6f5234f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 11 deletions

View File

@ -49,6 +49,10 @@
{ {
"note": "Add support for indicative (non-committal) quotes via RFQ-T", "note": "Add support for indicative (non-committal) quotes via RFQ-T",
"pr": 2555 "pr": 2555
},
{
"note": "Collapse `LiquidityProvider` into `DexForwarderBridge`",
"pr": 2560
} }
] ]
}, },

View File

@ -153,19 +153,10 @@ export function createOrdersFromPath(path: Fill[], opts: CreateOrderFromPathOpts
++i; ++i;
continue; continue;
} }
// Liquidity Provider must be called by ERC20BridgeProxy
if (collapsedPath[i].source === ERC20BridgeSource.LiquidityProvider) {
orders.push(createBridgeOrder(collapsedPath[i], opts));
++i;
continue;
}
// If there are contiguous bridge orders, we can batch them together. // If there are contiguous bridge orders, we can batch them together.
const contiguousBridgeFills = [collapsedPath[i]]; const contiguousBridgeFills = [collapsedPath[i]];
for (let j = i + 1; j < collapsedPath.length; ++j) { for (let j = i + 1; j < collapsedPath.length; ++j) {
if ( if (collapsedPath[j].source === ERC20BridgeSource.Native) {
collapsedPath[j].source === ERC20BridgeSource.Native ||
collapsedPath[j].source === ERC20BridgeSource.LiquidityProvider
) {
break; break;
} }
contiguousBridgeFills.push(collapsedPath[j]); contiguousBridgeFills.push(collapsedPath[j]);

View File

@ -659,7 +659,7 @@ describe('MarketOperationUtils tests', () => {
}), }),
], ],
Web3Wrapper.toBaseUnitAmount(10, 18), Web3Wrapper.toBaseUnitAmount(10, 18),
{ excludedSources: SELL_SOURCES, numSamples: 4, bridgeSlippage: 0 }, { excludedSources: SELL_SOURCES, numSamples: 4, bridgeSlippage: 0, shouldBatchBridgeOrders: false },
); );
expect(result.length).to.eql(1); expect(result.length).to.eql(1);
expect(result[0].makerAddress).to.eql(liquidityProviderAddress); expect(result[0].makerAddress).to.eql(liquidityProviderAddress);