diff options
Diffstat (limited to 'packages/contracts/util')
-rw-r--r-- | packages/contracts/util/artifacts.ts | 4 | ||||
-rw-r--r-- | packages/contracts/util/balances.ts | 2 | ||||
-rw-r--r-- | packages/contracts/util/bignumber_config.ts | 11 | ||||
-rw-r--r-- | packages/contracts/util/constants.ts | 5 | ||||
-rw-r--r-- | packages/contracts/util/crypto.ts | 1 | ||||
-rw-r--r-- | packages/contracts/util/rpc.ts | 43 |
6 files changed, 10 insertions, 56 deletions
diff --git a/packages/contracts/util/artifacts.ts b/packages/contracts/util/artifacts.ts index b15c9216f..6b05df78c 100644 --- a/packages/contracts/util/artifacts.ts +++ b/packages/contracts/util/artifacts.ts @@ -6,7 +6,9 @@ export class Artifacts { public Exchange: any; public ZRXToken: any; public DummyToken: any; + public DummyTokenV2: any; public EtherToken: any; + public EtherTokenV2: any; public MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress: any; public MaliciousToken: any; constructor(artifacts: any) { @@ -17,7 +19,9 @@ export class Artifacts { this.Exchange = artifacts.require('Exchange'); this.ZRXToken = artifacts.require('ZRXToken'); this.DummyToken = artifacts.require('DummyToken'); + this.DummyTokenV2 = artifacts.require('DummyToken_v2'); this.EtherToken = artifacts.require('EtherToken'); + this.EtherTokenV2 = artifacts.require('EtherToken_v2'); this.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = artifacts.require( 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress'); this.MaliciousToken = artifacts.require('MaliciousToken'); diff --git a/packages/contracts/util/balances.ts b/packages/contracts/util/balances.ts index fce15db6d..7f5e843a5 100644 --- a/packages/contracts/util/balances.ts +++ b/packages/contracts/util/balances.ts @@ -1,7 +1,7 @@ +import {bigNumberConfigs} from '@0xproject/utils'; import {BigNumber} from 'bignumber.js'; import * as _ from 'lodash'; -import {bigNumberConfigs} from './bignumber_config'; import {BalancesByOwner, ContractInstance} from './types'; bigNumberConfigs.configure(); diff --git a/packages/contracts/util/bignumber_config.ts b/packages/contracts/util/bignumber_config.ts deleted file mode 100644 index 38f59d341..000000000 --- a/packages/contracts/util/bignumber_config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import {BigNumber} from 'bignumber.js'; - -export const bigNumberConfigs = { - configure() { - // By default BigNumber's `toString` method converts to exponential notation if the value has - // more then 20 digits. We want to avoid this behavior, so we set EXPONENTIAL_AT to a high number - BigNumber.config({ - EXPONENTIAL_AT: 1000, - }); - }, -}; diff --git a/packages/contracts/util/constants.ts b/packages/contracts/util/constants.ts index 5beebc68c..e61b2f802 100644 --- a/packages/contracts/util/constants.ts +++ b/packages/contracts/util/constants.ts @@ -1,4 +1,9 @@ export const constants = { NULL_BYTES: '0x', INVALID_OPCODE: 'invalid opcode', + REVERT: 'revert', + TESTRPC_NETWORK_ID: 50, + MAX_ETHERTOKEN_WITHDRAW_GAS: 43000, + MAX_TOKEN_TRANSFERFROM_GAS: 80000, + MAX_TOKEN_APPROVE_GAS: 60000, }; diff --git a/packages/contracts/util/crypto.ts b/packages/contracts/util/crypto.ts index 5253b8c15..2e43ae816 100644 --- a/packages/contracts/util/crypto.ts +++ b/packages/contracts/util/crypto.ts @@ -1,4 +1,3 @@ -import {BigNumber} from 'bignumber.js'; import BN = require('bn.js'); import ABI = require('ethereumjs-abi'); import ethUtil = require('ethereumjs-util'); diff --git a/packages/contracts/util/rpc.ts b/packages/contracts/util/rpc.ts deleted file mode 100644 index 023602bd6..000000000 --- a/packages/contracts/util/rpc.ts +++ /dev/null @@ -1,43 +0,0 @@ -import 'isomorphic-fetch'; - -import * as truffleConf from '../truffle.js'; - -export class RPC { - private host: string; - private port: number; - private id: number; - constructor() { - this.host = truffleConf.networks.development.host; - this.port = truffleConf.networks.development.port; - this.id = 0; - } - public async increaseTimeAsync(time: number) { - const method = 'evm_increaseTime'; - const params = [time]; - const payload = this.toPayload(method, params); - return this.sendAsync(payload); - } - public async mineBlockAsync() { - const method = 'evm_mine'; - const payload = this.toPayload(method); - return this.sendAsync(payload); - } - private toPayload(method: string, params: any[] = []) { - const payload = JSON.stringify({ - id: this.id, - method, - params, - }); - this.id++; - return payload; - } - private async sendAsync(payload: string): Promise<any> { - const opts = { - method: 'POST', - body: payload, - }; - const response = await fetch(`http://${this.host}:${this.port}`, opts); - const responsePayload = await response.json(); - return responsePayload; - } -} |