aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test/utils')
-rw-r--r--packages/contracts/test/utils/artifacts.ts6
-rw-r--r--packages/contracts/test/utils/erc721_wrapper.ts3
-rw-r--r--packages/contracts/test/utils/exchange_wrapper.ts5
-rw-r--r--packages/contracts/test/utils/fill_order_combinatorial_utils.ts6
-rw-r--r--packages/contracts/test/utils/forwarder_wrapper.ts2
-rw-r--r--packages/contracts/test/utils/log_decoder.ts5
-rw-r--r--packages/contracts/test/utils/multi_sig_wrapper.ts2
7 files changed, 20 insertions, 9 deletions
diff --git a/packages/contracts/test/utils/artifacts.ts b/packages/contracts/test/utils/artifacts.ts
index 1d5728cba..e8a7585ac 100644
--- a/packages/contracts/test/utils/artifacts.ts
+++ b/packages/contracts/test/utils/artifacts.ts
@@ -4,15 +4,18 @@ import * as AssetProxyOwner from '../../artifacts/AssetProxyOwner.json';
import * as DummyERC20Token from '../../artifacts/DummyERC20Token.json';
import * as DummyERC721Receiver from '../../artifacts/DummyERC721Receiver.json';
import * as DummyERC721Token from '../../artifacts/DummyERC721Token.json';
+import * as DummyNoReturnERC20Token from '../../artifacts/DummyNoReturnERC20Token.json';
import * as ERC20Proxy from '../../artifacts/ERC20Proxy.json';
import * as ERC721Proxy from '../../artifacts/ERC721Proxy.json';
import * as Exchange from '../../artifacts/Exchange.json';
import * as ExchangeWrapper from '../../artifacts/ExchangeWrapper.json';
import * as Forwarder from '../../artifacts/Forwarder.json';
import * as IAssetProxy from '../../artifacts/IAssetProxy.json';
+import * as InvalidERC721Receiver from '../../artifacts/InvalidERC721Receiver.json';
import * as MixinAuthorizable from '../../artifacts/MixinAuthorizable.json';
import * as MultiSigWallet from '../../artifacts/MultiSigWallet.json';
import * as MultiSigWalletWithTimeLock from '../../artifacts/MultiSigWalletWithTimeLock.json';
+import * as OrderValidator from '../../artifacts/OrderValidator.json';
import * as TestAssetProxyDispatcher from '../../artifacts/TestAssetProxyDispatcher.json';
import * as TestAssetProxyOwner from '../../artifacts/TestAssetProxyOwner.json';
import * as TestConstants from '../../artifacts/TestConstants.json';
@@ -32,6 +35,7 @@ export const artifacts = {
DummyERC20Token: (DummyERC20Token as any) as ContractArtifact,
DummyERC721Receiver: (DummyERC721Receiver as any) as ContractArtifact,
DummyERC721Token: (DummyERC721Token as any) as ContractArtifact,
+ DummyNoReturnERC20Token: (DummyNoReturnERC20Token as any) as ContractArtifact,
ERC20Proxy: (ERC20Proxy as any) as ContractArtifact,
ERC721Proxy: (ERC721Proxy as any) as ContractArtifact,
Exchange: (Exchange as any) as ContractArtifact,
@@ -39,9 +43,11 @@ export const artifacts = {
EtherToken: (EtherToken as any) as ContractArtifact,
Forwarder: (Forwarder as any) as ContractArtifact,
IAssetProxy: (IAssetProxy as any) as ContractArtifact,
+ InvalidERC721Receiver: (InvalidERC721Receiver as any) as ContractArtifact,
MixinAuthorizable: (MixinAuthorizable as any) as ContractArtifact,
MultiSigWallet: (MultiSigWallet as any) as ContractArtifact,
MultiSigWalletWithTimeLock: (MultiSigWalletWithTimeLock as any) as ContractArtifact,
+ OrderValidator: (OrderValidator as any) as ContractArtifact,
TestAssetProxyOwner: (TestAssetProxyOwner as any) as ContractArtifact,
TestAssetProxyDispatcher: (TestAssetProxyDispatcher as any) as ContractArtifact,
TestConstants: (TestConstants as any) as ContractArtifact,
diff --git a/packages/contracts/test/utils/erc721_wrapper.ts b/packages/contracts/test/utils/erc721_wrapper.ts
index d023b4d02..743d10706 100644
--- a/packages/contracts/test/utils/erc721_wrapper.ts
+++ b/packages/contracts/test/utils/erc721_wrapper.ts
@@ -81,7 +81,8 @@ export class ERC721Wrapper {
}
public async doesTokenExistAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const doesExist = await tokenContract.exists.callAsync(tokenId);
+ const owner = await tokenContract.ownerOf.callAsync(tokenId);
+ const doesExist = owner !== constants.NULL_ADDRESS;
return doesExist;
}
public async approveProxyAsync(tokenAddress: string, tokenId: BigNumber): Promise<void> {
diff --git a/packages/contracts/test/utils/exchange_wrapper.ts b/packages/contracts/test/utils/exchange_wrapper.ts
index d57592d6d..619d43994 100644
--- a/packages/contracts/test/utils/exchange_wrapper.ts
+++ b/packages/contracts/test/utils/exchange_wrapper.ts
@@ -17,7 +17,7 @@ export class ExchangeWrapper {
constructor(exchangeContract: ExchangeContract, provider: Provider) {
this._exchange = exchangeContract;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, this._exchange.address);
+ this._logDecoder = new LogDecoder(this._web3Wrapper);
}
public async fillOrderAsync(
signedOrder: SignedOrder,
@@ -266,4 +266,7 @@ export class ExchangeWrapper {
);
return data;
}
+ public getExchangeAddress(): string {
+ return this._exchange.address;
+ }
}
diff --git a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
index f18ad0dd3..a9318571c 100644
--- a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
+++ b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
@@ -504,7 +504,11 @@ export class FillOrderCombinatorialUtils {
const actFilledTakerAmount = await this.exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash);
expect(actFilledTakerAmount).to.be.bignumber.equal(expFilledTakerAmount, 'filledTakerAmount');
- expect(txReceipt.logs.length).to.be.equal(1, 'logs length');
+ const exchangeLogs = _.filter(
+ txReceipt.logs,
+ txLog => txLog.address === this.exchangeWrapper.getExchangeAddress(),
+ );
+ expect(exchangeLogs.length).to.be.equal(1, 'logs length');
// tslint:disable-next-line:no-unnecessary-type-assertion
const log = txReceipt.logs[0] as LogWithDecodedArgs<ExchangeFillEventArgs>;
expect(log.args.makerAddress).to.be.equal(makerAddress, 'log.args.makerAddress');
diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts
index 5b9a63ddf..de247a878 100644
--- a/packages/contracts/test/utils/forwarder_wrapper.ts
+++ b/packages/contracts/test/utils/forwarder_wrapper.ts
@@ -58,7 +58,7 @@ export class ForwarderWrapper {
constructor(contractInstance: ForwarderContract, provider: Provider) {
this._forwarderContract = contractInstance;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, this._forwarderContract.address);
+ this._logDecoder = new LogDecoder(this._web3Wrapper);
}
public async marketSellOrdersWithEthAsync(
orders: SignedOrder[],
diff --git a/packages/contracts/test/utils/log_decoder.ts b/packages/contracts/test/utils/log_decoder.ts
index 92e9185d8..77211d357 100644
--- a/packages/contracts/test/utils/log_decoder.ts
+++ b/packages/contracts/test/utils/log_decoder.ts
@@ -16,7 +16,6 @@ import { constants } from './constants';
export class LogDecoder {
private readonly _web3Wrapper: Web3Wrapper;
- private readonly _contractAddress: string;
private readonly _abiDecoder: AbiDecoder;
public static wrapLogBigNumbers(log: any): any {
const argNames = _.keys(log.args);
@@ -27,9 +26,8 @@ export class LogDecoder {
}
}
}
- constructor(web3Wrapper: Web3Wrapper, contractAddress: string) {
+ constructor(web3Wrapper: Web3Wrapper) {
this._web3Wrapper = web3Wrapper;
- this._contractAddress = contractAddress;
const abiArrays: AbiDefinition[][] = [];
_.forEach(artifacts, (artifact: ContractArtifact) => {
const compilerOutput = artifact.compilerOutput;
@@ -48,7 +46,6 @@ export class LogDecoder {
}
public async getTxWithDecodedLogsAsync(txHash: string): Promise<TransactionReceiptWithDecodedLogs> {
const tx = await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
- tx.logs = _.filter(tx.logs, log => log.address === this._contractAddress);
tx.logs = _.map(tx.logs, log => this.decodeLogOrThrow(log));
return tx;
}
diff --git a/packages/contracts/test/utils/multi_sig_wrapper.ts b/packages/contracts/test/utils/multi_sig_wrapper.ts
index 8c8055d4a..e0c27b839 100644
--- a/packages/contracts/test/utils/multi_sig_wrapper.ts
+++ b/packages/contracts/test/utils/multi_sig_wrapper.ts
@@ -16,7 +16,7 @@ export class MultiSigWrapper {
constructor(multiSigContract: MultiSigWalletContract, provider: Provider) {
this._multiSig = multiSigContract;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, this._multiSig.address);
+ this._logDecoder = new LogDecoder(this._web3Wrapper);
}
public async submitTransactionAsync(
destination: string,