ignore generated wrappers and asset-swapper (#591)
This commit is contained in:
parent
c9b1aac8a5
commit
b6597df84f
@ -80,10 +80,8 @@ lib
|
||||
/contracts/erc1155/build/
|
||||
/contracts/extensions/build/
|
||||
/contracts/exchange-forwarder/build/
|
||||
/packages/asset-swapper/generated-artifacts
|
||||
/packages/asset-swapper/generated-wrappers
|
||||
/packages/asset-swapper/test/generated-artifacts
|
||||
/packages/asset-swapper/test/generated-wrappers
|
||||
/packages/asset-swapper/
|
||||
/packages/contract-wrappers/src/generated-wrappers/
|
||||
package.json
|
||||
packages/*/docs
|
||||
docs/
|
||||
|
@ -15,7 +15,7 @@ export const artifacts = {
|
||||
DummyERC20Token: DummyERC20Token as ContractArtifact,
|
||||
ERC20Token: ERC20Token as ContractArtifact,
|
||||
WETH9: WETH9 as ContractArtifact,
|
||||
ZRXToken: (ZRXToken as any) as ContractArtifact,
|
||||
ZRXToken: ZRXToken as any as ContractArtifact,
|
||||
DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
|
||||
DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ export const artifacts = {
|
||||
MintableERC20Token: MintableERC20Token as ContractArtifact,
|
||||
UnlimitedAllowanceERC20Token: UnlimitedAllowanceERC20Token as ContractArtifact,
|
||||
WETH9: WETH9 as ContractArtifact,
|
||||
ZRXToken: (ZRXToken as any) as ContractArtifact,
|
||||
ZRXToken: ZRXToken as any as ContractArtifact,
|
||||
IERC20Token: IERC20Token as ContractArtifact,
|
||||
IEtherToken: IEtherToken as ContractArtifact,
|
||||
IERC20TokenV06: IERC20TokenV06 as ContractArtifact,
|
||||
|
@ -236,7 +236,7 @@ export const describe = _.assign(mochaDescribe, {
|
||||
* Like mocha's `describe()`, but sets up a blockchain environment for you.
|
||||
*/
|
||||
export const blockchainTests: BlockchainContextDefinition = _.assign(
|
||||
function(description: string, callback: BlockchainSuiteCallback): ISuite {
|
||||
function (description: string, callback: BlockchainSuiteCallback): ISuite {
|
||||
return defineBlockchainSuite(StandardBlockchainTestsEnvironmentSingleton, description, callback, describe);
|
||||
},
|
||||
{
|
||||
@ -275,7 +275,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
|
||||
);
|
||||
},
|
||||
fork: _.assign(
|
||||
function(description: string, callback: BlockchainSuiteCallback): ISuite | void {
|
||||
function (description: string, callback: BlockchainSuiteCallback): ISuite | void {
|
||||
return defineBlockchainSuite(
|
||||
ForkedBlockchainTestsEnvironmentSingleton,
|
||||
description,
|
||||
@ -319,7 +319,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
|
||||
},
|
||||
),
|
||||
live: _.assign(
|
||||
function(description: string, callback: BlockchainSuiteCallback): ISuite | void {
|
||||
function (description: string, callback: BlockchainSuiteCallback): ISuite | void {
|
||||
return defineBlockchainSuite(
|
||||
LiveBlockchainTestsEnvironmentSingleton,
|
||||
description,
|
||||
@ -355,7 +355,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
|
||||
},
|
||||
),
|
||||
resets: _.assign(
|
||||
function(description: string, callback: BlockchainSuiteCallback): ISuite {
|
||||
function (description: string, callback: BlockchainSuiteCallback): ISuite {
|
||||
return defineResetsBlockchainSuite(
|
||||
StandardBlockchainTestsEnvironmentSingleton,
|
||||
description,
|
||||
@ -399,7 +399,7 @@ function defineBlockchainSuite<T>(
|
||||
callback: BlockchainSuiteCallback,
|
||||
describeCall: ContextDefinitionCallback<T>,
|
||||
): T {
|
||||
return describeCall(description, function(this: ISuiteCallbackContext): void {
|
||||
return describeCall(description, function (this: ISuiteCallbackContext): void {
|
||||
callback.call(this, envFactory.create());
|
||||
});
|
||||
}
|
||||
@ -410,7 +410,7 @@ function defineResetsBlockchainSuite<T>(
|
||||
callback: BlockchainSuiteCallback,
|
||||
describeCall: ContextDefinitionCallback<T>,
|
||||
): T {
|
||||
return describeCall(description, function(this: ISuiteCallbackContext): void {
|
||||
return describeCall(description, function (this: ISuiteCallbackContext): void {
|
||||
const env = envFactory.create();
|
||||
beforeEach(async () => env.blockchainLifecycle.startAsync());
|
||||
afterEach(async () => env.blockchainLifecycle.revertAsync());
|
||||
|
@ -40,10 +40,7 @@ export function getRandomPortion(total: Numberish): BigNumber {
|
||||
export function getRandomFloat(min: Numberish, max: Numberish): BigNumber {
|
||||
// Generate a really high precision number between [0, 1]
|
||||
const r = new BigNumber(crypto.randomBytes(32).toString('hex'), 16).dividedBy(new BigNumber(2).pow(256).minus(1));
|
||||
return new BigNumber(max)
|
||||
.minus(min)
|
||||
.times(r)
|
||||
.plus(min);
|
||||
return new BigNumber(max).minus(min).times(r).plus(min);
|
||||
}
|
||||
|
||||
export const FIXED_POINT_BASE = new BigNumber(2).pow(127);
|
||||
@ -77,10 +74,7 @@ export function getNumericalDivergence(a: Numberish, b: Numberish, precision = 1
|
||||
const base = 10 ** (precision - maxIntegerDigits);
|
||||
return n.times(base).integerValue(BigNumber.ROUND_DOWN);
|
||||
};
|
||||
return _toInteger(_a)
|
||||
.minus(_toInteger(_b))
|
||||
.abs()
|
||||
.toNumber();
|
||||
return _toInteger(_a).minus(_toInteger(_b)).abs().toNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,10 +91,7 @@ export function assertRoughlyEquals(actual: Numberish, expected: Numberish, prec
|
||||
* Asserts that two numbers are equal with up to `maxError` difference between them.
|
||||
*/
|
||||
export function assertIntegerRoughlyEquals(actual: Numberish, expected: Numberish, maxError = 1, msg?: string): void {
|
||||
const diff = new BigNumber(actual)
|
||||
.minus(expected)
|
||||
.abs()
|
||||
.toNumber();
|
||||
const diff = new BigNumber(actual).minus(expected).abs().toNumber();
|
||||
if (diff <= maxError) {
|
||||
return;
|
||||
}
|
||||
|
@ -8,10 +8,7 @@ import { BatchMatchOrder, CancelOrder, MatchOrder } from './types';
|
||||
|
||||
export const orderUtils = {
|
||||
getPartialAmountFloor(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber {
|
||||
const partialAmount = numerator
|
||||
.multipliedBy(target)
|
||||
.div(denominator)
|
||||
.integerValue(BigNumber.ROUND_FLOOR);
|
||||
const partialAmount = numerator.multipliedBy(target).div(denominator).integerValue(BigNumber.ROUND_FLOOR);
|
||||
return partialAmount;
|
||||
},
|
||||
createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => {
|
||||
|
@ -97,7 +97,7 @@ blockchainTests('mocha blockchain extensions', env => {
|
||||
function createHookedObject(obj: any, handler: (name: string) => void, methods: string[]): any {
|
||||
const hookedMethods = _.map(methods, methodName => {
|
||||
// tslint:disable: only-arrow-functions
|
||||
return function(this: any, ...args: any[]): any {
|
||||
return function (this: any, ...args: any[]): any {
|
||||
handler(methodName);
|
||||
return obj[methodName].call(this, ...args);
|
||||
};
|
||||
|
@ -55,7 +55,7 @@ describe('Order hashing', () => {
|
||||
it('throws a readable error message if taker format is invalid', async () => {
|
||||
const orderWithInvalidtakerFormat = {
|
||||
...order,
|
||||
takerAddress: (null as any) as string,
|
||||
takerAddress: null as any as string,
|
||||
};
|
||||
const expectedErrorMessage = `Expected order to conform to schema`;
|
||||
expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);
|
||||
|
@ -748,15 +748,7 @@ blockchainTests('LibBytes', env => {
|
||||
const result = await libBytes
|
||||
.publicWriteLength(byteArrayLongerThan32Bytes, newLen, constants.NULL_BYTES)
|
||||
.callAsync();
|
||||
expect(result).to.eq(
|
||||
byteArrayLongerThan32Bytes.slice(
|
||||
0,
|
||||
newLen
|
||||
.multipliedBy(2)
|
||||
.plus(2)
|
||||
.toNumber(),
|
||||
),
|
||||
);
|
||||
expect(result).to.eq(byteArrayLongerThan32Bytes.slice(0, newLen.multipliedBy(2).plus(2).toNumber()));
|
||||
});
|
||||
it("should right pad with 0's if new length is greater than original and no extra bytes are appended", async () => {
|
||||
const byteLen = fromHex(byteArrayLongerThan32Bytes).length;
|
||||
|
@ -389,7 +389,8 @@ export const artifacts = {
|
||||
TestNoEthRecipient: TestNoEthRecipient as ContractArtifact,
|
||||
TestOrderSignerRegistryWithContractWallet: TestOrderSignerRegistryWithContractWallet as ContractArtifact,
|
||||
TestPermissionlessTransformerDeployerSuicidal: TestPermissionlessTransformerDeployerSuicidal as ContractArtifact,
|
||||
TestPermissionlessTransformerDeployerTransformer: TestPermissionlessTransformerDeployerTransformer as ContractArtifact,
|
||||
TestPermissionlessTransformerDeployerTransformer:
|
||||
TestPermissionlessTransformerDeployerTransformer as ContractArtifact,
|
||||
TestPropertyValidator: TestPropertyValidator as ContractArtifact,
|
||||
TestRfqOriginRegistration: TestRfqOriginRegistration as ContractArtifact,
|
||||
TestSimpleFunctionRegistryFeatureImpl1: TestSimpleFunctionRegistryFeatureImpl1 as ContractArtifact,
|
||||
|
@ -61,15 +61,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
||||
|
||||
before(async () => {
|
||||
let owner;
|
||||
[
|
||||
owner,
|
||||
maker,
|
||||
taker,
|
||||
notMaker,
|
||||
notTaker,
|
||||
contractWalletOwner,
|
||||
contractWalletSigner,
|
||||
] = await env.getAccountAddressesAsync();
|
||||
[owner, maker, taker, notMaker, notTaker, contractWalletOwner, contractWalletSigner] =
|
||||
await env.getAccountAddressesAsync();
|
||||
[makerToken, takerToken, wethToken] = await Promise.all(
|
||||
[...new Array(3)].map(async () =>
|
||||
TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
@ -761,11 +754,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
||||
receipt: undefined,
|
||||
...opts,
|
||||
};
|
||||
const {
|
||||
makerTokenFilledAmount,
|
||||
takerTokenFilledAmount,
|
||||
takerTokenFeeFilledAmount,
|
||||
} = computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
|
||||
const { makerTokenFilledAmount, takerTokenFilledAmount, takerTokenFeeFilledAmount } =
|
||||
computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
|
||||
const makerBalance = await takerToken.balanceOf(maker).callAsync();
|
||||
const takerBalance = await makerToken.balanceOf(taker).callAsync();
|
||||
const feeRecipientBalance = await takerToken.balanceOf(order.feeRecipient).callAsync();
|
||||
|
@ -42,17 +42,8 @@ blockchainTests.resets('OtcOrdersFeature', env => {
|
||||
// Useful for ETH balance accounting
|
||||
const txDefaults = { ...env.txDefaults, gasPrice: 0 };
|
||||
let owner;
|
||||
[
|
||||
owner,
|
||||
maker,
|
||||
taker,
|
||||
notMaker,
|
||||
notTaker,
|
||||
contractWalletOwner,
|
||||
contractWalletSigner,
|
||||
txOrigin,
|
||||
notTxOrigin,
|
||||
] = await env.getAccountAddressesAsync();
|
||||
[owner, maker, taker, notMaker, notTaker, contractWalletOwner, contractWalletSigner, txOrigin, notTxOrigin] =
|
||||
await env.getAccountAddressesAsync();
|
||||
[makerToken, takerToken] = await Promise.all(
|
||||
[...new Array(2)].map(async () =>
|
||||
TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
|
@ -334,17 +334,13 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
|
||||
async function getBalancesAsync(owner: string): Promise<Balances> {
|
||||
const balances = { ...ZERO_BALANCES };
|
||||
[
|
||||
balances.makerTokenBalance,
|
||||
balances.takerTokensBalance,
|
||||
balances.takerFeeBalance,
|
||||
balances.ethBalance,
|
||||
] = await Promise.all([
|
||||
makerToken.balanceOf(owner).callAsync(),
|
||||
takerToken.balanceOf(owner).callAsync(),
|
||||
takerFeeToken.balanceOf(owner).callAsync(),
|
||||
env.web3Wrapper.getBalanceInWeiAsync(owner),
|
||||
]);
|
||||
[balances.makerTokenBalance, balances.takerTokensBalance, balances.takerFeeBalance, balances.ethBalance] =
|
||||
await Promise.all([
|
||||
makerToken.balanceOf(owner).callAsync(),
|
||||
takerToken.balanceOf(owner).callAsync(),
|
||||
takerFeeToken.balanceOf(owner).callAsync(),
|
||||
env.web3Wrapper.getBalanceInWeiAsync(owner),
|
||||
]);
|
||||
return balances;
|
||||
}
|
||||
|
||||
@ -365,11 +361,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
|
||||
function normalizeFillAmount(raw: BigNumber, balance: BigNumber): BigNumber {
|
||||
if (raw.gte(HIGH_BIT)) {
|
||||
return raw
|
||||
.minus(HIGH_BIT)
|
||||
.div('1e18')
|
||||
.times(balance)
|
||||
.integerValue(BigNumber.ROUND_DOWN);
|
||||
return raw.minus(HIGH_BIT).div('1e18').times(balance).integerValue(BigNumber.ROUND_DOWN);
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
@ -217,11 +217,8 @@ export class NativeOrdersTestEnvironment {
|
||||
takerTokenFillAmount: BigNumber = order.takerAmount,
|
||||
takerTokenAlreadyFilledAmount: BigNumber = ZERO,
|
||||
): IZeroExLimitOrderFilledEventArgs {
|
||||
const {
|
||||
makerTokenFilledAmount,
|
||||
takerTokenFilledAmount,
|
||||
takerTokenFeeFilledAmount,
|
||||
} = computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
|
||||
const { makerTokenFilledAmount, takerTokenFilledAmount, takerTokenFeeFilledAmount } =
|
||||
computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
|
||||
const protocolFee = order.taker !== NULL_ADDRESS ? ZERO : this.protocolFee;
|
||||
return {
|
||||
takerTokenFilledAmount,
|
||||
|
@ -69,7 +69,7 @@
|
||||
"lcov-result-merger": "^3.0.0",
|
||||
"lerna": "^3.0.0-beta.25",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"prettier": "1.19.1",
|
||||
"prettier": "2.7.1",
|
||||
"source-map-support": "^0.5.6",
|
||||
"typescript": "4.6.3",
|
||||
"wsrun": "^5.2.4"
|
||||
|
@ -368,9 +368,7 @@ export class OtcOrder extends OrderBase {
|
||||
public nonceBucket: BigNumber;
|
||||
public nonce: BigNumber;
|
||||
|
||||
public static parseExpiryAndNonce(
|
||||
expiryAndNonce: BigNumber,
|
||||
): {
|
||||
public static parseExpiryAndNonce(expiryAndNonce: BigNumber): {
|
||||
expiry: BigNumber;
|
||||
nonceBucket: BigNumber;
|
||||
nonce: BigNumber;
|
||||
|
12
yarn.lock
12
yarn.lock
@ -14140,16 +14140,16 @@ prettier-plugin-solidity@^1.0.0-alpha.4:
|
||||
solidity-comments-extractor "^0.0.7"
|
||||
string-width "^4.2.3"
|
||||
|
||||
prettier@1.19.1, prettier@^1.14.3, prettier@^1.16.3:
|
||||
version "1.19.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
||||
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
|
||||
|
||||
prettier@^2.3.1:
|
||||
prettier@2.7.1, prettier@^2.3.1:
|
||||
version "2.7.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
|
||||
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==
|
||||
|
||||
prettier@^1.14.3, prettier@^1.16.3:
|
||||
version "1.19.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
||||
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
|
||||
|
||||
pretty-bytes@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-1.0.4.tgz#0a22e8210609ad35542f8c8d5d2159aff0751c84"
|
||||
|
Loading…
x
Reference in New Issue
Block a user