Remove assetDataUtils everywhere (#2373)
* remove assetDataUtils everywhere * export IAssetDataContract from @0x/contract-wrappers to allow @0x/instant to decode asset data synchronously * export generic function `decodeAssetDataOrThrow` and add ERC20Bridge support * export `hexUtils` from order-utils instead of contracts-test-utils
This commit is contained in:
@@ -3,13 +3,10 @@ import {
|
||||
constants,
|
||||
expect,
|
||||
filterLogsToArguments,
|
||||
hexLeftPad,
|
||||
hexRandom,
|
||||
toHex,
|
||||
verifyEventsFromLogs,
|
||||
} from '@0x/contracts-test-utils';
|
||||
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { BigNumber, hexUtils } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { StakingRevertErrors } from '../../src';
|
||||
@@ -38,7 +35,7 @@ blockchainTests.resets('MixinStakingPool unit tests', env => {
|
||||
});
|
||||
|
||||
function toNextPoolId(lastPoolId: string): string {
|
||||
return hexLeftPad(new BigNumber(lastPoolId.slice(2), 16).plus(1));
|
||||
return hexUtils.leftPad(new BigNumber(lastPoolId.slice(2), 16).plus(1));
|
||||
}
|
||||
|
||||
function randomOperatorShare(): number {
|
||||
@@ -53,7 +50,7 @@ blockchainTests.resets('MixinStakingPool unit tests', env => {
|
||||
|
||||
async function createPoolAsync(opts?: Partial<CreatePoolOpts>): Promise<CreatePoolOpts> {
|
||||
const _opts = {
|
||||
poolId: hexRandom(),
|
||||
poolId: hexUtils.random(),
|
||||
operator,
|
||||
operatorShare: randomOperatorShare(),
|
||||
...opts,
|
||||
@@ -99,7 +96,7 @@ blockchainTests.resets('MixinStakingPool unit tests', env => {
|
||||
});
|
||||
|
||||
it('fails if the next pool ID overflows', async () => {
|
||||
await testContract.setLastPoolId(toHex(constants.MAX_UINT256)).awaitTransactionSuccessAsync();
|
||||
await testContract.setLastPoolId(hexUtils.toHex(constants.MAX_UINT256)).awaitTransactionSuccessAsync();
|
||||
const tx = testContract.createStakingPool(randomOperatorShare(), false).awaitTransactionSuccessAsync();
|
||||
const expectedError = new SafeMathRevertErrors.Uint256BinOpError(
|
||||
SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow,
|
||||
|
||||
Reference in New Issue
Block a user