Remove moved RevertErrors
This commit is contained in:
parent
9c42241269
commit
ad8caa2b51
@ -7,7 +7,7 @@ export {
|
|||||||
LibCoordinatorRichErrorsContract,
|
LibCoordinatorRichErrorsContract,
|
||||||
LibEIP712CoordinatorDomainContract,
|
LibEIP712CoordinatorDomainContract,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
export import CoordinatorRevertErrors = require('./revert_errors');
|
export { CoordinatorRevertErrors } from '@0x/utils';
|
||||||
export { CoordinatorServerCancellationResponse } from './client/index';
|
export { CoordinatorServerCancellationResponse } from './client/index';
|
||||||
export { ApprovalFactory } from './approval_factory';
|
export { ApprovalFactory } from './approval_factory';
|
||||||
export { SignedCoordinatorApproval } from './types';
|
export { SignedCoordinatorApproval } from './types';
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
|
|
||||||
export enum SignatureErrorCodes {
|
|
||||||
InvalidLength,
|
|
||||||
Unsupported,
|
|
||||||
Illegal,
|
|
||||||
Invalid,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SignatureError extends RevertError {
|
|
||||||
constructor(errorCode?: SignatureErrorCodes, hash?: string, signature?: string) {
|
|
||||||
super('SignatureError', 'SignatureError(uint8 errorCode, bytes32 hash, bytes signature)', {
|
|
||||||
errorCode,
|
|
||||||
hash,
|
|
||||||
signature,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class InvalidOriginError extends RevertError {
|
|
||||||
constructor(expectedOrigin?: string) {
|
|
||||||
super('InvalidOriginError', 'InvalidOriginError(address expectedOrigin)', { expectedOrigin });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ApprovalExpiredError extends RevertError {
|
|
||||||
constructor(transactionHash?: string, approvalExpirationTime?: BigNumber | number | string) {
|
|
||||||
super('ApprovalExpiredError', 'ApprovalExpiredError(bytes32 transactionHash, uint256 approvalExpirationTime)', {
|
|
||||||
transactionHash,
|
|
||||||
approvalExpirationTime,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class InvalidApprovalSignatureError extends RevertError {
|
|
||||||
constructor(transactionHash?: string, approverAddress?: string) {
|
|
||||||
super(
|
|
||||||
'InvalidApprovalSignatureError',
|
|
||||||
'InvalidApprovalSignatureError(bytes32 transactionHash, address approverAddress)',
|
|
||||||
{ transactionHash, approverAddress },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [SignatureError, InvalidOriginError, ApprovalExpiredError, InvalidApprovalSignatureError];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -12,9 +12,7 @@ import {
|
|||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { LibBytesRevertErrors } from '@0x/contracts-utils';
|
import { LibBytesRevertErrors } from '@0x/contracts-utils';
|
||||||
import { SignatureType, SignedOrder } from '@0x/types';
|
import { SignatureType, SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, CoordinatorRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import CoordinatorRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import { ApprovalFactory } from '../src/approval_factory';
|
import { ApprovalFactory } from '../src/approval_factory';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export { artifacts } from './artifacts';
|
export { artifacts } from './artifacts';
|
||||||
export { ForwarderContract } from './wrappers';
|
export { ForwarderContract } from './wrappers';
|
||||||
export import ForwarderRevertErrors = require('./revert_errors');
|
export { ExchangeForwarderRevertErrors } from '@0x/utils';
|
||||||
export {
|
export {
|
||||||
ContractArtifact,
|
ContractArtifact,
|
||||||
ContractChains,
|
ContractChains,
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
|
|
||||||
export class UnregisteredAssetProxyError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('UnregisteredAssetProxyError', 'UnregisteredAssetProxyError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UnsupportedAssetProxyError extends RevertError {
|
|
||||||
constructor(proxyId?: string) {
|
|
||||||
super('UnsupportedAssetProxyError', 'UnsupportedAssetProxyError(bytes4 proxyId)', { proxyId });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CompleteBuyFailedError extends RevertError {
|
|
||||||
constructor(
|
|
||||||
expectedAssetBuyAmount?: BigNumber | number | string,
|
|
||||||
actualAssetBuyAmount?: BigNumber | number | string,
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
'CompleteBuyFailedError',
|
|
||||||
'CompleteBuyFailedError(uint256 expectedAssetBuyAmount, uint256 actualAssetBuyAmount)',
|
|
||||||
{ expectedAssetBuyAmount, actualAssetBuyAmount },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UnsupportedFeeError extends RevertError {
|
|
||||||
constructor(takerFeeAssetData?: string) {
|
|
||||||
super('UnsupportedFeeError', 'UnsupportedFeeError(bytes takerFeeAssetData)', { takerFeeAssetData });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class FeePercentageTooLargeError extends RevertError {
|
|
||||||
constructor(feePercentage?: BigNumber | number | string) {
|
|
||||||
super('FeePercentageTooLargeError', 'FeePercentageTooLargeError(uint256 feePercentage)', {
|
|
||||||
feePercentage,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class InsufficientEthForFeeError extends RevertError {
|
|
||||||
constructor(ethFeeRequired?: BigNumber | number | string, ethAvailable?: BigNumber | number | string) {
|
|
||||||
super(
|
|
||||||
'InsufficientEthForFeeError',
|
|
||||||
'InsufficientEthForFeeError(uint256 ethFeeRequired, uint256 ethAvailable)',
|
|
||||||
{ ethFeeRequired, ethAvailable },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OverspentWethError extends RevertError {
|
|
||||||
constructor(wethSpent?: BigNumber | number | string, msgValue?: BigNumber | number | string) {
|
|
||||||
super('OverspentWethError', 'OverspentWethError(uint256 wethSpent, uint256 msgValue)', {
|
|
||||||
wethSpent,
|
|
||||||
msgValue,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class DefaultFunctionWethContractOnlyError extends RevertError {
|
|
||||||
constructor(senderAddress?: string) {
|
|
||||||
super('DefaultFunctionWethContractOnlyError', 'DefaultFunctionWethContractOnlyError(address senderAddress)', {
|
|
||||||
senderAddress,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MsgValueCannotEqualZeroError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('MsgValueCannotEqualZeroError', 'MsgValueCannotEqualZeroError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Erc721AmountMustEqualOneError extends RevertError {
|
|
||||||
constructor(amount?: BigNumber | number | string) {
|
|
||||||
super('Erc721AmountMustEqualOneError', 'Erc721AmountMustEqualOneError(uint256 amount)', {
|
|
||||||
amount,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
UnregisteredAssetProxyError,
|
|
||||||
UnsupportedAssetProxyError,
|
|
||||||
CompleteBuyFailedError,
|
|
||||||
UnsupportedFeeError,
|
|
||||||
FeePercentageTooLargeError,
|
|
||||||
InsufficientEthForFeeError,
|
|
||||||
OverspentWethError,
|
|
||||||
DefaultFunctionWethContractOnlyError,
|
|
||||||
MsgValueCannotEqualZeroError,
|
|
||||||
Erc721AmountMustEqualOneError,
|
|
||||||
];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -21,9 +21,7 @@ import {
|
|||||||
randomAddress,
|
randomAddress,
|
||||||
verifyEventsFromLogs,
|
verifyEventsFromLogs,
|
||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, ExchangeForwarderRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import { ForwarderRevertErrors } from '../src';
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestForwarderContract } from './wrappers';
|
import { TestForwarderContract } from './wrappers';
|
||||||
@ -159,7 +157,7 @@ blockchainTests('Supported asset type unit tests', env => {
|
|||||||
const tx = forwarder
|
const tx = forwarder
|
||||||
.transferAssetToSender(erc721AssetData, invalidAmount)
|
.transferAssetToSender(erc721AssetData, invalidAmount)
|
||||||
.awaitTransactionSuccessAsync({ from: receiver });
|
.awaitTransactionSuccessAsync({ from: receiver });
|
||||||
const expectedError = new ForwarderRevertErrors.Erc721AmountMustEqualOneError(invalidAmount);
|
const expectedError = new ExchangeForwarderRevertErrors.Erc721AmountMustEqualOneError(invalidAmount);
|
||||||
return expect(tx).to.revertWith(expectedError);
|
return expect(tx).to.revertWith(expectedError);
|
||||||
});
|
});
|
||||||
it('transfers an ERC20 token given ERC20Bridge assetData', async () => {
|
it('transfers an ERC20 token given ERC20Bridge assetData', async () => {
|
||||||
@ -177,7 +175,9 @@ blockchainTests('Supported asset type unit tests', env => {
|
|||||||
const tx = forwarder
|
const tx = forwarder
|
||||||
.transferAssetToSender(randomBytes, TRANSFER_AMOUNT)
|
.transferAssetToSender(randomBytes, TRANSFER_AMOUNT)
|
||||||
.awaitTransactionSuccessAsync({ from: receiver });
|
.awaitTransactionSuccessAsync({ from: receiver });
|
||||||
const expectedError = new ForwarderRevertErrors.UnsupportedAssetProxyError(hexSlice(randomBytes, 0, 4));
|
const expectedError = new ExchangeForwarderRevertErrors.UnsupportedAssetProxyError(
|
||||||
|
hexSlice(randomBytes, 0, 4),
|
||||||
|
);
|
||||||
return expect(tx).to.revertWith(expectedError);
|
return expect(tx).to.revertWith(expectedError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,7 @@ export {
|
|||||||
LibOrderContract,
|
LibOrderContract,
|
||||||
LibZeroExTransactionContract,
|
LibZeroExTransactionContract,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
export import LibMathRevertErrors = require('./lib_math_revert_errors');
|
export { LibMathRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import * as ReferenceFunctionsToExport from './reference_functions';
|
import * as ReferenceFunctionsToExport from './reference_functions';
|
||||||
export import ReferenceFunctions = ReferenceFunctionsToExport;
|
export import ReferenceFunctions = ReferenceFunctionsToExport;
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
|
|
||||||
export class DivisionByZeroError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('DivisionByZeroError', 'DivisionByZeroError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoundingError extends RevertError {
|
|
||||||
constructor(
|
|
||||||
numerator?: BigNumber | number | string,
|
|
||||||
denominator?: BigNumber | number | string,
|
|
||||||
target?: BigNumber | number | string,
|
|
||||||
) {
|
|
||||||
super('RoundingError', 'RoundingError(uint256 numerator, uint256 denominator, uint256 target)', {
|
|
||||||
numerator,
|
|
||||||
denominator,
|
|
||||||
target,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [DivisionByZeroError, RoundingError];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -1,8 +1,6 @@
|
|||||||
import { ReferenceFunctions } from '@0x/contracts-utils';
|
import { ReferenceFunctions } from '@0x/contracts-utils';
|
||||||
import { FillResults, Order } from '@0x/types';
|
import { FillResults, Order } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, LibMathRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import LibMathRevertErrors = require('./lib_math_revert_errors');
|
|
||||||
|
|
||||||
const { safeAdd, safeSub, safeMul, safeDiv } = ReferenceFunctions;
|
const { safeAdd, safeSub, safeMul, safeDiv } = ReferenceFunctions;
|
||||||
|
|
||||||
|
@ -9,11 +9,10 @@ import {
|
|||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
||||||
import { FillResults, MatchedFillResults, Order } from '@0x/types';
|
import { FillResults, MatchedFillResults, Order } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, LibMathRevertErrors } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import LibMathRevertErrors = require('../src/lib_math_revert_errors');
|
|
||||||
import { addFillResults, calculateFillResults, getPartialAmountFloor } from '../src/reference_functions';
|
import { addFillResults, calculateFillResults, getPartialAmountFloor } from '../src/reference_functions';
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
|
@ -7,9 +7,8 @@ import {
|
|||||||
uint256Values,
|
uint256Values,
|
||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, LibMathRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import LibMathRevertErrors = require('../src/lib_math_revert_errors');
|
|
||||||
import {
|
import {
|
||||||
getPartialAmountCeil,
|
getPartialAmountCeil,
|
||||||
getPartialAmountFloor,
|
getPartialAmountFloor,
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { constants, describe, expect } from '@0x/contracts-test-utils';
|
import { constants, describe, expect } from '@0x/contracts-test-utils';
|
||||||
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, LibMathRevertErrors } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import LibMathRevertErrors = require('../src/lib_math_revert_errors');
|
|
||||||
import {
|
import {
|
||||||
addFillResults,
|
addFillResults,
|
||||||
getPartialAmountCeil,
|
getPartialAmountCeil,
|
||||||
|
@ -15,7 +15,7 @@ export {
|
|||||||
ExchangeProtocolFeeMultiplierEventArgs,
|
ExchangeProtocolFeeMultiplierEventArgs,
|
||||||
ExchangeTransactionExecutionEventArgs,
|
ExchangeTransactionExecutionEventArgs,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
export import ExchangeRevertErrors = require('./revert_errors');
|
export { ExchangeRevertErrors } from '@0x/utils';
|
||||||
export { exchangeDataEncoder } from './exchange_data_encoder';
|
export { exchangeDataEncoder } from './exchange_data_encoder';
|
||||||
export { SignedOrder } from '@0x/types';
|
export { SignedOrder } from '@0x/types';
|
||||||
export { ExchangeFunctionName } from '@0x/contracts-test-utils';
|
export { ExchangeFunctionName } from '@0x/contracts-test-utils';
|
||||||
|
@ -1,287 +0,0 @@
|
|||||||
import { OrderStatus } from '@0x/types';
|
|
||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
|
|
||||||
export enum BatchMatchOrdersErrorCodes {
|
|
||||||
ZeroLeftOrders,
|
|
||||||
ZeroRightOrders,
|
|
||||||
InvalidLengthLeftSignatures,
|
|
||||||
InvalidLengthRightSignatures,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum ExchangeContextErrorCodes {
|
|
||||||
InvalidMaker,
|
|
||||||
InvalidTaker,
|
|
||||||
InvalidSender,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum FillErrorCode {
|
|
||||||
InvalidTakerAmount,
|
|
||||||
TakerOverpay,
|
|
||||||
Overfill,
|
|
||||||
InvalidFillPrice,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum SignatureErrorCode {
|
|
||||||
BadOrderSignature,
|
|
||||||
BadTransactionSignature,
|
|
||||||
InvalidLength,
|
|
||||||
Unsupported,
|
|
||||||
Illegal,
|
|
||||||
InappropriateSignatureType,
|
|
||||||
InvalidSigner,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum AssetProxyDispatchErrorCode {
|
|
||||||
InvalidAssetDataLength,
|
|
||||||
UnknownAssetProxy,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum TransactionErrorCode {
|
|
||||||
AlreadyExecuted,
|
|
||||||
Expired,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum IncompleteFillErrorCode {
|
|
||||||
IncompleteMarketBuyOrders,
|
|
||||||
IncompleteMarketSellOrders,
|
|
||||||
IncompleteFillOrder,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class BatchMatchOrdersError extends RevertError {
|
|
||||||
constructor(error?: BatchMatchOrdersErrorCodes) {
|
|
||||||
super('BatchMatchOrdersError', 'BatchMatchOrdersError(uint8 error)', { error });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SignatureError extends RevertError {
|
|
||||||
constructor(error?: SignatureErrorCode, hash?: string, signer?: string, signature?: string) {
|
|
||||||
super('SignatureError', 'SignatureError(uint8 error, bytes32 hash, address signer, bytes signature)', {
|
|
||||||
error,
|
|
||||||
hash,
|
|
||||||
signer,
|
|
||||||
signature,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SignatureValidatorNotApprovedError extends RevertError {
|
|
||||||
constructor(signer?: string, validator?: string) {
|
|
||||||
super(
|
|
||||||
'SignatureValidatorNotApprovedError',
|
|
||||||
'SignatureValidatorNotApprovedError(address signer, address validator)',
|
|
||||||
{
|
|
||||||
signer,
|
|
||||||
validator,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SignatureWalletError extends RevertError {
|
|
||||||
constructor(hash?: string, wallet?: string, signature?: string, errorData?: string) {
|
|
||||||
super(
|
|
||||||
'SignatureWalletError',
|
|
||||||
'SignatureWalletError(bytes32 hash, address wallet, bytes signature, bytes errorData)',
|
|
||||||
{
|
|
||||||
hash,
|
|
||||||
wallet,
|
|
||||||
signature,
|
|
||||||
errorData,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class EIP1271SignatureError extends RevertError {
|
|
||||||
constructor(verifyingContract?: string, data?: string, signature?: string, errorData?: string) {
|
|
||||||
super(
|
|
||||||
'EIP1271SignatureError',
|
|
||||||
'EIP1271SignatureError(address verifyingContract, bytes data, bytes signature, bytes errorData)',
|
|
||||||
{
|
|
||||||
verifyingContract,
|
|
||||||
data,
|
|
||||||
signature,
|
|
||||||
errorData,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OrderStatusError extends RevertError {
|
|
||||||
constructor(orderHash?: string, status?: OrderStatus) {
|
|
||||||
super('OrderStatusError', 'OrderStatusError(bytes32 orderHash, uint8 status)', { orderHash, status });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class FillError extends RevertError {
|
|
||||||
constructor(error?: FillErrorCode, orderHash?: string) {
|
|
||||||
super('FillError', 'FillError(uint8 error, bytes32 orderHash)', { error, orderHash });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OrderEpochError extends RevertError {
|
|
||||||
constructor(maker?: string, sender?: string, currentEpoch?: BigNumber) {
|
|
||||||
super('OrderEpochError', 'OrderEpochError(address maker, address sender, uint256 currentEpoch)', {
|
|
||||||
maker,
|
|
||||||
sender,
|
|
||||||
currentEpoch,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssetProxyExistsError extends RevertError {
|
|
||||||
constructor(assetProxyId?: string, assetProxy?: string) {
|
|
||||||
super('AssetProxyExistsError', 'AssetProxyExistsError(bytes4 assetProxyId, address assetProxy)', {
|
|
||||||
assetProxyId,
|
|
||||||
assetProxy,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssetProxyDispatchError extends RevertError {
|
|
||||||
constructor(error?: AssetProxyDispatchErrorCode, orderHash?: string, assetData?: string) {
|
|
||||||
super('AssetProxyDispatchError', 'AssetProxyDispatchError(uint8 error, bytes32 orderHash, bytes assetData)', {
|
|
||||||
error,
|
|
||||||
orderHash,
|
|
||||||
assetData,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssetProxyTransferError extends RevertError {
|
|
||||||
constructor(orderHash?: string, assetData?: string, errorData?: string) {
|
|
||||||
super(
|
|
||||||
'AssetProxyTransferError',
|
|
||||||
'AssetProxyTransferError(bytes32 orderHash, bytes assetData, bytes errorData)',
|
|
||||||
{
|
|
||||||
orderHash,
|
|
||||||
assetData,
|
|
||||||
errorData,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class NegativeSpreadError extends RevertError {
|
|
||||||
constructor(leftOrderHash?: string, rightOrderHash?: string) {
|
|
||||||
super('NegativeSpreadError', 'NegativeSpreadError(bytes32 leftOrderHash, bytes32 rightOrderHash)', {
|
|
||||||
leftOrderHash,
|
|
||||||
rightOrderHash,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TransactionError extends RevertError {
|
|
||||||
constructor(error?: TransactionErrorCode, transactionHash?: string) {
|
|
||||||
super('TransactionError', 'TransactionError(uint8 error, bytes32 transactionHash)', { error, transactionHash });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TransactionExecutionError extends RevertError {
|
|
||||||
constructor(transactionHash?: string, errorData?: string) {
|
|
||||||
super('TransactionExecutionError', 'TransactionExecutionError(bytes32 transactionHash, bytes errorData)', {
|
|
||||||
transactionHash,
|
|
||||||
errorData,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TransactionGasPriceError extends RevertError {
|
|
||||||
constructor(transactionHash?: string, actualGasPrice?: BigNumber, requiredGasPrice?: BigNumber) {
|
|
||||||
super(
|
|
||||||
'TransactionGasPriceError',
|
|
||||||
'TransactionGasPriceError(bytes32 transactionHash, uint256 actualGasPrice, uint256 requiredGasPrice)',
|
|
||||||
{
|
|
||||||
transactionHash,
|
|
||||||
actualGasPrice,
|
|
||||||
requiredGasPrice,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TransactionInvalidContextError extends RevertError {
|
|
||||||
constructor(transactionHash?: string, currentContextAddress?: string) {
|
|
||||||
super(
|
|
||||||
'TransactionInvalidContextError',
|
|
||||||
'TransactionInvalidContextError(bytes32 transactionHash, address currentContextAddress)',
|
|
||||||
{
|
|
||||||
transactionHash,
|
|
||||||
currentContextAddress,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class IncompleteFillError extends RevertError {
|
|
||||||
constructor(
|
|
||||||
error?: IncompleteFillErrorCode,
|
|
||||||
expectedAssetFillAmount?: BigNumber,
|
|
||||||
actualAssetFillAmount?: BigNumber,
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
'IncompleteFillError',
|
|
||||||
'IncompleteFillError(uint8 error, uint256 expectedAssetFillAmount, uint256 actualAssetFillAmount)',
|
|
||||||
{
|
|
||||||
error,
|
|
||||||
expectedAssetFillAmount,
|
|
||||||
actualAssetFillAmount,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ExchangeInvalidContextError extends RevertError {
|
|
||||||
constructor(error?: ExchangeContextErrorCodes, orderHash?: string, contextAddress?: string) {
|
|
||||||
super(
|
|
||||||
'ExchangeInvalidContextError',
|
|
||||||
'ExchangeInvalidContextError(uint8 error, bytes32 orderHash, address contextAddress)',
|
|
||||||
{ error, orderHash, contextAddress },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export class PayProtocolFeeError extends RevertError {
|
|
||||||
constructor(
|
|
||||||
orderHash?: string,
|
|
||||||
protocolFee?: BigNumber,
|
|
||||||
makerAddress?: string,
|
|
||||||
takerAddress?: string,
|
|
||||||
errorData?: string,
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
'PayProtocolFeeError',
|
|
||||||
'PayProtocolFeeError(bytes32 orderHash, uint256 protocolFee, address makerAddress, address takerAddress, bytes errorData)',
|
|
||||||
{ orderHash, protocolFee, makerAddress, takerAddress, errorData },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
AssetProxyExistsError,
|
|
||||||
AssetProxyDispatchError,
|
|
||||||
AssetProxyTransferError,
|
|
||||||
BatchMatchOrdersError,
|
|
||||||
EIP1271SignatureError,
|
|
||||||
ExchangeInvalidContextError,
|
|
||||||
FillError,
|
|
||||||
IncompleteFillError,
|
|
||||||
NegativeSpreadError,
|
|
||||||
OrderEpochError,
|
|
||||||
OrderStatusError,
|
|
||||||
PayProtocolFeeError,
|
|
||||||
SignatureError,
|
|
||||||
SignatureValidatorNotApprovedError,
|
|
||||||
SignatureWalletError,
|
|
||||||
TransactionError,
|
|
||||||
TransactionExecutionError,
|
|
||||||
TransactionGasPriceError,
|
|
||||||
TransactionInvalidContextError,
|
|
||||||
];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -19,17 +19,14 @@ import {
|
|||||||
import { OwnableRevertErrors } from '@0x/contracts-utils';
|
import { OwnableRevertErrors } from '@0x/contracts-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { AssetProxyId, RevertReason } from '@0x/types';
|
import { AssetProxyId, RevertReason } from '@0x/types';
|
||||||
import { BigNumber, StringRevertError } from '@0x/utils';
|
import { BigNumber, ExchangeRevertErrors, StringRevertError } from '@0x/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import ExchangeRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestAssetProxyDispatcherAssetProxyRegisteredEventArgs, TestAssetProxyDispatcherContract } from './wrappers';
|
|
||||||
|
|
||||||
import { dependencyArtifacts } from './utils/dependency_artifacts';
|
import { dependencyArtifacts } from './utils/dependency_artifacts';
|
||||||
|
import { TestAssetProxyDispatcherAssetProxyRegisteredEventArgs, TestAssetProxyDispatcherContract } from './wrappers';
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -2,20 +2,17 @@ import { ReferenceFunctions as LibReferenceFunctions } from '@0x/contracts-excha
|
|||||||
import { blockchainTests, constants, expect, hexRandom, orderHashUtils } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, expect, hexRandom, orderHashUtils } from '@0x/contracts-test-utils';
|
||||||
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
||||||
import { Order } from '@0x/types';
|
import { Order } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, ExchangeRevertErrors } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import ExchangeRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
TestExchangeInternalsContract,
|
TestExchangeInternalsContract,
|
||||||
TestExchangeInternalsDispatchTransferFromCalledEventArgs,
|
TestExchangeInternalsDispatchTransferFromCalledEventArgs,
|
||||||
TestExchangeInternalsFillEventArgs,
|
TestExchangeInternalsFillEventArgs,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
|
|
||||||
blockchainTests('Exchange core internal functions', env => {
|
blockchainTests('Exchange core internal functions', env => {
|
||||||
const CHAIN_ID = 1337;
|
const CHAIN_ID = 1337;
|
||||||
const ONE_ETHER = constants.ONE_ETHER;
|
const ONE_ETHER = constants.ONE_ETHER;
|
||||||
|
@ -2,11 +2,9 @@ import { LibMathRevertErrors, ReferenceFunctions as LibReferenceFunctions } from
|
|||||||
import { blockchainTests, constants, expect, hexRandom } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, expect, hexRandom } from '@0x/contracts-test-utils';
|
||||||
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
import { SafeMathRevertErrors } from '@0x/contracts-utils';
|
||||||
import { FillResults, OrderInfo, OrderStatus, SignatureType } from '@0x/types';
|
import { FillResults, OrderInfo, OrderStatus, SignatureType } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, ExchangeRevertErrors } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import ExchangeRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AssetBalances,
|
AssetBalances,
|
||||||
createBadAssetData,
|
createBadAssetData,
|
||||||
|
@ -8,11 +8,9 @@ import {
|
|||||||
randomAddress,
|
randomAddress,
|
||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { generatePseudoRandomSalt } from '@0x/order-utils';
|
import { generatePseudoRandomSalt } from '@0x/order-utils';
|
||||||
import { BigNumber, RevertError } from '@0x/utils';
|
import { BigNumber, ExchangeRevertErrors, RevertError } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import ExchangeRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestLibExchangeRichErrorDecoderContract } from './wrappers';
|
import { TestLibExchangeRichErrorDecoderContract } from './wrappers';
|
||||||
|
|
||||||
|
@ -16,12 +16,10 @@ import {
|
|||||||
transactionHashUtils,
|
transactionHashUtils,
|
||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { SignatureType, SignedOrder, SignedZeroExTransaction } from '@0x/types';
|
import { SignatureType, SignedOrder, SignedZeroExTransaction } from '@0x/types';
|
||||||
import { BigNumber, StringRevertError } from '@0x/utils';
|
import { BigNumber, ExchangeRevertErrors, StringRevertError } from '@0x/utils';
|
||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
|
|
||||||
import ExchangeRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
ExchangeContract,
|
ExchangeContract,
|
||||||
|
@ -15,13 +15,12 @@ import {
|
|||||||
transactionHashUtils,
|
transactionHashUtils,
|
||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { FillResults, OrderStatus } from '@0x/types';
|
import { FillResults, OrderStatus } from '@0x/types';
|
||||||
import { AbiEncoder, BigNumber } from '@0x/utils';
|
import { AbiEncoder, BigNumber, ExchangeRevertErrors } from '@0x/utils';
|
||||||
import { LogWithDecodedArgs, MethodAbi } from 'ethereum-types';
|
import { LogWithDecodedArgs, MethodAbi } from 'ethereum-types';
|
||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { exchangeDataEncoder } from '../src/exchange_data_encoder';
|
import { exchangeDataEncoder } from '../src/exchange_data_encoder';
|
||||||
import ExchangeRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import { artifacts as localArtifacts } from './artifacts';
|
import { artifacts as localArtifacts } from './artifacts';
|
||||||
import { ExchangeWrapper } from './utils/exchange_wrapper';
|
import { ExchangeWrapper } from './utils/exchange_wrapper';
|
||||||
|
@ -7,12 +7,10 @@ import {
|
|||||||
transactionHashUtils,
|
transactionHashUtils,
|
||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { EIP712DomainWithDefaultSchema, ZeroExTransaction } from '@0x/types';
|
import { EIP712DomainWithDefaultSchema, ZeroExTransaction } from '@0x/types';
|
||||||
import { BigNumber, StringRevertError } from '@0x/utils';
|
import { BigNumber, ExchangeRevertErrors, StringRevertError } from '@0x/utils';
|
||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import ExchangeRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestTransactionsContract, TestTransactionsTransactionExecutionEventArgs } from './wrappers';
|
import { TestTransactionsContract, TestTransactionsTransactionExecutionEventArgs } from './wrappers';
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import { LogWithDecodedArgs, TxData } from 'ethereum-types';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import 'make-promises-safe';
|
import 'make-promises-safe';
|
||||||
|
|
||||||
import ExchangeRevertErrors = require('../../src/revert_errors');
|
import { ExchangeRevertErrors } from '../../src';
|
||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
|
|
||||||
|
@ -11,13 +11,11 @@ import {
|
|||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { ReferenceFunctions as UtilReferenceFunctions, SafeMathRevertErrors } from '@0x/contracts-utils';
|
import { ReferenceFunctions as UtilReferenceFunctions, SafeMathRevertErrors } from '@0x/contracts-utils';
|
||||||
import { FillResults, Order } from '@0x/types';
|
import { FillResults, Order } from '@0x/types';
|
||||||
import { AnyRevertError, BigNumber, StringRevertError } from '@0x/utils';
|
import { AnyRevertError, BigNumber, ExchangeRevertErrors, StringRevertError } from '@0x/utils';
|
||||||
import { LogEntry, LogWithDecodedArgs } from 'ethereum-types';
|
import { LogEntry, LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as ethjs from 'ethereumjs-util';
|
import * as ethjs from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import ExchangeRevertErrors = require('../src/revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
TestFillRoundingContract,
|
TestFillRoundingContract,
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
|
|
||||||
export enum ValueErrorCodes {
|
|
||||||
TooSmall,
|
|
||||||
TooLarge,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum BinOpErrorCodes {
|
|
||||||
AdditionOverflow,
|
|
||||||
MultiplicationOverflow,
|
|
||||||
DivisionByZero,
|
|
||||||
DivisionOverflow,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SignedValueError extends RevertError {
|
|
||||||
constructor(error?: ValueErrorCodes, n?: BigNumber | number | string) {
|
|
||||||
super('SignedValueError', 'SignedValueError(uint8 error, int256 n)', {
|
|
||||||
error,
|
|
||||||
n,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UnsignedValueError extends RevertError {
|
|
||||||
constructor(error?: ValueErrorCodes, n?: BigNumber | number | string) {
|
|
||||||
super('UnsignedValueError', 'UnsignedValueError(uint8 error, uint256 n)', {
|
|
||||||
error,
|
|
||||||
n,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class BinOpError extends RevertError {
|
|
||||||
constructor(error?: BinOpErrorCodes, a?: BigNumber | number | string, b?: BigNumber | number | string) {
|
|
||||||
super('BinOpError', 'BinOpError(uint8 error, int256 a, int256 b)', {
|
|
||||||
error,
|
|
||||||
a,
|
|
||||||
b,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [SignedValueError, UnsignedValueError, BinOpError];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -41,8 +41,7 @@ export {
|
|||||||
IStakingEventsRewardsPaidEventArgs,
|
IStakingEventsRewardsPaidEventArgs,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
export { artifacts } from './artifacts';
|
export { artifacts } from './artifacts';
|
||||||
export import FixedMathRevertErrors = require('./fixed_math_revert_errors');
|
export { StakingRevertErrors, FixedMathRevertErrors } from '@0x/utils';
|
||||||
export import StakingRevertErrors = require('./staking_revert_errors');
|
|
||||||
export { constants } from './constants';
|
export { constants } from './constants';
|
||||||
export {
|
export {
|
||||||
StakeInfo,
|
StakeInfo,
|
||||||
|
@ -1,204 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
|
|
||||||
export enum MakerPoolAssignmentErrorCodes {
|
|
||||||
MakerAddressAlreadyRegistered,
|
|
||||||
MakerAddressNotRegistered,
|
|
||||||
MakerAddressNotPendingAdd,
|
|
||||||
PoolIsFull,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum OperatorShareErrorCodes {
|
|
||||||
OperatorShareTooLarge,
|
|
||||||
CanOnlyDecreaseOperatorShare,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum InvalidParamValueErrorCodes {
|
|
||||||
InvalidCobbDouglasAlpha,
|
|
||||||
InvalidRewardDelegatedStakeWeight,
|
|
||||||
InvalidMaximumMakersInPool,
|
|
||||||
InvalidMinimumPoolStake,
|
|
||||||
InvalidEpochDuration,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum InitializationErrorCodes {
|
|
||||||
MixinSchedulerAlreadyInitialized,
|
|
||||||
MixinParamsAlreadyInitialized,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum ExchangeManagerErrorCodes {
|
|
||||||
ExchangeAlreadyRegistered,
|
|
||||||
ExchangeNotRegistered,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OnlyCallableByExchangeError extends RevertError {
|
|
||||||
constructor(senderAddress?: string) {
|
|
||||||
super('OnlyCallableByExchangeError', 'OnlyCallableByExchangeError(address senderAddress)', { senderAddress });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ExchangeManagerError extends RevertError {
|
|
||||||
constructor(error?: ExchangeManagerErrorCodes, senderAddress?: string) {
|
|
||||||
super('ExchangeManagerError', 'ExchangeManagerError(uint8 errorCode, address senderAddress)', {
|
|
||||||
error,
|
|
||||||
senderAddress,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class InsufficientBalanceError extends RevertError {
|
|
||||||
constructor(amount?: BigNumber | number | string, balance?: BigNumber | number | string) {
|
|
||||||
super('InsufficientBalanceError', 'InsufficientBalanceError(uint256 amount, uint256 balance)', {
|
|
||||||
amount,
|
|
||||||
balance,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OnlyCallableByPoolOperatorError extends RevertError {
|
|
||||||
constructor(senderAddress?: string, poolId?: string) {
|
|
||||||
super(
|
|
||||||
'OnlyCallableByPoolOperatorError',
|
|
||||||
'OnlyCallableByPoolOperatorError(address senderAddress, bytes32 poolId)',
|
|
||||||
{ senderAddress, poolId },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MakerPoolAssignmentError extends RevertError {
|
|
||||||
constructor(error?: MakerPoolAssignmentErrorCodes, makerAddress?: string, poolId?: string) {
|
|
||||||
super(
|
|
||||||
'MakerPoolAssignmentError',
|
|
||||||
'MakerPoolAssignmentError(uint8 error, address makerAddress, bytes32 poolId)',
|
|
||||||
{
|
|
||||||
error,
|
|
||||||
makerAddress,
|
|
||||||
poolId,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class BlockTimestampTooLowError extends RevertError {
|
|
||||||
constructor(epochEndTime?: BigNumber | number | string, currentBlockTimestamp?: BigNumber | number | string) {
|
|
||||||
super(
|
|
||||||
'BlockTimestampTooLowError',
|
|
||||||
'BlockTimestampTooLowError(uint256 epochEndTime, uint256 currentBlockTimestamp)',
|
|
||||||
{ epochEndTime, currentBlockTimestamp },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OnlyCallableByStakingContractError extends RevertError {
|
|
||||||
constructor(senderAddress?: string) {
|
|
||||||
super('OnlyCallableByStakingContractError', 'OnlyCallableByStakingContractError(address senderAddress)', {
|
|
||||||
senderAddress,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OnlyCallableIfInCatastrophicFailureError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('OnlyCallableIfInCatastrophicFailureError', 'OnlyCallableIfInCatastrophicFailureError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OnlyCallableIfNotInCatastrophicFailureError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('OnlyCallableIfNotInCatastrophicFailureError', 'OnlyCallableIfNotInCatastrophicFailureError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OperatorShareError extends RevertError {
|
|
||||||
constructor(error?: OperatorShareErrorCodes, poolId?: string, operatorShare?: BigNumber | number | string) {
|
|
||||||
super('OperatorShareError', 'OperatorShareError(uint8 error, bytes32 poolId, uint32 operatorShare)', {
|
|
||||||
error,
|
|
||||||
poolId,
|
|
||||||
operatorShare,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PoolExistenceError extends RevertError {
|
|
||||||
constructor(poolId?: string, alreadyExists?: boolean) {
|
|
||||||
super('PoolExistenceError', 'PoolExistenceError(bytes32 poolId, bool alreadyExists)', {
|
|
||||||
poolId,
|
|
||||||
alreadyExists,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class InvalidParamValueError extends RevertError {
|
|
||||||
constructor(error?: InvalidParamValueErrorCodes) {
|
|
||||||
super('InvalidParamValueError', 'InvalidParamValueError(uint8 error)', {
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class InvalidProtocolFeePaymentError extends RevertError {
|
|
||||||
constructor(
|
|
||||||
expectedProtocolFeePaid?: BigNumber | number | string,
|
|
||||||
actualProtocolFeePaid?: BigNumber | number | string,
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
'InvalidProtocolFeePaymentError',
|
|
||||||
'InvalidProtocolFeePaymentError(uint256 expectedProtocolFeePaid, uint256 actualProtocolFeePaid)',
|
|
||||||
{ expectedProtocolFeePaid, actualProtocolFeePaid },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class InitializationError extends RevertError {
|
|
||||||
constructor(error?: InitializationErrorCodes) {
|
|
||||||
super('InitializationError', 'InitializationError(uint8 error)', { error });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ProxyDestinationCannotBeNilError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('ProxyDestinationCannotBeNilError', 'ProxyDestinationCannotBeNilError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PreviousEpochNotFinalizedError extends RevertError {
|
|
||||||
constructor(closingEpoch?: BigNumber | number | string, unfinalizedPoolsRemaining?: BigNumber | number | string) {
|
|
||||||
super(
|
|
||||||
'PreviousEpochNotFinalizedError',
|
|
||||||
'PreviousEpochNotFinalizedError(uint256 closingEpoch, uint256 unfinalizedPoolsRemaining)',
|
|
||||||
{ closingEpoch, unfinalizedPoolsRemaining },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PoolNotFinalizedError extends RevertError {
|
|
||||||
constructor(poolId: string, epoch: BigNumber | number | string) {
|
|
||||||
super('PoolNotFinalizedError', 'PoolNotFinalizedError(bytes32 poolId, uint256 epoch)', { poolId, epoch });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
BlockTimestampTooLowError,
|
|
||||||
ExchangeManagerError,
|
|
||||||
InitializationError,
|
|
||||||
InsufficientBalanceError,
|
|
||||||
InvalidProtocolFeePaymentError,
|
|
||||||
InvalidParamValueError,
|
|
||||||
MakerPoolAssignmentError,
|
|
||||||
OnlyCallableByExchangeError,
|
|
||||||
OnlyCallableByPoolOperatorError,
|
|
||||||
OnlyCallableByStakingContractError,
|
|
||||||
OnlyCallableIfInCatastrophicFailureError,
|
|
||||||
OnlyCallableIfNotInCatastrophicFailureError,
|
|
||||||
OperatorShareError,
|
|
||||||
PoolExistenceError,
|
|
||||||
PreviousEpochNotFinalizedError,
|
|
||||||
ProxyDestinationCannotBeNilError,
|
|
||||||
PoolNotFinalizedError,
|
|
||||||
];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -1,9 +1,8 @@
|
|||||||
import { blockchainTests, constants, expect, filterLogsToArguments } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, expect, filterLogsToArguments } from '@0x/contracts-test-utils';
|
||||||
import { AuthorizableRevertErrors } from '@0x/contracts-utils';
|
import { AuthorizableRevertErrors } from '@0x/contracts-utils';
|
||||||
import { BigNumber, StringRevertError } from '@0x/utils';
|
import { BigNumber, StakingRevertErrors, StringRevertError } from '@0x/utils';
|
||||||
|
|
||||||
import { constants as stakingConstants } from '../src/constants';
|
import { constants as stakingConstants } from '../src/constants';
|
||||||
import StakingRevertErrors = require('../src/staking_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
||||||
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
|
||||||
|
import { StakingRevertErrors } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { constants as stakingConstants } from '../src/constants';
|
import { constants as stakingConstants } from '../src/constants';
|
||||||
import StakingRevertErrors = require('../src/staking_revert_errors');
|
|
||||||
|
|
||||||
import { MakerActor } from './actors/maker_actor';
|
import { MakerActor } from './actors/maker_actor';
|
||||||
import { PoolOperatorActor } from './actors/pool_operator_actor';
|
import { PoolOperatorActor } from './actors/pool_operator_actor';
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
||||||
import { blockchainTests, constants, describe, expect, shortZip } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, describe, expect, shortZip } from '@0x/contracts-test-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, StakingRevertErrors } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import StakingRevertErrors = require('../src/staking_revert_errors');
|
|
||||||
import { DelegatorsByPoolId, OperatorByPoolId, StakeInfo, StakeStatus } from '../src/types';
|
import { DelegatorsByPoolId, OperatorByPoolId, StakeInfo, StakeStatus } from '../src/types';
|
||||||
|
|
||||||
import { FinalizerActor } from './actors/finalizer_actor';
|
import { FinalizerActor } from './actors/finalizer_actor';
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
||||||
import { blockchainTests, describe } from '@0x/contracts-test-utils';
|
import { blockchainTests, describe } from '@0x/contracts-test-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, StakingRevertErrors } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import StakingRevertErrors = require('../src/staking_revert_errors');
|
|
||||||
import { StakeInfo, StakeStatus } from '../src/types';
|
import { StakeInfo, StakeStatus } from '../src/types';
|
||||||
|
|
||||||
import { StakerActor } from './actors/staker_actor';
|
import { StakerActor } from './actors/staker_actor';
|
||||||
|
@ -2,7 +2,7 @@ import { blockchainTests, expect } from '@0x/contracts-test-utils';
|
|||||||
import { AuthorizableRevertErrors } from '@0x/contracts-utils';
|
import { AuthorizableRevertErrors } from '@0x/contracts-utils';
|
||||||
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||||
|
|
||||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
import { StakingRevertErrors } from '../../src';
|
||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
import {
|
import {
|
||||||
|
@ -11,8 +11,8 @@ import { BigNumber } from '@0x/utils';
|
|||||||
import { LogEntry } from 'ethereum-types';
|
import { LogEntry } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { StakingRevertErrors } from '../../src';
|
||||||
import { constants as stakingConstants } from '../../src/constants';
|
import { constants as stakingConstants } from '../../src/constants';
|
||||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
import { assertIntegerRoughlyEquals, getRandomInteger, toBaseUnitAmount } from '../utils/number_utils';
|
import { assertIntegerRoughlyEquals, getRandomInteger, toBaseUnitAmount } from '../utils/number_utils';
|
||||||
|
@ -3,7 +3,7 @@ import { BigNumber } from '@0x/utils';
|
|||||||
import { Decimal } from 'decimal.js';
|
import { Decimal } from 'decimal.js';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import FixedMathRevertErrors = require('../../src/fixed_math_revert_errors');
|
import { FixedMathRevertErrors } from '../../src';
|
||||||
import { assertRoughlyEquals, fromFixed, toDecimal, toFixed } from '../utils/number_utils';
|
import { assertRoughlyEquals, fromFixed, toDecimal, toFixed } from '../utils/number_utils';
|
||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
|
@ -2,8 +2,8 @@ import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/co
|
|||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
|
|
||||||
|
import { StakingRevertErrors } from '../../src';
|
||||||
import { constants as stakingConstants } from '../../src/constants';
|
import { constants as stakingConstants } from '../../src/constants';
|
||||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
import {
|
import {
|
||||||
|
@ -11,7 +11,7 @@ import { BigNumber } from '@0x/utils';
|
|||||||
import { LogEntry } from 'ethereum-types';
|
import { LogEntry } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
import { StakingRevertErrors } from '../../src';
|
||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
import {
|
import {
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
import { StakingRevertErrors } from '../../src';
|
||||||
import { StakeStatus } from '../../src/types';
|
import { StakeStatus } from '../../src/types';
|
||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
|
@ -11,8 +11,8 @@ import {
|
|||||||
TestStakingProxyUnitContract,
|
TestStakingProxyUnitContract,
|
||||||
} from '../wrappers';
|
} from '../wrappers';
|
||||||
|
|
||||||
|
import { StakingRevertErrors } from '../../src';
|
||||||
import { constants as stakingConstants } from '../../src/constants';
|
import { constants as stakingConstants } from '../../src/constants';
|
||||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
|
||||||
|
|
||||||
blockchainTests.resets('StakingProxy unit tests', env => {
|
blockchainTests.resets('StakingProxy unit tests', env => {
|
||||||
const testString = 'Hello, World!';
|
const testString = 'Hello, World!';
|
||||||
|
@ -13,8 +13,8 @@ import { RevertReason } from '@0x/types';
|
|||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||||
|
|
||||||
|
import { StakingRevertErrors } from '../../src';
|
||||||
import { constants as stakingConstants } from '../../src/constants';
|
import { constants as stakingConstants } from '../../src/constants';
|
||||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
import {
|
import {
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
export class AuthorizedAddressMismatchError extends RevertError {
|
|
||||||
constructor(authorized?: string, target?: string) {
|
|
||||||
super('AuthorizedAddressMismatchError', 'AuthorizedAddressMismatchError(address authorized, address target)', {
|
|
||||||
authorized,
|
|
||||||
target,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class IndexOutOfBoundsError extends RevertError {
|
|
||||||
constructor(index?: BigNumber, len?: BigNumber) {
|
|
||||||
super('IndexOutOfBoundsError', 'IndexOutOfBoundsError(uint256 index, uint256 len)', { index, len });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SenderNotAuthorizedError extends RevertError {
|
|
||||||
constructor(sender?: string) {
|
|
||||||
super('SenderNotAuthorizedError', 'SenderNotAuthorizedError(address sender)', { sender });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TargetAlreadyAuthorizedError extends RevertError {
|
|
||||||
constructor(target?: string) {
|
|
||||||
super('TargetAlreadyAuthorizedError', 'TargetAlreadyAuthorizedError(address target)', { target });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TargetNotAuthorizedError extends RevertError {
|
|
||||||
constructor(target?: string) {
|
|
||||||
super('TargetNotAuthorizedError', 'TargetNotAuthorizedError(address target)', { target });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ZeroCantBeAuthorizedError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('ZeroCantBeAuthorizedError', 'ZeroCantBeAuthorizedError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
AuthorizedAddressMismatchError,
|
|
||||||
IndexOutOfBoundsError,
|
|
||||||
SenderNotAuthorizedError,
|
|
||||||
TargetAlreadyAuthorizedError,
|
|
||||||
TargetNotAuthorizedError,
|
|
||||||
ZeroCantBeAuthorizedError,
|
|
||||||
];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -4,9 +4,11 @@ export * from './wrappers';
|
|||||||
import * as ReferenceFunctionsToExport from './reference_functions';
|
import * as ReferenceFunctionsToExport from './reference_functions';
|
||||||
export import ReferenceFunctions = ReferenceFunctionsToExport;
|
export import ReferenceFunctions = ReferenceFunctionsToExport;
|
||||||
|
|
||||||
export import AuthorizableRevertErrors = require('./authorizable_revert_errors');
|
export {
|
||||||
export import LibAddressArrayRevertErrors = require('./lib_address_array_revert_errors');
|
AuthorizableRevertErrors,
|
||||||
export import LibBytesRevertErrors = require('./lib_bytes_revert_errors');
|
LibAddressArrayRevertErrors,
|
||||||
export import OwnableRevertErrors = require('./ownable_revert_errors');
|
LibBytesRevertErrors,
|
||||||
export import ReentrancyGuardRevertErrors = require('./reentrancy_guard_revert_errors');
|
OwnableRevertErrors,
|
||||||
export import SafeMathRevertErrors = require('./safe_math_revert_errors');
|
ReentrancyGuardRevertErrors,
|
||||||
|
SafeMathRevertErrors,
|
||||||
|
} from '@0x/utils';
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
export class MismanagedMemoryError extends RevertError {
|
|
||||||
constructor(freeMemPtr?: BigNumber, addressArrayEndPtr?: BigNumber) {
|
|
||||||
super('MismanagedMemoryError', 'MismanagedMemoryError(uint256 freeMemPtr, uint256 addressArrayEndPtr)', {
|
|
||||||
freeMemPtr,
|
|
||||||
addressArrayEndPtr,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register the MismanagedMemoryError type
|
|
||||||
RevertError.registerType(MismanagedMemoryError);
|
|
@ -1,25 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
export enum InvalidByteOperationErrorCodes {
|
|
||||||
FromLessThanOrEqualsToRequired,
|
|
||||||
ToLessThanOrEqualsLengthRequired,
|
|
||||||
LengthGreaterThanZeroRequired,
|
|
||||||
LengthGreaterThanOrEqualsFourRequired,
|
|
||||||
LengthGreaterThanOrEqualsTwentyRequired,
|
|
||||||
LengthGreaterThanOrEqualsThirtyTwoRequired,
|
|
||||||
LengthGreaterThanOrEqualsNestedBytesLengthRequired,
|
|
||||||
DestinationLengthGreaterThanOrEqualSourceLengthRequired,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class InvalidByteOperationError extends RevertError {
|
|
||||||
constructor(error?: InvalidByteOperationErrorCodes, offset?: BigNumber, required?: BigNumber) {
|
|
||||||
super('InvalidByteOperationError', 'InvalidByteOperationError(uint8 error, uint256 offset, uint256 required)', {
|
|
||||||
error,
|
|
||||||
offset,
|
|
||||||
required,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register the InvalidByteOperationError type
|
|
||||||
RevertError.registerType(InvalidByteOperationError);
|
|
@ -1,24 +0,0 @@
|
|||||||
import { RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
export class OnlyOwnerError extends RevertError {
|
|
||||||
constructor(sender?: string, owner?: string) {
|
|
||||||
super('OnlyOwnerError', 'OnlyOwnerError(address sender, address owner)', {
|
|
||||||
sender,
|
|
||||||
owner,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TransferOwnerToZeroError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('TransferOwnerToZeroError', 'TransferOwnerToZeroError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [OnlyOwnerError, TransferOwnerToZeroError];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
import { RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
export class IllegalReentrancyError extends RevertError {
|
|
||||||
constructor() {
|
|
||||||
super('IllegalReentrancyError', 'IllegalReentrancyError()', {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register the IllegalReentrancyError type
|
|
||||||
RevertError.registerType(IllegalReentrancyError);
|
|
@ -1,6 +1,4 @@
|
|||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, SafeMathRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import SafeMathRevertErrors = require('./safe_math_revert_errors');
|
|
||||||
|
|
||||||
const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
|
const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
|
||||||
|
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
|
||||||
|
|
||||||
// tslint:disable:max-classes-per-file
|
|
||||||
|
|
||||||
export enum BinOpErrorCodes {
|
|
||||||
AdditionOverflow,
|
|
||||||
MultiplicationOverflow,
|
|
||||||
SubtractionUnderflow,
|
|
||||||
DivisionByZero,
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum DowncastErrorCodes {
|
|
||||||
ValueTooLargeToDowncastToUint32,
|
|
||||||
ValueTooLargeToDowncastToUint64,
|
|
||||||
ValueTooLargeToDowncastToUint96,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Uint256BinOpError extends RevertError {
|
|
||||||
constructor(error?: BinOpErrorCodes, a?: BigNumber, b?: BigNumber) {
|
|
||||||
super('Uint256BinOpError', 'Uint256BinOpError(uint8 error, uint256 a, uint256 b)', {
|
|
||||||
error,
|
|
||||||
a,
|
|
||||||
b,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Uint96BinOpError extends RevertError {
|
|
||||||
constructor(error?: BinOpErrorCodes, a?: BigNumber, b?: BigNumber) {
|
|
||||||
super('Uint96BinOpError', 'Uint96BinOpError(uint8 error, uint96 a, uint96 b)', {
|
|
||||||
error,
|
|
||||||
a,
|
|
||||||
b,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Uint64BinOpError extends RevertError {
|
|
||||||
constructor(error?: BinOpErrorCodes, a?: BigNumber, b?: BigNumber) {
|
|
||||||
super('Uint64BinOpError', 'Uint64BinOpError(uint8 error, uint64 a, uint64 b)', {
|
|
||||||
error,
|
|
||||||
a,
|
|
||||||
b,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Uint256DowncastError extends RevertError {
|
|
||||||
constructor(error?: DowncastErrorCodes, a?: BigNumber) {
|
|
||||||
super('Uint256DowncastError', 'Uint256DowncastError(uint8 error, uint256 a)', {
|
|
||||||
error,
|
|
||||||
a,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [Uint256BinOpError, Uint96BinOpError, Uint64BinOpError, Uint256DowncastError];
|
|
||||||
|
|
||||||
// Register the types we've defined.
|
|
||||||
for (const type of types) {
|
|
||||||
RevertError.registerType(type);
|
|
||||||
}
|
|
@ -1,10 +1,7 @@
|
|||||||
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { AuthorizableRevertErrors, BigNumber, OwnableRevertErrors } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import AuthorizableRevertErrors = require('../src/authorizable_revert_errors');
|
|
||||||
import OwnableRevertErrors = require('../src/ownable_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestAuthorizableContract } from './wrappers';
|
import { TestAuthorizableContract } from './wrappers';
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import { chaiSetup, provider, randomAddress, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
|
import { chaiSetup, provider, randomAddress, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, LibAddressArrayRevertErrors } from '@0x/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import LibAddressArrayRevertErrors = require('../src/lib_address_array_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestLibAddressArrayContract } from './wrappers';
|
import { TestLibAddressArrayContract } from './wrappers';
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, LibBytesRevertErrors } from '@0x/utils';
|
||||||
import BN = require('bn.js');
|
import BN = require('bn.js');
|
||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import LibBytesRevertErrors = require('../src/lib_bytes_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestLibBytesContract } from './wrappers';
|
import { TestLibBytesContract } from './wrappers';
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { blockchainTests, constants, describe, expect } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, describe, expect } from '@0x/contracts-test-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber, SafeMathRevertErrors } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import * as ReferenceFunctions from '../src/reference_functions';
|
import * as ReferenceFunctions from '../src/reference_functions';
|
||||||
import SafeMathRevertErrors = require('../src/safe_math_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestLibSafeMathContract } from './wrappers';
|
import { TestLibSafeMathContract } from './wrappers';
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { blockchainTests, constants, expect, filterLogsToArguments } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, expect, filterLogsToArguments } from '@0x/contracts-test-utils';
|
||||||
|
import { OwnableRevertErrors } from '@0x/utils';
|
||||||
import OwnableRevertErrors = require('../src/ownable_revert_errors');
|
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { IOwnableEvents, IOwnableOwnershipTransferredEventArgs, TestOwnableContract } from './wrappers';
|
import { IOwnableEvents, IOwnableOwnershipTransferredEventArgs, TestOwnableContract } from './wrappers';
|
||||||
|
@ -3,7 +3,7 @@ import { BlockchainLifecycle } from '@0x/dev-utils';
|
|||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import ReentrancyGuardRevertErrors = require('../src/reentrancy_guard_revert_errors');
|
import { ReentrancyGuardRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { TestReentrancyGuardContract } from './wrappers';
|
import { TestReentrancyGuardContract } from './wrappers';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { constants, describe, expect } from '@0x/contracts-test-utils';
|
import { constants, describe, expect } from '@0x/contracts-test-utils';
|
||||||
|
import { SafeMathRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import { safeAdd, safeDiv, safeMul, safeSub } from '../src/reference_functions';
|
import { safeAdd, safeDiv, safeMul, safeSub } from '../src/reference_functions';
|
||||||
import SafeMathRevertErrors = require('../src/safe_math_revert_errors');
|
|
||||||
|
|
||||||
describe('Reference Functions', () => {
|
describe('Reference Functions', () => {
|
||||||
const { ONE_ETHER, MAX_UINT256, ZERO_AMOUNT } = constants;
|
const { ONE_ETHER, MAX_UINT256, ZERO_AMOUNT } = constants;
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
"version": "4.6.0-beta.3",
|
"version": "4.6.0-beta.3",
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Re-export all `RevertErrors`"
|
"note": "Re-export all `RevertErrors`",
|
||||||
|
"pr": 2362
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -26,84 +26,15 @@ export {
|
|||||||
AnyRevertError,
|
AnyRevertError,
|
||||||
} from './revert_error';
|
} from './revert_error';
|
||||||
|
|
||||||
export {
|
export import CoordinatorRevertErrors = require('./revert_errors/coordinator/revert_errors');
|
||||||
AssetProxyDispatchError,
|
export import ExchangeForwarderRevertErrors = require('./revert_errors/exchange-forwarder/revert_errors');
|
||||||
AssetProxyDispatchErrorCode,
|
export import LibMathRevertErrors = require('./revert_errors/exchange-libs/lib_math_revert_errors');
|
||||||
AssetProxyExistsError,
|
export import ExchangeRevertErrors = require('./revert_errors/exchange/revert_errors');
|
||||||
AssetProxyTransferError,
|
export import FixedMathRevertErrors = require('./revert_errors/staking/fixed_math_revert_errors');
|
||||||
BatchMatchOrdersError,
|
export import StakingRevertErrors = require('./revert_errors/staking/staking_revert_errors');
|
||||||
BatchMatchOrdersErrorCodes,
|
export import AuthorizableRevertErrors = require('./revert_errors/utils/authorizable_revert_errors');
|
||||||
EIP1271SignatureError,
|
export import LibAddressArrayRevertErrors = require('./revert_errors/utils/lib_address_array_revert_errors');
|
||||||
ExchangeContextErrorCodes,
|
export import LibBytesRevertErrors = require('./revert_errors/utils/lib_bytes_revert_errors');
|
||||||
ExchangeInvalidContextError,
|
export import OwnableRevertErrors = require('./revert_errors/utils/ownable_revert_errors');
|
||||||
FillError,
|
export import ReentrancyGuardRevertErrors = require('./revert_errors/utils/reentrancy_guard_revert_errors');
|
||||||
FillErrorCode,
|
export import SafeMathRevertErrors = require('./revert_errors/utils/safe_math_revert_errors');
|
||||||
IncompleteFillError,
|
|
||||||
IncompleteFillErrorCode,
|
|
||||||
NegativeSpreadError,
|
|
||||||
OrderEpochError,
|
|
||||||
OrderStatusError,
|
|
||||||
PayProtocolFeeError,
|
|
||||||
SignatureError,
|
|
||||||
SignatureErrorCode,
|
|
||||||
SignatureValidatorNotApprovedError,
|
|
||||||
SignatureWalletError,
|
|
||||||
TransactionError,
|
|
||||||
TransactionErrorCode,
|
|
||||||
TransactionExecutionError,
|
|
||||||
TransactionGasPriceError,
|
|
||||||
TransactionInvalidContextError,
|
|
||||||
} from './revert_errors/exchange/revert_errors';
|
|
||||||
|
|
||||||
export {
|
|
||||||
CompleteBuyFailedError,
|
|
||||||
DefaultFunctionWethContractOnlyError,
|
|
||||||
Erc721AmountMustEqualOneError,
|
|
||||||
FeePercentageTooLargeError,
|
|
||||||
InsufficientEthForFeeError,
|
|
||||||
MsgValueCannotEqualZeroError,
|
|
||||||
OverspentWethError,
|
|
||||||
UnregisteredAssetProxyError,
|
|
||||||
UnsupportedAssetProxyError,
|
|
||||||
UnsupportedFeeError,
|
|
||||||
} from './revert_errors/exchange-forwarder/revert_errors';
|
|
||||||
|
|
||||||
export { DivisionByZeroError, RoundingError } from './revert_errors/exchange-libs/lib_math_revert_errors';
|
|
||||||
export {
|
|
||||||
BinOpError,
|
|
||||||
BinOpErrorCodes as StakingBinOpErrorCodes,
|
|
||||||
SignedValueError,
|
|
||||||
UnsignedValueError,
|
|
||||||
ValueErrorCodes,
|
|
||||||
} from './revert_errors/staking/fixed_math_revert_errors';
|
|
||||||
|
|
||||||
export {
|
|
||||||
AuthorizedAddressMismatchError,
|
|
||||||
IndexOutOfBoundsError,
|
|
||||||
SenderNotAuthorizedError,
|
|
||||||
TargetAlreadyAuthorizedError,
|
|
||||||
TargetNotAuthorizedError,
|
|
||||||
ZeroCantBeAuthorizedError,
|
|
||||||
} from './revert_errors/utils/authorizable_revert_errors';
|
|
||||||
export { MismanagedMemoryError } from './revert_errors/utils/lib_address_array_revert_errors';
|
|
||||||
export {
|
|
||||||
InvalidByteOperationError,
|
|
||||||
InvalidByteOperationErrorCodes,
|
|
||||||
} from './revert_errors/utils/lib_bytes_revert_errors';
|
|
||||||
export { OnlyOwnerError, TransferOwnerToZeroError } from './revert_errors/utils/ownable_revert_errors';
|
|
||||||
export { IllegalReentrancyError } from './revert_errors/utils/reentrancy_guard_revert_errors';
|
|
||||||
export {
|
|
||||||
BinOpErrorCodes,
|
|
||||||
DowncastErrorCodes,
|
|
||||||
Uint256BinOpError,
|
|
||||||
Uint256DowncastError,
|
|
||||||
Uint64BinOpError,
|
|
||||||
Uint96BinOpError,
|
|
||||||
} from './revert_errors/utils/safe_math_revert_errors';
|
|
||||||
export {
|
|
||||||
ApprovalExpiredError,
|
|
||||||
InvalidApprovalSignatureError,
|
|
||||||
InvalidOriginError,
|
|
||||||
SignatureError as CoordinatorSignatureError,
|
|
||||||
SignatureErrorCodes,
|
|
||||||
} from './revert_errors/coordinator/revert_errors';
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user