Normalize token decimals before calculating exchange rate (#129)
This commit is contained in:
parent
02341f647b
commit
f87aa671a3
@ -258,10 +258,10 @@ class AddLiquidity extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
const { value: tokenValue } = selectors().getBalance(fromToken[token], token);
|
||||
const { value: tokenValue, decimals } = selectors().getBalance(fromToken[token], token);
|
||||
const { value: ethValue } = selectors().getBalance(fromToken[token], eth);
|
||||
|
||||
return tokenValue.dividedBy(ethValue);
|
||||
return tokenValue.multipliedBy(10 ** (18 - decimals)).dividedBy(ethValue);
|
||||
}
|
||||
|
||||
validate() {
|
||||
@ -368,7 +368,7 @@ class AddLiquidity extends Component {
|
||||
<div className="pool__summary-panel">
|
||||
<div className="pool__exchange-rate-wrapper">
|
||||
<span className="pool__exchange-rate">Exchange Rate</span>
|
||||
<span>{`1 ETH = ${tokenValue.dividedBy(ethValue).toFixed(4)} ${label}`}</span>
|
||||
<span>{`1 ETH = ${tokenValue.multipliedBy(10 ** (18 - decimals)).dividedBy(ethValue).toFixed(4)} ${label}`}</span>
|
||||
</div>
|
||||
<div className="pool__exchange-rate-wrapper">
|
||||
<span className="swap__exchange-rate">Current Pool Size</span>
|
||||
|
Loading…
Reference in New Issue
Block a user