aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-02 01:47:22 +0800
committerFabio Berger <me@fabioberger.com>2017-06-02 01:47:22 +0800
commita1be87058536f5ab10c68c570c1b9994defe52b1 (patch)
tree935878b66d6588e4614efe32ac7052dcdb0bb447 /src
parentc42877327e59f983a83c7221f1bec5b31addf5a7 (diff)
downloaddexon-sol-tools-a1be87058536f5ab10c68c570c1b9994defe52b1.tar
dexon-sol-tools-a1be87058536f5ab10c68c570c1b9994defe52b1.tar.gz
dexon-sol-tools-a1be87058536f5ab10c68c570c1b9994defe52b1.tar.bz2
dexon-sol-tools-a1be87058536f5ab10c68c570c1b9994defe52b1.tar.lz
dexon-sol-tools-a1be87058536f5ab10c68c570c1b9994defe52b1.tar.xz
dexon-sol-tools-a1be87058536f5ab10c68c570c1b9994defe52b1.tar.zst
dexon-sol-tools-a1be87058536f5ab10c68c570c1b9994defe52b1.zip
Create a FillsScenario utils module and use it in the fillOrder tests
Diffstat (limited to 'src')
-rw-r--r--src/0x.js.ts2
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts10
-rw-r--r--src/types.ts4
3 files changed, 11 insertions, 5 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts
index a95bc3384..a613d5f48 100644
--- a/src/0x.js.ts
+++ b/src/0x.js.ts
@@ -120,7 +120,7 @@ export class ZeroEx {
/**
* Sets default account for sending transactions.
*/
- public setDefaultAccount(account: string): void {
+ public setTransactionSenderAccount(account: string): void {
this.web3Wrapper.setDefaultAccount(account);
}
/**
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index dc2c95d4e..eace55f4d 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -74,10 +74,10 @@ export class ExchangeWrapper extends ContractWrapper {
assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer);
const senderAddress = await this.web3Wrapper.getSenderAddressOrThrowAsync();
- const exchangeInstance = await this.getExchangeContractAsync();
-
await this.validateFillOrderAsync(signedOrder, fillTakerAmountInBaseUnits, senderAddress);
+ const exchangeInstance = await this.getExchangeContractAsync();
+
const orderAddresses: OrderAddresses = [
signedOrder.maker,
signedOrder.taker,
@@ -120,7 +120,8 @@ export class ExchangeWrapper extends ContractWrapper {
);
this.throwErrorLogsAsErrors(response.logs);
}
- private async validateFillOrderAsync(signedOrder: SignedOrder, fillAmount: BigNumber.BigNumber, senderAddress: string) {
+ private async validateFillOrderAsync(signedOrder: SignedOrder, fillAmount: BigNumber.BigNumber,
+ senderAddress: string) {
if (fillAmount.eq(0)) {
throw new Error(FillOrderValidationErrs.FILL_AMOUNT_IS_ZERO);
}
@@ -130,7 +131,8 @@ export class ExchangeWrapper extends ContractWrapper {
if (signedOrder.expirationUnixTimestampSec.lessThan(Date.now() / 1000)) {
throw new Error(FillOrderValidationErrs.EXPIRED);
}
- const makerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.makerTokenAddress, signedOrder.maker);
+ const makerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.makerTokenAddress,
+ signedOrder.maker);
const takerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.takerTokenAddress, senderAddress);
const makerAllowance = await this.tokenWrapper.getProxyAllowanceAsync(signedOrder.makerTokenAddress,
signedOrder.maker);
diff --git a/src/types.ts b/src/types.ts
index ad5d8fb17..f80f98dc4 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -138,3 +138,7 @@ export interface TxOpts {
from: string;
gas?: number;
}
+
+export interface TokenAddressBySymbol {
+ [symbol: string]: string;
+}