diff options
Diffstat (limited to 'packages/asset-buyer/src/utils')
-rw-r--r-- | packages/asset-buyer/src/utils/assert.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/asset-buyer/src/utils/assert.ts b/packages/asset-buyer/src/utils/assert.ts index edc90608c..745ba726f 100644 --- a/packages/asset-buyer/src/utils/assert.ts +++ b/packages/asset-buyer/src/utils/assert.ts @@ -41,4 +41,11 @@ export const assert = { `Expected all orders in ${variableName} to have the same makerAssetData and takerAssetData.`, ); }, + isValidPercentage(variableName: string, percentage: number): void { + assert.isNumber(variableName, percentage); + assert.assert( + percentage >= 0 && percentage <= 1, + `Expected ${variableName} to be between 0 and 1, but is ${percentage}`, + ); + }, }; |