Merge pull request #479 from 0xProject/bug/website/portal-fill-mixed-decimals
Portal fill with rounding error/mixed decimals
This commit is contained in:
@@ -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 =
|
||||
|
@@ -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]:
|
||||
|
Reference in New Issue
Block a user