@0x/contracts-integrations: Fix broken tests.

This commit is contained in:
Lawrence Forman 2020-09-01 17:32:29 -04:00
parent 1cdc6e7184
commit d8844f6970
8 changed files with 39 additions and 21 deletions

View File

@ -558,7 +558,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex,
signedOrder.makerAssetData,
new StringRevertError(RevertReason.TransferFailed).toString(),
new StringRevertError(RevertReason.TransferFailed).encode(),
);
const tx = exchange
.fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature)
@ -587,7 +587,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex,
signedOrder.takerAssetData,
new StringRevertError(RevertReason.TransferFailed).toString(),
new StringRevertError(RevertReason.TransferFailed).encode(),
);
const tx = exchange
.fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature)
@ -616,7 +616,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex,
signedOrder.makerAssetData,
new StringRevertError(RevertReason.InvalidAmount).toString(),
new StringRevertError(RevertReason.InvalidAmount).encode(),
);
const tx = exchange
.fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature)
@ -645,7 +645,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex,
signedOrder.takerAssetData,
new StringRevertError(RevertReason.InvalidAmount).toString(),
new StringRevertError(RevertReason.InvalidAmount).encode(),
);
const tx = exchange
.fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature)
@ -980,7 +980,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex,
assetData,
new StringRevertError(RevertReason.TargetNotEven).toString(),
new StringRevertError(RevertReason.TargetNotEven).encode(),
);
const tx = exchange
.fillOrder(signedOrder, signedOrder.takerAssetAmount, signedOrder.signature)
@ -1015,7 +1015,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex,
assetData,
new StringRevertError(RevertReason.TargetNotEven).toString(),
new StringRevertError(RevertReason.TargetNotEven).encode(),
);
const tx = exchange
.fillOrder(signedOrder, signedOrder.takerAssetAmount, signedOrder.signature)

View File

@ -278,7 +278,7 @@ blockchainTests.resets('Exchange fills dydx orders', env => {
} catch (e) {
assetProxyError = decodeThrownErrorAsRevertError(e).values.errorData;
}
expect(assetProxyError).to.deep.equal(new StringRevertError(expectedAssetProxyError.toString()));
expect(assetProxyError).to.deep.equal(new StringRevertError(expectedAssetProxyError.encode()));
});
});
});

View File

@ -121,7 +121,7 @@ blockchainTests.resets('Transaction <> protocol fee integration tests', env => {
maker.address,
wethless.address,
'0x',
).toString();
).encode();
return new ExchangeRevertErrors.TransactionExecutionError(
transactionHashUtils.getTransactionHashHex(failedTransaction),
nestedError,
@ -252,7 +252,7 @@ blockchainTests.resets('Transaction <> protocol fee integration tests', env => {
.awaitTransactionSuccessAsync({ from: alice.address, value: REFUND_AMOUNT });
const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashUtils.getTransactionHashHex(recursiveTransaction),
protocolFeeError(order, transaction).toString(),
protocolFeeError(order, transaction).encode(),
);
return expect(tx).to.revertWith(expectedError);
});

View File

@ -280,7 +280,7 @@ blockchainTests.resets('Transaction integration tests', env => {
const noReentrancyError = new ExchangeRevertErrors.TransactionInvalidContextError(
transactionHashHex,
transaction.signerAddress,
).toString();
).encode();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
recursiveTransactionHashHex,
noReentrancyError,
@ -330,7 +330,7 @@ blockchainTests.resets('Transaction integration tests', env => {
orderHashUtils.getOrderHashHex(order),
order.makerAddress,
order.signature,
).toString();
).encode();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashHex,
nestedError,
@ -353,7 +353,7 @@ blockchainTests.resets('Transaction integration tests', env => {
ExchangeRevertErrors.ExchangeContextErrorCodes.InvalidMaker,
orderHashUtils.getOrderHashHex(order),
takers[0].address,
).toString();
).encode();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashHex,
nestedError,
@ -403,7 +403,7 @@ blockchainTests.resets('Transaction integration tests', env => {
ExchangeRevertErrors.ExchangeContextErrorCodes.InvalidMaker,
orderHashUtils.getOrderHashHex(orders[0]),
takers[0].address,
).toString();
).encode();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashHex,
nestedError,
@ -771,7 +771,7 @@ blockchainTests.resets('Transaction integration tests', env => {
const nestedError = new ExchangeRevertErrors.OrderStatusError(
orderHashUtils.getOrderHashHex(order),
OrderStatus.Cancelled,
).toString();
).encode();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashUtils.getTransactionHashHex(transaction2),
nestedError,

View File

@ -123,7 +123,7 @@ blockchainTests.resets('Chainlink stop-limit order tests', env => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashUtils.getOrderHashHex(order),
order.makerAssetData,
new StringRevertError('ChainlinkStopLimit/OUT_OF_PRICE_RANGE').toString(),
new StringRevertError('ChainlinkStopLimit/OUT_OF_PRICE_RANGE').encode(),
);
return expect(tx).to.revertWith(expectedError);
});
@ -133,7 +133,7 @@ blockchainTests.resets('Chainlink stop-limit order tests', env => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashUtils.getOrderHashHex(order),
order.makerAssetData,
new StringRevertError('ChainlinkStopLimit/OUT_OF_PRICE_RANGE').toString(),
new StringRevertError('ChainlinkStopLimit/OUT_OF_PRICE_RANGE').encode(),
);
return expect(tx).to.revertWith(expectedError);
});

View File

@ -45,8 +45,12 @@ export async function deployBootstrapFeaturesAsync(
)).address,
ownable:
features.ownable ||
(await OwnableFeatureContract.deployFrom0xArtifactAsync(artifacts.OwnableFeature, provider, txDefaults, artifacts))
.address,
(await OwnableFeatureContract.deployFrom0xArtifactAsync(
artifacts.OwnableFeature,
provider,
txDefaults,
artifacts,
)).address,
};
}

View File

@ -52,7 +52,12 @@ blockchainTests.resets('MetaTransactions feature', env => {
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, {
transformERC20: transformERC20Feature.address,
});
feature = new MetaTransactionsFeatureContract(zeroEx.address, env.provider, { ...env.txDefaults, from: sender }, abis);
feature = new MetaTransactionsFeatureContract(
zeroEx.address,
env.provider,
{ ...env.txDefaults, from: sender },
abis,
);
feeToken = await TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
artifacts.TestMintableERC20Token,
env.provider,

View File

@ -60,7 +60,12 @@ blockchainTests.resets('TransformERC20 feature', env => {
},
{ transformerDeployer },
);
feature = new TransformERC20FeatureContract(zeroEx.address, env.provider, { ...env.txDefaults, from: sender }, abis);
feature = new TransformERC20FeatureContract(
zeroEx.address,
env.provider,
{ ...env.txDefaults, from: sender },
abis,
);
wallet = new FlashWalletContract(await feature.getTransformWallet().callAsync(), env.provider, env.txDefaults);
allowanceTarget = await new ITokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults)
.getAllowanceTarget()
@ -122,7 +127,11 @@ blockchainTests.resets('TransformERC20 feature', env => {
it('owner can set the quote signer with `setQuoteSigner()`', async () => {
const newSigner = randomAddress();
const receipt = await feature.setQuoteSigner(newSigner).awaitTransactionSuccessAsync({ from: owner });
verifyEventsFromLogs(receipt.logs, [{ quoteSigner: newSigner }], TransformERC20FeatureEvents.QuoteSignerUpdated);
verifyEventsFromLogs(
receipt.logs,
[{ quoteSigner: newSigner }],
TransformERC20FeatureEvents.QuoteSignerUpdated,
);
const actualSigner = await feature.getQuoteSigner().callAsync();
expect(actualSigner).to.eq(newSigner);
});