Portal fill with mixed decimals
When the token pair has different decimal precison we can end up with a remainder when multiplying by an exchange rate (as one is in 18 decimals and the other is 6 for example)
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 =
|
||||
|
||||
Reference in New Issue
Block a user