Move Forwarder test to integrations; update to use new framework

This commit is contained in:
Michael Zhu
2019-10-22 11:47:16 -07:00
parent db9be73fec
commit 3d56c06ff3
16 changed files with 953 additions and 1238 deletions

View File

@@ -3,6 +3,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as crypto from 'crypto';
import { expect } from './chai_setup';
import { constants } from './constants';
import { Numberish } from './types';
/**
@@ -86,3 +87,12 @@ export function toBaseUnitAmount(amount: Numberish): BigNumber {
const baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amountAsBigNumber, decimals);
return baseUnitAmount;
}
/**
* Computes a percentage of `value`, first converting `percentage` to be expressed in 18 digits.
*/
export function getPercentageOfValue(value: Numberish, percentage: Numberish): BigNumber {
const numerator = constants.PERCENTAGE_DENOMINATOR.times(percentage).dividedToIntegerBy(100);
const newValue = numerator.times(value).dividedToIntegerBy(constants.PERCENTAGE_DENOMINATOR);
return newValue;
}