Linter
This commit is contained in:
@@ -10,7 +10,7 @@ import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import { AbiEncoder, BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { AbiDefinition, MethodAbi, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
import { MethodAbi, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
||||
|
||||
@@ -86,9 +86,13 @@ export class BaseContract {
|
||||
}
|
||||
protected static _throwIfRevertWithReasonCallResult(rawCallResult: string): void {
|
||||
if (rawCallResult.slice(REVERT_ERROR_SELECTOR_OFFSET, REVERT_ERROR_SELECTOR_END) === REVERT_ERROR_SELECTOR) {
|
||||
const revertReason = AbiEncoder.create('(string)').decodeAsArray(
|
||||
const revertReasonArray = AbiEncoder.create('(string)').decodeAsArray(
|
||||
ethers.utils.hexDataSlice(rawCallResult, REVERT_ERROR_SELECTOR_BYTES_LENGTH),
|
||||
)[0];
|
||||
);
|
||||
if (revertReasonArray.length !== 1) {
|
||||
throw new Error(`Cannot safely decode revert reason: Expected an array with one element, got ${revertReasonArray}`);
|
||||
}
|
||||
const revertReason = revertReasonArray[0];
|
||||
throw new Error(revertReason);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user