aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-17 06:16:49 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-17 06:16:49 +0800
commit466ec6b22a51f0a9d618f6091ce6f9f533118280 (patch)
tree433bf040b0e11666bb1429b569c941d5e677395b /packages/asset-buyer/src
parenta58771844366d5fd331e6b46a8de596d17fa6632 (diff)
downloaddexon-0x-contracts-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar
dexon-0x-contracts-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.gz
dexon-0x-contracts-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.bz2
dexon-0x-contracts-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.lz
dexon-0x-contracts-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.xz
dexon-0x-contracts-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.zst
dexon-0x-contracts-466ec6b22a51f0a9d618f6091ce6f9f533118280.zip
Change LiquidityForAssetData to return a BigNumber instead of a number to avoid losing precision
Diffstat (limited to 'packages/asset-buyer/src')
-rw-r--r--packages/asset-buyer/src/asset_buyer.ts4
-rw-r--r--packages/asset-buyer/src/types.ts4
-rw-r--r--packages/asset-buyer/src/utils/calculate_liquidity.ts4
3 files changed, 6 insertions, 6 deletions
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts
index b4b024d62..4344f070c 100644
--- a/packages/asset-buyer/src/asset_buyer.ts
+++ b/packages/asset-buyer/src/asset_buyer.ts
@@ -200,8 +200,8 @@ export class AssetBuyer {
const etherTokenAssetData = this._getEtherTokenAssetDataOrThrow();
if (!assetPairs.includes(etherTokenAssetData)) {
return {
- tokensAvailableInBaseUnits: 0,
- ethValueAvailableInWei: 0,
+ tokensAvailableInBaseUnits: new BigNumber(0),
+ ethValueAvailableInWei: new BigNumber(0),
};
}
diff --git a/packages/asset-buyer/src/types.ts b/packages/asset-buyer/src/types.ts
index 9208a3217..46a2338ce 100644
--- a/packages/asset-buyer/src/types.ts
+++ b/packages/asset-buyer/src/types.ts
@@ -137,6 +137,6 @@ export interface OrdersAndFillableAmounts {
* Represents available liquidity for a given assetData
*/
export interface LiquidityForAssetData {
- tokensAvailableInBaseUnits: number;
- ethValueAvailableInWei: number;
+ tokensAvailableInBaseUnits: BigNumber;
+ ethValueAvailableInWei: BigNumber;
}
diff --git a/packages/asset-buyer/src/utils/calculate_liquidity.ts b/packages/asset-buyer/src/utils/calculate_liquidity.ts
index 910c756ac..a8d165b4b 100644
--- a/packages/asset-buyer/src/utils/calculate_liquidity.ts
+++ b/packages/asset-buyer/src/utils/calculate_liquidity.ts
@@ -28,7 +28,7 @@ export const calculateLiquidity = (ordersAndFillableAmounts: OrdersAndFillableAm
// Turn into regular numbers
return {
- tokensAvailableInBaseUnits: liquidityInBigNumbers.tokensAvailableInBaseUnits.toNumber(),
- ethValueAvailableInWei: liquidityInBigNumbers.ethValueAvailableInWei.toNumber(),
+ tokensAvailableInBaseUnits: liquidityInBigNumbers.tokensAvailableInBaseUnits,
+ ethValueAvailableInWei: liquidityInBigNumbers.ethValueAvailableInWei,
};
};