Remove moved RevertErrors
This commit is contained in:
@@ -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,
|
||||
} from './wrappers';
|
||||
export { artifacts } from './artifacts';
|
||||
export import FixedMathRevertErrors = require('./fixed_math_revert_errors');
|
||||
export import StakingRevertErrors = require('./staking_revert_errors');
|
||||
export { StakingRevertErrors, FixedMathRevertErrors } from '@0x/utils';
|
||||
export { constants } from './constants';
|
||||
export {
|
||||
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 { 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 StakingRevertErrors = require('../src/staking_revert_errors');
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
import {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
||||
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
|
||||
import { StakingRevertErrors } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants as stakingConstants } from '../src/constants';
|
||||
import StakingRevertErrors = require('../src/staking_revert_errors');
|
||||
|
||||
import { MakerActor } from './actors/maker_actor';
|
||||
import { PoolOperatorActor } from './actors/pool_operator_actor';
|
||||
|
@@ -1,9 +1,8 @@
|
||||
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
||||
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 StakingRevertErrors = require('../src/staking_revert_errors');
|
||||
import { DelegatorsByPoolId, OperatorByPoolId, StakeInfo, StakeStatus } from '../src/types';
|
||||
|
||||
import { FinalizerActor } from './actors/finalizer_actor';
|
||||
|
@@ -1,9 +1,8 @@
|
||||
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
|
||||
import { blockchainTests, describe } from '@0x/contracts-test-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { BigNumber, StakingRevertErrors } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import StakingRevertErrors = require('../src/staking_revert_errors');
|
||||
import { StakeInfo, StakeStatus } from '../src/types';
|
||||
|
||||
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 { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
|
||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
||||
import { StakingRevertErrors } from '../../src';
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
import {
|
||||
|
@@ -11,8 +11,8 @@ import { BigNumber } from '@0x/utils';
|
||||
import { LogEntry } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { StakingRevertErrors } from '../../src';
|
||||
import { constants as stakingConstants } from '../../src/constants';
|
||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
import { assertIntegerRoughlyEquals, getRandomInteger, toBaseUnitAmount } from '../utils/number_utils';
|
||||
|
@@ -3,7 +3,7 @@ import { BigNumber } from '@0x/utils';
|
||||
import { Decimal } from 'decimal.js';
|
||||
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 { artifacts } from '../artifacts';
|
||||
|
@@ -2,8 +2,8 @@ import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/co
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||
|
||||
import { StakingRevertErrors } from '../../src';
|
||||
import { constants as stakingConstants } from '../../src/constants';
|
||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
import {
|
||||
|
@@ -11,7 +11,7 @@ import { BigNumber } from '@0x/utils';
|
||||
import { LogEntry } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
||||
import { StakingRevertErrors } from '../../src';
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
import {
|
||||
|
@@ -12,7 +12,7 @@ import {
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
||||
import { StakingRevertErrors } from '../../src';
|
||||
import { StakeStatus } from '../../src/types';
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
|
@@ -11,8 +11,8 @@ import {
|
||||
TestStakingProxyUnitContract,
|
||||
} from '../wrappers';
|
||||
|
||||
import { StakingRevertErrors } from '../../src';
|
||||
import { constants as stakingConstants } from '../../src/constants';
|
||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
||||
|
||||
blockchainTests.resets('StakingProxy unit tests', env => {
|
||||
const testString = 'Hello, World!';
|
||||
|
@@ -13,8 +13,8 @@ import { RevertReason } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
|
||||
import { StakingRevertErrors } from '../../src';
|
||||
import { constants as stakingConstants } from '../../src/constants';
|
||||
import StakingRevertErrors = require('../../src/staking_revert_errors');
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
import {
|
||||
|
Reference in New Issue
Block a user