diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-23 05:45:44 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-23 06:39:03 +0800 |
commit | a5c7ddcff54fcb9e88adfda15167836b00db877d (patch) | |
tree | ff09cc722ce3823a497f95239b1e40612de5ca94 /packages/forwarder-helper/src/forwarder_helper_impl.ts | |
parent | 6cef847a2759864de64d79ea02368bd85039e5ad (diff) | |
download | dexon-sol-tools-a5c7ddcff54fcb9e88adfda15167836b00db877d.tar dexon-sol-tools-a5c7ddcff54fcb9e88adfda15167836b00db877d.tar.gz dexon-sol-tools-a5c7ddcff54fcb9e88adfda15167836b00db877d.tar.bz2 dexon-sol-tools-a5c7ddcff54fcb9e88adfda15167836b00db877d.tar.lz dexon-sol-tools-a5c7ddcff54fcb9e88adfda15167836b00db877d.tar.xz dexon-sol-tools-a5c7ddcff54fcb9e88adfda15167836b00db877d.tar.zst dexon-sol-tools-a5c7ddcff54fcb9e88adfda15167836b00db877d.zip |
Add more comments
Diffstat (limited to 'packages/forwarder-helper/src/forwarder_helper_impl.ts')
-rw-r--r-- | packages/forwarder-helper/src/forwarder_helper_impl.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 123c925f1..f21fab9fd 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -52,15 +52,18 @@ export class ForwarderHelperImpl implements ForwarderHelper { } private static _sortConfig(opts: ForwarderHelperImplConfig): ForwarderHelperImplConfig { const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = opts; + // Bundle orders together with their remainingFillAmounts so that we can sort them together const orderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( orders, remainingFillableMakerAssetAmounts, ); // TODO: provide a feeRate to the sorting function to more accurately sort based on the current market for ZRX tokens const sortedOrderWithAmounts = sortingUtils.sortOrdersByFeeAdjustedRate(orderWithAmounts); + // Unbundle after sorting const unbundledSortedOrderWithAmounts = ForwarderHelperImpl._unbundleSignedOrderWithAmounts( sortedOrderWithAmounts, ); + // Do the same bundling + unbundling for feeOrder sorting const feeOrderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( feeOrders, remainingFillableFeeAmounts, |