Cleanup rich reverts

This commit is contained in:
Amir Bandeali 2019-09-24 18:13:30 -07:00
parent e5aaf68277
commit 57f5b12e24
9 changed files with 59 additions and 198 deletions

View File

@ -146,7 +146,7 @@ contract StakingProxy is
if (_epochDurationInSeconds < 5 days || _epochDurationInSeconds > 30 days) { if (_epochDurationInSeconds < 5 days || _epochDurationInSeconds > 30 days) {
LibRichErrors.rrevert( LibRichErrors.rrevert(
LibStakingRichErrors.InvalidParamValueError( LibStakingRichErrors.InvalidParamValueError(
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidEpochDuration LibStakingRichErrors.InvalidParamValueErrorCodes.InvalidEpochDuration
)); ));
} }
@ -155,7 +155,7 @@ contract StakingProxy is
if (cobbDouglasAlphaNumerator > _cobbDouglasAlphaDenominator || _cobbDouglasAlphaDenominator == 0) { if (cobbDouglasAlphaNumerator > _cobbDouglasAlphaDenominator || _cobbDouglasAlphaDenominator == 0) {
LibRichErrors.rrevert( LibRichErrors.rrevert(
LibStakingRichErrors.InvalidParamValueError( LibStakingRichErrors.InvalidParamValueError(
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidCobbDouglasAlpha LibStakingRichErrors.InvalidParamValueErrorCodes.InvalidCobbDouglasAlpha
)); ));
} }
@ -163,7 +163,7 @@ contract StakingProxy is
if (rewardDelegatedStakeWeight > PPM_DENOMINATOR) { if (rewardDelegatedStakeWeight > PPM_DENOMINATOR) {
LibRichErrors.rrevert( LibRichErrors.rrevert(
LibStakingRichErrors.InvalidParamValueError( LibStakingRichErrors.InvalidParamValueError(
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidRewardDelegatedStakeWeight LibStakingRichErrors.InvalidParamValueErrorCodes.InvalidRewardDelegatedStakeWeight
)); ));
} }
@ -171,7 +171,7 @@ contract StakingProxy is
if (maximumMakersInPool == 0) { if (maximumMakersInPool == 0) {
LibRichErrors.rrevert( LibRichErrors.rrevert(
LibStakingRichErrors.InvalidParamValueError( LibStakingRichErrors.InvalidParamValueError(
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidMaximumMakersInPool LibStakingRichErrors.InvalidParamValueErrorCodes.InvalidMaximumMakersInPool
)); ));
} }
@ -179,7 +179,7 @@ contract StakingProxy is
if (minimumPoolStake < 2) { if (minimumPoolStake < 2) {
LibRichErrors.rrevert( LibRichErrors.rrevert(
LibStakingRichErrors.InvalidParamValueError( LibStakingRichErrors.InvalidParamValueError(
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidMinimumPoolStake LibStakingRichErrors.InvalidParamValueErrorCodes.InvalidMinimumPoolStake
)); ));
} }
} }

View File

@ -51,7 +51,8 @@ contract MixinExchangeManager is
onlyAuthorized onlyAuthorized
{ {
if (validExchanges[addr]) { if (validExchanges[addr]) {
LibRichErrors.rrevert(LibStakingRichErrors.ExchangeAddressAlreadyRegisteredError( LibRichErrors.rrevert(LibStakingRichErrors.ExchangeManagerError(
LibStakingRichErrors.ExchangeManagerErrorCodes.ExchangeAlreadyRegistered,
addr addr
)); ));
} }
@ -66,7 +67,8 @@ contract MixinExchangeManager is
onlyAuthorized onlyAuthorized
{ {
if (!validExchanges[addr]) { if (!validExchanges[addr]) {
LibRichErrors.rrevert(LibStakingRichErrors.ExchangeAddressNotRegisteredError( LibRichErrors.rrevert(LibStakingRichErrors.ExchangeManagerError(
LibStakingRichErrors.ExchangeManagerErrorCodes.ExchangeNotRegistered,
addr addr
)); ));
} }

View File

@ -34,12 +34,12 @@ library LibStakingRichErrors {
MismatchedFeeAndPayment MismatchedFeeAndPayment
} }
enum InitializationErrorCode { enum InitializationErrorCodes {
MixinSchedulerAlreadyInitialized, MixinSchedulerAlreadyInitialized,
MixinParamsAlreadyInitialized MixinParamsAlreadyInitialized
} }
enum InvalidParamValueErrorCode { enum InvalidParamValueErrorCodes {
InvalidCobbDouglasAlpha, InvalidCobbDouglasAlpha,
InvalidRewardDelegatedStakeWeight, InvalidRewardDelegatedStakeWeight,
InvalidMaximumMakersInPool, InvalidMaximumMakersInPool,
@ -54,21 +54,18 @@ library LibStakingRichErrors {
PoolIsFull PoolIsFull
} }
// bytes4(keccak256("MiscalculatedRewardsError(uint256,uint256)")) enum ExchangeManagerErrorCodes {
bytes4 internal constant MISCALCULATED_REWARDS_ERROR_SELECTOR = ExchangeAlreadyRegistered,
0xf7806c4e; ExchangeNotRegistered
}
// bytes4(keccak256("OnlyCallableByExchangeError(address)")) // bytes4(keccak256("OnlyCallableByExchangeError(address)"))
bytes4 internal constant ONLY_CALLABLE_BY_EXCHANGE_ERROR_SELECTOR = bytes4 internal constant ONLY_CALLABLE_BY_EXCHANGE_ERROR_SELECTOR =
0xb56d2df0; 0xb56d2df0;
// bytes4(keccak256("ExchangeAddressAlreadyRegisteredError(address)")) // bytes4(keccak256("ExchangeManagerError(uint8,address)"))
bytes4 internal constant EXCHANGE_ADDRESS_ALREADY_REGISTERED_ERROR_SELECTOR = bytes4 internal constant EXCHANGE_MANAGER_ERROR_SELECTOR =
0xc87a78b7; 0xb9588e43;
// bytes4(keccak256("ExchangeAddressNotRegisteredError(address)"))
bytes4 internal constant EXCHANGE_ADDRESS_NOT_REGISTERED_ERROR_SELECTOR =
0x7dc025b0;
// bytes4(keccak256("InsufficientBalanceError(uint256,uint256)")) // bytes4(keccak256("InsufficientBalanceError(uint256,uint256)"))
bytes4 internal constant INSUFFICIENT_BALANCE_ERROR_SELECTOR = bytes4 internal constant INSUFFICIENT_BALANCE_ERROR_SELECTOR =
@ -82,10 +79,6 @@ library LibStakingRichErrors {
bytes4 internal constant MAKER_POOL_ASSIGNMENT_ERROR_SELECTOR = bytes4 internal constant MAKER_POOL_ASSIGNMENT_ERROR_SELECTOR =
0x69945e3f; 0x69945e3f;
// bytes4(keccak256("WithdrawAmountExceedsMemberBalanceError(uint256,uint256)"))
bytes4 internal constant WITHDRAW_AMOUNT_EXCEEDS_MEMBER_BALANCE_ERROR_SELECTOR =
0xfc9c065f;
// bytes4(keccak256("BlockTimestampTooLowError(uint256,uint256)")) // bytes4(keccak256("BlockTimestampTooLowError(uint256,uint256)"))
bytes4 internal constant BLOCK_TIMESTAMP_TOO_LOW_ERROR_SELECTOR = bytes4 internal constant BLOCK_TIMESTAMP_TOO_LOW_ERROR_SELECTOR =
0xa6bcde47; 0xa6bcde47;
@ -102,10 +95,6 @@ library LibStakingRichErrors {
bytes internal constant ONLY_CALLABLE_IF_NOT_IN_CATASTROPHIC_FAILURE_ERROR = bytes internal constant ONLY_CALLABLE_IF_NOT_IN_CATASTROPHIC_FAILURE_ERROR =
hex"7dd020ce"; hex"7dd020ce";
// bytes4(keccak256("AmountExceedsBalanceOfPoolError(uint256,uint96)"))
bytes4 internal constant AMOUNT_EXCEEDS_BALANCE_OF_POOL_ERROR_SELECTOR =
0x4c5c09dd;
// bytes4(keccak256("OperatorShareError(uint8,bytes32,uint32)")) // bytes4(keccak256("OperatorShareError(uint8,bytes32,uint32)"))
bytes4 internal constant OPERATOR_SHARE_ERROR_SELECTOR = bytes4 internal constant OPERATOR_SHARE_ERROR_SELECTOR =
0x22df9597; 0x22df9597;
@ -139,21 +128,6 @@ library LibStakingRichErrors {
0x614b800a; 0x614b800a;
// solhint-disable func-name-mixedcase // solhint-disable func-name-mixedcase
function MiscalculatedRewardsError(
uint256 totalRewardsPaid,
uint256 initialContractBalance
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
MISCALCULATED_REWARDS_ERROR_SELECTOR,
totalRewardsPaid,
initialContractBalance
);
}
function OnlyCallableByExchangeError( function OnlyCallableByExchangeError(
address senderAddress address senderAddress
) )
@ -167,7 +141,8 @@ library LibStakingRichErrors {
); );
} }
function ExchangeAddressAlreadyRegisteredError( function ExchangeManagerError(
ExchangeManagerErrorCodes errorCodes,
address exchangeAddress address exchangeAddress
) )
internal internal
@ -175,20 +150,8 @@ library LibStakingRichErrors {
returns (bytes memory) returns (bytes memory)
{ {
return abi.encodeWithSelector( return abi.encodeWithSelector(
EXCHANGE_ADDRESS_ALREADY_REGISTERED_ERROR_SELECTOR, EXCHANGE_MANAGER_ERROR_SELECTOR,
exchangeAddress errorCodes,
);
}
function ExchangeAddressNotRegisteredError(
address exchangeAddress
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
EXCHANGE_ADDRESS_NOT_REGISTERED_ERROR_SELECTOR,
exchangeAddress exchangeAddress
); );
} }
@ -224,7 +187,7 @@ library LibStakingRichErrors {
} }
function MakerPoolAssignmentError( function MakerPoolAssignmentError(
MakerPoolAssignmentErrorCodes errorCode, MakerPoolAssignmentErrorCodes errorCodes,
address makerAddress, address makerAddress,
bytes32 poolId bytes32 poolId
) )
@ -234,27 +197,12 @@ library LibStakingRichErrors {
{ {
return abi.encodeWithSelector( return abi.encodeWithSelector(
MAKER_POOL_ASSIGNMENT_ERROR_SELECTOR, MAKER_POOL_ASSIGNMENT_ERROR_SELECTOR,
errorCode, errorCodes,
makerAddress, makerAddress,
poolId poolId
); );
} }
function WithdrawAmountExceedsMemberBalanceError(
uint256 withdrawAmount,
uint256 balance
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
WITHDRAW_AMOUNT_EXCEEDS_MEMBER_BALANCE_ERROR_SELECTOR,
withdrawAmount,
balance
);
}
function BlockTimestampTooLowError( function BlockTimestampTooLowError(
uint256 epochEndTime, uint256 epochEndTime,
uint256 currentBlockTimestamp uint256 currentBlockTimestamp
@ -299,23 +247,8 @@ library LibStakingRichErrors {
return ONLY_CALLABLE_IF_NOT_IN_CATASTROPHIC_FAILURE_ERROR; return ONLY_CALLABLE_IF_NOT_IN_CATASTROPHIC_FAILURE_ERROR;
} }
function AmountExceedsBalanceOfPoolError(
uint256 amount,
uint96 poolBalance
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
AMOUNT_EXCEEDS_BALANCE_OF_POOL_ERROR_SELECTOR,
amount,
poolBalance
);
}
function OperatorShareError( function OperatorShareError(
OperatorShareErrorCodes errorCode, OperatorShareErrorCodes errorCodes,
bytes32 poolId, bytes32 poolId,
uint32 operatorShare uint32 operatorShare
) )
@ -325,7 +258,7 @@ library LibStakingRichErrors {
{ {
return abi.encodeWithSelector( return abi.encodeWithSelector(
OPERATOR_SHARE_ERROR_SELECTOR, OPERATOR_SHARE_ERROR_SELECTOR,
errorCode, errorCodes,
poolId, poolId,
operatorShare operatorShare
); );
@ -347,7 +280,7 @@ library LibStakingRichErrors {
} }
function InvalidProtocolFeePaymentError( function InvalidProtocolFeePaymentError(
ProtocolFeePaymentErrorCodes errorCode, ProtocolFeePaymentErrorCodes errorCodes,
uint256 expectedProtocolFeePaid, uint256 expectedProtocolFeePaid,
uint256 actualProtocolFeePaid uint256 actualProtocolFeePaid
) )
@ -357,7 +290,7 @@ library LibStakingRichErrors {
{ {
return abi.encodeWithSelector( return abi.encodeWithSelector(
INVALID_PROTOCOL_FEE_PAYMENT_ERROR_SELECTOR, INVALID_PROTOCOL_FEE_PAYMENT_ERROR_SELECTOR,
errorCode, errorCodes,
expectedProtocolFeePaid, expectedProtocolFeePaid,
actualProtocolFeePaid actualProtocolFeePaid
); );
@ -374,7 +307,7 @@ library LibStakingRichErrors {
); );
} }
function InitializationError(InitializationErrorCode code) function InitializationError(InitializationErrorCodes code)
internal internal
pure pure
returns (bytes memory) returns (bytes memory)
@ -385,7 +318,7 @@ library LibStakingRichErrors {
); );
} }
function InvalidParamValueError(InvalidParamValueErrorCode code) function InvalidParamValueError(InvalidParamValueErrorCodes code)
internal internal
pure pure
returns (bytes memory) returns (bytes memory)

View File

@ -118,7 +118,7 @@ contract MixinParams is
) { ) {
LibRichErrors.rrevert( LibRichErrors.rrevert(
LibStakingRichErrors.InitializationError( LibStakingRichErrors.InitializationError(
LibStakingRichErrors.InitializationErrorCode.MixinParamsAlreadyInitialized LibStakingRichErrors.InitializationErrorCodes.MixinParamsAlreadyInitialized
) )
); );
} }

View File

@ -97,7 +97,7 @@ contract MixinScheduler is
if (currentEpochStartTimeInSeconds != 0) { if (currentEpochStartTimeInSeconds != 0) {
LibRichErrors.rrevert( LibRichErrors.rrevert(
LibStakingRichErrors.InitializationError( LibStakingRichErrors.InitializationError(
LibStakingRichErrors.InitializationErrorCode.MixinSchedulerAlreadyInitialized LibStakingRichErrors.InitializationErrorCodes.MixinSchedulerAlreadyInitialized
) )
); );
} }

View File

@ -37,7 +37,10 @@ blockchainTests('Exchange Integrations', env => {
const isValidAddressValid = await validExchanges.callAsync(exchange); const isValidAddressValid = await validExchanges.callAsync(exchange);
expect(isValidAddressValid).to.be.true(); expect(isValidAddressValid).to.be.true();
// 3 try adding valid address again // 3 try adding valid address again
let revertError = new StakingRevertErrors.ExchangeAddressAlreadyRegisteredError(exchange); let revertError = new StakingRevertErrors.ExchangeManagerError(
StakingRevertErrors.ExchangeManagerErrorCodes.ExchangeAlreadyRegistered,
exchange,
);
let tx = addExchangeAddress.awaitTransactionSuccessAsync(exchange); let tx = addExchangeAddress.awaitTransactionSuccessAsync(exchange);
await expect(tx).to.revertWith(revertError); await expect(tx).to.revertWith(revertError);
// 4 remove valid address // 4 remove valid address
@ -45,7 +48,10 @@ blockchainTests('Exchange Integrations', env => {
const isValidAddressStillValid = await validExchanges.callAsync(exchange); const isValidAddressStillValid = await validExchanges.callAsync(exchange);
expect(isValidAddressStillValid).to.be.false(); expect(isValidAddressStillValid).to.be.false();
// 5 try removing valid address again // 5 try removing valid address again
revertError = new StakingRevertErrors.ExchangeAddressNotRegisteredError(exchange); revertError = new StakingRevertErrors.ExchangeManagerError(
StakingRevertErrors.ExchangeManagerErrorCodes.ExchangeNotRegistered,
exchange,
);
tx = removeExchangeAddress.awaitTransactionSuccessAsync(exchange); tx = removeExchangeAddress.awaitTransactionSuccessAsync(exchange);
await expect(tx).to.revertWith(revertError); await expect(tx).to.revertWith(revertError);
// @todo should not be able to add / remove an exchange if not contract owner. // @todo should not be able to add / remove an exchange if not contract owner.

View File

@ -224,7 +224,7 @@ blockchainTests('Migration tests', env => {
epochDurationInSeconds: fiveDays.minus(1), epochDurationInSeconds: fiveDays.minus(1),
}); });
const expectedError = new StakingRevertErrors.InvalidParamValueError( const expectedError = new StakingRevertErrors.InvalidParamValueError(
StakingRevertErrors.InvalidParamValueErrorCode.InvalidEpochDuration, StakingRevertErrors.InvalidParamValueErrorCodes.InvalidEpochDuration,
); );
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
}); });
@ -234,7 +234,7 @@ blockchainTests('Migration tests', env => {
epochDurationInSeconds: thirtyDays.plus(1), epochDurationInSeconds: thirtyDays.plus(1),
}); });
const expectedError = new StakingRevertErrors.InvalidParamValueError( const expectedError = new StakingRevertErrors.InvalidParamValueError(
StakingRevertErrors.InvalidParamValueErrorCode.InvalidEpochDuration, StakingRevertErrors.InvalidParamValueErrorCodes.InvalidEpochDuration,
); );
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
}); });
@ -258,7 +258,7 @@ blockchainTests('Migration tests', env => {
cobbDouglasAlphaDenominator: constants.ZERO_AMOUNT, cobbDouglasAlphaDenominator: constants.ZERO_AMOUNT,
}); });
const expectedError = new StakingRevertErrors.InvalidParamValueError( const expectedError = new StakingRevertErrors.InvalidParamValueError(
StakingRevertErrors.InvalidParamValueErrorCode.InvalidCobbDouglasAlpha, StakingRevertErrors.InvalidParamValueErrorCodes.InvalidCobbDouglasAlpha,
); );
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
}); });
@ -269,7 +269,7 @@ blockchainTests('Migration tests', env => {
cobbDouglasAlphaDenominator: new BigNumber(100), cobbDouglasAlphaDenominator: new BigNumber(100),
}); });
const expectedError = new StakingRevertErrors.InvalidParamValueError( const expectedError = new StakingRevertErrors.InvalidParamValueError(
StakingRevertErrors.InvalidParamValueErrorCode.InvalidCobbDouglasAlpha, StakingRevertErrors.InvalidParamValueErrorCodes.InvalidCobbDouglasAlpha,
); );
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
}); });
@ -295,7 +295,7 @@ blockchainTests('Migration tests', env => {
rewardDelegatedStakeWeight: new BigNumber(stakingConstants.PPM).plus(1), rewardDelegatedStakeWeight: new BigNumber(stakingConstants.PPM).plus(1),
}); });
const expectedError = new StakingRevertErrors.InvalidParamValueError( const expectedError = new StakingRevertErrors.InvalidParamValueError(
StakingRevertErrors.InvalidParamValueErrorCode.InvalidRewardDelegatedStakeWeight, StakingRevertErrors.InvalidParamValueErrorCodes.InvalidRewardDelegatedStakeWeight,
); );
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
}); });
@ -312,7 +312,7 @@ blockchainTests('Migration tests', env => {
maximumMakersInPool: constants.ZERO_AMOUNT, maximumMakersInPool: constants.ZERO_AMOUNT,
}); });
const expectedError = new StakingRevertErrors.InvalidParamValueError( const expectedError = new StakingRevertErrors.InvalidParamValueError(
StakingRevertErrors.InvalidParamValueErrorCode.InvalidMaximumMakersInPool, StakingRevertErrors.InvalidParamValueErrorCodes.InvalidMaximumMakersInPool,
); );
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
}); });

View File

@ -7,14 +7,6 @@ library LibSafeMathRichErrors {
bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR = bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR =
0xe946c1bb; 0xe946c1bb;
// bytes4(keccak256("Uint96BinOpError(uint8,uint96,uint96)"))
bytes4 internal constant UINT96_BINOP_ERROR_SELECTOR =
0xe486a353;
// bytes4(keccak256("Uint64BinOpError(uint8,uint64,uint64)"))
bytes4 internal constant UINT64_BINOP_ERROR_SELECTOR =
0x67e71b32;
// bytes4(keccak256("Uint256DowncastError(uint8,uint256)")) // bytes4(keccak256("Uint256DowncastError(uint8,uint256)"))
bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR = bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR =
0xc996af7b; 0xc996af7b;
@ -50,40 +42,6 @@ library LibSafeMathRichErrors {
); );
} }
function Uint96BinOpError(
BinOpErrorCodes errorCode,
uint96 a,
uint96 b
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
UINT96_BINOP_ERROR_SELECTOR,
errorCode,
a,
b
);
}
function Uint64BinOpError(
BinOpErrorCodes errorCode,
uint64 a,
uint64 b
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
UINT64_BINOP_ERROR_SELECTOR,
errorCode,
a,
b
);
}
function Uint256DowncastError( function Uint256DowncastError(
DowncastErrorCodes errorCode, DowncastErrorCodes errorCode,
uint256 a uint256 a

View File

@ -19,7 +19,7 @@ export enum ProtocolFeePaymentErrorCodes {
MismatchedFeeAndPayment, MismatchedFeeAndPayment,
} }
export enum InvalidParamValueErrorCode { export enum InvalidParamValueErrorCodes {
InvalidCobbDouglasAlpha, InvalidCobbDouglasAlpha,
InvalidRewardDelegatedStakeWeight, InvalidRewardDelegatedStakeWeight,
InvalidMaximumMakersInPool, InvalidMaximumMakersInPool,
@ -27,19 +27,14 @@ export enum InvalidParamValueErrorCode {
InvalidEpochDuration, InvalidEpochDuration,
} }
export enum InitializationErrorCode { export enum InitializationErrorCodes {
MixinSchedulerAlreadyInitialized, MixinSchedulerAlreadyInitialized,
MixinParamsAlreadyInitialized, MixinParamsAlreadyInitialized,
} }
export class MiscalculatedRewardsError extends RevertError { export enum ExchangeManagerErrorCodes {
constructor(totalRewardsPaid?: BigNumber | number | string, initialContractBalance?: BigNumber | number | string) { ExchangeAlreadyRegistered,
super( ExchangeNotRegistered,
'MiscalculatedRewardsError',
'MiscalculatedRewardsError(uint256 totalRewardsPaid, uint256 initialContractBalance)',
{ totalRewardsPaid, initialContractBalance },
);
}
} }
export class OnlyCallableByExchangeError extends RevertError { export class OnlyCallableByExchangeError extends RevertError {
@ -48,20 +43,11 @@ export class OnlyCallableByExchangeError extends RevertError {
} }
} }
export class ExchangeAddressAlreadyRegisteredError extends RevertError { export class ExchangeManagerError extends RevertError {
constructor(exchangeAddress?: string) { constructor(error?: ExchangeManagerErrorCodes, senderAddress?: string) {
super( super('ExchangeManagerError', 'ExchangeManagerError(uint8 errorCode, address senderAddress)', {
'ExchangeAddressAlreadyRegisteredError', error,
'ExchangeAddressAlreadyRegisteredError(address exchangeAddress)', senderAddress,
{ exchangeAddress },
);
}
}
export class ExchangeAddressNotRegisteredError extends RevertError {
constructor(exchangeAddress?: string) {
super('ExchangeAddressNotRegisteredError', 'ExchangeAddressNotRegisteredError(address exchangeAddress)', {
exchangeAddress,
}); });
} }
} }
@ -99,16 +85,6 @@ export class MakerPoolAssignmentError extends RevertError {
} }
} }
export class WithdrawAmountExceedsMemberBalanceError extends RevertError {
constructor(withdrawAmount?: BigNumber | number | string, balance?: BigNumber | number | string) {
super(
'WithdrawAmountExceedsMemberBalanceError',
'WithdrawAmountExceedsMemberBalanceError(uint256 withdrawAmount, uint256 balance)',
{ withdrawAmount, balance },
);
}
}
export class BlockTimestampTooLowError extends RevertError { export class BlockTimestampTooLowError extends RevertError {
constructor(epochEndTime?: BigNumber | number | string, currentBlockTimestamp?: BigNumber | number | string) { constructor(epochEndTime?: BigNumber | number | string, currentBlockTimestamp?: BigNumber | number | string) {
super( super(
@ -139,16 +115,6 @@ export class OnlyCallableIfNotInCatastrophicFailureError extends RevertError {
} }
} }
export class AmountExceedsBalanceOfPoolError extends RevertError {
constructor(amount?: BigNumber | number | string, poolBalance?: BigNumber | number | string) {
super(
'AmountExceedsBalanceOfPoolError',
'AmountExceedsBalanceOfPoolError(uint256 amount, uint96 poolBalance)',
{ amount, poolBalance },
);
}
}
export class OperatorShareError extends RevertError { export class OperatorShareError extends RevertError {
constructor(error?: OperatorShareErrorCodes, poolId?: string, operatorShare?: BigNumber | number | string) { constructor(error?: OperatorShareErrorCodes, poolId?: string, operatorShare?: BigNumber | number | string) {
super('OperatorShareError', 'OperatorShareError(uint8 error, bytes32 poolId, uint32 operatorShare)', { super('OperatorShareError', 'OperatorShareError(uint8 error, bytes32 poolId, uint32 operatorShare)', {
@ -169,7 +135,7 @@ export class PoolExistenceError extends RevertError {
} }
export class InvalidParamValueError extends RevertError { export class InvalidParamValueError extends RevertError {
constructor(error?: InvalidParamValueErrorCode) { constructor(error?: InvalidParamValueErrorCodes) {
super('InvalidParamValueError', 'InvalidParamValueError(uint8 error)', { super('InvalidParamValueError', 'InvalidParamValueError(uint8 error)', {
error, error,
}); });
@ -197,7 +163,7 @@ export class InvalidProtocolFeePaymentError extends RevertError {
} }
export class InitializationError extends RevertError { export class InitializationError extends RevertError {
constructor(error?: InitializationErrorCode) { constructor(error?: InitializationErrorCodes) {
super('InitializationError', 'InitializationError(uint8 error)', { error }); super('InitializationError', 'InitializationError(uint8 error)', { error });
} }
} }
@ -219,17 +185,14 @@ export class PreviousEpochNotFinalizedError extends RevertError {
} }
const types = [ const types = [
AmountExceedsBalanceOfPoolError,
BlockTimestampTooLowError, BlockTimestampTooLowError,
ExchangeAddressAlreadyRegisteredError, ExchangeManagerError,
ExchangeAddressNotRegisteredError,
InitializationError, InitializationError,
InsufficientBalanceError, InsufficientBalanceError,
InvalidProtocolFeePaymentError, InvalidProtocolFeePaymentError,
InvalidStakeStatusError, InvalidStakeStatusError,
InvalidParamValueError, InvalidParamValueError,
MakerPoolAssignmentError, MakerPoolAssignmentError,
MiscalculatedRewardsError,
OnlyCallableByExchangeError, OnlyCallableByExchangeError,
OnlyCallableByPoolOperatorOrMakerError, OnlyCallableByPoolOperatorOrMakerError,
OnlyCallableByStakingContractError, OnlyCallableByStakingContractError,
@ -239,7 +202,6 @@ const types = [
PoolExistenceError, PoolExistenceError,
PreviousEpochNotFinalizedError, PreviousEpochNotFinalizedError,
ProxyDestinationCannotBeNilError, ProxyDestinationCannotBeNilError,
WithdrawAmountExceedsMemberBalanceError,
]; ];
// Register the types we've defined. // Register the types we've defined.