aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/asset-buyer/src/types.ts')
-rw-r--r--packages/asset-buyer/src/types.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/asset-buyer/src/types.ts b/packages/asset-buyer/src/types.ts
index 3b573edca..dfa17a22d 100644
--- a/packages/asset-buyer/src/types.ts
+++ b/packages/asset-buyer/src/types.ts
@@ -117,6 +117,16 @@ export enum AssetBuyerError {
TransactionValueTooLow = 'TRANSACTION_VALUE_TOO_LOW',
}
+export class InsufficientAssetLiquidityError extends Error {
+ public numAssetsAvailable: BigNumber;
+ constructor(numAssetsAvailable: BigNumber) {
+ super(AssetBuyerError.InsufficientAssetLiquidity);
+ this.numAssetsAvailable = numAssetsAvailable;
+ // Setting prototype so instanceof works. See https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
+ Object.setPrototypeOf(this, InsufficientAssetLiquidityError.prototype);
+ }
+}
+
export interface OrdersAndFillableAmounts {
orders: SignedOrder[];
remainingFillableMakerAssetAmounts: BigNumber[];