Merge branch 'v2-prototype' into feature/truffle-sol-cov
This commit is contained in:
@@ -28,9 +28,7 @@
|
|||||||
"build:umd:prod": "NODE_ENV=production webpack",
|
"build:umd:prod": "NODE_ENV=production webpack",
|
||||||
"build:commonjs": "tsc && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
"build:commonjs": "tsc && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||||
"test:commonjs": "run-s build:commonjs run_mocha",
|
"test:commonjs": "run-s build:commonjs run_mocha",
|
||||||
"_comment": {"run_mocha": "mocha lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
|
"run_mocha": "mocha lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
|
||||||
"note": "The `run_mocha` test has been commented out by @hysz (greg@0xproject.com) until the migration package and 0x.js have been updated for V2."},
|
|
||||||
"run_mocha": "",
|
|
||||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||||
"docs:stage": "node scripts/stage_docs.js",
|
"docs:stage": "node scripts/stage_docs.js",
|
||||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"compact_artifacts": "Exchange DummyToken ZRXToken Token EtherToken TokenTransferProxy TokenRegistry",
|
"compact_artifacts": "Exchange DummyToken ZRXToken Token EtherToken TokenTransferProxy TokenRegistry",
|
||||||
"contracts": "Exchange DummyToken ZRXToken Token WETH9 TokenTransferProxy MultiSigWallet MultiSigWalletWithTimeLock MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress MaliciousToken TokenRegistry Arbitrage EtherDelta AccountLevels",
|
"contracts": "Exchange DummyToken ZRXToken Token WETH9 TokenTransferProxy_v1 MultiSigWallet MultiSigWalletWithTimeLock MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress MaliciousToken TokenRegistry Arbitrage EtherDelta AccountLevels",
|
||||||
"postpublish": {
|
"postpublish": {
|
||||||
"assets": [
|
"assets": [
|
||||||
"packages/contract-wrappers/_bundles/index.js",
|
"packages/contract-wrappers/_bundles/index.js",
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
"test:circleci": "yarn test:coverage"
|
"test:circleci": "yarn test:coverage"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"abis":
|
"abis": "../migrations/artifacts/2.0.0/@(DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TestAssetProxyDispatcher|TestLibBytes|TestLibs|TestSignatureValidator|TokenRegistry|WETH9|ZRXToken).json"
|
||||||
"../migrations/artifacts/2.0.0/@(DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TestAssetProxyDispatcher|TestLibBytes|TestLibs|TestSignatureValidator|TokenRegistry|WETH9|ZRXToken).json"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -66,8 +65,9 @@
|
|||||||
"yargs": "^10.0.3"
|
"yargs": "^10.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"0x.js": "^0.38.0",
|
|
||||||
"@0xproject/base-contract": "^0.3.2",
|
"@0xproject/base-contract": "^0.3.2",
|
||||||
|
"@0xproject/contract-wrappers": "^0.0.2",
|
||||||
|
"@0xproject/order-utils": "^0.0.5",
|
||||||
"@0xproject/sol-compiler": "^0.5.0",
|
"@0xproject/sol-compiler": "^0.5.0",
|
||||||
"@0xproject/types": "^0.7.0",
|
"@0xproject/types": "^0.7.0",
|
||||||
"@0xproject/typescript-typings": "^0.3.2",
|
"@0xproject/typescript-typings": "^0.3.2",
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { generatePseudoRandomSalt } from '@0xproject/order-utils';
|
||||||
|
|
||||||
import { crypto } from './crypto';
|
import { crypto } from './crypto';
|
||||||
|
|
||||||
export const addressUtils = {
|
export const addressUtils = {
|
||||||
generatePseudoRandomAddress(): string {
|
generatePseudoRandomAddress(): string {
|
||||||
const randomBigNum = ZeroEx.generatePseudoRandomSalt();
|
const randomBigNum = generatePseudoRandomSalt();
|
||||||
const randomBuff = crypto.solSHA3([randomBigNum]);
|
const randomBuff = crypto.solSHA3([randomBigNum]);
|
||||||
const randomAddress = `0x${randomBuff.slice(0, 20).toString('hex')}`;
|
const randomAddress = `0x${randomBuff.slice(0, 20).toString('hex')}`;
|
||||||
return randomAddress;
|
return randomAddress;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
@@ -31,13 +31,14 @@ export const constants = {
|
|||||||
NUM_DUMMY_ERC20_TO_DEPLOY: 3,
|
NUM_DUMMY_ERC20_TO_DEPLOY: 3,
|
||||||
NUM_DUMMY_ERC721_TO_DEPLOY: 1,
|
NUM_DUMMY_ERC721_TO_DEPLOY: 1,
|
||||||
NUM_ERC721_TOKENS_TO_MINT: 2,
|
NUM_ERC721_TOKENS_TO_MINT: 2,
|
||||||
|
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
||||||
TESTRPC_PRIVATE_KEYS: _.map(TESTRPC_PRIVATE_KEYS_STRINGS, privateKeyString => ethUtil.toBuffer(privateKeyString)),
|
TESTRPC_PRIVATE_KEYS: _.map(TESTRPC_PRIVATE_KEYS_STRINGS, privateKeyString => ethUtil.toBuffer(privateKeyString)),
|
||||||
INITIAL_ERC20_BALANCE: ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18),
|
INITIAL_ERC20_BALANCE: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18),
|
||||||
INITIAL_ERC20_ALLOWANCE: ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18),
|
INITIAL_ERC20_ALLOWANCE: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18),
|
||||||
STATIC_ORDER_PARAMS: {
|
STATIC_ORDER_PARAMS: {
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
|
||||||
makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
|
makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
|
||||||
takerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
|
takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { generatePseudoRandomSalt } from '@0xproject/order-utils';
|
||||||
import { Provider } from '@0xproject/types';
|
import { Provider } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -54,7 +54,7 @@ export class ERC721Wrapper {
|
|||||||
_.forEach(this._dummyTokenContracts, dummyTokenContract => {
|
_.forEach(this._dummyTokenContracts, dummyTokenContract => {
|
||||||
_.forEach(this._tokenOwnerAddresses, tokenOwnerAddress => {
|
_.forEach(this._tokenOwnerAddresses, tokenOwnerAddress => {
|
||||||
_.forEach(_.range(constants.NUM_ERC721_TOKENS_TO_MINT), () => {
|
_.forEach(_.range(constants.NUM_ERC721_TOKENS_TO_MINT), () => {
|
||||||
const tokenId = ZeroEx.generatePseudoRandomSalt();
|
const tokenId = generatePseudoRandomSalt();
|
||||||
setBalancePromises.push(
|
setBalancePromises.push(
|
||||||
dummyTokenContract.mint.sendTransactionAsync(tokenOwnerAddress, tokenId, {
|
dummyTokenContract.mint.sendTransactionAsync(tokenOwnerAddress, tokenId, {
|
||||||
from: this._contractOwnerAddress,
|
from: this._contractOwnerAddress,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { TransactionReceiptWithDecodedLogs, ZeroEx } from '0x.js';
|
import { Provider, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as Web3 from 'web3';
|
import * as Web3 from 'web3';
|
||||||
|
|
||||||
@@ -13,11 +14,11 @@ import { AssetProxyId, OrderInfo, SignedOrder, SignedTransaction } from './types
|
|||||||
|
|
||||||
export class ExchangeWrapper {
|
export class ExchangeWrapper {
|
||||||
private _exchange: ExchangeContract;
|
private _exchange: ExchangeContract;
|
||||||
|
private _web3Wrapper: Web3Wrapper;
|
||||||
private _logDecoder: LogDecoder = new LogDecoder(constants.TESTRPC_NETWORK_ID);
|
private _logDecoder: LogDecoder = new LogDecoder(constants.TESTRPC_NETWORK_ID);
|
||||||
private _zeroEx: ZeroEx;
|
constructor(exchangeContract: ExchangeContract, provider: Provider) {
|
||||||
constructor(exchangeContract: ExchangeContract, zeroEx: ZeroEx) {
|
|
||||||
this._exchange = exchangeContract;
|
this._exchange = exchangeContract;
|
||||||
this._zeroEx = zeroEx;
|
this._web3Wrapper = new Web3Wrapper(provider);
|
||||||
}
|
}
|
||||||
public async fillOrderAsync(
|
public async fillOrderAsync(
|
||||||
signedOrder: SignedOrder,
|
signedOrder: SignedOrder,
|
||||||
@@ -196,7 +197,7 @@ export class ExchangeWrapper {
|
|||||||
opts: { oldAssetProxyAddressIfExists?: string } = {},
|
opts: { oldAssetProxyAddressIfExists?: string } = {},
|
||||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
const oldAssetProxyAddress = _.isUndefined(opts.oldAssetProxyAddressIfExists)
|
const oldAssetProxyAddress = _.isUndefined(opts.oldAssetProxyAddressIfExists)
|
||||||
? ZeroEx.NULL_ADDRESS
|
? constants.NULL_ADDRESS
|
||||||
: opts.oldAssetProxyAddressIfExists;
|
: opts.oldAssetProxyAddressIfExists;
|
||||||
const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync(
|
const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync(
|
||||||
assetProxyId,
|
assetProxyId,
|
||||||
@@ -246,7 +247,7 @@ export class ExchangeWrapper {
|
|||||||
return tx;
|
return tx;
|
||||||
}
|
}
|
||||||
private async _getTxWithDecodedExchangeLogsAsync(txHash: string): Promise<TransactionReceiptWithDecodedLogs> {
|
private async _getTxWithDecodedExchangeLogsAsync(txHash: string): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
const tx = await this._web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
|
||||||
tx.logs = _.map(tx.logs, log => this._logDecoder.decodeLogOrThrow(log));
|
tx.logs = _.map(tx.logs, log => this._logDecoder.decodeLogOrThrow(log));
|
||||||
return tx;
|
return tx;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { generatePseudoRandomSalt } from '@0xproject/order-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { constants } from './constants';
|
||||||
import { orderUtils } from './order_utils';
|
import { orderUtils } from './order_utils';
|
||||||
import { signingUtils } from './signing_utils';
|
import { signingUtils } from './signing_utils';
|
||||||
import { SignatureType, SignedOrder, UnsignedOrder } from './types';
|
import { SignatureType, SignedOrder, UnsignedOrder } from './types';
|
||||||
@@ -19,10 +20,10 @@ export class OrderFactory {
|
|||||||
): SignedOrder {
|
): SignedOrder {
|
||||||
const randomExpiration = new BigNumber(Math.floor((Date.now() + Math.random() * 100000000000) / 1000));
|
const randomExpiration = new BigNumber(Math.floor((Date.now() + Math.random() * 100000000000) / 1000));
|
||||||
const order = ({
|
const order = ({
|
||||||
senderAddress: ZeroEx.NULL_ADDRESS,
|
senderAddress: constants.NULL_ADDRESS,
|
||||||
expirationTimeSeconds: randomExpiration,
|
expirationTimeSeconds: randomExpiration,
|
||||||
salt: ZeroEx.generatePseudoRandomSalt(),
|
salt: generatePseudoRandomSalt(),
|
||||||
takerAddress: ZeroEx.NULL_ADDRESS,
|
takerAddress: constants.NULL_ADDRESS,
|
||||||
...this._defaultOrderParams,
|
...this._defaultOrderParams,
|
||||||
...customOrderParams,
|
...customOrderParams,
|
||||||
} as any) as UnsignedOrder;
|
} as any) as UnsignedOrder;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { generatePseudoRandomSalt } from '@0xproject/order-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export class TransactionFactory {
|
|||||||
data: string,
|
data: string,
|
||||||
signatureType: SignatureType = SignatureType.Ecrecover,
|
signatureType: SignatureType = SignatureType.Ecrecover,
|
||||||
): SignedTransaction {
|
): SignedTransaction {
|
||||||
const salt = ZeroEx.generatePseudoRandomSalt();
|
const salt = generatePseudoRandomSalt();
|
||||||
const txHash = crypto.solSHA3([this._exchangeAddress, salt, ethUtil.toBuffer(data)]);
|
const txHash = crypto.solSHA3([this._exchangeAddress, salt, ethUtil.toBuffer(data)]);
|
||||||
const signature = signingUtils.signMessage(txHash, this._privateKey, signatureType);
|
const signature = signingUtils.signMessage(txHash, this._privateKey, signatureType);
|
||||||
const signedTx = {
|
const signedTx = {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
@@ -37,8 +36,6 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
let erc721Wrapper: ERC721Wrapper;
|
let erc721Wrapper: ERC721Wrapper;
|
||||||
let erc721MakerTokenId: BigNumber;
|
let erc721MakerTokenId: BigNumber;
|
||||||
|
|
||||||
let zeroEx: ZeroEx;
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
});
|
});
|
||||||
@@ -73,10 +70,6 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
}),
|
}),
|
||||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
);
|
);
|
||||||
|
|
||||||
zeroEx = new ZeroEx(provider, {
|
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
@@ -200,7 +193,7 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
amounts,
|
amounts,
|
||||||
{ from: exchangeAddress },
|
{ from: exchangeAddress },
|
||||||
);
|
);
|
||||||
const res = await zeroEx.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
const res = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||||
|
|
||||||
expect(res.logs.length).to.equal(numTransfers);
|
expect(res.logs.length).to.equal(numTransfers);
|
||||||
@@ -383,7 +376,7 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
amounts,
|
amounts,
|
||||||
{ from: exchangeAddress },
|
{ from: exchangeAddress },
|
||||||
);
|
);
|
||||||
const res = await zeroEx.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
const res = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
expect(res.logs.length).to.equal(numTransfers);
|
expect(res.logs.length).to.equal(numTransfers);
|
||||||
|
|
||||||
const newOwnerMakerAssetA = await erc721Token.ownerOf.callAsync(makerTokenIdA);
|
const newOwnerMakerAssetA = await erc721Token.ownerOf.callAsync(makerTokenIdA);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ContractWrappersError, ZeroEx } from '0x.js';
|
import { ContractWrappers, ContractWrappersError } from '@0xproject/contract-wrappers';
|
||||||
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber, promisify } from '@0xproject/utils';
|
import { BigNumber, promisify } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
@@ -17,8 +17,8 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
|||||||
|
|
||||||
describe('EtherToken', () => {
|
describe('EtherToken', () => {
|
||||||
let account: string;
|
let account: string;
|
||||||
const gasPrice = ZeroEx.toBaseUnitAmount(new BigNumber(20), 9);
|
const gasPrice = Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 9);
|
||||||
let zeroEx: ZeroEx;
|
let contractWrappers: ContractWrappers;
|
||||||
let etherTokenAddress: string;
|
let etherTokenAddress: string;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
@@ -33,7 +33,7 @@ describe('EtherToken', () => {
|
|||||||
|
|
||||||
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, txDefaults);
|
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, txDefaults);
|
||||||
etherTokenAddress = etherToken.address;
|
etherTokenAddress = etherToken.address;
|
||||||
zeroEx = new ZeroEx(provider, {
|
contractWrappers = new ContractWrappers(provider, {
|
||||||
gasPrice,
|
gasPrice,
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
networkId: constants.TESTRPC_NETWORK_ID,
|
||||||
});
|
});
|
||||||
@@ -49,23 +49,23 @@ describe('EtherToken', () => {
|
|||||||
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
||||||
const ethToDeposit = initEthBalance.plus(1);
|
const ethToDeposit = initEthBalance.plus(1);
|
||||||
|
|
||||||
return expect(zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account)).to.be.rejectedWith(
|
return expect(
|
||||||
ContractWrappersError.InsufficientEthBalanceForDeposit,
|
contractWrappers.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account),
|
||||||
);
|
).to.be.rejectedWith(ContractWrappersError.InsufficientEthBalanceForDeposit);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should convert deposited Ether to wrapped Ether tokens', async () => {
|
it('should convert deposited Ether to wrapped Ether tokens', async () => {
|
||||||
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
||||||
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
const initEthTokenBalance = await contractWrappers.token.getBalanceAsync(etherTokenAddress, account);
|
||||||
|
|
||||||
const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
|
const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
|
||||||
|
|
||||||
const txHash = await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
|
const txHash = await contractWrappers.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
|
||||||
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
|
const receipt = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
|
|
||||||
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
|
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
|
||||||
const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
||||||
const finalEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
const finalEthTokenBalance = await contractWrappers.token.getBalanceAsync(etherTokenAddress, account);
|
||||||
|
|
||||||
expect(finalEthBalance).to.be.bignumber.equal(initEthBalance.minus(ethToDeposit.plus(ethSpentOnGas)));
|
expect(finalEthBalance).to.be.bignumber.equal(initEthBalance.minus(ethToDeposit.plus(ethSpentOnGas)));
|
||||||
expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.plus(ethToDeposit));
|
expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.plus(ethToDeposit));
|
||||||
@@ -74,29 +74,34 @@ describe('EtherToken', () => {
|
|||||||
|
|
||||||
describe('withdraw', () => {
|
describe('withdraw', () => {
|
||||||
it('should throw if caller attempts to withdraw greater than caller balance', async () => {
|
it('should throw if caller attempts to withdraw greater than caller balance', async () => {
|
||||||
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
const initEthTokenBalance = await contractWrappers.token.getBalanceAsync(etherTokenAddress, account);
|
||||||
const ethTokensToWithdraw = initEthTokenBalance.plus(1);
|
const ethTokensToWithdraw = initEthTokenBalance.plus(1);
|
||||||
|
|
||||||
return expect(
|
return expect(
|
||||||
zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account),
|
contractWrappers.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account),
|
||||||
).to.be.rejectedWith(ContractWrappersError.InsufficientWEthBalanceForWithdrawal);
|
).to.be.rejectedWith(ContractWrappersError.InsufficientWEthBalanceForWithdrawal);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should convert ether tokens to ether with sufficient balance', async () => {
|
it('should convert ether tokens to ether with sufficient balance', async () => {
|
||||||
const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
|
const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
|
||||||
await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
|
await contractWrappers.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
|
||||||
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
const initEthTokenBalance = await contractWrappers.token.getBalanceAsync(etherTokenAddress, account);
|
||||||
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
||||||
const ethTokensToWithdraw = initEthTokenBalance;
|
const ethTokensToWithdraw = initEthTokenBalance;
|
||||||
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
|
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
|
||||||
const txHash = await zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account, {
|
const txHash = await contractWrappers.etherToken.withdrawAsync(
|
||||||
gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS,
|
etherTokenAddress,
|
||||||
});
|
ethTokensToWithdraw,
|
||||||
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
|
account,
|
||||||
|
{
|
||||||
|
gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const receipt = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
|
|
||||||
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
|
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
|
||||||
const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
||||||
const finalEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
const finalEthTokenBalance = await contractWrappers.token.getBalanceAsync(etherTokenAddress, account);
|
||||||
|
|
||||||
expect(finalEthBalance).to.be.bignumber.equal(
|
expect(finalEthBalance).to.be.bignumber.equal(
|
||||||
initEthBalance.plus(ethTokensToWithdraw.minus(ethSpentOnGas)),
|
initEthBalance.plus(ethTokensToWithdraw.minus(ethSpentOnGas)),
|
||||||
@@ -108,9 +113,9 @@ describe('EtherToken', () => {
|
|||||||
describe('fallback', () => {
|
describe('fallback', () => {
|
||||||
it('should convert sent ether to ether tokens', async () => {
|
it('should convert sent ether to ether tokens', async () => {
|
||||||
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
||||||
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
const initEthTokenBalance = await contractWrappers.token.getBalanceAsync(etherTokenAddress, account);
|
||||||
|
|
||||||
const ethToDeposit = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
|
const ethToDeposit = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18);
|
||||||
|
|
||||||
const txHash = await web3Wrapper.sendTransactionAsync({
|
const txHash = await web3Wrapper.sendTransactionAsync({
|
||||||
from: account,
|
from: account,
|
||||||
@@ -119,11 +124,11 @@ describe('EtherToken', () => {
|
|||||||
gasPrice,
|
gasPrice,
|
||||||
});
|
});
|
||||||
|
|
||||||
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
|
const receipt = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
|
|
||||||
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
|
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
|
||||||
const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
|
||||||
const finalEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
|
const finalEthTokenBalance = await contractWrappers.token.getBalanceAsync(etherTokenAddress, account);
|
||||||
|
|
||||||
expect(finalEthBalance).to.be.bignumber.equal(initEthBalance.minus(ethToDeposit.plus(ethSpentOnGas)));
|
expect(finalEthBalance).to.be.bignumber.equal(initEthBalance.minus(ethToDeposit.plus(ethSpentOnGas)));
|
||||||
expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.plus(ethToDeposit));
|
expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.plus(ethToDeposit));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { LogWithDecodedArgs, ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
|
import { LogWithDecodedArgs } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
import 'make-promises-safe';
|
import 'make-promises-safe';
|
||||||
@@ -59,8 +60,6 @@ describe('Exchange core', () => {
|
|||||||
let defaultMakerAssetAddress: string;
|
let defaultMakerAssetAddress: string;
|
||||||
let defaultTakerAssetAddress: string;
|
let defaultTakerAssetAddress: string;
|
||||||
|
|
||||||
let zeroEx: ZeroEx;
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
});
|
});
|
||||||
@@ -91,11 +90,7 @@ describe('Exchange core', () => {
|
|||||||
txDefaults,
|
txDefaults,
|
||||||
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
|
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
|
||||||
);
|
);
|
||||||
zeroEx = new ZeroEx(provider, {
|
exchangeWrapper = new ExchangeWrapper(exchange, provider);
|
||||||
exchangeContractAddress: exchange.address,
|
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
|
||||||
});
|
|
||||||
exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
|
|
||||||
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
|
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
|
||||||
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
|
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
|
||||||
|
|
||||||
@@ -178,8 +173,8 @@ describe('Exchange core', () => {
|
|||||||
|
|
||||||
it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => {
|
it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => {
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
|
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
|
||||||
@@ -231,8 +226,8 @@ describe('Exchange core', () => {
|
|||||||
|
|
||||||
it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => {
|
it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => {
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
|
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
|
||||||
@@ -284,8 +279,8 @@ describe('Exchange core', () => {
|
|||||||
|
|
||||||
it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => {
|
it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => {
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
|
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
|
||||||
@@ -338,8 +333,8 @@ describe('Exchange core', () => {
|
|||||||
it('should transfer the correct amounts when taker is specified and order is claimed by taker', async () => {
|
it('should transfer the correct amounts when taker is specified and order is claimed by taker', async () => {
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
takerAddress,
|
takerAddress,
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
|
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
|
||||||
@@ -457,8 +452,8 @@ describe('Exchange core', () => {
|
|||||||
it('should throw when taker is specified and order is claimed by other', async () => {
|
it('should throw when taker is specified and order is claimed by other', async () => {
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
takerAddress: feeRecipientAddress,
|
takerAddress: feeRecipientAddress,
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
|
||||||
});
|
});
|
||||||
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
||||||
constants.REVERT,
|
constants.REVERT,
|
||||||
@@ -467,7 +462,7 @@ describe('Exchange core', () => {
|
|||||||
|
|
||||||
it('should throw if signature is invalid', async () => {
|
it('should throw if signature is invalid', async () => {
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
const invalidR = ethUtil.sha3('invalidR');
|
const invalidR = ethUtil.sha3('invalidR');
|
||||||
@@ -513,7 +508,7 @@ describe('Exchange core', () => {
|
|||||||
|
|
||||||
it('should throw if maker erc20Balances are too low to fill order', async () => {
|
it('should throw if maker erc20Balances are too low to fill order', async () => {
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
||||||
@@ -523,7 +518,7 @@ describe('Exchange core', () => {
|
|||||||
|
|
||||||
it('should throw if taker erc20Balances are too low to fill order', async () => {
|
it('should throw if taker erc20Balances are too low to fill order', async () => {
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
||||||
@@ -538,6 +533,9 @@ describe('Exchange core', () => {
|
|||||||
}),
|
}),
|
||||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
);
|
);
|
||||||
|
// HACK: `rejectWith` returns a "promise-like" type, but not an actual "Promise", so TSLint
|
||||||
|
// complains, even though we do need to `await` it. So we disable the TSLint error below.
|
||||||
|
// tslint:disable-next-line:await-promise
|
||||||
await expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
await expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
||||||
constants.REVERT,
|
constants.REVERT,
|
||||||
);
|
);
|
||||||
@@ -556,6 +554,9 @@ describe('Exchange core', () => {
|
|||||||
}),
|
}),
|
||||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
);
|
);
|
||||||
|
// HACK: `rejectWith` returns a "promise-like" type, but not an actual "Promise", so TSLint
|
||||||
|
// complains, even though we do need to `await` it. So we disable the TSLint error below.
|
||||||
|
// tslint:disable-next-line:await-promise
|
||||||
await expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
await expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
|
||||||
constants.REVERT,
|
constants.REVERT,
|
||||||
);
|
);
|
||||||
@@ -709,23 +710,23 @@ describe('Exchange core', () => {
|
|||||||
erc20Balances = await erc20Wrapper.getBalancesAsync();
|
erc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||||
const signedOrders = await Promise.all([
|
const signedOrders = await Promise.all([
|
||||||
orderFactory.newSignedOrder({
|
orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
|
||||||
salt: new BigNumber(0),
|
salt: new BigNumber(0),
|
||||||
}),
|
}),
|
||||||
orderFactory.newSignedOrder({
|
orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(79), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(79), 18),
|
||||||
salt: new BigNumber(1),
|
salt: new BigNumber(1),
|
||||||
}),
|
}),
|
||||||
orderFactory.newSignedOrder({
|
orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(979), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(979), 18),
|
||||||
salt: new BigNumber(2),
|
salt: new BigNumber(2),
|
||||||
}),
|
}),
|
||||||
orderFactory.newSignedOrder({
|
orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
|
||||||
salt: new BigNumber(3),
|
salt: new BigNumber(3),
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
@@ -901,7 +902,7 @@ describe('Exchange core', () => {
|
|||||||
const makerAssetId = erc721MakerAssetIds[0];
|
const makerAssetId = erc721MakerAssetIds[0];
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: new BigNumber(1),
|
makerAssetAmount: new BigNumber(1),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
|
makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
|
||||||
});
|
});
|
||||||
@@ -941,7 +942,7 @@ describe('Exchange core', () => {
|
|||||||
const takerAssetId = erc721TakerAssetIds[0];
|
const takerAssetId = erc721TakerAssetIds[0];
|
||||||
signedOrder = orderFactory.newSignedOrder({
|
signedOrder = orderFactory.newSignedOrder({
|
||||||
takerAssetAmount: new BigNumber(1),
|
takerAssetAmount: new BigNumber(1),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
|
takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
@@ -83,7 +82,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
});
|
});
|
||||||
describe('registerAssetProxy', () => {
|
describe('registerAssetProxy', () => {
|
||||||
it('should record proxy upon registration', async () => {
|
it('should record proxy upon registration', async () => {
|
||||||
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
@@ -99,7 +98,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
|
|
||||||
it('should be able to record multiple proxies', async () => {
|
it('should be able to record multiple proxies', async () => {
|
||||||
// Record first proxy
|
// Record first proxy
|
||||||
const prevERC20ProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevERC20ProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
@@ -112,7 +111,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
||||||
expect(proxyAddress).to.be.equal(erc20Proxy.address);
|
expect(proxyAddress).to.be.equal(erc20Proxy.address);
|
||||||
// Record another proxy
|
// Record another proxy
|
||||||
const prevERC721ProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevERC721ProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC721,
|
AssetProxyId.ERC721,
|
||||||
@@ -128,7 +127,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
|
|
||||||
it('should replace proxy address upon re-registration', async () => {
|
it('should replace proxy address upon re-registration', async () => {
|
||||||
// Initial registration
|
// Initial registration
|
||||||
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
@@ -165,7 +164,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
|
|
||||||
it('should throw if registering with incorrect "currentAssetProxyAddress" field', async () => {
|
it('should throw if registering with incorrect "currentAssetProxyAddress" field', async () => {
|
||||||
// Initial registration
|
// Initial registration
|
||||||
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
@@ -177,12 +176,12 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
);
|
);
|
||||||
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
||||||
expect(proxyAddress).to.be.equal(erc20Proxy.address);
|
expect(proxyAddress).to.be.equal(erc20Proxy.address);
|
||||||
// The following transaction will throw because the currentAddress is no longer ZeroEx.NULL_ADDRESS
|
// The following transaction will throw because the currentAddress is no longer constants.NULL_ADDRESS
|
||||||
return expect(
|
return expect(
|
||||||
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
ZeroEx.NULL_ADDRESS,
|
constants.NULL_ADDRESS,
|
||||||
{ from: owner },
|
{ from: owner },
|
||||||
),
|
),
|
||||||
).to.be.rejectedWith(constants.REVERT);
|
).to.be.rejectedWith(constants.REVERT);
|
||||||
@@ -190,7 +189,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
|
|
||||||
it('should be able to reset proxy address to NULL', async () => {
|
it('should be able to reset proxy address to NULL', async () => {
|
||||||
// Initial registration
|
// Initial registration
|
||||||
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
@@ -203,7 +202,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
||||||
expect(proxyAddress).to.be.equal(erc20Proxy.address);
|
expect(proxyAddress).to.be.equal(erc20Proxy.address);
|
||||||
// The following transaction will reset the proxy address
|
// The following transaction will reset the proxy address
|
||||||
const newProxyAddress = ZeroEx.NULL_ADDRESS;
|
const newProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
@@ -218,7 +217,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw if requesting address is not owner', async () => {
|
it('should throw if requesting address is not owner', async () => {
|
||||||
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevProxyAddress = constants.NULL_ADDRESS;
|
||||||
return expect(
|
return expect(
|
||||||
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
@@ -230,7 +229,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw if attempting to register a proxy to the incorrect id', async () => {
|
it('should throw if attempting to register a proxy to the incorrect id', async () => {
|
||||||
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevProxyAddress = constants.NULL_ADDRESS;
|
||||||
return expect(
|
return expect(
|
||||||
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC721,
|
AssetProxyId.ERC721,
|
||||||
@@ -244,7 +243,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
|
|
||||||
describe('getAssetProxy', () => {
|
describe('getAssetProxy', () => {
|
||||||
it('should return correct address of registered proxy', async () => {
|
it('should return correct address of registered proxy', async () => {
|
||||||
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
@@ -260,14 +259,14 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
|
|
||||||
it('should return NULL address if requesting non-existent proxy', async () => {
|
it('should return NULL address if requesting non-existent proxy', async () => {
|
||||||
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
|
||||||
expect(proxyAddress).to.be.equal(ZeroEx.NULL_ADDRESS);
|
expect(proxyAddress).to.be.equal(constants.NULL_ADDRESS);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('dispatchTransferFrom', () => {
|
describe('dispatchTransferFrom', () => {
|
||||||
it('should dispatch transfer to registered proxy', async () => {
|
it('should dispatch transfer to registered proxy', async () => {
|
||||||
// Register ERC20 proxy
|
// Register ERC20 proxy
|
||||||
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
|
const prevProxyAddress = constants.NULL_ADDRESS;
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
|
||||||
AssetProxyId.ERC20,
|
AssetProxyId.ERC20,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
@@ -35,7 +34,6 @@ describe('Exchange libs', () => {
|
|||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
const makerAddress = accounts[0];
|
const makerAddress = accounts[0];
|
||||||
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
|
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
|
||||||
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
|
|
||||||
|
|
||||||
const defaultOrderParams = {
|
const defaultOrderParams = {
|
||||||
...constants.STATIC_ORDER_PARAMS,
|
...constants.STATIC_ORDER_PARAMS,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { LogWithDecodedArgs, ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
|
import { LogWithDecodedArgs } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -76,8 +77,6 @@ describe('matchOrders', () => {
|
|||||||
|
|
||||||
let matchOrderTester: MatchOrderTester;
|
let matchOrderTester: MatchOrderTester;
|
||||||
|
|
||||||
let zeroEx: ZeroEx;
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
});
|
});
|
||||||
@@ -117,11 +116,7 @@ describe('matchOrders', () => {
|
|||||||
txDefaults,
|
txDefaults,
|
||||||
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
|
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
|
||||||
);
|
);
|
||||||
zeroEx = new ZeroEx(provider, {
|
exchangeWrapper = new ExchangeWrapper(exchange, provider);
|
||||||
exchangeContractAddress: exchange.address,
|
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
|
||||||
});
|
|
||||||
exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
|
|
||||||
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
|
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
|
||||||
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
|
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
|
||||||
// Authorize ERC20 and ERC721 trades by exchange
|
// Authorize ERC20 and ERC721 trades by exchange
|
||||||
@@ -173,16 +168,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match signedOrderLeft with signedOrderRight
|
// Match signedOrderLeft with signedOrderRight
|
||||||
@@ -207,16 +202,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Store original taker balance
|
// Store original taker balance
|
||||||
@@ -252,16 +247,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(20), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(4), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -286,16 +281,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -320,16 +315,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -359,8 +354,8 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match signedOrderLeft with signedOrderRight2
|
// Match signedOrderLeft with signedOrderRight2
|
||||||
@@ -389,8 +384,8 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -398,8 +393,8 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -429,8 +424,8 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
// Match signedOrderLeft2 with signedOrderRight
|
// Match signedOrderLeft2 with signedOrderRight
|
||||||
@@ -462,16 +457,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress,
|
feeRecipientAddress,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress,
|
feeRecipientAddress,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -490,16 +485,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -519,16 +514,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -548,16 +543,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -577,16 +572,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -606,16 +601,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: makerAddressLeft,
|
feeRecipientAddress: makerAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: makerAddressRight,
|
feeRecipientAddress: makerAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -634,16 +629,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Cancel left order
|
// Cancel left order
|
||||||
@@ -660,16 +655,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Cancel right order
|
// Cancel right order
|
||||||
@@ -686,16 +681,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -716,16 +711,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -746,16 +741,16 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
@@ -778,14 +773,14 @@ describe('matchOrders', () => {
|
|||||||
makerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
|
makerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
makerAssetAmount: new BigNumber(1),
|
makerAssetAmount: new BigNumber(1),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
const signedOrderRight = orderFactoryRight.newSignedOrder({
|
||||||
makerAddress: makerAddressRight,
|
makerAddress: makerAddressRight,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
|
takerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: new BigNumber(1),
|
takerAssetAmount: new BigNumber(1),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
@@ -812,7 +807,7 @@ describe('matchOrders', () => {
|
|||||||
makerAddress: makerAddressLeft,
|
makerAddress: makerAddressLeft,
|
||||||
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
takerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
|
takerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: new BigNumber(1),
|
takerAssetAmount: new BigNumber(1),
|
||||||
feeRecipientAddress: feeRecipientAddressLeft,
|
feeRecipientAddress: feeRecipientAddressLeft,
|
||||||
});
|
});
|
||||||
@@ -821,7 +816,7 @@ describe('matchOrders', () => {
|
|||||||
makerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
|
makerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
|
||||||
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
|
||||||
makerAssetAmount: new BigNumber(1),
|
makerAssetAmount: new BigNumber(1),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
feeRecipientAddress: feeRecipientAddressRight,
|
feeRecipientAddress: feeRecipientAddressRight,
|
||||||
});
|
});
|
||||||
// Match orders
|
// Match orders
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
@@ -39,7 +38,6 @@ describe('MixinSignatureValidator', () => {
|
|||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
);
|
);
|
||||||
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
|
|
||||||
|
|
||||||
const defaultOrderParams = {
|
const defaultOrderParams = {
|
||||||
...constants.STATIC_ORDER_PARAMS,
|
...constants.STATIC_ORDER_PARAMS,
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
|
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
@@ -59,8 +57,6 @@ describe('Exchange transactions', () => {
|
|||||||
let defaultMakerTokenAddress: string;
|
let defaultMakerTokenAddress: string;
|
||||||
let defaultTakerTokenAddress: string;
|
let defaultTakerTokenAddress: string;
|
||||||
|
|
||||||
let zeroEx: ZeroEx;
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
});
|
});
|
||||||
@@ -83,11 +79,7 @@ describe('Exchange transactions', () => {
|
|||||||
txDefaults,
|
txDefaults,
|
||||||
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
|
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
|
||||||
);
|
);
|
||||||
zeroEx = new ZeroEx(provider, {
|
exchangeWrapper = new ExchangeWrapper(exchange, provider);
|
||||||
exchangeContractAddress: exchange.address,
|
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
|
||||||
});
|
|
||||||
exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
|
|
||||||
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
|
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
|
||||||
|
|
||||||
await web3Wrapper.awaitTransactionMinedAsync(
|
await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
@@ -188,7 +180,7 @@ describe('Exchange transactions', () => {
|
|||||||
it('should reset the currentContextAddress', async () => {
|
it('should reset the currentContextAddress', async () => {
|
||||||
await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
|
await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
|
||||||
const currentContextAddress = await exchange.currentContextAddress.callAsync();
|
const currentContextAddress = await exchange.currentContextAddress.callAsync();
|
||||||
expect(currentContextAddress).to.equal(ZeroEx.NULL_ADDRESS);
|
expect(currentContextAddress).to.equal(constants.NULL_ADDRESS);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
@@ -54,8 +53,6 @@ describe('Exchange wrappers', () => {
|
|||||||
let defaultMakerAssetAddress: string;
|
let defaultMakerAssetAddress: string;
|
||||||
let defaultTakerAssetAddress: string;
|
let defaultTakerAssetAddress: string;
|
||||||
|
|
||||||
let zeroEx: ZeroEx;
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
});
|
});
|
||||||
@@ -86,11 +83,7 @@ describe('Exchange wrappers', () => {
|
|||||||
txDefaults,
|
txDefaults,
|
||||||
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
|
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
|
||||||
);
|
);
|
||||||
zeroEx = new ZeroEx(provider, {
|
exchangeWrapper = new ExchangeWrapper(exchange, provider);
|
||||||
exchangeContractAddress: exchange.address,
|
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
|
||||||
});
|
|
||||||
exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
|
|
||||||
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
|
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
|
||||||
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
|
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
|
||||||
|
|
||||||
@@ -131,8 +124,8 @@ describe('Exchange wrappers', () => {
|
|||||||
describe('fillOrKillOrder', () => {
|
describe('fillOrKillOrder', () => {
|
||||||
it('should transfer the correct amounts', async () => {
|
it('should transfer the correct amounts', async () => {
|
||||||
const signedOrder = orderFactory.newSignedOrder({
|
const signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
|
||||||
});
|
});
|
||||||
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
|
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
|
||||||
await exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress, {
|
await exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress, {
|
||||||
@@ -199,8 +192,8 @@ describe('Exchange wrappers', () => {
|
|||||||
describe('fillOrderNoThrow', () => {
|
describe('fillOrderNoThrow', () => {
|
||||||
it('should transfer the correct amounts', async () => {
|
it('should transfer the correct amounts', async () => {
|
||||||
const signedOrder = orderFactory.newSignedOrder({
|
const signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
|
||||||
});
|
});
|
||||||
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
|
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
|
||||||
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, {
|
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, {
|
||||||
@@ -243,7 +236,7 @@ describe('Exchange wrappers', () => {
|
|||||||
|
|
||||||
it('should not change erc20Balances if maker erc20Balances are too low to fill order', async () => {
|
it('should not change erc20Balances if maker erc20Balances are too low to fill order', async () => {
|
||||||
const signedOrder = orderFactory.newSignedOrder({
|
const signedOrder = orderFactory.newSignedOrder({
|
||||||
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
|
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
|
||||||
@@ -253,7 +246,7 @@ describe('Exchange wrappers', () => {
|
|||||||
|
|
||||||
it('should not change erc20Balances if taker erc20Balances are too low to fill order', async () => {
|
it('should not change erc20Balances if taker erc20Balances are too low to fill order', async () => {
|
||||||
const signedOrder = orderFactory.newSignedOrder({
|
const signedOrder = orderFactory.newSignedOrder({
|
||||||
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
|
||||||
});
|
});
|
||||||
|
|
||||||
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
|
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
|
||||||
@@ -644,7 +637,7 @@ describe('Exchange wrappers', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
|
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
|
||||||
const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
|
const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
|
||||||
_.forEach(signedOrders, signedOrder => {
|
_.forEach(signedOrders, signedOrder => {
|
||||||
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
|
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
|
||||||
defaultMakerAssetAddress
|
defaultMakerAssetAddress
|
||||||
@@ -687,7 +680,7 @@ describe('Exchange wrappers', () => {
|
|||||||
|
|
||||||
return expect(
|
return expect(
|
||||||
exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
|
exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
|
||||||
takerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
|
takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
|
||||||
}),
|
}),
|
||||||
).to.be.rejectedWith(constants.REVERT);
|
).to.be.rejectedWith(constants.REVERT);
|
||||||
});
|
});
|
||||||
@@ -733,7 +726,7 @@ describe('Exchange wrappers', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
|
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
|
||||||
const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
|
const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
|
||||||
_.forEach(signedOrders, signedOrder => {
|
_.forEach(signedOrders, signedOrder => {
|
||||||
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
|
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
|
||||||
defaultMakerAssetAddress
|
defaultMakerAssetAddress
|
||||||
@@ -776,7 +769,7 @@ describe('Exchange wrappers', () => {
|
|||||||
|
|
||||||
return expect(
|
return expect(
|
||||||
exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
|
exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
|
||||||
takerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
|
takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
|
||||||
}),
|
}),
|
||||||
).to.be.rejectedWith(constants.REVERT);
|
).to.be.rejectedWith(constants.REVERT);
|
||||||
});
|
});
|
||||||
@@ -822,7 +815,7 @@ describe('Exchange wrappers', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
|
it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
|
||||||
const makerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
|
const makerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
|
||||||
_.forEach(signedOrders, signedOrder => {
|
_.forEach(signedOrders, signedOrder => {
|
||||||
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
|
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
|
||||||
defaultMakerAssetAddress
|
defaultMakerAssetAddress
|
||||||
@@ -865,7 +858,7 @@ describe('Exchange wrappers', () => {
|
|||||||
|
|
||||||
return expect(
|
return expect(
|
||||||
exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
|
exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
|
||||||
makerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
|
makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
|
||||||
}),
|
}),
|
||||||
).to.be.rejectedWith(constants.REVERT);
|
).to.be.rejectedWith(constants.REVERT);
|
||||||
});
|
});
|
||||||
@@ -911,7 +904,7 @@ describe('Exchange wrappers', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
|
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
|
||||||
const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
|
const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
|
||||||
_.forEach(signedOrders, signedOrder => {
|
_.forEach(signedOrders, signedOrder => {
|
||||||
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
|
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
|
||||||
defaultMakerAssetAddress
|
defaultMakerAssetAddress
|
||||||
@@ -954,7 +947,7 @@ describe('Exchange wrappers', () => {
|
|||||||
|
|
||||||
return expect(
|
return expect(
|
||||||
exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
|
exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
|
||||||
makerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
|
makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
|
||||||
}),
|
}),
|
||||||
).to.be.rejectedWith(constants.REVERT);
|
).to.be.rejectedWith(constants.REVERT);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs, ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
|
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import BN = require('bn.js');
|
import BN = require('bn.js');
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { LogWithDecodedArgs, ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle, web3Factory } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, web3Factory } from '@0xproject/dev-utils';
|
||||||
|
import { LogWithDecodedArgs } from '@0xproject/types';
|
||||||
import { AbiDecoder, BigNumber } from '@0xproject/utils';
|
import { AbiDecoder, BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
@@ -20,7 +20,6 @@ const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLock.compilerOutput.abi;
|
|||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
|
|
||||||
const abiDecoder = new AbiDecoder([MULTI_SIG_ABI]);
|
const abiDecoder = new AbiDecoder([MULTI_SIG_ABI]);
|
||||||
|
|
||||||
describe('MultiSigWalletWithTimeLock', () => {
|
describe('MultiSigWalletWithTimeLock', () => {
|
||||||
@@ -80,7 +79,10 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
args: [SECONDS_TIME_LOCKED.toNumber()],
|
args: [SECONDS_TIME_LOCKED.toNumber()],
|
||||||
};
|
};
|
||||||
const txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
|
const txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
|
||||||
const txReceipt = await zeroEx.awaitTransactionMinedAsync(txHash);
|
const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
|
txHash,
|
||||||
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
|
);
|
||||||
const log = abiDecoder.tryToDecodeLogOrNoop(txReceipt.logs[0]) as LogWithDecodedArgs<
|
const log = abiDecoder.tryToDecodeLogOrNoop(txReceipt.logs[0]) as LogWithDecodedArgs<
|
||||||
SubmissionContractEventArgs
|
SubmissionContractEventArgs
|
||||||
>;
|
>;
|
||||||
@@ -100,14 +102,17 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
args: [SECONDS_TIME_LOCKED.toNumber()],
|
args: [SECONDS_TIME_LOCKED.toNumber()],
|
||||||
};
|
};
|
||||||
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
|
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
|
||||||
const txReceipt = await zeroEx.awaitTransactionMinedAsync(txHash);
|
const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
|
txHash,
|
||||||
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
|
);
|
||||||
const log = abiDecoder.tryToDecodeLogOrNoop(txReceipt.logs[0]) as LogWithDecodedArgs<
|
const log = abiDecoder.tryToDecodeLogOrNoop(txReceipt.logs[0]) as LogWithDecodedArgs<
|
||||||
SubmissionContractEventArgs
|
SubmissionContractEventArgs
|
||||||
>;
|
>;
|
||||||
|
|
||||||
txId = log.args.transactionId;
|
txId = log.args.transactionId;
|
||||||
txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, { from: owners[1] });
|
txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, { from: owners[1] });
|
||||||
const res = await zeroEx.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
const res = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
expect(res.logs).to.have.length(2);
|
expect(res.logs).to.have.length(2);
|
||||||
|
|
||||||
const blockNum = await web3Wrapper.getBlockNumberAsync();
|
const blockNum = await web3Wrapper.getBlockNumberAsync();
|
||||||
@@ -127,7 +132,10 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
args: [SECONDS_TIME_LOCKED.toNumber()],
|
args: [SECONDS_TIME_LOCKED.toNumber()],
|
||||||
};
|
};
|
||||||
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
|
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
|
||||||
const txReceipt = await zeroEx.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
|
txHash,
|
||||||
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
|
);
|
||||||
const log = abiDecoder.tryToDecodeLogOrNoop(txReceipt.logs[0]) as LogWithDecodedArgs<
|
const log = abiDecoder.tryToDecodeLogOrNoop(txReceipt.logs[0]) as LogWithDecodedArgs<
|
||||||
SubmissionContractEventArgs
|
SubmissionContractEventArgs
|
||||||
>;
|
>;
|
||||||
@@ -139,7 +147,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
expect(initialSecondsTimeLocked).to.be.equal(0);
|
expect(initialSecondsTimeLocked).to.be.equal(0);
|
||||||
|
|
||||||
txHash = await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] });
|
txHash = await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] });
|
||||||
const res = await zeroEx.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
const res = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
expect(res.logs).to.have.length(2);
|
expect(res.logs).to.have.length(2);
|
||||||
|
|
||||||
const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync());
|
const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync());
|
||||||
@@ -174,7 +182,10 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
args: [newSecondsTimeLocked],
|
args: [newSecondsTimeLocked],
|
||||||
};
|
};
|
||||||
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
|
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
|
||||||
let txReceipt = await zeroEx.awaitTransactionMinedAsync(txHash);
|
let txReceipt = await web3Wrapper.awaitTransactionMinedAsync(
|
||||||
|
txHash,
|
||||||
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
|
);
|
||||||
const log = abiDecoder.tryToDecodeLogOrNoop(txReceipt.logs[0]) as LogWithDecodedArgs<
|
const log = abiDecoder.tryToDecodeLogOrNoop(txReceipt.logs[0]) as LogWithDecodedArgs<
|
||||||
SubmissionContractEventArgs
|
SubmissionContractEventArgs
|
||||||
>;
|
>;
|
||||||
@@ -182,7 +193,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, {
|
txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, {
|
||||||
from: owners[1],
|
from: owners[1],
|
||||||
});
|
});
|
||||||
txReceipt = await zeroEx.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
txReceipt = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
expect(txReceipt.logs).to.have.length(2);
|
expect(txReceipt.logs).to.have.length(2);
|
||||||
});
|
});
|
||||||
const newSecondsTimeLocked = 0;
|
const newSecondsTimeLocked = 0;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber, NULL_BYTES } from '@0xproject/utils';
|
import { BigNumber, NULL_BYTES } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
@@ -66,7 +65,7 @@ describe('TokenRegistry', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const nullToken = {
|
const nullToken = {
|
||||||
address: ZeroEx.NULL_ADDRESS,
|
address: constants.NULL_ADDRESS,
|
||||||
name: '',
|
name: '',
|
||||||
symbol: '',
|
symbol: '',
|
||||||
decimals: 0,
|
decimals: 0,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
// let amountGive: BigNumber;
|
// let amountGive: BigNumber;
|
||||||
// let makerTokenAmount: BigNumber;
|
// let makerTokenAmount: BigNumber;
|
||||||
// let takerTokenAmount: BigNumber;
|
// let takerTokenAmount: BigNumber;
|
||||||
// const feeRecipient = ZeroEx.NULL_ADDRESS;
|
// const feeRecipient = constants.NULL_ADDRESS;
|
||||||
// const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
// const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
||||||
// const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
// const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
// exchangeContractAddress: exchange.address,
|
// exchangeContractAddress: exchange.address,
|
||||||
// networkId: constants.TESTRPC_NETWORK_ID,
|
// networkId: constants.TESTRPC_NETWORK_ID,
|
||||||
// });
|
// });
|
||||||
// exWrapper = new ExchangeWrapper(exchange, zeroEx);
|
// exWrapper = new ExchangeWrapper(exchange, provider);
|
||||||
|
|
||||||
// makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
|
// makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
|
||||||
// takerTokenAmount = makerTokenAmount;
|
// takerTokenAmount = makerTokenAmount;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ContractWrappers } from '@0xproject/contract-wrappers';
|
||||||
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
@@ -19,7 +19,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
|||||||
describe('UnlimitedAllowanceToken', () => {
|
describe('UnlimitedAllowanceToken', () => {
|
||||||
let owner: string;
|
let owner: string;
|
||||||
let spender: string;
|
let spender: string;
|
||||||
const zeroEx = new ZeroEx(provider, {
|
const contractWrappers = new ContractWrappers(provider, {
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
networkId: constants.TESTRPC_NETWORK_ID,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ describe('UnlimitedAllowanceToken', () => {
|
|||||||
});
|
});
|
||||||
describe('transfer', () => {
|
describe('transfer', () => {
|
||||||
it('should throw if owner has insufficient balance', async () => {
|
it('should throw if owner has insufficient balance', async () => {
|
||||||
const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const ownerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const amountToTransfer = ownerBalance.plus(1);
|
const amountToTransfer = ownerBalance.plus(1);
|
||||||
return expect(token.transfer.callAsync(spender, amountToTransfer, { from: owner })).to.be.rejectedWith(
|
return expect(token.transfer.callAsync(spender, amountToTransfer, { from: owner })).to.be.rejectedWith(
|
||||||
constants.REVERT,
|
constants.REVERT,
|
||||||
@@ -69,11 +69,11 @@ describe('UnlimitedAllowanceToken', () => {
|
|||||||
|
|
||||||
it('should transfer balance from sender to receiver', async () => {
|
it('should transfer balance from sender to receiver', async () => {
|
||||||
const receiver = spender;
|
const receiver = spender;
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const initOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const amountToTransfer = new BigNumber(1);
|
const amountToTransfer = new BigNumber(1);
|
||||||
await zeroEx.token.transferAsync(tokenAddress, owner, receiver, amountToTransfer);
|
await contractWrappers.token.transferAsync(tokenAddress, owner, receiver, amountToTransfer);
|
||||||
const finalOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const finalOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const finalReceiverBalance = await zeroEx.token.getBalanceAsync(tokenAddress, receiver);
|
const finalReceiverBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, receiver);
|
||||||
|
|
||||||
const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
|
const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
|
||||||
const expectedFinalReceiverBalance = amountToTransfer;
|
const expectedFinalReceiverBalance = amountToTransfer;
|
||||||
@@ -91,9 +91,9 @@ describe('UnlimitedAllowanceToken', () => {
|
|||||||
|
|
||||||
describe('transferFrom', () => {
|
describe('transferFrom', () => {
|
||||||
it('should throw if owner has insufficient balance', async () => {
|
it('should throw if owner has insufficient balance', async () => {
|
||||||
const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const ownerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const amountToTransfer = ownerBalance.plus(1);
|
const amountToTransfer = ownerBalance.plus(1);
|
||||||
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, amountToTransfer);
|
await contractWrappers.token.setAllowanceAsync(tokenAddress, owner, spender, amountToTransfer);
|
||||||
return expect(
|
return expect(
|
||||||
token.transferFrom.callAsync(owner, spender, amountToTransfer, {
|
token.transferFrom.callAsync(owner, spender, amountToTransfer, {
|
||||||
from: spender,
|
from: spender,
|
||||||
@@ -102,10 +102,10 @@ describe('UnlimitedAllowanceToken', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw if spender has insufficient allowance', async () => {
|
it('should throw if spender has insufficient allowance', async () => {
|
||||||
const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const ownerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const amountToTransfer = ownerBalance;
|
const amountToTransfer = ownerBalance;
|
||||||
|
|
||||||
const spenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
|
const spenderAllowance = await contractWrappers.token.getAllowanceAsync(tokenAddress, owner, spender);
|
||||||
const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
|
const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
|
||||||
expect(isSpenderAllowanceInsufficient).to.be.true();
|
expect(isSpenderAllowanceInsufficient).to.be.true();
|
||||||
|
|
||||||
@@ -125,44 +125,44 @@ describe('UnlimitedAllowanceToken', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
|
it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const initOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
const initSpenderAllowance = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
const initSpenderAllowance = contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
||||||
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
|
await contractWrappers.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
|
||||||
await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
|
await contractWrappers.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
|
const newSpenderAllowance = await contractWrappers.token.getAllowanceAsync(tokenAddress, owner, spender);
|
||||||
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
|
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should transfer the correct balances if spender has sufficient allowance', async () => {
|
it('should transfer the correct balances if spender has sufficient allowance', async () => {
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const initOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
const initSpenderAllowance = initOwnerBalance;
|
const initSpenderAllowance = initOwnerBalance;
|
||||||
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
|
await contractWrappers.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
|
||||||
await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
|
await contractWrappers.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const newOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const newSpenderBalance = await zeroEx.token.getBalanceAsync(tokenAddress, spender);
|
const newSpenderBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, spender);
|
||||||
|
|
||||||
expect(newOwnerBalance).to.be.bignumber.equal(0);
|
expect(newOwnerBalance).to.be.bignumber.equal(0);
|
||||||
expect(newSpenderBalance).to.be.bignumber.equal(initOwnerBalance);
|
expect(newSpenderBalance).to.be.bignumber.equal(initOwnerBalance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
|
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
|
const initOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
const initSpenderAllowance = initOwnerBalance;
|
const initSpenderAllowance = initOwnerBalance;
|
||||||
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
|
await contractWrappers.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
|
||||||
await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
|
await contractWrappers.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
|
const newSpenderAllowance = await contractWrappers.token.getAllowanceAsync(tokenAddress, owner, spender);
|
||||||
expect(newSpenderAllowance).to.be.bignumber.equal(0);
|
expect(newSpenderAllowance).to.be.bignumber.equal(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { LogWithDecodedArgs, ZeroEx } from '0x.js';
|
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
|
import { LogWithDecodedArgs } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ContractWrappers } from '@0xproject/contract-wrappers';
|
||||||
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
@@ -19,7 +19,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
|||||||
describe('ZRXToken', () => {
|
describe('ZRXToken', () => {
|
||||||
let owner: string;
|
let owner: string;
|
||||||
let spender: string;
|
let spender: string;
|
||||||
let zeroEx: ZeroEx;
|
let contractWrappers: ContractWrappers;
|
||||||
|
|
||||||
let MAX_UINT: BigNumber;
|
let MAX_UINT: BigNumber;
|
||||||
|
|
||||||
@@ -36,12 +36,12 @@ describe('ZRXToken', () => {
|
|||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
owner = accounts[0];
|
owner = accounts[0];
|
||||||
spender = accounts[1];
|
spender = accounts[1];
|
||||||
zeroEx = new ZeroEx(provider, {
|
contractWrappers = new ContractWrappers(provider, {
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
networkId: constants.TESTRPC_NETWORK_ID,
|
||||||
});
|
});
|
||||||
zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
|
zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
|
||||||
zrxAddress = zrxToken.address;
|
zrxAddress = zrxToken.address;
|
||||||
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
MAX_UINT = contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
||||||
});
|
});
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
@@ -59,7 +59,7 @@ describe('ZRXToken', () => {
|
|||||||
it('should have a total supply of 1 billion tokens', async () => {
|
it('should have a total supply of 1 billion tokens', async () => {
|
||||||
const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
|
const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
|
||||||
const expectedTotalSupply = 1000000000;
|
const expectedTotalSupply = 1000000000;
|
||||||
expect(ZeroEx.toUnitAmount(totalSupply, 18)).to.be.bignumber.equal(expectedTotalSupply);
|
expect(Web3Wrapper.toUnitAmount(totalSupply, 18)).to.be.bignumber.equal(expectedTotalSupply);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be named 0x Protocol Token', async () => {
|
it('should be named 0x Protocol Token', async () => {
|
||||||
@@ -77,7 +77,7 @@ describe('ZRXToken', () => {
|
|||||||
|
|
||||||
describe('constructor', () => {
|
describe('constructor', () => {
|
||||||
it('should initialize owner balance to totalSupply', async () => {
|
it('should initialize owner balance to totalSupply', async () => {
|
||||||
const ownerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const ownerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
|
const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
|
||||||
expect(totalSupply).to.be.bignumber.equal(ownerBalance);
|
expect(totalSupply).to.be.bignumber.equal(ownerBalance);
|
||||||
});
|
});
|
||||||
@@ -86,11 +86,11 @@ describe('ZRXToken', () => {
|
|||||||
describe('transfer', () => {
|
describe('transfer', () => {
|
||||||
it('should transfer balance from sender to receiver', async () => {
|
it('should transfer balance from sender to receiver', async () => {
|
||||||
const receiver = spender;
|
const receiver = spender;
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const initOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const amountToTransfer = new BigNumber(1);
|
const amountToTransfer = new BigNumber(1);
|
||||||
await zeroEx.token.transferAsync(zrxAddress, owner, receiver, amountToTransfer);
|
await contractWrappers.token.transferAsync(zrxAddress, owner, receiver, amountToTransfer);
|
||||||
const finalOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const finalOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const finalReceiverBalance = await zeroEx.token.getBalanceAsync(zrxAddress, receiver);
|
const finalReceiverBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, receiver);
|
||||||
|
|
||||||
const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
|
const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
|
||||||
const expectedFinalReceiverBalance = amountToTransfer;
|
const expectedFinalReceiverBalance = amountToTransfer;
|
||||||
@@ -108,9 +108,9 @@ describe('ZRXToken', () => {
|
|||||||
|
|
||||||
describe('transferFrom', () => {
|
describe('transferFrom', () => {
|
||||||
it('should return false if owner has insufficient balance', async () => {
|
it('should return false if owner has insufficient balance', async () => {
|
||||||
const ownerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const ownerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const amountToTransfer = ownerBalance.plus(1);
|
const amountToTransfer = ownerBalance.plus(1);
|
||||||
await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer, {
|
await contractWrappers.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
|
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
|
||||||
});
|
});
|
||||||
const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
|
const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
|
||||||
@@ -120,10 +120,10 @@ describe('ZRXToken', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return false if spender has insufficient allowance', async () => {
|
it('should return false if spender has insufficient allowance', async () => {
|
||||||
const ownerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const ownerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const amountToTransfer = ownerBalance;
|
const amountToTransfer = ownerBalance;
|
||||||
|
|
||||||
const spenderAllowance = await zeroEx.token.getAllowanceAsync(zrxAddress, owner, spender);
|
const spenderAllowance = await contractWrappers.token.getAllowanceAsync(zrxAddress, owner, spender);
|
||||||
const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
|
const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
|
||||||
expect(isSpenderAllowanceInsufficient).to.be.true();
|
expect(isSpenderAllowanceInsufficient).to.be.true();
|
||||||
|
|
||||||
@@ -142,46 +142,46 @@ describe('ZRXToken', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
|
it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const initOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
const initSpenderAllowance = MAX_UINT;
|
const initSpenderAllowance = MAX_UINT;
|
||||||
await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance, {
|
await contractWrappers.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance, {
|
||||||
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
|
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
|
||||||
});
|
});
|
||||||
await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
await contractWrappers.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(zrxAddress, owner, spender);
|
const newSpenderAllowance = await contractWrappers.token.getAllowanceAsync(zrxAddress, owner, spender);
|
||||||
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
|
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should transfer the correct balances if spender has sufficient allowance', async () => {
|
it('should transfer the correct balances if spender has sufficient allowance', async () => {
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const initOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const initSpenderBalance = await zeroEx.token.getBalanceAsync(zrxAddress, spender);
|
const initSpenderBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, spender);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
const initSpenderAllowance = initOwnerBalance;
|
const initSpenderAllowance = initOwnerBalance;
|
||||||
await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
|
await contractWrappers.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
|
||||||
await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
await contractWrappers.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const newOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const newSpenderBalance = await zeroEx.token.getBalanceAsync(zrxAddress, spender);
|
const newSpenderBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, spender);
|
||||||
|
|
||||||
expect(newOwnerBalance).to.be.bignumber.equal(0);
|
expect(newOwnerBalance).to.be.bignumber.equal(0);
|
||||||
expect(newSpenderBalance).to.be.bignumber.equal(initSpenderBalance.plus(initOwnerBalance));
|
expect(newSpenderBalance).to.be.bignumber.equal(initSpenderBalance.plus(initOwnerBalance));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
|
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const initOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer);
|
await contractWrappers.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer);
|
||||||
await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
await contractWrappers.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(zrxAddress, owner, spender);
|
const newSpenderAllowance = await contractWrappers.token.getAllowanceAsync(zrxAddress, owner, spender);
|
||||||
expect(newSpenderAllowance).to.be.bignumber.equal(0);
|
expect(newSpenderAllowance).to.be.bignumber.equal(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as Exchange from '../artifacts/1.0.0/Exchange_v1.json';
|
|||||||
import * as MultiSigWalletWithTimeLock from '../artifacts/1.0.0/MultiSigWalletWithTimeLock.json';
|
import * as MultiSigWalletWithTimeLock from '../artifacts/1.0.0/MultiSigWalletWithTimeLock.json';
|
||||||
import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress from '../artifacts/1.0.0/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json';
|
import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress from '../artifacts/1.0.0/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json';
|
||||||
import * as TokenRegistry from '../artifacts/1.0.0/TokenRegistry.json';
|
import * as TokenRegistry from '../artifacts/1.0.0/TokenRegistry.json';
|
||||||
import * as TokenTransferProxy from '../artifacts/1.0.0/TokenTransferProxy.json';
|
import * as TokenTransferProxy from '../artifacts/1.0.0/TokenTransferProxy_v1.json';
|
||||||
import * as EtherToken from '../artifacts/1.0.0/WETH9.json';
|
import * as EtherToken from '../artifacts/1.0.0/WETH9.json';
|
||||||
import * as ZRX from '../artifacts/1.0.0/ZRXToken.json';
|
import * as ZRX from '../artifacts/1.0.0/ZRXToken.json';
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function parseSignatureHexAsVRS(signatureHex: string): ECSignature {
|
|||||||
// HACK: Sometimes v is returned as [0, 1] and sometimes as [27, 28]
|
// HACK: Sometimes v is returned as [0, 1] and sometimes as [27, 28]
|
||||||
// If it is returned as [0, 1], add 27 to both so it becomes [27, 28]
|
// If it is returned as [0, 1], add 27 to both so it becomes [27, 28]
|
||||||
const lowestValidV = 27;
|
const lowestValidV = 27;
|
||||||
const isProperlyFormattedV = v < lowestValidV;
|
const isProperlyFormattedV = v >= lowestValidV;
|
||||||
if (!isProperlyFormattedV) {
|
if (!isProperlyFormattedV) {
|
||||||
v += lowestValidV;
|
v += lowestValidV;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"compact_artifacts": "Exchange DummyToken ZRXToken Token EtherToken TokenTransferProxy TokenRegistry",
|
"compact_artifacts": "Exchange DummyToken ZRXToken Token EtherToken TokenTransferProxy TokenRegistry",
|
||||||
"contracts": "Exchange DummyToken ZRXToken Token WETH9 TokenTransferProxy MultiSigWallet MultiSigWalletWithTimeLock MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress MaliciousToken TokenRegistry Arbitrage EtherDelta AccountLevels",
|
"contracts": "Exchange DummyToken ZRXToken Token WETH9 TokenTransferProxy_v1 MultiSigWallet MultiSigWalletWithTimeLock MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress MaliciousToken TokenRegistry Arbitrage EtherDelta AccountLevels",
|
||||||
"postpublish": {
|
"postpublish": {
|
||||||
"assets": [
|
"assets": [
|
||||||
"packages/order-watcher/_bundles/index.js",
|
"packages/order-watcher/_bundles/index.js",
|
||||||
|
|||||||
@@ -31,8 +31,9 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md",
|
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"0x.js": "^0.38.0",
|
|
||||||
"@0xproject/assert": "^0.2.10",
|
"@0xproject/assert": "^0.2.10",
|
||||||
|
"@0xproject/types": "^0.7.0",
|
||||||
|
"@0xproject/order-utils": "^0.0.5",
|
||||||
"@0xproject/connect": "^0.6.13",
|
"@0xproject/connect": "^0.6.13",
|
||||||
"@0xproject/json-schemas": "^0.7.24",
|
"@0xproject/json-schemas": "^0.7.24",
|
||||||
"@0xproject/typescript-typings": "^0.3.2",
|
"@0xproject/typescript-typings": "^0.3.2",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { SignedOrder, ZeroEx } from '0x.js';
|
|
||||||
import { HttpClient } from '@0xproject/connect';
|
import { HttpClient } from '@0xproject/connect';
|
||||||
import { Schema, schemas as schemasByName } from '@0xproject/json-schemas';
|
import { Schema, schemas as schemasByName } from '@0xproject/json-schemas';
|
||||||
|
import { getOrderHashHex } from '@0xproject/order-utils';
|
||||||
|
import { SignedOrder } from '@0xproject/types';
|
||||||
import { logUtils } from '@0xproject/utils';
|
import { logUtils } from '@0xproject/utils';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -98,7 +99,7 @@ async function createOrderEnvironmentValuesAsync(url: string): Promise<Environme
|
|||||||
createEnvironmentValue('orderMaker', orderIfExists.maker),
|
createEnvironmentValue('orderMaker', orderIfExists.maker),
|
||||||
createEnvironmentValue('orderTaker', orderIfExists.taker),
|
createEnvironmentValue('orderTaker', orderIfExists.taker),
|
||||||
createEnvironmentValue('orderFeeRecipient', orderIfExists.feeRecipient),
|
createEnvironmentValue('orderFeeRecipient', orderIfExists.feeRecipient),
|
||||||
createEnvironmentValue('orderHash', ZeroEx.getOrderHashHex(orderIfExists)),
|
createEnvironmentValue('orderHash', getOrderHashHex(orderIfExists)),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
logUtils.log(`${chalk.red(`No orders from /orders found`)}`);
|
logUtils.log(`${chalk.red(`No orders from /orders found`)}`);
|
||||||
|
|||||||
@@ -11,14 +11,13 @@
|
|||||||
"clean": "shx rm -f public/bundle*",
|
"clean": "shx rm -f public/bundle*",
|
||||||
"lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'",
|
"lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'",
|
||||||
"watch": "webpack-dev-server --content-base public --https",
|
"watch": "webpack-dev-server --content-base public --https",
|
||||||
"deploy_dogfood": "npm run build; aws s3 sync ./public/. s3://dogfood-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
|
"deploy_dogfood": "npm run build; aws s3 sync ./public/. s3://dogfood.0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
|
||||||
"deploy_staging": "npm run build; aws s3 sync ./public/. s3://staging-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
|
"deploy_staging": "npm run build; aws s3 sync ./public/. s3://staging-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
|
||||||
"deploy_live": "npm run build; aws s3 sync ./public/. s3://0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers"
|
"deploy_live": "npm run build; aws s3 sync ./public/. s3://0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers"
|
||||||
},
|
},
|
||||||
"author": "Fabio Berger",
|
"author": "Fabio Berger",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"0x.js": "^0.38.0",
|
|
||||||
"@0xproject/react-docs": "^0.0.12",
|
"@0xproject/react-docs": "^0.0.12",
|
||||||
"@0xproject/react-shared": "^0.1.7",
|
"@0xproject/react-shared": "^0.1.7",
|
||||||
"@0xproject/subproviders": "^0.10.2",
|
"@0xproject/subproviders": "^0.10.2",
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
BlockParam,
|
|
||||||
BlockRange,
|
BlockRange,
|
||||||
|
ContractWrappers,
|
||||||
DecodedLogEvent,
|
DecodedLogEvent,
|
||||||
ECSignature,
|
|
||||||
ExchangeContractEventArgs,
|
ExchangeContractEventArgs,
|
||||||
ExchangeEvents,
|
ExchangeEvents,
|
||||||
IndexedFilterValues,
|
IndexedFilterValues,
|
||||||
LogCancelContractEventArgs,
|
LogCancelContractEventArgs,
|
||||||
LogFillContractEventArgs,
|
LogFillContractEventArgs,
|
||||||
LogWithDecodedArgs,
|
|
||||||
Order,
|
|
||||||
SignedOrder,
|
|
||||||
Token as ZeroExToken,
|
Token as ZeroExToken,
|
||||||
TransactionReceiptWithDecodedLogs,
|
} from '@0xproject/contract-wrappers';
|
||||||
ZeroEx,
|
import { isValidOrderHash, signOrderHashAsync } from '@0xproject/order-utils';
|
||||||
} from '0x.js';
|
|
||||||
import { EtherscanLinkSuffixes, utils as sharedUtils } from '@0xproject/react-shared';
|
import { EtherscanLinkSuffixes, utils as sharedUtils } from '@0xproject/react-shared';
|
||||||
import {
|
import {
|
||||||
InjectedWeb3Subprovider,
|
InjectedWeb3Subprovider,
|
||||||
@@ -23,7 +18,15 @@ import {
|
|||||||
RedundantSubprovider,
|
RedundantSubprovider,
|
||||||
Subprovider,
|
Subprovider,
|
||||||
} from '@0xproject/subproviders';
|
} from '@0xproject/subproviders';
|
||||||
import { Provider } from '@0xproject/types';
|
import {
|
||||||
|
BlockParam,
|
||||||
|
ECSignature,
|
||||||
|
LogWithDecodedArgs,
|
||||||
|
Order,
|
||||||
|
Provider,
|
||||||
|
SignedOrder,
|
||||||
|
TransactionReceiptWithDecodedLogs,
|
||||||
|
} from '@0xproject/types';
|
||||||
import { BigNumber, intervalUtils, logUtils, promisify } from '@0xproject/utils';
|
import { BigNumber, intervalUtils, logUtils, promisify } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -72,7 +75,7 @@ const providerToName: { [provider: string]: string } = {
|
|||||||
export class Blockchain {
|
export class Blockchain {
|
||||||
public networkId: number;
|
public networkId: number;
|
||||||
public nodeVersion: string;
|
public nodeVersion: string;
|
||||||
private _zeroEx: ZeroEx;
|
private _contractWrappers: ContractWrappers;
|
||||||
private _dispatcher: Dispatcher;
|
private _dispatcher: Dispatcher;
|
||||||
private _web3Wrapper?: Web3Wrapper;
|
private _web3Wrapper?: Web3Wrapper;
|
||||||
private _blockchainWatcher?: BlockchainWatcher;
|
private _blockchainWatcher?: BlockchainWatcher;
|
||||||
@@ -164,8 +167,8 @@ export class Blockchain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public async isAddressInTokenRegistryAsync(tokenAddress: string): Promise<boolean> {
|
public async isAddressInTokenRegistryAsync(tokenAddress: string): Promise<boolean> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'Contract Wrappers must be instantiated.');
|
||||||
const tokenIfExists = await this._zeroEx.tokenRegistry.getTokenIfExistsAsync(tokenAddress);
|
const tokenIfExists = await this._contractWrappers.tokenRegistry.getTokenIfExistsAsync(tokenAddress);
|
||||||
return !_.isUndefined(tokenIfExists);
|
return !_.isUndefined(tokenIfExists);
|
||||||
}
|
}
|
||||||
public getLedgerDerivationPathIfExists(): string {
|
public getLedgerDerivationPathIfExists(): string {
|
||||||
@@ -182,7 +185,7 @@ export class Blockchain {
|
|||||||
this._ledgerSubprovider.setPath(path);
|
this._ledgerSubprovider.setPath(path);
|
||||||
}
|
}
|
||||||
public async updateProviderToLedgerAsync(networkId: number): Promise<void> {
|
public async updateProviderToLedgerAsync(networkId: number): Promise<void> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'Contract Wrappers must be instantiated.');
|
||||||
|
|
||||||
const isU2FSupported = await utils.isU2FSupportedAsync();
|
const isU2FSupported = await utils.isU2FSupportedAsync();
|
||||||
if (!isU2FSupported) {
|
if (!isU2FSupported) {
|
||||||
@@ -225,12 +228,12 @@ export class Blockchain {
|
|||||||
this.networkId,
|
this.networkId,
|
||||||
shouldPollUserAddress,
|
shouldPollUserAddress,
|
||||||
);
|
);
|
||||||
this._zeroEx.setProvider(provider, this.networkId);
|
this._contractWrappers.setProvider(provider, this.networkId);
|
||||||
this._blockchainWatcher.startEmittingNetworkConnectionAndUserBalanceState();
|
this._blockchainWatcher.startEmittingNetworkConnectionAndUserBalanceState();
|
||||||
this._dispatcher.updateProviderType(ProviderType.Ledger);
|
this._dispatcher.updateProviderType(ProviderType.Ledger);
|
||||||
}
|
}
|
||||||
public async updateProviderToInjectedAsync(): Promise<void> {
|
public async updateProviderToInjectedAsync(): Promise<void> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'Contract Wrappers must be instantiated.');
|
||||||
|
|
||||||
if (_.isUndefined(this._cachedProvider)) {
|
if (_.isUndefined(this._cachedProvider)) {
|
||||||
return; // Going from injected to injected, so we noop
|
return; // Going from injected to injected, so we noop
|
||||||
@@ -253,7 +256,7 @@ export class Blockchain {
|
|||||||
const userAddresses = await this._web3Wrapper.getAvailableAddressesAsync();
|
const userAddresses = await this._web3Wrapper.getAvailableAddressesAsync();
|
||||||
this._userAddressIfExists = userAddresses[0];
|
this._userAddressIfExists = userAddresses[0];
|
||||||
|
|
||||||
this._zeroEx.setProvider(provider, this.networkId);
|
this._contractWrappers.setProvider(provider, this.networkId);
|
||||||
|
|
||||||
await this.fetchTokenInformationAsync();
|
await this.fetchTokenInformationAsync();
|
||||||
this._blockchainWatcher.startEmittingNetworkConnectionAndUserBalanceState();
|
this._blockchainWatcher.startEmittingNetworkConnectionAndUserBalanceState();
|
||||||
@@ -264,10 +267,10 @@ export class Blockchain {
|
|||||||
public async setProxyAllowanceAsync(token: Token, amountInBaseUnits: BigNumber): Promise<void> {
|
public async setProxyAllowanceAsync(token: Token, amountInBaseUnits: BigNumber): Promise<void> {
|
||||||
utils.assert(this.isValidAddress(token.address), BlockchainCallErrs.TokenAddressIsInvalid);
|
utils.assert(this.isValidAddress(token.address), BlockchainCallErrs.TokenAddressIsInvalid);
|
||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'Contract Wrappers must be instantiated.');
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._zeroEx.token.setProxyAllowanceAsync(
|
const txHash = await this._contractWrappers.token.setProxyAllowanceAsync(
|
||||||
token.address,
|
token.address,
|
||||||
this._userAddressIfExists,
|
this._userAddressIfExists,
|
||||||
amountInBaseUnits,
|
amountInBaseUnits,
|
||||||
@@ -278,11 +281,11 @@ export class Blockchain {
|
|||||||
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
||||||
}
|
}
|
||||||
public async transferAsync(token: Token, toAddress: string, amountInBaseUnits: BigNumber): Promise<void> {
|
public async transferAsync(token: Token, toAddress: string, amountInBaseUnits: BigNumber): Promise<void> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._zeroEx.token.transferAsync(
|
const txHash = await this._contractWrappers.token.transferAsync(
|
||||||
token.address,
|
token.address,
|
||||||
this._userAddressIfExists,
|
this._userAddressIfExists,
|
||||||
toAddress,
|
toAddress,
|
||||||
@@ -326,13 +329,13 @@ export class Blockchain {
|
|||||||
return zeroExSignedOrder;
|
return zeroExSignedOrder;
|
||||||
}
|
}
|
||||||
public async fillOrderAsync(signedOrder: SignedOrder, fillTakerTokenAmount: BigNumber): Promise<BigNumber> {
|
public async fillOrderAsync(signedOrder: SignedOrder, fillTakerTokenAmount: BigNumber): Promise<BigNumber> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
|
|
||||||
const shouldThrowOnInsufficientBalanceOrAllowance = true;
|
const shouldThrowOnInsufficientBalanceOrAllowance = true;
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._zeroEx.exchange.fillOrderAsync(
|
const txHash = await this._contractWrappers.exchange.fillOrderAsync(
|
||||||
signedOrder,
|
signedOrder,
|
||||||
fillTakerTokenAmount,
|
fillTakerTokenAmount,
|
||||||
shouldThrowOnInsufficientBalanceOrAllowance,
|
shouldThrowOnInsufficientBalanceOrAllowance,
|
||||||
@@ -343,7 +346,7 @@ export class Blockchain {
|
|||||||
);
|
);
|
||||||
const receipt = await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
const receipt = await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
||||||
const logs: Array<LogWithDecodedArgs<ExchangeContractEventArgs>> = receipt.logs as any;
|
const logs: Array<LogWithDecodedArgs<ExchangeContractEventArgs>> = receipt.logs as any;
|
||||||
this._zeroEx.exchange.throwLogErrorsAsErrors(logs);
|
this._contractWrappers.exchange.throwLogErrorsAsErrors(logs);
|
||||||
const logFill = _.find(logs, { event: 'LogFill' });
|
const logFill = _.find(logs, { event: 'LogFill' });
|
||||||
const args = (logFill.args as any) as LogFillContractEventArgs;
|
const args = (logFill.args as any) as LogFillContractEventArgs;
|
||||||
const filledTakerTokenAmount = args.filledTakerTokenAmount;
|
const filledTakerTokenAmount = args.filledTakerTokenAmount;
|
||||||
@@ -351,32 +354,32 @@ export class Blockchain {
|
|||||||
}
|
}
|
||||||
public async cancelOrderAsync(signedOrder: SignedOrder, cancelTakerTokenAmount: BigNumber): Promise<BigNumber> {
|
public async cancelOrderAsync(signedOrder: SignedOrder, cancelTakerTokenAmount: BigNumber): Promise<BigNumber> {
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._zeroEx.exchange.cancelOrderAsync(signedOrder, cancelTakerTokenAmount, {
|
const txHash = await this._contractWrappers.exchange.cancelOrderAsync(signedOrder, cancelTakerTokenAmount, {
|
||||||
gasPrice: this._defaultGasPrice,
|
gasPrice: this._defaultGasPrice,
|
||||||
});
|
});
|
||||||
const receipt = await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
const receipt = await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
||||||
const logs: Array<LogWithDecodedArgs<ExchangeContractEventArgs>> = receipt.logs as any;
|
const logs: Array<LogWithDecodedArgs<ExchangeContractEventArgs>> = receipt.logs as any;
|
||||||
this._zeroEx.exchange.throwLogErrorsAsErrors(logs);
|
this._contractWrappers.exchange.throwLogErrorsAsErrors(logs);
|
||||||
const logCancel = _.find(logs, { event: ExchangeEvents.LogCancel });
|
const logCancel = _.find(logs, { event: ExchangeEvents.LogCancel });
|
||||||
const args = (logCancel.args as any) as LogCancelContractEventArgs;
|
const args = (logCancel.args as any) as LogCancelContractEventArgs;
|
||||||
const cancelledTakerTokenAmount = args.cancelledTakerTokenAmount;
|
const cancelledTakerTokenAmount = args.cancelledTakerTokenAmount;
|
||||||
return cancelledTakerTokenAmount;
|
return cancelledTakerTokenAmount;
|
||||||
}
|
}
|
||||||
public async getUnavailableTakerAmountAsync(orderHash: string): Promise<BigNumber> {
|
public async getUnavailableTakerAmountAsync(orderHash: string): Promise<BigNumber> {
|
||||||
utils.assert(ZeroEx.isValidOrderHash(orderHash), 'Must be valid orderHash');
|
utils.assert(isValidOrderHash(orderHash), 'Must be valid orderHash');
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
const unavailableTakerAmount = await this._zeroEx.exchange.getUnavailableTakerAmountAsync(orderHash);
|
const unavailableTakerAmount = await this._contractWrappers.exchange.getUnavailableTakerAmountAsync(orderHash);
|
||||||
return unavailableTakerAmount;
|
return unavailableTakerAmount;
|
||||||
}
|
}
|
||||||
public getExchangeContractAddressIfExists(): string | undefined {
|
public getExchangeContractAddressIfExists(): string | undefined {
|
||||||
return this._zeroEx.exchange.getContractAddress();
|
return this._contractWrappers.exchange.getContractAddress();
|
||||||
}
|
}
|
||||||
public async validateFillOrderThrowIfInvalidAsync(
|
public async validateFillOrderThrowIfInvalidAsync(
|
||||||
signedOrder: SignedOrder,
|
signedOrder: SignedOrder,
|
||||||
fillTakerTokenAmount: BigNumber,
|
fillTakerTokenAmount: BigNumber,
|
||||||
takerAddress: string,
|
takerAddress: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await this._zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(
|
await this._contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync(
|
||||||
signedOrder,
|
signedOrder,
|
||||||
fillTakerTokenAmount,
|
fillTakerTokenAmount,
|
||||||
takerAddress,
|
takerAddress,
|
||||||
@@ -386,7 +389,7 @@ export class Blockchain {
|
|||||||
order: Order,
|
order: Order,
|
||||||
cancelTakerTokenAmount: BigNumber,
|
cancelTakerTokenAmount: BigNumber,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await this._zeroEx.exchange.validateCancelOrderThrowIfInvalidAsync(order, cancelTakerTokenAmount);
|
await this._contractWrappers.exchange.validateCancelOrderThrowIfInvalidAsync(order, cancelTakerTokenAmount);
|
||||||
}
|
}
|
||||||
public isValidAddress(address: string): boolean {
|
public isValidAddress(address: string): boolean {
|
||||||
const lowercaseAddress = address.toLowerCase();
|
const lowercaseAddress = address.toLowerCase();
|
||||||
@@ -421,7 +424,7 @@ export class Blockchain {
|
|||||||
return newTokenBalancePromise;
|
return newTokenBalancePromise;
|
||||||
}
|
}
|
||||||
public async signOrderHashAsync(orderHash: string): Promise<ECSignature> {
|
public async signOrderHashAsync(orderHash: string): Promise<ECSignature> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
const makerAddress = this._userAddressIfExists;
|
const makerAddress = this._userAddressIfExists;
|
||||||
// If makerAddress is undefined, this means they have a web3 instance injected into their browser
|
// If makerAddress is undefined, this means they have a web3 instance injected into their browser
|
||||||
// but no account addresses associated with it.
|
// but no account addresses associated with it.
|
||||||
@@ -438,11 +441,8 @@ export class Blockchain {
|
|||||||
if ((isParityNode && !isLedgerSigner) || isTestRpc || isLedgerSigner) {
|
if ((isParityNode && !isLedgerSigner) || isTestRpc || isLedgerSigner) {
|
||||||
shouldAddPersonalMessagePrefix = false;
|
shouldAddPersonalMessagePrefix = false;
|
||||||
}
|
}
|
||||||
const ecSignature = await this._zeroEx.signOrderHashAsync(
|
const provider = this._contractWrappers.getProvider();
|
||||||
orderHash,
|
const ecSignature = await signOrderHashAsync(provider, orderHash, makerAddress, shouldAddPersonalMessagePrefix);
|
||||||
makerAddress,
|
|
||||||
shouldAddPersonalMessagePrefix,
|
|
||||||
);
|
|
||||||
this._dispatcher.updateECSignature(ecSignature);
|
this._dispatcher.updateECSignature(ecSignature);
|
||||||
return ecSignature;
|
return ecSignature;
|
||||||
}
|
}
|
||||||
@@ -461,11 +461,11 @@ export class Blockchain {
|
|||||||
return balanceInWei;
|
return balanceInWei;
|
||||||
}
|
}
|
||||||
public async convertEthToWrappedEthTokensAsync(etherTokenAddress: string, amount: BigNumber): Promise<void> {
|
public async convertEthToWrappedEthTokensAsync(etherTokenAddress: string, amount: BigNumber): Promise<void> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._zeroEx.etherToken.depositAsync(
|
const txHash = await this._contractWrappers.etherToken.depositAsync(
|
||||||
etherTokenAddress,
|
etherTokenAddress,
|
||||||
amount,
|
amount,
|
||||||
this._userAddressIfExists,
|
this._userAddressIfExists,
|
||||||
@@ -476,11 +476,11 @@ export class Blockchain {
|
|||||||
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
|
||||||
}
|
}
|
||||||
public async convertWrappedEthTokensToEthAsync(etherTokenAddress: string, amount: BigNumber): Promise<void> {
|
public async convertWrappedEthTokensToEthAsync(etherTokenAddress: string, amount: BigNumber): Promise<void> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
|
|
||||||
this._showFlashMessageIfLedger();
|
this._showFlashMessageIfLedger();
|
||||||
const txHash = await this._zeroEx.etherToken.withdrawAsync(
|
const txHash = await this._contractWrappers.etherToken.withdrawAsync(
|
||||||
etherTokenAddress,
|
etherTokenAddress,
|
||||||
amount,
|
amount,
|
||||||
this._userAddressIfExists,
|
this._userAddressIfExists,
|
||||||
@@ -507,7 +507,7 @@ export class Blockchain {
|
|||||||
ownerAddressIfExists: string,
|
ownerAddressIfExists: string,
|
||||||
tokenAddress: string,
|
tokenAddress: string,
|
||||||
): Promise<BigNumber[]> {
|
): Promise<BigNumber[]> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
|
|
||||||
if (_.isUndefined(ownerAddressIfExists)) {
|
if (_.isUndefined(ownerAddressIfExists)) {
|
||||||
const zero = new BigNumber(0);
|
const zero = new BigNumber(0);
|
||||||
@@ -516,14 +516,16 @@ export class Blockchain {
|
|||||||
let balance = new BigNumber(0);
|
let balance = new BigNumber(0);
|
||||||
let allowance = new BigNumber(0);
|
let allowance = new BigNumber(0);
|
||||||
if (this._doesUserAddressExist()) {
|
if (this._doesUserAddressExist()) {
|
||||||
balance = await this._zeroEx.token.getBalanceAsync(tokenAddress, ownerAddressIfExists);
|
balance = await this._contractWrappers.token.getBalanceAsync(tokenAddress, ownerAddressIfExists);
|
||||||
allowance = await this._zeroEx.token.getProxyAllowanceAsync(tokenAddress, ownerAddressIfExists);
|
allowance = await this._contractWrappers.token.getProxyAllowanceAsync(tokenAddress, ownerAddressIfExists);
|
||||||
}
|
}
|
||||||
return [balance, allowance];
|
return [balance, allowance];
|
||||||
}
|
}
|
||||||
public async getUserAccountsAsync(): Promise<string[]> {
|
public async getUserAccountsAsync(): Promise<string[]> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
const userAccountsIfExists = await this._zeroEx.getAvailableAddressesAsync();
|
const provider = this._contractWrappers.getProvider();
|
||||||
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
|
const userAccountsIfExists = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
return userAccountsIfExists;
|
return userAccountsIfExists;
|
||||||
}
|
}
|
||||||
// HACK: When a user is using a Ledger, we simply dispatch the selected userAddress, which
|
// HACK: When a user is using a Ledger, we simply dispatch the selected userAddress, which
|
||||||
@@ -619,7 +621,9 @@ export class Blockchain {
|
|||||||
etherScanLinkIfExists,
|
etherScanLinkIfExists,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const receipt = await this._zeroEx.awaitTransactionMinedAsync(txHash);
|
const provider = this._contractWrappers.getProvider();
|
||||||
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
|
const receipt = await web3Wrapper.awaitTransactionMinedAsync(txHash);
|
||||||
return receipt;
|
return receipt;
|
||||||
}
|
}
|
||||||
private _doesUserAddressExist(): boolean {
|
private _doesUserAddressExist(): boolean {
|
||||||
@@ -633,7 +637,7 @@ export class Blockchain {
|
|||||||
return; // short-circuit
|
return; // short-circuit
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(this._zeroEx)) {
|
if (!_.isUndefined(this._contractWrappers)) {
|
||||||
// Since we do not have an index on the `taker` address and want to show
|
// Since we do not have an index on the `taker` address and want to show
|
||||||
// transactions where an account is either the `maker` or `taker`, we loop
|
// transactions where an account is either the `maker` or `taker`, we loop
|
||||||
// through all fill events, and filter/cache them client-side.
|
// through all fill events, and filter/cache them client-side.
|
||||||
@@ -642,14 +646,14 @@ export class Blockchain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async _startListeningForExchangeLogFillEventsAsync(indexFilterValues: IndexedFilterValues): Promise<void> {
|
private async _startListeningForExchangeLogFillEventsAsync(indexFilterValues: IndexedFilterValues): Promise<void> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
|
||||||
|
|
||||||
// Fetch historical logs
|
// Fetch historical logs
|
||||||
await this._fetchHistoricalExchangeLogFillEventsAsync(indexFilterValues);
|
await this._fetchHistoricalExchangeLogFillEventsAsync(indexFilterValues);
|
||||||
|
|
||||||
// Start a subscription for new logs
|
// Start a subscription for new logs
|
||||||
this._zeroEx.exchange.subscribe(
|
this._contractWrappers.exchange.subscribe(
|
||||||
ExchangeEvents.LogFill,
|
ExchangeEvents.LogFill,
|
||||||
indexFilterValues,
|
indexFilterValues,
|
||||||
async (err: Error, decodedLogEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
|
async (err: Error, decodedLogEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
|
||||||
@@ -684,7 +688,7 @@ export class Blockchain {
|
|||||||
fromBlock,
|
fromBlock,
|
||||||
toBlock: 'latest' as BlockParam,
|
toBlock: 'latest' as BlockParam,
|
||||||
};
|
};
|
||||||
const decodedLogs = await this._zeroEx.exchange.getLogsAsync<LogFillContractEventArgs>(
|
const decodedLogs = await this._contractWrappers.exchange.getLogsAsync<LogFillContractEventArgs>(
|
||||||
ExchangeEvents.LogFill,
|
ExchangeEvents.LogFill,
|
||||||
blockRange,
|
blockRange,
|
||||||
indexFilterValues,
|
indexFilterValues,
|
||||||
@@ -741,11 +745,11 @@ export class Blockchain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private _stopWatchingExchangeLogFillEvents(): void {
|
private _stopWatchingExchangeLogFillEvents(): void {
|
||||||
this._zeroEx.exchange.unsubscribeAll();
|
this._contractWrappers.exchange.unsubscribeAll();
|
||||||
}
|
}
|
||||||
private async _getTokenRegistryTokensByAddressAsync(): Promise<TokenByAddress> {
|
private async _getTokenRegistryTokensByAddressAsync(): Promise<TokenByAddress> {
|
||||||
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
|
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
|
||||||
const tokenRegistryTokens = await this._zeroEx.tokenRegistry.getTokensAsync();
|
const tokenRegistryTokens = await this._contractWrappers.tokenRegistry.getTokensAsync();
|
||||||
|
|
||||||
const tokenByAddress: TokenByAddress = {};
|
const tokenByAddress: TokenByAddress = {};
|
||||||
_.each(tokenRegistryTokens, (t: ZeroExToken, i: number) => {
|
_.each(tokenRegistryTokens, (t: ZeroExToken, i: number) => {
|
||||||
@@ -794,7 +798,7 @@ export class Blockchain {
|
|||||||
const zeroExConfigs = {
|
const zeroExConfigs = {
|
||||||
networkId: this.networkId,
|
networkId: this.networkId,
|
||||||
};
|
};
|
||||||
this._zeroEx = new ZeroEx(provider, zeroExConfigs);
|
this._contractWrappers = new ContractWrappers(provider, zeroExConfigs);
|
||||||
this._updateProviderName(injectedWeb3);
|
this._updateProviderName(injectedWeb3);
|
||||||
const shouldPollUserAddress = true;
|
const shouldPollUserAddress = true;
|
||||||
this._web3Wrapper = new Web3Wrapper(provider);
|
this._web3Wrapper = new Web3Wrapper(provider);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { colors } from '@0xproject/react-shared';
|
import { colors } from '@0xproject/react-shared';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Dialog from 'material-ui/Dialog';
|
import Dialog from 'material-ui/Dialog';
|
||||||
import FlatButton from 'material-ui/FlatButton';
|
import FlatButton from 'material-ui/FlatButton';
|
||||||
@@ -78,7 +78,7 @@ export class EthWethConversionDialog extends React.Component<
|
|||||||
? 'Convert your Ether into a tokenized, tradable form.'
|
? 'Convert your Ether into a tokenized, tradable form.'
|
||||||
: "Convert your Wrapped Ether back into it's native form.";
|
: "Convert your Wrapped Ether back into it's native form.";
|
||||||
const isWrappedVersion = this.props.direction === Side.Receive;
|
const isWrappedVersion = this.props.direction === Side.Receive;
|
||||||
const etherBalanceInEth = ZeroEx.toUnitAmount(this.props.etherBalanceInWei, constants.DECIMAL_PLACES_ETH);
|
const etherBalanceInEth = Web3Wrapper.toUnitAmount(this.props.etherBalanceInWei, constants.DECIMAL_PLACES_ETH);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="pb2">{explanation}</div>
|
<div className="pb2">{explanation}</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
|
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
|
||||||
import { BigNumber, logUtils } from '@0xproject/utils';
|
import { BigNumber, logUtils } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Dialog from 'material-ui/Dialog';
|
import Dialog from 'material-ui/Dialog';
|
||||||
import FlatButton from 'material-ui/FlatButton';
|
import FlatButton from 'material-ui/FlatButton';
|
||||||
@@ -168,7 +168,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
|
|||||||
// We specifically prefix kovan ETH.
|
// We specifically prefix kovan ETH.
|
||||||
// TODO: We should probably add prefixes for all networks
|
// TODO: We should probably add prefixes for all networks
|
||||||
const isKovanNetwork = networkName === 'Kovan';
|
const isKovanNetwork = networkName === 'Kovan';
|
||||||
const balanceInEth = ZeroEx.toUnitAmount(balanceInWei, constants.DECIMAL_PLACES_ETH);
|
const balanceInEth = Web3Wrapper.toUnitAmount(balanceInWei, constants.DECIMAL_PLACES_ETH);
|
||||||
const balanceString = `${balanceInEth.toString()} ${isKovanNetwork ? 'Kovan ' : ''}ETH`;
|
const balanceString = `${balanceInEth.toString()} ${isKovanNetwork ? 'Kovan ' : ''}ETH`;
|
||||||
return (
|
return (
|
||||||
<TableRow key={userAddress} style={{ height: 40 }}>
|
<TableRow key={userAddress} style={{ height: 40 }}>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BigNumber, logUtils } from '@0xproject/utils';
|
import { BigNumber, logUtils } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import RaisedButton from 'material-ui/RaisedButton';
|
import RaisedButton from 'material-ui/RaisedButton';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
@@ -95,11 +95,11 @@ export class EthWethConversionButton extends React.Component<
|
|||||||
try {
|
try {
|
||||||
if (direction === Side.Deposit) {
|
if (direction === Side.Deposit) {
|
||||||
await this.props.blockchain.convertEthToWrappedEthTokensAsync(token.address, value);
|
await this.props.blockchain.convertEthToWrappedEthTokensAsync(token.address, value);
|
||||||
const ethAmount = ZeroEx.toUnitAmount(value, constants.DECIMAL_PLACES_ETH);
|
const ethAmount = Web3Wrapper.toUnitAmount(value, constants.DECIMAL_PLACES_ETH);
|
||||||
this.props.dispatcher.showFlashMessage(`Successfully wrapped ${ethAmount.toString()} ETH to WETH`);
|
this.props.dispatcher.showFlashMessage(`Successfully wrapped ${ethAmount.toString()} ETH to WETH`);
|
||||||
} else {
|
} else {
|
||||||
await this.props.blockchain.convertWrappedEthTokensToEthAsync(token.address, value);
|
await this.props.blockchain.convertWrappedEthTokensToEthAsync(token.address, value);
|
||||||
const tokenAmount = ZeroEx.toUnitAmount(value, token.decimals);
|
const tokenAmount = Web3Wrapper.toUnitAmount(value, token.decimals);
|
||||||
this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount.toString()} WETH to ETH`);
|
this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount.toString()} WETH to ETH`);
|
||||||
}
|
}
|
||||||
if (!this.props.isOutdatedWrappedEther) {
|
if (!this.props.isOutdatedWrappedEther) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { colors, EtherscanLinkSuffixes, utils as sharedUtils } from '@0xproject/react-shared';
|
import { colors, EtherscanLinkSuffixes, utils as sharedUtils } from '@0xproject/react-shared';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Divider from 'material-ui/Divider';
|
import Divider from 'material-ui/Divider';
|
||||||
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table';
|
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table';
|
||||||
@@ -85,7 +85,7 @@ export class EthWrappers extends React.Component<EthWrappersProps, EthWrappersSt
|
|||||||
}
|
}
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
const etherToken = this._getEthToken();
|
const etherToken = this._getEthToken();
|
||||||
const wethBalance = ZeroEx.toUnitAmount(this.state.ethTokenState.balance, constants.DECIMAL_PLACES_ETH);
|
const wethBalance = Web3Wrapper.toUnitAmount(this.state.ethTokenState.balance, constants.DECIMAL_PLACES_ETH);
|
||||||
const isBidirectional = true;
|
const isBidirectional = true;
|
||||||
const etherscanUrl = sharedUtils.getEtherScanLinkIfExists(
|
const etherscanUrl = sharedUtils.getEtherScanLinkIfExists(
|
||||||
etherToken.address,
|
etherToken.address,
|
||||||
@@ -93,7 +93,7 @@ export class EthWrappers extends React.Component<EthWrappersProps, EthWrappersSt
|
|||||||
EtherscanLinkSuffixes.Address,
|
EtherscanLinkSuffixes.Address,
|
||||||
);
|
);
|
||||||
const tokenLabel = this._renderToken('Wrapped Ether', etherToken.address, configs.ICON_URL_BY_SYMBOL.WETH);
|
const tokenLabel = this._renderToken('Wrapped Ether', etherToken.address, configs.ICON_URL_BY_SYMBOL.WETH);
|
||||||
const userEtherBalanceInEth = ZeroEx.toUnitAmount(
|
const userEtherBalanceInEth = Web3Wrapper.toUnitAmount(
|
||||||
this.props.userEtherBalanceInWei,
|
this.props.userEtherBalanceInWei,
|
||||||
constants.DECIMAL_PLACES_ETH,
|
constants.DECIMAL_PLACES_ETH,
|
||||||
);
|
);
|
||||||
@@ -265,7 +265,7 @@ export class EthWrappers extends React.Component<EthWrappersProps, EthWrappersSt
|
|||||||
const outdatedEtherTokenState = this.state.outdatedWETHStateByAddress[outdatedWETHIfExists.address];
|
const outdatedEtherTokenState = this.state.outdatedWETHStateByAddress[outdatedWETHIfExists.address];
|
||||||
const isStateLoaded = outdatedEtherTokenState.isLoaded;
|
const isStateLoaded = outdatedEtherTokenState.isLoaded;
|
||||||
const balanceInEthIfExists = isStateLoaded
|
const balanceInEthIfExists = isStateLoaded
|
||||||
? ZeroEx.toUnitAmount(outdatedEtherTokenState.balance, constants.DECIMAL_PLACES_ETH).toFixed(
|
? Web3Wrapper.toUnitAmount(outdatedEtherTokenState.balance, constants.DECIMAL_PLACES_ETH).toFixed(
|
||||||
configs.AMOUNT_DISPLAY_PRECSION,
|
configs.AMOUNT_DISPLAY_PRECSION,
|
||||||
)
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { Order as ZeroExOrder, ZeroEx } from '0x.js';
|
import { getOrderHashHex, isValidSignature } from '@0xproject/order-utils';
|
||||||
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
|
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
|
||||||
|
import { Order as ZeroExOrder } from '@0xproject/types';
|
||||||
import { BigNumber, logUtils } from '@0xproject/utils';
|
import { BigNumber, logUtils } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as accounting from 'accounting';
|
import * as accounting from 'accounting';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { Card, CardHeader, CardText } from 'material-ui/Card';
|
import { Card, CardHeader, CardText } from 'material-ui/Card';
|
||||||
@@ -433,15 +435,15 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
|
|||||||
takerTokenAddress: parsedOrder.signedOrder.takerTokenAddress,
|
takerTokenAddress: parsedOrder.signedOrder.takerTokenAddress,
|
||||||
takerTokenAmount: takerAmount,
|
takerTokenAmount: takerAmount,
|
||||||
};
|
};
|
||||||
orderHash = ZeroEx.getOrderHashHex(zeroExOrder);
|
orderHash = getOrderHashHex(zeroExOrder);
|
||||||
|
|
||||||
const exchangeContractAddr = this.props.blockchain.getExchangeContractAddressIfExists();
|
const exchangeContractAddr = this.props.blockchain.getExchangeContractAddressIfExists();
|
||||||
const signature = parsedOrder.signedOrder.ecSignature;
|
const signature = parsedOrder.signedOrder.ecSignature;
|
||||||
const isValidSignature = ZeroEx.isValidSignature(orderHash, signature, parsedOrder.signedOrder.maker);
|
const isSignatureValid = isValidSignature(orderHash, signature, parsedOrder.signedOrder.maker);
|
||||||
if (exchangeContractAddr !== parsedOrder.signedOrder.exchangeContractAddress) {
|
if (exchangeContractAddr !== parsedOrder.signedOrder.exchangeContractAddress) {
|
||||||
orderJSONErrMsg = 'This order was made on another network or using a deprecated Exchange contract';
|
orderJSONErrMsg = 'This order was made on another network or using a deprecated Exchange contract';
|
||||||
parsedOrder = undefined;
|
parsedOrder = undefined;
|
||||||
} else if (!isValidSignature) {
|
} else if (!isSignatureValid) {
|
||||||
orderJSONErrMsg = 'Order signature is invalid';
|
orderJSONErrMsg = 'Order signature is invalid';
|
||||||
parsedOrder = undefined;
|
parsedOrder = undefined;
|
||||||
} else {
|
} else {
|
||||||
@@ -600,7 +602,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
|
|||||||
const takerTokenAmount = new BigNumber(parsedOrder.signedOrder.takerTokenAmount);
|
const takerTokenAmount = new BigNumber(parsedOrder.signedOrder.takerTokenAmount);
|
||||||
|
|
||||||
const signedOrder = this.props.blockchain.portalOrderToZeroExOrder(parsedOrder);
|
const signedOrder = this.props.blockchain.portalOrderToZeroExOrder(parsedOrder);
|
||||||
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
|
const orderHash = getOrderHashHex(signedOrder);
|
||||||
const unavailableTakerAmount = await this.props.blockchain.getUnavailableTakerAmountAsync(orderHash);
|
const unavailableTakerAmount = await this.props.blockchain.getUnavailableTakerAmountAsync(orderHash);
|
||||||
const availableTakerTokenAmount = takerTokenAmount.minus(unavailableTakerAmount);
|
const availableTakerTokenAmount = takerTokenAmount.minus(unavailableTakerAmount);
|
||||||
try {
|
try {
|
||||||
@@ -646,7 +648,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private _formatCurrencyAmount(amount: BigNumber, decimals: number): number {
|
private _formatCurrencyAmount(amount: BigNumber, decimals: number): number {
|
||||||
const unitAmount = ZeroEx.toUnitAmount(amount, decimals);
|
const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
|
||||||
const roundedUnitAmount = Math.round(unitAmount.toNumber() * 100000) / 100000;
|
const roundedUnitAmount = Math.round(unitAmount.toNumber() * 100000) / 100000;
|
||||||
return roundedUnitAmount;
|
return roundedUnitAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { generatePseudoRandomSalt } from '@0xproject/order-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Paper from 'material-ui/Paper';
|
import Paper from 'material-ui/Paper';
|
||||||
@@ -38,7 +38,7 @@ export class FillOrderJSON extends React.Component<FillOrderJSONProps, FillOrder
|
|||||||
s: '937862111edcba395f8a9e0cc1b2c5e12320...',
|
s: '937862111edcba395f8a9e0cc1b2c5e12320...',
|
||||||
v: 27,
|
v: 27,
|
||||||
};
|
};
|
||||||
const hintSalt = ZeroEx.generatePseudoRandomSalt();
|
const hintSalt = generatePseudoRandomSalt();
|
||||||
const feeRecipient = constants.NULL_ADDRESS;
|
const feeRecipient = constants.NULL_ADDRESS;
|
||||||
const hintOrder = utils.generateOrder(
|
const hintOrder = utils.generateOrder(
|
||||||
exchangeContract,
|
exchangeContract,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { colors } from '@0xproject/react-shared';
|
import { colors } from '@0xproject/react-shared';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Token } from 'ts/types';
|
import { Token } from 'ts/types';
|
||||||
@@ -22,7 +22,7 @@ export class TokenSendCompleted extends React.Component<TokenSendCompletedProps,
|
|||||||
Verify on Etherscan
|
Verify on Etherscan
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
const amountInUnits = ZeroEx.toUnitAmount(this.props.amountInBaseUnits, this.props.token.decimals);
|
const amountInUnits = Web3Wrapper.toUnitAmount(this.props.amountInBaseUnits, this.props.token.decimals);
|
||||||
const truncatedAddress = utils.getAddressBeginAndEnd(this.props.toAddress);
|
const truncatedAddress = utils.getAddressBeginAndEnd(this.props.toAddress);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { ECSignature, Order, ZeroEx } from '0x.js';
|
import { generatePseudoRandomSalt, getOrderHashHex } from '@0xproject/order-utils';
|
||||||
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
|
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
|
||||||
|
import { ECSignature, Order } from '@0xproject/types';
|
||||||
import { BigNumber, logUtils } from '@0xproject/utils';
|
import { BigNumber, logUtils } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Dialog from 'material-ui/Dialog';
|
import Dialog from 'material-ui/Dialog';
|
||||||
@@ -78,7 +79,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
|
|||||||
specified, anyone is able to fill it.';
|
specified, anyone is able to fill it.';
|
||||||
const exchangeContractIfExists = this.props.blockchain.getExchangeContractAddressIfExists();
|
const exchangeContractIfExists = this.props.blockchain.getExchangeContractAddressIfExists();
|
||||||
const initialTakerAddress =
|
const initialTakerAddress =
|
||||||
this.props.orderTakerAddress === ZeroEx.NULL_ADDRESS ? '' : this.props.orderTakerAddress;
|
this.props.orderTakerAddress === constants.NULL_ADDRESS ? '' : this.props.orderTakerAddress;
|
||||||
return (
|
return (
|
||||||
<div className="clearfix mb2 lg-px4 md-px4 sm-px2">
|
<div className="clearfix mb2 lg-px4 md-px4 sm-px2">
|
||||||
<h3>Generate an order</h3>
|
<h3>Generate an order</h3>
|
||||||
@@ -224,7 +225,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
|
|||||||
// Upon closing the order JSON dialog, we update the orderSalt stored in the Redux store
|
// Upon closing the order JSON dialog, we update the orderSalt stored in the Redux store
|
||||||
// with a new value so that if a user signs the identical order again, the newly signed
|
// with a new value so that if a user signs the identical order again, the newly signed
|
||||||
// orderHash will not collide with the previously generated orderHash.
|
// orderHash will not collide with the previously generated orderHash.
|
||||||
this.props.dispatcher.updateOrderSalt(ZeroEx.generatePseudoRandomSalt());
|
this.props.dispatcher.updateOrderSalt(generatePseudoRandomSalt());
|
||||||
this.setState({
|
this.setState({
|
||||||
signingState: SigningState.UNSIGNED,
|
signingState: SigningState.UNSIGNED,
|
||||||
});
|
});
|
||||||
@@ -305,7 +306,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
|
|||||||
takerTokenAddress: hashData.receiveTokenContractAddr,
|
takerTokenAddress: hashData.receiveTokenContractAddr,
|
||||||
takerTokenAmount: hashData.receiveAmount,
|
takerTokenAmount: hashData.receiveAmount,
|
||||||
};
|
};
|
||||||
const orderHash = ZeroEx.getOrderHashHex(zeroExOrder);
|
const orderHash = getOrderHashHex(zeroExOrder);
|
||||||
|
|
||||||
let globalErrMsg = '';
|
let globalErrMsg = '';
|
||||||
try {
|
try {
|
||||||
@@ -348,7 +349,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
|
|||||||
}
|
}
|
||||||
private _updateOrderAddress(address?: string): void {
|
private _updateOrderAddress(address?: string): void {
|
||||||
if (!_.isUndefined(address)) {
|
if (!_.isUndefined(address)) {
|
||||||
const normalizedAddress = _.isEmpty(address) ? ZeroEx.NULL_ADDRESS : address;
|
const normalizedAddress = _.isEmpty(address) ? constants.NULL_ADDRESS : address;
|
||||||
this.props.dispatcher.updateOrderTakerAddress(normalizedAddress);
|
this.props.dispatcher.updateOrderTakerAddress(normalizedAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { BalanceBoundedInput } from 'ts/components/inputs/balance_bounded_input';
|
import { BalanceBoundedInput } from 'ts/components/inputs/balance_bounded_input';
|
||||||
@@ -34,7 +34,7 @@ export class EthAmountInput extends React.Component<EthAmountInputProps, EthAmou
|
|||||||
};
|
};
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
const amount = this.props.amount
|
const amount = this.props.amount
|
||||||
? ZeroEx.toUnitAmount(this.props.amount, constants.DECIMAL_PLACES_ETH)
|
? Web3Wrapper.toUnitAmount(this.props.amount, constants.DECIMAL_PLACES_ETH)
|
||||||
: undefined;
|
: undefined;
|
||||||
return (
|
return (
|
||||||
<div className="flex overflow-hidden" style={this.props.style}>
|
<div className="flex overflow-hidden" style={this.props.style}>
|
||||||
@@ -61,7 +61,7 @@ export class EthAmountInput extends React.Component<EthAmountInputProps, EthAmou
|
|||||||
private _onChange(isValid: boolean, amount?: BigNumber): void {
|
private _onChange(isValid: boolean, amount?: BigNumber): void {
|
||||||
const baseUnitAmountIfExists = _.isUndefined(amount)
|
const baseUnitAmountIfExists = _.isUndefined(amount)
|
||||||
? undefined
|
? undefined
|
||||||
: ZeroEx.toBaseUnitAmount(amount, constants.DECIMAL_PLACES_ETH);
|
: Web3Wrapper.toBaseUnitAmount(amount, constants.DECIMAL_PLACES_ETH);
|
||||||
this.props.onChange(isValid, baseUnitAmountIfExists);
|
this.props.onChange(isValid, baseUnitAmountIfExists);
|
||||||
}
|
}
|
||||||
private _getLabelStyle(): React.CSSProperties {
|
private _getLabelStyle(): React.CSSProperties {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Order, ZeroEx } from '0x.js';
|
import { getOrderHashHex } from '@0xproject/order-utils';
|
||||||
import { Styles } from '@0xproject/react-shared';
|
import { Styles } from '@0xproject/react-shared';
|
||||||
|
import { Order } from '@0xproject/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import ReactTooltip = require('react-tooltip');
|
import ReactTooltip = require('react-tooltip');
|
||||||
@@ -57,7 +58,7 @@ export class HashInput extends React.Component<HashInputProps, HashInputState> {
|
|||||||
takerTokenAddress: hashData.receiveTokenContractAddr,
|
takerTokenAddress: hashData.receiveTokenContractAddr,
|
||||||
takerTokenAmount: hashData.receiveAmount,
|
takerTokenAmount: hashData.receiveAmount,
|
||||||
};
|
};
|
||||||
const orderHash = ZeroEx.getOrderHashHex(order);
|
const orderHash = getOrderHashHex(order);
|
||||||
return orderHash;
|
return orderHash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { colors } from '@0xproject/react-shared';
|
import { colors } from '@0xproject/react-shared';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
@@ -75,14 +75,14 @@ export class TokenAmountInput extends React.Component<TokenAmountInputProps, Tok
|
|||||||
}
|
}
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
const amount = this.props.amount
|
const amount = this.props.amount
|
||||||
? ZeroEx.toUnitAmount(this.props.amount, this.props.token.decimals)
|
? Web3Wrapper.toUnitAmount(this.props.amount, this.props.token.decimals)
|
||||||
: undefined;
|
: undefined;
|
||||||
return (
|
return (
|
||||||
<div className="flex overflow-hidden" style={this._getStyle()}>
|
<div className="flex overflow-hidden" style={this._getStyle()}>
|
||||||
<BalanceBoundedInput
|
<BalanceBoundedInput
|
||||||
label={this.props.label}
|
label={this.props.label}
|
||||||
amount={amount}
|
amount={amount}
|
||||||
balance={ZeroEx.toUnitAmount(this.state.balance, this.props.token.decimals)}
|
balance={Web3Wrapper.toUnitAmount(this.state.balance, this.props.token.decimals)}
|
||||||
onChange={this._onChange.bind(this)}
|
onChange={this._onChange.bind(this)}
|
||||||
onErrorMsgChange={this.props.onErrorMsgChange}
|
onErrorMsgChange={this.props.onErrorMsgChange}
|
||||||
validate={this._validate.bind(this)}
|
validate={this._validate.bind(this)}
|
||||||
@@ -103,7 +103,7 @@ export class TokenAmountInput extends React.Component<TokenAmountInputProps, Tok
|
|||||||
private _onChange(isValid: boolean, amount?: BigNumber): void {
|
private _onChange(isValid: boolean, amount?: BigNumber): void {
|
||||||
let baseUnitAmount;
|
let baseUnitAmount;
|
||||||
if (!_.isUndefined(amount)) {
|
if (!_.isUndefined(amount)) {
|
||||||
baseUnitAmount = ZeroEx.toBaseUnitAmount(amount, this.props.token.decimals);
|
baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amount, this.props.token.decimals);
|
||||||
}
|
}
|
||||||
this.props.onChange(isValid, baseUnitAmount);
|
this.props.onChange(isValid, baseUnitAmount);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ECSignature } from '0x.js';
|
import { ECSignature } from '@0xproject/types';
|
||||||
import { BigNumber, logUtils } from '@0xproject/utils';
|
import { BigNumber, logUtils } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Paper from 'material-ui/Paper';
|
import Paper from 'material-ui/Paper';
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import {
|
import {
|
||||||
colors,
|
colors,
|
||||||
constants as sharedConstants,
|
constants as sharedConstants,
|
||||||
@@ -8,6 +7,7 @@ import {
|
|||||||
utils as sharedUtils,
|
utils as sharedUtils,
|
||||||
} from '@0xproject/react-shared';
|
} from '@0xproject/react-shared';
|
||||||
import { BigNumber, logUtils } from '@0xproject/utils';
|
import { BigNumber, logUtils } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Dialog from 'material-ui/Dialog';
|
import Dialog from 'material-ui/Dialog';
|
||||||
import Divider from 'material-ui/Divider';
|
import Divider from 'material-ui/Divider';
|
||||||
@@ -111,7 +111,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
|
|||||||
if (nextProps.userEtherBalanceInWei !== this.props.userEtherBalanceInWei) {
|
if (nextProps.userEtherBalanceInWei !== this.props.userEtherBalanceInWei) {
|
||||||
if (this.state.isBalanceSpinnerVisible) {
|
if (this.state.isBalanceSpinnerVisible) {
|
||||||
const receivedAmountInWei = nextProps.userEtherBalanceInWei.minus(this.props.userEtherBalanceInWei);
|
const receivedAmountInWei = nextProps.userEtherBalanceInWei.minus(this.props.userEtherBalanceInWei);
|
||||||
const receivedAmountInEth = ZeroEx.toUnitAmount(receivedAmountInWei, constants.DECIMAL_PLACES_ETH);
|
const receivedAmountInEth = Web3Wrapper.toUnitAmount(receivedAmountInWei, constants.DECIMAL_PLACES_ETH);
|
||||||
const networkName = sharedConstants.NETWORK_NAME_BY_ID[this.props.networkId];
|
const networkName = sharedConstants.NETWORK_NAME_BY_ID[this.props.networkId];
|
||||||
this.props.dispatcher.showFlashMessage(
|
this.props.dispatcher.showFlashMessage(
|
||||||
`Received ${receivedAmountInEth.toString(10)} ${networkName} Ether`,
|
`Received ${receivedAmountInEth.toString(10)} ${networkName} Ether`,
|
||||||
@@ -180,7 +180,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
|
|||||||
token balances in order to execute trades.<br> \
|
token balances in order to execute trades.<br> \
|
||||||
Toggling sets an allowance for the<br> \
|
Toggling sets an allowance for the<br> \
|
||||||
smart contract so you can start trading that token.';
|
smart contract so you can start trading that token.';
|
||||||
const userEtherBalanceInEth = ZeroEx.toUnitAmount(
|
const userEtherBalanceInEth = Web3Wrapper.toUnitAmount(
|
||||||
this.props.userEtherBalanceInWei,
|
this.props.userEtherBalanceInWei,
|
||||||
constants.DECIMAL_PLACES_ETH,
|
constants.DECIMAL_PLACES_ETH,
|
||||||
);
|
);
|
||||||
@@ -445,7 +445,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
private _renderAmount(amount: BigNumber, decimals: number): React.ReactNode {
|
private _renderAmount(amount: BigNumber, decimals: number): React.ReactNode {
|
||||||
const unitAmount = ZeroEx.toUnitAmount(amount, decimals);
|
const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
|
||||||
return unitAmount.toNumber().toFixed(configs.AMOUNT_DISPLAY_PRECSION);
|
return unitAmount.toNumber().toFixed(configs.AMOUNT_DISPLAY_PRECSION);
|
||||||
}
|
}
|
||||||
private _renderTokenName(token: Token): React.ReactNode {
|
private _renderTokenName(token: Token): React.ReactNode {
|
||||||
@@ -508,7 +508,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
|
|||||||
try {
|
try {
|
||||||
await this.props.blockchain.mintTestTokensAsync(token);
|
await this.props.blockchain.mintTestTokensAsync(token);
|
||||||
await this._refetchTokenStateAsync(token.address);
|
await this._refetchTokenStateAsync(token.address);
|
||||||
const amount = ZeroEx.toUnitAmount(constants.MINT_AMOUNT, token.decimals);
|
const amount = Web3Wrapper.toUnitAmount(constants.MINT_AMOUNT, token.decimals);
|
||||||
this.props.dispatcher.showFlashMessage(`Successfully minted ${amount.toString(10)} ${token.symbol}`);
|
this.props.dispatcher.showFlashMessage(`Successfully minted ${amount.toString(10)} ${token.symbol}`);
|
||||||
return true;
|
return true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { colors, EtherscanLinkSuffixes } from '@0xproject/react-shared';
|
import { colors, EtherscanLinkSuffixes } from '@0xproject/react-shared';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import Paper from 'material-ui/Paper';
|
import Paper from 'material-ui/Paper';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
@@ -90,10 +90,16 @@ export class TradeHistoryItem extends React.Component<TradeHistoryItemProps, Tra
|
|||||||
}
|
}
|
||||||
private _renderAmounts(makerToken: Token, takerToken: Token): React.ReactNode {
|
private _renderAmounts(makerToken: Token, takerToken: Token): React.ReactNode {
|
||||||
const fill = this.props.fill;
|
const fill = this.props.fill;
|
||||||
const filledTakerTokenAmountInUnits = ZeroEx.toUnitAmount(fill.filledTakerTokenAmount, takerToken.decimals);
|
const filledTakerTokenAmountInUnits = Web3Wrapper.toUnitAmount(
|
||||||
const filledMakerTokenAmountInUnits = ZeroEx.toUnitAmount(fill.filledMakerTokenAmount, takerToken.decimals);
|
fill.filledTakerTokenAmount,
|
||||||
|
takerToken.decimals,
|
||||||
|
);
|
||||||
|
const filledMakerTokenAmountInUnits = Web3Wrapper.toUnitAmount(
|
||||||
|
fill.filledMakerTokenAmount,
|
||||||
|
takerToken.decimals,
|
||||||
|
);
|
||||||
let exchangeRate = filledTakerTokenAmountInUnits.div(filledMakerTokenAmountInUnits);
|
let exchangeRate = filledTakerTokenAmountInUnits.div(filledMakerTokenAmountInUnits);
|
||||||
const fillMakerTokenAmount = ZeroEx.toBaseUnitAmount(filledMakerTokenAmountInUnits, makerToken.decimals);
|
const fillMakerTokenAmount = Web3Wrapper.toBaseUnitAmount(filledMakerTokenAmountInUnits, makerToken.decimals);
|
||||||
|
|
||||||
let receiveAmount;
|
let receiveAmount;
|
||||||
let receiveToken;
|
let receiveToken;
|
||||||
@@ -160,7 +166,7 @@ export class TradeHistoryItem extends React.Component<TradeHistoryItemProps, Tra
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
private _renderAmount(amount: BigNumber, symbol: string, decimals: number): React.ReactNode {
|
private _renderAmount(amount: BigNumber, symbol: string, decimals: number): React.ReactNode {
|
||||||
const unitAmount = ZeroEx.toUnitAmount(amount, decimals);
|
const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
{unitAmount.toFixed(configs.AMOUNT_DISPLAY_PRECSION)} {symbol}
|
{unitAmount.toFixed(configs.AMOUNT_DISPLAY_PRECSION)} {symbol}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Party } from 'ts/components/ui/party';
|
import { Party } from 'ts/components/ui/party';
|
||||||
@@ -63,7 +63,7 @@ export class VisualOrder extends React.Component<VisualOrderProps, VisualOrderSt
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
private _renderAmount(assetToken: AssetToken, token: Token): React.ReactNode {
|
private _renderAmount(assetToken: AssetToken, token: Token): React.ReactNode {
|
||||||
const unitAmount = ZeroEx.toUnitAmount(assetToken.amount, token.decimals);
|
const unitAmount = Web3Wrapper.toUnitAmount(assetToken.amount, token.decimals);
|
||||||
return (
|
return (
|
||||||
<div style={{ fontSize: 13 }}>
|
<div style={{ fontSize: 13 }}>
|
||||||
{unitAmount.toNumber().toFixed(configs.AMOUNT_DISPLAY_PRECSION)} {token.symbol}
|
{unitAmount.toNumber().toFixed(configs.AMOUNT_DISPLAY_PRECSION)} {token.symbol}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import {
|
import {
|
||||||
constants as sharedConstants,
|
constants as sharedConstants,
|
||||||
EtherscanLinkSuffixes,
|
EtherscanLinkSuffixes,
|
||||||
@@ -6,6 +5,7 @@ import {
|
|||||||
utils as sharedUtils,
|
utils as sharedUtils,
|
||||||
} from '@0xproject/react-shared';
|
} from '@0xproject/react-shared';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import FlatButton from 'material-ui/FlatButton';
|
import FlatButton from 'material-ui/FlatButton';
|
||||||
import FloatingActionButton from 'material-ui/FloatingActionButton';
|
import FloatingActionButton from 'material-ui/FloatingActionButton';
|
||||||
@@ -473,7 +473,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
private _renderAmount(amount: BigNumber, decimals: number, symbol: string): React.ReactNode {
|
private _renderAmount(amount: BigNumber, decimals: number, symbol: string): React.ReactNode {
|
||||||
const unitAmount = ZeroEx.toUnitAmount(amount, decimals);
|
const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
|
||||||
const formattedAmount = unitAmount.toPrecision(TOKEN_AMOUNT_DISPLAY_PRECISION);
|
const formattedAmount = unitAmount.toPrecision(TOKEN_AMOUNT_DISPLAY_PRECISION);
|
||||||
const result = `${formattedAmount} ${symbol}`;
|
const result = `${formattedAmount} ${symbol}`;
|
||||||
return <div style={styles.amountLabel}>{result}</div>;
|
return <div style={styles.amountLabel}>{result}</div>;
|
||||||
@@ -482,7 +482,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
|
|||||||
if (_.isUndefined(price)) {
|
if (_.isUndefined(price)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const unitAmount = ZeroEx.toUnitAmount(amount, decimals);
|
const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
|
||||||
const value = unitAmount.mul(price);
|
const value = unitAmount.mul(price);
|
||||||
const formattedAmount = value.toFixed(USD_DECIMAL_PLACES);
|
const formattedAmount = value.toFixed(USD_DECIMAL_PLACES);
|
||||||
const result = `$${formattedAmount}`;
|
const result = `$${formattedAmount}`;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
|
||||||
import { Styles } from '@0xproject/react-shared';
|
import { Styles } from '@0xproject/react-shared';
|
||||||
import { BigNumber, logUtils } from '@0xproject/utils';
|
import { BigNumber, logUtils } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import FlatButton from 'material-ui/FlatButton';
|
import FlatButton from 'material-ui/FlatButton';
|
||||||
import { ListItem } from 'material-ui/List';
|
import { ListItem } from 'material-ui/List';
|
||||||
@@ -82,7 +82,10 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
const etherBalanceInEth = ZeroEx.toUnitAmount(this.props.userEtherBalanceInWei, constants.DECIMAL_PLACES_ETH);
|
const etherBalanceInEth = Web3Wrapper.toUnitAmount(
|
||||||
|
this.props.userEtherBalanceInWei,
|
||||||
|
constants.DECIMAL_PLACES_ETH,
|
||||||
|
);
|
||||||
const isWrappingEth = this.props.direction === Side.Deposit;
|
const isWrappingEth = this.props.direction === Side.Deposit;
|
||||||
const topLabelText = isWrappingEth ? 'Convert ETH into WETH 1:1' : 'Convert WETH into ETH 1:1';
|
const topLabelText = isWrappingEth ? 'Convert ETH into WETH 1:1' : 'Convert WETH into ETH 1:1';
|
||||||
return (
|
return (
|
||||||
@@ -184,11 +187,11 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther
|
|||||||
const amountToConvert = this.state.currentInputAmount;
|
const amountToConvert = this.state.currentInputAmount;
|
||||||
if (this.props.direction === Side.Deposit) {
|
if (this.props.direction === Side.Deposit) {
|
||||||
await this.props.blockchain.convertEthToWrappedEthTokensAsync(etherToken.address, amountToConvert);
|
await this.props.blockchain.convertEthToWrappedEthTokensAsync(etherToken.address, amountToConvert);
|
||||||
const ethAmount = ZeroEx.toUnitAmount(amountToConvert, constants.DECIMAL_PLACES_ETH);
|
const ethAmount = Web3Wrapper.toUnitAmount(amountToConvert, constants.DECIMAL_PLACES_ETH);
|
||||||
this.props.dispatcher.showFlashMessage(`Successfully wrapped ${ethAmount.toString()} ETH to WETH`);
|
this.props.dispatcher.showFlashMessage(`Successfully wrapped ${ethAmount.toString()} ETH to WETH`);
|
||||||
} else {
|
} else {
|
||||||
await this.props.blockchain.convertWrappedEthTokensToEthAsync(etherToken.address, amountToConvert);
|
await this.props.blockchain.convertWrappedEthTokensToEthAsync(etherToken.address, amountToConvert);
|
||||||
const tokenAmount = ZeroEx.toUnitAmount(amountToConvert, etherToken.decimals);
|
const tokenAmount = Web3Wrapper.toUnitAmount(amountToConvert, etherToken.decimals);
|
||||||
this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount.toString()} WETH to ETH`);
|
this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount.toString()} WETH to ETH`);
|
||||||
}
|
}
|
||||||
await this.props.refetchEthTokenStateAsync();
|
await this.props.refetchEthTokenStateAsync();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ECSignature } from '0x.js';
|
import { ECSignature } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ECSignature } from '0x.js';
|
import { ECSignature } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Dispatch } from 'redux';
|
import { Dispatch } from 'redux';
|
||||||
import { State } from 'ts/redux/reducer';
|
import { State } from 'ts/redux/reducer';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ECSignature, ZeroEx } from '0x.js';
|
import { constants, generatePseudoRandomSalt } from '@0xproject/order-utils';
|
||||||
|
import { ECSignature } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
@@ -65,8 +66,8 @@ const INITIAL_STATE: State = {
|
|||||||
s: '',
|
s: '',
|
||||||
v: 27,
|
v: 27,
|
||||||
},
|
},
|
||||||
orderTakerAddress: ZeroEx.NULL_ADDRESS,
|
orderTakerAddress: constants.NULL_ADDRESS,
|
||||||
orderSalt: ZeroEx.generatePseudoRandomSalt(),
|
orderSalt: generatePseudoRandomSalt(),
|
||||||
nodeVersion: undefined,
|
nodeVersion: undefined,
|
||||||
screenWidth: utils.getScreenWidth(),
|
screenWidth: utils.getScreenWidth(),
|
||||||
shouldBlockchainErrDialogBeOpen: false,
|
shouldBlockchainErrDialogBeOpen: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ECSignature } from '0x.js';
|
import { ECSignature } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const configs = {
|
|||||||
// WARNING: ZRX & WETH MUST always be default trackedTokens
|
// WARNING: ZRX & WETH MUST always be default trackedTokens
|
||||||
DEFAULT_TRACKED_TOKEN_SYMBOLS: ['WETH', 'ZRX'],
|
DEFAULT_TRACKED_TOKEN_SYMBOLS: ['WETH', 'ZRX'],
|
||||||
DOMAIN_STAGING: 'staging-0xproject.s3-website-us-east-1.amazonaws.com',
|
DOMAIN_STAGING: 'staging-0xproject.s3-website-us-east-1.amazonaws.com',
|
||||||
DOMAIN_DOGFOOD: 'dogfood-0xproject.s3-website-us-east-1.amazonaws.com',
|
DOMAIN_DOGFOOD: 'dogfood.0xproject.com',
|
||||||
DOMAIN_DEVELOPMENT: '0xproject.localhost:3572',
|
DOMAIN_DEVELOPMENT: '0xproject.localhost:3572',
|
||||||
DOMAIN_PRODUCTION: '0xproject.com',
|
DOMAIN_PRODUCTION: '0xproject.com',
|
||||||
ENVIRONMENT: isDevelopment ? Environments.DEVELOPMENT : Environments.PRODUCTION,
|
ENVIRONMENT: isDevelopment ? Environments.DEVELOPMENT : Environments.PRODUCTION,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ContractWrappersError, ECSignature, ExchangeContractErrs, ZeroEx } from '0x.js';
|
import { ContractWrappersError, ExchangeContractErrs } from '@0xproject/contract-wrappers';
|
||||||
import { OrderError } from '@0xproject/order-utils';
|
import { OrderError } from '@0xproject/order-utils';
|
||||||
import { constants as sharedConstants, EtherscanLinkSuffixes, Networks } from '@0xproject/react-shared';
|
import { constants as sharedConstants, EtherscanLinkSuffixes, Networks } from '@0xproject/react-shared';
|
||||||
import { Provider } from '@0xproject/types';
|
import { ECSignature, Provider } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import deepEqual = require('deep-equal');
|
import deepEqual = require('deep-equal');
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|||||||
Reference in New Issue
Block a user