aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/test/utils/token_utils.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-12 00:53:50 +0800
committerFabio Berger <me@fabioberger.com>2018-07-12 00:53:50 +0800
commitb6ac132c789939414e2aba911246e6a931facea4 (patch)
tree66c6f0ea16868aa06a6ffc188bcc575d2891b5c3 /packages/0x.js/test/utils/token_utils.ts
parentabf87a643d85827cb1186e913fa6ae6bc04c8df1 (diff)
downloaddexon-0x-contracts-b6ac132c789939414e2aba911246e6a931facea4.tar.gz
dexon-0x-contracts-b6ac132c789939414e2aba911246e6a931facea4.tar.zst
dexon-0x-contracts-b6ac132c789939414e2aba911246e6a931facea4.zip
Refactor 0x.js to V2
Diffstat (limited to 'packages/0x.js/test/utils/token_utils.ts')
-rw-r--r--packages/0x.js/test/utils/token_utils.ts40
1 files changed, 9 insertions, 31 deletions
diff --git a/packages/0x.js/test/utils/token_utils.ts b/packages/0x.js/test/utils/token_utils.ts
index fe4886ba4..76ee80b58 100644
--- a/packages/0x.js/test/utils/token_utils.ts
+++ b/packages/0x.js/test/utils/token_utils.ts
@@ -1,34 +1,12 @@
-import { Token } from '@0xproject/types';
-import * as _ from 'lodash';
+import { generatePseudoRandomSalt } from '@0xproject/order-utils';
+import { BigNumber } from '@0xproject/utils';
-import { InternalZeroExError } from '../../src/types';
+import { artifacts } from '../../src/artifacts';
-const PROTOCOL_TOKEN_SYMBOL = 'ZRX';
-const WETH_TOKEN_SYMBOL = 'WETH';
+import { constants } from './constants';
-export class TokenUtils {
- private _tokens: Token[];
- constructor(tokens: Token[]) {
- this._tokens = tokens;
- }
- public getProtocolTokenOrThrow(): Token {
- const zrxToken = _.find(this._tokens, { symbol: PROTOCOL_TOKEN_SYMBOL });
- if (_.isUndefined(zrxToken)) {
- throw new Error(InternalZeroExError.ZrxNotInTokenRegistry);
- }
- return zrxToken;
- }
- public getWethTokenOrThrow(): Token {
- const wethToken = _.find(this._tokens, { symbol: WETH_TOKEN_SYMBOL });
- if (_.isUndefined(wethToken)) {
- throw new Error(InternalZeroExError.WethNotInTokenRegistry);
- }
- return wethToken;
- }
- public getDummyTokens(): Token[] {
- const dummyTokens = _.filter(this._tokens, token => {
- return !_.includes([PROTOCOL_TOKEN_SYMBOL, WETH_TOKEN_SYMBOL], token.symbol);
- });
- return dummyTokens;
- }
-}
+export const tokenUtils = {
+ getProtocolTokenAddress(): string {
+ return artifacts.ZRXToken.networks[constants.TESTRPC_NETWORK_ID].address;
+ },
+};