aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer
diff options
context:
space:
mode:
Diffstat (limited to 'packages/asset-buyer')
-rw-r--r--packages/asset-buyer/src/asset_buyer.ts3
-rw-r--r--packages/asset-buyer/test/asset_buyer_test.ts30
2 files changed, 24 insertions, 9 deletions
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts
index 77cf403d7..43b60f928 100644
--- a/packages/asset-buyer/src/asset_buyer.ts
+++ b/packages/asset-buyer/src/asset_buyer.ts
@@ -227,7 +227,8 @@ export class AssetBuyer {
assert.isBoolean('shouldForceOrderRefresh', shouldForceOrderRefresh);
const assetPairs = await this.orderProvider.getAvailableMakerAssetDatasAsync(assetData);
- if (!assetPairs.includes(assetData)) {
+ const etherTokenAssetData = this._getEtherTokenAssetDataOrThrow();
+ if (!assetPairs.includes(etherTokenAssetData)) {
return {
tokensAvailableInBaseUnits: 0,
ethValueAvailableInWei: 0,
diff --git a/packages/asset-buyer/test/asset_buyer_test.ts b/packages/asset-buyer/test/asset_buyer_test.ts
index 5e05d5564..9ed51f5e5 100644
--- a/packages/asset-buyer/test/asset_buyer_test.ts
+++ b/packages/asset-buyer/test/asset_buyer_test.ts
@@ -24,6 +24,8 @@ const expect = chai.expect;
const FAKE_SRA_URL = 'https://fakeurl.com';
const FAKE_ASSET_DATA = '0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48';
const TOKEN_DECIMALS = 18;
+const DAI_ASSET_DATA = '0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359"';
+const WETH_ASSET_DATA = '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
const WETH_DECIMALS = constants.ETHER_TOKEN_DECIMALS;
const baseUnitAmount = (unitAmount: number, decimals = TOKEN_DECIMALS): BigNumber => {
@@ -75,14 +77,26 @@ describe('AssetBuyer', () => {
});
});
- it('should return 0s when asset pair not supported', async () => {
- mockAvailableAssetDatas(mockOrderProvider, FAKE_ASSET_DATA, []);
+ describe('asset pair not supported', () => {
+ it('should return 0s when no asset pair not supported', async () => {
+ mockAvailableAssetDatas(mockOrderProvider, FAKE_ASSET_DATA, []);
- const assetBuyer = new AssetBuyer(mockWeb3Provider.object, mockOrderProvider.object);
- const liquidityResult = await assetBuyer.getLiquidityForAssetDataAsync(FAKE_ASSET_DATA);
- expect(liquidityResult).to.deep.equal({
- tokensAvailableInBaseUnits: 0,
- ethValueAvailableInWei: 0,
+ const assetBuyer = new AssetBuyer(mockWeb3Provider.object, mockOrderProvider.object);
+ const liquidityResult = await assetBuyer.getLiquidityForAssetDataAsync(FAKE_ASSET_DATA);
+ expect(liquidityResult).to.deep.equal({
+ tokensAvailableInBaseUnits: 0,
+ ethValueAvailableInWei: 0,
+ });
+ });
+ it('should return 0s when only other asset pair supported', async () => {
+ mockAvailableAssetDatas(mockOrderProvider, FAKE_ASSET_DATA, [DAI_ASSET_DATA]);
+
+ const assetBuyer = new AssetBuyer(mockWeb3Provider.object, mockOrderProvider.object);
+ const liquidityResult = await assetBuyer.getLiquidityForAssetDataAsync(FAKE_ASSET_DATA);
+ expect(liquidityResult).to.deep.equal({
+ tokensAvailableInBaseUnits: 0,
+ ethValueAvailableInWei: 0,
+ });
});
});
@@ -98,7 +112,7 @@ describe('AssetBuyer', () => {
});
beforeEach(() => {
- mockAvailableAssetDatas(mockOrderProvider, FAKE_ASSET_DATA, [FAKE_ASSET_DATA]);
+ mockAvailableAssetDatas(mockOrderProvider, FAKE_ASSET_DATA, [WETH_ASSET_DATA]);
});
it('should return 0s when no orders available', async () => {