diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-22 08:08:44 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-23 06:39:03 +0800 |
commit | 68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed (patch) | |
tree | b951b52ab55cbd2d1b931ea2d91b59bbc4468514 /packages/forwarder-helper/src | |
parent | 67d33ec10c3d2467d2d073d22bfe2957353a0cc8 (diff) | |
download | dexon-sol-tools-68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed.tar dexon-sol-tools-68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed.tar.gz dexon-sol-tools-68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed.tar.bz2 dexon-sol-tools-68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed.tar.lz dexon-sol-tools-68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed.tar.xz dexon-sol-tools-68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed.tar.zst dexon-sol-tools-68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed.zip |
Add tests for getMarketBuyOrdersInfo
Diffstat (limited to 'packages/forwarder-helper/src')
-rw-r--r-- | packages/forwarder-helper/src/forwarder_helper_impl.ts | 4 | ||||
-rw-r--r-- | packages/forwarder-helper/src/types.ts | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 43b2962da..123c925f1 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -83,7 +83,7 @@ export class ForwarderHelperImpl implements ForwarderHelper { const { makerAssetFillAmount, feePercentage } = request; const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = this.config; // TODO: make the slippage percentage customizable - const slippageBufferAmount = makerAssetFillAmount.mul(SLIPPAGE_PERCENTAGE); + const slippageBufferAmount = makerAssetFillAmount.mul(SLIPPAGE_PERCENTAGE).round(); const { resultOrders, remainingFillAmount } = marketUtils.findOrdersThatCoverMakerAssetFillAmount( orders, makerAssetFillAmount, @@ -93,7 +93,7 @@ export class ForwarderHelperImpl implements ForwarderHelper { }, ); if (remainingFillAmount.gt(constants.ZERO_AMOUNT)) { - throw new Error(ForwarderHelperError.InsufficientLiquidity); + throw new Error(ForwarderHelperError.InsufficientMakerAssetLiquidity); } // TODO: update this logic to find the minimum amount of feeOrders to cover the worst case as opposed to // finding order that cover all fees, this will help with estimating ETH and minimizing gas usage diff --git a/packages/forwarder-helper/src/types.ts b/packages/forwarder-helper/src/types.ts index 084c3303e..fb171cc90 100644 --- a/packages/forwarder-helper/src/types.ts +++ b/packages/forwarder-helper/src/types.ts @@ -12,7 +12,7 @@ export interface ForwarderHelper { } export enum ForwarderHelperError { - InsufficientLiquidity = 'INSUFFICIENT_LIQUIDITY', + InsufficientMakerAssetLiquidity = 'INSUFFICIENT_MAKER_ASSET_LIQUIDITY', InsufficientZrxLiquidity = 'INSUFFICIENT_ZRX_LIQUIDITY', } |