@0x:contracts-staking Addressed review comments

This commit is contained in:
Alex Towle
2019-09-11 16:58:41 -07:00
parent 82afdda256
commit b7f25ee3b6
3 changed files with 98 additions and 141 deletions

View File

@@ -44,6 +44,14 @@ export function hexInvert(n: string | BigNumber | number, size: number = WORD_LE
return ethUtil.bufferToHex(Buffer.from(buf.map(b => ~b)));
}
/**
* Slices off the desired number of bytes from a hex number.
*/
export function hexSlice(n: string | BigNumber | number, size: number): string {
const hex = toHex(n);
return '0x'.concat(toHex(n).slice(size * 2 + 2, hex.length));
}
/**
* Convert a string, a number, or a BigNumber into a hex string.
* Works with negative numbers, as well.

View File

@@ -28,7 +28,7 @@ export { bytes32Values, testCombinatoriallyWithReferenceFunc, uint256Values } fr
export { TransactionFactory } from './transaction_factory';
export { MutatorContractFunction, TransactionHelper } from './transaction_helper';
export { testWithReferenceFuncAsync } from './test_with_reference';
export { hexConcat, hexLeftPad, hexInvert, hexRandom, hexRightPad, toHex } from './hex_utils';
export { hexConcat, hexLeftPad, hexInvert, hexSlice, hexRandom, hexRightPad, toHex } from './hex_utils';
export {
BatchMatchOrder,
ContractName,