ignore generated wrappers and asset-swapper (#591)

This commit is contained in:
eobbad 2022-09-26 16:05:55 -04:00 committed by GitHub
parent c9b1aac8a5
commit b6597df84f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 43 additions and 96 deletions

View File

@ -80,10 +80,8 @@ lib
/contracts/erc1155/build/ /contracts/erc1155/build/
/contracts/extensions/build/ /contracts/extensions/build/
/contracts/exchange-forwarder/build/ /contracts/exchange-forwarder/build/
/packages/asset-swapper/generated-artifacts /packages/asset-swapper/
/packages/asset-swapper/generated-wrappers /packages/contract-wrappers/src/generated-wrappers/
/packages/asset-swapper/test/generated-artifacts
/packages/asset-swapper/test/generated-wrappers
package.json package.json
packages/*/docs packages/*/docs
docs/ docs/

View File

@ -15,7 +15,7 @@ export const artifacts = {
DummyERC20Token: DummyERC20Token as ContractArtifact, DummyERC20Token: DummyERC20Token as ContractArtifact,
ERC20Token: ERC20Token as ContractArtifact, ERC20Token: ERC20Token as ContractArtifact,
WETH9: WETH9 as ContractArtifact, WETH9: WETH9 as ContractArtifact,
ZRXToken: (ZRXToken as any) as ContractArtifact, ZRXToken: ZRXToken as any as ContractArtifact,
DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact, DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact, DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
}; };

View File

@ -28,7 +28,7 @@ export const artifacts = {
MintableERC20Token: MintableERC20Token as ContractArtifact, MintableERC20Token: MintableERC20Token as ContractArtifact,
UnlimitedAllowanceERC20Token: UnlimitedAllowanceERC20Token as ContractArtifact, UnlimitedAllowanceERC20Token: UnlimitedAllowanceERC20Token as ContractArtifact,
WETH9: WETH9 as ContractArtifact, WETH9: WETH9 as ContractArtifact,
ZRXToken: (ZRXToken as any) as ContractArtifact, ZRXToken: ZRXToken as any as ContractArtifact,
IERC20Token: IERC20Token as ContractArtifact, IERC20Token: IERC20Token as ContractArtifact,
IEtherToken: IEtherToken as ContractArtifact, IEtherToken: IEtherToken as ContractArtifact,
IERC20TokenV06: IERC20TokenV06 as ContractArtifact, IERC20TokenV06: IERC20TokenV06 as ContractArtifact,

View File

@ -236,7 +236,7 @@ export const describe = _.assign(mochaDescribe, {
* Like mocha's `describe()`, but sets up a blockchain environment for you. * Like mocha's `describe()`, but sets up a blockchain environment for you.
*/ */
export const blockchainTests: BlockchainContextDefinition = _.assign( export const blockchainTests: BlockchainContextDefinition = _.assign(
function(description: string, callback: BlockchainSuiteCallback): ISuite { function (description: string, callback: BlockchainSuiteCallback): ISuite {
return defineBlockchainSuite(StandardBlockchainTestsEnvironmentSingleton, description, callback, describe); return defineBlockchainSuite(StandardBlockchainTestsEnvironmentSingleton, description, callback, describe);
}, },
{ {
@ -275,7 +275,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
); );
}, },
fork: _.assign( fork: _.assign(
function(description: string, callback: BlockchainSuiteCallback): ISuite | void { function (description: string, callback: BlockchainSuiteCallback): ISuite | void {
return defineBlockchainSuite( return defineBlockchainSuite(
ForkedBlockchainTestsEnvironmentSingleton, ForkedBlockchainTestsEnvironmentSingleton,
description, description,
@ -319,7 +319,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
}, },
), ),
live: _.assign( live: _.assign(
function(description: string, callback: BlockchainSuiteCallback): ISuite | void { function (description: string, callback: BlockchainSuiteCallback): ISuite | void {
return defineBlockchainSuite( return defineBlockchainSuite(
LiveBlockchainTestsEnvironmentSingleton, LiveBlockchainTestsEnvironmentSingleton,
description, description,
@ -355,7 +355,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
}, },
), ),
resets: _.assign( resets: _.assign(
function(description: string, callback: BlockchainSuiteCallback): ISuite { function (description: string, callback: BlockchainSuiteCallback): ISuite {
return defineResetsBlockchainSuite( return defineResetsBlockchainSuite(
StandardBlockchainTestsEnvironmentSingleton, StandardBlockchainTestsEnvironmentSingleton,
description, description,
@ -399,7 +399,7 @@ function defineBlockchainSuite<T>(
callback: BlockchainSuiteCallback, callback: BlockchainSuiteCallback,
describeCall: ContextDefinitionCallback<T>, describeCall: ContextDefinitionCallback<T>,
): T { ): T {
return describeCall(description, function(this: ISuiteCallbackContext): void { return describeCall(description, function (this: ISuiteCallbackContext): void {
callback.call(this, envFactory.create()); callback.call(this, envFactory.create());
}); });
} }
@ -410,7 +410,7 @@ function defineResetsBlockchainSuite<T>(
callback: BlockchainSuiteCallback, callback: BlockchainSuiteCallback,
describeCall: ContextDefinitionCallback<T>, describeCall: ContextDefinitionCallback<T>,
): T { ): T {
return describeCall(description, function(this: ISuiteCallbackContext): void { return describeCall(description, function (this: ISuiteCallbackContext): void {
const env = envFactory.create(); const env = envFactory.create();
beforeEach(async () => env.blockchainLifecycle.startAsync()); beforeEach(async () => env.blockchainLifecycle.startAsync());
afterEach(async () => env.blockchainLifecycle.revertAsync()); afterEach(async () => env.blockchainLifecycle.revertAsync());

View File

@ -40,10 +40,7 @@ export function getRandomPortion(total: Numberish): BigNumber {
export function getRandomFloat(min: Numberish, max: Numberish): BigNumber { export function getRandomFloat(min: Numberish, max: Numberish): BigNumber {
// Generate a really high precision number between [0, 1] // 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)); const r = new BigNumber(crypto.randomBytes(32).toString('hex'), 16).dividedBy(new BigNumber(2).pow(256).minus(1));
return new BigNumber(max) return new BigNumber(max).minus(min).times(r).plus(min);
.minus(min)
.times(r)
.plus(min);
} }
export const FIXED_POINT_BASE = new BigNumber(2).pow(127); 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); const base = 10 ** (precision - maxIntegerDigits);
return n.times(base).integerValue(BigNumber.ROUND_DOWN); return n.times(base).integerValue(BigNumber.ROUND_DOWN);
}; };
return _toInteger(_a) return _toInteger(_a).minus(_toInteger(_b)).abs().toNumber();
.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. * 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 { export function assertIntegerRoughlyEquals(actual: Numberish, expected: Numberish, maxError = 1, msg?: string): void {
const diff = new BigNumber(actual) const diff = new BigNumber(actual).minus(expected).abs().toNumber();
.minus(expected)
.abs()
.toNumber();
if (diff <= maxError) { if (diff <= maxError) {
return; return;
} }

View File

@ -8,10 +8,7 @@ import { BatchMatchOrder, CancelOrder, MatchOrder } from './types';
export const orderUtils = { export const orderUtils = {
getPartialAmountFloor(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber { getPartialAmountFloor(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber {
const partialAmount = numerator const partialAmount = numerator.multipliedBy(target).div(denominator).integerValue(BigNumber.ROUND_FLOOR);
.multipliedBy(target)
.div(denominator)
.integerValue(BigNumber.ROUND_FLOOR);
return partialAmount; return partialAmount;
}, },
createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => { createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => {

View File

@ -97,7 +97,7 @@ blockchainTests('mocha blockchain extensions', env => {
function createHookedObject(obj: any, handler: (name: string) => void, methods: string[]): any { function createHookedObject(obj: any, handler: (name: string) => void, methods: string[]): any {
const hookedMethods = _.map(methods, methodName => { const hookedMethods = _.map(methods, methodName => {
// tslint:disable: only-arrow-functions // tslint:disable: only-arrow-functions
return function(this: any, ...args: any[]): any { return function (this: any, ...args: any[]): any {
handler(methodName); handler(methodName);
return obj[methodName].call(this, ...args); return obj[methodName].call(this, ...args);
}; };

View File

@ -55,7 +55,7 @@ describe('Order hashing', () => {
it('throws a readable error message if taker format is invalid', async () => { it('throws a readable error message if taker format is invalid', async () => {
const orderWithInvalidtakerFormat = { const orderWithInvalidtakerFormat = {
...order, ...order,
takerAddress: (null as any) as string, takerAddress: null as any as string,
}; };
const expectedErrorMessage = `Expected order to conform to schema`; const expectedErrorMessage = `Expected order to conform to schema`;
expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage); expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);

View File

@ -748,15 +748,7 @@ blockchainTests('LibBytes', env => {
const result = await libBytes const result = await libBytes
.publicWriteLength(byteArrayLongerThan32Bytes, newLen, constants.NULL_BYTES) .publicWriteLength(byteArrayLongerThan32Bytes, newLen, constants.NULL_BYTES)
.callAsync(); .callAsync();
expect(result).to.eq( expect(result).to.eq(byteArrayLongerThan32Bytes.slice(0, newLen.multipliedBy(2).plus(2).toNumber()));
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 () => { 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; const byteLen = fromHex(byteArrayLongerThan32Bytes).length;

View File

@ -389,7 +389,8 @@ export const artifacts = {
TestNoEthRecipient: TestNoEthRecipient as ContractArtifact, TestNoEthRecipient: TestNoEthRecipient as ContractArtifact,
TestOrderSignerRegistryWithContractWallet: TestOrderSignerRegistryWithContractWallet as ContractArtifact, TestOrderSignerRegistryWithContractWallet: TestOrderSignerRegistryWithContractWallet as ContractArtifact,
TestPermissionlessTransformerDeployerSuicidal: TestPermissionlessTransformerDeployerSuicidal as ContractArtifact, TestPermissionlessTransformerDeployerSuicidal: TestPermissionlessTransformerDeployerSuicidal as ContractArtifact,
TestPermissionlessTransformerDeployerTransformer: TestPermissionlessTransformerDeployerTransformer as ContractArtifact, TestPermissionlessTransformerDeployerTransformer:
TestPermissionlessTransformerDeployerTransformer as ContractArtifact,
TestPropertyValidator: TestPropertyValidator as ContractArtifact, TestPropertyValidator: TestPropertyValidator as ContractArtifact,
TestRfqOriginRegistration: TestRfqOriginRegistration as ContractArtifact, TestRfqOriginRegistration: TestRfqOriginRegistration as ContractArtifact,
TestSimpleFunctionRegistryFeatureImpl1: TestSimpleFunctionRegistryFeatureImpl1 as ContractArtifact, TestSimpleFunctionRegistryFeatureImpl1: TestSimpleFunctionRegistryFeatureImpl1 as ContractArtifact,

View File

@ -61,15 +61,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
before(async () => { before(async () => {
let owner; let owner;
[ [owner, maker, taker, notMaker, notTaker, contractWalletOwner, contractWalletSigner] =
owner, await env.getAccountAddressesAsync();
maker,
taker,
notMaker,
notTaker,
contractWalletOwner,
contractWalletSigner,
] = await env.getAccountAddressesAsync();
[makerToken, takerToken, wethToken] = await Promise.all( [makerToken, takerToken, wethToken] = await Promise.all(
[...new Array(3)].map(async () => [...new Array(3)].map(async () =>
TestMintableERC20TokenContract.deployFrom0xArtifactAsync( TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
@ -761,11 +754,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
receipt: undefined, receipt: undefined,
...opts, ...opts,
}; };
const { const { makerTokenFilledAmount, takerTokenFilledAmount, takerTokenFeeFilledAmount } =
makerTokenFilledAmount, computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
takerTokenFilledAmount,
takerTokenFeeFilledAmount,
} = computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
const makerBalance = await takerToken.balanceOf(maker).callAsync(); const makerBalance = await takerToken.balanceOf(maker).callAsync();
const takerBalance = await makerToken.balanceOf(taker).callAsync(); const takerBalance = await makerToken.balanceOf(taker).callAsync();
const feeRecipientBalance = await takerToken.balanceOf(order.feeRecipient).callAsync(); const feeRecipientBalance = await takerToken.balanceOf(order.feeRecipient).callAsync();

View File

@ -42,17 +42,8 @@ blockchainTests.resets('OtcOrdersFeature', env => {
// Useful for ETH balance accounting // Useful for ETH balance accounting
const txDefaults = { ...env.txDefaults, gasPrice: 0 }; const txDefaults = { ...env.txDefaults, gasPrice: 0 };
let owner; let owner;
[ [owner, maker, taker, notMaker, notTaker, contractWalletOwner, contractWalletSigner, txOrigin, notTxOrigin] =
owner, await env.getAccountAddressesAsync();
maker,
taker,
notMaker,
notTaker,
contractWalletOwner,
contractWalletSigner,
txOrigin,
notTxOrigin,
] = await env.getAccountAddressesAsync();
[makerToken, takerToken] = await Promise.all( [makerToken, takerToken] = await Promise.all(
[...new Array(2)].map(async () => [...new Array(2)].map(async () =>
TestMintableERC20TokenContract.deployFrom0xArtifactAsync( TestMintableERC20TokenContract.deployFrom0xArtifactAsync(

View File

@ -334,17 +334,13 @@ blockchainTests.resets('FillQuoteTransformer', env => {
async function getBalancesAsync(owner: string): Promise<Balances> { async function getBalancesAsync(owner: string): Promise<Balances> {
const balances = { ...ZERO_BALANCES }; const balances = { ...ZERO_BALANCES };
[ [balances.makerTokenBalance, balances.takerTokensBalance, balances.takerFeeBalance, balances.ethBalance] =
balances.makerTokenBalance, await Promise.all([
balances.takerTokensBalance, makerToken.balanceOf(owner).callAsync(),
balances.takerFeeBalance, takerToken.balanceOf(owner).callAsync(),
balances.ethBalance, takerFeeToken.balanceOf(owner).callAsync(),
] = await Promise.all([ env.web3Wrapper.getBalanceInWeiAsync(owner),
makerToken.balanceOf(owner).callAsync(), ]);
takerToken.balanceOf(owner).callAsync(),
takerFeeToken.balanceOf(owner).callAsync(),
env.web3Wrapper.getBalanceInWeiAsync(owner),
]);
return balances; return balances;
} }
@ -365,11 +361,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
function normalizeFillAmount(raw: BigNumber, balance: BigNumber): BigNumber { function normalizeFillAmount(raw: BigNumber, balance: BigNumber): BigNumber {
if (raw.gte(HIGH_BIT)) { if (raw.gte(HIGH_BIT)) {
return raw return raw.minus(HIGH_BIT).div('1e18').times(balance).integerValue(BigNumber.ROUND_DOWN);
.minus(HIGH_BIT)
.div('1e18')
.times(balance)
.integerValue(BigNumber.ROUND_DOWN);
} }
return raw; return raw;
} }

View File

@ -217,11 +217,8 @@ export class NativeOrdersTestEnvironment {
takerTokenFillAmount: BigNumber = order.takerAmount, takerTokenFillAmount: BigNumber = order.takerAmount,
takerTokenAlreadyFilledAmount: BigNumber = ZERO, takerTokenAlreadyFilledAmount: BigNumber = ZERO,
): IZeroExLimitOrderFilledEventArgs { ): IZeroExLimitOrderFilledEventArgs {
const { const { makerTokenFilledAmount, takerTokenFilledAmount, takerTokenFeeFilledAmount } =
makerTokenFilledAmount, computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
takerTokenFilledAmount,
takerTokenFeeFilledAmount,
} = computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
const protocolFee = order.taker !== NULL_ADDRESS ? ZERO : this.protocolFee; const protocolFee = order.taker !== NULL_ADDRESS ? ZERO : this.protocolFee;
return { return {
takerTokenFilledAmount, takerTokenFilledAmount,

View File

@ -69,7 +69,7 @@
"lcov-result-merger": "^3.0.0", "lcov-result-merger": "^3.0.0",
"lerna": "^3.0.0-beta.25", "lerna": "^3.0.0-beta.25",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",
"prettier": "1.19.1", "prettier": "2.7.1",
"source-map-support": "^0.5.6", "source-map-support": "^0.5.6",
"typescript": "4.6.3", "typescript": "4.6.3",
"wsrun": "^5.2.4" "wsrun": "^5.2.4"

View File

@ -368,9 +368,7 @@ export class OtcOrder extends OrderBase {
public nonceBucket: BigNumber; public nonceBucket: BigNumber;
public nonce: BigNumber; public nonce: BigNumber;
public static parseExpiryAndNonce( public static parseExpiryAndNonce(expiryAndNonce: BigNumber): {
expiryAndNonce: BigNumber,
): {
expiry: BigNumber; expiry: BigNumber;
nonceBucket: BigNumber; nonceBucket: BigNumber;
nonce: BigNumber; nonce: BigNumber;

View File

@ -14140,16 +14140,16 @@ prettier-plugin-solidity@^1.0.0-alpha.4:
solidity-comments-extractor "^0.0.7" solidity-comments-extractor "^0.0.7"
string-width "^4.2.3" string-width "^4.2.3"
prettier@1.19.1, prettier@^1.14.3, prettier@^1.16.3: prettier@2.7.1, prettier@^2.3.1:
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:
version "2.7.1" version "2.7.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== 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: pretty-bytes@^1.0.4:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-1.0.4.tgz#0a22e8210609ad35542f8c8d5d2159aff0751c84" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-1.0.4.tgz#0a22e8210609ad35542f8c8d5d2159aff0751c84"