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,9 +1831,12 @@ 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);
const expectedError = new SafeMathRevertErrors.Uint256UnderflowError(
spenderInitialFungibleBalance,
valuesToTransfer[0],
);
// execute transfer // execute transfer
await expectTransactionFailedAsync( const tx = erc1155ProxyWrapper.transferFromAsync(
erc1155ProxyWrapper.transferFromAsync(
spender, spender,
receiver, receiver,
erc1155Contract.address, erc1155Contract.address,
@ -1842,9 +1845,8 @@ describe('ERC1155Proxy', () => {
valueMultiplier, valueMultiplier,
receiverCallbackData, receiverCallbackData,
authorized, authorized,
),
RevertReason.Uint256Underflow,
); );
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