fix 0 decimals bug
This commit is contained in:
parent
78cdf11b37
commit
c27cd98b33
@ -86,7 +86,12 @@ function addLiquidityStateReducer(state, action) {
|
|||||||
|
|
||||||
function getExchangeRate(inputValue, inputDecimals, outputValue, outputDecimals, invert = false) {
|
function getExchangeRate(inputValue, inputDecimals, outputValue, outputDecimals, invert = false) {
|
||||||
try {
|
try {
|
||||||
if (inputValue && inputDecimals && outputValue && outputDecimals) {
|
if (
|
||||||
|
inputValue &&
|
||||||
|
(inputDecimals || inputDecimals === 0) &&
|
||||||
|
outputValue &&
|
||||||
|
(outputDecimals || outputDecimals === 0)
|
||||||
|
) {
|
||||||
const factor = ethers.utils.bigNumberify(10).pow(ethers.utils.bigNumberify(18))
|
const factor = ethers.utils.bigNumberify(10).pow(ethers.utils.bigNumberify(18))
|
||||||
|
|
||||||
if (invert) {
|
if (invert) {
|
||||||
|
@ -27,7 +27,12 @@ const GAS_MARGIN = ethers.utils.bigNumberify(1000)
|
|||||||
|
|
||||||
function getExchangeRate(inputValue, inputDecimals, outputValue, outputDecimals, invert = false) {
|
function getExchangeRate(inputValue, inputDecimals, outputValue, outputDecimals, invert = false) {
|
||||||
try {
|
try {
|
||||||
if (inputValue && inputDecimals && outputValue && outputDecimals) {
|
if (
|
||||||
|
inputValue &&
|
||||||
|
(inputDecimals || inputDecimals === 0) &&
|
||||||
|
outputValue &&
|
||||||
|
(outputDecimals || outputDecimals === 0)
|
||||||
|
) {
|
||||||
const factor = ethers.utils.bigNumberify(10).pow(ethers.utils.bigNumberify(18))
|
const factor = ethers.utils.bigNumberify(10).pow(ethers.utils.bigNumberify(18))
|
||||||
|
|
||||||
if (invert) {
|
if (invert) {
|
||||||
|
@ -141,7 +141,12 @@ function swapStateReducer(state, action) {
|
|||||||
|
|
||||||
function getExchangeRate(inputValue, inputDecimals, outputValue, outputDecimals, invert = false) {
|
function getExchangeRate(inputValue, inputDecimals, outputValue, outputDecimals, invert = false) {
|
||||||
try {
|
try {
|
||||||
if (inputValue && inputDecimals && outputValue && outputDecimals) {
|
if (
|
||||||
|
inputValue &&
|
||||||
|
(inputDecimals || inputDecimals === 0) &&
|
||||||
|
outputValue &&
|
||||||
|
(outputDecimals || outputDecimals === 0)
|
||||||
|
) {
|
||||||
const factor = ethers.utils.bigNumberify(10).pow(ethers.utils.bigNumberify(18))
|
const factor = ethers.utils.bigNumberify(10).pow(ethers.utils.bigNumberify(18))
|
||||||
|
|
||||||
if (invert) {
|
if (invert) {
|
||||||
|
@ -139,7 +139,12 @@ function swapStateReducer(state, action) {
|
|||||||
|
|
||||||
function getExchangeRate(inputValue, inputDecimals, outputValue, outputDecimals, invert = false) {
|
function getExchangeRate(inputValue, inputDecimals, outputValue, outputDecimals, invert = false) {
|
||||||
try {
|
try {
|
||||||
if (inputValue && inputDecimals && outputValue && outputDecimals) {
|
if (
|
||||||
|
inputValue &&
|
||||||
|
(inputDecimals || inputDecimals === 0) &&
|
||||||
|
outputValue &&
|
||||||
|
(outputDecimals || outputDecimals === 0)
|
||||||
|
) {
|
||||||
const factor = ethers.utils.bigNumberify(10).pow(ethers.utils.bigNumberify(18))
|
const factor = ethers.utils.bigNumberify(10).pow(ethers.utils.bigNumberify(18))
|
||||||
|
|
||||||
if (invert) {
|
if (invert) {
|
||||||
|
Loading…
Reference in New Issue
Block a user