diff options
author | Fabio Berger <me@fabioberger.com> | 2017-09-26 21:29:44 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-09-26 21:29:44 +0800 |
commit | deac665b42739cf13db58c73fbf8e3f6624c34aa (patch) | |
tree | 860aac68a0ee3dd427d131545f2443b9799bfad9 /src/contract_wrappers | |
parent | fbac611337593b9bf03552637e709c45bdeee4ed (diff) | |
parent | 3c40526bffcccbad2a64f92f69f3b6ec63946c88 (diff) | |
download | dexon-sol-tools-deac665b42739cf13db58c73fbf8e3f6624c34aa.tar dexon-sol-tools-deac665b42739cf13db58c73fbf8e3f6624c34aa.tar.gz dexon-sol-tools-deac665b42739cf13db58c73fbf8e3f6624c34aa.tar.bz2 dexon-sol-tools-deac665b42739cf13db58c73fbf8e3f6624c34aa.tar.lz dexon-sol-tools-deac665b42739cf13db58c73fbf8e3f6624c34aa.tar.xz dexon-sol-tools-deac665b42739cf13db58c73fbf8e3f6624c34aa.tar.zst dexon-sol-tools-deac665b42739cf13db58c73fbf8e3f6624c34aa.zip |
Merge branch 'development' into addOrderValidation
* development:
Update comment
Add a test for getZRXTokenAddressAsync
Document changes in CHANGELOG
Make getZRXTokenAddressAsync public
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index c81e7919f..d2a3bcfa3 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -657,7 +657,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); assert.isBigNumber('fillTakerTokenAmount', fillTakerTokenAmount); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const zrxTokenAddress = await this._getZRXTokenAddressAsync(); + const zrxTokenAddress = await this.getZRXTokenAddressAsync(); await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync( signedOrder, fillTakerTokenAmount, takerAddress, zrxTokenAddress); } @@ -690,7 +690,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); assert.isBigNumber('fillTakerTokenAmount', fillTakerTokenAmount); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const zrxTokenAddress = await this._getZRXTokenAddressAsync(); + const zrxTokenAddress = await this.getZRXTokenAddressAsync(); await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync( signedOrder, fillTakerTokenAmount, takerAddress, zrxTokenAddress); } @@ -728,6 +728,15 @@ export class ExchangeWrapper extends ContractWrapper { throw new Error(errMessage); } } + /** + * Returns the ZRX token address used by the exchange contract. + * @return Address of ZRX token + */ + public async getZRXTokenAddressAsync(): Promise<string> { + const exchangeInstance = await this._getExchangeContractAsync(); + const ZRXtokenAddress = await exchangeInstance.ZRX_TOKEN_CONTRACT.callAsync(); + return ZRXtokenAddress; + } private async _invalidateContractInstancesAsync(): Promise<void> { await this.stopWatchingAllEventsAsync(); delete this._exchangeContractIfExists; @@ -765,11 +774,6 @@ export class ExchangeWrapper extends ContractWrapper { this._exchangeContractIfExists = contractInstance as ExchangeContract; return this._exchangeContractIfExists; } - private async _getZRXTokenAddressAsync(): Promise<string> { - const exchangeInstance = await this._getExchangeContractAsync(); - const ZRXtokenAddress = await exchangeInstance.ZRX_TOKEN_CONTRACT.callAsync(); - return ZRXtokenAddress; - } private async _getTokenTransferProxyAddressAsync(): Promise<string> { const exchangeInstance = await this._getExchangeContractAsync(); const tokenTransferProxyAddress = await exchangeInstance.TOKEN_TRANSFER_PROXY_CONTRACT.callAsync(); |