From 66db021900cf4ac824635512052afb2bddb0299c Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 19 Sep 2017 14:53:12 +0200 Subject: Postfix variable names with 'ifExists' --- src/contract_wrappers/contract_wrapper.ts | 5 +++-- src/contract_wrappers/ether_token_wrapper.ts | 8 ++++---- src/contract_wrappers/exchange_wrapper.ts | 8 ++++---- src/contract_wrappers/token_registry_wrapper.ts | 8 ++++---- 4 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts index 4e3fb5029..2a55b53d9 100644 --- a/src/contract_wrappers/contract_wrapper.ts +++ b/src/contract_wrappers/contract_wrapper.ts @@ -10,9 +10,10 @@ export class ContractWrapper { this._web3Wrapper = web3Wrapper; } protected async _instantiateContractIfExistsAsync(artifact: Artifact, - address?: string): Promise { + addressIfExists?: string, + ): Promise { const contractInstance = - await this._web3Wrapper.getContractInstanceFromArtifactAsync(artifact, address); + await this._web3Wrapper.getContractInstanceFromArtifactAsync(artifact, addressIfExists); return contractInstance; } } diff --git a/src/contract_wrappers/ether_token_wrapper.ts b/src/contract_wrappers/ether_token_wrapper.ts index efe3fe06c..f15e766f0 100644 --- a/src/contract_wrappers/ether_token_wrapper.ts +++ b/src/contract_wrappers/ether_token_wrapper.ts @@ -13,11 +13,11 @@ import {artifacts} from '../artifacts'; export class EtherTokenWrapper extends ContractWrapper { private _etherTokenContractIfExists?: EtherTokenContract; private _tokenWrapper: TokenWrapper; - private _contractAddress?: string; - constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, contractAddress?: string) { + private _contractAddressIfExists?: string; + constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, contractAddressIfExists?: string) { super(web3Wrapper); this._tokenWrapper = tokenWrapper; - this._contractAddress = contractAddress; + this._contractAddressIfExists = contractAddressIfExists; } /** * Deposit ETH into the Wrapped ETH smart contract and issues the equivalent number of wrapped ETH tokens @@ -78,7 +78,7 @@ export class EtherTokenWrapper extends ContractWrapper { return this._etherTokenContractIfExists; } const contractInstance = await this._instantiateContractIfExistsAsync( - artifacts.EtherTokenArtifact, this._contractAddress, + artifacts.EtherTokenArtifact, this._contractAddressIfExists, ); this._etherTokenContractIfExists = contractInstance as EtherTokenContract; return this._etherTokenContractIfExists; diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 2360f639d..11a448680 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -56,7 +56,7 @@ export class ExchangeWrapper extends ContractWrapper { [ExchangeContractErrCodes.ERROR_FILL_TRUNCATION]: ExchangeContractErrs.OrderFillRoundingError, [ExchangeContractErrCodes.ERROR_FILL_BALANCE_ALLOWANCE]: ExchangeContractErrs.FillBalanceAllowanceError, }; - private _contractAddress?: string; + private _contractAddressIfExists?: string; private static _getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] { const orderAddresses: OrderAddresses = [ order.maker, @@ -75,12 +75,12 @@ export class ExchangeWrapper extends ContractWrapper { ]; return [orderAddresses, orderValues]; } - constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, contractAddress?: string) { + constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, contractAddressIfExists?: string) { super(web3Wrapper); this._tokenWrapper = tokenWrapper; this._orderValidationUtils = new OrderValidationUtils(tokenWrapper, this); this._exchangeLogEventEmitters = []; - this._contractAddress = contractAddress; + this._contractAddressIfExists = contractAddressIfExists; } /** * Returns the unavailable takerAmount of an order. Unavailable amount is defined as the total @@ -740,7 +740,7 @@ export class ExchangeWrapper extends ContractWrapper { return this._exchangeContractIfExists; } const contractInstance = await this._instantiateContractIfExistsAsync( - artifacts.ExchangeArtifact, this._contractAddress, + artifacts.ExchangeArtifact, this._contractAddressIfExists, ); this._exchangeContractIfExists = contractInstance as ExchangeContract; return this._exchangeContractIfExists; diff --git a/src/contract_wrappers/token_registry_wrapper.ts b/src/contract_wrappers/token_registry_wrapper.ts index fb0ab78f6..2cc5a9aa0 100644 --- a/src/contract_wrappers/token_registry_wrapper.ts +++ b/src/contract_wrappers/token_registry_wrapper.ts @@ -11,10 +11,10 @@ import {artifacts} from '../artifacts'; */ export class TokenRegistryWrapper extends ContractWrapper { private _tokenRegistryContractIfExists?: TokenRegistryContract; - private _contractAddress?: string; - constructor(web3Wrapper: Web3Wrapper, contractAddress?: string) { + private _contractAddressIfExists?: string; + constructor(web3Wrapper: Web3Wrapper, contractAddressIfExists?: string) { super(web3Wrapper); - this._contractAddress = contractAddress; + this._contractAddressIfExists = contractAddressIfExists; } /** * Retrieves all the tokens currently listed in the Token Registry smart contract @@ -114,7 +114,7 @@ export class TokenRegistryWrapper extends ContractWrapper { return this._tokenRegistryContractIfExists; } const contractInstance = await this._instantiateContractIfExistsAsync( - artifacts.TokenRegistryArtifact, this._contractAddress, + artifacts.TokenRegistryArtifact, this._contractAddressIfExists, ); this._tokenRegistryContractIfExists = contractInstance as TokenRegistryContract; return this._tokenRegistryContractIfExists; -- cgit v1.2.3