update abi-gen with new method interfaces (#2325)
* update abi-gen with new method interfaces * wip: get all packages to build * wip: get all packages to build * Fix two contract wrapper calls * Export necessary types part of the contract wrapper public interfaces * Revive and fix wrapper_unit_tests * Remove duplicate type * Fix lib_exchange_rich_error_decoder tests * Fix remaining test failures in contracts-* packages * Prettier fixes * remove transactionHelper * lint and update changelogs * Fix prettier * Revert changes to reference docs * Add back changelog already published and add revert changelog entry * Add missing CHANGELOG entries * Add missing comma * Update mesh-rpc-client dep * Update Mesh RPC logic in @0x/orderbook to v6.0.1-beta * Align package versions
This commit is contained in:
@@ -25,7 +25,7 @@ blockchainTests('LibEIP712ExchangeDomain', env => {
|
||||
version: constants.EIP712_DOMAIN_VERSION,
|
||||
};
|
||||
const expectedDomainHash = ethUtil.bufferToHex(signTypedDataUtils.generateDomainHash(domain));
|
||||
const actualDomainHash = await libEIP712ExchangeDomainContract.EIP712_EXCHANGE_DOMAIN_HASH.callAsync();
|
||||
const actualDomainHash = await libEIP712ExchangeDomainContract.EIP712_EXCHANGE_DOMAIN_HASH().callAsync();
|
||||
expect(actualDomainHash).to.be.equal(expectedDomainHash);
|
||||
});
|
||||
it('should calculate the correct domain hash when verifyingContractAddressIfExists is set to a non-null address', async () => {
|
||||
@@ -46,7 +46,7 @@ blockchainTests('LibEIP712ExchangeDomain', env => {
|
||||
version: constants.EIP712_DOMAIN_VERSION,
|
||||
};
|
||||
const expectedDomainHash = ethUtil.bufferToHex(signTypedDataUtils.generateDomainHash(domain));
|
||||
const actualDomainHash = await libEIP712ExchangeDomainContract.EIP712_EXCHANGE_DOMAIN_HASH.callAsync();
|
||||
const actualDomainHash = await libEIP712ExchangeDomainContract.EIP712_EXCHANGE_DOMAIN_HASH().callAsync();
|
||||
expect(actualDomainHash).to.be.equal(expectedDomainHash);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -109,12 +109,14 @@ blockchainTests('LibFillResults', env => {
|
||||
otherAmount: BigNumber,
|
||||
): Promise<FillResults> {
|
||||
const order = makeOrder(otherAmount, orderTakerAssetAmount, otherAmount, otherAmount);
|
||||
return libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
takerAssetFilledAmount, // Using this so that the gas price is distinct from protocolFeeMultiplier
|
||||
otherAmount,
|
||||
);
|
||||
return libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
takerAssetFilledAmount, // Using this so that the gas price is distinct from protocolFeeMultiplier
|
||||
otherAmount,
|
||||
)
|
||||
.callAsync();
|
||||
}
|
||||
|
||||
testCombinatoriallyWithReferenceFunc(
|
||||
@@ -148,12 +150,14 @@ blockchainTests('LibFillResults', env => {
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
);
|
||||
const actual = await libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
);
|
||||
const actual = await libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync();
|
||||
expect(actual).to.deep.eq(expected);
|
||||
});
|
||||
|
||||
@@ -170,12 +174,14 @@ blockchainTests('LibFillResults', env => {
|
||||
order.makerAssetAmount,
|
||||
);
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -198,12 +204,14 @@ blockchainTests('LibFillResults', env => {
|
||||
order.makerFee,
|
||||
);
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -221,12 +229,14 @@ blockchainTests('LibFillResults', env => {
|
||||
order.takerFee,
|
||||
);
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -238,12 +248,14 @@ blockchainTests('LibFillResults', env => {
|
||||
const takerAssetFilledAmount = ONE_ETHER;
|
||||
const expectedError = new LibMathRevertErrors.DivisionByZeroError();
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -259,12 +271,14 @@ blockchainTests('LibFillResults', env => {
|
||||
order.makerAssetAmount,
|
||||
);
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -286,12 +300,14 @@ blockchainTests('LibFillResults', env => {
|
||||
order.makerFee,
|
||||
);
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -313,12 +329,14 @@ blockchainTests('LibFillResults', env => {
|
||||
order.takerFee,
|
||||
);
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -336,12 +354,9 @@ blockchainTests('LibFillResults', env => {
|
||||
MAX_UINT256,
|
||||
);
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
MAX_UINT256,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(order, takerAssetFilledAmount, MAX_UINT256, DEFAULT_GAS_PRICE)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -363,12 +378,14 @@ blockchainTests('LibFillResults', env => {
|
||||
order.makerFee,
|
||||
);
|
||||
return expect(
|
||||
libsContract.calculateFillResults.callAsync(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
),
|
||||
libsContract
|
||||
.calculateFillResults(
|
||||
order,
|
||||
takerAssetFilledAmount,
|
||||
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
|
||||
DEFAULT_GAS_PRICE,
|
||||
)
|
||||
.callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
});
|
||||
@@ -396,7 +413,7 @@ blockchainTests('LibFillResults', env => {
|
||||
it('matches the output of the reference function', async () => {
|
||||
const [a, b] = DEFAULT_FILL_RESULTS;
|
||||
const expected = addFillResults(a, b);
|
||||
const actual = await libsContract.addFillResults.callAsync(a, b);
|
||||
const actual = await libsContract.addFillResults(a, b).callAsync();
|
||||
expect(actual).to.deep.equal(expected);
|
||||
});
|
||||
|
||||
@@ -408,7 +425,7 @@ blockchainTests('LibFillResults', env => {
|
||||
a.makerAssetFilledAmount,
|
||||
b.makerAssetFilledAmount,
|
||||
);
|
||||
return expect(libsContract.addFillResults.callAsync(a, b)).to.revertWith(expectedError);
|
||||
return expect(libsContract.addFillResults(a, b).callAsync()).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
it('reverts if computing `takerAssetFilledAmount` overflows', async () => {
|
||||
@@ -419,7 +436,7 @@ blockchainTests('LibFillResults', env => {
|
||||
a.takerAssetFilledAmount,
|
||||
b.takerAssetFilledAmount,
|
||||
);
|
||||
return expect(libsContract.addFillResults.callAsync(a, b)).to.revertWith(expectedError);
|
||||
return expect(libsContract.addFillResults(a, b).callAsync()).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
it('reverts if computing `makerFeePaid` overflows', async () => {
|
||||
@@ -430,7 +447,7 @@ blockchainTests('LibFillResults', env => {
|
||||
a.makerFeePaid,
|
||||
b.makerFeePaid,
|
||||
);
|
||||
return expect(libsContract.addFillResults.callAsync(a, b)).to.revertWith(expectedError);
|
||||
return expect(libsContract.addFillResults(a, b).callAsync()).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
it('reverts if computing `takerFeePaid` overflows', async () => {
|
||||
@@ -441,7 +458,7 @@ blockchainTests('LibFillResults', env => {
|
||||
a.takerFeePaid,
|
||||
b.takerFeePaid,
|
||||
);
|
||||
return expect(libsContract.addFillResults.callAsync(a, b)).to.revertWith(expectedError);
|
||||
return expect(libsContract.addFillResults(a, b).callAsync()).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
it('reverts if computing `protocolFeePaid` overflows', async () => {
|
||||
@@ -452,7 +469,7 @@ blockchainTests('LibFillResults', env => {
|
||||
a.protocolFeePaid,
|
||||
b.protocolFeePaid,
|
||||
);
|
||||
return expect(libsContract.addFillResults.callAsync(a, b)).to.revertWith(expectedError);
|
||||
return expect(libsContract.addFillResults(a, b).callAsync()).to.revertWith(expectedError);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -516,16 +533,17 @@ blockchainTests('LibFillResults', env => {
|
||||
gasPrice: BigNumber,
|
||||
from?: string,
|
||||
): Promise<void> {
|
||||
const actualMatchedFillResults = await libsContract.calculateMatchedFillResults.callAsync(
|
||||
leftOrder,
|
||||
rightOrder,
|
||||
leftOrderTakerAssetFilledAmount,
|
||||
rightOrderTakerAssetFilledAmount,
|
||||
protocolFeeMultiplier,
|
||||
gasPrice,
|
||||
false,
|
||||
{ from },
|
||||
);
|
||||
const actualMatchedFillResults = await libsContract
|
||||
.calculateMatchedFillResults(
|
||||
leftOrder,
|
||||
rightOrder,
|
||||
leftOrderTakerAssetFilledAmount,
|
||||
rightOrderTakerAssetFilledAmount,
|
||||
protocolFeeMultiplier,
|
||||
gasPrice,
|
||||
false,
|
||||
)
|
||||
.callAsync({ from });
|
||||
expect(actualMatchedFillResults).to.be.deep.eq(expectedMatchedFillResults);
|
||||
}
|
||||
|
||||
@@ -1187,16 +1205,17 @@ blockchainTests('LibFillResults', env => {
|
||||
gasPrice: BigNumber,
|
||||
from?: string,
|
||||
): Promise<void> {
|
||||
const actualMatchedFillResults = await libsContract.calculateMatchedFillResults.callAsync(
|
||||
leftOrder,
|
||||
rightOrder,
|
||||
leftOrderTakerAssetFilledAmount,
|
||||
rightOrderTakerAssetFilledAmount,
|
||||
protocolFeeMultiplier,
|
||||
gasPrice,
|
||||
true,
|
||||
{ from },
|
||||
);
|
||||
const actualMatchedFillResults = await libsContract
|
||||
.calculateMatchedFillResults(
|
||||
leftOrder,
|
||||
rightOrder,
|
||||
leftOrderTakerAssetFilledAmount,
|
||||
rightOrderTakerAssetFilledAmount,
|
||||
protocolFeeMultiplier,
|
||||
gasPrice,
|
||||
true,
|
||||
)
|
||||
.callAsync({ from });
|
||||
expect(actualMatchedFillResults).to.be.deep.eq(expectedMatchedFillResults);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ blockchainTests('LibMath', env => {
|
||||
|
||||
function createContractTestFunction<T>(name: string): (...args: any[]) => Promise<T> {
|
||||
return async (...args: any[]): Promise<T> => {
|
||||
const method = (libsContract as any)[name] as { callAsync: (...args: any[]) => Promise<T> };
|
||||
return method.callAsync(...args);
|
||||
return (libsContract as any)[name](...args).callAsync;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -64,7 +63,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ONE_ETHER.dividedToIntegerBy(2);
|
||||
const target = ONE_ETHER.times(0.01);
|
||||
const expected = getPartialAmountFloor(numerator, denominator, target);
|
||||
const actual = await libsContract.getPartialAmountFloor.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.getPartialAmountFloor(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
});
|
||||
|
||||
@@ -73,7 +72,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ONE_ETHER.times(1.8);
|
||||
const target = ONE_ETHER;
|
||||
const expected = ONE_ETHER.dividedToIntegerBy(3);
|
||||
const actual = await libsContract.getPartialAmountFloor.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.getPartialAmountFloor(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
});
|
||||
|
||||
@@ -87,7 +86,7 @@ blockchainTests('LibMath', env => {
|
||||
denominator,
|
||||
);
|
||||
return expect(
|
||||
libsContract.getPartialAmountFloor.callAsync(numerator, denominator, target),
|
||||
libsContract.getPartialAmountFloor(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -101,7 +100,7 @@ blockchainTests('LibMath', env => {
|
||||
target,
|
||||
);
|
||||
return expect(
|
||||
libsContract.getPartialAmountFloor.callAsync(numerator, denominator, target),
|
||||
libsContract.getPartialAmountFloor(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
});
|
||||
@@ -123,7 +122,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ONE_ETHER.dividedToIntegerBy(2);
|
||||
const target = ONE_ETHER.times(0.01);
|
||||
const expected = getPartialAmountCeil(numerator, denominator, target);
|
||||
const actual = await libsContract.getPartialAmountCeil.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.getPartialAmountCeil(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
});
|
||||
|
||||
@@ -132,7 +131,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ONE_ETHER.times(1.8);
|
||||
const target = ONE_ETHER;
|
||||
const expected = ONE_ETHER.dividedToIntegerBy(3).plus(1);
|
||||
const actual = await libsContract.getPartialAmountCeil.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.getPartialAmountCeil(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
});
|
||||
|
||||
@@ -147,7 +146,7 @@ blockchainTests('LibMath', env => {
|
||||
new BigNumber(1),
|
||||
);
|
||||
return expect(
|
||||
libsContract.getPartialAmountCeil.callAsync(numerator, denominator, target),
|
||||
libsContract.getPartialAmountCeil(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -161,7 +160,7 @@ blockchainTests('LibMath', env => {
|
||||
target,
|
||||
);
|
||||
return expect(
|
||||
libsContract.getPartialAmountCeil.callAsync(numerator, denominator, target),
|
||||
libsContract.getPartialAmountCeil(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
});
|
||||
@@ -183,7 +182,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ONE_ETHER.dividedToIntegerBy(2);
|
||||
const target = ONE_ETHER.times(0.01);
|
||||
const expected = safeGetPartialAmountFloor(numerator, denominator, target);
|
||||
const actual = await libsContract.safeGetPartialAmountFloor.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.safeGetPartialAmountFloor(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
});
|
||||
|
||||
@@ -192,7 +191,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ONE_ETHER.times(1.8);
|
||||
const target = ONE_ETHER;
|
||||
const expected = ONE_ETHER.dividedToIntegerBy(3);
|
||||
const actual = await libsContract.safeGetPartialAmountFloor.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.safeGetPartialAmountFloor(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
});
|
||||
|
||||
@@ -202,7 +201,7 @@ blockchainTests('LibMath', env => {
|
||||
const target = new BigNumber(333);
|
||||
const expectedError = new LibMathRevertErrors.RoundingError(numerator, denominator, target);
|
||||
return expect(
|
||||
libsContract.safeGetPartialAmountFloor.callAsync(numerator, denominator, target),
|
||||
libsContract.safeGetPartialAmountFloor(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -212,7 +211,7 @@ blockchainTests('LibMath', env => {
|
||||
const target = ONE_ETHER.times(0.01);
|
||||
const expectedError = new LibMathRevertErrors.DivisionByZeroError();
|
||||
return expect(
|
||||
libsContract.safeGetPartialAmountFloor.callAsync(numerator, denominator, target),
|
||||
libsContract.safeGetPartialAmountFloor(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -226,7 +225,7 @@ blockchainTests('LibMath', env => {
|
||||
target,
|
||||
);
|
||||
return expect(
|
||||
libsContract.safeGetPartialAmountFloor.callAsync(numerator, denominator, target),
|
||||
libsContract.safeGetPartialAmountFloor(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
});
|
||||
@@ -248,7 +247,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ONE_ETHER.dividedToIntegerBy(2);
|
||||
const target = ONE_ETHER.times(0.01);
|
||||
const expected = safeGetPartialAmountCeil(numerator, denominator, target);
|
||||
const actual = await libsContract.safeGetPartialAmountCeil.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.safeGetPartialAmountCeil(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
});
|
||||
|
||||
@@ -257,7 +256,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ONE_ETHER.times(1.8);
|
||||
const target = ONE_ETHER;
|
||||
const expected = ONE_ETHER.dividedToIntegerBy(3).plus(1);
|
||||
const actual = await libsContract.safeGetPartialAmountCeil.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.safeGetPartialAmountCeil(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.bignumber.eq(expected);
|
||||
});
|
||||
|
||||
@@ -267,7 +266,7 @@ blockchainTests('LibMath', env => {
|
||||
const target = new BigNumber(333);
|
||||
const expectedError = new LibMathRevertErrors.RoundingError(numerator, denominator, target);
|
||||
return expect(
|
||||
libsContract.safeGetPartialAmountCeil.callAsync(numerator, denominator, target),
|
||||
libsContract.safeGetPartialAmountCeil(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -277,7 +276,7 @@ blockchainTests('LibMath', env => {
|
||||
const target = ONE_ETHER.times(0.01);
|
||||
const expectedError = new LibMathRevertErrors.DivisionByZeroError();
|
||||
return expect(
|
||||
libsContract.safeGetPartialAmountCeil.callAsync(numerator, denominator, target),
|
||||
libsContract.safeGetPartialAmountCeil(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -291,7 +290,7 @@ blockchainTests('LibMath', env => {
|
||||
target,
|
||||
);
|
||||
return expect(
|
||||
libsContract.safeGetPartialAmountCeil.callAsync(numerator, denominator, target),
|
||||
libsContract.safeGetPartialAmountCeil(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
});
|
||||
@@ -313,7 +312,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = new BigNumber(102);
|
||||
const target = new BigNumber(52);
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const actual = await libsContract.isRoundingErrorFloor.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.isRoundingErrorFloor(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.eq(true);
|
||||
});
|
||||
|
||||
@@ -322,7 +321,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = new BigNumber(101);
|
||||
const target = new BigNumber(92);
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const actual = await libsContract.isRoundingErrorFloor.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.isRoundingErrorFloor(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.eq(false);
|
||||
});
|
||||
|
||||
@@ -333,7 +332,7 @@ blockchainTests('LibMath', env => {
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const expected = isRoundingErrorFloor(numerator, denominator, target);
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const actual = await libsContract.isRoundingErrorFloor.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.isRoundingErrorFloor(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.eq(expected);
|
||||
});
|
||||
|
||||
@@ -343,7 +342,7 @@ blockchainTests('LibMath', env => {
|
||||
const target = ONE_ETHER.times(0.01);
|
||||
const expectedError = new LibMathRevertErrors.DivisionByZeroError();
|
||||
return expect(
|
||||
libsContract.isRoundingErrorFloor.callAsync(numerator, denominator, target),
|
||||
libsContract.isRoundingErrorFloor(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
@@ -357,7 +356,7 @@ blockchainTests('LibMath', env => {
|
||||
target,
|
||||
);
|
||||
return expect(
|
||||
libsContract.isRoundingErrorFloor.callAsync(numerator, denominator, target),
|
||||
libsContract.isRoundingErrorFloor(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
});
|
||||
@@ -379,7 +378,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = new BigNumber(101);
|
||||
const target = new BigNumber(92);
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const actual = await libsContract.isRoundingErrorCeil.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.isRoundingErrorCeil(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.eq(true);
|
||||
});
|
||||
|
||||
@@ -388,7 +387,7 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = new BigNumber(102);
|
||||
const target = new BigNumber(52);
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const actual = await libsContract.isRoundingErrorCeil.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.isRoundingErrorCeil(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.eq(false);
|
||||
});
|
||||
|
||||
@@ -399,7 +398,7 @@ blockchainTests('LibMath', env => {
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const expected = isRoundingErrorCeil(numerator, denominator, target);
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const actual = await libsContract.isRoundingErrorCeil.callAsync(numerator, denominator, target);
|
||||
const actual = await libsContract.isRoundingErrorCeil(numerator, denominator, target).callAsync();
|
||||
expect(actual).to.eq(expected);
|
||||
});
|
||||
|
||||
@@ -408,9 +407,9 @@ blockchainTests('LibMath', env => {
|
||||
const denominator = ZERO_AMOUNT;
|
||||
const target = ONE_ETHER.times(0.01);
|
||||
const expectedError = new LibMathRevertErrors.DivisionByZeroError();
|
||||
return expect(libsContract.isRoundingErrorCeil.callAsync(numerator, denominator, target)).to.revertWith(
|
||||
expectedError,
|
||||
);
|
||||
return expect(
|
||||
libsContract.isRoundingErrorCeil(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
it('reverts if `numerator * target` overflows', async () => {
|
||||
@@ -422,9 +421,9 @@ blockchainTests('LibMath', env => {
|
||||
numerator,
|
||||
target,
|
||||
);
|
||||
return expect(libsContract.isRoundingErrorCeil.callAsync(numerator, denominator, target)).to.revertWith(
|
||||
expectedError,
|
||||
);
|
||||
return expect(
|
||||
libsContract.isRoundingErrorCeil(numerator, denominator, target).callAsync(),
|
||||
).to.revertWith(expectedError);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@ blockchainTests('LibOrder', env => {
|
||||
version: constants.EIP712_DOMAIN_VERSION,
|
||||
}),
|
||||
);
|
||||
const actualHash = await libOrderContract.getTypedDataHash.callAsync(order, domainHash);
|
||||
const actualHash = await libOrderContract.getTypedDataHash(order, domainHash).callAsync();
|
||||
expect(actualHash).to.be.eq(expectedHash);
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ blockchainTests('LibOrder', env => {
|
||||
chainId: 1337,
|
||||
}),
|
||||
);
|
||||
const orderHashHex1 = await libOrderContract.getTypedDataHash.callAsync(EMPTY_ORDER, domainHash1);
|
||||
const orderHashHex2 = await libOrderContract.getTypedDataHash.callAsync(EMPTY_ORDER, domainHash2);
|
||||
const orderHashHex1 = await libOrderContract.getTypedDataHash(EMPTY_ORDER, domainHash1).callAsync();
|
||||
const orderHashHex2 = await libOrderContract.getTypedDataHash(EMPTY_ORDER, domainHash2).callAsync();
|
||||
expect(orderHashHex1).to.be.not.equal(orderHashHex2);
|
||||
});
|
||||
});
|
||||
@@ -120,7 +120,7 @@ blockchainTests('LibOrder', env => {
|
||||
async function testGetStructHashAsync(order: Order): Promise<void> {
|
||||
const typedData = eip712Utils.createOrderTypedData(order);
|
||||
const expectedHash = ethUtil.bufferToHex(signTypedDataUtils.generateTypedDataHashWithoutDomain(typedData));
|
||||
const actualHash = await libOrderContract.getStructHash.callAsync(order);
|
||||
const actualHash = await libOrderContract.getStructHash(order).callAsync();
|
||||
expect(actualHash).to.be.eq(expectedHash);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ blockchainTests('LibZeroExTransaction', env => {
|
||||
version: constants.EIP712_DOMAIN_VERSION,
|
||||
}),
|
||||
);
|
||||
const actualHash = await libZeroExTransactionContract.getTypedDataHash.callAsync(transaction, domainHash);
|
||||
const actualHash = await libZeroExTransactionContract.getTypedDataHash(transaction, domainHash).callAsync();
|
||||
expect(actualHash).to.be.eq(expectedHash);
|
||||
}
|
||||
|
||||
@@ -94,14 +94,12 @@ blockchainTests('LibZeroExTransaction', env => {
|
||||
chainId: 1337,
|
||||
}),
|
||||
);
|
||||
const transactionHashHex1 = await libZeroExTransactionContract.getTypedDataHash.callAsync(
|
||||
EMPTY_TRANSACTION,
|
||||
domainHash1,
|
||||
);
|
||||
const transactionHashHex2 = await libZeroExTransactionContract.getTypedDataHash.callAsync(
|
||||
EMPTY_TRANSACTION,
|
||||
domainHash2,
|
||||
);
|
||||
const transactionHashHex1 = await libZeroExTransactionContract
|
||||
.getTypedDataHash(EMPTY_TRANSACTION, domainHash1)
|
||||
.callAsync();
|
||||
const transactionHashHex2 = await libZeroExTransactionContract
|
||||
.getTypedDataHash(EMPTY_TRANSACTION, domainHash2)
|
||||
.callAsync();
|
||||
expect(transactionHashHex1).to.be.not.equal(transactionHashHex2);
|
||||
});
|
||||
});
|
||||
@@ -112,7 +110,7 @@ blockchainTests('LibZeroExTransaction', env => {
|
||||
async function testGetStructHashAsync(transaction: ZeroExTransaction): Promise<void> {
|
||||
const typedData = eip712Utils.createZeroExTransactionTypedData(transaction);
|
||||
const expectedHash = ethUtil.bufferToHex(signTypedDataUtils.generateTypedDataHashWithoutDomain(typedData));
|
||||
const actualHash = await libZeroExTransactionContract.getStructHash.callAsync(transaction);
|
||||
const actualHash = await libZeroExTransactionContract.getStructHash(transaction).callAsync();
|
||||
expect(actualHash).to.be.eq(expectedHash);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user