Readded Underflow RichErrors to asset-proxy

This commit is contained in:
James Towle 2019-06-06 16:35:59 -07:00 committed by Amir Bandeali
parent 56d5e9c889
commit 666b992c51

View File

@ -17,7 +17,7 @@ import {
import { BlockchainLifecycle } from '@0x/dev-utils'; import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils'; import { assetDataUtils } from '@0x/order-utils';
import { AssetProxyId, RevertReason } from '@0x/types'; import { AssetProxyId, RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils'; import { BigNumber, SafeMathRevertErrors } from '@0x/utils';
import * as chai from 'chai'; import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types'; import { LogWithDecodedArgs } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util'; import * as ethUtil from 'ethereumjs-util';
@ -1831,20 +1831,22 @@ describe('ERC1155Proxy', () => {
// check balances before transfer // check balances before transfer
const expectedInitialBalances = [spenderInitialFungibleBalance, receiverInitialFungibleBalance]; const expectedInitialBalances = [spenderInitialFungibleBalance, receiverInitialFungibleBalance];
await erc1155Wrapper.assertBalancesAsync(tokenHolders, tokensToTransfer, expectedInitialBalances); await erc1155Wrapper.assertBalancesAsync(tokenHolders, tokensToTransfer, expectedInitialBalances);
// execute transfer const expectedError = new SafeMathRevertErrors.Uint256UnderflowError(
await expectTransactionFailedAsync( spenderInitialFungibleBalance,
erc1155ProxyWrapper.transferFromAsync( valuesToTransfer[0],
spender,
receiver,
erc1155Contract.address,
tokensToTransfer,
valuesToTransfer,
valueMultiplier,
receiverCallbackData,
authorized,
),
RevertReason.Uint256Underflow,
); );
// execute transfer
const tx = erc1155ProxyWrapper.transferFromAsync(
spender,
receiver,
erc1155Contract.address,
tokensToTransfer,
valuesToTransfer,
valueMultiplier,
receiverCallbackData,
authorized,
);
expect(tx).to.revertWith(expectedError);
}); });
it('should revert if sender allowance is insufficient', async () => { it('should revert if sender allowance is insufficient', async () => {
// dremove allowance for ERC1155 proxy // dremove allowance for ERC1155 proxy