From 63d79faa85df1cc090837fc49befb5076b50203b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 27 Sep 2018 11:51:11 +0200 Subject: Fix linter errors --- packages/base-contract/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 538c87431..981e6fca6 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -22,7 +22,8 @@ export interface EthersInterfaceByFunctionSignature { const REVERT_ERROR_SELECTOR = '08c379a0'; const REVERT_ERROR_SELECTOR_OFFSET = 2; -const REVERT_ERROR_SELECTOR_END = 10; +const REVERT_ERROR_SELECTOR_BYTES_LENGTH = 4; +const REVERT_ERROR_SELECTOR_END = REVERT_ERROR_SELECTOR_OFFSET + REVERT_ERROR_SELECTOR_BYTES_LENGTH * 2; export class BaseContract { protected _ethersInterfacesByFunctionSignature: EthersInterfaceByFunctionSignature; @@ -90,7 +91,7 @@ export class BaseContract { if (rawCallResult.slice(REVERT_ERROR_SELECTOR_OFFSET, REVERT_ERROR_SELECTOR_END) === REVERT_ERROR_SELECTOR) { const revertReason = ethers.utils.defaultAbiCoder.decode( ['string'], - ethers.utils.hexDataSlice(rawCallResult, 4), + ethers.utils.hexDataSlice(rawCallResult, REVERT_ERROR_SELECTOR_BYTES_LENGTH), ); throw new Error(revertReason); } -- cgit v1.2.3