diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-25 18:00:02 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-29 16:01:13 +0800 |
commit | a6a16017997fbe53ac709f2f0d874e348da35621 (patch) | |
tree | 9c0bf98ddef5e9f073c7e5c795fc79eb2b9d3e35 /src/contract_wrappers | |
parent | a8fd3f30cf87660f08fa7b1c249606b7f8872ba1 (diff) | |
download | dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.gz dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.bz2 dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.lz dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.xz dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.zst dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.zip |
Allow user to specify the gas price
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r-- | src/contract_wrappers/contract_wrapper.ts | 7 | ||||
-rw-r--r-- | src/contract_wrappers/ether_token_wrapper.ts | 4 | ||||
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 4 | ||||
-rw-r--r-- | src/contract_wrappers/token_registry_wrapper.ts | 4 | ||||
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 4 |
5 files changed, 14 insertions, 9 deletions
diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts index 7efa229a5..015ed275a 100644 --- a/src/contract_wrappers/contract_wrapper.ts +++ b/src/contract_wrappers/contract_wrapper.ts @@ -6,11 +6,16 @@ import {utils} from '../utils/utils'; export class ContractWrapper { protected _web3Wrapper: Web3Wrapper; - constructor(web3Wrapper: Web3Wrapper) { + private _gasPrice: BigNumber.BigNumber; + constructor(web3Wrapper: Web3Wrapper, gasPrice: BigNumber.BigNumber) { this._web3Wrapper = web3Wrapper; + this._gasPrice = gasPrice; } protected async _instantiateContractIfExistsAsync(artifact: Artifact, address?: string): Promise<ContractInstance> { const c = await contract(artifact); + c.defaults({ + gasPrice: this._gasPrice, + }); const providerObj = this._web3Wrapper.getCurrentProvider(); c.setProvider(providerObj); diff --git a/src/contract_wrappers/ether_token_wrapper.ts b/src/contract_wrappers/ether_token_wrapper.ts index ee0ac2d8c..eae84feec 100644 --- a/src/contract_wrappers/ether_token_wrapper.ts +++ b/src/contract_wrappers/ether_token_wrapper.ts @@ -13,8 +13,8 @@ import * as EtherTokenArtifacts from '../artifacts/EtherToken.json'; export class EtherTokenWrapper extends ContractWrapper { private _etherTokenContractIfExists?: EtherTokenContract; private _tokenWrapper: TokenWrapper; - constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper) { - super(web3Wrapper); + constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, gasPrice: BigNumber.BigNumber) { + super(web3Wrapper, gasPrice); this._tokenWrapper = tokenWrapper; } /** diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index a01940f4b..8ae51da43 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -73,8 +73,8 @@ export class ExchangeWrapper extends ContractWrapper { ]; return [orderAddresses, orderValues]; } - constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper) { - super(web3Wrapper); + constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, gasPrice: BigNumber.BigNumber) { + super(web3Wrapper, gasPrice); this._tokenWrapper = tokenWrapper; this._orderValidationUtils = new OrderValidationUtils(tokenWrapper, this); this._exchangeLogEventEmitters = []; diff --git a/src/contract_wrappers/token_registry_wrapper.ts b/src/contract_wrappers/token_registry_wrapper.ts index 5fee1304e..5469b4a95 100644 --- a/src/contract_wrappers/token_registry_wrapper.ts +++ b/src/contract_wrappers/token_registry_wrapper.ts @@ -11,8 +11,8 @@ import * as TokenRegistryArtifacts from '../artifacts/TokenRegistry.json'; */ export class TokenRegistryWrapper extends ContractWrapper { private _tokenRegistryContractIfExists?: TokenRegistryContract; - constructor(web3Wrapper: Web3Wrapper) { - super(web3Wrapper); + constructor(web3Wrapper: Web3Wrapper, gasPrice: BigNumber.BigNumber) { + super(web3Wrapper, gasPrice); } /** * Retrieves all the tokens currently listed in the Token Registry smart contract diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 51490359e..24f56a24a 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -31,8 +31,8 @@ export class TokenWrapper extends ContractWrapper { public UNLIMITED_ALLOWANCE_IN_BASE_UNITS = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; private _tokenContractsByAddress: {[address: string]: TokenContract}; private _tokenLogEventEmitters: ContractEventEmitter[]; - constructor(web3Wrapper: Web3Wrapper) { - super(web3Wrapper); + constructor(web3Wrapper: Web3Wrapper, gasPrice: BigNumber.BigNumber) { + super(web3Wrapper, gasPrice); this._tokenContractsByAddress = {}; this._tokenLogEventEmitters = []; } |