diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-26 20:21:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-26 20:21:26 +0800 |
commit | b4f3450d4a3a5b2f80624cd07398958728517344 (patch) | |
tree | 57118196a8beb93d01837e662177a71dad4227a4 | |
parent | 109fc41474f5319a27052ab09234cc0426eb22ce (diff) | |
parent | 0a8b7cb49402d440df41ea0119f8a75d6f6c7a50 (diff) | |
download | dexon-sol-tools-b4f3450d4a3a5b2f80624cd07398958728517344.tar.gz dexon-sol-tools-b4f3450d4a3a5b2f80624cd07398958728517344.tar.zst dexon-sol-tools-b4f3450d4a3a5b2f80624cd07398958728517344.zip |
Merge pull request #479 from 0xProject/bug/website/portal-fill-mixed-decimals
Portal fill with rounding error/mixed decimals
-rw-r--r-- | packages/website/ts/components/fill_order.tsx | 6 | ||||
-rw-r--r-- | packages/website/ts/utils/utils.ts | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index a6144bd6b..ea94e0987 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -198,11 +198,13 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { symbol: takerToken.symbol, }; const parsedOrderExpiration = new BigNumber(this.state.parsedOrder.signedOrder.expirationUnixTimestampSec); - const exchangeRate = orderMakerAmount.div(orderTakerAmount); let orderReceiveAmount = 0; if (!_.isUndefined(this.props.orderFillAmount)) { - const orderReceiveAmountBigNumber = exchangeRate.mul(this.props.orderFillAmount); + const orderReceiveAmountBigNumber = orderMakerAmount + .times(this.props.orderFillAmount) + .dividedBy(orderTakerAmount) + .floor(); orderReceiveAmount = this._formatCurrencyAmount(orderReceiveAmountBigNumber, makerToken.decimals); } const isUserMaker = diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 25d7e449b..75597a7e2 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -219,7 +219,8 @@ export const utils = { [ExchangeContractErrs.OrderFillAmountZero]: "Order fill amount can't be 0", [ExchangeContractErrs.OrderRemainingFillAmountZero]: 'This order has already been completely filled or cancelled', - [ExchangeContractErrs.OrderFillRoundingError]: 'Rounding error will occur when filling this order', + [ExchangeContractErrs.OrderFillRoundingError]: + 'Rounding error will occur when filling this order. Please try filling a different amount.', [ExchangeContractErrs.InsufficientTakerBalance]: 'Taker no longer has a sufficient balance to complete this order', [ExchangeContractErrs.InsufficientTakerAllowance]: |