aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-03 00:10:06 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-03 00:10:06 +0800
commit76280dd5dbc5a5a2fb5f7230fa73d594f822c7e6 (patch)
tree3344c5c97af8ae6bb936a7d2074f6687a8c8904c /src
parent45fadeb690e27acccc776515ada8d39e3633194a (diff)
downloaddexon-sol-tools-76280dd5dbc5a5a2fb5f7230fa73d594f822c7e6.tar
dexon-sol-tools-76280dd5dbc5a5a2fb5f7230fa73d594f822c7e6.tar.gz
dexon-sol-tools-76280dd5dbc5a5a2fb5f7230fa73d594f822c7e6.tar.bz2
dexon-sol-tools-76280dd5dbc5a5a2fb5f7230fa73d594f822c7e6.tar.lz
dexon-sol-tools-76280dd5dbc5a5a2fb5f7230fa73d594f822c7e6.tar.xz
dexon-sol-tools-76280dd5dbc5a5a2fb5f7230fa73d594f822c7e6.tar.zst
dexon-sol-tools-76280dd5dbc5a5a2fb5f7230fa73d594f822c7e6.zip
Address feedback
Diffstat (limited to 'src')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts24
-rw-r--r--src/types.ts16
2 files changed, 20 insertions, 20 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 55ddcc46a..4aa532bdd 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -168,42 +168,42 @@ export class ExchangeWrapper extends ContractWrapper {
const takerAllowance = await this.tokenWrapper.getProxyAllowanceAsync(signedOrder.takerTokenAddress,
senderAddress);
- // How many taker tokens would you get for 1 maker token;
+ // exchangeRate is the price of one maker token denominated in taker tokens
const exchangeRate = signedOrder.takerTokenAmount.div(signedOrder.makerTokenAmount);
const fillMakerAmountInBaseUnits = fillTakerAmount.div(exchangeRate);
if (fillTakerAmount.greaterThan(takerBalance)) {
- throw new Error(ExchangeContractErrs.NOT_ENOUGH_TAKER_BALANCE);
+ throw new Error(ExchangeContractErrs.INSUFFICIENT_TAKER_BALANCE);
}
if (fillTakerAmount.greaterThan(takerAllowance)) {
- throw new Error(ExchangeContractErrs.NOT_ENOUGH_TAKER_ALLOWANCE);
+ throw new Error(ExchangeContractErrs.INSUFFICIENT_TAKER_ALLOWANCE);
}
if (fillMakerAmountInBaseUnits.greaterThan(makerBalance)) {
- throw new Error(ExchangeContractErrs.NOT_ENOUGH_MAKER_BALANCE);
+ throw new Error(ExchangeContractErrs.INSUFFICIENT_MAKER_BALANCE);
}
if (fillMakerAmountInBaseUnits.greaterThan(makerAllowance)) {
- throw new Error(ExchangeContractErrs.NOT_ENOUGH_MAKER_ALLOWANCE);
+ throw new Error(ExchangeContractErrs.INSUFFICIENT_MAKER_ALLOWANCE);
}
const makerFeeBalance = await this.tokenWrapper.getBalanceAsync(zrxTokenAddress,
- signedOrder.maker);
+ signedOrder.maker);
const takerFeeBalance = await this.tokenWrapper.getBalanceAsync(zrxTokenAddress, senderAddress);
const makerFeeAllowance = await this.tokenWrapper.getProxyAllowanceAsync(zrxTokenAddress,
- signedOrder.maker);
+ signedOrder.maker);
const takerFeeAllowance = await this.tokenWrapper.getProxyAllowanceAsync(zrxTokenAddress,
- senderAddress);
+ senderAddress);
if (signedOrder.takerFee.greaterThan(takerFeeBalance)) {
- throw new Error(ExchangeContractErrs.NOT_ENOUGH_TAKER_FEE_BALANCE);
+ throw new Error(ExchangeContractErrs.INSUFFICIENT_TAKER_FEE_BALANCE);
}
if (signedOrder.takerFee.greaterThan(takerFeeAllowance)) {
- throw new Error(ExchangeContractErrs.NOT_ENOUGH_TAKER_FEE_ALLOWANCE);
+ throw new Error(ExchangeContractErrs.INSUFFICIENT_TAKER_FEE_ALLOWANCE);
}
if (signedOrder.makerFee.greaterThan(makerFeeBalance)) {
- throw new Error(ExchangeContractErrs.NOT_ENOUGH_MAKER_FEE_BALANCE);
+ throw new Error(ExchangeContractErrs.INSUFFICIENT_MAKER_FEE_BALANCE);
}
if (signedOrder.makerFee.greaterThan(makerFeeAllowance)) {
- throw new Error(ExchangeContractErrs.NOT_ENOUGH_MAKER_FEE_ALLOWANCE);
+ throw new Error(ExchangeContractErrs.INSUFFICIENT_MAKER_FEE_ALLOWANCE);
}
}
private throwErrorLogsAsErrors(logs: ContractEvent[]): void {
diff --git a/src/types.ts b/src/types.ts
index 6cd5a93fe..f58fa035c 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -89,14 +89,14 @@ export const ExchangeContractErrs = strEnum([
'ORDER_REMAINING_FILL_AMOUNT_ZERO',
'ORDER_FILL_ROUNDING_ERROR',
'FILL_BALANCE_ALLOWANCE_ERROR',
- 'NOT_ENOUGH_TAKER_BALANCE',
- 'NOT_ENOUGH_TAKER_ALLOWANCE',
- 'NOT_ENOUGH_MAKER_BALANCE',
- 'NOT_ENOUGH_MAKER_ALLOWANCE',
- 'NOT_ENOUGH_TAKER_FEE_BALANCE',
- 'NOT_ENOUGH_TAKER_FEE_ALLOWANCE',
- 'NOT_ENOUGH_MAKER_FEE_BALANCE',
- 'NOT_ENOUGH_MAKER_FEE_ALLOWANCE',
+ 'INSUFFICIENT_TAKER_BALANCE',
+ 'INSUFFICIENT_TAKER_ALLOWANCE',
+ 'INSUFFICIENT_MAKER_BALANCE',
+ 'INSUFFICIENT_MAKER_ALLOWANCE',
+ 'INSUFFICIENT_TAKER_FEE_BALANCE',
+ 'INSUFFICIENT_TAKER_FEE_ALLOWANCE',
+ 'INSUFFICIENT_MAKER_FEE_BALANCE',
+ 'INSUFFICIENT_MAKER_FEE_ALLOWANCE',
'TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER',
]);