Add Broker rich errors
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "5.3.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Added Broker revert errors",
|
||||
"pr": 2455
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "5.2.0",
|
||||
"changes": [
|
||||
|
@@ -27,6 +27,7 @@ export {
|
||||
AnyRevertError,
|
||||
} from './revert_error';
|
||||
|
||||
export import BrokerRevertErrors = require('./revert_errors/broker/revert_errors');
|
||||
export import CoordinatorRevertErrors = require('./revert_errors/coordinator/revert_errors');
|
||||
export import ExchangeForwarderRevertErrors = require('./revert_errors/exchange-forwarder/revert_errors');
|
||||
export import LibMathRevertErrors = require('./revert_errors/exchange-libs/lib_math_revert_errors');
|
||||
|
44
packages/utils/src/revert_errors/broker/revert_errors.ts
Normal file
44
packages/utils/src/revert_errors/broker/revert_errors.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { BigNumber } from '../../configured_bignumber';
|
||||
import { RevertError } from '../../revert_error';
|
||||
|
||||
// tslint:disable:max-classes-per-file
|
||||
|
||||
export class InvalidFromAddressError extends RevertError {
|
||||
constructor(from?: string) {
|
||||
super('InvalidFromAddressError', 'InvalidFromAddressError(address from)', { from });
|
||||
}
|
||||
}
|
||||
|
||||
export class AmountsLengthMustEqualOneError extends RevertError {
|
||||
constructor(amountsLength?: BigNumber | number | string) {
|
||||
super('AmountsLengthMustEqualOneError', 'AmountsLengthMustEqualOneError(uint256 amountsLength)', {
|
||||
amountsLength,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class TooFewBrokerAssetsProvidedError extends RevertError {
|
||||
constructor(numBrokeredAssets?: BigNumber | number | string) {
|
||||
super('TooFewBrokerAssetsProvidedError', 'TooFewBrokerAssetsProvidedError(uint256 numBrokeredAssets)', {
|
||||
numBrokeredAssets,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class InvalidFunctionSelectorError extends RevertError {
|
||||
constructor(selector?: string) {
|
||||
super('InvalidFunctionSelectorError', 'InvalidFunctionSelectorError(bytes4 selector)', { selector });
|
||||
}
|
||||
}
|
||||
|
||||
const types = [
|
||||
InvalidFromAddressError,
|
||||
AmountsLengthMustEqualOneError,
|
||||
TooFewBrokerAssetsProvidedError,
|
||||
InvalidFunctionSelectorError,
|
||||
];
|
||||
|
||||
// Register the types we've defined.
|
||||
for (const type of types) {
|
||||
RevertError.registerType(type);
|
||||
}
|
Reference in New Issue
Block a user